Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp105875rdb; Wed, 29 Nov 2023 22:38:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4/ekLcUwANZbwdSAx2w0zyVFLTl/FQkYL3d0Ju9JJzMeyr+7qHiBjrIuN2N3yIqLn0zVj X-Received: by 2002:a17:90b:33cb:b0:285:d550:994b with SMTP id lk11-20020a17090b33cb00b00285d550994bmr12191147pjb.40.1701326330576; Wed, 29 Nov 2023 22:38:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701326330; cv=none; d=google.com; s=arc-20160816; b=lLQ8KJfCdVCcxkPCGrHmaQ/PyB6BySNDFr+N6PRUrzElpqv9/cL0scUOMllosZVBep qHfHGwwN38BA9oI7eynMMLEbtuf+3uCm25I92WLV+dXo2klRxto4XQw6Euv3O7aHjIyE poQ7BNeMFmrR5nOzt4otuWYFzl4UQA323L6tQJGdPAQJ3lGOJbpCDIA6H+ZdTW7BCVSV 5R8fzyjkUae+9ATAvzCux0kFZSvv56wFXvM18H0HaLYproxNgx7Rmtozu2jCnpZRUaxg logEeVTfzSrUkTHvv/lPOVUj1aDjLLEm7nmr9Bp9cej/sKhV4lyaAvNDJiVtEHwWYl5h SCPg== 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=IoaNebWj6WdqROHUgOaXFN9XZbA5N7Tmp23rLr1Pw/A=; fh=0TmBxb3iK+HPjRlYDVXDLy5dPQUGD9gLiQry0et3j2E=; b=vgVMoLA7Pd44c9Titk+WczT9iN7SNBGqOZbf8vaqkLoZo0rgIjvUAYtlHpuUBZBXxD ALDGyrqqIG9x/74mbSXQ812VCfA8Je7v4uQTdqisI4IF2x0jvljtS29HGI0nMqgyfRdf y0sFzEVWQdaOXjimSlQzUN8BAiJ06w0lcVL0YzNToinDDw5EX/x2LT+rAY3yo4s62XSd F8DZNaH5aNDfOsxrRNClwxk8+mDNgBSsCyuBDo26gQ3+OjtAIoyNAVDZ7mXGHWKijxwd YuROEDRwIgONl64rruNnxEZ76VP5NoB1vjwDn1ifVGQRKkOd5f4ju4yV0qse23d5wvKn vNig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=QnXBzJ+g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id z12-20020a17090ad78c00b002800fffeb61si2988358pju.5.2023.11.29.22.38.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 22:38:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=QnXBzJ+g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id E4389823FAE5; Tue, 28 Nov 2023 00:05:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344025AbjK1IEy (ORCPT + 99 others); Tue, 28 Nov 2023 03:04:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343982AbjK1IEm (ORCPT ); Tue, 28 Nov 2023 03:04:42 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E42C7DB for ; Tue, 28 Nov 2023 00:04:47 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-507a0907896so6657047e87.2 for ; Tue, 28 Nov 2023 00:04:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1701158686; x=1701763486; 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=IoaNebWj6WdqROHUgOaXFN9XZbA5N7Tmp23rLr1Pw/A=; b=QnXBzJ+g115eGwqrZGkYam4RQe2aCxxcfRRj2P+wZuoHuDS+QUdWc3XIIS6xY6ygkX 9oLkZHXsXjJV+8eUvT/l1bQ3faYTQ0fdIBu7T94qOMwB0Nzp2T5utMqZCR6t5IyI9IHG g967U2liIckFIWnLJa7IFW7Z5vdDRLmSnex2U+y9fWrqKilyFH/2AYuVKZ8y6nXEu2YV iMlL5VRDuIB3pB65bSVEhfat1nNB7J+CNd0ZQuGtjvvjDSIdmJnCkGUQGIrAK7S6cieo XBUaMvD8HmKWHTWT2arr1E3aBf+lrQOqNFuDBwH5jrsemVtb/rn/EVI+I0Nwc5QiYnib R54w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701158686; x=1701763486; 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=IoaNebWj6WdqROHUgOaXFN9XZbA5N7Tmp23rLr1Pw/A=; b=cYGpJ8Nbm1tpYA/AXyoVABi1fltVCOsrYPzxvFyBeJNBtmrsgGcDB7Y60R6Q0e1hzv ZV1/okC+2M2iW2hBLyUxThVUGfh+dlYDWDs77fiSIajJAV9Q7OJ29uV1dBNpscbcPfLA unrrjJcM+LS+YRlNzrFakkaVS4248TPcERL/5gvPyKOFiuaMUx8NXW4St1TEPcD0liuj gc2V6r9P+XijejJ7WHqJDq7woOCrrDBEgFeaY4qy2wt6DIOCDtT1pjMTJDLIpJ1oteI5 oxo/u8yHFKgw6T9vgyhOdGnMzfwzF4ClnwtscjdjM1dvuL2aFsCz2M62gzCfmg/oHkSk euOw== X-Gm-Message-State: AOJu0Yz2ZkLprqqAK295Q7TTmQHPOj1ZIl7chGYKpJ8P+S0Ie9SKUxYt 65LjmNduUC5KFTBkeo692R/YcQ== X-Received: by 2002:a19:8c5c:0:b0:50a:b9dd:43f with SMTP id i28-20020a198c5c000000b0050ab9dd043fmr8382999lfj.21.1701158686229; Tue, 28 Nov 2023 00:04:46 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.125]) by smtp.gmail.com with ESMTPSA id g18-20020a05600c4ed200b0040b4ccdcffbsm1127534wmq.2.2023.11.28.00.04.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 00:04:45 -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, 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 Subject: [PATCH v2 3/6] net: ravb: Make write access to CXR35 first before accessing other EMAC registers Date: Tue, 28 Nov 2023 10:04:36 +0200 Message-Id: <20231128080439.852467-4-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231128080439.852467-1-claudiu.beznea.uj@bp.renesas.com> References: <20231128080439.852467-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 howler.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 (howler.vger.email [0.0.0.0]); Tue, 28 Nov 2023 00:05:28 -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") Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- Changes in v2: - none 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 0af2ace286be..62a986b5de41 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