public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [PATCH] net: fec: Get rid of FEC_ENET_ENABLE_[TR]XC_DELAY
Date: Tue, 19 Jan 2021 00:57:05 +0100	[thread overview]
Message-ID: <20210118235705.550207-1-marex@denx.de> (raw)

The FEC_ENET_ENABLE_.XC_DELAY setting is only used by one system which
supports OF control, correctly set the rgmii-id PHY mode in the DT and
then determine whether or not to enable the FEC RXC/TXC internal delay
based on the PHY mode.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Ramon Fried <rfried.dev@gmail.com>
---
 arch/arm/dts/fsl-imx8qm-apalis.dts  |  2 +-
 arch/arm/dts/fsl-imx8qxp-apalis.dts |  2 +-
 drivers/net/fec_mxc.c               | 14 ++++++--------
 include/configs/apalis-imx8.h       |  3 ---
 include/configs/apalis-imx8x.h      |  3 ---
 5 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/arch/arm/dts/fsl-imx8qm-apalis.dts b/arch/arm/dts/fsl-imx8qm-apalis.dts
index 5187b794527..0d8d3b3e8e8 100644
--- a/arch/arm/dts/fsl-imx8qm-apalis.dts
+++ b/arch/arm/dts/fsl-imx8qm-apalis.dts
@@ -503,7 +503,7 @@
 	pinctrl-0 = <&pinctrl_fec1>;
 	fsl,magic-packet;
 	phy-handle = <&ethphy0>;
-	phy-mode = "rgmii";
+	phy-mode = "rgmii-id";
 	phy-reset-duration = <10>;
 	phy-reset-gpios = <&gpio1 11 1>;
 	status = "okay";
diff --git a/arch/arm/dts/fsl-imx8qxp-apalis.dts b/arch/arm/dts/fsl-imx8qxp-apalis.dts
index 6bd231b2834..9cb3d3a809b 100644
--- a/arch/arm/dts/fsl-imx8qxp-apalis.dts
+++ b/arch/arm/dts/fsl-imx8qxp-apalis.dts
@@ -229,7 +229,7 @@
 	pinctrl-0 = <&pinctrl_fec1>;
 	fsl,magic-packet;
 	phy-handle = <&ethphy0>;
-	phy-mode = "rgmii";
+	phy-mode = "rgmii-id";
 	phy-reset-duration = <10>;
 	phy-reset-post-delay = <150>;
 	phy-reset-gpios = <&gpio3 4 GPIO_ACTIVE_LOW>;
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index bb55be9a267..73fc5f4c903 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -507,15 +507,13 @@ static int fec_open(struct eth_device *edev)
 	writel(readl(&fec->eth->ecntrl) | FEC_ECNTRL_ETHER_EN,
 	       &fec->eth->ecntrl);
 
-#ifdef FEC_ENET_ENABLE_TXC_DELAY
-	writel(readl(&fec->eth->ecntrl) | FEC_ECNTRL_TXC_DLY,
-	       &fec->eth->ecntrl);
-#endif
+	if (fec->interface == PHY_INTERFACE_MODE_RGMII_ID ||
+	    fec->interface == PHY_INTERFACE_MODE_RGMII_TXID)
+		setbits_le32(&fec->eth->ecntrl, FEC_ECNTRL_TXC_DLY);
 
-#ifdef FEC_ENET_ENABLE_RXC_DELAY
-	writel(readl(&fec->eth->ecntrl) | FEC_ECNTRL_RXC_DLY,
-	       &fec->eth->ecntrl);
-#endif
+	if (fec->interface == PHY_INTERFACE_MODE_RGMII_ID ||
+	    fec->interface == PHY_INTERFACE_MODE_RGMII_RXID)
+		setbits_le32(&fec->eth->ecntrl, FEC_ECNTRL_RXC_DLY);
 
 #if defined(CONFIG_MX25) || defined(CONFIG_MX53) || defined(CONFIG_MX6SL)
 	udelay(100);
diff --git a/include/configs/apalis-imx8.h b/include/configs/apalis-imx8.h
index db4e9011c0b..81441d7770f 100644
--- a/include/configs/apalis-imx8.h
+++ b/include/configs/apalis-imx8.h
@@ -21,9 +21,6 @@
 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 
 /* Networking */
-#define FEC_QUIRK_ENET_MAC
-#define FEC_ENET_ENABLE_TXC_DELAY
-
 #define CONFIG_TFTP_TSIZE
 
 #define CONFIG_IPADDR			192.168.10.2
diff --git a/include/configs/apalis-imx8x.h b/include/configs/apalis-imx8x.h
index db31c210f50..90bbeb926d3 100644
--- a/include/configs/apalis-imx8x.h
+++ b/include/configs/apalis-imx8x.h
@@ -25,9 +25,6 @@
 #define CONFIG_NETMASK			255.255.255.0
 #define CONFIG_SERVERIP			192.168.10.1
 
-#define FEC_ENET_ENABLE_TXC_DELAY
-#define FEC_ENET_ENABLE_RXC_DELAY
-
 #define MEM_LAYOUT_ENV_SETTINGS \
 	"kernel_addr_r=0x80280000\0" \
 	"fdt_addr_r=0x83100000\0" \
-- 
2.29.2

             reply	other threads:[~2021-01-18 23:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18 23:57 Marek Vasut [this message]
2021-01-20  8:17 ` [PATCH] net: fec: Get rid of FEC_ENET_ENABLE_[TR]XC_DELAY Oleksandr Suvorov
2021-01-23 12:46   ` Stefano Babic
2021-01-23 15:49 ` sbabic at denx.de
  -- strict thread matches above, loose matches on Subject: below --
2021-01-23 19:57 Marek Vasut
2021-01-23 22:04 ` Stefano Babic
2021-01-24 14:35   ` Oleksandr Suvorov
2021-01-24 14:52     ` Marek Vasut
2021-01-24 17:14       ` Oleksandr Suvorov

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=20210118235705.550207-1-marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /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