From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] net: phy: marvell: Add functions to read PHY's extended registers
Date: Mon, 30 Oct 2017 11:34:08 +0100 [thread overview]
Message-ID: <20171030113408.7d0721b4@jawa> (raw)
In-Reply-To: <HE1PR04MB20731772CAE5372B1905B8B89A5A0@HE1PR04MB2073.eurprd04.prod.outlook.com>
Hi York,
> On 10/27/2017 08:23 AM, Lukasz Majewski wrote:
> > On Fri, 27 Oct 2017 15:06:37 +0000
> > York Sun <york.sun@nxp.com> wrote:
> >
> >> On 10/27/2017 02:12 AM, 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 v2:
> >>> - Provide the readext and writeext callbacks to other marvell ETH
> >>> PHY devices
> >>>
> >>> drivers/net/phy/marvell.c | 47
> >>> +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47
> >>> insertions(+)
> >>>
> >>> diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
> >>> index b7f300e..19f451d 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);
>
> For register 30 and 31, the page register is 29, not 22.
Yes, for 88E1145 and 88E1149 the page register is 29, not 22 (as it is
in majority of devices from marvell.c file in u-boot).
It seems like the most practical approach would be as presented in
patch v1 - just enable this code on PHY which I can test.
If you find other devices (boards) and test the code, then we can add
it as well.
> >>> + 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)
> >>> {
> >>> @@ -599,6 +624,8 @@ static struct phy_driver M88E1011S_driver = {
> >>> .config = &m88e1011s_config,
> >>> .startup = &m88e1011s_startup,
> >>> .shutdown = &genphy_shutdown,
> >>> + .readext = &m88e1xxx_phy_extread,
> >>> + .writeext = &m88e1xxx_phy_extwrite,
> >>> };
> >>>
> >>
> >> Lukasz,
> >>
> >> This seems wrong. 88E1011S doesn't have the page register.
> >
> > Ok. I will remove this one from v3.
> >
> >> I can only
> >> confirm 88E1111 and 88E1145 have pages.
> >
> > I do know that it works on 88E151x
> >
> > The 88E1318 and 88E1618 seems to be unknown.
> >
> >> I don't have other part's
> >> datasheet to check.
> >
>
> I suggest only to enable the parts you can confirm on hardware,
> datasheet, or from the source code (where the page register is used).
>
> York
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 at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171030/edd7b7fe/attachment.sig>
next prev parent reply other threads:[~2017-10-30 10:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-27 9:12 [U-Boot] [PATCH v2] net: phy: marvell: Add functions to read PHY's extended registers Lukasz Majewski
2017-10-27 15:06 ` York Sun
2017-10-27 15:23 ` Lukasz Majewski
2017-10-27 15:28 ` York Sun
2017-10-28 21:46 ` Lukasz Majewski
2017-10-30 10:34 ` Lukasz Majewski [this message]
2017-10-30 14:56 ` York Sun
2017-10-30 21:57 ` [U-Boot] [PATCH v3] " Lukasz Majewski
2017-10-30 22:16 ` York Sun
2017-11-17 10:06 ` Lukasz Majewski
2017-12-05 20:20 ` Joe Hershberger
2018-01-22 16:49 ` [U-Boot] " Joe Hershberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171030113408.7d0721b4@jawa \
--to=lukma@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox