diff mbox series

[U-Boot,V2,4/5] net: fec: sharing MDIO for two enet controllers

Message ID 20180321090151.14917-4-peng.fan@nxp.com
State Superseded
Delegated to: Joe Hershberger
Headers show
Series [U-Boot,V2,1/5] net: fec_mxc: Fix DM driver issue in recv | expand

Commit Message

Peng Fan March 21, 2018, 9:01 a.m. UTC
On i.MX6SX, 6UL and 7D, there are two enet controllers each has a
MDIO port. But Some boards share one MDIO port for the two enets. So
introduce a configuration CONFIG_FEC_MXC_MDIO_BASE to indicate
the MDIO port for sharing.

To i.MX28, adapt to use the new config

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
---

V2:
 adapt mx28 to use FEC_MXC_MDIO_BASE

 drivers/net/Kconfig       | 9 ++++++++-
 drivers/net/fec_mxc.c     | 8 ++++++--
 include/configs/mx28evk.h | 1 +
 3 files changed, 15 insertions(+), 3 deletions(-)

Comments

Jagan Teki March 21, 2018, 9:19 a.m. UTC | #1
On Wed, Mar 21, 2018 at 2:31 PM, Peng Fan <peng.fan@nxp.com> wrote:
> On i.MX6SX, 6UL and 7D, there are two enet controllers each has a
> MDIO port. But Some boards share one MDIO port for the two enets. So
> introduce a configuration CONFIG_FEC_MXC_MDIO_BASE to indicate
> the MDIO port for sharing.
>
> To i.MX28, adapt to use the new config
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> Cc: Fabio Estevam <fabio.estevam@nxp.com>
> ---
>
> V2:
>  adapt mx28 to use FEC_MXC_MDIO_BASE
>
>  drivers/net/Kconfig       | 9 ++++++++-
>  drivers/net/fec_mxc.c     | 8 ++++++--
>  include/configs/mx28evk.h | 1 +
>  3 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index de1947ccc1..c5fd6f648a 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -147,9 +147,16 @@ config ETHOC
>         help
>           This MAC is present in OpenRISC and Xtensa XTFPGA boards.
>
> +config FEC_MXC_MDIO_BASE
> +       hex "MDIO base address for the FEC controller"
> +       depends on FEC_MXC
> +       help
> +         This specifies the MDIO registers base address. It is used when
> +         two FEC controllers share MDIO bus.

How about retrieving this from dt? we have board that support dt along
with dm supporting.

Jagan.
Peng Fan March 21, 2018, 9:24 a.m. UTC | #2
> -----Original Message-----
> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
> Sent: 2018年3月21日 17:19
> To: Peng Fan <peng.fan@nxp.com>
> Cc: Joe Hershberger <joe.hershberger@ni.com>; Fabio Estevam
> <fabio.estevam@nxp.com>; U-Boot Mailing List <u-boot@lists.denx.de>
> Subject: Re: [U-Boot] [PATCH V2 4/5] net: fec: sharing MDIO for two enet
> controllers
> 
> On Wed, Mar 21, 2018 at 2:31 PM, Peng Fan <peng.fan@nxp.com> wrote:
> > On i.MX6SX, 6UL and 7D, there are two enet controllers each has a MDIO
> > port. But Some boards share one MDIO port for the two enets. So
> > introduce a configuration CONFIG_FEC_MXC_MDIO_BASE to indicate the
> > MDIO port for sharing.
> >
> > To i.MX28, adapt to use the new config
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> > Cc: Fabio Estevam <fabio.estevam@nxp.com>
> > ---
> >
> > V2:
> >  adapt mx28 to use FEC_MXC_MDIO_BASE
> >
> >  drivers/net/Kconfig       | 9 ++++++++-
> >  drivers/net/fec_mxc.c     | 8 ++++++--
> >  include/configs/mx28evk.h | 1 +
> >  3 files changed, 15 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index
> > de1947ccc1..c5fd6f648a 100644
> > --- a/drivers/net/Kconfig
> > +++ b/drivers/net/Kconfig
> > @@ -147,9 +147,16 @@ config ETHOC
> >         help
> >           This MAC is present in OpenRISC and Xtensa XTFPGA boards.
> >
> > +config FEC_MXC_MDIO_BASE
> > +       hex "MDIO base address for the FEC controller"
> > +       depends on FEC_MXC
> > +       help
> > +         This specifies the MDIO registers base address. It is used when
> > +         two FEC controllers share MDIO bus.
> 
> How about retrieving this from dt? we have board that support dt along with
> dm supporting.

It's ok to retrieve the info from dt, but we are not only support dt, we also need
to support non-dt case. Define FEC_MXC_MDIO_BASE is the simplest method
to achieve that I think.

Thanks,
Peng.

