forked from mirrors/linux
		
	net: phy: micrel: add toggling phy reset if PHY is not attached
This patch adds toggling phy reset if PHY is not attached. Otherwise,
some boards (e.g. R-Car H3 Salvator-XS) cannot link up correctly if
we do the following method:
 1) Kernel boots by using initramfs.
 --> No open the nic, so phy_device_register() and phy_probe()
     deasserts the reset.
 2) Kernel enters the suspend.
 --> So, keep the reset signal as deassert.
 --> On R-Car Salvator-XS board, unfortunately, the board power is
     turned off.
 3) Kernel returns from suspend.
 4) ifconfig eth0 up
 --> Then, since edge signal of the reset doesn't happen,
     it cannot link up.
 5) ifconfig eth0 down
 6) ifconfig eth0 up
 --> In this case, it can link up.
Reported-by: Hiromitsu Yamasaki <hiromitsu.yamasaki.ym@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
			
			
This commit is contained in:
		
							parent
							
								
									ef1b5bf506
								
							
						
					
					
						commit
						8c85f4b812
					
				
					 1 changed files with 8 additions and 0 deletions
				
			
		| 
						 | 
					@ -23,6 +23,7 @@
 | 
				
			||||||
 *			 ksz9477
 | 
					 *			 ksz9477
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <linux/delay.h>
 | 
				
			||||||
#include <linux/kernel.h>
 | 
					#include <linux/kernel.h>
 | 
				
			||||||
#include <linux/module.h>
 | 
					#include <linux/module.h>
 | 
				
			||||||
#include <linux/phy.h>
 | 
					#include <linux/phy.h>
 | 
				
			||||||
| 
						 | 
					@ -835,6 +836,13 @@ static int kszphy_resume(struct phy_device *phydev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!phydev->attached_dev) {
 | 
				
			||||||
 | 
							/* If the PHY is not attached, toggle the reset */
 | 
				
			||||||
 | 
							phy_device_reset(phydev, 1);
 | 
				
			||||||
 | 
							udelay(1);
 | 
				
			||||||
 | 
							phy_device_reset(phydev, 0);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	genphy_resume(phydev);
 | 
						genphy_resume(phydev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = kszphy_config_reset(phydev);
 | 
						ret = kszphy_config_reset(phydev);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue