]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: brcmstb: Make two changes in MDIO register fields
authorJim Quinlan <james.quinlan@broadcom.com>
Fri, 14 Feb 2025 17:39:35 +0000 (12:39 -0500)
committerKrzysztof Wilczyński <kwilczynski@kernel.org>
Tue, 4 Mar 2025 16:03:04 +0000 (16:03 +0000)
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 <james.quinlan@broadcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20250214173944.47506-8-james.quinlan@broadcom.com
[kwilczynski: commit log]
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
drivers/pci/controller/pcie-brcmstb.c

index 76f51352709e913a67b2d249fb1e907735df7912..ab25f674800d3c0e51b4217679be9b4719f18e39 100644 (file)
 #define MDIO_PORT0                     0x0
 #define MDIO_DATA_MASK                 0x7fffffff
 #define MDIO_PORT_MASK                 0xf0000
+#define MDIO_PORT_EXT_MASK             0x200000
 #define MDIO_REGAD_MASK                        0xffff
-#define MDIO_CMD_MASK                  0xfff00000
+#define MDIO_CMD_MASK                  0x00100000
 #define MDIO_CMD_READ                  0x1
 #define MDIO_CMD_WRITE                 0x0
 #define MDIO_DATA_DONE_MASK            0x80000000
@@ -327,6 +328,7 @@ static u32 brcm_pcie_mdio_form_pkt(int port, int regad, int cmd)
 {
        u32 pkt = 0;
 
+       pkt |= FIELD_PREP(MDIO_PORT_EXT_MASK, port >> 4);
        pkt |= FIELD_PREP(MDIO_PORT_MASK, port);
        pkt |= FIELD_PREP(MDIO_REGAD_MASK, regad);
        pkt |= FIELD_PREP(MDIO_CMD_MASK, cmd);