net: phy: disregard "Clause 22 registers present" bit in get_phy_c45_devs_in_pkg
Subsystems (3)
Heiner Kallweit
maintainerPATCH v2 1/1 net: phy: disregard "Clause 22 registers present" bit in get_phy_c45_devs_in_pkg
Bit 0 in register 1.5 doesn't represent a device but is a flag that Clause 22 registers are present. Therefore disregard this bit when populating the device list. If code needs this information it should read register 1.5 directly instead of accessing the device list.
Because this bit doesn't represent a device don't define a MDIO_MMD_XYZ constant, just define a MDIO_DEVS_XYZ constant for the flag in the device list bitmap.
v2:
- make masking of bit 0 more explicit
- improve commit message
--- drivers/net/phy/phy_device.c | 3 +++ include/uapi/linux/mdio.h | 1 + 2 files changed, 4 insertions(+)
drivers/net/phy/phy_device.c +3 -0
@@ -684,6 +684,9 @@ static int get_phy_c45_devs_in_pkg(struct mii_bus *bus, int addr, int dev_addr,return -EIO ; *devices_in_package |= (phy_reg &0xffff ); +/* Bit 0 doesn't represent a device, it indicates c22 regs presence */ + *devices_in_package &= ~BIT (0 ); +return 0 ; }
include/uapi/linux/mdio.h +1 -0
@@ -115,6 +115,7 @@/* Device present registers. */ #define MDIO_DEVS_PRESENT (devad) (1 << (devad)) +#define MDIO_DEVS_C22PRESENT MDIO_DEVS_PRESENT(0)#define MDIO_DEVS_PMAPMD MDIO_DEVS_PRESENT(MDIO_MMD_PMAPMD)#define MDIO_DEVS_WIS MDIO_DEVS_PRESENT(MDIO_MMD_WIS)#define MDIO_DEVS_PCS MDIO_DEVS_PRESENT(MDIO_MMD_PCS)
Signature · 1 line
2.20.1
From: Heiner Kallweit <[email protected]>
Date: Fri, 8 Feb 2019 19:25:22 +0100
Quoted 9 lines
Bit 0 in register 1.5 doesn't represent a device but is a flag that Clause 22 registers are present. Therefore disregard this bit when populating the device list. If code needs this information it should read register 1.5 directly instead of accessing the device list.
Because this bit doesn't represent a device don't define aMDIO_MMD_XYZconstant, just define aMDIO_DEVS_XYZconstant for the flag in the device list bitmap.
Quoted 5 lines
v2:
- make masking of bit 0 more explicit
- improve commit messageSigned-off-by Heiner Kallweit <[email protected]>
Applied, thanks Heiner.
Heiner Kallweit
maintainerQuoted 16 lines · David Miller
From: Heiner Kallweit <[email protected]>
Date: Fri, 8 Feb 2019 19:25:22 +0100Quoted 13 lines
Bit 0 in register 1.5 doesn't represent a device but is a flag that Clause 22 registers are present. Therefore disregard this bit when populating the device list. If code needs this information it should read register 1.5 directly instead of accessing the device list.
Because this bit doesn't represent a device don't define aMDIO_MMD_XYZconstant, just define aMDIO_DEVS_XYZconstant for the flag in the device list bitmap.v2:
- make masking of bit 0 more explicit
- improve commit message
Andrew had few further review comments and based on that I prepared a v3, this time as series of three patches. What you just applied was splitted to two patches and patch 1 is new. But this shouldn't be a big deal. We can keep what was applied and I will rebase patch 1 and resubmit it.
Quoted 4 lines
Quoted 1 line
Signed-off-by Heiner Kallweit <[email protected]>Applied, thanks Heiner.
Heiner