> 
> Jagan.
> --
> Jagan Teki
> Free Software Engineer |
> https://emea01.safelinks.protection.outlook.com/?url=www.openedev.com&da
> ta=02%7C01%7Cpeng.fan%40nxp.com%7Ca54a1113dc41442592e108d58f0cce
> cf%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6365722075248105
> 65&sdata=tos3ch1hdzrdQcoiAlB3l1dOCQ6%2Ff4ahk3RptQNjLcA%3D&reserved
> =0
> U-Boot, Linux | Upstream Maintainer
> Hyderabad, India.
Jagan Teki March 21, 2018, 9:30 a.m. UTC | #3
On Wed, Mar 21, 2018 at 2:54 PM, Peng Fan <peng.fan@nxp.com> wrote:
>
>
>> -----Original Message-----
>> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
>> Sent: 2018年3月21日 17:19
>> To: Peng Fan <peng.fan@nxp.com>
>> Cc: Joe Hershberger <joe.hershberger@ni.com>; Fabio Estevam
>> <fabio.estevam@nxp.com>; U-Boot Mailing List <u-boot@lists.denx.de>
>> Subject: Re: [U-Boot] [PATCH V2 4/5] net: fec: sharing MDIO for two enet
>> controllers
>>
>> On Wed, Mar 21, 2018 at 2:31 PM, Peng Fan <peng.fan@nxp.com> wrote:
>> > On i.MX6SX, 6UL and 7D, there are two enet controllers each has a MDIO
>> > port. But Some boards share one MDIO port for the two enets. So
>> > introduce a configuration CONFIG_FEC_MXC_MDIO_BASE to indicate the
>> > MDIO port for sharing.
>> >
>> > To i.MX28, adapt to use the new config
>> >
>> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
>> > Acked-by: Joe Hershberger <joe.hershberger@ni.com>
>> > Cc: Fabio Estevam <fabio.estevam@nxp.com>
>> > ---
>> >
>> > V2:
>> >  adapt mx28 to use FEC_MXC_MDIO_BASE
>> >
>> >  drivers/net/Kconfig       | 9 ++++++++-
>> >  drivers/net/fec_mxc.c     | 8 ++++++--
>> >  include/configs/mx28evk.h | 1 +
>> >  3 files changed, 15 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index
>> > de1947ccc1..c5fd6f648a 100644
>> > --- a/drivers/net/Kconfig
>> > +++ b/drivers/net/Kconfig
>> > @@ -147,9 +147,16 @@ config ETHOC
>> >         help
>> >           This MAC is present in OpenRISC and Xtensa XTFPGA boards.
>> >
>> > +config FEC_MXC_MDIO_BASE
>> > +       hex "MDIO base address for the FEC controller"
>> > +       depends on FEC_MXC
>> > +       help
>> > +         This specifies the MDIO registers base address. It is used when
>> > +         two FEC controllers share MDIO bus.
>>
>> How about retrieving this from dt? we have board that support dt along with
>> dm supporting.
>
> It's ok to retrieve the info from dt, but we are not only support dt, we also need
> to support non-dt case. Define FEC_MXC_MDIO_BASE is the simplest method
> to achieve that I think.

But patch adds the same for DM case which usually retrieve the info
from dt, point here is to get rid of ifdef and new CONFIG_ ie where DM
and dts play smart atleast.
Peng Fan March 21, 2018, 9:42 a.m. UTC | #4
> -----Original Message-----
> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
> Sent: 2018年3月21日 17:31
> To: Peng Fan <peng.fan@nxp.com>
> Cc: Joe Hershberger <joe.hershberger@ni.com>; Fabio Estevam
> <fabio.estevam@nxp.com>; U-Boot Mailing List <u-boot@lists.denx.de>
> Subject: Re: [U-Boot] [PATCH V2 4/5] net: fec: sharing MDIO for two enet
> controllers
> 
> On Wed, Mar 21, 2018 at 2:54 PM, Peng Fan <peng.fan@nxp.com> wrote:
> >
> >
> >> -----Original Message-----
> >> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
> >> Sent: 2018年3月21日 17:19
> >> To: Peng Fan <peng.fan@nxp.com>
> >> Cc: Joe Hershberger <joe.hershberger@ni.com>; Fabio Estevam
> >> <fabio.estevam@nxp.com>; U-Boot Mailing List <u-boot@lists.denx.de>
> >> Subject: Re: [U-Boot] [PATCH V2 4/5] net: fec: sharing MDIO for two
> >> enet controllers
> >>
> >> On Wed, Mar 21, 2018 at 2:31 PM, Peng Fan <peng.fan@nxp.com> wrote:
> >> > On i.MX6SX, 6UL and 7D, there are two enet controllers each has a
> >> > MDIO port. But Some boards share one MDIO port for the two enets.
> >> > So introduce a configuration CONFIG_FEC_MXC_MDIO_BASE to indicate
> >> > the MDIO port for sharing.
> >> >
> >> > To i.MX28, adapt to use the new config
> >> >
> >> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> >> > Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> >> > Cc: Fabio Estevam <fabio.estevam@nxp.com>
> >> > ---
> >> >
> >> > V2:
> >> >  adapt mx28 to use FEC_MXC_MDIO_BASE
> >> >
> >> >  drivers/net/Kconfig       | 9 ++++++++-
> >> >  drivers/net/fec_mxc.c     | 8 ++++++--
> >> >  include/configs/mx28evk.h | 1 +
> >> >  3 files changed, 15 insertions(+), 3 deletions(-)
> >> >
> >> > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index
> >> > de1947ccc1..c5fd6f648a 100644
> >> > --- a/drivers/net/Kconfig
> >> > +++ b/drivers/net/Kconfig
> >> > @@ -147,9 +147,16 @@ config ETHOC
> >> >         help
> >> >           This MAC is present in OpenRISC and Xtensa XTFPGA boards.
> >> >
> >> > +config FEC_MXC_MDIO_BASE
> >> > +       hex "MDIO base address for the FEC controller"
> >> > +       depends on FEC_MXC
> >> > +       help
> >> > +         This specifies the MDIO registers base address. It is used when
> >> > +         two FEC controllers share MDIO bus.
> >>
> >> How about retrieving this from dt? we have board that support dt
> >> along with dm supporting.
> >
> > It's ok to retrieve the info from dt, but we are not only support dt,
> > we also need to support non-dt case. Define FEC_MXC_MDIO_BASE is the
> > simplest method to achieve that I think.
> 
> But patch adds the same for DM case which usually retrieve the info from dt,
> point here is to get rid of ifdef and new CONFIG_ ie where DM and dts play
> smart atleast.

The uboot fec_mxc driver or net driver is not that sync with linux code,
Using dt here, need to parse phy-handle = <&ethphy0>;, then parse ethphy0 parent
to get reg, I just think this like hack.

