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 93FF4EB64DA for ; Sat, 8 Jul 2023 10:43:53 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A2AE28631F; Sat, 8 Jul 2023 12:43:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="WB1MxCN0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 20F4F86373; Sat, 8 Jul 2023 12:43:50 +0200 (CEST) Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5A834861E6 for ; Sat, 8 Jul 2023 12:43:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=s-vadapalli@ti.com Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 368Ahfak109074; Sat, 8 Jul 2023 05:43:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1688813021; bh=1SLN5zgr/yod+Z16etLpxD5CqHxiN7AQQELDbTlQZCg=; h=Date:CC:Subject:To:References:From:In-Reply-To; b=WB1MxCN0bXVSs0UPEZkWWYbVq1pEwRWnMfNbszr9/aeuThxHr9j0GGb94GvlCVaCd lUVB9LSJyCDIJcw24r3fakMCNZOy078THWOKLTI59VTjzZs/HQXBDIoFeq8DCnfjD1 JdBYQR5MFjrttVV4YrKNGgt1QqM20b4InD3c8G8M= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 368Ahf8H055522 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 8 Jul 2023 05:43:41 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Sat, 8 Jul 2023 05:43:40 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Sat, 8 Jul 2023 05:43:41 -0500 Received: from [172.24.227.9] (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 368AhbFW026233; Sat, 8 Jul 2023 05:43:38 -0500 Message-ID: <59b83f2e-75bb-b02a-564c-a11a32e90b8e@ti.com> Date: Sat, 8 Jul 2023 16:13:37 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 CC: , Andreas Dannenberg , "Joe Hershberger" , Ramon Fried , Ravi Gunasekaran , Grygorii Strashko , Simon Glass , Subject: Re: [PATCH] net: ti: am65-cpsw-nuss: Use dedicated port mode control registers To: References: <20230614222853.574427-1-dannenberg@ti.com> Content-Language: en-US From: Siddharth Vadapalli In-Reply-To: <20230614222853.574427-1-dannenberg@ti.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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 Hello Tom, Can this patch please be merged? On 15/06/23 03:58, Andreas Dannenberg wrote: > The different CPSW sub-system Ethernet ports have different PHY mode > control registers. In order to allow the modes to get configured > independently only the register for the port in question must be > accessed, otherwise we would just be re-configuring the mode for port 1, > while leaving all others at their power-on defaults. Fix this issue by > adding a port-number based offset to the mode control base register > address based on the fact that the control registers for the different > ports are spaced exactly 0x4 bytes apart. > > Fixes: 9d0dca1199d1 ("net: ethernet: ti: Introduce am654 gigabit eth switch subsystem driver") > Signed-off-by: Andreas Dannenberg > Reviewed-by: Siddharth Vadapalli > --- > Driver changes bench-tested on an SK-AM62 EVM by iterating through > different variations of RGMII and RMII modes for CPSW ports 1 and 2 and > checking operation as well as CTRL_ENET1_CTRL and CTRL_ENET2_CTRL > control register contents from the U-Boot command line via 'md.l'. > Testing was done on top of today's 'next' branch. > > drivers/net/ti/am65-cpsw-nuss.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ti/am65-cpsw-nuss.c b/drivers/net/ti/am65-cpsw-nuss.c > index f674b0baa3..523a4c9f91 100644 > --- a/drivers/net/ti/am65-cpsw-nuss.c > +++ b/drivers/net/ti/am65-cpsw-nuss.c > @@ -223,6 +223,8 @@ out: > return phy->link; > } > > +#define AM65_GMII_SEL_PORT_OFFS(x) (0x4 * ((x) - 1)) > + > #define AM65_GMII_SEL_MODE_MII 0 > #define AM65_GMII_SEL_MODE_RMII 1 > #define AM65_GMII_SEL_MODE_RGMII 2 > @@ -233,11 +235,12 @@ static void am65_cpsw_gmii_sel_k3(struct am65_cpsw_priv *priv, > phy_interface_t phy_mode, int slave) > { > struct am65_cpsw_common *common = priv->cpsw_common; > + fdt_addr_t gmii_sel = common->gmii_sel + AM65_GMII_SEL_PORT_OFFS(slave); > u32 reg; > u32 mode = 0; > bool rgmii_id = false; > > - reg = readl(common->gmii_sel); > + reg = readl(gmii_sel); > > dev_dbg(common->dev, "old gmii_sel: %08x\n", reg); > > @@ -273,9 +276,9 @@ static void am65_cpsw_gmii_sel_k3(struct am65_cpsw_priv *priv, > reg = mode; > dev_dbg(common->dev, "gmii_sel PHY mode: %u, new gmii_sel: %08x\n", > phy_mode, reg); > - writel(reg, common->gmii_sel); > + writel(reg, gmii_sel); > > - reg = readl(common->gmii_sel); > + reg = readl(gmii_sel); > if (reg != mode) > dev_err(common->dev, > "gmii_sel PHY mode NOT SET!: requested: %08x, gmii_sel: %08x\n", -- Regards, Siddharth.