All of lore.kernel.org
 help / color / mirror / Atom feed
* fec driver and two micrel phys
@ 2017-11-28 15:28 Oliver Graute
  2017-11-28 16:09 ` Andrew Lunn
  2017-11-29  1:38 ` Andy Duan
  0 siblings, 2 replies; 6+ messages in thread
From: Oliver Graute @ 2017-11-28 15:28 UTC (permalink / raw)
  To: netdev; +Cc: fugang.duan

Hello list,

I try to get two Micrel KSZ8041 Phys working with the fec driver from
Kernel 4.14. But it looks that something with the mii_bus probing is not
working here. I expect the Phys on address 01 and 03. Currently on eth1
I see TX traffic but no RX. On eth0 there is neither nor. (ifconfig)

[   51.997034] Micrel KSZ8041 800f0000.ethernet-1:00: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:00, irq=POLL)
[   52.036719] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   52.621138] Micrel KSZ8041 800f0000.ethernet-1:01: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:01, irq=POLL)
[   52.649677] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[   54.697479] fec 800f4000.ethernet eth1: Link is Up - 100Mbps/Full - flow control off
[   54.721424] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[   59.860693] Micrel KSZ8041 800f0000.ethernet-1:00: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:00, irq=POLL)
[   59.874298] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   59.980688] Micrel KSZ8041 800f0000.ethernet-1:01: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:01, irq=POLL)
[   59.994289] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[   62.025331] fec 800f4000.ethernet eth1: Link is Up - 100Mbps/Full - flow control off
[   62.044588] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready


On my old setup with an Kernel 4.2 the phys are working. But there I
patched the phy_mask into the old fec code. Because I didn't know how to
do it better by device tree.

Can someone tell my how to do it right?


+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1909,6 +1909,9 @@ static int fec_enet_mii_probe(struct net_device
*ndev)
        fep->phy_dev = NULL;
+       //FIXME: Has to come in via DT
+       fep->mii_bus->phy_mask = 5;

[    2.857053] fec 800f0000.ethernet: failed to get phy-reset-gpios: -16
[    2.864190] fec 800f0000.ethernet (unnamed net_device) (uninitialized): Invalid MAC address: 00:00:00:00:00:00
[    2.874450] fec 800f0000.ethernet (unnamed net_device) (uninitialized): Using random MAC address: 4e:7f:b4:28:6d:a5
[    2.954844] libphy: fec_enet_mii_bus: probed
[    2.969254] fec 800f4000.ethernet (unnamed net_device) (uninitialized): Invalid MAC address: 00:00:00:00:00:00
[    2.979514] fec 800f4000.ethernet (unnamed net_device) (uninitialized): Using random MAC address: 3a:4a:96:7e:c2:02
[   41.430276] fec 800f0000.ethernet eth0: Freescale FEC PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.etherne:01, irq=-1)
[   42.062191] fec 800f4000.ethernet eth1: Freescale FEC PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.etherne:03, irq=-1)
[   43.430622] fec 800f0000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
[   48.245927] fec 800f0000.ethernet eth0: Freescale FEC PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.etherne:01, irq=-1)
[   50.246425] fec 800f0000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
[  112.254191] fec 800f0000.ethernet eth0: Link is Down
[  117.066479] fec 800f4000.ethernet eth1: Link is Up - 100Mbps/Full - flow control off

Best Regards,

Oliver

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: fec driver and two micrel phys
  2017-11-28 15:28 fec driver and two micrel phys Oliver Graute