Regards,
Peng.
Jagan Teki March 21, 2018, 10:05 a.m. UTC | #5
On Wed, Mar 21, 2018 at 3:12 PM, Peng Fan <peng.fan@nxp.com> wrote:
>
>
>> -----Original Message-----
>> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
>> Sent: 2018年3月21日 17:31
>> To: Peng Fan <peng.fan@nxp.com>
>> Cc: Joe Hershberger <joe.hershberger@ni.com>; Fabio Estevam
>> <fabio.estevam@nxp.com>; U-Boot Mailing List <u-boot@lists.denx.de>
>> Subject: Re: [U-Boot] [PATCH V2 4/5] net: fec: sharing MDIO for two enet
>> controllers
>>
>> On Wed, Mar 21, 2018 at 2:54 PM, Peng Fan <peng.fan@nxp.com> wrote:
>> >
>> >
>> >> -----Original Message-----
>> >> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
>> >> Sent: 2018年3月21日 17:19
>> >> To: Peng Fan <peng.fan@nxp.com>
>> >> Cc: Joe Hershberger <joe.hershberger@ni.com>; Fabio Estevam
>> >> <fabio.estevam@nxp.com>; U-Boot Mailing List <u-boot@lists.denx.de>
>> >> Subject: Re: [U-Boot] [PATCH V2 4/5] net: fec: sharing MDIO for two
>> >> enet controllers
>> >>
>> >> On Wed, Mar 21, 2018 at 2:31 PM, Peng Fan <peng.fan@nxp.com> wrote:
>> >> > On i.MX6SX, 6UL and 7D, there are two enet controllers each has a
>> >> > MDIO port. But Some boards share one MDIO port for the two enets.
>> >> > So introduce a configuration CONFIG_FEC_MXC_MDIO_BASE to indicate
>> >> > the MDIO port for sharing.
>> >> >
>> >> > To i.MX28, adapt to use the new config
>> >> >
>> >> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
>> >> > Acked-by: Joe Hershberger <joe.hershberger@ni.com>
>> >> > Cc: Fabio Estevam <fabio.estevam@nxp.com>
>> >> > ---
>> >> >
>> >> > V2:
>> >> >  adapt mx28 to use FEC_MXC_MDIO_BASE
>> >> >
>> >> >  drivers/net/Kconfig       | 9 ++++++++-
>> >> >  drivers/net/fec_mxc.c     | 8 ++++++--
>> >> >  include/configs/mx28evk.h | 1 +
>> >> >  3 files changed, 15 insertions(+), 3 deletions(-)
>> >> >
>> >> > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index
>> >> > de1947ccc1..c5fd6f648a 100644
>> >> > --- a/drivers/net/Kconfig
>> >> > +++ b/drivers/net/Kconfig
>> >> > @@ -147,9 +147,16 @@ config ETHOC
>> >> >         help
>> >> >           This MAC is present in OpenRISC and Xtensa XTFPGA boards.
>> >> >
>> >> > +config FEC_MXC_MDIO_BASE
>> >> > +       hex "MDIO base address for the FEC controller"
>> >> > +       depends on FEC_MXC
>> >> > +       help
>> >> > +         This specifies the MDIO registers base address. It is used when
>> >> > +         two FEC controllers share MDIO bus.
>> >>
>> >> How about retrieving this from dt? we have board that support dt
>> >> along with dm supporting.
>> >
>> > It's ok to retrieve the info from dt, but we are not only support dt,
>> > we also need to support non-dt case. Define FEC_MXC_MDIO_BASE is the
>> > simplest method to achieve that I think.
>>
>> But patch adds the same for DM case which usually retrieve the info from dt,
>> point here is to get rid of ifdef and new CONFIG_ ie where DM and dts play
>> smart atleast.
>
> The uboot fec_mxc driver or net driver is not that sync with linux code,
> Using dt here, need to parse phy-handle = <&ethphy0>;, then parse ethphy0 parent
> to get reg, I just think this like hack.

No, I think we can do this with adding new DM MDIO similar to DM PHY
which recently done. May be some sort of efforts but it is permanent.
Peng Fan March 21, 2018, 1:24 p.m. UTC | #6
> >> >
> >> >
> >> >> -----Original Message-----
> >> >> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
> >> >> Sent: 2018年3月21日 17:19
> >> >> To: Peng Fan <peng.fan@nxp.com>
> >> >> Cc: Joe Hershberger <joe.hershberger@ni.com>; Fabio Estevam
> >> >> <fabio.estevam@nxp.com>; U-Boot Mailing List
> >> >> <u-boot@lists.denx.de>
> >> >> Subject: Re: [U-Boot] [PATCH V2 4/5] net: fec: sharing MDIO for
> >> >> two enet controllers
> >> >>
> >> >> On Wed, Mar 21, 2018 at 2:31 PM, Peng Fan <peng.fan@nxp.com>
> wrote:
> >> >> > On i.MX6SX, 6UL and 7D, there are two enet controllers each has
> >> >> > a MDIO port. But Some boards share one MDIO port for the two enets.
> >> >> > So introduce a configuration CONFIG_FEC_MXC_MDIO_BASE to
> >> >> > indicate the MDIO port for sharing.
> >> >> >
> >> >> > To i.MX28, adapt to use the new config
> >> >> >
> >> >> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> >> >> > Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> >> >> > Cc: Fabio Estevam <fabio.estevam@nxp.com>
> >> >> > ---
> >> >> >
> >> >> > V2:
> >> >> >  adapt mx28 to use FEC_MXC_MDIO_BASE
> >> >> >
> >> >> >  drivers/net/Kconfig       | 9 ++++++++-
> >> >> >  drivers/net/fec_mxc.c     | 8 ++++++--
> >> >> >  include/configs/mx28evk.h | 1 +
> >> >> >  3 files changed, 15 insertions(+), 3 deletions(-)
> >> >> >
> >> >> > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index
> >> >> > de1947ccc1..c5fd6f648a 100644
> >> >> > --- a/drivers/net/Kconfig
> >> >> > +++ b/drivers/net/Kconfig
> >> >> > @@ -147,9 +147,16 @@ config ETHOC
> >> >> >         help
> >> >> >           This MAC is present in OpenRISC and Xtensa XTFPGA
> boards.
> >> >> >
> >> >> > +config FEC_MXC_MDIO_BASE
> >> >> > +       hex "MDIO base address for the FEC controller"
> >> >> > +       depends on FEC_MXC
> >> >> > +       help
> >> >> > +         This specifies the MDIO registers base address. It is used
> when
> >> >> > +         two FEC controllers share MDIO bus.
> >> >>
> >> >> How about retrieving this from dt? we have board that support dt
> >> >> along with dm supporting.
> >> >
> >> > It's ok to retrieve the info from dt, but we are not only support
> >> > dt, we also need to support non-dt case. Define FEC_MXC_MDIO_BASE
> >> > is the simplest method to achieve that I think.
> >>
> >> But patch adds the same for DM case which usually retrieve the info
> >> from dt, point here is to get rid of ifdef and new CONFIG_ ie where
> >> DM and dts play smart atleast.
> >
> > The uboot fec_mxc driver or net driver is not that sync with linux
> > code, Using dt here, need to parse phy-handle = <&ethphy0>;, then
> > parse ethphy0 parent to get reg, I just think this like hack.
> 
> No, I think we can do this with adding new DM MDIO similar to DM PHY which
> recently done. May be some sort of efforts but it is permanent.
We do not have that driver now, so could we first have this patch? When
DM MDIO ready, this piece code could be removed then?

