Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33C14C678D4 for ; Mon, 6 Mar 2023 14:57:49 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 305E3858FC; Mon, 6 Mar 2023 15:56:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1678114584; bh=CquWvhLfoTueQ3PPwS/plwmii5N7PfGCjmt2gQxIM2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=xeh5wbHpa8odxO4hjOj+/S/rVZBtAPxmrpy6YkOhaTpB254xfMeTN0diRzsckXznJ 9KJc7UXkdxrfZn1ZlKlxbqm1YDdbd9MLM8DAuNS/3A5bOZSJEKXudtmmFlGs2rrvuQ MiLvH9D/7nXysnIchytfT9jenkfnWdS1JKvx8/rFRY4pIA61yq6DILSYmhcbVRngZ8 RwBKl55MHEEttTcsJVb8d0W2RfS+rFO4sQmryoWlqSiZN6wgWO2ncmTaOJT7/AHuiK nJb8PUX4FKMLA54iWrAhE5OgI3QHuS2LW93JJMG2++m/+P4w/53/qBOwokjjG2rZ1T VYOpP5vU20O8A== Received: from tr.lan (ip-86-49-120-218.bb.vodafone.cz [86.49.120.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 38D78859E2; Mon, 6 Mar 2023 15:54:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1678114451; bh=CquWvhLfoTueQ3PPwS/plwmii5N7PfGCjmt2gQxIM2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fJ2tqd9kl1gg7OC5PwK+m6HWIO1L+fA37kHl49nlUHawd7HVaFURlr12g7vU0MMNM KYLYwUPsPyAxSRQo0XjV5q97N4TgFrnwEU+nS1pe/YGjaJSRN9/TrQNQZtY5m8qVwv w4sh+wa9MKDfIydUInYDGnkliJu1efJtfQi/0EqlxJ/WNctAm3rKMRJPb606qhE1Jw b/9/6QJzN0BkOCdoYXHPtzgRQ4lt7JiQeld9Z/hAMXmxcLYCWvd+VWbqMqXXGOvfAe vI7TF7Y8EYmTvyns6fBsCbXhMIRqzwbU9Vrhi9WuyBBVJGWU+06LwGUWrj/Wdjvzdy zPh1rHpAoEj/Q== From: Marek Vasut To: u-boot@lists.denx.de Cc: Marek Vasut , Ramon Fried , "Ariel D'Alessandro" , "NXP i.MX U-Boot Team" , Andrey Zhizhikin , Fabio Estevam , Joe Hershberger , Lukasz Majewski , Marcel Ziswiler , Michael Trimarchi , Peng Fan , Sean Anderson , Stefano Babic , Tim Harvey , Tommaso Merciai 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 Message-Id: <20230306145354.7439-6-marex@denx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230306145354.7439-1-marex@denx.de> References: <20230306145354.7439-1-marex@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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 Signed-off-by: Marek Vasut --- Cc: "Ariel D'Alessandro" Cc: "NXP i.MX U-Boot Team" Cc: Andrey Zhizhikin Cc: Fabio Estevam Cc: Joe Hershberger Cc: Lukasz Majewski Cc: Marcel Ziswiler Cc: Marek Vasut Cc: Michael Trimarchi Cc: Peng Fan Cc: Ramon Fried Cc: Sean Anderson Cc: Stefano Babic Cc: Tim Harvey Cc: Tommaso Merciai 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