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
Cc: Marek Vasut <marex@denx.de>, Ramon Fried <rfried.dev@gmail.com>,
	"Ariel D'Alessandro" <ariel.dalessandro@collabora.com>,
	"NXP i.MX U-Boot Team" <uboot-imx@nxp.com>,
	Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>,
	Fabio Estevam <festevam@gmail.com>,
	Joe Hershberger <joe.hershberger@ni.com>,
	Lukasz Majewski <lukma@denx.de>,
	Marcel Ziswiler <marcel.ziswiler@toradex.com>,
	Michael Trimarchi <michael@amarulasolutions.com>,
	Peng Fan <peng.fan@nxp.com>, Sean Anderson <seanga2@gmail.com>,
	Stefano Babic <sbabic@denx.de>,
	Tim Harvey <tharvey@gateworks.com>,
	Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
Subject: [PATCH v4 06/14] net: dwc_eth_qos: Set DMA_MODE SWR bit to reset the MAC
Date: Mon,  6 Mar 2023 15:53:46 +0100	[thread overview]
Message-ID: <20230306145354.7439-6-marex@denx.de> (raw)
In-Reply-To: <20230306145354.7439-1-marex@denx.de>

The driver currently only waits for DMA_MODE SWR bit to clear itself.
This is insufficient e.g. on i.MX8M Plus, where the MAC must be reset
before IOMUX GPR[1] content is latched into the MAC and used. Without
the proper reset, the i.MX8M Plus MAC variant does not take the value
in IOMUX GPR[1] into account, which makes it impossible e.g. to switch
interface mode from RGMII to any other.

Since proper reset is desired in general to put the block into defined
state, always assert the DMA_MODE SWR bit before waiting for the bit
to clear itself.

Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: "Ariel D'Alessandro" <ariel.dalessandro@collabora.com>
Cc: "NXP i.MX U-Boot Team" <uboot-imx@nxp.com>
Cc: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Michael Trimarchi <michael@amarulasolutions.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
Cc: u-boot@lists.denx.de
---
V2: Add RB from Ramon
V3: No change
V4: No change
---
 drivers/net/dwc_eth_qos.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c
index 9a5575e7b83..ec58697b311 100644
--- a/drivers/net/dwc_eth_qos.c
+++ b/drivers/net/dwc_eth_qos.c
@@ -761,6 +761,12 @@ static int eqos_start(struct udevice *dev)
 
 	eqos->reg_access_ok = true;
 
+	/*
+	 * Assert the SWR first, the actually reset the MAC and to latch in
+	 * e.g. i.MX8M Plus GPR[1] content, which selects interface mode.
+	 */
+	setbits_le32(&eqos->dma_regs->mode, EQOS_DMA_MODE_SWR);
+
 	ret = wait_for_bit_le32(&eqos->dma_regs->mode,
 				EQOS_DMA_MODE_SWR, false,
 				eqos->config->swr_wait, false);
-- 
2.39.2


  parent reply	other threads:[~2023-03-06 14:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06 14:53 [PATCH v4 01/14] clk: imx8mp: Add EQoS MAC clock Marek Vasut
2023-03-06 14:53 ` [PATCH v4 02/14] net: Pull board_interface_eth_init() into common code Marek Vasut
2023-03-30 15:23   ` sbabic
2023-03-06 14:53 ` [PATCH v4 03/14] net: dwc_eth_qos: Drop bogus return after goto Marek Vasut
2023-03-30 15:23   ` sbabic
2023-03-06 14:53 ` [PATCH v4 04/14] net: dwc_eth_qos: Drop unused dm_gpio_free() on STM32 Marek Vasut
2023-03-30 15:23   ` sbabic
2023-03-06 14:53 ` [PATCH v4 05/14] net: dwc_eth_qos: Staticize eqos_inval_buffer_tegra186() Marek Vasut
2023-03-30 15:23   ` sbabic
2023-03-06 14:53 ` Marek Vasut [this message]
2023-03-30 15:23   ` [PATCH v4 06/14] net: dwc_eth_qos: Set DMA_MODE SWR bit to reset the MAC sbabic
2023-03-06 14:53 ` [PATCH v4 07/14] net: dwc_eth_qos: Add DM CLK support for i.MX8M Plus Marek Vasut
2023-03-30 15:31   ` sbabic
2023-03-06 14:53 ` [PATCH v4 08/14] net: dwc_eth_qos: Add i.MX8M Plus RMII support Marek Vasut
2023-03-30 15:22   ` sbabic
2023-03-06 14:53 ` [PATCH v4 09/14] net: dwc_eth_qos: Add board_interface_eth_init() for i.MX8M Plus Marek Vasut
2023-03-30 15:22   ` sbabic
2023-03-06 14:53 ` [PATCH v4 10/14] net: fec_mxc: Add ref clock setup support for i.MX8M Mini/Nano/Plus Marek Vasut
2023-03-30 15:23   ` sbabic
2023-03-06 14:53 ` [PATCH v4 11/14] net: fec_mxc: Add board_interface_eth_init() " Marek Vasut
2023-03-30 15:23   ` sbabic
2023-03-06 14:53 ` [PATCH v4 12/14] arm64: dts: imx8mp: Drop EQoS clock workaround Marek Vasut
2023-03-30 15:22   ` sbabic
2023-03-06 14:53 ` [PATCH v4 13/14] arm64: imx8mp: Drop EQoS GPR[1] board workaround Marek Vasut
2023-03-30 15:23   ` sbabic
2023-03-06 14:53 ` [PATCH v4 14/14] arm64: imx8mm: imx8mn: imx8mp: Drop FEC " Marek Vasut
2023-03-30 15:23   ` sbabic
2023-03-30 15:23 ` [PATCH v4 01/14] clk: imx8mp: Add EQoS MAC clock sbabic

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=20230306145354.7439-6-marex@denx.de \
    --to=marex@denx.de \
    --cc=andrey.zhizhikin@leica-geosystems.com \
    --cc=ariel.dalessandro@collabora.com \
    --cc=festevam@gmail.com \
    --cc=joe.hershberger@ni.com \
    --cc=lukma@denx.de \
    --cc=marcel.ziswiler@toradex.com \
    --cc=michael@amarulasolutions.com \
    --cc=peng.fan@nxp.com \
    --cc=rfried.dev@gmail.com \
    --cc=sbabic@denx.de \
    --cc=seanga2@gmail.com \
    --cc=tharvey@gateworks.com \
    --cc=tommaso.merciai@amarulasolutions.com \
    --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