Thanks,
Peng.
Jagan Teki March 21, 2018, 6:29 p.m. UTC | #7
On Wed, Mar 21, 2018 at 6:54 PM, Peng Fan <peng.fan@nxp.com> wrote:
>> >> >
>> >> >
>> >> >> -----Original Message-----
>> >> >> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
>> >> >> Sent: 2018年3月21日 17:19
>> >> >> To: Peng Fan <peng.fan@nxp.com>
>> >> >> Cc: Joe Hershberger <joe.hershberger@ni.com>; Fabio Estevam
>> >> >> <fabio.estevam@nxp.com>; U-Boot Mailing List
>> >> >> <u-boot@lists.denx.de>
>> >> >> Subject: Re: [U-Boot] [PATCH V2 4/5] net: fec: sharing MDIO for
>> >> >> two enet controllers
>> >> >>
>> >> >> On Wed, Mar 21, 2018 at 2:31 PM, Peng Fan <peng.fan@nxp.com>
>> wrote:
>> >> >> > On i.MX6SX, 6UL and 7D, there are two enet controllers each has
>> >> >> > a MDIO port. But Some boards share one MDIO port for the two enets.
>> >> >> > So introduce a configuration CONFIG_FEC_MXC_MDIO_BASE to
>> >> >> > indicate the MDIO port for sharing.
>> >> >> >
>> >> >> > To i.MX28, adapt to use the new config
>> >> >> >
>> >> >> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
>> >> >> > Acked-by: Joe Hershberger <joe.hershberger@ni.com>
>> >> >> > Cc: Fabio Estevam <fabio.estevam@nxp.com>
>> >> >> > ---
>> >> >> >
>> >> >> > V2:
>> >> >> >  adapt mx28 to use FEC_MXC_MDIO_BASE
>> >> >> >
>> >> >> >  drivers/net/Kconfig       | 9 ++++++++-
>> >> >> >  drivers/net/fec_mxc.c     | 8 ++++++--
>> >> >> >  include/configs/mx28evk.h | 1 +
>> >> >> >  3 files changed, 15 insertions(+), 3 deletions(-)
>> >> >> >
>> >> >> > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index
>> >> >> > de1947ccc1..c5fd6f648a 100644
>> >> >> > --- a/drivers/net/Kconfig
>> >> >> > +++ b/drivers/net/Kconfig
>> >> >> > @@ -147,9 +147,16 @@ config ETHOC
>> >> >> >         help
>> >> >> >           This MAC is present in OpenRISC and Xtensa XTFPGA
>> boards.
>> >> >> >
>> >> >> > +config FEC_MXC_MDIO_BASE
>> >> >> > +       hex "MDIO base address for the FEC controller"
>> >> >> > +       depends on FEC_MXC
>> >> >> > +       help
>> >> >> > +         This specifies the MDIO registers base address. It is used
>> when
>> >> >> > +         two FEC controllers share MDIO bus.
>> >> >>
>> >> >> How about retrieving this from dt? we have board that support dt
>> >> >> along with dm supporting.
>> >> >
>> >> > It's ok to retrieve the info from dt, but we are not only support
>> >> > dt, we also need to support non-dt case. Define FEC_MXC_MDIO_BASE
>> >> > is the simplest method to achieve that I think.
>> >>
>> >> But patch adds the same for DM case which usually retrieve the info
>> >> from dt, point here is to get rid of ifdef and new CONFIG_ ie where
>> >> DM and dts play smart atleast.
>> >
>> > The uboot fec_mxc driver or net driver is not that sync with linux
>> > code, Using dt here, need to parse phy-handle = <&ethphy0>;, then
>> > parse ethphy0 parent to get reg, I just think this like hack.
>>
>> No, I think we can do this with adding new DM MDIO similar to DM PHY which
>> recently done. May be some sort of efforts but it is permanent.
> We do not have that driver now, so could we first have this patch? When
> DM MDIO ready, this piece code could be removed then?

