[PATCH v1 4/6] verdin-imx8mm: Change board phy skew values for our ksz9031
Philippe Schenker
philippe.schenker at toradex.com
Mon Mar 9 19:24:34 CET 2020
This patches uses the existing functions for interacting with the
KSZ9031 and uses the values appropriate for our board.
Signed-off-by: Philippe Schenker <philippe.schenker at toradex.com>
---
board/toradex/verdin-imx8mm/verdin-imx8mm.c | 32 +++++++++++++++------
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
index 16b9fa1ec18..3177ba53907 100644
--- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c
+++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
@@ -8,6 +8,7 @@
#include <asm/io.h>
#include <miiphy.h>
#include <netdev.h>
+#include <micrel.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -32,14 +33,29 @@ static int setup_fec(void)
int board_phy_config(struct phy_device *phydev)
{
- /* enable rgmii rxc skew and phy mode select to RGMII copper */
- phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x1f);
- phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x8);
-
- phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x00);
- phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x82ee);
- phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05);
- phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x100);
+ /*
+ * The PHY adds 1.2ns for the RXC and 0ns for TXC clock by
+ * default. The MAC and the layout don't add a skew between
+ * clock and data.
+ * Add 0.3ns for the RXC path and 0.96 + 0.42 ns (1.38 ns) for
+ * the TXC path to get the required clock skews.
+ */
+ /* control data pad skew - devaddr = 0x02, register = 0x04 */
+ ksz9031_phy_extended_write(phydev, 0x02,
+ MII_KSZ9031_EXT_RGMII_CTRL_SIG_SKEW,
+ MII_KSZ9031_MOD_DATA_NO_POST_INC, 0x0070);
+ /* rx data pad skew - devaddr = 0x02, register = 0x05 */
+ ksz9031_phy_extended_write(phydev, 0x02,
+ MII_KSZ9031_EXT_RGMII_RX_DATA_SKEW,
+ MII_KSZ9031_MOD_DATA_NO_POST_INC, 0x7777);
+ /* tx data pad skew - devaddr = 0x02, register = 0x06 */
+ ksz9031_phy_extended_write(phydev, 0x02,
+ MII_KSZ9031_EXT_RGMII_TX_DATA_SKEW,
+ MII_KSZ9031_MOD_DATA_NO_POST_INC, 0x0000);
+ /* gtx and rx clock pad skew - devaddr = 0x02, register = 0x08 */
+ ksz9031_phy_extended_write(phydev, 0x02,
+ MII_KSZ9031_EXT_RGMII_CLOCK_SKEW,
+ MII_KSZ9031_MOD_DATA_NO_POST_INC, 0x03f4);
if (phydev->drv->config)
phydev->drv->config(phydev);
--
2.25.1
More information about the U-Boot
mailing list