From patchwork Wed Mar 11 10:49:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Schenker X-Patchwork-Id: 243521 List-Id: U-Boot discussion From: philippe.schenker at toradex.com (Philippe Schenker) Date: Wed, 11 Mar 2020 11:49:46 +0100 Subject: [PATCH v2 1/2] net: fec: Add possibility to enable TXC delay Message-ID: <20200311104947.26999-1-philippe.schenker@toradex.com> This patch enables the possibility to set FEC_ENET_ENABLE_TXC_DELAY or FEC_ENET_ENABLE_RXC_DELAY so one can via a define enable the RXC or TXC delay in the MAC. Signed-off-by: Philippe Schenker --- Changes in v2: None drivers/net/fec_mxc.c | 10 ++++++++++ drivers/net/fec_mxc.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index bc5b63d7881..345d37be4e8 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -503,6 +503,16 @@ 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 FEC_ENET_ENABLE_RXC_DELAY + writel(readl(&fec->eth->ecntrl) | FEC_ECNTRL_RXC_DLY, + &fec->eth->ecntrl); +#endif + #if defined(CONFIG_MX25) || defined(CONFIG_MX53) || defined(CONFIG_MX6SL) udelay(100); diff --git a/drivers/net/fec_mxc.h b/drivers/net/fec_mxc.h index 159aec89679..3c8fdda2638 100644 --- a/drivers/net/fec_mxc.h +++ b/drivers/net/fec_mxc.h @@ -188,6 +188,8 @@ struct ethernet_regs { #define FEC_ECNTRL_ETHER_EN 0x00000002 /* enable the FEC */ #define FEC_ECNTRL_SPEED 0x00000020 #define FEC_ECNTRL_DBSWAP 0x00000100 +#define FEC_ECNTRL_TXC_DLY 0x00010000 /* TXC delayed */ +#define FEC_ECNTRL_RXC_DLY 0x00020000 /* RXC delayed */ #define FEC_X_WMRK_STRFWD 0x00000100 From patchwork Wed Mar 11 10:49:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Schenker X-Patchwork-Id: 243522 List-Id: U-Boot discussion From: philippe.schenker at toradex.com (Philippe Schenker) Date: Wed, 11 Mar 2020 11:49:47 +0100 Subject: [PATCH v2 2/2] config: apalis-imx8: Enable FEC TXC delay In-Reply-To: <20200311104947.26999-1-philippe.schenker@toradex.com> References: <20200311104947.26999-1-philippe.schenker@toradex.com> Message-ID: <20200311104947.26999-2-philippe.schenker@toradex.com> define FEC_ENET_ENABLE_TXC_DELAY to enable the delay on TXC line on the MAC. This has to be done in order to meet RGMII specs. According to RGMII specs the clock should get delayed so the edges of the clock are preferrably in the middle of the edges of data-lines so they can be sampled properly. Our PHY expects the MAC to delay TXC line, as it is also written in the spec. This patch makes sure the TXC delay on the FEC is enabled Signed-off-by: Philippe Schenker --- Changes in v2: - Entered a 'why' description in patch 'config: apalis-imx8: Enable FEC TXC delay' include/configs/apalis-imx8.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/configs/apalis-imx8.h b/include/configs/apalis-imx8.h index bea035c3e23..40037157339 100644 --- a/include/configs/apalis-imx8.h +++ b/include/configs/apalis-imx8.h @@ -24,6 +24,7 @@ /* Networking */ #define FEC_QUIRK_ENET_MAC +#define FEC_ENET_ENABLE_TXC_DELAY #define CONFIG_TFTP_TSIZE