ie. up to Joe. Honestly this macro become removed in future, my point
here is why we need to maintain dead macro instead of adding proper
maintainable stuff. I'm pretty sure adding DM_MDIO is straight forward
and as of now just add what we need and rest will implement future.
You may become victim to others to move DM_ETH as soon as possible :)
Joe Hershberger March 21, 2018, 6:39 p.m. UTC | #8
On Wed, Mar 21, 2018 at 1:29 PM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
> On Wed, Mar 21, 2018 at 6:54 PM, Peng Fan <peng.fan@nxp.com> wrote:
>>> >> >
>>> >> >
>>> >> >> -----Original Message-----
>>> >> >> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
>>> >> >> Sent: 2018年3月21日 17:19
>>> >> >> To: Peng Fan <peng.fan@nxp.com>
>>> >> >> Cc: Joe Hershberger <joe.hershberger@ni.com>; Fabio Estevam
>>> >> >> <fabio.estevam@nxp.com>; U-Boot Mailing List
>>> >> >> <u-boot@lists.denx.de>
>>> >> >> Subject: Re: [U-Boot] [PATCH V2 4/5] net: fec: sharing MDIO for
>>> >> >> two enet controllers
>>> >> >>
>>> >> >> On Wed, Mar 21, 2018 at 2:31 PM, Peng Fan <peng.fan@nxp.com>
>>> wrote:
>>> >> >> > On i.MX6SX, 6UL and 7D, there are two enet controllers each has
>>> >> >> > a MDIO port. But Some boards share one MDIO port for the two enets.
>>> >> >> > So introduce a configuration CONFIG_FEC_MXC_MDIO_BASE to
>>> >> >> > indicate the MDIO port for sharing.
>>> >> >> >
>>> >> >> > To i.MX28, adapt to use the new config
>>> >> >> >
>>> >> >> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
>>> >> >> > Acked-by: Joe Hershberger <joe.hershberger@ni.com>
>>> >> >> > Cc: Fabio Estevam <fabio.estevam@nxp.com>
>>> >> >> > ---
>>> >> >> >
>>> >> >> > V2:
>>> >> >> >  adapt mx28 to use FEC_MXC_MDIO_BASE
>>> >> >> >
>>> >> >> >  drivers/net/Kconfig       | 9 ++++++++-
>>> >> >> >  drivers/net/fec_mxc.c     | 8 ++++++--
>>> >> >> >  include/configs/mx28evk.h | 1 +
>>> >> >> >  3 files changed, 15 insertions(+), 3 deletions(-)
>>> >> >> >
>>> >> >> > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index
>>> >> >> > de1947ccc1..c5fd6f648a 100644
>>> >> >> > --- a/drivers/net/Kconfig
>>> >> >> > +++ b/drivers/net/Kconfig
>>> >> >> > @@ -147,9 +147,16 @@ config ETHOC
>>> >> >> >         help
>>> >> >> >           This MAC is present in OpenRISC and Xtensa XTFPGA
>>> boards.
>>> >> >> >
>>> >> >> > +config FEC_MXC_MDIO_BASE
>>> >> >> > +       hex "MDIO base address for the FEC controller"
>>> >> >> > +       depends on FEC_MXC
>>> >> >> > +       help
>>> >> >> > +         This specifies the MDIO registers base address. It is used
>>> when
>>> >> >> > +         two FEC controllers share MDIO bus.
>>> >> >>
>>> >> >> How about retrieving this from dt? we have board that support dt
>>> >> >> along with dm supporting.
>>> >> >
>>> >> > It's ok to retrieve the info from dt, but we are not only support
>>> >> > dt, we also need to support non-dt case. Define FEC_MXC_MDIO_BASE
>>> >> > is the simplest method to achieve that I think.
>>> >>
>>> >> But patch adds the same for DM case which usually retrieve the info
>>> >> from dt, point here is to get rid of ifdef and new CONFIG_ ie where
>>> >> DM and dts play smart atleast.
>>> >
>>> > The uboot fec_mxc driver or net driver is not that sync with linux
>>> > code, Using dt here, need to parse phy-handle = <&ethphy0>;, then
>>> > parse ethphy0 parent to get reg, I just think this like hack.
>>>
>>> No, I think we can do this with adding new DM MDIO similar to DM PHY which
>>> recently done. May be some sort of efforts but it is permanent.
>> We do not have that driver now, so could we first have this patch? When
>> DM MDIO ready, this piece code could be removed then?
>
> ie. up to Joe. Honestly this macro become removed in future, my point
> here is why we need to maintain dead macro instead of adding proper
> maintainable stuff. I'm pretty sure adding DM_MDIO is straight forward
> and as of now just add what we need and rest will implement future.
> You may become victim to others to move DM_ETH as soon as possible :)

It would be ideal if you wanted to implement DM MDIO, but I can also
appreciate that this is not already there for you to use. As I
commented when I acked this, the I'm OK with this approach at this
time due to the state of the DM support in eth.

As a side note, maybe moving other boards that use this NIC to DM_ETH
and removing non-DM support would be a better cleanup to start with.

Cheers,
-Joe
Jagan Teki March 21, 2018, 6:59 p.m. UTC | #9
On Thu, Mar 22, 2018 at 12:09 AM, Joe Hershberger
<joe.hershberger@ni.com> wrote:
> On Wed, Mar 21, 2018 at 1:29 PM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
>> On Wed, Mar 21, 2018 at 6:54 PM, Peng Fan <peng.fan@nxp.com> wrote:
>>>> >> >
>>>> >> >
>>>> >> >> -----Original Message-----
>>>> >> >> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
>>>> >> >> Sent: 2018年3月21日 17:19
>>>> >> >> To: Peng Fan <peng.fan@nxp.com>
>>>> >> >> Cc: Joe Hershberger <joe.hershberger@ni.com>; Fabio Estevam
>>>> >> >> <fabio.estevam@nxp.com>; U-Boot Mailing List
>>>> >> >> <u-boot@lists.denx.de>
>>>> >> >> Subject: Re: [U-Boot] [PATCH V2 4/5] net: fec: sharing MDIO for
>>>> >> >> two enet controllers
>>>> >> >>
>>>> >> >> On Wed, Mar 21, 2018 at 2:31 PM, Peng Fan <peng.fan@nxp.com>
>>>> wrote:
>>>> >> >> > On i.MX6SX, 6UL and 7D, there are two enet controllers each has
>>>> >> >> > a MDIO port. But Some boards share one MDIO port for the two enets.
>>>> >> >> > So introduce a configuration CONFIG_FEC_MXC_MDIO_BASE to
>>>> >> >> > indicate the MDIO port for sharing.
>>>> >> >> >
>>>> >> >> > To i.MX28, adapt to use the new config
>>>> >> >> >
>>>> >> >> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
>>>> >> >> > Acked-by: Joe Hershberger <joe.hershberger@ni.com>
>>>> >> >> > Cc: Fabio Estevam <fabio.estevam@nxp.com>
>>>> >> >> > ---
>>>> >> >> >
>>>> >> >> > V2:
>>>> >> >> >  adapt mx28 to use FEC_MXC_MDIO_BASE
>>>> >> >> >
>>>> >> >> >  drivers/net/Kconfig       | 9 ++++++++-
>>>> >> >> >  drivers/net/fec_mxc.c     | 8 ++++++--
>>>> >> >> >  include/configs/mx28evk.h | 1 +
>>>> >> >> >  3 files changed, 15 insertions(+), 3 deletions(-)
>>>> >> >> >
>>>> >> >> > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index
>>>> >> >> > de1947ccc1..c5fd6f648a 100644
>>>> >> >> > --- a/drivers/net/Kconfig
>>>> >> >> > +++ b/drivers/net/Kconfig
>>>> >> >> > @@ -147,9 +147,16 @@ config ETHOC
>>>> >> >> >         help
>>>> >> >> >           This MAC is present in OpenRISC and Xtensa XTFPGA
>>>> boards.
>>>> >> >> >
>>>> >> >> > +config FEC_MXC_MDIO_BASE
>>>> >> >> > +       hex "MDIO base address for the FEC controller"
>>>> >> >> > +       depends on FEC_MXC
>>>> >> >> > +       help
>>>> >> >> > +         This specifies the MDIO registers base address. It is used
>>>> when
>>>> >> >> > +         two FEC controllers share MDIO bus.
>>>> >> >>
>>>> >> >> How about retrieving this from dt? we have board that support dt
>>>> >> >> along with dm supporting.
>>>> >> >
>>>> >> > It's ok to retrieve the info from dt, but we are not only support
>>>> >> > dt, we also need to support non-dt case. Define FEC_MXC_MDIO_BASE
>>>> >> > is the simplest method to achieve that I think.
>>>> >>
>>>> >> But patch adds the same for DM case which usually retrieve the info
>>>> >> from dt, point here is to get rid of ifdef and new CONFIG_ ie where
>>>> >> DM and dts play smart atleast.
>>>> >
>>>> > The uboot fec_mxc driver or net driver is not that sync with linux
>>>> > code, Using dt here, need to parse phy-handle = <&ethphy0>;, then
>>>> > parse ethphy0 parent to get reg, I just think this like hack.
>>>>
>>>> No, I think we can do this with adding new DM MDIO similar to DM PHY which
>>>> recently done. May be some sort of efforts but it is permanent.
>>> We do not have that driver now, so could we first have this patch? When
>>> DM MDIO ready, this piece code could be removed then?
>>
>> ie. up to Joe. Honestly this macro become removed in future, my point
>> here is why we need to maintain dead macro instead of adding proper
>> maintainable stuff. I'm pretty sure adding DM_MDIO is straight forward
>> and as of now just add what we need and rest will implement future.
>> You may become victim to others to move DM_ETH as soon as possible :)
>
> It would be ideal if you wanted to implement DM MDIO, but I can also
> appreciate that this is not already there for you to use. As I
> commented when I acked this, the I'm OK with this approach at this
> time due to the state of the DM support in eth.

