Message ID | 20171030215753.13917-1-lukma@denx.de |
---|---|
State | Accepted |
Commit | ce27eb9b40594857a60cbff4763bc6a12e1118d3 |
Delegated to: | Joe Hershberger |
Headers | show |
Series | [U-Boot,v3] net: phy: marvell: Add functions to read PHY's extended registers | expand |
On 10/30/2017 02:58 PM, Lukasz Majewski wrote: > This commit allows extended Marvell registers to be read with: > > foo > mdio rx FEC 3.10 > Reading from bus FEC > PHY at address 0: > 3.16 - 0x1063 > foo > mdio wx FEC 3.10 0x1011 > > The above code changes the way ETH connector LEDs blink. > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > > --- > > Changes in v3: > - Enable extended registers access only for 88E151x family of PHYs > > Changes in v2: > - Provide the readext and writeext callbacks to other marvell ETH PHY > devices > Reviewed-by: York Sun <york.sun@nxp.com>
Hi Joe, > On 10/30/2017 02:58 PM, Lukasz Majewski wrote: > > This commit allows extended Marvell registers to be read with: > > > > foo > mdio rx FEC 3.10 > > Reading from bus FEC > > PHY at address 0: > > 3.16 - 0x1063 > > foo > mdio wx FEC 3.10 0x1011 > > > > The above code changes the way ETH connector LEDs blink. > > > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > > > > --- > > > > Changes in v3: > > - Enable extended registers access only for 88E151x family of > > PHYs > > > > Changes in v2: > > - Provide the readext and writeext callbacks to other marvell > > ETH PHY devices > > > > Reviewed-by: York Sun <york.sun@nxp.com> Would it be possible to add this patch to your next u-boot-net PR? Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
On Mon, Oct 30, 2017 at 4:57 PM, Lukasz Majewski <lukma@denx.de> wrote: > This commit allows extended Marvell registers to be read with: > > foo > mdio rx FEC 3.10 > Reading from bus FEC > PHY at address 0: > 3.16 - 0x1063 > foo > mdio wx FEC 3.10 0x1011 > > The above code changes the way ETH connector LEDs blink. > > Signed-off-by: Lukasz Majewski <lukma@denx.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Hi Lukasz, https://patchwork.ozlabs.org/patch/832191/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git Thanks! -Joe
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index b7f300e40f..0b9a9fce8a 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -104,6 +104,31 @@ #define MIIM_88E151x_MODE_SGMII 1 #define MIIM_88E151x_RESET_OFFS 15 +static int m88e1xxx_phy_extread(struct phy_device *phydev, int addr, + int devaddr, int regnum) +{ + int oldpage = phy_read(phydev, MDIO_DEVAD_NONE, MII_MARVELL_PHY_PAGE); + int val; + + phy_write(phydev, MDIO_DEVAD_NONE, MII_MARVELL_PHY_PAGE, devaddr); + val = phy_read(phydev, MDIO_DEVAD_NONE, regnum); + phy_write(phydev, MDIO_DEVAD_NONE, MII_MARVELL_PHY_PAGE, oldpage); + + return val; +} + +static int m88e1xxx_phy_extwrite(struct phy_device *phydev, int addr, + int devaddr, int regnum, u16 val) +{ + int oldpage = phy_read(phydev, MDIO_DEVAD_NONE, MII_MARVELL_PHY_PAGE); + + phy_write(phydev, MDIO_DEVAD_NONE, MII_MARVELL_PHY_PAGE, devaddr); + phy_write(phydev, MDIO_DEVAD_NONE, regnum, val); + phy_write(phydev, MDIO_DEVAD_NONE, MII_MARVELL_PHY_PAGE, oldpage); + + return 0; +} + /* Marvell 88E1011S */ static int m88e1011s_config(struct phy_device *phydev) { @@ -669,6 +694,8 @@ static struct phy_driver M88E1510_driver = { .config = &m88e1510_config, .startup = &m88e1011s_startup, .shutdown = &genphy_shutdown, + .readext = &m88e1xxx_phy_extread, + .writeext = &m88e1xxx_phy_extwrite, }; /* @@ -684,6 +711,8 @@ static struct phy_driver M88E1518_driver = { .config = &m88e1518_config, .startup = &m88e1011s_startup, .shutdown = &genphy_shutdown, + .readext = &m88e1xxx_phy_extread, + .writeext = &m88e1xxx_phy_extwrite, }; static struct phy_driver M88E1310_driver = {
This commit allows extended Marvell registers to be read with: foo > mdio rx FEC 3.10 Reading from bus FEC PHY at address 0: 3.16 - 0x1063 foo > mdio wx FEC 3.10 0x1011 The above code changes the way ETH connector LEDs blink. Signed-off-by: Lukasz Majewski <lukma@denx.de> --- Changes in v3: - Enable extended registers access only for 88E151x family of PHYs Changes in v2: - Provide the readext and writeext callbacks to other marvell ETH PHY devices drivers/net/phy/marvell.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)