@ 2017-11-28 16:09 ` Andrew Lunn
  2017-11-29  7:29   ` Oliver Graute
  2017-11-29  1:38 ` Andy Duan
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2017-11-28 16:09 UTC (permalink / raw)
  To: netdev, fugang.duan

On Tue, Nov 28, 2017 at 04:28:15PM +0100, Oliver Graute wrote:
> Hello list,
> 
> I try to get two Micrel KSZ8041 Phys working with the fec driver from
> Kernel 4.14. But it looks that something with the mii_bus probing is not
> working here. I expect the Phys on address 01 and 03. Currently on eth1
> I see TX traffic but no RX. On eth0 there is neither nor. (ifconfig)
> 
> [   51.997034] Micrel KSZ8041 800f0000.ethernet-1:00: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:00, irq=POLL)
> [   52.036719] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
> [   52.621138] Micrel KSZ8041 800f0000.ethernet-1:01: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:01, irq=POLL)
> [   52.649677] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
> [   54.697479] fec 800f4000.ethernet eth1: Link is Up - 100Mbps/Full - flow control off
> [   54.721424] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
> [   59.860693] Micrel KSZ8041 800f0000.ethernet-1:00: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:00, irq=POLL)
> [   59.874298] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
> [   59.980688] Micrel KSZ8041 800f0000.ethernet-1:01: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:01, irq=POLL)
> [   59.994289] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
> [   62.025331] fec 800f4000.ethernet eth1: Link is Up - 100Mbps/Full - flow control off
> [   62.044588] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
> 
> 
> On my old setup with an Kernel 4.2 the phys are working. But there I
> patched the phy_mask into the old fec code. Because I didn't know how to
> do it better by device tree.
> 
> Can someone tell my how to do it right?

Hi Oliver

Can you show use your device tree? You should be using phy-handle to
point to the PHYs on the MDIO bus.

      Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: fec driver and two micrel phys
  2017-11-28 15:28 fec driver and two micrel phys Oliver Graute
  2017-11-28 16:09 ` Andrew Lunn
@ 2017-11-29  1:38 ` Andy Duan
  1 sibling, 0 replies; 6+ messages in thread
From: Andy Duan @ 2017-11-29  1:38 UTC (permalink / raw)
  To: Oliver Graute, netdev

From: Oliver Graute <oliver.graute@gmail.com> Sent: Tuesday, November 28, 2017 11:28 PM
>Hello list,
>
>I try to get two Micrel KSZ8041 Phys working with the fec driver from Kernel
>4.14. But it looks that something with the mii_bus probing is not working here.
>I expect the Phys on address 01 and 03. Currently on eth1 I see TX traffic but
>no RX. On eth0 there is neither nor. (ifconfig)
>
>[   51.997034] Micrel KSZ8041 800f0000.ethernet-1:00: attached PHY driver
>[Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:00, irq=POLL)
>[   52.036719] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
>[   52.621138] Micrel KSZ8041 800f0000.ethernet-1:01: attached PHY driver
>[Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:01, irq=POLL)
>[   52.649677] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
>[   54.697479] fec 800f4000.ethernet eth1: Link is Up - 100Mbps/Full - flow
>control off
>[   54.721424] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
>[   59.860693] Micrel KSZ8041 800f0000.ethernet-1:00: attached PHY driver
>[Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:00, irq=POLL)
>[   59.874298] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
>[   59.980688] Micrel KSZ8041 800f0000.ethernet-1:01: attached PHY driver
>[Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:01, irq=POLL)
>[   59.994289] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
>[   62.025331] fec 800f4000.ethernet eth1: Link is Up - 100Mbps/Full - flow
>control off
>[   62.044588] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
>
>
>On my old setup with an Kernel 4.2 the phys are working. But there I patched
>the phy_mask into the old fec code. Because I didn't know how to do it better
>by device tree.
>
>Can someone tell my how to do it right?
>

Firstly, the log show PHY link is not stable, and the auto-negotiation show flow control off. So pls add PHY reset.
Secondly, as Andrew said, pls list out your device tree, it is better to configure two phy node in device tree. 

>
>+++ b/drivers/net/ethernet/freescale/fec_main.c
>@@ -1909,6 +1909,9 @@ static int fec_enet_mii_probe(struct net_device
>*ndev)
>        fep->phy_dev = NULL;
>+       //FIXME: Has to come in via DT
>+       fep->mii_bus->phy_mask = 5;
>
>[    2.857053] fec 800f0000.ethernet: failed to get phy-reset-gpios: -16
>[    2.864190] fec 800f0000.ethernet (unnamed net_device) (uninitialized):
>Invalid MAC address: 00:00:00:00:00:00
>[    2.874450] fec 800f0000.ethernet (unnamed net_device) (uninitialized):
>Using random MAC address: 4e:7f:b4:28:6d:a5
>[    2.954844] libphy: fec_enet_mii_bus: probed
>[    2.969254] fec 800f4000.ethernet (unnamed net_device) (uninitialized):
>Invalid MAC address: 00:00:00:00:00:00
>[    2.979514] fec 800f4000.ethernet (unnamed net_device) (uninitialized):
>Using random MAC address: 3a:4a:96:7e:c2:02
>[   41.430276] fec 800f0000.ethernet eth0: Freescale FEC PHY driver [Micrel
>KSZ8041] (mii_bus:phy_addr=800f0000.etherne:01, irq=-1)
>[   42.062191] fec 800f4000.ethernet eth1: Freescale FEC PHY driver [Micrel
>KSZ8041] (mii_bus:phy_addr=800f0000.etherne:03, irq=-1)
>[   43.430622] fec 800f0000.ethernet eth0: Link is Up - 100Mbps/Full - flow
>control off
>[   48.245927] fec 800f0000.ethernet eth0: Freescale FEC PHY driver [Micrel
>KSZ8041] (mii_bus:phy_addr=800f0000.etherne:01, irq=-1)
>[   50.246425] fec 800f0000.ethernet eth0: Link is Up - 100Mbps/Full - flow
>control off
>[  112.254191] fec 800f0000.ethernet eth0: Link is Down [  117.066479] fec
>800f4000.ethernet eth1: Link is Up - 100Mbps/Full - flow control off
>
>Best Regards,
>
>Oliver

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: fec driver and two micrel phys
  2017-11-28 16:09 ` Andrew Lunn
