i2c-vr: add support for MPS MP292X VR firmware update over I2C
This commit introduces support for programming MPS MP292X VR devices
over the I2C bus. It enables firmware updates for VR models such as
MP2925 and MP2929.
Support for the MP292XFirmware type in EM was added in [1].
[1] https://gerrit.openbmc.org/c/openbmc/entity-manager/+/85159
Tested on the Yosemite5 platform:
1. Display the fw inventory
```
curl --silent $creds https://$bmc/redfish/v1/UpdateService/FirmwareInventory
```
```
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory",
"@odata.type": "#SoftwareInventoryCollection.SoftwareInventoryCollection",
"Members": [
{...},
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/Yosemite5_CXL_VR_P1V2_VDD_DDR_CH13_1427"
},
{...}
],
"Members@odata.count": 16,
"Name": "Software Inventory Collection"
}
```
2. Query version.
```
curl $creds https://$bmc/redfish/v1/UpdateService/FirmwareInventory/Yosemite5_CXL_VR_P1V2_VDD_DDR_CH13_1427
```
```
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/Yosemite5_CXL_VR_P1V2_VDD_DDR_CH13_1427",
"@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
"Description": "Other image",
"Id": "Yosemite5_CXL_VR_P1V2_VDD_DDR_CH13_1427",
"Name": "Software Inventory",
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "Enabled"
},
"Updateable": true,
"Version": "7F652B8C"
}
```
3. Trigger the fw update via redfish.
```
curl -k ${creds} \
-H "Content-Type:multipart/form-data" \
-X POST \
-F UpdateParameters="{\"Targets\":[\"/redfish/v1/UpdateService/FirmwareInventory/Yosemite5_CXL_VR_P1V2_VDD_DDR_CH13_1427\"],\"@Redfish.OperationApplyTime\":\"OnReset\"};type=application/json" \
-F "UpdateFile=@${fwpath};type=application/octet-stream" \
https://${bmc}/redfish/v1/UpdateService/update-multipart
```
4. Task is returned
```
{
"@odata.id": "/redfish/v1/TaskService/Tasks/0",
"@odata.type": "#Task.v1_4_3.Task",
"HidePayload": false,
"Id": "0",
"Messages": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The task with Id '0' has started.",
"MessageArgs": [
"0"
],
"MessageId": "TaskEvent.1.0.TaskStarted",
"MessageSeverity": "OK",
"Resolution": "None."
}
],
"Name": "Task 0",
"Payload": {
"HttpHeaders": [],
"HttpOperation": "POST",
"TargetUri": "/redfish/v1/UpdateService/update-multipart"
},
"PercentComplete": 0,
"StartTime": "2025-11-12T07:19:57+00:00",
"TaskMonitor": "/redfish/v1/TaskService/TaskMonitors/0",
"TaskState": "Running",
"TaskStatus": "OK"
}
```
5. Query Task status
```
curl --silent $creds https://$bmc/redfish/v1/TaskService/Tasks/0
```
```
{
"@odata.id": "/redfish/v1/TaskService/Tasks/0",
"@odata.type": "#Task.v1_4_3.Task",
"EndTime": "2025-11-12T07:20:31+00:00",
"HidePayload": false,
"Id": "0",
"Messages": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The task with Id '0' has started.",
"MessageArgs": [
"0"
],
"MessageId": "TaskEvent.1.0.TaskStarted",
"MessageSeverity": "OK",
"Resolution": "None."
},
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The task with Id '0' has changed to progress 50 percent complete.",
"MessageArgs": [
"0",
"50"
],
"MessageId": "TaskEvent.1.0.TaskProgressChanged",
"MessageSeverity": "OK",
"Resolution": "None."
},
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The task with Id '0' has changed to progress 100 percent complete.",
"MessageArgs": [
"0",
"100"
],
"MessageId": "TaskEvent.1.0.TaskProgressChanged",
"MessageSeverity": "OK",
"Resolution": "None."
},
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The task with Id '0' has completed.",
"MessageArgs": [
"0"
],
"MessageId": "TaskEvent.1.0.TaskCompletedOK",
"MessageSeverity": "OK",
"Resolution": "None."
}
],
"Name": "Task 0",
"Payload": {
"HttpHeaders": [],
"HttpOperation": "POST",
"JsonBody": "null",
"TargetUri": "/redfish/v1/UpdateService/update-multipart"
},
"PercentComplete": 100,
"StartTime": "2025-11-12T07:19:57+00:00",
"TaskMonitor": "/redfish/v1/TaskService/TaskMonitors/0",
"TaskState": "Completed",
"TaskStatus": "OK"
}
```
6. Display the fw inventory with newly updated fw.
```
curl --silent $creds https://$bmc/redfish/v1/UpdateService/FirmwareInventory
```
```
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory",
"@odata.type": "#SoftwareInventoryCollection.SoftwareInventoryCollection",
"Members": [
{...},
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/Yosemite5_CXL_VR_P1V2_VDD_DDR_CH13_1427"
},
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/Yosemite5_CXL_VR_P1V2_VDD_DDR_CH13_8152"
},
{...}
],
"Members@odata.count": 17,
"Name": "Software Inventory Collection"
}
```
7. Query the new fw version.
```
curl $creds https://$bmc/redfish/v1/UpdateService/FirmwareInventory/Yosemite5_CXL_VR_P1V2_VDD_DDR_CH13_8152
```
```
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/Yosemite5_CXL_VR_P1V2_VDD_DDR_CH13_8152",
"@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
"Description": "Other image",
"Id": "Yosemite5_CXL_VR_P1V2_VDD_DDR_CH13_8152",
"Name": "Software Inventory",
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "Enabled"
},
"Updateable": false,
"Version": "7F6588DF"
}
```
8. Do AC cycle to make sure the new fw is applied.
```
busctl set-property xyz.openbmc_project.State.Chassis0 /xyz/openbmc_project/state/chassis0 \
xyz.openbmc_project.State.Chassis RequestedPowerTransition s xyz.openbmc_project.State.Chassis.Transition.PowerCycle
```
9. Display the fw inventory after AC cycle.
```
curl --silent $creds https://$bmc/redfish/v1/UpdateService/FirmwareInventory
```
```
kevin@meta-device:~$ curl --silent $creds https://$bmc/redfish/v1/UpdateService/FirmwareInventory
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory",
"@odata.type": "#SoftwareInventoryCollection.SoftwareInventoryCollection",
"Members": [
{...},
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/Yosemite5_CXL_VR_P1V2_VDD_DDR_CH13_8379"
},
{...}
],
"Members@odata.count": 16,
"Name": "Software Inventory Collection"
}
```
10. Query the fw version after AC cycle.
```
curl $creds https://$bmc/redfish/v1/UpdateService/FirmwareInventory/Yosemite5_CXL_VR_P1V2_VDD_DDR_CH13_8379
```
```
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/Yosemite5_CXL_VR_P1V2_VDD_DDR_CH13_8379",
"@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
"Description": "Other image",
"Id": "Yosemite5_CXL_VR_P1V2_VDD_DDR_CH13_8379",
"Name": "Software Inventory",
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "Enabled"
},
"Updateable": true,
"Version": "7F6588DF"
}
```
Change-Id: I261a3b9619154860e0a636a633247965fea11032
Signed-off-by: Kevin Tung <kevin.tung.openbmc@gmail.com>
diff --git a/i2c-vr/mps/mpx9xx.hpp b/i2c-vr/mps/mpx9xx.hpp
new file mode 100644
index 0000000..3de9b17
--- /dev/null
+++ b/i2c-vr/mps/mpx9xx.hpp
@@ -0,0 +1,67 @@
+#pragma once
+
+#include "common/include/pmbus.hpp"
+#include "mps.hpp"
+
+namespace phosphor::software::VR
+{
+
+enum class MPX9XXCmd : uint8_t;
+
+/**
+ * @class MPX9XX
+ * @brief Base class for MPX9XX voltage regulators
+ *
+ * Provides common firmware update steps such as unlocking write protection,
+ * programming registers, storing/restoring NVM data, and CRC checks.
+ * Derived classes only need to provide the Config ID command.
+ */
+class MPX9XX : public MPSVoltageRegulator
+{
+ public:
+ MPX9XX(sdbusplus::async::context& ctx, uint16_t bus, uint16_t address) :
+ MPSVoltageRegulator(ctx, bus, address)
+ {}
+
+ sdbusplus::async::task<bool> verifyImage(const uint8_t* image,
+ size_t imageSize) final;
+ sdbusplus::async::task<bool> updateFirmware(bool force) final;
+ sdbusplus::async::task<bool> getCRC(uint32_t* checksum) final;
+ sdbusplus::async::task<bool> parseDeviceConfiguration() final;
+ bool forcedUpdateAllowed() final;
+
+ private:
+ sdbusplus::async::task<bool> checkId(MPX9XXCmd idCmd, uint32_t expected);
+ sdbusplus::async::task<bool> unlockWriteProtect();
+ sdbusplus::async::task<bool> disableStoreFaultTriggering();
+ sdbusplus::async::task<bool> setMultiConfigAddress(uint8_t config);
+ sdbusplus::async::task<bool> programConfigData(
+ const std::vector<MPSData>& gdata);
+ sdbusplus::async::task<bool> programAllRegisters();
+ sdbusplus::async::task<bool> storeDataIntoMTP();
+ sdbusplus::async::task<bool> restoreDataFromNVM();
+ sdbusplus::async::task<bool> checkMTPCRC();
+
+ protected:
+ virtual MPX9XXCmd getConfigIdCmd() const = 0;
+};
+
+class MP292X : public MPX9XX
+{
+ public:
+ using MPX9XX::MPX9XX;
+
+ protected:
+ MPX9XXCmd getConfigIdCmd() const final;
+};
+
+class MP994X : public MPX9XX
+{
+ public:
+ using MPX9XX::MPX9XX;
+
+ protected:
+ MPX9XXCmd getConfigIdCmd() const final;
+};
+
+} // namespace phosphor::software::VR