net: fec: Get rid of FEC_ENET_ENABLE_[TR]XC_DELAY
Subsystems (3)
PATCH v2 1/1 net: fec: Get rid of FEC_ENET_ENABLE_[TR]XC_DELAY
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.
---
V2: Add missing ifdef DM_ETH around the code using fec->interface
--- 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, 9 insertions(+), 15 deletions(-)
arch/arm/dts/fsl-imx8qm-apalis.dts +1 -1
@@ -503,7 +503,7 @@ pinctrl-0 = <&pinctrl_fec1>; fsl,magic-packet; phy-handle = <ðphy0>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; phy-reset-duration = <10>; phy-reset-gpios = <&gpio1 11 1>; status = "okay";
arch/arm/dts/fsl-imx8qxp-apalis.dts +1 -1
@@ -229,7 +229,7 @@ pinctrl-0 = <&pinctrl_fec1>; fsl,magic-packet; phy-handle = <ðphy0>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; phy-reset-duration = <10>; phy-reset-post-delay = <150>; phy-reset-gpios = <&gpio3 4 GPIO_ACTIVE_LOW>;
drivers/net/fec_mxc.c +7 -7
@@ -507,14 +507,14 @@ 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 +#ifdef CONFIG_DM_ETH +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); +if (fec->interface ==PHY_INTERFACE_MODE_RGMII_ID || + fec->interface ==PHY_INTERFACE_MODE_RGMII_RXID ) +setbits_le32 (&fec->eth->ecntrl,FEC_ECNTRL_RXC_DLY );#endif #if defined(CONFIG_MX25 ) || defined(CONFIG_MX53 ) || defined(CONFIG_MX6SL )
include/configs/apalis-imx8.h +0 -3
@@ -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
include/configs/apalis-imx8x.h +0 -3
@@ -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" \
Signature · 1 line
2.29.2
PATCH v2 1/1 net: fec: Get rid of FEC_ENET_ENABLE_[TR]XC_DELAY
Hi Marek,
Sorry for the late reply.
Quoted 25 lines · Marek Vasut
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 <[email protected]>Cc Oleksandr Suvorov <[email protected]>Cc Stefano Babic <[email protected]>Cc Ramon Fried <[email protected]>---
V2: Add missing ifdefDM_ETHaround the code usingfec->interface--- 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, 9 insertions(+), 15 deletions(-)arch/arm/dts/fsl-imx8qm-apalis.dts +0
-0
arch/arm/dts/fsl-imx8qm-apalis.dts line 506
Quoted 5 lines
arch/arm/dts/fsl-imx8qm-apalis.dts +1
-1@@ -503,7 +503,7 @@ pinctrl-0 = <&pinctrl_fec1>; fsl,magic-packet; phy-handle = <ðphy0>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id";
The PHY on Apalis iMX8QM expects the delay on TXC line only. So "rgmii-txid" would be better there.
Quoted 47 lines
arch/arm/dts/fsl-imx8qm-apalis.dts +0
-0phy-reset-duration = <10>; phy-reset-gpios = <&gpio1 11 1>; status = "okay";arch/arm/dts/fsl-imx8qxp-apalis.dts +1
-1@@ -229,7 +229,7 @@ pinctrl-0 = <&pinctrl_fec1>; fsl,magic-packet; phy-handle = <ðphy0>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; phy-reset-duration = <10>; phy-reset-post-delay = <150>; phy-reset-gpios = <&gpio3 4 GPIO_ACTIVE_LOW>;drivers/net/fec_mxc.c +7
-7@@ -507,14 +507,14 @@ 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 +#ifdef CONFIG_DM_ETH +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); +if (fec->interface ==PHY_INTERFACE_MODE_RGMII_ID || + fec->interface ==PHY_INTERFACE_MODE_RGMII_RXID ) +setbits_le32 (&fec->eth->ecntrl,FEC_ECNTRL_RXC_DLY );#endif #if defined(CONFIG_MX25 ) || defined(CONFIG_MX53 ) || defined(CONFIG_MX6SL )include/configs/apalis-imx8.h +0
-0
include/configs/apalis-imx8.h line 24
Quoted 4 lines
include/configs/apalis-imx8.h +0
-1@@ -21,9 +21,6 @@#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG /* Networking */ -#define FEC_QUIRK_ENET_MAC
This quirk can't be dropped so far.
Quoted 22 lines
include/configs/apalis-imx8.h +0
-2-#define FEC_ENET_ENABLE_TXC_DELAY -#define CONFIG_TFTP_TSIZE #define CONFIG_IPADDR 192.168.10.2include/configs/apalis-imx8x.h +0
-4@@ -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
Signature · 4 lines
Best regards Oleksandr Suvorov cryosay at gmail.com
PATCH v2 1/1 net: fec: Get rid of FEC_ENET_ENABLE_[TR]XC_DELAY
Quoted 1 line · Oleksandr Suvorov
Hi Marek,
Hi,
[...]
Quoted 10 lines
arch/arm/dts/fsl-imx8qm-apalis.dts line 506
Quoted 7 lines
+++
b/arch/arm/dts/fsl-imx8qm-apalis.dtsarch/arm/dts/fsl-imx8qm-apalis.dts +1
-1@@ -503,7 +503,7 @@ pinctrl-0 = <&pinctrl_fec1>; fsl,magic-packet; phy-handle = <ðphy0>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id";The PHY on Apalis iMX8QM expects the delay on TXC line only. So "rgmii-txid" would be better there.
Can you prepare me a tested diff for the apalis boards so I can squash it into V3 ? That would be easiest.
[...]
Quoted 4 lines
include/configs/apalis-imx8.h line 24
Quoted 2 lines
include/configs/apalis-imx8.h +0
-1/* Networking */ -#define FEC_QUIRK_ENET_MAC This quirk can't be dropped so far.
With the following patch applied, I believe it can:
[PATCH] ARM: imx: Add missing FEC ethernet quirk for MX8M
[...]