From patchwork Mon Mar 13 16:56:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 68959 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1307086wrd; Mon, 13 Mar 2023 10:17:19 -0700 (PDT) X-Google-Smtp-Source: AK7set9a2Dh4asz/TIjBPtru2h+bdRVcy+4q8Q7MAOrl8cv6ngIhiK2PwX6xw1ZZHfLFpkFwQ0co X-Received: by 2002:a62:17c4:0:b0:624:673f:aae8 with SMTP id 187-20020a6217c4000000b00624673faae8mr2701937pfx.3.1678727838679; Mon, 13 Mar 2023 10:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678727838; cv=none; d=google.com; s=arc-20160816; b=TYswYC5nFssDwXCPKpFRXk7yMBavk3gCNqSh90ZO70bO0szMP3pQNgauM63rALCSe+ PgdaqUC1JBmxsYoHy3hFs+utgTFrAiOPScxB3k6zRP26y2W0P9Yjsx09V0jsYbd38a55 +dOA0eU9wEHPRRw+I+LjCGHzCcGRyOu30aHdVrmOLLIYFUZuuZEhtAWiuVI1Hca0a8Tf C6vYDY1B/03uUgT4796bkSESiYGTSQtO32SOwMJyEojybMjxUnONvLmHvorv197e7rkh KC0veA8ZZwKHpDTJKGtIxQP7+9oPVNTcCt9zplI/K9oVlUy3K4a2wRk+HW6tbQeoNTtE ATvA== 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=froEIgd/jTK8vMet67sF4Svy58nAbygAJuDZdwZXRoo=; b=fnMx/BX9znKFdHzxmCXeUSIgGoGGmUpDs9umJLeDUdEi/000eVK7HEIH7/gtX69lKh OkzIpD8SgILB3I10WypNcOni7j9D/X1H9iVyhBNLjmjkWepznSOfNRLZcSP/zfRBbEJS qWdB4Hvv3PQDB+hX8Hzncq5drx45mMX/AEjUrrR5P8aQFpjU0F9WP0O6m/GWa04okBYX EaxZ2tICXloly3E3ywdkkMkKmwsQPyhZat6oRZo+6JkmOQAYxN/t+LQpFKR01xP4lqAr +EmlEDpdh4pdRyF4B0f4m3K9tdQFxKy66z16rwDfHKYHgY5mNyeSdseJBmZz75+mCEjW h3Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bUXgj8S8; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f21-20020a635115000000b004fb9330dcfcsi7087775pgb.323.2023.03.13.10.17.05; Mon, 13 Mar 2023 10:17:18 -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=bUXgj8S8; 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 S231517AbjCMRAe (ORCPT + 99 others); Mon, 13 Mar 2023 13:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231695AbjCMRAG (ORCPT ); Mon, 13 Mar 2023 13:00:06 -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 20A827C3F8 for ; Mon, 13 Mar 2023 09:58:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678726693; 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=froEIgd/jTK8vMet67sF4Svy58nAbygAJuDZdwZXRoo=; b=bUXgj8S8YumsAln3yZzgCEgIc9ixPEjmLDbxyT1T+pE/MNCqP0R5eW0GO1Ia04Ija7rR39 7Q55D/ANfaJLg5g7zHnRTYxtsUzAqrdO/LMqoWYdj0jPnT5jjXzAQ8N2h0inVjVArqBZIg AfiVK7a27CXARRZZ1GgR5cJp6IztJK0= Received: from mail-oa1-f71.google.com (mail-oa1-f71.google.com [209.85.160.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-107-ghklsQMvOZufFERA1Dsbmg-1; Mon, 13 Mar 2023 12:58:12 -0400 X-MC-Unique: ghklsQMvOZufFERA1Dsbmg-1 Received: by mail-oa1-f71.google.com with SMTP id 586e51a60fabf-17268e44df1so7500639fac.9 for ; Mon, 13 Mar 2023 09:58:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678726691; 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=froEIgd/jTK8vMet67sF4Svy58nAbygAJuDZdwZXRoo=; b=yUKbA3VKaJ/6aaRDhoh39PMseRwizVn0tlChT32e0gd9zdjRVw8Z5hc2FspDuTmpMG o7BEjjBwGVynnQwFX/YrkP0f+4BbQUapC1o83LOzoD9150k4l0SNuTcRCKRn7JildbZx e69hdKRDKuasiN0GytdaWzo0W0cYhDVWZf/SLPc+pl9XDr7gmdNx18LkgH80P7jbZ0EP /Mi57K+id0Qtd/YE55m/g6lE0aUWQKl05N808AT4OI6sWRz7vY+gBscYilhZxx5yYxvX 6Yr7ltjcr8/upKo+ZetSyTv8CVpqM3j+RmuI5VwwAOj91BnVJrqngTh/Pt+7BZsmXRXN BxlQ== X-Gm-Message-State: AO0yUKUQx73oShNetwBudMVGglif4ew6vOw0v2pb7tge7BVOy5JGw9eG XWzcxaFuyFZQTQ7+bFoaNk8d++DV+bL5SRoNTz6r+Tp/KWMYoPXK3QWInG7q9VtHYbGuJxl+0hA e0hmWOo2ylBMAcGwcHny2QNpIfZUHCQe6WKtMYFXDQqZzw27NpTeUTCvxGiPUpeEEhLOdbppBTx h3zFYHCG5g1f8= X-Received: by 2002:a54:4581:0:b0:378:2e00:6059 with SMTP id z1-20020a544581000000b003782e006059mr15770446oib.1.1678726690991; Mon, 13 Mar 2023 09:58:10 -0700 (PDT) X-Received: by 2002:a54:4581:0:b0:378:2e00:6059 with SMTP id z1-20020a544581000000b003782e006059mr15770404oib.1.1678726690652; Mon, 13 Mar 2023 09:58:10 -0700 (PDT) Received: from halaney-x13s.attlocal.net ([2600:1700:1ff0:d0e0::21]) by smtp.gmail.com with ESMTPSA id o2-20020acad702000000b00384d3003fa3sm3365273oig.26.2023.03.13.09.58.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Mar 2023 09:58:10 -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, mturquette@baylibre.com, sboyd@kernel.org, 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-clk@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, Andrew Halaney Subject: [PATCH net-next 10/11] net: ethernet: stmmac: dwmac-qcom-ethqos: Use loopback_en for all speeds Date: Mon, 13 Mar 2023 11:56:19 -0500 Message-Id: <20230313165620.128463-11-ahalaney@redhat.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313165620.128463-1-ahalaney@redhat.com> References: <20230313165620.128463-1-ahalaney@redhat.com> MIME-Version: 1.0 Content-type: text/plain 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760273722128515944?= X-GMAIL-MSGID: =?utf-8?q?1760273722128515944?= 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 --- .../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 6f272cae330d..778852934e36 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 phy_mode; int phase_shift; + 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); @@ -293,6 +294,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); @@ -325,12 +332,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: @@ -362,13 +365,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: @@ -402,7 +400,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, @@ -547,7 +545,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)) {