Don't initialise ports with no PHY
Subsystems (3)
RFC PATCH 1/1 Don't initialise ports with no PHY
Since cbb961ca271e ("Use random MAC address when none is given") Varisys Cyrus P5020 boards have been listing 5 ethernet ports instead of the 2 the board has.This is because we were preventing the adding of the unused ports by not suppling them a MAC address, which this patch now supplies.
Prevent them from appearing in the net devices list by checking for a 'status="disabled"' entry during probe and skipping the port if we find it.
---
drivers/net/ethernet/freescale/fman/mac.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/ethernet/freescale/fman/mac.c +11 -0
@@ -606,6 +606,7 @@ static int mac_probe(struct platform_device *_of_dev)struct resource res;struct mac_priv_s *priv;const u8 *mac_addr; +const char *prop;u32 val;u8 fman_id;phy_interface_t phy_if;
@@ -628,6 +629,16 @@ static int mac_probe(struct platform_device *_of_dev) mac_dev->priv = priv; priv->dev = dev; +/* check for disabled devices and skip them, as now a missing +* MAC address will be replaced with a Random one rather than +* disabling the port +*/ + prop =of_get_property (mac_node,"status" ,NULL ); + if (prop && !strncmp(prop, "disabled", 8) { + err = -ENODEV ; + goto _return + } +if (of_device_is_compatible (mac_node,"fsl,fman-dtsec" )) {setup_dtsec (mac_dev); priv->internal_phy_node = of_parse_phandle(mac_node,
Quoted 32 lines · Darren Stevens
Since
cbb961ca271e("Use random MAC address when none is given") Varisys Cyrus P5020 boards have been listing 5 ethernet ports instead of the 2 the board has.This is because we were preventing the adding of the unused ports by not suppling them a MAC address, which this patch now supplies.Prevent them from appearing in the net devices list by checking for a 'status="disabled"' entry during probe and skipping the port if we find it.
Signed-off-by Darren Stevens <[email protected]>---
drivers/net/ethernet/freescale/fman/mac.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/net/ethernet/freescale/fman/mac.c +1
-0@@ -606,6 +606,7 @@ static int mac_probe(struct platform_device *_of_dev)struct resource res;struct mac_priv_s *priv;const u8 *mac_addr; +const char *prop;u32 val;u8 fman_id;phy_interface_t phy_if;@@ -628,6 +629,16 @@ static int mac_probe(struct platform_device *_of_dev) mac_dev->priv = priv; priv->dev = dev;
drivers/net/ethernet/freescale/fman/mac.c static int mac_probe(struct platform_device *_of_dev) · line 640
Quoted 10 lines
drivers/net/ethernet/freescale/fman/mac.c +9
-0+/* check for disabled devices and skip them, as now a missing +* MAC address will be replaced with a Random one rather than +* disabling the port +*/ + prop =of_get_property (mac_node,"status" ,NULL ); + if (prop && !strncmp(prop, "disabled", 8) { + err = -ENODEV ; + goto _return + }
There is a sorter version: of_device_is_available(mac_node) which will do the same thing.
Quoted 5 lines
drivers/net/ethernet/freescale/fman/mac.c +1
-0+if (of_device_is_compatible (mac_node,"fsl,fman-dtsec" )) {setup_dtsec (mac_dev); priv->internal_phy_node = of_parse_phandle(mac_node,
Signature · 1 line
Florian
Quoted 9 lines · Darren Stevens
Since
cbb961ca271e("Use random MAC address when none is given") Varisys Cyrus P5020 boards have been listing 5 ethernet ports instead of the 2 the board has.This is because we were preventing the adding of the unused ports by not suppling them a MAC address, which this patch now supplies.Prevent them from appearing in the net devices list by checking for a 'status="disabled"' entry during probe and skipping the port if we find it.
Hi Darren
I'm surprised the core is probing a device which has status disabled. Are you sure this is the correct explanation?
Thanks
Andrew
Hi Darren,
Thanks a lot for your patch!
I tested it with the RC3 today.
Unfortunately it doesn't compile because a bracket is missing in the following line:
+ if (prop && !strncmp(prop, "disabled", 8) {
And a semicolon is missing in the following line:
+ goto _return
I added the bracket and the semicolon and after that it compiled without any problems. (New patch attached)
Unfortunately I see more than 2 ethernet ports with the RC3 and your patch on my Cyrus P5040. Maybe Skateman has an other result on his Cyrus P5020.
Maybe we have to modify the dtb file.
Thanks,
Christian
Quoted 36 lines · Darren Stevens
Since
cbb961ca271e("Use random MAC address when none is given") Varisys Cyrus P5020 boards have been listing 5 ethernet ports instead of the 2 the board has.This is because we were preventing the adding of the unused ports by not suppling them a MAC address, which this patch now supplies.Prevent them from appearing in the net devices list by checking for a 'status="disabled"' entry during probe and skipping the port if we find it.
Signed-off-by Darren Stevens <[email protected]>---
drivers/net/ethernet/freescale/fman/mac.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/net/ethernet/freescale/fman/mac.c +4
-0@@ -606,6 +606,7 @@ static int mac_probe(struct platform_device *_of_dev)struct resource res;struct mac_priv_s *priv;const u8 *mac_addr; +const char *prop;u32 val;u8 fman_id;phy_interface_t phy_if;@@ -628,6 +629,16 @@ static int mac_probe(struct platform_device *_of_dev) mac_dev->priv = priv; priv->dev = dev; +/* check for disabled devices and skip them, as now a missing +* MAC address will be replaced with a Random one rather than +* disabling the port
drivers/net/ethernet/freescale/fman/mac.c static int mac_probe(struct platform_device *_of_dev) · line 644
Quoted 10 lines
drivers/net/ethernet/freescale/fman/mac.c +7
-0+*/ + prop =of_get_property (mac_node,"status" ,NULL ); + if (prop && !strncmp(prop, "disabled", 8) { + err = -ENODEV ; + goto _return + } +if (of_device_is_compatible (mac_node,"fsl,fman-dtsec" )) {setup_dtsec (mac_dev); priv->internal_phy_node = of_parse_phandle(mac_node,
drivers/net/ethernet/freescale/fman/mac.c +11 -0
@@ -606,6 +606,7 @@ static int mac_probe(struct platform_device *_of_dev)struct resource res;struct mac_priv_s *priv;const u8 *mac_addr; +const char *prop;u32 val;u8 fman_id;phy_interface_t phy_if;
@@ -628,6 +629,16 @@ static int mac_probe(struct platform_device *_of_dev) mac_dev->priv = priv; priv->dev = dev; +/* check for disabled devices and skip them, as now a missing +* MAC address will be replaced with a Random one rather than +* disabling the port +*/ + prop =of_get_property (mac_node,"status" ,NULL ); +if (prop && !strncmp (prop,"disabled" ,8 )) { + err = -ENODEV ; + goto _return; + } +if (of_device_is_compatible (mac_node,"fsl,fman-dtsec" )) {setup_dtsec (mac_dev); priv->internal_phy_node = of_parse_phandle(mac_node,
Quoted 1 line
Maybe we have to modify the dtb file.
Hi Christian
Could you point me at the DT file.
Thanks
Andrew
Quoted 5 lines · Christian Zigotzky
Hi Andrew,
You can find some dtb and source files in our kernel package.
Download: http://www.xenosoft.de/linux-image-5.7-rc3-X1000_X5000.tar.gz
I have the tarball. Are we talking about linux-image-5.7-rc3-X1000_X5000/X5000_and_QEMU_e5500/dtbs/X5000_20/cyrus.eth.dtb
I don't see any status = "disabled"; in the blob. So i would expect the driver to probe.
Andrew
Quoted 11 lines · Andrew Lunn
Quoted 5 lines · Christian Zigotzky
Hi Andrew,
You can find some dtb and source files in our kernel package.
Download: http://www.xenosoft.de/linux-image-5.7-rc3-X1000_X5000.tar.gz
Quoted 9 lines
I have the tarball. Are we talking about linux-image-5.7-rc3-X1000_X5000/X5000_and_QEMU_e5500/dtbs/X5000_20/cyrus.eth.dtb
I don't see any status = "disabled"; in the blob. So i would expect the driver to probe.
Andrew
Yes, that’s correct but maybe Darren uses another dtb file.
@Darren
Which dtb file do you use?
Hi Andrew,
You can find some dtb and source files in our kernel package.
Download: http://www.xenosoft.de/linux-image-5.7-rc3-X1000_X5000.tar.gz
Thanks,
Christian
Quoted 12 lines · Andrew Lunn
Quoted 2 lines
Maybe we have to modify the dtb file.
Hi Christian
Could you point me at the DT file.
Thanks
Andrew
Hello Andrew
Quoted 7 lines · Andrew Lunn
Quoted 6 lines · Darren Stevens
Since
cbb961ca271e("Use random MAC address when none is given") Varisys Cyrus P5020 boards have been listing 5 ethernet ports instead of the 2 the board has.This is because we were preventing the adding of the unused ports by not suppling them a MAC address, which this patch now supplies.
Quoted 8 lines
Quoted 3 lines
Prevent them from appearing in the net devices list by checking for a 'status="disabled"' entry during probe and skipping the port if we find it.
Hi Darren
I'm surprised the core is probing a device which has status disabled. Are you sure this is the correct explanation?
You are correct, the core is detecting status="disabled". My mistake, the Hardware vendor's supplied dts always relied on only supplying active ports with an IP address, and it didn't occur to me to test that they could be disabled.
Sorry.
Regards
Darren
Hello Christian
Quoted 7 lines · Christian Zigotzky
Quoted 7 lines · Andrew Lunn
Quoted 2 lines · Christian Zigotzky
Hi Andrew,
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
You can find some dtb and source files in our kernel package.
Download: http://www.xenosoft.de/linux-image-5.7-rc3-X1000_X5000.tar.gz
I have the tarball. Are we talking about
linux-image-5.7-rc3-X1000_X5000/X5000_and_QEMU_e5500/dtbs/X5000_20/cyrus.eth.dtb
Quoted 3 lines
Quoted 3 lines
I don't see any status = "disabled"; in the blob. So i would expect the driver to probe.
No, the vendor never added that to them.
Quoted 4 lines
Yes, that's correct but maybe Darren uses another dtb file.
@Darren
Which dtb file do you use?
My current one attached, including updated cyrus_p5020.dts & p5020si-pre.dtsi which I'm preparing patches for.
Christian, build an unmodified kernel, select board level reset or power off, then both the GPIO drivers.
Then under LED Support: GPIO connected LED's and triggers -> disk activity
I think you still have a 5020 don't you? I'll look at 5040 later (I'll need someone to test)
Regards
Darren
Quoted 39 lines · Darren Stevens
Hello Christian
Quoted 8 lines · Christian Zigotzky
Quoted 7 lines
Quoted 3 lines · Andrew Lunn
Quoted 2 lines · Christian Zigotzky
Hi Andrew,
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
You can find some dtb and source files in our kernel package.
Download: http://www.xenosoft.de/linux-image-5.7-rc3-X1000_X5000.tar.gz
I have the tarball. Are we talking about
linux-image-5.7-rc3-X1000_X5000/X5000_and_QEMU_e5500/dtbs/X5000_20/cyrus.eth.dtb
Quoted 3 lines
Quoted 3 lines
I don't see any status = "disabled"; in the blob. So i would expect the driver to probe.
No, the vendor never added that to them.
Quoted 4 lines
Yes, that's correct but maybe Darren uses another dtb file.
@Darren
Which dtb file do you use?My current one attached, including updated
cyrus_p5020.dts&p5020si-pre.dtsiwhich I'm preparing patches for.Christian, build an unmodified kernel, select board level reset or power off, then both the GPIO drivers.
Then under LED Support: GPIO connected LED's and triggers -> disk activity
Quoted 6 lines
I think you still have a 5020 don't you? I'll look at 5040 later (I'll need someone to test)
Regards
Darren
<cyrus-dts.zip>
Darren
I use a 5040 currently.
Thanks
Christian