@ 2017-11-29  7:29   ` Oliver Graute
  2017-11-29  9:08     ` Oliver Graute
  0 siblings, 1 reply; 6+ messages in thread
From: Oliver Graute @ 2017-11-29  7:29 UTC (permalink / raw)
  To: netdev

On 28/11/17, Andrew Lunn wrote:
> On Tue, Nov 28, 2017 at 04:28:15PM +0100, Oliver Graute wrote:
> > Hello list,
> > 
> > I try to get two Micrel KSZ8041 Phys working with the fec driver from
> > Kernel 4.14. But it looks that something with the mii_bus probing is not
> > working here. I expect the Phys on address 01 and 03. Currently on eth1
> > I see TX traffic but no RX. On eth0 there is neither nor. (ifconfig)
> > 
> > [   51.997034] Micrel KSZ8041 800f0000.ethernet-1:00: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:00, irq=POLL)
> > [   52.036719] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
> > [   52.621138] Micrel KSZ8041 800f0000.ethernet-1:01: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:01, irq=POLL)
> > [   52.649677] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
> > [   54.697479] fec 800f4000.ethernet eth1: Link is Up - 100Mbps/Full - flow control off
> > [   54.721424] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
> > [   59.860693] Micrel KSZ8041 800f0000.ethernet-1:00: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:00, irq=POLL)
> > [   59.874298] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
> > [   59.980688] Micrel KSZ8041 800f0000.ethernet-1:01: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:01, irq=POLL)
> > [   59.994289] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
> > [   62.025331] fec 800f4000.ethernet eth1: Link is Up - 100Mbps/Full - flow control off
> > [   62.044588] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
> > 
> > 
> > On my old setup with an Kernel 4.2 the phys are working. But there I
> > patched the phy_mask into the old fec code. Because I didn't know how to
> > do it better by device tree.
> > 
> > Can someone tell my how to do it right?
> 
> Hi Oliver
> 
> Can you show use your device tree? You should be using phy-handle to
> point to the PHYs on the MDIO bus.

here is my device tree setting (derived from imx28-evk.dts):

&mac0 {
	phy-mode = "rmii";
	pinctrl-names = "default";
	pinctrl-0 = <&mac0_pins_a>;
	phy-reset-gpios = <&gpio4 13 0>;
	phy-reset-duration = <100>;
	status = "okay";
};

&mac1 {
	phy-mode = "rmii";
	pinctrl-names = "default";
	pinctrl-0 = <&mac1_pins_a>;
	status = "okay";
};

Best Regards,

Oliver

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: fec driver and two micrel phys
  2017-11-29  7:29   ` Oliver Graute
@ 2017-11-29  9:08     ` Oliver Graute
  2017-11-29 16:12       ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Oliver Graute @ 2017-11-29  9:08 UTC (permalink / raw)
  To: netdev

