Skip to content

Commit 4dc08dc

Browse files
laykuanloonkuba-moo
authored andcommitted
net: phy: dp83867: introduce critical chip default init for non-of platform
PHY driver dp83867 has rich supports for OF-platform to fine-tune the PHY chip during phy configuration. However, for non-OF platform, certain PHY tunable parameters such as IO impedance and RX & TX internal delays are critical and should be initialized to its default during PHY driver probe. Tested-by: Clement <clement@intel.com> Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com> Co-developed-by: Ong Boon Leong <boon.leong.ong@intel.com> Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com> Tested-by: Kurt Kanzenbach <kurt@linutronix.de> Link: https://lore.kernel.org/r/20211013065941.2124858-1-boon.leong.ong@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 4ece1ae commit 4dc08dc

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

drivers/net/phy/dp83867.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,25 @@ static int dp83867_of_init(struct phy_device *phydev)
619619
#else
620620
static int dp83867_of_init(struct phy_device *phydev)
621621
{
622+
struct dp83867_private *dp83867 = phydev->priv;
623+
u16 delay;
624+
625+
/* For non-OF device, the RX and TX ID values are either strapped
626+
* or take from default value. So, we init RX & TX ID values here
627+
* so that the RGMIIDCTL is configured correctly later in
628+
* dp83867_config_init();
629+
*/
630+
delay = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_RGMIIDCTL);
631+
dp83867->rx_id_delay = delay & DP83867_RGMII_RX_CLK_DELAY_MAX;
632+
dp83867->tx_id_delay = (delay >> DP83867_RGMII_TX_CLK_DELAY_SHIFT) &
633+
DP83867_RGMII_TX_CLK_DELAY_MAX;
634+
635+
/* Per datasheet, IO impedance is default to 50-ohm, so we set the
636+
* same here or else the default '0' means highest IO impedance
637+
* which is wrong.
638+
*/
639+
dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN / 2;
640+
622641
return 0;
623642
}
624643
#endif /* CONFIG_OF_MDIO */

0 commit comments

Comments
 (0)