u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Marcel Ziswiler <marcel@ziswiler.com>
To: u-boot@lists.denx.de
Cc: Stefano Babic <sbabic@denx.de>,
	Heiko Thiery <heiko.thiery@gmail.com>,
	Fabio Estevam <festevam@gmail.com>,
	Frieder Schrempf <frieder.schrempf@kontron.de>,
	Marcel Ziswiler <marcel.ziswiler@toradex.com>,
	Igor Opaniuk <igor.opaniuk@gmail.com>,
	Max Krummenacher <max.krummenacher@toradex.com>,
	"NXP i.MX U-Boot Team" <uboot-imx@nxp.com>,
	Simon Glass <sjg@chromium.org>
Subject: [PATCH v4 02/10] verdin-imx8mm: fix ethernet
Date: Wed,  6 Oct 2021 23:27:48 +0200	[thread overview]
Message-ID: <20211006212757.464740-3-marcel@ziswiler.com> (raw)
In-Reply-To: <20211006212757.464740-1-marcel@ziswiler.com>

From: Marcel Ziswiler <marcel.ziswiler@toradex.com>

Turns out Microship (formerly Micrel) meanwhile integrated proper
support for the DLL setup on their KSZ9131. Unfortunately, this
conflicts with our previous board code doing that.
Fix this by getting rid of our board code and just relying on the
generic implementation relying on rgmii-id being used as phy-mode.

Fixes: commit c6df0e2ffdc4
       ("net: phy: micrel: add support for DLL setup on ksz9131")
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
---

(no changes since v1)

 arch/arm/dts/imx8mm-verdin.dts              |  2 +-
 board/toradex/verdin-imx8mm/verdin-imx8mm.c | 64 ---------------------
 2 files changed, 1 insertion(+), 65 deletions(-)

diff --git a/arch/arm/dts/imx8mm-verdin.dts b/arch/arm/dts/imx8mm-verdin.dts
index fb0756d6e19..ac2a4b69d3c 100644
--- a/arch/arm/dts/imx8mm-verdin.dts
+++ b/arch/arm/dts/imx8mm-verdin.dts
@@ -160,7 +160,7 @@
 &fec1 {
 	fsl,magic-packet;
 	phy-handle = <&ethphy0>;
-	phy-mode = "rgmii";
+	phy-mode = "rgmii-id";
 	phy-supply = <&reg_ethphy>;
 	pinctrl-names = "default", "sleep";
 	pinctrl-0 = <&pinctrl_fec1>;
diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
index 76f4a1e209a..1644f4b3081 100644
--- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c
+++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
@@ -36,70 +36,6 @@ static int setup_fec(void)
 
 	return 0;
 }
-
-int board_phy_config(struct phy_device *phydev)
-{
-	int tmp;
-
-	switch (ksz9xx1_phy_get_id(phydev) & MII_KSZ9x31_SILICON_REV_MASK) {
-	case PHY_ID_KSZ9031:
-		/*
-		 * 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);
-		break;
-	case PHY_ID_KSZ9131:
-	default:
-		/* read rxc dll control - devaddr = 0x2, register = 0x4c */
-		tmp = ksz9031_phy_extended_read(phydev, 0x02,
-					MII_KSZ9131_EXT_RGMII_2NS_SKEW_RXDLL,
-					MII_KSZ9031_MOD_DATA_NO_POST_INC);
-		/* disable rxdll bypass (enable 2ns skew delay on RXC) */
-		tmp &= ~MII_KSZ9131_RXTXDLL_BYPASS;
-		/* rxc data pad skew 2ns - devaddr = 0x02, register = 0x4c */
-		tmp = ksz9031_phy_extended_write(phydev, 0x02,
-					MII_KSZ9131_EXT_RGMII_2NS_SKEW_RXDLL,
-					MII_KSZ9031_MOD_DATA_NO_POST_INC, tmp);
-		/* read txc dll control - devaddr = 0x02, register = 0x4d */
-		tmp = ksz9031_phy_extended_read(phydev, 0x02,
-					MII_KSZ9131_EXT_RGMII_2NS_SKEW_TXDLL,
-					MII_KSZ9031_MOD_DATA_NO_POST_INC);
-		/* disable txdll bypass (enable 2ns skew delay on TXC) */
-		tmp &= ~MII_KSZ9131_RXTXDLL_BYPASS;
-		/* rxc data pad skew 2ns - devaddr = 0x02, register = 0x4d */
-		tmp = ksz9031_phy_extended_write(phydev, 0x02,
-					MII_KSZ9131_EXT_RGMII_2NS_SKEW_TXDLL,
-					MII_KSZ9031_MOD_DATA_NO_POST_INC, tmp);
-		break;
-	}
-
-	if (phydev->drv->config)
-		phydev->drv->config(phydev);
-	return 0;
-}
 #endif
 
 int board_init(void)
-- 
2.26.2


  parent reply	other threads:[~2021-10-06 21:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-06 21:27 [PATCH v4 00/10] board: toradex: verdin-imx8mm: target refresh Marcel Ziswiler
2021-10-06 21:27 ` [PATCH v4 01/10] imx8m: clean-up kconfig indentation Marcel Ziswiler
2021-10-06 21:27 ` Marcel Ziswiler [this message]
2021-10-06 21:27 ` [PATCH v4 03/10] ARM: dts: imx8mm-verdin: prepare for dek blob encapsulation Marcel Ziswiler
2021-10-06 21:27 ` [PATCH v4 04/10] verdin-imx8mm: switch to use binman to pack images Marcel Ziswiler
2021-10-07  2:18   ` Simon Glass
2021-10-07 21:59     ` Marcel Ziswiler
2021-10-06 21:27 ` [PATCH v4 05/10] verdin-imx8mm: enable sleep_moci output Marcel Ziswiler
2021-10-06 21:27 ` [PATCH v4 06/10] verdin-imx8mm: clean-up include order Marcel Ziswiler
2021-10-06 21:27 ` [PATCH v4 07/10] verdin-imx8mm: drop support for v1.0 hardware Marcel Ziswiler
2021-10-06 21:27 ` [PATCH v4 08/10] include/configs: apalis-imx8/verdin-imx8mm: rename kernel image variable Marcel Ziswiler
2021-10-09 16:06   ` Wolfgang Denk
2021-10-06 21:27 ` [PATCH v4 09/10] verdin-imx8mm: use preboot for fdtfile evaluation Marcel Ziswiler
2021-10-06 21:27 ` [PATCH v4 10/10] verdin-imx8mm: fix watchdog pinctrl issue Marcel Ziswiler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211006212757.464740-3-marcel@ziswiler.com \
    --to=marcel@ziswiler.com \
    --cc=festevam@gmail.com \
    --cc=frieder.schrempf@kontron.de \
    --cc=heiko.thiery@gmail.com \
    --cc=igor.opaniuk@gmail.com \
    --cc=marcel.ziswiler@toradex.com \
    --cc=max.krummenacher@toradex.com \
    --cc=sbabic@denx.de \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).