As I said before, its your decision.

>
> As a side note, maybe moving other boards that use this NIC to DM_ETH
> and removing non-DM support would be a better cleanup to start with.

To be honest this can't be predictable (until you make a note on
MIGRATION deadline), I still see new boards from i.MX still can't use
dt.
Joe Hershberger March 21, 2018, 7:13 p.m. UTC | #10
On Wed, Mar 21, 2018 at 1:59 PM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
> On Thu, Mar 22, 2018 at 12:09 AM, Joe Hershberger
> <joe.hershberger@ni.com> wrote:
>> On Wed, Mar 21, 2018 at 1:29 PM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
>>> On Wed, Mar 21, 2018 at 6:54 PM, Peng Fan <peng.fan@nxp.com> wrote:
>>>>> >> >
>>>>> >> >
>>>>> >> >> -----Original Message-----
>>>>> >> >> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
>>>>> >> >> Sent: 2018年3月21日 17:19
>>>>> >> >> To: Peng Fan <peng.fan@nxp.com>
>>>>> >> >> Cc: Joe Hershberger <joe.hershberger@ni.com>; Fabio Estevam
>>>>> >> >> <fabio.estevam@nxp.com>; U-Boot Mailing List
>>>>> >> >> <u-boot@lists.denx.de>
>>>>> >> >> Subject: Re: [U-Boot] [PATCH V2 4/5] net: fec: sharing MDIO for
>>>>> >> >> two enet controllers
>>>>> >> >>
>>>>> >> >> On Wed, Mar 21, 2018 at 2:31 PM, Peng Fan <peng.fan@nxp.com>
>>>>> wrote:
>>>>> >> >> > On i.MX6SX, 6UL and 7D, there are two enet controllers each has
>>>>> >> >> > a MDIO port. But Some boards share one MDIO port for the two enets.
>>>>> >> >> > So introduce a configuration CONFIG_FEC_MXC_MDIO_BASE to
>>>>> >> >> > indicate the MDIO port for sharing.
>>>>> >> >> >
>>>>> >> >> > To i.MX28, adapt to use the new config
>>>>> >> >> >
>>>>> >> >> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
>>>>> >> >> > Acked-by: Joe Hershberger <joe.hershberger@ni.com>
>>>>> >> >> > Cc: Fabio Estevam <fabio.estevam@nxp.com>
>>>>> >> >> > ---
>>>>> >> >> >
>>>>> >> >> > V2:
>>>>> >> >> >  adapt mx28 to use FEC_MXC_MDIO_BASE
>>>>> >> >> >
>>>>> >> >> >  drivers/net/Kconfig       | 9 ++++++++-
>>>>> >> >> >  drivers/net/fec_mxc.c     | 8 ++++++--
>>>>> >> >> >  include/configs/mx28evk.h | 1 +
>>>>> >> >> >  3 files changed, 15 insertions(+), 3 deletions(-)
>>>>> >> >> >
>>>>> >> >> > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index
>>>>> >> >> > de1947ccc1..c5fd6f648a 100644
>>>>> >> >> > --- a/drivers/net/Kconfig
>>>>> >> >> > +++ b/drivers/net/Kconfig
>>>>> >> >> > @@ -147,9 +147,16 @@ config ETHOC
>>>>> >> >> >         help
>>>>> >> >> >           This MAC is present in OpenRISC and Xtensa XTFPGA
>>>>> boards.
>>>>> >> >> >
>>>>> >> >> > +config FEC_MXC_MDIO_BASE
>>>>> >> >> > +       hex "MDIO base address for the FEC controller"
>>>>> >> >> > +       depends on FEC_MXC
>>>>> >> >> > +       help
>>>>> >> >> > +         This specifies the MDIO registers base address. It is used
>>>>> when
>>>>> >> >> > +         two FEC controllers share MDIO bus.
>>>>> >> >>
>>>>> >> >> How about retrieving this from dt? we have board that support dt
>>>>> >> >> along with dm supporting.
>>>>> >> >
>>>>> >> > It's ok to retrieve the info from dt, but we are not only support
>>>>> >> > dt, we also need to support non-dt case. Define FEC_MXC_MDIO_BASE
>>>>> >> > is the simplest method to achieve that I think.
>>>>> >>
>>>>> >> But patch adds the same for DM case which usually retrieve the info
>>>>> >> from dt, point here is to get rid of ifdef and new CONFIG_ ie where
>>>>> >> DM and dts play smart atleast.
>>>>> >
>>>>> > The uboot fec_mxc driver or net driver is not that sync with linux
>>>>> > code, Using dt here, need to parse phy-handle = <&ethphy0>;, then
>>>>> > parse ethphy0 parent to get reg, I just think this like hack.
>>>>>
>>>>> No, I think we can do this with adding new DM MDIO similar to DM PHY which
>>>>> recently done. May be some sort of efforts but it is permanent.
>>>> We do not have that driver now, so could we first have this patch? When
>>>> DM MDIO ready, this piece code could be removed then?
>>>
>>> ie. up to Joe. Honestly this macro become removed in future, my point
>>> here is why we need to maintain dead macro instead of adding proper
>>> maintainable stuff. I'm pretty sure adding DM_MDIO is straight forward
>>> and as of now just add what we need and rest will implement future.
>>> You may become victim to others to move DM_ETH as soon as possible :)
>>
>> It would be ideal if you wanted to implement DM MDIO, but I can also
>> appreciate that this is not already there for you to use. As I
>> commented when I acked this, the I'm OK with this approach at this
>> time due to the state of the DM support in eth.
>
> As I said before, its your decision.
>
>>
>> As a side note, maybe moving other boards that use this NIC to DM_ETH
>> and removing non-DM support would be a better cleanup to start with.
>
> To be honest this can't be predictable (until you make a note on
> MIGRATION deadline), I still see new boards from i.MX still can't use
> dt.

