diff mbox

[1/1] net/fec: add KSZ9021RN phy fixup

Message ID 1323684558-16796-1-git-send-email-richard.zhao@linaro.org
State Changes Requested
Headers show

Commit Message

Richard Zhao Dec. 12, 2011, 10:09 a.m. UTC
For imx6q sabrelite board, set phy RGMII pad skew.

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 drivers/net/ethernet/freescale/fec.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

Comments

Fabio Estevam Dec. 12, 2011, 12:56 p.m. UTC | #1
On Mon, Dec 12, 2011 at 8:09 AM, Richard Zhao <richard.zhao@linaro.org> wrote:
> For imx6q sabrelite board, set phy RGMII pad skew.
>
> Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
> ---
>  drivers/net/ethernet/freescale/fec.c |   19 +++++++++++++++++++
>  1 files changed, 19 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
> index 112af9b..d3b4463 100644
> --- a/drivers/net/ethernet/freescale/fec.c
> +++ b/drivers/net/ethernet/freescale/fec.c
> @@ -1513,6 +1513,21 @@ static inline void fec_reset_phy(struct platform_device *pdev)
>  }
>  #endif /* CONFIG_OF */
>
> +/* For imx6q sabrelite board: set KSZ9021RN RGMII pad skew */
> +static int ksz9021rn_phy_fixup(struct phy_device *phydev)
> +{
> +       /* min rx data delay */
> +       phy_write(phydev, 0x0b, 0x8105);
> +       phy_write(phydev, 0x0c, 0x0000);
> +
> +       /* max rx/tx clock delay, min rx/tx control delay */
> +       phy_write(phydev, 0x0b, 0x8104);
> +       phy_write(phydev, 0x0c, 0xf0f0);
> +       phy_write(phydev, 0x0b, 0x104);
> +
> +       return 0;

This should go to drivers/net/phy/micrel.c.

Regards,

Fabio Estevam
Richard Zhao Dec. 12, 2011, 1:51 p.m. UTC | #2
On Mon, Dec 12, 2011 at 10:56:48AM -0200, Fabio Estevam wrote:
> On Mon, Dec 12, 2011 at 8:09 AM, Richard Zhao <richard.zhao@linaro.org> wrote:
> > For imx6q sabrelite board, set phy RGMII pad skew.
> >
> > Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
> > ---
> >  drivers/net/ethernet/freescale/fec.c |   19 +++++++++++++++++++
> >  1 files changed, 19 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
> > index 112af9b..d3b4463 100644
> > --- a/drivers/net/ethernet/freescale/fec.c
> > +++ b/drivers/net/ethernet/freescale/fec.c
> > @@ -1513,6 +1513,21 @@ static inline void fec_reset_phy(struct platform_device *pdev)
> >  }
> >  #endif /* CONFIG_OF */
> >
> > +/* For imx6q sabrelite board: set KSZ9021RN RGMII pad skew */
> > +static int ksz9021rn_phy_fixup(struct phy_device *phydev)
> > +{
> > +       /* min rx data delay */
> > +       phy_write(phydev, 0x0b, 0x8105);
> > +       phy_write(phydev, 0x0c, 0x0000);
> > +
> > +       /* max rx/tx clock delay, min rx/tx control delay */
> > +       phy_write(phydev, 0x0b, 0x8104);
> > +       phy_write(phydev, 0x0c, 0xf0f0);
> > +       phy_write(phydev, 0x0b, 0x104);
> > +
> > +       return 0;
> 
> This should go to drivers/net/phy/micrel.c.
Why? It's specific to fec.

Thanks
Richard
> 
> Regards,
> 
> Fabio Estevam
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Veli-Pekka Peltola Dec. 12, 2011, 2:42 p.m. UTC | #3
On 12/12/2011 03:51 PM, Richard Zhao wrote:
> On Mon, Dec 12, 2011 at 10:56:48AM -0200, Fabio Estevam wrote:
>> On Mon, Dec 12, 2011 at 8:09 AM, Richard Zhao<richard.zhao@linaro.org>  wrote:
>>> For imx6q sabrelite board, set phy RGMII pad skew.
>>>
>>> Signed-off-by: Richard Zhao<richard.zhao@linaro.org>
>>> ---
>>>   drivers/net/ethernet/freescale/fec.c |   19 +++++++++++++++++++
>>>   1 files changed, 19 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
>>> index 112af9b..d3b4463 100644
>>> --- a/drivers/net/ethernet/freescale/fec.c
>>> +++ b/drivers/net/ethernet/freescale/fec.c
>>> @@ -1513,6 +1513,21 @@ static inline void fec_reset_phy(struct platform_device *pdev)
>>>   }
>>>   #endif /* CONFIG_OF */
>>>
>>> +/* For imx6q sabrelite board: set KSZ9021RN RGMII pad skew */
>>> +static int ksz9021rn_phy_fixup(struct phy_device *phydev)
>>> +{
>>> +       /* min rx data delay */
>>> +       phy_write(phydev, 0x0b, 0x8105);
>>> +       phy_write(phydev, 0x0c, 0x0000);
>>> +
>>> +       /* max rx/tx clock delay, min rx/tx control delay */
>>> +       phy_write(phydev, 0x0b, 0x8104);
>>> +       phy_write(phydev, 0x0c, 0xf0f0);
>>> +       phy_write(phydev, 0x0b, 0x104);
>>> +
>>> +       return 0;
>>
>> This should go to drivers/net/phy/micrel.c.
> Why? It's specific to fec.

For me it seems to be a board specific and should be placed to the 
machine file. Please include linux/micrel_phy.h and use proper defines 
(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK).

--
Veli-Pekka Peltola
Richard Zhao Dec. 13, 2011, 2:10 a.m. UTC | #4
On Mon, Dec 12, 2011 at 04:42:07PM +0200, Veli-Pekka Peltola wrote:
> On 12/12/2011 03:51 PM, Richard Zhao wrote:
> >On Mon, Dec 12, 2011 at 10:56:48AM -0200, Fabio Estevam wrote:
> >>On Mon, Dec 12, 2011 at 8:09 AM, Richard Zhao<richard.zhao@linaro.org>  wrote:
> >>>For imx6q sabrelite board, set phy RGMII pad skew.
> >>>
> >>>Signed-off-by: Richard Zhao<richard.zhao@linaro.org>
> >>>---
> >>>  drivers/net/ethernet/freescale/fec.c |   19 +++++++++++++++++++
> >>>  1 files changed, 19 insertions(+), 0 deletions(-)
> >>>
> >>>diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
> >>>index 112af9b..d3b4463 100644
> >>>--- a/drivers/net/ethernet/freescale/fec.c
> >>>+++ b/drivers/net/ethernet/freescale/fec.c
> >>>@@ -1513,6 +1513,21 @@ static inline void fec_reset_phy(struct platform_device *pdev)
> >>>  }
> >>>  #endif /* CONFIG_OF */
> >>>
> >>>+/* For imx6q sabrelite board: set KSZ9021RN RGMII pad skew */
> >>>+static int ksz9021rn_phy_fixup(struct phy_device *phydev)
> >>>+{
> >>>+       /* min rx data delay */
> >>>+       phy_write(phydev, 0x0b, 0x8105);
> >>>+       phy_write(phydev, 0x0c, 0x0000);
> >>>+
> >>>+       /* max rx/tx clock delay, min rx/tx control delay */
> >>>+       phy_write(phydev, 0x0b, 0x8104);
> >>>+       phy_write(phydev, 0x0c, 0xf0f0);
> >>>+       phy_write(phydev, 0x0b, 0x104);
> >>>+
> >>>+       return 0;
> >>
> >>This should go to drivers/net/phy/micrel.c.
> >Why? It's specific to fec.
> 
> For me it seems to be a board specific and should be placed to the
> machine file. 
By converting to DT, machine code's becoming common too. I feel hard to
find a place. Put it in imx6q_init_machine?

Sascha & Shawn, Could you give comments here?

> Please include linux/micrel_phy.h and use proper
> defines (PHY_ID_KSZ9021, MICREL_PHY_ID_MASK).
right. thanks.

Richard
> 
> --
> Veli-Pekka Peltola
>
Jason Liu Dec. 13, 2011, 2:29 a.m. UTC | #5
2011/12/13 Shawn Guo <shawn.guo@freescale.com>:
> On Tue, Dec 13, 2011 at 10:10:08AM +0800, Richard Zhao wrote:
>> By converting to DT, machine code's becoming common too. I feel hard to
>> find a place. Put it in imx6q_init_machine?
>>
>> Sascha & Shawn, Could you give comments here?
>>
> I see no problem to do that by checking board compatible string and
> do the setup for particular board.

Then, you may end up having more and more fix up in the fec driver
when all the platforms converted to DT,
which will put the fec driver into mess.

>
> --
> Regards,
> Shawn
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Shawn Guo Dec. 13, 2011, 2:36 a.m. UTC | #6
On Tue, Dec 13, 2011 at 10:10:08AM +0800, Richard Zhao wrote:
> By converting to DT, machine code's becoming common too. I feel hard to
> find a place. Put it in imx6q_init_machine?
> 
> Sascha & Shawn, Could you give comments here?
> 
I see no problem to do that by checking board compatible string and
do the setup for particular board.
Shawn Guo Dec. 13, 2011, 2:47 a.m. UTC | #7
On Tue, Dec 13, 2011 at 10:29:53AM +0800, Jason Liu wrote:
> 2011/12/13 Shawn Guo <shawn.guo@freescale.com>:
> > On Tue, Dec 13, 2011 at 10:10:08AM +0800, Richard Zhao wrote:
> >> By converting to DT, machine code's becoming common too. I feel hard to
> >> find a place. Put it in imx6q_init_machine?
> >>
> >> Sascha & Shawn, Could you give comments here?
> >>
> > I see no problem to do that by checking board compatible string and
> > do the setup for particular board.
> 
> Then, you may end up having more and more fix up in the fec driver
> when all the platforms converted to DT,
> which will put the fec driver into mess.
> 
I meant we do this in imx6q_init_machine().
Richard Zhao Dec. 13, 2011, 8:28 a.m. UTC | #8
On Tue, Dec 13, 2011 at 10:47:33AM +0800, Shawn Guo wrote:
> On Tue, Dec 13, 2011 at 10:29:53AM +0800, Jason Liu wrote:
> > 2011/12/13 Shawn Guo <shawn.guo@freescale.com>:
> > > On Tue, Dec 13, 2011 at 10:10:08AM +0800, Richard Zhao wrote:
> > >> By converting to DT, machine code's becoming common too. I feel hard to
> > >> find a place. Put it in imx6q_init_machine?
> > >>
> > >> Sascha & Shawn, Could you give comments here?
> > >>
> > > I see no problem to do that by checking board compatible string and
> > > do the setup for particular board.
> > 
> > Then, you may end up having more and more fix up in the fec driver
> > when all the platforms converted to DT,
> > which will put the fec driver into mess.
> > 
> I meant we do this in imx6q_init_machine().
all right. moved to machine code.

Thanks
Richard
> 
> -- 
> Regards,
> Shawn
diff mbox

Patch

diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 112af9b..d3b4463 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -1513,6 +1513,21 @@  static inline void fec_reset_phy(struct platform_device *pdev)
 }
 #endif /* CONFIG_OF */
 
+/* For imx6q sabrelite board: set KSZ9021RN RGMII pad skew */
+static int ksz9021rn_phy_fixup(struct phy_device *phydev)
+{
+	/* min rx data delay */
+	phy_write(phydev, 0x0b, 0x8105);
+	phy_write(phydev, 0x0c, 0x0000);
+
+	/* max rx/tx clock delay, min rx/tx control delay */
+	phy_write(phydev, 0x0b, 0x8104);
+	phy_write(phydev, 0x0c, 0xf0f0);
+	phy_write(phydev, 0x0b, 0x104);
+
+	return 0;
+}
+
 static int __devinit
 fec_probe(struct platform_device *pdev)
 {
@@ -1597,6 +1612,10 @@  fec_probe(struct platform_device *pdev)
 	if (ret)
 		goto failed_init;
 
+	/* register the PHY board fixup (for Micrel KSZ9021RN) */
+	phy_register_fixup_for_uid(0x00221611, 0xfffffff0,
+					 ksz9021rn_phy_fixup);
+
 	ret = fec_enet_mii_init(pdev);
 	if (ret)
 		goto failed_mii_init;