On 29/11/17, Oliver Graute wrote:
> On 28/11/17, Andrew Lunn wrote:
> > On Tue, Nov 28, 2017 at 04:28:15PM +0100, Oliver Graute wrote:
> > > Hello list,
> > > 
> > > I try to get two Micrel KSZ8041 Phys working with the fec driver from
> > > Kernel 4.14. But it looks that something with the mii_bus probing is not
> > > working here. I expect the Phys on address 01 and 03. Currently on eth1
> > > I see TX traffic but no RX. On eth0 there is neither nor. (ifconfig)
> > > 
> > > [   51.997034] Micrel KSZ8041 800f0000.ethernet-1:00: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:00, irq=POLL)
> > > [   52.036719] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
> > > [   52.621138] Micrel KSZ8041 800f0000.ethernet-1:01: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:01, irq=POLL)
> > > [   52.649677] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
> > > [   54.697479] fec 800f4000.ethernet eth1: Link is Up - 100Mbps/Full - flow control off
> > > [   54.721424] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
> > > [   59.860693] Micrel KSZ8041 800f0000.ethernet-1:00: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:00, irq=POLL)
> > > [   59.874298] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
> > > [   59.980688] Micrel KSZ8041 800f0000.ethernet-1:01: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.ethernet-1:01, irq=POLL)
> > > [   59.994289] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
> > > [   62.025331] fec 800f4000.ethernet eth1: Link is Up - 100Mbps/Full - flow control off
> > > [   62.044588] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
> > > 
> > > 
> > > On my old setup with an Kernel 4.2 the phys are working. But there I
> > > patched the phy_mask into the old fec code. Because I didn't know how to
> > > do it better by device tree.
> > > 
> > > Can someone tell my how to do it right?
> > 
> > Hi Oliver
> > 
> > Can you show use your device tree? You should be using phy-handle to
> > point to the PHYs on the MDIO bus.
> 
> here is my device tree setting (derived from imx28-evk.dts):
> 
> &mac0 {
> 	phy-mode = "rmii";
> 	pinctrl-names = "default";
> 	pinctrl-0 = <&mac0_pins_a>;
> 	phy-reset-gpios = <&gpio4 13 0>;
> 	phy-reset-duration = <100>;
> 	status = "okay";
> };
> 
> &mac1 {
> 	phy-mode = "rmii";
> 	pinctrl-names = "default";
> 	pinctrl-0 = <&mac1_pins_a>;
> 	status = "okay";
> };
> 


I got it working with the follwing device tree setup and after reading this

http://lists.infradead.org/pipermail/linux-arm-kernel/2015-January/314706.html

&mac0 {
	phy-mode = "rmii";
	phy-handle = <&ethphy0>;
	pinctrl-names = "default";
	pinctrl-0 = <&mac0_pins_a>;
	phy-reset-gpios = <&gpio4 13 0>;
	phy-reset-duration = <100>;
	status = "okay";

	mdio {
		#address-cells = <1>;
		#size-cells = <0>;

		ethphy0: ethernet-phy@1 {
			reg = <1>;
		};

		ethphy1: ethernet-phy@3 {
			reg = <3>;
		};
	};
};

&mac1 {
	phy-mode = "rmii";
	phy-handle = <&ethphy1>;
	pinctrl-names = "default";
	pinctrl-0 = <&mac1_pins_a>;
	status = "okay";

};

Thx for stub me in right direction.

Best regards,

Oliver

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: fec driver and two micrel phys
  2017-11-29  9:08     ` Oliver Graute
@ 2017-11-29 16:12       ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2017-11-29 16:12 UTC (permalink / raw)
  To: netdev

> http://lists.infradead.org/pipermail/linux-arm-kernel/2015-January/314706.html
> 
> &mac0 {
> 	phy-mode = "rmii";
> 	phy-handle = <&ethphy0>;
> 	pinctrl-names = "default";
> 	pinctrl-0 = <&mac0_pins_a>;
> 	phy-reset-gpios = <&gpio4 13 0>;
> 	phy-reset-duration = <100>;
> 	status = "okay";
> 
> 	mdio {
> 		#address-cells = <1>;
> 		#size-cells = <0>;
> 
> 		ethphy0: ethernet-phy@1 {
> 			reg = <1>;
> 		};
> 
> 		ethphy1: ethernet-phy@3 {
> 			reg = <3>;
> 		};
> 	};
> };
> 
> &mac1 {
> 	phy-mode = "rmii";
> 	phy-handle = <&ethphy1>;
> 	pinctrl-names = "default";
> 	pinctrl-0 = <&mac1_pins_a>;
> 	status = "okay";
> 
> };
> 
> Thx for stub me in right direction.

Hi Oliver

This looks a lot better.

     Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-11-29 16:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28 15:28 fec driver and two micrel phys Oliver Graute
2017-11-28 16:09 ` Andrew Lunn
2017-11-29  7:29   ` Oliver Graute
2017-11-29  9:08     ` Oliver Graute
2017-11-29 16:12       ` Andrew Lunn
2017-11-29  1:38 ` Andy Duan

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.