Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6006985rwl; Tue, 11 Apr 2023 13:12:00 -0700 (PDT) X-Google-Smtp-Source: AKy350YqJiNA45JEhmiGSA0kA6C9pBULEeIpm64C9bo9VID9/a4ErXNbmbXMlUPkEq8JNIFUjb5e X-Received: by 2002:a17:907:8dc4:b0:94a:8d90:14e5 with SMTP id tg4-20020a1709078dc400b0094a8d9014e5mr6219188ejc.65.1681243919960; Tue, 11 Apr 2023 13:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681243919; cv=none; d=google.com; s=arc-20160816; b=bfv24D0iNbF4hNx8a/w0AwkKjMB2rh8neY7cYOWGK2yacoWsRj5bACVlSyFQ+xMHx7 XVx1RNzK77SjvCWVm8lc0Lonkt9WZ2n+Ftg9sgs/QbG2U2y7K/TCVmntBqjk4zhetIR8 iPCLUkoOA5fEXjp1GFJlWSrQqtqV9p3/eHZwcCQwH+5WDbdbJcz8P3Us0MC+cHgBSi92 jHMQ7dkWyMvA4DFuyIXT0kXuQ1GDZ8g76Zk1JYp2m5EfMoMLdN4/x8aN/iLxl4TL8o02 pGz0JD85whfoHF1QkJ3/HSuthZSk5rSF10mj9p+1E7zS9W3MxhhPv5iE6gB2Vaq7lh1L 7jUg== 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=QM/JDn6zIGqyihwEr6VtdCtu+tgT+kE/dI0xjSGrnCs=; b=C9MQaUqLcZi8ln15XOCTEG4OrKjZQpoJl0RpjmKv6h4P4lqadI+3GtxeNPtmZ8h+tY rTdTeOZ4fBD0Ml3V7rvj0nf9PTejiiaDEofGwP9Lxl5wDuJEDqQCtSbWcGLhdfUPp0cy ZmY+jQzLTp2INbXotZR3me7HaKkmZxg4JdVxzivff3eLv1zi5QrTeb5GmsqBZCa6rbKa xCYVLbB0116ifxOAMY2jai8S5ZK/OwtL/Uzgvc+PTTQ6IxChQvDfNHIciVp3NCsQ3d2T dwISfFdfbAR4CyzXMFiBOCeZktbWwtR04Gy92xGjoZOKDoehuA5oi9eeEAdW0fJIrSqi N8HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="JdVt5/ND"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id tj5-20020a170907c24500b00930f5af3877si1227426ejc.343.2023.04.11.13.11.10; Tue, 11 Apr 2023 13:11:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="JdVt5/ND"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230006AbjDKUIG (ORCPT + 99 others); Tue, 11 Apr 2023 16:08:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbjDKUHW (ORCPT ); Tue, 11 Apr 2023 16:07:22 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E37A36180 for ; Tue, 11 Apr 2023 13:05:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681243541; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QM/JDn6zIGqyihwEr6VtdCtu+tgT+kE/dI0xjSGrnCs=; b=JdVt5/NDRFKED6yUXZ+R4PMjPGRtTUmUCDYTwSteGP7HDDVwOw+P4jPSb/LXGNOJ5nqPeg Jk2WjziQF8tt2nQ6J4PaG9SCw2VmvUrwbN6DqjvLQsl9ZpEwXHQhPWcXejpvJ2151kpX4Y Z4ifMrIbziGTt6CrqjN/2WUQTYkcm+U= Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-78-rPmt32rvNq6f8bdMwEkIfQ-1; Tue, 11 Apr 2023 16:05:33 -0400 X-MC-Unique: rPmt32rvNq6f8bdMwEkIfQ-1 Received: by mail-oi1-f199.google.com with SMTP id e18-20020a056808149200b00386f33cd11dso2689194oiw.5 for ; Tue, 11 Apr 2023 13:05:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681243526; 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=QM/JDn6zIGqyihwEr6VtdCtu+tgT+kE/dI0xjSGrnCs=; b=h3YyKPGJTFG2F2C89SHDaGucOtvCUhpQa01zj2U9qdKR3jhs/wzVNsD8qfRU2DxBk/ Lzv3rkdF0gFsAnmUnHeREY3zHuSrqxzalYbQXqs3t2ip97LSeu5ZNe0LYLe6DPjgonqh 7VpXTTJRah23O2X/QTW2JySIkKKGLSXL6aXCe0DiGqhk7QWX/BXHNp9FKQYprQ+Qhcqo 8Lri43lVDVE0R1SKUDhV84x5Kp6B+qnkXYmLoKVfTfOL+cam4D3p926Tk5pjgMxQmfcI IrAd3ULy/GGTqUTj3eA0TwSiy5O5bMH6gjwlQDBw211ksB6QKaDb5X9jDKmVbfPD/dyz 9anQ== X-Gm-Message-State: AAQBX9c1xjwA6OZqKptaZnRaNDK4ZgHE1tRPdbVTkIS7RGwuI9stuxRb nPALUa5xeTOO+prugai87tRBYRclHpUys5ebkNy0G9TDPy2BMHb/oswirVpmIxN6YeO4wim9/TR 58SUztm9lyK7t1EfrCZK3fKqD6BGWrYKHyfBpYSFgyUUwW8Dh7xsljphbIcCQzJ37ELMgGHYLTZ Ih2yMJyWRBjjQ= X-Received: by 2002:aca:2316:0:b0:386:d4f7:6774 with SMTP id e22-20020aca2316000000b00386d4f76774mr1544034oie.37.1681243526496; Tue, 11 Apr 2023 13:05:26 -0700 (PDT) X-Received: by 2002:aca:2316:0:b0:386:d4f7:6774 with SMTP id e22-20020aca2316000000b00386d4f76774mr1543980oie.37.1681243525830; Tue, 11 Apr 2023 13:05:25 -0700 (PDT) Received: from halaney-x13s.attlocal.net (104-53-165-62.lightspeed.stlsmo.sbcglobal.net. [104.53.165.62]) by smtp.gmail.com with ESMTPSA id e20-20020a056808149400b00387764759a3sm5868545oiw.24.2023.04.11.13.05.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 13:05:25 -0700 (PDT) From: Andrew Halaney To: linux-kernel@vger.kernel.org Cc: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, vkoul@kernel.org, bhupesh.sharma@linaro.org, wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, mturquette@baylibre.com, peppe.cavallaro@st.com, alexandre.torgue@foss.st.com, joabreu@synopsys.com, mcoquelin.stm32@gmail.com, richardcochran@gmail.com, linux@armlinux.org.uk, veekhee@apple.com, tee.min.tan@linux.intel.com, mohammad.athari.ismail@intel.com, jonathanh@nvidia.com, ruppala@nvidia.com, bmasney@redhat.com, andrey.konovalov@linaro.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, ncai@quicinc.com, jsuraj@qti.qualcomm.com, hisunil@quicinc.com, echanude@redhat.com, Andrew Halaney Subject: [PATCH net-next v4 11/12] net: stmmac: dwmac-qcom-ethqos: Use loopback_en for all speeds Date: Tue, 11 Apr 2023 15:04:08 -0500 Message-Id: <20230411200409.455355-12-ahalaney@redhat.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230411200409.455355-1-ahalaney@redhat.com> References: <20230411200409.455355-1-ahalaney@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It seems that this variable should be used for all speeds, not just 1000/100. While at it refactor it slightly to be more readable, including fixing the typo in the variable name. Signed-off-by: Andrew Halaney --- Changes since v2/v3: * None Changes since v1: * Use a consistent subject prefix with other stmmac changes in series (myself) .../stmicro/stmmac/dwmac-qcom-ethqos.c | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index abec6dd27992..ec9e93147716 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -78,7 +78,7 @@ struct ethqos_emac_por { struct ethqos_emac_driver_data { const struct ethqos_emac_por *por; unsigned int num_por; - bool rgmii_config_looback_en; + bool rgmii_config_loopback_en; }; struct qcom_ethqos { @@ -91,7 +91,7 @@ struct qcom_ethqos { const struct ethqos_emac_por *por; unsigned int num_por; - bool rgmii_config_looback_en; + bool rgmii_config_loopback_en; }; static int rgmii_readl(struct qcom_ethqos *ethqos, unsigned int offset) @@ -183,7 +183,7 @@ static const struct ethqos_emac_por emac_v2_3_0_por[] = { static const struct ethqos_emac_driver_data emac_v2_3_0_data = { .por = emac_v2_3_0_por, .num_por = ARRAY_SIZE(emac_v2_3_0_por), - .rgmii_config_looback_en = true, + .rgmii_config_loopback_en = true, }; static const struct ethqos_emac_por emac_v2_1_0_por[] = { @@ -198,7 +198,7 @@ static const struct ethqos_emac_por emac_v2_1_0_por[] = { static const struct ethqos_emac_driver_data emac_v2_1_0_data = { .por = emac_v2_1_0_por, .num_por = ARRAY_SIZE(emac_v2_1_0_por), - .rgmii_config_looback_en = false, + .rgmii_config_loopback_en = false, }; static int ethqos_dll_configure(struct qcom_ethqos *ethqos) @@ -281,6 +281,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos) { int phase_shift; int phy_mode; + int loopback; /* Determine if the PHY adds a 2 ns TX delay or the MAC handles it */ phy_mode = device_get_phy_mode(ðqos->pdev->dev); @@ -294,6 +295,12 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos) rgmii_updatel(ethqos, RGMII_CONFIG2_TX_TO_RX_LOOPBACK_EN, 0, RGMII_IO_MACRO_CONFIG2); + /* Determine if this platform wants loopback enabled after programming */ + if (ethqos->rgmii_config_loopback_en) + loopback = RGMII_CONFIG_LOOPBACK_EN; + else + loopback = 0; + /* Select RGMII, write 0 to interface select */ rgmii_updatel(ethqos, RGMII_CONFIG_INTF_SEL, 0, RGMII_IO_MACRO_CONFIG); @@ -326,12 +333,8 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos) rgmii_updatel(ethqos, SDCC_DDR_CONFIG_PRG_DLY_EN, SDCC_DDR_CONFIG_PRG_DLY_EN, SDCC_HC_REG_DDR_CONFIG); - if (ethqos->rgmii_config_looback_en) - rgmii_updatel(ethqos, RGMII_CONFIG_LOOPBACK_EN, - RGMII_CONFIG_LOOPBACK_EN, RGMII_IO_MACRO_CONFIG); - else - rgmii_updatel(ethqos, RGMII_CONFIG_LOOPBACK_EN, - 0, RGMII_IO_MACRO_CONFIG); + rgmii_updatel(ethqos, RGMII_CONFIG_LOOPBACK_EN, + loopback, RGMII_IO_MACRO_CONFIG); break; case SPEED_100: @@ -363,13 +366,8 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos) rgmii_updatel(ethqos, SDCC_DDR_CONFIG_EXT_PRG_RCLK_DLY_EN, SDCC_DDR_CONFIG_EXT_PRG_RCLK_DLY_EN, SDCC_HC_REG_DDR_CONFIG); - if (ethqos->rgmii_config_looback_en) - rgmii_updatel(ethqos, RGMII_CONFIG_LOOPBACK_EN, - RGMII_CONFIG_LOOPBACK_EN, RGMII_IO_MACRO_CONFIG); - else - rgmii_updatel(ethqos, RGMII_CONFIG_LOOPBACK_EN, - 0, RGMII_IO_MACRO_CONFIG); - + rgmii_updatel(ethqos, RGMII_CONFIG_LOOPBACK_EN, + loopback, RGMII_IO_MACRO_CONFIG); break; case SPEED_10: @@ -403,7 +401,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos) SDCC_DDR_CONFIG_EXT_PRG_RCLK_DLY_EN, SDCC_HC_REG_DDR_CONFIG); rgmii_updatel(ethqos, RGMII_CONFIG_LOOPBACK_EN, - RGMII_CONFIG_LOOPBACK_EN, RGMII_IO_MACRO_CONFIG); + loopback, RGMII_IO_MACRO_CONFIG); break; default: dev_err(ðqos->pdev->dev, @@ -548,7 +546,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) data = of_device_get_match_data(&pdev->dev); ethqos->por = data->por; ethqos->num_por = data->num_por; - ethqos->rgmii_config_looback_en = data->rgmii_config_looback_en; + ethqos->rgmii_config_loopback_en = data->rgmii_config_loopback_en; ethqos->rgmii_clk = devm_clk_get(&pdev->dev, "rgmii"); if (IS_ERR(ethqos->rgmii_clk)) { -- 2.39.2