Commit 6e6c651c authored by Adam Wujek's avatar Adam Wujek

main/i2c: use var block mode for UPTIME_SECS and TMR_ERROR_CNT

Thanks to this change the linux kernel may use PEC for these registers
in much easier way.

In pytest, update query flags for TEMP_CURVE_POINTS and TEMP_MATRIX_ROW
registers.
Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent b6492661
......@@ -176,9 +176,9 @@ Commands marked with \+ or \* are:
+----------+---------------------+------------------------+----------+-------------------------------------------------------------------------+
| D6 +* | UC_RESET_ | Byte write | 1 | reset the uC |
+----------+---------------------+------------------------+----------+-------------------------------------------------------------------------+
| D7 + | UPTIME_SECS_ | MultiByte read | 4 | get the uptime in seconds |
| D7 + | UPTIME_SECS_ | Block read | var(1+4) | get the uptime in seconds |
+----------+---------------------+------------------------+----------+-------------------------------------------------------------------------+
| D8 + | TMR_ERROR_CNT_ | MultiByte read | 4 | get TMR error count |
| D8 + | TMR_ERROR_CNT_ | Block read | var(1+4) | get TMR error count |
+----------+---------------------+------------------------+----------+-------------------------------------------------------------------------+
| D9 + | USE_PEC_ | Byte write / read | 1 | turn PEC on / off |
+----------+---------------------+------------------------+----------+-------------------------------------------------------------------------+
......@@ -195,6 +195,9 @@ Commands marked with \+ or \* are:
\* - supported by bootloader
Block registers contain in the first byte the size of data that follows.
This also applies to the registers with the fixed size like UPTIME_SECS_.
Detailed list of PMBus commands
-------------------------------
......@@ -635,25 +638,31 @@ UPTIME_SECS
~~~~~~~~~~~
| Command code: **D7**
| Transaction type: **Word read**
| Data length: **4**
| Transaction type: **Block read**
| Data length: **var(1+4)**
Get the uptime of the MoniMod (in seconds).
The fist byte of the register contains the number of bytes of data.
For this register, its value is fixed to 4.
.. _TMR_ERROR_CNT:
TMR_ERROR_CNT
~~~~~~~~~~~~~
| Command code: **D8**
| Transaction type: **Word read**
| Data length: **4**
| Transaction type: **Block read**
| Data length: **var(1+4)**
When software mitigation through COAST is enabled (see
:ref:`coast_sec`), one can access the TMR_ERROR_CNT counter using
this command. Setting `TMR Error` bit in STATUS_CML_ clears the value of this
register.
The fist byte of the register contains the number of bytes of data.
For this register, its value is fixed to 4.
.. _USE_PEC:
USE_PEC
......
......@@ -203,8 +203,8 @@ static const int8_t cmd_data_lengths[] = {
/* MFR specific commands */
[cmd_0xD5] = 1,
[cmd_0xD6] = 1,
[cmd_0xD7] = 4,
[cmd_0xD8] = 4,
[cmd_0xD7] = -((int8_t)sizeof(seconds_up)), /* no null char, no -1 */
[cmd_0xD8] = -((int8_t)sizeof(TMR_ERROR_CNT)), /* no null char, no -1 */
[cmd_0xD9] = 1,
[cmd_0xE0] = -((int8_t)sizeof(temp_curve_points_data)), /* no null char, no -1 */
[cmd_0xE1] = -((int8_t)sizeof(temp_matrix_row)), /* no null char, no -1 */
......@@ -245,8 +245,8 @@ static const cmd_t cmds_cmds[] = (cmd_t[]){
{0xAE, (int8_t *)&cmd_data_lengths[cmd_0xAE], (uint8_t *)&IC_DEVICE_REV, (fp_t)NULL, (fp_t)NULL, (fp_t)NULL, QUERY_RD | QUERY_FMT_NAN, 0},
{0xD5, (int8_t *)&cmd_data_lengths[cmd_0xD5], (uint8_t *)&fw_type, &get_fw_type, &boot_new_fw, (fp_t)NULL, QUERY_WR | QUERY_RD, 0},
{0xD6, (int8_t *)&cmd_data_lengths[cmd_0xD6], (uint8_t *)&reset_byte, (fp_t)NULL, &uc_reset, (fp_t)NULL, QUERY_WR, 0},
{0xD7, (int8_t *)&cmd_data_lengths[cmd_0xD7], (uint8_t *)&seconds_up, (fp_t)NULL, (fp_t)NULL, (fp_t)NULL, QUERY_RD, 0},
{0xD8, (int8_t *)&cmd_data_lengths[cmd_0xD8], (uint8_t *)&TMR_ERROR_CNT, (fp_t)NULL, (fp_t)NULL, (fp_t)NULL, QUERY_WR | QUERY_RD, 0},
{0xD7, (int8_t *)&cmd_data_lengths[cmd_0xD7], (uint8_t *)&seconds_up, (fp_t)NULL, (fp_t)NULL, (fp_t)NULL, QUERY_RD | QUERY_FMT_NAN, 0},
{0xD8, (int8_t *)&cmd_data_lengths[cmd_0xD8], (uint8_t *)&TMR_ERROR_CNT, (fp_t)NULL, (fp_t)NULL, (fp_t)NULL, QUERY_WR | QUERY_RD | QUERY_FMT_NAN,0},
{0xD9, (int8_t *)&cmd_data_lengths[cmd_0xD9], (uint8_t *)&use_pec_tmp, &get_pec, &set_pec, (fp_t)NULL, QUERY_WR | QUERY_RD, 1},
{0xE0, (int8_t *)&cmd_data_lengths[cmd_0xE0], (uint8_t *)&temp_curve_points_data, &get_tc_curve, &set_tc_curve, (fp_t)NULL, QUERY_WR | QUERY_RD | QUERY_FMT_NAN,0},
{0xE1, (int8_t *)&cmd_data_lengths[cmd_0xE1], (uint8_t *)&temp_matrix_row, &get_tc_matrix, &set_tc_matrix, (fp_t)NULL, QUERY_WR | QUERY_RD | QUERY_FMT_NAN,0},
......
......@@ -56,8 +56,8 @@ cmd_query = {
"LOCAL_FW_CHKSUM" : QUERY_SUP | QUERY_RD,
"BOOT_NEW_FW" : QUERY_SUP | QUERY_WR | QUERY_RD,
"UC_RESET" : QUERY_SUP | QUERY_WR,
"UPTIME_SECS" : QUERY_SUP | QUERY_RD,
"TMR_ERROR_CNT" : QUERY_SUP | QUERY_WR | QUERY_RD,
"UPTIME_SECS" : QUERY_SUP | QUERY_RD | QUERY_FMT_NAN,
"TMR_ERROR_CNT" : QUERY_SUP | QUERY_WR | QUERY_RD | QUERY_FMT_NAN,
"USE_PEC" : QUERY_SUP | QUERY_WR | QUERY_RD,
"TEMP_CURVE_POINTS" : QUERY_SUP | QUERY_WR | QUERY_RD | QUERY_FMT_NAN,
"TEMP_MATRIX_ROW" : QUERY_SUP | QUERY_WR | QUERY_RD | QUERY_FMT_NAN,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment