Skip to content

Commit 0676bfe

Browse files
jhnikulaalexandrebelloni
authored andcommitted
i3c: mipi-i3c-hci: Fix DAT/DCT entry sizes
MIPI I3C HCI specification v1.1 describes the ENTRY_SIZE field for the Device Address Table (DAT) and the Device Characteristics Table (DCT) section offset registers (DAT_SECTION_OFFSET and DCT_SECTION_OFFSET). That field is not documented in earlier version. ENTRY_SIZE value 0 is meant to be backward compatible. For the DAT entry size it is interpreted as 2 DWORDs (8-bytes) and for the DCT entry size as 4 DWORDs (16-bytes). Values 1-15 are reserved for future use. New version I believe fixes also the TABLE_SIZE field description. Before it was defined in DWORDs which I believe is incorrect since the DAT/DCT table entry structures, and sizes, are described having 8-bytes/16-bytes entries. This is more clear in the specification v1.1 which states the TABLE_SIZE fields are interpreted as number of entries in the DAT/DCT tables. I believe this same holds also in earlier version, at least it makes more sense. Fix code accordingly and let the DAT_entry_size and the DCT_entry_size variables carry the size as bytes. Which is how it is already interpreted in the dat_v1.c: hci_dat_v1_init(). Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Link: https://lore.kernel.org/r/20230921055704.1087277-4-jarkko.nikula@linux.intel.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent f656f6b commit 0676bfe

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • drivers/i3c/master/mipi-i3c-hci

drivers/i3c/master/mipi-i3c-hci/core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -610,17 +610,17 @@ static int i3c_hci_init(struct i3c_hci *hci)
610610
offset = FIELD_GET(DAT_TABLE_OFFSET, regval);
611611
hci->DAT_regs = offset ? hci->base_regs + offset : NULL;
612612
hci->DAT_entries = FIELD_GET(DAT_TABLE_SIZE, regval);
613-
hci->DAT_entry_size = FIELD_GET(DAT_ENTRY_SIZE, regval);
613+
hci->DAT_entry_size = FIELD_GET(DAT_ENTRY_SIZE, regval) ? 0 : 8;
614614
dev_info(&hci->master.dev, "DAT: %u %u-bytes entries at offset %#x\n",
615-
hci->DAT_entries, hci->DAT_entry_size * 4, offset);
615+
hci->DAT_entries, hci->DAT_entry_size, offset);
616616

617617
regval = reg_read(DCT_SECTION);
618618
offset = FIELD_GET(DCT_TABLE_OFFSET, regval);
619619
hci->DCT_regs = offset ? hci->base_regs + offset : NULL;
620620
hci->DCT_entries = FIELD_GET(DCT_TABLE_SIZE, regval);
621-
hci->DCT_entry_size = FIELD_GET(DCT_ENTRY_SIZE, regval);
621+
hci->DCT_entry_size = FIELD_GET(DCT_ENTRY_SIZE, regval) ? 0 : 16;
622622
dev_info(&hci->master.dev, "DCT: %u %u-bytes entries at offset %#x\n",
623-
hci->DCT_entries, hci->DCT_entry_size * 4, offset);
623+
hci->DCT_entries, hci->DCT_entry_size, offset);
624624

625625
regval = reg_read(RING_HEADERS_SECTION);
626626
offset = FIELD_GET(RING_HEADERS_OFFSET, regval);

0 commit comments

Comments
 (0)