Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4377976rdh; Tue, 28 Nov 2023 22:35:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGgeMuS7A5YBOESqT4vlQkdZsFHAvYdj6RQYyUS6/Sqr1GPd1oQogWFdCTtJNzSOBzWkZE/ X-Received: by 2002:a17:902:c40d:b0:1cf:6ac3:81c2 with SMTP id k13-20020a170902c40d00b001cf6ac381c2mr18320608plk.47.1701239746342; Tue, 28 Nov 2023 22:35:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701239746; cv=none; d=google.com; s=arc-20160816; b=o+cg249FPVuMr39MHLpF0OlIF7edtCgBUhziwvxG4C+90mDBh6URbPzkZc7v4153ZT 2lFXrm7mBGb59HF000ugi9q380fV1P+5HG09uoImC/tbnz8k/6Hb/ZudGBMyPEAvOyNP 1BVRcFOph/UyHIPAf+UZ5UBQDjBDeqZCyowIDMez7V9D75BZCEvVOkDJoChdgnGyejvV g8ftT+RSSzNhPItkHFzRDcGq9hnLZc930Ez27aLySw25DUiBtEV/WfMWu28xC9hGW8f2 G0Okuf97kk0tOTjffmlwHNa8fqfUFc32wNrtbv+BIvn12oyIWh2zmTAPxiEwSBWqG2ev 71UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sQu10j0QwV+Ad1UGRhRRU7KzoLHJiBSEBkkZ5ea4Ue8=; fh=+jwocpIEcpU4tee9Medy6FcgWbHkCjESAH5riVYuYu0=; b=qyvxPQFW6QbjqnJTzMuNNPSgzAclE7AVzM1DLDlm3nmKBr71z/wmpgcSO8F2ImDgdM YYOMNgfVW2U7VXitk9IafZ7mNFsfR+xmkZk+Ez4a2OT55Ghzxo2UcRW3yH1lmowhPjph jCMldBM7O3MGGA0l7grOKPwYrh3KO1uHQlVhicmPvD7XSg4OhNCCUQK8RKRtajox6fcn jOgJXYMqf8nKEKhKVV/g/tY2x43bowe2o4RAoM9y/0Xe79agl0PecxpFBSLVa1wd2CbG RoI4NglSgvJgEC9fpOglWqZlQB904JN2tVWe3iq18ebUFIU4NV6kXo53WwbW4gxeHRl2 XJjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=mOW8jygG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id v5-20020a1709029a0500b001c604fdbb14si12971033plp.81.2023.11.28.22.35.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 22:35:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=mOW8jygG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 81E1A807B483; Mon, 27 Nov 2023 01:05:09 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232745AbjK0JEt (ORCPT + 99 others); Mon, 27 Nov 2023 04:04:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232667AbjK0JEl (ORCPT ); Mon, 27 Nov 2023 04:04:41 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 041BB18E for ; Mon, 27 Nov 2023 01:04:47 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a02d12a2444so571166066b.3 for ; Mon, 27 Nov 2023 01:04:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1701075885; x=1701680685; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sQu10j0QwV+Ad1UGRhRRU7KzoLHJiBSEBkkZ5ea4Ue8=; b=mOW8jygGTTUSGr7OMcMHFQIUAKrZcmdrT0Lm9SCUKlwpmtlg/4E8Beo5KiXx+LW4tE CWiI0Bu77dttGNPMVAQxqOV8LaevIHY6Lpo54B8c+2ystx8GJxlnSct7WrkFeobHxSrV Tncu3FJt7ZOqm11A5bxL9nr3OFeU2IuQR3zlgAnAOJzpuwLnNw+C9db/NwnW/qGyHd68 rTF/zjAJhqIvEhGRfTxPcPLwbzKWPrw/457bv4DZ94JWReWw+GbvkewGnyOtMPwS/CO9 G7iWfj6FATirr5rGhp4ECHCV6Al/cBGsyNHjzW2W3HsgsmdZgf2K5tWnaQ0UyoEjICEv XA5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701075885; x=1701680685; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sQu10j0QwV+Ad1UGRhRRU7KzoLHJiBSEBkkZ5ea4Ue8=; b=bPzcSZ0pgL72YD90PvpbfhsH05hp1we9iRqo3KPvJxmba+Jgj35EO0KDtJ5GxXv6J5 jFRtn43o8BsrhZeGKbLfmLDVVUe1dxOKggVW64GNlAwhZgq26HJ1cntsKNRcM32dgEBs fstFlV5wXKVYhSPsDA85s0nT/HygfbLrZDei4OxEQ9vvfTsGGnaOYBMiL9pfKl/o6XCL /Y/9vqdICAKVX5k38X0PSLDBvWyRTYcYx++ady2LU1QEu8blvZCHCt/OzNDxDxEQKY62 Qd9BhoDjjtzNoJByxnoX3t8Kj6wTqR1hhZToYHI35fNyVc1XJQ2cmGfyAOav9jxYUKKL RbPA== X-Gm-Message-State: AOJu0YyPtS1UClFS/oUZsLssxe4M+lT9CaEsKuFHStz96fJQZW18dDsm NItOJVKosWV0PYxxJz58dvO5uA4JegSCVl5GGN0= X-Received: by 2002:a17:906:eb0f:b0:a02:95ea:1289 with SMTP id mb15-20020a170906eb0f00b00a0295ea1289mr8362060ejb.20.1701075885302; Mon, 27 Nov 2023 01:04:45 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.125]) by smtp.gmail.com with ESMTPSA id ay14-20020a170906d28e00b009fad1dfe472sm5456539ejb.153.2023.11.27.01.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 01:04:44 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, geert+renesas@glider.be, wsa+renesas@sang-engineering.com, robh@kernel.org, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, mitsuhiro.kimura.kc@renesas.com, masaru.nagai.vx@renesas.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH 3/6] net: ravb: Make write access to CXR35 first before accessing other EMAC registers Date: Mon, 27 Nov 2023 11:04:23 +0200 Message-Id: <20231127090426.3761729-4-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231127090426.3761729-1-claudiu.beznea.uj@bp.renesas.com> References: <20231127090426.3761729-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 27 Nov 2023 01:05:09 -0800 (PST) From: Claudiu Beznea Hardware manual of RZ/G3S (and RZ/G2L) specifies the following on the description of CXR35 register (chapter "PHY interface select register (CXR35)"): "After release reset, make write-access to this register before making write-access to other registers (except MDIOMOD). Even if not need to change the value of this register, make write-access to this register at least one time. Because RGMII/MII MODE is recognized by accessing this register". The setup procedure for EMAC module (chapter "Setup procedure" of RZ/G3S, RZ/G2L manuals) specifies the E-MAC.CXR35 register is the first EMAC register that is to be configured. Note [A] from chapter "PHY interface select register (CXR35)" specifies the following: [A] The case which CXR35 SEL_XMII is used for the selection of RGMII/MII in APB Clock 100 MHz. (1) To use RGMII interface, Set ‘H’03E8_0000’ to this register. (2) To use MII interface, Set ‘H’03E8_0002’ to this register. Take into account these indication. Fixes: 1089877ada8d ("ravb: Add RZ/G2L MII interface support") Signed-off-by: Claudiu Beznea Reviewed-by: Sergey Shtylyov --- Changes since [1]: - collected Rb tag [1] https://lore.kernel.org/all/20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com/ drivers/net/ethernet/renesas/ravb_main.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index cd3474168452..2d4f4fb3d16e 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -515,6 +515,15 @@ static void ravb_emac_init_gbeth(struct net_device *ndev) { struct ravb_private *priv = netdev_priv(ndev); + if (priv->phy_interface == PHY_INTERFACE_MODE_MII) { + ravb_write(ndev, (1000 << 16) | CXR35_SEL_XMII_MII, CXR35); + ravb_modify(ndev, CXR31, CXR31_SEL_LINK0 | CXR31_SEL_LINK1, 0); + } else { + ravb_write(ndev, (1000 << 16) | CXR35_SEL_XMII_RGMII, CXR35); + ravb_modify(ndev, CXR31, CXR31_SEL_LINK0 | CXR31_SEL_LINK1, + CXR31_SEL_LINK0); + } + /* Receive frame limit set register */ ravb_write(ndev, GBETH_RX_BUFF_MAX + ETH_FCS_LEN, RFLR); @@ -537,14 +546,6 @@ static void ravb_emac_init_gbeth(struct net_device *ndev) /* E-MAC interrupt enable register */ ravb_write(ndev, ECSIPR_ICDIP, ECSIPR); - - if (priv->phy_interface == PHY_INTERFACE_MODE_MII) { - ravb_modify(ndev, CXR31, CXR31_SEL_LINK0 | CXR31_SEL_LINK1, 0); - ravb_write(ndev, (1000 << 16) | CXR35_SEL_XMII_MII, CXR35); - } else { - ravb_modify(ndev, CXR31, CXR31_SEL_LINK0 | CXR31_SEL_LINK1, - CXR31_SEL_LINK0); - } } static void ravb_emac_init_rcar(struct net_device *ndev) -- 2.39.2