Skip to content

Commit a9ec9fb

Browse files
jamesequinlankwilczynski
authored andcommitted
PCI: brcmstb: Make two changes in MDIO register fields
The hardware has been updated with two changes to the MDIO packet format. The CMD field used to be 12 bits and now is only 1 bit. This change is backwards compatible because the field's starting bit position is unchanged, and the only commands we've used have values 0 and 1. The PORT field's width has been changed from 4 bits to 5 bits. When written, the new bit is not contiguous with the other four. However, this change is backwards compatible because the driver never used anything other than 0 for the port field's value. Thus, update the existing code to handle new changes to the hardware in a backwards-compatible manner. Signed-off-by: Jim Quinlan <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] [kwilczynski: commit log] Signed-off-by: Krzysztof Wilczyński <[email protected]>
1 parent 42fd45b commit a9ec9fb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/pci/controller/pcie-brcmstb.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,9 @@
175175
#define MDIO_PORT0 0x0
176176
#define MDIO_DATA_MASK 0x7fffffff
177177
#define MDIO_PORT_MASK 0xf0000
178+
#define MDIO_PORT_EXT_MASK 0x200000
178179
#define MDIO_REGAD_MASK 0xffff
179-
#define MDIO_CMD_MASK 0xfff00000
180+
#define MDIO_CMD_MASK 0x00100000
180181
#define MDIO_CMD_READ 0x1
181182
#define MDIO_CMD_WRITE 0x0
182183
#define MDIO_DATA_DONE_MASK 0x80000000
@@ -327,6 +328,7 @@ static u32 brcm_pcie_mdio_form_pkt(int port, int regad, int cmd)
327328
{
328329
u32 pkt = 0;
329330

331+
pkt |= FIELD_PREP(MDIO_PORT_EXT_MASK, port >> 4);
330332
pkt |= FIELD_PREP(MDIO_PORT_MASK, port);
331333
pkt |= FIELD_PREP(MDIO_REGAD_MASK, regad);
332334
pkt |= FIELD_PREP(MDIO_CMD_MASK, cmd);

0 commit comments

Comments
 (0)