* [PATCH] net/phy: refactor RTL8211F initialization
@ 2015-04-22 10:22 Shengzhou Liu
2015-04-22 16:57 ` Florian Fainelli
2015-04-23 14:42 ` Joe Hershberger
0 siblings, 2 replies; 8+ messages in thread
From: Shengzhou Liu @ 2015-04-22 10:22 UTC (permalink / raw)
To: netdev, joe.hershberger; +Cc: Shengzhou Liu
RTL8211F needs to enalbe TXDLY for RGMII during
phy initialization, so move it to rtl8211f_config
for early initialization.
Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
cc: Joe Hershberger <joe.hershberger@gmail.com>
---
drivers/net/phy/realtek.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index 3917c82..d48095b 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -43,6 +43,22 @@ static int rtl8211x_config(struct phy_device *phydev)
return 0;
}
+static int rtl8211f_config(struct phy_device *phydev)
+{
+ phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
+
+ if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
+ /* enable TXDLY */
+ phy_write(phydev, MDIO_DEVAD_NONE,
+ MIIM_RTL8211F_PAGE_SELECT, 0xd08);
+ phy_write(phydev, MDIO_DEVAD_NONE, 0x11, 0x109);
+ }
+
+ genphy_config_aneg(phydev);
+
+ return 0;
+}
+
static int rtl8211x_parse_status(struct phy_device *phydev)
{
unsigned int speed;
@@ -142,13 +158,6 @@ static int rtl8211f_parse_status(struct phy_device *phydev)
phydev->speed = SPEED_10;
}
- if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
- /* enable TXDLY */
- phy_write(phydev, MDIO_DEVAD_NONE,
- MIIM_RTL8211F_PAGE_SELECT, 0xd08);
- phy_write(phydev, MDIO_DEVAD_NONE, 0x11, 0x109);
- }
-
return 0;
}
@@ -209,7 +218,7 @@ static struct phy_driver RTL8211F_driver = {
.uid = 0x1cc916,
.mask = 0xffffff,
.features = PHY_GBIT_FEATURES,
- .config = &rtl8211x_config,
+ .config = &rtl8211f_config,
.startup = &rtl8211f_startup,
.shutdown = &genphy_shutdown,
};
--
2.1.0.27.g96db324
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] net/phy: refactor RTL8211F initialization
2015-04-22 10:22 [PATCH] net/phy: refactor RTL8211F initialization Shengzhou Liu
@ 2015-04-22 16:57 ` Florian Fainelli
2015-04-23 3:53 ` Shengzhou.Liu
2015-04-23 14:42 ` Joe Hershberger
1 sibling, 1 reply; 8+ messages in thread
From: Florian Fainelli @ 2015-04-22 16:57 UTC (permalink / raw)
To: Shengzhou Liu, netdev, joe.hershberger
On 22/04/15 03:22, Shengzhou Liu wrote:
> RTL8211F needs to enalbe TXDLY for RGMII during
> phy initialization, so move it to rtl8211f_config
> for early initialization.
>
> Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
> cc: Joe Hershberger <joe.hershberger@gmail.com>
> ---
> drivers/net/phy/realtek.c | 25 +++++++++++++++++--------
> 1 file changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> index 3917c82..d48095b 100644
> --- a/drivers/net/phy/realtek.c
> +++ b/drivers/net/phy/realtek.c
> @@ -43,6 +43,22 @@ static int rtl8211x_config(struct phy_device *phydev)
> return 0;
> }
>
> +static int rtl8211f_config(struct phy_device *phydev)
> +{
> + phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
That part of the change is not documented but has to be, and you should
use genphy_soft_reset() which also takes care of waiting the required
amount of time before BMCR_RESET is cleared.
> +
> + if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
> + /* enable TXDLY */
> + phy_write(phydev, MDIO_DEVAD_NONE,
> + MIIM_RTL8211F_PAGE_SELECT, 0xd08);
> + phy_write(phydev, MDIO_DEVAD_NONE, 0x11, 0x109);
Do you need to reset the page selector somehow after this write?
> + }
> +
> + genphy_config_aneg(phydev);
> +
> + return 0;
> +}
> +
> static int rtl8211x_parse_status(struct phy_device *phydev)
> {
> unsigned int speed;
> @@ -142,13 +158,6 @@ static int rtl8211f_parse_status(struct phy_device *phydev)
> phydev->speed = SPEED_10;
> }
>
> - if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
> - /* enable TXDLY */
> - phy_write(phydev, MDIO_DEVAD_NONE,
> - MIIM_RTL8211F_PAGE_SELECT, 0xd08);
> - phy_write(phydev, MDIO_DEVAD_NONE, 0x11, 0x109);
> - }
> -
> return 0;
> }
>
> @@ -209,7 +218,7 @@ static struct phy_driver RTL8211F_driver = {
> .uid = 0x1cc916,
> .mask = 0xffffff,
> .features = PHY_GBIT_FEATURES,
> - .config = &rtl8211x_config,
> + .config = &rtl8211f_config,
> .startup = &rtl8211f_startup,
> .shutdown = &genphy_shutdown,
> };
>
--
Florian
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] net/phy: refactor RTL8211F initialization
2015-04-22 16:57 ` Florian Fainelli
@ 2015-04-23 3:53 ` Shengzhou.Liu
2015-04-23 4:39 ` Florian Fainelli
0 siblings, 1 reply; 8+ messages in thread
From: Shengzhou.Liu @ 2015-04-23 3:53 UTC (permalink / raw)
To: Florian Fainelli, netdev, joe.hershberger
> -----Original Message-----
> From: Florian Fainelli [mailto:f.fainelli@gmail.com]
> Sent: Thursday, April 23, 2015 12:57 AM
> To: Liu Shengzhou-B36685; netdev@vger.kernel.org; joe.hershberger@gmail.com
> Subject: Re: [PATCH] net/phy: refactor RTL8211F initialization
>
> On 22/04/15 03:22, Shengzhou Liu wrote:
> > RTL8211F needs to enalbe TXDLY for RGMII during phy initialization, so
> > move it to rtl8211f_config for early initialization.
> >
> > Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
> > cc: Joe Hershberger <joe.hershberger@gmail.com>
> > ---
> > drivers/net/phy/realtek.c | 25 +++++++++++++++++--------
> > 1 file changed, 17 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> > index 3917c82..d48095b 100644
> > --- a/drivers/net/phy/realtek.c
> > +++ b/drivers/net/phy/realtek.c
> > @@ -43,6 +43,22 @@ static int rtl8211x_config(struct phy_device *phydev)
> > return 0;
> > }
> >
> > +static int rtl8211f_config(struct phy_device *phydev) {
> > + phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
>
> That part of the change is not documented but has to be, and you should use
> genphy_soft_reset() which also takes care of waiting the required amount of
> time before BMCR_RESET is cleared.
There is no genphy_soft_reset() in current u-boot tree.
> > +
> > + if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
> > + /* enable TXDLY */
> > + phy_write(phydev, MDIO_DEVAD_NONE,
> > + MIIM_RTL8211F_PAGE_SELECT, 0xd08);
> > + phy_write(phydev, MDIO_DEVAD_NONE, 0x11, 0x109);
>
> Do you need to reset the page selector somehow after this write?
Actually no need to reset the page selector.
> > + }
> > +
> > + genphy_config_aneg(phydev);
> > +
> > + return 0;
> > +}
> > +
> > static int rtl8211x_parse_status(struct phy_device *phydev) {
> > unsigned int speed;
> > @@ -142,13 +158,6 @@ static int rtl8211f_parse_status(struct phy_device
> *phydev)
> > phydev->speed = SPEED_10;
> > }
> >
> > - if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
> > - /* enable TXDLY */
> > - phy_write(phydev, MDIO_DEVAD_NONE,
> > - MIIM_RTL8211F_PAGE_SELECT, 0xd08);
> > - phy_write(phydev, MDIO_DEVAD_NONE, 0x11, 0x109);
> > - }
> > -
> > return 0;
> > }
> >
> > @@ -209,7 +218,7 @@ static struct phy_driver RTL8211F_driver = {
> > .uid = 0x1cc916,
> > .mask = 0xffffff,
> > .features = PHY_GBIT_FEATURES,
> > - .config = &rtl8211x_config,
> > + .config = &rtl8211f_config,
> > .startup = &rtl8211f_startup,
> > .shutdown = &genphy_shutdown,
> > };
> >
>
>
> --
> Florian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] net/phy: refactor RTL8211F initialization
2015-04-23 3:53 ` Shengzhou.Liu
@ 2015-04-23 4:39 ` Florian Fainelli
2015-04-23 5:58 ` Shengzhou.Liu
0 siblings, 1 reply; 8+ messages in thread
From: Florian Fainelli @ 2015-04-23 4:39 UTC (permalink / raw)
To: Shengzhou.Liu, netdev, joe.hershberger
Le 22/04/2015 20:53, Shengzhou.Liu@freescale.com a écrit :
>> -----Original Message-----
>> From: Florian Fainelli [mailto:f.fainelli@gmail.com]
>> Sent: Thursday, April 23, 2015 12:57 AM
>> To: Liu Shengzhou-B36685; netdev@vger.kernel.org; joe.hershberger@gmail.com
>> Subject: Re: [PATCH] net/phy: refactor RTL8211F initialization
>>
>> On 22/04/15 03:22, Shengzhou Liu wrote:
>>> RTL8211F needs to enalbe TXDLY for RGMII during phy initialization, so
>>> move it to rtl8211f_config for early initialization.
>>>
>>> Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
>>> cc: Joe Hershberger <joe.hershberger@gmail.com>
>>> ---
>>> drivers/net/phy/realtek.c | 25 +++++++++++++++++--------
>>> 1 file changed, 17 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
>>> index 3917c82..d48095b 100644
>>> --- a/drivers/net/phy/realtek.c
>>> +++ b/drivers/net/phy/realtek.c
>>> @@ -43,6 +43,22 @@ static int rtl8211x_config(struct phy_device *phydev)
>>> return 0;
>>> }
>>>
>>> +static int rtl8211f_config(struct phy_device *phydev) {
>>> + phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
>>
>> That part of the change is not documented but has to be, and you should use
>> genphy_soft_reset() which also takes care of waiting the required amount of
>> time before BMCR_RESET is cleared.
>
> There is no genphy_soft_reset() in current u-boot tree.
Did you mean to submit that against u-boot or Linux? If the latter,
there is absolutely no need to have the same file compile under u-boot
and Linux without changes, that is too restrictive. There is a
genphy_soft_reset() which takes care of waiting for BMCR_RESET to clear,
please use it, there is no guarantee otherwise that a PHY has completed
a reset.
--
Florian
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] net/phy: refactor RTL8211F initialization
2015-04-23 4:39 ` Florian Fainelli
@ 2015-04-23 5:58 ` Shengzhou.Liu
2015-04-23 14:42 ` [U-Boot] " Joe Hershberger
0 siblings, 1 reply; 8+ messages in thread
From: Shengzhou.Liu @ 2015-04-23 5:58 UTC (permalink / raw)
To: Florian Fainelli, netdev, joe.hershberger
> -----Original Message-----
> From: Florian Fainelli [mailto:f.fainelli@gmail.com]
> Sent: Thursday, April 23, 2015 12:39 PM
> To: Liu Shengzhou-B36685; netdev@vger.kernel.org; joe.hershberger@gmail.com
> Subject: Re: [PATCH] net/phy: refactor RTL8211F initialization
>
> Le 22/04/2015 20:53, Shengzhou.Liu@freescale.com a écrit :
> >> -----Original Message-----
> >> From: Florian Fainelli [mailto:f.fainelli@gmail.com]
> >> Sent: Thursday, April 23, 2015 12:57 AM
> >> To: Liu Shengzhou-B36685; netdev@vger.kernel.org;
> >> joe.hershberger@gmail.com
> >> Subject: Re: [PATCH] net/phy: refactor RTL8211F initialization
> >>
> >> On 22/04/15 03:22, Shengzhou Liu wrote:
> >>> RTL8211F needs to enalbe TXDLY for RGMII during phy initialization,
> >>> so move it to rtl8211f_config for early initialization.
> >>>
> >>> Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
> >>> cc: Joe Hershberger <joe.hershberger@gmail.com>
> >>> ---
> >>> drivers/net/phy/realtek.c | 25 +++++++++++++++++--------
> >>> 1 file changed, 17 insertions(+), 8 deletions(-)
> >>>
> >>> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> >>> index 3917c82..d48095b 100644
> >>> --- a/drivers/net/phy/realtek.c
> >>> +++ b/drivers/net/phy/realtek.c
> >>> @@ -43,6 +43,22 @@ static int rtl8211x_config(struct phy_device *phydev)
> >>> return 0;
> >>> }
> >>>
> >>> +static int rtl8211f_config(struct phy_device *phydev) {
> >>> + phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
> >>
> >> That part of the change is not documented but has to be, and you
> >> should use
> >> genphy_soft_reset() which also takes care of waiting the required
> >> amount of time before BMCR_RESET is cleared.
> >
> > There is no genphy_soft_reset() in current u-boot tree.
>
> Did you mean to submit that against u-boot or Linux? If the latter, there is
> absolutely no need to have the same file compile under u-boot and Linux
> without changes, that is too restrictive. There is a
> genphy_soft_reset() which takes care of waiting for BMCR_RESET to clear,
> please use it, there is no guarantee otherwise that a PHY has completed a
> reset.
> --
> Florian
This patch is for u-boot, not for kernel. There is no genphy_soft_reset() in u-boot.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] net/phy: refactor RTL8211F initialization
2015-04-22 10:22 [PATCH] net/phy: refactor RTL8211F initialization Shengzhou Liu
2015-04-22 16:57 ` Florian Fainelli
@ 2015-04-23 14:42 ` Joe Hershberger
2015-04-24 8:19 ` Shengzhou.Liu at freescale.com
1 sibling, 1 reply; 8+ messages in thread
From: Joe Hershberger @ 2015-04-23 14:42 UTC (permalink / raw)
To: u-boot
Hi Shengzhou Liu,
On Wed, Apr 22, 2015 at 5:22 AM, Shengzhou Liu
<Shengzhou.Liu@freescale.com> wrote:
> RTL8211F needs to enalbe TXDLY for RGMII during
> phy initialization, so move it to rtl8211f_config
> for early initialization.
>
> Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
> cc: Joe Hershberger <joe.hershberger@gmail.com>
> ---
> drivers/net/phy/realtek.c | 25 +++++++++++++++++--------
> 1 file changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> index 3917c82..d48095b 100644
> --- a/drivers/net/phy/realtek.c
> +++ b/drivers/net/phy/realtek.c
> @@ -43,6 +43,22 @@ static int rtl8211x_config(struct phy_device *phydev)
> return 0;
> }
>
> +static int rtl8211f_config(struct phy_device *phydev)
> +{
> + phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
Do you not need to disable the phy interrupt here?
> +
> + if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
> + /* enable TXDLY */
> + phy_write(phydev, MDIO_DEVAD_NONE,
> + MIIM_RTL8211F_PAGE_SELECT, 0xd08);
Why do you not need to change the page back to default? Does it only
apply to one following command or something? I haven't read the data
sheet for this phy to understand its behavior, but want to make sure
it's clear here. Please at least add a comment describing why the
page need not be changed back.
> + phy_write(phydev, MDIO_DEVAD_NONE, 0x11, 0x109);
Is this TX delay board specific? Seems like it would be. Should it be
parameterized to come from a board CONFIG_? If not, at least add a
comment describing these magic numbers.
> + }
> +
> + genphy_config_aneg(phydev);
> +
> + return 0;
> +}
> +
> static int rtl8211x_parse_status(struct phy_device *phydev)
> {
> unsigned int speed;
> @@ -142,13 +158,6 @@ static int rtl8211f_parse_status(struct phy_device *phydev)
> phydev->speed = SPEED_10;
> }
>
> - if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
> - /* enable TXDLY */
> - phy_write(phydev, MDIO_DEVAD_NONE,
> - MIIM_RTL8211F_PAGE_SELECT, 0xd08);
> - phy_write(phydev, MDIO_DEVAD_NONE, 0x11, 0x109);
> - }
> -
> return 0;
> }
>
> @@ -209,7 +218,7 @@ static struct phy_driver RTL8211F_driver = {
> .uid = 0x1cc916,
> .mask = 0xffffff,
> .features = PHY_GBIT_FEATURES,
> - .config = &rtl8211x_config,
> + .config = &rtl8211f_config,
> .startup = &rtl8211f_startup,
> .shutdown = &genphy_shutdown,
> };
> --
> 2.1.0.27.g96db324
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] net/phy: refactor RTL8211F initialization
2015-04-23 5:58 ` Shengzhou.Liu
@ 2015-04-23 14:42 ` Joe Hershberger
0 siblings, 0 replies; 8+ messages in thread
From: Joe Hershberger @ 2015-04-23 14:42 UTC (permalink / raw)
To: u-boot
On Thu, Apr 23, 2015 at 12:58 AM, Shengzhou.Liu at freescale.com
<Shengzhou.Liu@freescale.com> wrote:
>> -----Original Message-----
>> From: Florian Fainelli [mailto:f.fainelli at gmail.com]
>> Sent: Thursday, April 23, 2015 12:39 PM
>> To: Liu Shengzhou-B36685; netdev at vger.kernel.org; joe.hershberger at gmail.com
>> Subject: Re: [PATCH] net/phy: refactor RTL8211F initialization
>>
>> Did you mean to submit that against u-boot or Linux? If the latter, there is
>> absolutely no need to have the same file compile under u-boot and Linux
>> without changes, that is too restrictive. There is a
>> genphy_soft_reset() which takes care of waiting for BMCR_RESET to clear,
>> please use it, there is no guarantee otherwise that a PHY has completed a
>> reset.
>> --
>> Florian
> This patch is for u-boot, not for kernel. There is no genphy_soft_reset() in u-boot.
You sent this patch to the netdev list and not the u-boot list. I've
added the u-boot list here, but you should send v2 to the u-boot list.
Thanks,
-Joe
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] net/phy: refactor RTL8211F initialization
2015-04-23 14:42 ` Joe Hershberger
@ 2015-04-24 8:19 ` Shengzhou.Liu at freescale.com
0 siblings, 0 replies; 8+ messages in thread
From: Shengzhou.Liu at freescale.com @ 2015-04-24 8:19 UTC (permalink / raw)
To: u-boot
> -----Original Message-----
> From: Joe Hershberger [mailto:joe.hershberger at gmail.com]
> Sent: Thursday, April 23, 2015 10:42 PM
> To: Liu Shengzhou-B36685
> Cc: u-boot
> Subject: Re: [PATCH] net/phy: refactor RTL8211F initialization
>
> Hi Shengzhou Liu,
>
> On Wed, Apr 22, 2015 at 5:22 AM, Shengzhou Liu <Shengzhou.Liu@freescale.com>
> wrote:
> > RTL8211F needs to enalbe TXDLY for RGMII during phy initialization, so
> > move it to rtl8211f_config for early initialization.
> >
> > Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
> > cc: Joe Hershberger <joe.hershberger@gmail.com>
> > ---
> > drivers/net/phy/realtek.c | 25 +++++++++++++++++--------
> > 1 file changed, 17 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> > index 3917c82..d48095b 100644
> > --- a/drivers/net/phy/realtek.c
> > +++ b/drivers/net/phy/realtek.c
> > @@ -43,6 +43,22 @@ static int rtl8211x_config(struct phy_device *phydev)
> > return 0;
> > }
> >
> > +static int rtl8211f_config(struct phy_device *phydev) {
> > + phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
>
> Do you not need to disable the phy interrupt here?
No need, It's disabled by default.
> > +
> > + if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
> > + /* enable TXDLY */
> > + phy_write(phydev, MDIO_DEVAD_NONE,
> > + MIIM_RTL8211F_PAGE_SELECT, 0xd08);
>
> Why do you not need to change the page back to default? Does it only apply to
> one following command or something? I haven't read the data sheet for this
> phy to understand its behavior, but want to make sure it's clear here.
> Please at least add a comment describing why the page need not be changed
> back.
There is no other command, so it's working without back to default.
To avoid potential problem if one not set expected page, will have the page back to default 0 in v2.
> > + phy_write(phydev, MDIO_DEVAD_NONE, 0x11, 0x109);
>
> Is this TX delay board specific? Seems like it would be. Should it be
> parameterized to come from a board CONFIG_? If not, at least add a comment
> describing these magic numbers.
It is not board specific. Will replace the magic number.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-04-24 8:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-22 10:22 [PATCH] net/phy: refactor RTL8211F initialization Shengzhou Liu
2015-04-22 16:57 ` Florian Fainelli
2015-04-23 3:53 ` Shengzhou.Liu
2015-04-23 4:39 ` Florian Fainelli
2015-04-23 5:58 ` Shengzhou.Liu
2015-04-23 14:42 ` [U-Boot] " Joe Hershberger
2015-04-23 14:42 ` Joe Hershberger
2015-04-24 8:19 ` Shengzhou.Liu at freescale.com
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.