That's not good. Simon and I (and I thought everyone else) have been
operating under the declaration that no new driver or board can be
added using legacy. I hope whoever is acking this board support will
stop.

-Joe
Peng Fan March 22, 2018, 1:28 a.m. UTC | #11
> -----Original Message-----
> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
> Sent: 2018年3月22日 3:00
> To: Joe Hershberger <joe.hershberger@ni.com>
> Cc: Peng Fan <peng.fan@nxp.com>; Fabio Estevam <fabio.estevam@nxp.com>;
> U-Boot Mailing List <u-boot@lists.denx.de>
> Subject: Re: [U-Boot] [PATCH V2 4/5] net: fec: sharing MDIO for two enet
> controllers
> 
> On Thu, Mar 22, 2018 at 12:09 AM, Joe Hershberger <joe.hershberger@ni.com>
> wrote:
> > On Wed, Mar 21, 2018 at 1:29 PM, Jagan Teki <jagannadh.teki@gmail.com>
> wrote:
> >> On Wed, Mar 21, 2018 at 6:54 PM, Peng Fan <peng.fan@nxp.com> wrote:
> >>>> >> >
> >>>> >> >
> >>>> >> >> -----Original Message-----
> >>>> >> >> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]
> >>>> >> >> Sent: 2018年3月21日 17:19
> >>>> >> >> To: Peng Fan <peng.fan@nxp.com>
> >>>> >> >> Cc: Joe Hershberger <joe.hershberger@ni.com>; Fabio Estevam
> >>>> >> >> <fabio.estevam@nxp.com>; U-Boot Mailing List
> >>>> >> >> <u-boot@lists.denx.de>
> >>>> >> >> Subject: Re: [U-Boot] [PATCH V2 4/5] net: fec: sharing MDIO
> >>>> >> >> for two enet controllers
> >>>> >> >>
> >>>> >> >> On Wed, Mar 21, 2018 at 2:31 PM, Peng Fan <peng.fan@nxp.com>
> >>>> wrote:
> >>>> >> >> > On i.MX6SX, 6UL and 7D, there are two enet controllers each
> >>>> >> >> > has a MDIO port. But Some boards share one MDIO port for the
> two enets.
> >>>> >> >> > So introduce a configuration CONFIG_FEC_MXC_MDIO_BASE to
> >>>> >> >> > indicate the MDIO port for sharing.
> >>>> >> >> >
> >>>> >> >> > To i.MX28, adapt to use the new config
> >>>> >> >> >
> >>>> >> >> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> >>>> >> >> > Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> >>>> >> >> > Cc: Fabio Estevam <fabio.estevam@nxp.com>
> >>>> >> >> > ---
> >>>> >> >> >
> >>>> >> >> > V2:
> >>>> >> >> >  adapt mx28 to use FEC_MXC_MDIO_BASE
> >>>> >> >> >
> >>>> >> >> >  drivers/net/Kconfig       | 9 ++++++++-
> >>>> >> >> >  drivers/net/fec_mxc.c     | 8 ++++++--
> >>>> >> >> >  include/configs/mx28evk.h | 1 +
> >>>> >> >> >  3 files changed, 15 insertions(+), 3 deletions(-)
> >>>> >> >> >
> >>>> >> >> > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> >>>> >> >> > index de1947ccc1..c5fd6f648a 100644
> >>>> >> >> > --- a/drivers/net/Kconfig
> >>>> >> >> > +++ b/drivers/net/Kconfig
> >>>> >> >> > @@ -147,9 +147,16 @@ config ETHOC
> >>>> >> >> >         help
> >>>> >> >> >           This MAC is present in OpenRISC and Xtensa XTFPGA
> >>>> boards.
> >>>> >> >> >
> >>>> >> >> > +config FEC_MXC_MDIO_BASE
> >>>> >> >> > +       hex "MDIO base address for the FEC controller"
> >>>> >> >> > +       depends on FEC_MXC
> >>>> >> >> > +       help
> >>>> >> >> > +         This specifies the MDIO registers base address.
> >>>> >> >> > +It is used
> >>>> when
> >>>> >> >> > +         two FEC controllers share MDIO bus.
> >>>> >> >>
> >>>> >> >> How about retrieving this from dt? we have board that support
> >>>> >> >> dt along with dm supporting.
> >>>> >> >
> >>>> >> > It's ok to retrieve the info from dt, but we are not only
> >>>> >> > support dt, we also need to support non-dt case. Define
> >>>> >> > FEC_MXC_MDIO_BASE is the simplest method to achieve that I think.
> >>>> >>
> >>>> >> But patch adds the same for DM case which usually retrieve the
> >>>> >> info from dt, point here is to get rid of ifdef and new CONFIG_
> >>>> >> ie where DM and dts play smart atleast.
> >>>> >
> >>>> > The uboot fec_mxc driver or net driver is not that sync with
> >>>> > linux code, Using dt here, need to parse phy-handle =
> >>>> > <&ethphy0>;, then parse ethphy0 parent to get reg, I just think this like
> hack.
> >>>>
> >>>> No, I think we can do this with adding new DM MDIO similar to DM
> >>>> PHY which recently done. May be some sort of efforts but it is permanent.
> >>> We do not have that driver now, so could we first have this patch?
> >>> When DM MDIO ready, this piece code could be removed then?
> >>
> >> ie. up to Joe. Honestly this macro become removed in future, my point
> >> here is why we need to maintain dead macro instead of adding proper
> >> maintainable stuff. I'm pretty sure adding DM_MDIO is straight
> >> forward and as of now just add what we need and rest will implement future.
> >> You may become victim to others to move DM_ETH as soon as possible :)
> >
> > It would be ideal if you wanted to implement DM MDIO, but I can also
> > appreciate that this is not already there for you to use. As I
> > commented when I acked this, the I'm OK with this approach at this
> > time due to the state of the DM support in eth.
> 
> As I said before, its your decision.
> 
> >
> > As a side note, maybe moving other boards that use this NIC to DM_ETH
> > and removing non-DM support would be a better cleanup to start with.
> 
> To be honest this can't be predictable (until you make a note on MIGRATION
> deadline), I still see new boards from i.MX still can't use dt.
For NXP vendor boards, Most boards already migrated to use dt, except the 6sabresd
Or 6sabreauto which use SPL + non-DM U-boot. This will be moved to use
SPL + u-boot FIT DM, but sometimes I bother with nand/spinor/norflash spl + fit uboot.

