Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1661986rwl; Fri, 31 Mar 2023 14:51:15 -0700 (PDT) X-Google-Smtp-Source: AKy350adIuie5VO7UlhLlLxJPPsIxnYXf9dmYXIlYuZntKe1jj42o9beV3Plp6GfmFcGomR44mM5 X-Received: by 2002:a17:906:207:b0:933:23c4:820b with SMTP id 7-20020a170906020700b0093323c4820bmr6048736ejd.4.1680299475709; Fri, 31 Mar 2023 14:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680299475; cv=none; d=google.com; s=arc-20160816; b=yDTuRW2Okyf8cXEYEsOahWP608S0VxFekOir+jDhN5NRyZdLwfgQSqgJiHMpMITRzR wykv7hoAzzCQsywh6QMgqtPa8R2JRh+7qbFeBPI8srYv91kE9n7cFQqeuHhfidbKXuv/ ktlBtDvKBuXJ346YnrMZzF/nrUKsUSYE4lCYCQrh7nysrzLceySqelXFWXrvWmMk4tOo zi9pMKcqBawdCFACWpBDg/wiELIvFpSnJbk9+32X/vog2BzzswgysO1+u0jZvwXxt2jg y/QgRP3GSuKK7XQuiYjSlyQF2B0Uy1ky/yePiPB+o/ZhNPP4i/946COjNqeR0rNglPz7 bjgw== 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=SF6uNcTaL1XWIdtjfUNctRW8ZpoxmAhgGf/gHeHXnR4=; b=LC9XKRuQ5JFamlrsa1+aSYqTZe2ZENOEWmWvm9LPsZ3FLceWiI8513LcHjL/RJNKHq 5J/a3O4JVXUmA0XcrKE7H3zJt+5IiIx+Qi4TjEizEGYVI+9xIz2la7IeqKgTmQ2zF2+4 HnhpEEkwUVcIIqM59DMlBek1S1Pxsul5lMCqFuh6WFtqJMnyHgI2X7u86ANotcDgl4YC RUtboqMc1BJowUFBBXyIGG1IZBfViWFD4rJcUwP/FDu/zD0Pfa/hFwTVIyyQNUBIcqwP WS89CT8T+6mSV3qX/nMOvVNpSwj6jaCW3QyvTgsNBUbD3EFTMWSEaMBYVQQ95W4bUVAy cEBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=houqqK83; 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 gj8-20020a170906e10800b0093338c0f70dsi3365849ejb.117.2023.03.31.14.50.51; Fri, 31 Mar 2023 14:51:15 -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=houqqK83; 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 S233372AbjCaVt2 (ORCPT + 99 others); Fri, 31 Mar 2023 17:49:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232739AbjCaVsc (ORCPT ); Fri, 31 Mar 2023 17:48:32 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 303FA18F9A for ; Fri, 31 Mar 2023 14:46:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680299214; 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=SF6uNcTaL1XWIdtjfUNctRW8ZpoxmAhgGf/gHeHXnR4=; b=houqqK83lIXLv+UtzCSy6caxyHTu9sFcfumr68TznfzRorqRjzVkoJaSgpvmg8clzCaRuJ RNJt3IUBcZpNzfZ1DFpgWBfWAbzLKM8TwJ4f7rVEJntjgmDtdxFrCcH9eglPbJYaAs0tPI OwAi4IyJ44yo82yj3AbqWQYaQbfEi8o= Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-459-ZPwJP7YBOc-2Jn7y25hGcA-1; Fri, 31 Mar 2023 17:46:53 -0400 X-MC-Unique: ZPwJP7YBOc-2Jn7y25hGcA-1 Received: by mail-ot1-f72.google.com with SMTP id k29-20020a9d701d000000b006a037b882d8so8769718otj.16 for ; Fri, 31 Mar 2023 14:46:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680299210; 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=SF6uNcTaL1XWIdtjfUNctRW8ZpoxmAhgGf/gHeHXnR4=; b=M4oNOqSwmf649eErzwgBNhS9qN0G9Yk2zcM2JSLz1nA6tvGFqXhWp1Y1/YYkgx12Wj Yxhf80vYfAidYCeGY9A/L5roge04b6z0e9AfpNtu8JPkrfW1R6pKdhO6iF2jKGFEj193 X0Dx8PJTl5Yp6pjRBMta24GT1EvcFEOedTumZi1C1Z5p/LqvA2BqIzSIeMLt6A4x+A0+ OlarkweJniB8F5hyuIpnLxX5RiWw/xREzy1v1N+9qQHEj18/0uzCx5stoppZ5o3HZoD/ jRxwutxWZ9wQ+s2W1a9i/fLsCLgBDOi/F9FIp/t4kbQQ5iBoDwUcvnrAzOoR1IoYRAPP Y7Dw== X-Gm-Message-State: AAQBX9e7rzs5gkeZATlEjOEovgojNc5WLSGt/XhdmlVPAbnz963k48In 5TL9w7LVFkQIqSjGUORzj0UF++x9xxAY0AZm7Wh+4lWo2Mo/ePMXmst6mDUUvpsy6HL97XlNFxL SLKYunEsYpqY+PyM6UGEGqIddjtb7ZkjjC9L6bcaAk/Ze2Cb76l868TVO++iDG49pEEA74rT6RQ RBuAXYj2dScIE= X-Received: by 2002:a4a:cb03:0:b0:53b:b277:1c6 with SMTP id r3-20020a4acb03000000b0053bb27701c6mr5861099ooq.1.1680299209913; Fri, 31 Mar 2023 14:46:49 -0700 (PDT) X-Received: by 2002:a4a:cb03:0:b0:53b:b277:1c6 with SMTP id r3-20020a4acb03000000b0053bb27701c6mr5861058ooq.1.1680299209542; Fri, 31 Mar 2023 14:46:49 -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 x80-20020a4a4153000000b0053d9be4be68sm1328531ooa.19.2023.03.31.14.46.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 14:46:49 -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 v3 11/12] net: stmmac: dwmac-qcom-ethqos: Use loopback_en for all speeds Date: Fri, 31 Mar 2023 16:45:48 -0500 Message-Id: <20230331214549.756660-12-ahalaney@redhat.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230331214549.756660-1-ahalaney@redhat.com> References: <20230331214549.756660-1-ahalaney@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=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: * 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