Skip to content

Commit

Permalink
net: phy: dp83867: introduce critical chip default init for non-of pl…
Browse files Browse the repository at this point in the history
…atform

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>
  • Loading branch information
Lay, Kuan Loon authored and Jakub Kicinski committed Oct 15, 2021
1 parent 4ece1ae commit 4dc08dc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions drivers/net/phy/dp83867.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,25 @@ static int dp83867_of_init(struct phy_device *phydev)
#else
static int dp83867_of_init(struct phy_device *phydev)
{
struct dp83867_private *dp83867 = phydev->priv;
u16 delay;

/* For non-OF device, the RX and TX ID values are either strapped
* or take from default value. So, we init RX & TX ID values here
* so that the RGMIIDCTL is configured correctly later in
* dp83867_config_init();
*/
delay = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_RGMIIDCTL);
dp83867->rx_id_delay = delay & DP83867_RGMII_RX_CLK_DELAY_MAX;
dp83867->tx_id_delay = (delay >> DP83867_RGMII_TX_CLK_DELAY_SHIFT) &
DP83867_RGMII_TX_CLK_DELAY_MAX;

/* Per datasheet, IO impedance is default to 50-ohm, so we set the
* same here or else the default '0' means highest IO impedance
* which is wrong.
*/
dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN / 2;

return 0;
}
#endif /* CONFIG_OF_MDIO */
Expand Down

0 comments on commit 4dc08dc

Please sign in to comment.