Thanks,
Peng.
Calvin Johnson March 22, 2018, 10:49 a.m. UTC | #12
Hi Joe,

> >>>
> >>> No, I think we can do this with adding new DM MDIO similar to DM PHY
> which
> >>> recently done. May be some sort of efforts but it is permanent.
> >> We do not have that driver now, so could we first have this patch? When
> >> DM MDIO ready, this piece code could be removed then?
> >
> > ie. up to Joe. Honestly this macro become removed in future, my point
> > here is why we need to maintain dead macro instead of adding proper
> > maintainable stuff. I'm pretty sure adding DM_MDIO is straight forward
> > and as of now just add what we need and rest will implement future.
> > You may become victim to others to move DM_ETH as soon as possible :)
> 
> It would be ideal if you wanted to implement DM MDIO, but I can also
> appreciate that this is not already there for you to use. As I
> commented when I acked this, the I'm OK with this approach at this
> time due to the state of the DM support in eth.
> 
> As a side note, maybe moving other boards that use this NIC to DM_ETH
> and removing non-DM support would be a better cleanup to start with.

Is someone already working on DM MDIO? 
Are there any patches already submitted for this? I couldn't find any.

Thanks
Calvin
Joe Hershberger March 22, 2018, 6:22 p.m. UTC | #13
On Thu, Mar 22, 2018 at 5:49 AM, Calvin Johnson <calvin.johnson@nxp.com> wrote:
> Hi Joe,
>
>> >>>
>> >>> No, I think we can do this with adding new DM MDIO similar to DM PHY
>> which
>> >>> recently done. May be some sort of efforts but it is permanent.
>> >> We do not have that driver now, so could we first have this patch? When
>> >> DM MDIO ready, this piece code could be removed then?
>> >
>> > ie. up to Joe. Honestly this macro become removed in future, my point
>> > here is why we need to maintain dead macro instead of adding proper
>> > maintainable stuff. I'm pretty sure adding DM_MDIO is straight forward
>> > and as of now just add what we need and rest will implement future.
>> > You may become victim to others to move DM_ETH as soon as possible :)
>>
>> It would be ideal if you wanted to implement DM MDIO, but I can also
>> appreciate that this is not already there for you to use. As I
>> commented when I acked this, the I'm OK with this approach at this
>> time due to the state of the DM support in eth.
>>
>> As a side note, maybe moving other boards that use this NIC to DM_ETH
>> and removing non-DM support would be a better cleanup to start with.
>
> Is someone already working on DM MDIO?
> Are there any patches already submitted for this? I couldn't find any.

I have a rough start on it, but I'm not happy with it so far.

-Joe
diff mbox series

Patch

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index de1947ccc1..c5fd6f648a 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -147,9 +147,16 @@  config ETHOC
 	help
 	  This MAC is present in OpenRISC and Xtensa XTFPGA boards.
 
+config FEC_MXC_MDIO_BASE
+	hex "MDIO base address for the FEC controller"
+	depends on FEC_MXC
+	help
+	  This specifies the MDIO registers base address. It is used when
+	  two FEC controllers share MDIO bus.
+
 config FEC_MXC
 	bool "FEC Ethernet controller"
-	depends on MX5 || MX6
+	depends on MX5 || MX6 || MX7
 	help
 	  This driver supports the 10/100 Fast Ethernet controller for
 	  NXP i.MX processors.
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 4f1c906a72..ba66c2f95a 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1145,12 +1145,12 @@  int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)
 #endif
 	int ret;
 
-#ifdef CONFIG_MX28
+#ifdef CONFIG_FEC_MXC_MDIO_BASE
 	/*
 	 * The i.MX28 has two ethernet interfaces, but they are not equal.
 	 * Only the first one can access the MDIO bus.
 	 */
-	base_mii = MXS_ENET0_BASE;
+	base_mii = CONFIG_FEC_MXC_MDIO_BASE;
 #else
 	base_mii = addr;
 #endif
@@ -1272,7 +1272,11 @@  static int fecmxc_probe(struct udevice *dev)
 	fec_reg_setup(priv);
 
 	priv->dev_id = dev->seq;
+#ifdef CONFIG_FEC_MXC_MDIO_BASE
+	bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE, dev->seq);
+#else
 	bus = fec_get_miibus((ulong)priv->eth, dev->seq);
+#endif
 	if (!bus) {
 		ret = -ENOMEM;
 		goto err_mii;
diff --git a/include/configs/mx28evk.h b/include/configs/mx28evk.h
index bc58ca5c62..79d4c9b2ce 100644
--- a/include/configs/mx28evk.h
+++ b/include/configs/mx28evk.h
@@ -65,6 +65,7 @@ 
 /* FEC Ethernet on SoC */
 #ifdef	CONFIG_CMD_NET
 #define CONFIG_FEC_MXC
+#define CONFIG_FEC_MXC_MDIO_BASE MXS_ENET0_BASE
 #define CONFIG_MX28_FEC_MAC_IN_OCOTP
 #endif