i2c-vr/xdpe1x2xx: General improvements and debugs
General improvements:
- Change const to constexpr for all kind of constants
- Add more product ids for the XDPE192XX
- Add info struct with device specific information.
- Add GetHWAddress function to get scratchpad address dynamically
- Add debug statements in multiple locations
- Add pcTime (process time) to mfrFWcmd functions parameter list\
- Add constants for different process times
- Change wait calls to milliseconds from microseconds
- Change co_return value types. Code had leftovers integer values, but
function returned bool already
Fix:
- Add missing bracket in `DataStartTag`
Tested locally with [81278]:
```
./xdpe1x2xx-manual-update vr_firmware.mic
CRC sum: 44b858d2
<7> configuration.sumExp = 0xffb60363
27Z 0xFFB60363/XV0 Config
0000000sing: //XV0 PMBus LoopA User
50505055ing: //XV0 PMBus LoopB User
07> Parsing: //XV0 FW SVI3 LoopA
07> Parsing: //XV0 FW SVI3 LoopB
00000000ing: [End Configuration Data]
<7> Value CRC: 2799942320
<7> Value CRC: 3852089771
<7> Value CRC: 4027591577
<7> Value CRC: 925496414
<7> Value CRC: 3114726333
<7> Scratchpad Address: 0x2005e000
<7> CRC before programming: 0x44b858d2
<7> CRC of configuration: 0xffb60363
<7> VR Device ID: 0x95
<7> VR Device Rev: 0x1
<7> Remaining write cycles of VR: 16
<7> Invalidate current Configuration
<7> Programming section: 0
<7> Section Type: 0x4
<7> Invalidating section type: 4
<7> Setting scratchpad address: 537255936
<7> Upload from scratch pad to OTP with soak time: 1600ms
<7> Programming section: 1
<7> Section Type: 0x7
<7> Invalidating section type: 7
<7> Setting scratchpad address: 537255936
<7> Upload from scratch pad to OTP with soak time: 700ms
<7> Programming section: 2
<7> Section Type: 0x9
<7> Invalidating section type: 9
<7> Setting scratchpad address: 537255936
<7> Upload from scratch pad to OTP with soak time: 700ms
<7> Programming section: 3
<7> Section Type: 0xd
<7> Invalidating section type: 13
<7> Setting scratchpad address: 537255936
<7> Upload from scratch pad to OTP with soak time: 300ms
<7> Programming section: 4
<7> Section Type: 0xe
<7> Invalidating section type: 14
<7> Setting scratchpad address: 537255936
<7> Upload from scratch pad to OTP with soak time: 300ms
CRC sum: ffb60363
```
Change-Id: I01f27a13cc9a245b23645e1aa56581ca92442e01
Signed-off-by: Christopher Meis <christopher.meis@9elements.com>
diff --git a/i2c-vr/xdpe1x2xx/xdpe1x2xx.hpp b/i2c-vr/xdpe1x2xx/xdpe1x2xx.hpp
index dfe3d47..56944f5 100644
--- a/i2c-vr/xdpe1x2xx/xdpe1x2xx.hpp
+++ b/i2c-vr/xdpe1x2xx/xdpe1x2xx.hpp
@@ -28,6 +28,16 @@
static const int MaxSectCnt = 16;
static const int MaxSectDataCnt = 200;
+ struct deviceInfo
+ {
+ uint8_t deviceId;
+ uint8_t deviceRev;
+ uint8_t remainingWrites;
+ uint32_t scratchPadAddress;
+ uint32_t actualCRC;
+ uint32_t configSize;
+ };
+
struct configSect
{
uint8_t type;
@@ -45,13 +55,14 @@
};
sdbusplus::async::task<bool> getDeviceId(uint8_t* deviceId);
- sdbusplus::async::task<bool> mfrFWcmd(uint8_t cmd, uint8_t* data,
- uint8_t* resp);
+ sdbusplus::async::task<bool> mfrFWcmd(uint8_t cmd, uint16_t processTime,
+ uint8_t* data, uint8_t* resp);
sdbusplus::async::task<bool> getRemainingWrites(uint8_t* remain);
sdbusplus::async::task<bool> program(bool force);
+ sdbusplus::async::task<bool> getScratchPadAddress();
- int parseImage(const uint8_t* image, size_t imageSize);
- int checkImage();
+ bool parseImage(const uint8_t* image, size_t imageSize);
+ bool checkImage();
static uint32_t calcCRC32(const uint32_t* data, int len);
static int getConfigSize(uint8_t deviceId, uint8_t revision);
@@ -59,6 +70,7 @@
phosphor::i2c::I2C i2cInterface;
+ struct deviceInfo info;
struct xdpe1x2xxConfig configuration;
};