mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	net: phy: dp83869: Set opmode from straps
If the op-mode for the device is not set in the device tree then set the strapped op-mode and store it for later configuration. Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									c4566aec6e
								
							
						
					
					
						commit
						0eaf8ccf20
					
				
					 1 changed files with 20 additions and 1 deletions
				
			
		| 
						 | 
					@ -65,6 +65,7 @@
 | 
				
			||||||
#define DP83869_RGMII_RX_CLK_DELAY_EN		BIT(0)
 | 
					#define DP83869_RGMII_RX_CLK_DELAY_EN		BIT(0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* STRAP_STS1 bits */
 | 
					/* STRAP_STS1 bits */
 | 
				
			||||||
 | 
					#define DP83869_STRAP_OP_MODE_MASK		GENMASK(2, 0)
 | 
				
			||||||
#define DP83869_STRAP_STS1_RESERVED		BIT(11)
 | 
					#define DP83869_STRAP_STS1_RESERVED		BIT(11)
 | 
				
			||||||
#define DP83869_STRAP_MIRROR_ENABLED           BIT(12)
 | 
					#define DP83869_STRAP_MIRROR_ENABLED           BIT(12)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -161,6 +162,20 @@ static int dp83869_config_port_mirroring(struct phy_device *phydev)
 | 
				
			||||||
					  DP83869_CFG3_PORT_MIRROR_EN);
 | 
										  DP83869_CFG3_PORT_MIRROR_EN);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int dp83869_set_strapped_mode(struct phy_device *phydev)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct dp83869_private *dp83869 = phydev->priv;
 | 
				
			||||||
 | 
						int val;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						val = phy_read_mmd(phydev, DP83869_DEVADDR, DP83869_STRAP_STS1);
 | 
				
			||||||
 | 
						if (val < 0)
 | 
				
			||||||
 | 
							return val;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						dp83869->mode = val & DP83869_STRAP_OP_MODE_MASK;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CONFIG_OF_MDIO
 | 
					#ifdef CONFIG_OF_MDIO
 | 
				
			||||||
static int dp83869_of_init(struct phy_device *phydev)
 | 
					static int dp83869_of_init(struct phy_device *phydev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -185,6 +200,10 @@ static int dp83869_of_init(struct phy_device *phydev)
 | 
				
			||||||
		if (dp83869->mode < DP83869_RGMII_COPPER_ETHERNET ||
 | 
							if (dp83869->mode < DP83869_RGMII_COPPER_ETHERNET ||
 | 
				
			||||||
		    dp83869->mode > DP83869_SGMII_COPPER_ETHERNET)
 | 
							    dp83869->mode > DP83869_SGMII_COPPER_ETHERNET)
 | 
				
			||||||
			return -EINVAL;
 | 
								return -EINVAL;
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							ret = dp83869_set_strapped_mode(phydev);
 | 
				
			||||||
 | 
							if (ret)
 | 
				
			||||||
 | 
								return ret;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (of_property_read_bool(of_node, "ti,max-output-impedance"))
 | 
						if (of_property_read_bool(of_node, "ti,max-output-impedance"))
 | 
				
			||||||
| 
						 | 
					@ -218,7 +237,7 @@ static int dp83869_of_init(struct phy_device *phydev)
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
static int dp83869_of_init(struct phy_device *phydev)
 | 
					static int dp83869_of_init(struct phy_device *phydev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return 0;
 | 
						return dp83869_set_strapped_mode(phydev);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif /* CONFIG_OF_MDIO */
 | 
					#endif /* CONFIG_OF_MDIO */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue