Skip to contentSkip to conversation

mv643xx_eth and MDIO bus PM resume

PATCH New Simon Guinot 3 participants 6 messages Sep 11, 2010 – Sep 14, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

I am trying to get some PM support for Kirkwood machines and I have to deal with the MDIO bus driver which trigger a kernel crash at resume.

The Kirkwood SoC Ethernet driver is mv643xx_eth and don't use the PAL machine state. The PHY is handled by calling manually PHY functions.

The problem is that the current mdio_bus_resume() implementation _always_ start at resume the PAL state machine even if the driver can't handle that. That's the mv643xx_eth case, which don't provide the adjust_link() method.

Any hint to fix this issue is welcome.

Thanks in advance.

Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100911/275adc68/attachment.sig>

#1 lore raw
Quoted 8 lines · Simon Guinot

Hi,

I am trying to get some PM support for Kirkwood machines and I have to deal with the MDIO bus driver which trigger a kernel crash at resume.

The Kirkwood SoC Ethernet driver is mv643xx_eth and don't use the PAL machine state. The PHY is handled by calling manually PHY functions.

Quoted 6 lines

The problem is that the current mdio_bus_resume() implementation _always_ start at resume the PAL state machine even if the driver can't handle that. That's the mv643xx_eth case, which don't provide the adjust_link() method.

Any hint to fix this issue is welcome.

Simon, can you please post your patch to this driver that adds PM support? saeed

#2 lore raw

Hi Saeed,

Quoted 9 lines · saeed bishara
Quoted 8 lines · Simon Guinot

Hi,

I am trying to get some PM support for Kirkwood machines and I have to deal with the MDIO bus driver which trigger a kernel crash at resume.

The Kirkwood SoC Ethernet driver is mv643xx_eth and don't use the PAL machine state. The PHY is handled by calling manually PHY functions.

Quoted 7 lines
Quoted 6 lines

The problem is that the current mdio_bus_resume() implementation _always_ start at resume the PAL state machine even if the driver can't handle that. That's the mv643xx_eth case, which don't provide the adjust_link() method.

Any hint to fix this issue is welcome.

Simon, can you please post your patch to this driver that adds PM support?

Sorry I don't have a such patch yet. For now, I am still working on the core power management support.

If you want test, some patches are available at:

git://lacie-nas.org/lacie-orion.git pm

And the web url is:

http://git.lacie-nas.org/?p=lacie-orion.git;a=shortlog;h=refs/heads/pm

The next step is to add PM support for the driver mv643xx_eth. As the PM core turn off the GE unit clock, probably that some driver code is needed to handle suspend and resume. Maybe do you have a such patch ?

Concerning the mdio_bus_resume() issue, I think it is not related with the Ethernet driver. At resume the MDIO bus automatically start the PAL state machine, even if the adjust_link() function is not supplied. Just add a check is probably good enough.

Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100912/cd3785a9/attachment.sig>

#3 lore raw

PATCH 1/4 phylib: fix PAL state machine restart on resume

From: Simon Guinot <[email protected]>

On resume, before starting the PAL state machine, check if the adjust_link() method is well supplied. If not, this would lead to a NULL pointer dereference in the phy_state_machine() function.

This scenario can happen if the Ethernet driver call manually the PHY functions instead of using the PAL state machine. The mv643xx_eth driver is a such example.

---
 drivers/net/phy/mdio_bus.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/mdio_bus.c +2 -2
index 6a6b819..6c58da2 100644
@@ -308,7 +308,7 @@ static int mdio_bus_suspend(struct device *dev)
 	 * may call phy routines that try to grab the same lock, and that may
 	 * lead to a deadlock.
 	 */
-	if (phydev->attached_dev)
+	if (phydev->attached_dev && phydev->adjust_link)
 		phy_stop_machine(phydev);
 
 	if (!mdio_bus_phy_may_suspend(phydev))
@@ -331,7 +331,7 @@ static int mdio_bus_resume(struct device *dev)
 		return ret;
 
 no_resume:
-	if (phydev->attached_dev)
+	if (phydev->attached_dev && phydev->adjust_link)
 		phy_start_machine(phydev, NULL);
 
 	return 0;
Signature · 1 line
1.6.3.1
maintainer
#4 lore raw

PATCH 1/4 phylib: fix PAL state machine restart on resume

Networking patches should be submitted to netdev at vger.kernel.org not linux-net at vger.kernel.org

linux-net is for user questions, developers do not listen at that address

Please resubmit your patch to the correct location, thank you.

#5 lore raw
In reply to Simon Guinot
Quoted 19 lines · Simon Guinot

Hi Saeed,

Quoted 16 lines · saeed bishara
Quoted 8 lines · Simon Guinot

Hi,

I am trying to get some PM support for Kirkwood machines and I have to deal with the MDIO bus driver which trigger a kernel crash at resume.

The Kirkwood SoC Ethernet driver is mv643xx_eth and don't use the PAL machine state. The PHY is handled by calling manually PHY functions.

Quoted 6 lines

The problem is that the current mdio_bus_resume() implementation _always_ start at resume the PAL state machine even if the driver can't handle that. That's the mv643xx_eth case, which don't provide the adjust_link() method.

Any hint to fix this issue is welcome.

Simon, can you please post your patch to this driver that adds PM support?

attached my patch for mv643xx_eth pm support. The Marvell Dove has complete pm support, but this still not merged into mainline, you can look at this git tree where you can find patches for usb, spi, pcie
http://kernel.ubuntu.com/git?p=ycmiao/ubuntu-lucid.git;a=shortlog;h=refs/heads/mvl-dove
saeed

Quoted 23 lines

Sorry I don't have a such patch yet. For now, I am still working on the core power management support.

If you want test, some patches are available at:

git://lacie-nas.org/lacie-orion.git pm

And the web url is:

http://git.lacie-nas.org/?p=lacie-orion.git;a=shortlog;h=refs/heads/pm

The next step is to add PM support for the driver mv643xx_eth. As the PM core turn off the GE unit clock, probably that some driver code is needed to handle suspend and resume. Maybe do you have a such patch ?

Concerning the mdio_bus_resume() issue, I think it is not related with the Ethernet driver. At resume the MDIO bus automatically start the PAL state machine, even if the adjust_link() function is not supplied. Just add a check is probably good enough.

Simon

Quoted 9 lines

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkyNRvcACgkQgtp0PDeOcDrcTACfVDQPWDsoALforv2wSCJ4sbwy 8cIAn0FDzNcMUjuhHJsp5BRsTQ8jdqIm
=I4UJ
-----END PGP SIGNATURE-----

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mv643xx-add-power-management-support.patch
Type: application/octet-stream
Size: 3714 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100913/ebf0287c/attachment.obj>