From nobody Sat Feb 7 15:11:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE23FEB64DD for ; Mon, 19 Jun 2023 09:24:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231350AbjFSJYb (ORCPT ); Mon, 19 Jun 2023 05:24:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231326AbjFSJYR (ORCPT ); Mon, 19 Jun 2023 05:24:17 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1886EB0 for ; Mon, 19 Jun 2023 02:24:15 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-4f63ab1ac4aso3946949e87.0 for ; Mon, 19 Jun 2023 02:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687166653; x=1689758653; 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=Fg9HPnaQs4uw+/BUPOC0tDtzoyUDTGe4TgouVRsxWgE=; b=ocglfYYfqa/esuJaIEFrBWiWSewxOHkZ7OEhJHLgI5q8jKaLsSyw8JW04olIdi2aup ANPQQzkk7ovLeeBJnUPq++WlWepM8c8hOsK/VertiQZfktne6BR+JSZldM0hyTybZZGG PyxaqYCyOqyOjY497idphdkO3chcuC1xGEhZt+janAipYdunTLLmGfhh5ljjJMOIct4d M60COR6lJlIiSSMzNiGkWbog7Q1hiUdBIgCElSYiUn1vHTXw3XoYhdGyo+WRHPvWJwo6 SG4e5xlVURsBPEbPwH65Y1DKxU7FSlraZRtFHXgEn0AVqAnYIPRHgTFWNG8EO6Ni+3uH eAfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687166653; x=1689758653; 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=Fg9HPnaQs4uw+/BUPOC0tDtzoyUDTGe4TgouVRsxWgE=; b=UxVo9NyzVgO+qwqDjF06yMdzp0qB960MuCIeS5YnHwPOMb0XXSj4aEU5ygCNTdJnck shPvvDZpCFXWe40zm7pfV+16mx4ZyrzGcNVldE2LNOlgFSvHa6GFswFy0nxmQAREa9kj /w7GUMcHeQgLPgNM/AfNA0vl3SSwUixfVZDCQFV++i/kmnaM+6YzBwkJDuL7PBDHy5YL irSal1dNs4P8L20sjrgPAbIgzI5/HvQb6PLav/HJhOwRuG4BldFNL9iwAIXfnAd2Jr/w VaHvvaG/axV/tZKDEYZZOyF7kIRWFqPBs2FU4SxY3QNY4NU3A/VjIwG49Ez3VbVw3dA2 Q2qg== X-Gm-Message-State: AC+VfDx+dChj7gABuyFTPx3YOVva2ReFYUc5gff6ST4IUN2n2T7zERzI V5pi0MBjZ3Laz19KzU8dOb0U9g== X-Google-Smtp-Source: ACHHUZ50KTGQ8uOARkF0XdY7qCU86fgrDX9isO/ItNJnjN9lmgPmxRhe+lHdUd5ugqf+B76ovYaoHQ== X-Received: by 2002:a19:f201:0:b0:4f7:b640:fa40 with SMTP id q1-20020a19f201000000b004f7b640fa40mr4151520lfh.43.1687166653342; Mon, 19 Jun 2023 02:24:13 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:d9e8:ddbf:7391:a0b0]) by smtp.gmail.com with ESMTPSA id q9-20020a7bce89000000b003f7cb42fa20sm10045229wmj.42.2023.06.19.02.24.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 02:24:12 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Andrew Halaney Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [RESEND PATCH v2 01/14] net: stmmac: dwmac-qcom-ethqos: shrink clock code with devres Date: Mon, 19 Jun 2023 11:23:49 +0200 Message-Id: <20230619092402.195578-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619092402.195578-1-brgl@bgdev.pl> References: <20230619092402.195578-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski We can use a devm action to completely drop the remove callback and use stmmac_pltfr_remove() directly for remove. We can also drop one of the goto labels. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andrew Halaney --- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index c801838fae2a..2da0738eed24 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -586,6 +586,11 @@ static int ethqos_clks_config(void *priv, bool enabled) return ret; } =20 +static void ethqos_clks_disable(void *data) +{ + ethqos_clks_config(data, false); +} + static int qcom_ethqos_probe(struct platform_device *pdev) { struct device_node *np =3D pdev->dev.of_node; @@ -636,6 +641,10 @@ static int qcom_ethqos_probe(struct platform_device *p= dev) if (ret) goto err_mem; =20 + ret =3D devm_add_action_or_reset(&pdev->dev, ethqos_clks_disable, ethqos); + if (ret) + goto err_mem; + ethqos->speed =3D SPEED_1000; ethqos_update_rgmii_clk(ethqos, SPEED_1000); ethqos_set_func_clk_en(ethqos); @@ -653,27 +662,16 @@ static int qcom_ethqos_probe(struct platform_device *= pdev) =20 ret =3D stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); if (ret) - goto err_clk; + goto err_mem; =20 return ret; =20 -err_clk: - ethqos_clks_config(ethqos, false); - err_mem: stmmac_remove_config_dt(pdev, plat_dat); =20 return ret; } =20 -static void qcom_ethqos_remove(struct platform_device *pdev) -{ - struct qcom_ethqos *ethqos =3D get_stmmac_bsp_priv(&pdev->dev); - - stmmac_pltfr_remove(pdev); - ethqos_clks_config(ethqos, false); -} - static const struct of_device_id qcom_ethqos_match[] =3D { { .compatible =3D "qcom,qcs404-ethqos", .data =3D &emac_v2_3_0_data}, { .compatible =3D "qcom,sc8280xp-ethqos", .data =3D &emac_v3_0_0_data}, @@ -684,7 +682,7 @@ MODULE_DEVICE_TABLE(of, qcom_ethqos_match); =20 static struct platform_driver qcom_ethqos_driver =3D { .probe =3D qcom_ethqos_probe, - .remove_new =3D qcom_ethqos_remove, + .remove_new =3D stmmac_pltfr_remove, .driver =3D { .name =3D "qcom-ethqos", .pm =3D &stmmac_pltfr_pm_ops, --=20 2.39.2 From nobody Sat Feb 7 15:11:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5120AC0015E for ; Mon, 19 Jun 2023 09:24:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231357AbjFSJY0 (ORCPT ); Mon, 19 Jun 2023 05:24:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231350AbjFSJYR (ORCPT ); Mon, 19 Jun 2023 05:24:17 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FC0512B for ; Mon, 19 Jun 2023 02:24:16 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f8fe9dc27aso18850775e9.3 for ; Mon, 19 Jun 2023 02:24:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687166654; x=1689758654; 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=kqkS8wBl8PLRWJLFm1wypKtzLGR0zlssSDIjkM/ys4k=; b=Qos2IkA8ZAsADGu19H9PZy/5OjA+THOvzQdLHdLMnfKM6C9WgWeB0cX2h/gQI//18O 4if1A4xBamh4uv99ZPTqoKTuFA4IIUkZSmDhHBputotWzNV49DEz+X1P9Xi4hjdgSAj7 nVMdtprKu8rb77R5wb8w4kNkSZl4AynnDKa4viVHi4TeeT45ZxW6hB8X+4S/GAnBSYY6 WjrWvv8POPWbGJscaHvwf27j7SvPQd4UQAm0ns2kKBfWLj6jELlu08H8UZhSaHvqynly F/J/IOPL7OFGnQYQUFloDt/KluYdeLdtCKjlToY7YXbF5UYZIDhLYqV+J7bF9rC9rWtq KKrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687166654; x=1689758654; 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=kqkS8wBl8PLRWJLFm1wypKtzLGR0zlssSDIjkM/ys4k=; b=O5Im5zeA8hnxs96023ME/WbAhw5kyAHG0C6jV8mq51ht7oUO1MBet1wRqgEp0AAYk3 6W0IJvbHMyQZpxish0p82UnI+Lhat3xIJxAwqJXZfjLQVlLXTujibrh4VUWpLAI8cLvG WoNnT5E6SdK7Ync6haHDiX6VVBmxiFYAgJmsU9nXhYHgsSxu3I3Z7ZItiowbOoTnCoLX JSQOCEkzGIPx1flcN1Kom0FdGWeZe5GeV5A3Rz9bjHAtKo5NsEBrSPiTS1mObdqHoqgp 0rkpu++08+2eoBKKz3X820qZ4ptAXfkxXTN4xGvQrtRQTRT4IxrIquV2Dc3a3+Tgmkii V3Ww== X-Gm-Message-State: AC+VfDxcsRDvRgv4tUuA8zBChCuhpXOPw6ltfaSXCcdZE9UuF1p6Suss 1QFM35ejcQQ9Nhqz5rUskywWxA== X-Google-Smtp-Source: ACHHUZ5nrI1ToJX1lF60t4H/hldIC6GXtkZvoSNtU8CXZk9iEQ2Ix3iq7IHZj9CpVyTfdBYlNjb0bA== X-Received: by 2002:a1c:6a0a:0:b0:3f9:2c0:b58 with SMTP id f10-20020a1c6a0a000000b003f902c00b58mr3664302wmc.4.1687166654511; Mon, 19 Jun 2023 02:24:14 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:d9e8:ddbf:7391:a0b0]) by smtp.gmail.com with ESMTPSA id q9-20020a7bce89000000b003f7cb42fa20sm10045229wmj.42.2023.06.19.02.24.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 02:24:14 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Andrew Halaney Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [RESEND PATCH v2 02/14] net: stmmac: dwmac-qcom-ethqos: rename a label in probe() Date: Mon, 19 Jun 2023 11:23:50 +0200 Message-Id: <20230619092402.195578-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619092402.195578-1-brgl@bgdev.pl> References: <20230619092402.195578-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski The err_mem label's name is unclear. It actually should be reached on any error after stmmac_probe_config_dt() succeeds. Name it after the cleanup action that needs to be called before exiting. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andrew Halaney --- .../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 2da0738eed24..16e856861558 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -615,14 +615,14 @@ static int qcom_ethqos_probe(struct platform_device *= pdev) ethqos =3D devm_kzalloc(&pdev->dev, sizeof(*ethqos), GFP_KERNEL); if (!ethqos) { ret =3D -ENOMEM; - goto err_mem; + goto out_config_dt; } =20 ethqos->pdev =3D pdev; ethqos->rgmii_base =3D devm_platform_ioremap_resource_byname(pdev, "rgmii= "); if (IS_ERR(ethqos->rgmii_base)) { ret =3D PTR_ERR(ethqos->rgmii_base); - goto err_mem; + goto out_config_dt; } =20 data =3D of_device_get_match_data(&pdev->dev); @@ -634,16 +634,16 @@ static int qcom_ethqos_probe(struct platform_device *= pdev) ethqos->rgmii_clk =3D devm_clk_get(&pdev->dev, "rgmii"); if (IS_ERR(ethqos->rgmii_clk)) { ret =3D PTR_ERR(ethqos->rgmii_clk); - goto err_mem; + goto out_config_dt; } =20 ret =3D ethqos_clks_config(ethqos, true); if (ret) - goto err_mem; + goto out_config_dt; =20 ret =3D devm_add_action_or_reset(&pdev->dev, ethqos_clks_disable, ethqos); if (ret) - goto err_mem; + goto out_config_dt; =20 ethqos->speed =3D SPEED_1000; ethqos_update_rgmii_clk(ethqos, SPEED_1000); @@ -662,11 +662,11 @@ static int qcom_ethqos_probe(struct platform_device *= pdev) =20 ret =3D stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); if (ret) - goto err_mem; + goto out_config_dt; =20 return ret; =20 -err_mem: +out_config_dt: stmmac_remove_config_dt(pdev, plat_dat); =20 return ret; --=20 2.39.2 From nobody Sat Feb 7 15:11:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D08B0EB64D9 for ; Mon, 19 Jun 2023 09:24:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231248AbjFSJYn (ORCPT ); Mon, 19 Jun 2023 05:24:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231346AbjFSJYS (ORCPT ); Mon, 19 Jun 2023 05:24:18 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C37B18D for ; Mon, 19 Jun 2023 02:24:17 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-4f769c37d26so4012097e87.1 for ; Mon, 19 Jun 2023 02:24:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687166656; x=1689758656; 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=jbBN5UFZLskttS3+DKY7OChoCqIyyvgczJBfknfqHmY=; b=IgJbKu3j5ZSezHMCdBUh//m5BjaQnLUFHhTknW4VBcn4lAblpPaHRZ1Fg8mgLyOnwn B+CUjCvyLvpZTDweOBWlV32HEMP4jI1kCm9h7YK3xegxh0EEACGXSVwNff1llgRxdbrO DXmjRfKbyzieziwyN+VOYogRFr1BFhc7IXDOvjFOMNWalXxL5tdQxfLlQc6VN1zWe85h zUwDsXJqzGRXIv+fzm2VK6cnQ1rwqwfZ3VUJGKX6h356mJJK9Z/gt1Nev934IASlL243 +fI1CPxpdHmWdipONXkkVWGAGnIDLLbPts0scgNsx2l/mmywhnkmXNKXxF33lllu0wZw ul5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687166656; x=1689758656; 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=jbBN5UFZLskttS3+DKY7OChoCqIyyvgczJBfknfqHmY=; b=TkU4dRttBeHDx28CVsF3Py+blQZqGs3ts2BzU6Mghi0hKh3zabaC9jvTFq+p+CaeYF WCHAze7KKu7Jg8W3rICnLPn2+ItCDk5GVGArpEvCIfuWW1UjTOlRLVapXCrwUjBpwR5u jqdT0EOZTVpAG9skVuekfvSZ5HPTDocPO6KNHvib7q4WUQESdQ7a7UAgxgCFVyGj0Oyn EVAN1q8NGhnqwqeiuB4k6TeLWmycNeUmMan3Eu+bXKohsdxtasdKwwUL+LOEkXBmOhtC hl1S5OdJyxQYyQLT9PlCPYiCNGKUVU4IlWXawpAuBwJwM7ynT8BGcoUewBxr2Cfp13BU OpMw== X-Gm-Message-State: AC+VfDx5qDgdh9MvOz/GVzwY3gMIGIQ4M5n6/jXxMTf3wu8p4XR4voSN YeyT6UpCcAnrZgeg+hwlE0rftQ== X-Google-Smtp-Source: ACHHUZ7a6sBSYCvvGZ0rLeDvJ+aAMJ8hN0pO8v2WRQzU9PMkjFcqPr5PjOXONwRoBWWY5Umkpk3jBg== X-Received: by 2002:a19:5e16:0:b0:4f4:b28d:73eb with SMTP id s22-20020a195e16000000b004f4b28d73ebmr4567389lfb.12.1687166655767; Mon, 19 Jun 2023 02:24:15 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:d9e8:ddbf:7391:a0b0]) by smtp.gmail.com with ESMTPSA id q9-20020a7bce89000000b003f7cb42fa20sm10045229wmj.42.2023.06.19.02.24.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 02:24:15 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Andrew Halaney Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [RESEND PATCH v2 03/14] net: stmmac: dwmac-qcom-ethqos: tweak the order of local variables Date: Mon, 19 Jun 2023 11:23:51 +0200 Message-Id: <20230619092402.195578-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619092402.195578-1-brgl@bgdev.pl> References: <20230619092402.195578-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski Make sure we follow the reverse-xmas tree convention. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andrew Halaney --- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 16e856861558..28d2514a8795 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -594,9 +594,9 @@ static void ethqos_clks_disable(void *data) static int qcom_ethqos_probe(struct platform_device *pdev) { struct device_node *np =3D pdev->dev.of_node; + const struct ethqos_emac_driver_data *data; struct plat_stmmacenet_data *plat_dat; struct stmmac_resources stmmac_res; - const struct ethqos_emac_driver_data *data; struct qcom_ethqos *ethqos; int ret; =20 --=20 2.39.2 From nobody Sat Feb 7 15:11:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B3C0EB64DD for ; Mon, 19 Jun 2023 09:25:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229705AbjFSJYu (ORCPT ); Mon, 19 Jun 2023 05:24:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231359AbjFSJYU (ORCPT ); Mon, 19 Jun 2023 05:24:20 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78D33B4 for ; Mon, 19 Jun 2023 02:24:18 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3f8f3786f20so38704365e9.2 for ; Mon, 19 Jun 2023 02:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687166657; x=1689758657; 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=cX9gh1Qiyxf8dBz8QJPkiT5qyQqbjJsIR5XZjH6yJKE=; b=hpxb0GgdKFJ0yvV9IE9QIY/O5lbfyCRdeRPBFSwxFttwLfpkSj0VcNqzcNMWDPad9h gew0V1pLJUqL3Da9M0v34uv3I7Q2v5N7zPpbXqkRXfQD3nvQLPEp2swGsDXlFuuuvjlx 70KgAY0LYovHTCfQIoLsQ3zwn7KfUkHYe1dIOkRsfLOOSeuzJJzJb8+RBkhFXXPXPstP oZg9qAiYhaK2ZvA4QTHyvUTeemfintvW8kEOYjtCwr3yAZt1wLUORG4OEpiOP2p3fdeq ogqkpuqpqykP3OTgtXcPQtv4K/s3Nf58v+SozKHC8PbAQ1tmW5nWA0bmrbJmb8k+DBnV GA5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687166657; x=1689758657; 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=cX9gh1Qiyxf8dBz8QJPkiT5qyQqbjJsIR5XZjH6yJKE=; b=aUPQNQ/9jGJHvJ6rPjG8rAZL84R2htn/92gYEAxWbczNnf8id8GD5X3DEAn3Qc5TGr xYdDgQ8AGW/Us4m9kwsTA8Ipj/bCup12KzFm0bTQPxpveKsRbWP0EeRMeJWqg+avUje+ SyCXdOsxoPgWq4mmgvl8oU+Z5ebbA/xzxlrIYIP6XrFSHBPy60Fbbqex6ZySUaogGaRN t0m4M7a+p5Y8w5jtEt6eQn49l8Kzk2mu6iEw42klo8c0HMUrHwXWCHQFrOsZlTobukrA AnNZ5NwqDT1bs6Q4N4d0Ayf6UnJLvmKavKNJBd1CrviZoBh04CLX0yWb5wtI4KH9+GFY xXZg== X-Gm-Message-State: AC+VfDys6vvcGnJMBH45RNuCP0wv7X3WqT6SageS4z84dMkLyRPU67vY MIcRwJzTnQmA0jLGS90VwU1Ozw== X-Google-Smtp-Source: ACHHUZ46yBGLDtRgrScH6wl/dLlKFGzXqi1EAWkLA0gIVuqpChDlX5Au3Vl3l4m3aMqgPZgA2Wo/jQ== X-Received: by 2002:a1c:7705:0:b0:3f9:7a6:3cae with SMTP id t5-20020a1c7705000000b003f907a63caemr5923697wmi.9.1687166656923; Mon, 19 Jun 2023 02:24:16 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:d9e8:ddbf:7391:a0b0]) by smtp.gmail.com with ESMTPSA id q9-20020a7bce89000000b003f7cb42fa20sm10045229wmj.42.2023.06.19.02.24.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 02:24:16 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Andrew Halaney Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [RESEND PATCH v2 04/14] net: stmmac: dwmac-qcom-ethqos: use a helper variable for &pdev->dev Date: Mon, 19 Jun 2023 11:23:52 +0200 Message-Id: <20230619092402.195578-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619092402.195578-1-brgl@bgdev.pl> References: <20230619092402.195578-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski Shrink code and avoid line breaks by using a helper variable for &pdev->dev. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andrew Halaney --- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 28d2514a8795..f0776ddea3ab 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -123,25 +123,26 @@ static void rgmii_updatel(struct qcom_ethqos *ethqos, static void rgmii_dump(void *priv) { struct qcom_ethqos *ethqos =3D priv; + struct device *dev =3D ðqos->pdev->dev; =20 - dev_dbg(ðqos->pdev->dev, "Rgmii register dump\n"); - dev_dbg(ðqos->pdev->dev, "RGMII_IO_MACRO_CONFIG: %x\n", + dev_dbg(dev, "Rgmii register dump\n"); + dev_dbg(dev, "RGMII_IO_MACRO_CONFIG: %x\n", rgmii_readl(ethqos, RGMII_IO_MACRO_CONFIG)); - dev_dbg(ðqos->pdev->dev, "SDCC_HC_REG_DLL_CONFIG: %x\n", + dev_dbg(dev, "SDCC_HC_REG_DLL_CONFIG: %x\n", rgmii_readl(ethqos, SDCC_HC_REG_DLL_CONFIG)); - dev_dbg(ðqos->pdev->dev, "SDCC_HC_REG_DDR_CONFIG: %x\n", + dev_dbg(dev, "SDCC_HC_REG_DDR_CONFIG: %x\n", rgmii_readl(ethqos, SDCC_HC_REG_DDR_CONFIG)); - dev_dbg(ðqos->pdev->dev, "SDCC_HC_REG_DLL_CONFIG2: %x\n", + dev_dbg(dev, "SDCC_HC_REG_DLL_CONFIG2: %x\n", rgmii_readl(ethqos, SDCC_HC_REG_DLL_CONFIG2)); - dev_dbg(ðqos->pdev->dev, "SDC4_STATUS: %x\n", + dev_dbg(dev, "SDC4_STATUS: %x\n", rgmii_readl(ethqos, SDC4_STATUS)); - dev_dbg(ðqos->pdev->dev, "SDCC_USR_CTL: %x\n", + dev_dbg(dev, "SDCC_USR_CTL: %x\n", rgmii_readl(ethqos, SDCC_USR_CTL)); - dev_dbg(ðqos->pdev->dev, "RGMII_IO_MACRO_CONFIG2: %x\n", + dev_dbg(dev, "RGMII_IO_MACRO_CONFIG2: %x\n", rgmii_readl(ethqos, RGMII_IO_MACRO_CONFIG2)); - dev_dbg(ðqos->pdev->dev, "RGMII_IO_MACRO_DEBUG1: %x\n", + dev_dbg(dev, "RGMII_IO_MACRO_DEBUG1: %x\n", rgmii_readl(ethqos, RGMII_IO_MACRO_DEBUG1)); - dev_dbg(ðqos->pdev->dev, "EMAC_SYSTEM_LOW_POWER_DEBUG: %x\n", + dev_dbg(dev, "EMAC_SYSTEM_LOW_POWER_DEBUG: %x\n", rgmii_readl(ethqos, EMAC_SYSTEM_LOW_POWER_DEBUG)); } =20 @@ -242,6 +243,7 @@ static const struct ethqos_emac_driver_data emac_v3_0_0= _data =3D { =20 static int ethqos_dll_configure(struct qcom_ethqos *ethqos) { + struct device *dev =3D ðqos->pdev->dev; unsigned int val; int retry =3D 1000; =20 @@ -279,7 +281,7 @@ static int ethqos_dll_configure(struct qcom_ethqos *eth= qos) retry--; } while (retry > 0); if (!retry) - dev_err(ðqos->pdev->dev, "Clear CK_OUT_EN timedout\n"); + dev_err(dev, "Clear CK_OUT_EN timedout\n"); =20 /* Set CK_OUT_EN */ rgmii_updatel(ethqos, SDCC_DLL_CONFIG_CK_OUT_EN, @@ -296,7 +298,7 @@ static int ethqos_dll_configure(struct qcom_ethqos *eth= qos) retry--; } while (retry > 0); if (!retry) - dev_err(ðqos->pdev->dev, "Set CK_OUT_EN timedout\n"); + dev_err(dev, "Set CK_OUT_EN timedout\n"); =20 /* Set DDR_CAL_EN */ rgmii_updatel(ethqos, SDCC_DLL_CONFIG2_DDR_CAL_EN, @@ -322,12 +324,13 @@ static int ethqos_dll_configure(struct qcom_ethqos *e= thqos) =20 static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos) { + struct device *dev =3D ðqos->pdev->dev; int phase_shift; int phy_mode; int loopback; =20 /* Determine if the PHY adds a 2 ns TX delay or the MAC handles it */ - phy_mode =3D device_get_phy_mode(ðqos->pdev->dev); + phy_mode =3D device_get_phy_mode(dev); if (phy_mode =3D=3D PHY_INTERFACE_MODE_RGMII_ID || phy_mode =3D=3D PHY_INTERFACE_MODE_RGMII_TXID) phase_shift =3D 0; @@ -468,8 +471,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *= ethqos) loopback, RGMII_IO_MACRO_CONFIG); break; default: - dev_err(ðqos->pdev->dev, - "Invalid speed %d\n", ethqos->speed); + dev_err(dev, "Invalid speed %d\n", ethqos->speed); return -EINVAL; } =20 @@ -478,6 +480,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *= ethqos) =20 static int ethqos_configure(struct qcom_ethqos *ethqos) { + struct device *dev =3D ðqos->pdev->dev; volatile unsigned int dll_lock; unsigned int i, retry =3D 1000; =20 @@ -540,8 +543,7 @@ static int ethqos_configure(struct qcom_ethqos *ethqos) retry--; } while (retry > 0); if (!retry) - dev_err(ðqos->pdev->dev, - "Timeout while waiting for DLL lock\n"); + dev_err(dev, "Timeout while waiting for DLL lock\n"); } =20 if (ethqos->speed =3D=3D SPEED_1000) @@ -597,6 +599,7 @@ static int qcom_ethqos_probe(struct platform_device *pd= ev) const struct ethqos_emac_driver_data *data; struct plat_stmmacenet_data *plat_dat; struct stmmac_resources stmmac_res; + struct device *dev =3D &pdev->dev; struct qcom_ethqos *ethqos; int ret; =20 @@ -606,13 +609,13 @@ static int qcom_ethqos_probe(struct platform_device *= pdev) =20 plat_dat =3D stmmac_probe_config_dt(pdev, stmmac_res.mac); if (IS_ERR(plat_dat)) { - dev_err(&pdev->dev, "dt configuration failed\n"); + dev_err(dev, "dt configuration failed\n"); return PTR_ERR(plat_dat); } =20 plat_dat->clks_config =3D ethqos_clks_config; =20 - ethqos =3D devm_kzalloc(&pdev->dev, sizeof(*ethqos), GFP_KERNEL); + ethqos =3D devm_kzalloc(dev, sizeof(*ethqos), GFP_KERNEL); if (!ethqos) { ret =3D -ENOMEM; goto out_config_dt; @@ -625,13 +628,13 @@ static int qcom_ethqos_probe(struct platform_device *= pdev) goto out_config_dt; } =20 - data =3D of_device_get_match_data(&pdev->dev); + data =3D of_device_get_match_data(dev); ethqos->por =3D data->por; ethqos->num_por =3D data->num_por; ethqos->rgmii_config_loopback_en =3D data->rgmii_config_loopback_en; ethqos->has_emac3 =3D data->has_emac3; =20 - ethqos->rgmii_clk =3D devm_clk_get(&pdev->dev, "rgmii"); + ethqos->rgmii_clk =3D devm_clk_get(dev, "rgmii"); if (IS_ERR(ethqos->rgmii_clk)) { ret =3D PTR_ERR(ethqos->rgmii_clk); goto out_config_dt; @@ -641,7 +644,7 @@ static int qcom_ethqos_probe(struct platform_device *pd= ev) if (ret) goto out_config_dt; =20 - ret =3D devm_add_action_or_reset(&pdev->dev, ethqos_clks_disable, ethqos); + ret =3D devm_add_action_or_reset(dev, ethqos_clks_disable, ethqos); if (ret) goto out_config_dt; =20 @@ -660,7 +663,7 @@ static int qcom_ethqos_probe(struct platform_device *pd= ev) if (of_device_is_compatible(np, "qcom,qcs404-ethqos")) plat_dat->rx_clk_runs_in_lpi =3D 1; =20 - ret =3D stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); + ret =3D stmmac_dvr_probe(dev, plat_dat, &stmmac_res); if (ret) goto out_config_dt; =20 --=20 2.39.2 From nobody Sat Feb 7 15:11:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93F5AEB64DA for ; Mon, 19 Jun 2023 09:25:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231531AbjFSJZf (ORCPT ); Mon, 19 Jun 2023 05:25:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231339AbjFSJYV (ORCPT ); Mon, 19 Jun 2023 05:24:21 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A391B12B for ; Mon, 19 Jun 2023 02:24:19 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3f8fb0e7709so28625355e9.2 for ; Mon, 19 Jun 2023 02:24:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687166658; x=1689758658; 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=2s2NJclKWNK/7cl/j+crrrKprFB1owa3fhzvvYgN/iA=; b=JVygoOc+Sgv4N+YpwUy0/S3Tb3EU99+UmbwTg/SZi3AvYvh2T/jrFwNRBUFY9D4wNT ajdGMMWD0gbYpHD6PU1nP33R3HM9Fuzz9V3lUQrccCudcwfMKMyXTLE4iA4i/Hyxqc8H xUo37e8oXYLHW2ghVq0kXhM1jrh8ZzxKRq0c7xUAOGN8Foo+KzgPr1T7wktwzGLD5SLv 4d35AemYguD/hrY/mLMc9uMxNtpNdFRQZTU7wTKdphQPeaPj2c4jccE1jen6R5IVfzP2 V/DmfYJoHcq80KiiveGwg4M3EA3Z6JEexZHzukbJ7/lWtuO5PZGvelemFRS8280yP8NO DaMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687166658; x=1689758658; 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=2s2NJclKWNK/7cl/j+crrrKprFB1owa3fhzvvYgN/iA=; b=fCT4psy/6Hn+0pCj7KawUEGOH/jOuUAfPih94oY05o82RUkqbGrHsNuzRnCHHjN1qN rmCG7EO1HP93WlFezqQQHYR6NGXRzRw4lF8bVyAhPPsf0SK8waM0b6SYwDDp76Zd+mAp xaj9gsbjCUZG8DOcuOJSopnlGpPml1PX/dBBA9wb/7tJ+WgdWyap1INTrhlIdqbOTaNq dzf2mZMB+4dUmlnJiOssntVeMJdremtNfBpeb8wtVpXhQysEQqIWQzpAa2bl9dbc7YlM HrOD4JyKFWSY45bLMwXJR+Zrlq+iAW0bs4tqpqhsKd19WdTxYhDwg4xThwT30k+Ik2y/ zLVQ== X-Gm-Message-State: AC+VfDznJV5go8RaSqsbEcYbrMyisXwpvbelvOv9mSC57fUmARQsiF/4 1Yow4JRHdy3VKWzl7Z1MGVQMJQ== X-Google-Smtp-Source: ACHHUZ6PbF7xaV88naI4EANmCuj1nfS/vMqu1VtnGeIj+ZKInR97LZy9OzAzGw+H+MfOGIxYdxlSSw== X-Received: by 2002:a7b:c454:0:b0:3f7:5e08:7a04 with SMTP id l20-20020a7bc454000000b003f75e087a04mr7646140wmi.25.1687166658109; Mon, 19 Jun 2023 02:24:18 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:d9e8:ddbf:7391:a0b0]) by smtp.gmail.com with ESMTPSA id q9-20020a7bce89000000b003f7cb42fa20sm10045229wmj.42.2023.06.19.02.24.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 02:24:17 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Andrew Halaney Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [RESEND PATCH v2 05/14] net: stmmac: dwmac-qcom-ethqos: add missing include Date: Mon, 19 Jun 2023 11:23:53 +0200 Message-Id: <20230619092402.195578-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619092402.195578-1-brgl@bgdev.pl> References: <20230619092402.195578-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski device_get_phy_mode() is declared in linux/property.h but this header is not included. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andrew Halaney --- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index f0776ddea3ab..b66d64d138cb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -6,6 +6,7 @@ #include #include #include +#include #include "stmmac.h" #include "stmmac_platform.h" =20 --=20 2.39.2 From nobody Sat Feb 7 15:11:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7497EB64DA for ; Mon, 19 Jun 2023 09:25:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231602AbjFSJY5 (ORCPT ); Mon, 19 Jun 2023 05:24:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231374AbjFSJYW (ORCPT ); Mon, 19 Jun 2023 05:24:22 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA99D12F for ; Mon, 19 Jun 2023 02:24:20 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-30fbf253dc7so2307225f8f.0 for ; Mon, 19 Jun 2023 02:24:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687166659; x=1689758659; 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=r1Ok1IYka1vb/vM8tvKH2bExKZHEfvi4JId7lcZB7pk=; b=kyHT8TL+2GSjjQREnvB3sDGmITerXPnmzkNogrnyC+QjJOC6XyLg2cdclezHjWaXPH zfGTSZePqXBZcCL5FKoRCWQsiHOxWONCURN9XFcfwFtqHLxK0VGUv47VJ/iKqP8ivnUT +0qyHmkDi8Ja6fQ+JssQeGdFGfISfMn2BCpDgdTrg6ogiAmIqnVsSn4odIrAeGc7XsIE UXGFFyF43iaDeIM/9rgTPFr5eN9CQwYmiTll65ySroOyumfs++eBFi/EYb5rTIQ+Napk IvKkDERUvy0JAY9sWgZUu3b1zF/YjGTGMOb6738nk6iU0q6Tj49q7Wz5E89jPFwxkD/Y 5RYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687166659; x=1689758659; 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=r1Ok1IYka1vb/vM8tvKH2bExKZHEfvi4JId7lcZB7pk=; b=BeOt9yxpDce19Qrl1HZUBxRUkSHuBV8oI3/beMtGI5viLpw+K8QH13P0bp3cxaam33 nWo7EhXNuJVB0hfhYS1O2R/03FZhpvF6y/Nx9QQ/xuss92ZG5A8vdK5PfrDPalp4RNFT xPxRA6IUWXCMqJw42QpYTsaTWx0hZ97Xgfp5/v778rYpXDY++oKjCt/9BfIcSb4pj8Cv XqWDJFuyKFhEysyh0N3fibdgxTN3ST9MliBSgjvD4HG2jGx7J5RWSQyqQu8A7OQyd7j8 MKBGs3gBOY/a450QN4l4Gn+fg/sd31SVDgzzOMVHt2B6NJL9/paGx3kmLdNtwdCi/tay IXAw== X-Gm-Message-State: AC+VfDxHP/6iH2gaaGVaLqIJK93LjJG45FLT1y2XMApjQWoCdnZAiSjz Qg+Cq/Yz+wVguWF3DTq+A3TwXQ== X-Google-Smtp-Source: ACHHUZ4CVUlTIzAxN+LAPNfnxBCniWd6XVG9x7Oys2PrG/4EHzRom2BdwYzcTsWwhaF6q/GoKdWTkA== X-Received: by 2002:adf:ce84:0:b0:30e:5bf2:ef1b with SMTP id r4-20020adfce84000000b0030e5bf2ef1bmr12363169wrn.25.1687166659271; Mon, 19 Jun 2023 02:24:19 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:d9e8:ddbf:7391:a0b0]) by smtp.gmail.com with ESMTPSA id q9-20020a7bce89000000b003f7cb42fa20sm10045229wmj.42.2023.06.19.02.24.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 02:24:18 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Andrew Halaney Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [RESEND PATCH v2 06/14] net: stmmac: dwmac-qcom-ethqos: add a newline between headers Date: Mon, 19 Jun 2023 11:23:54 +0200 Message-Id: <20230619092402.195578-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619092402.195578-1-brgl@bgdev.pl> References: <20230619092402.195578-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski Typically we use a newline between global and local headers so add it here as well. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andrew Halaney --- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index b66d64d138cb..e3a9b785334d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -7,6 +7,7 @@ #include #include #include + #include "stmmac.h" #include "stmmac_platform.h" =20 --=20 2.39.2 From nobody Sat Feb 7 15:11:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 375C9EB64D9 for ; Mon, 19 Jun 2023 09:26:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231651AbjFSJZF (ORCPT ); Mon, 19 Jun 2023 05:25:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231386AbjFSJYX (ORCPT ); Mon, 19 Jun 2023 05:24:23 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E908918D for ; Mon, 19 Jun 2023 02:24:21 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3f8f3786f1dso35340725e9.2 for ; Mon, 19 Jun 2023 02:24:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687166660; x=1689758660; 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=uMgaAHe76eIn3F9IB6JgFSErZkAha9wqjAecsB/W5Vk=; b=k6hUzsBdbW852NGN1tgRKfvV8+nCAhx6DYEPsgRjsWlZ0BTtUlFExnS/x1vqW5n848 D4J1nktobWGcUq4l0hluW577VVrCeg+Py9HYgt4695ySSnSmkrlNnPc9RmtNwK1stwQY Jsx7XXRnhk6C5mQ9jTw5RboNB4higsW7c0F1HuaeZPTCaTdjtY3R4V+K7+KysIzkdj27 0XuGEv7CgJ21CbJ9AhNl9A49Los6afD9v2IgckI0lgFJ5E1+v0rzd1bwrf/aPs16VOrY 475v0VPp49d8KiURbla6ANCC2JIWJ7/gVEUG2XUk3sOD9fLBi9Si5IQtVkkJbLAR1T0L l8Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687166660; x=1689758660; 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=uMgaAHe76eIn3F9IB6JgFSErZkAha9wqjAecsB/W5Vk=; b=P3+1CZEUFzRsFXkYWe3Dpvu67oQ6WM7Ye7upFr7MCP+JNMRyX/TNwDK/tgaEjCDr8Z vdMa64tUJjKHRhIQtYbVayefaWcDfbjcOhI32c9yBF7xL7dUBaeD+S4P/bCAZVwoNMEM PrDf/aVtsdv13t5dWA39VykZQkEeYzpAXWbj73r59fsq6gYY/3TEbxNgh42fIfzZXHIf +KFalBF2RfrYBHxufxQyTquQa7s6rSZxgJeTIwtqoDKFyNAtgU6L6dEMGu1Ll2oLeC2m J2z04Juxol01PXTvlMkG2JFJ8knNBtUwwculDGAVp0JWB+AkNvLeW1AYSEkGl5vnANvD w2HQ== X-Gm-Message-State: AC+VfDwNpxR0vKMRVT6XrlsDXBF4MjaKamW9EMmOl3iOs8nLdJu0jRpo vnktxN/s/9dYC3kj0dYKyPxfpg== X-Google-Smtp-Source: ACHHUZ6Nn/68uiujSBlIeSENzRMSR5Q+y8Y7jbVXv2vkfmhUq7+1i9cbhugLNdmWErDKVc9aUsPEZw== X-Received: by 2002:a7b:cb56:0:b0:3f7:e48b:974d with SMTP id v22-20020a7bcb56000000b003f7e48b974dmr10384783wmj.27.1687166660443; Mon, 19 Jun 2023 02:24:20 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:d9e8:ddbf:7391:a0b0]) by smtp.gmail.com with ESMTPSA id q9-20020a7bce89000000b003f7cb42fa20sm10045229wmj.42.2023.06.19.02.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 02:24:20 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Andrew Halaney Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [RESEND PATCH v2 07/14] net: stmmac: dwmac-qcom-ethqos: remove stray space Date: Mon, 19 Jun 2023 11:23:55 +0200 Message-Id: <20230619092402.195578-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619092402.195578-1-brgl@bgdev.pl> References: <20230619092402.195578-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski There's an unnecessary space in the rgmii_updatel() function, remove it. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andrew Halaney --- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index e3a9b785334d..ec3bbd199501 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -117,7 +117,7 @@ static void rgmii_updatel(struct qcom_ethqos *ethqos, { unsigned int temp; =20 - temp =3D rgmii_readl(ethqos, offset); + temp =3D rgmii_readl(ethqos, offset); temp =3D (temp & ~(mask)) | val; rgmii_writel(ethqos, temp, offset); } --=20 2.39.2 From nobody Sat Feb 7 15:11:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E9EEEB64D9 for ; Mon, 19 Jun 2023 09:25:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231419AbjFSJZT (ORCPT ); Mon, 19 Jun 2023 05:25:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231393AbjFSJYY (ORCPT ); Mon, 19 Jun 2023 05:24:24 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25FCD1A4 for ; Mon, 19 Jun 2023 02:24:23 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3f9b258f3a2so5184275e9.0 for ; Mon, 19 Jun 2023 02:24:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687166661; x=1689758661; 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=4LJNYlud7nrLWcLjYZWRISbOkEhmJfj+HftG3WBZPio=; b=2YWmvGNdY7ru1EdR1H+tJupPph00OxidGvPR+8zGqIzhb6ZwLiheQRuCTZGv3/7mM9 yqeQTqxwpq9+25SGL54iVb2Uyq6F2aRzLsRB4SDOI995SICNij6NzKILZR56dNLRmb7B BwCETmHOkph/PtUHZPXspkfeXb8aS1TgsRK1Z6AYXzGOHAR9miXnGOWFHfevL03Th3qu Ojk8CdC1XLiBd2Vtw/5qdpc59mEE7NC2QcLoaap8lM3jyQXSBcnS5O7RYB/HtLMmGalK vT72R+clvy786hV3uqZlkALdNFUQP4lW45oDGD5vDMC67Ub+aAYzfXAhzKpFQEQwK0WG 0KnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687166661; x=1689758661; 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=4LJNYlud7nrLWcLjYZWRISbOkEhmJfj+HftG3WBZPio=; b=jA4dzxa0W30weJHzzYq/zYwYFj1hd3yBEjZwO2e7KxYUQPKVR5GqVMQbivJWisHxpQ 72Ki2/tcPATMzR7mJ0V9r13zHvpM3tM30d9Er39AO8SF66G/rS4eKfF69eZCpPu4N/iq BhbYAPzu5uow16RO+Pi95F0HqfSOqj8ysoRnMJZt3IGivIIfKz4GrDPKp9X6t4i3/IxQ wCfFMmxQ33PWgfiCm0lbnjaOcUUl7Petqe/hh+Ki/sxNkVpY/XQhKVluL9W74MEE6eyj imYmymtJo5sCeUT7HqyQNM40lPWLJP3Dd8O4CQzfK/vMglhvHTZkKeL2BRfIZyA7MafX kGNQ== X-Gm-Message-State: AC+VfDyKlFFvcLeqiiml3YeEPzTVQjyVfAqtdAdbgRWQLAmuZ0WPTXmL WLlFeDH3LBZ/gvwxb58lDGtOMg== X-Google-Smtp-Source: ACHHUZ72UV4Ac/uWZjGcoOozYdQtjCYg5zJ4Jm8xHVhmuQ7f9B9muVAN5ZMB2o/BigOBoxF3JIRpbg== X-Received: by 2002:a05:600c:220b:b0:3f9:b10a:b310 with SMTP id z11-20020a05600c220b00b003f9b10ab310mr2287957wml.26.1687166661642; Mon, 19 Jun 2023 02:24:21 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:d9e8:ddbf:7391:a0b0]) by smtp.gmail.com with ESMTPSA id q9-20020a7bce89000000b003f7cb42fa20sm10045229wmj.42.2023.06.19.02.24.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 02:24:21 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Andrew Halaney Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [RESEND PATCH v2 08/14] net: stmmac: dwmac-qcom-ethqos: add support for the optional serdes phy Date: Mon, 19 Jun 2023 11:23:56 +0200 Message-Id: <20230619092402.195578-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619092402.195578-1-brgl@bgdev.pl> References: <20230619092402.195578-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski On sa8775p platforms, there's a SGMII SerDes PHY between the MAC and external PHY that we need to enable and configure. Signed-off-by: Bartosz Golaszewski --- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index ec3bbd199501..042733b5e80b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -6,6 +6,7 @@ #include #include #include +#include #include =20 #include "stmmac.h" @@ -93,6 +94,7 @@ struct qcom_ethqos { =20 unsigned int rgmii_clk_rate; struct clk *rgmii_clk; + struct phy *serdes_phy; unsigned int speed; =20 const struct ethqos_emac_por *por; @@ -565,6 +567,30 @@ static void ethqos_fix_mac_speed(void *priv, unsigned = int speed) ethqos_configure(ethqos); } =20 +static int qcom_ethqos_serdes_powerup(struct net_device *ndev, void *priv) +{ + struct qcom_ethqos *ethqos =3D priv; + int ret; + + ret =3D phy_init(ethqos->serdes_phy); + if (ret) + return ret; + + ret =3D phy_power_on(ethqos->serdes_phy); + if (ret) + return ret; + + return phy_set_speed(ethqos->serdes_phy, ethqos->speed); +} + +static void qcom_ethqos_serdes_powerdown(struct net_device *ndev, void *pr= iv) +{ + struct qcom_ethqos *ethqos =3D priv; + + phy_power_off(ethqos->serdes_phy); + phy_exit(ethqos->serdes_phy); +} + static int ethqos_clks_config(void *priv, bool enabled) { struct qcom_ethqos *ethqos =3D priv; @@ -650,6 +676,12 @@ static int qcom_ethqos_probe(struct platform_device *p= dev) if (ret) goto out_config_dt; =20 + ethqos->serdes_phy =3D devm_phy_optional_get(dev, "serdes"); + if (IS_ERR(ethqos->serdes_phy)) { + ret =3D PTR_ERR(ethqos->serdes_phy); + goto out_config_dt; + } + ethqos->speed =3D SPEED_1000; ethqos_update_rgmii_clk(ethqos, SPEED_1000); ethqos_set_func_clk_en(ethqos); @@ -665,6 +697,11 @@ static int qcom_ethqos_probe(struct platform_device *p= dev) if (of_device_is_compatible(np, "qcom,qcs404-ethqos")) plat_dat->rx_clk_runs_in_lpi =3D 1; =20 + if (ethqos->serdes_phy) { + plat_dat->serdes_powerup =3D qcom_ethqos_serdes_powerup; + plat_dat->serdes_powerdown =3D qcom_ethqos_serdes_powerdown; + } + ret =3D stmmac_dvr_probe(dev, plat_dat, &stmmac_res); if (ret) goto out_config_dt; --=20 2.39.2 From nobody Sat Feb 7 15:11:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 373B1EB64DA for ; Mon, 19 Jun 2023 09:25:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231489AbjFSJZX (ORCPT ); Mon, 19 Jun 2023 05:25:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231416AbjFSJY0 (ORCPT ); Mon, 19 Jun 2023 05:24:26 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76A031B0 for ; Mon, 19 Jun 2023 02:24:24 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4f849a0e371so3941266e87.1 for ; Mon, 19 Jun 2023 02:24:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687166663; x=1689758663; 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=4JbQYFD4SJ55C6wrt2tec2lUW3s94uPPtSv2iGx8v1A=; b=FO1TsLuyGfLLdjqAOuNl6B4IB5YT42wd94FSALBjASdAJ7CEbTi6fKVotL4F4GvfsN s3FCtp35ynTjMGz1T7ZeKmduLTm7j2icbgS+1TSe5/2w4wIMj5gl2gJ5ceyieX1gD8Lw othyakqlSaVzaS4ZrdNUphj7u4CVxJnCdrm68qvUq3pyrjDld6euEXu8Hbc2mP9u77mO Zj0czW/J0Z4lgp9EofFkqcwa1tP2/wA9oHKPRRaMKdCorDx4moj7bK8PJurXXh3JNziw YWbOo+M64YNh66ZDSSNQl3ZbQhb3Gs4W6tYWC1uEgCyT8ih7tTmANF/zxNkVU75xq7SF toBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687166663; x=1689758663; 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=4JbQYFD4SJ55C6wrt2tec2lUW3s94uPPtSv2iGx8v1A=; b=A0DStz1HJb3QSca8X8On1DWkd0Y367TtIZJAgUnpbYPltV5l6Bu9AfouflVSFGScjk XkvUHgtQMxUAPVkmyW1JHnBkg+SCPbTqnADOyf2Fz5TxxuY9Z5Ju5g+p4qw01/U/CCAq 5ggNo8HOI+JHN5MuytLxbFIyvXEC0adev3yONBUfmN+QWcBfLmks2znHSn6oVe+1sFEg xauti+2X671uU9BmW6ns8USI15Usf95ba04Zntc6nrMQ511gDJgCr1IEAsp/PXe3nm3g 3ujweW5OpI4YsJiPWQhPbvtjx7KN6U4ct/1N3A1n6XiM4cc/8sXVbqR+1m1Jy/y/FKnh Bqjw== X-Gm-Message-State: AC+VfDzTRLhR+2LA2NfqrV+776SKM3GfAt/Jn9AKRuZ4MlT2dIEF0Ev3 toOlDUfyutEYRw4FUSqgnYkDDw== X-Google-Smtp-Source: ACHHUZ4OpiZJE0Qs/G+fP+x4GLaCuNxHMdA1ee2XP86bKMUVorC07qhw7wspkw+AOnYveYXvlRZ2Ng== X-Received: by 2002:ac2:499e:0:b0:4f8:6f40:4776 with SMTP id f30-20020ac2499e000000b004f86f404776mr1035218lfl.46.1687166662829; Mon, 19 Jun 2023 02:24:22 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:d9e8:ddbf:7391:a0b0]) by smtp.gmail.com with ESMTPSA id q9-20020a7bce89000000b003f7cb42fa20sm10045229wmj.42.2023.06.19.02.24.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 02:24:22 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Andrew Halaney Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [RESEND PATCH v2 09/14] net: stmmac: dwmac-qcom-ethqos: add support for the phyaux clock Date: Mon, 19 Jun 2023 11:23:57 +0200 Message-Id: <20230619092402.195578-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619092402.195578-1-brgl@bgdev.pl> References: <20230619092402.195578-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski On sa8775p, the EMAC revision is 4 and we use SGMII instead of RGMII. There's no "rgmii" clock but there's a fourth clock under a different name: "phyaux". Add a new field to the chip data struct that specifies the link clock name. Default to "rgmii" for backward compatibility. Signed-off-by: Bartosz Golaszewski --- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 042733b5e80b..a739e1d5c046 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -85,6 +85,7 @@ struct ethqos_emac_driver_data { unsigned int num_por; bool rgmii_config_loopback_en; bool has_emac3; + const char *link_clk_name; struct dwmac4_addrs dwmac4_addrs; }; =20 @@ -92,8 +93,8 @@ struct qcom_ethqos { struct platform_device *pdev; void __iomem *rgmii_base; =20 - unsigned int rgmii_clk_rate; - struct clk *rgmii_clk; + unsigned int link_clk_rate; + struct clk *link_clk; struct phy *serdes_phy; unsigned int speed; =20 @@ -156,23 +157,23 @@ static void rgmii_dump(void *priv) #define RGMII_ID_MODE_10_LOW_SVS_CLK_FREQ (5 * 1000 * 1000UL) =20 static void -ethqos_update_rgmii_clk(struct qcom_ethqos *ethqos, unsigned int speed) +ethqos_update_link_clk(struct qcom_ethqos *ethqos, unsigned int speed) { switch (speed) { case SPEED_1000: - ethqos->rgmii_clk_rate =3D RGMII_1000_NOM_CLK_FREQ; + ethqos->link_clk_rate =3D RGMII_1000_NOM_CLK_FREQ; break; =20 case SPEED_100: - ethqos->rgmii_clk_rate =3D RGMII_ID_MODE_100_LOW_SVS_CLK_FREQ; + ethqos->link_clk_rate =3D RGMII_ID_MODE_100_LOW_SVS_CLK_FREQ; break; =20 case SPEED_10: - ethqos->rgmii_clk_rate =3D RGMII_ID_MODE_10_LOW_SVS_CLK_FREQ; + ethqos->link_clk_rate =3D RGMII_ID_MODE_10_LOW_SVS_CLK_FREQ; break; } =20 - clk_set_rate(ethqos->rgmii_clk, ethqos->rgmii_clk_rate); + clk_set_rate(ethqos->link_clk, ethqos->link_clk_rate); } =20 static void ethqos_set_func_clk_en(struct qcom_ethqos *ethqos) @@ -563,7 +564,7 @@ static void ethqos_fix_mac_speed(void *priv, unsigned i= nt speed) struct qcom_ethqos *ethqos =3D priv; =20 ethqos->speed =3D speed; - ethqos_update_rgmii_clk(ethqos, speed); + ethqos_update_link_clk(ethqos, speed); ethqos_configure(ethqos); } =20 @@ -597,9 +598,9 @@ static int ethqos_clks_config(void *priv, bool enabled) int ret =3D 0; =20 if (enabled) { - ret =3D clk_prepare_enable(ethqos->rgmii_clk); + ret =3D clk_prepare_enable(ethqos->link_clk); if (ret) { - dev_err(ðqos->pdev->dev, "rgmii_clk enable failed\n"); + dev_err(ðqos->pdev->dev, "link_clk enable failed\n"); return ret; } =20 @@ -610,7 +611,7 @@ static int ethqos_clks_config(void *priv, bool enabled) */ ethqos_set_func_clk_en(ethqos); } else { - clk_disable_unprepare(ethqos->rgmii_clk); + clk_disable_unprepare(ethqos->link_clk); } =20 return ret; @@ -662,9 +663,9 @@ static int qcom_ethqos_probe(struct platform_device *pd= ev) ethqos->rgmii_config_loopback_en =3D data->rgmii_config_loopback_en; ethqos->has_emac3 =3D data->has_emac3; =20 - ethqos->rgmii_clk =3D devm_clk_get(dev, "rgmii"); - if (IS_ERR(ethqos->rgmii_clk)) { - ret =3D PTR_ERR(ethqos->rgmii_clk); + ethqos->link_clk =3D devm_clk_get(dev, data->link_clk_name ?: "rgmii"); + if (IS_ERR(ethqos->link_clk)) { + ret =3D PTR_ERR(ethqos->link_clk); goto out_config_dt; } =20 @@ -683,7 +684,7 @@ static int qcom_ethqos_probe(struct platform_device *pd= ev) } =20 ethqos->speed =3D SPEED_1000; - ethqos_update_rgmii_clk(ethqos, SPEED_1000); + ethqos_update_link_clk(ethqos, SPEED_1000); ethqos_set_func_clk_en(ethqos); =20 plat_dat->bsp_priv =3D ethqos; --=20 2.39.2 From nobody Sat Feb 7 15:11:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 536F9EB64DA for ; Mon, 19 Jun 2023 09:25:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231504AbjFSJZa (ORCPT ); Mon, 19 Jun 2023 05:25:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231376AbjFSJY1 (ORCPT ); Mon, 19 Jun 2023 05:24:27 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 782EDB4 for ; Mon, 19 Jun 2023 02:24:25 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3f8d1eb535eso27296625e9.3 for ; Mon, 19 Jun 2023 02:24:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687166664; x=1689758664; 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=ePekGJ8XieE9NixEVRESpLaa1JhvD/weUEjagHex2MA=; b=stXeyAKFiBma9MHM5czXcrssZRC1jErp8AXW2Fa8I2556gbnr9ZR3eAm7LWOkt9U/J yDg1VDJ1jLiK1sHFJM7IN9YEToCipDXUUoeVD87J25vlIPosjONHyv7awdWlH0488U3g /okd2MFXSWmg+CD44rJvSFCylpjUoIzjCdWH5eXuyZm3yXnnN4Hmi7e+Bgoy8htaDRPl KMVq59xLm8pPOr1zcnH+S/WEssULK3T1SoJfubLXdxqJrjhhffoJi2NiVJYpJCYZXQul GpinTFwqcwT/89/3sdLeJQOkzTVNFdZ859QRai9ckSu9WQoJQyIX75eP5pqcTZ3UAaZV 3sYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687166664; x=1689758664; 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=ePekGJ8XieE9NixEVRESpLaa1JhvD/weUEjagHex2MA=; b=ZTUi7okbylpC0pyIQvjJ/oqoX2BfyjsBa9VNAHpGMjbQrjmsINsp27LEpovLVk1beI jC5X8c8eTA9QwW36W34g0ZRXWz1Ma+L4b3D9mDSHSIuN4E8YaCBc5dJdFI1YlhjdaQsD r+NNqtSsr/Vetv7/nJU8qAfVu1Ue4rt+cOLNkonSfItrbr8yogWm2HneIchFlZWYB4iu euRLCz1+cklW7Om3Q4YJ60CrlWUNeQWPZ6muIT2PrzjVrk2hgt7HLm+u1qnxEHx1HMps caF7n3dJUp35B9wBd/XZW7t+3fDzVmzyEqjkSNx2y7JHGLPDm2fee4Iiank1fb+qd27I VOww== X-Gm-Message-State: AC+VfDw3xeQ247z9nE0vkbDD2gOk7bxieIMUZvMG8ynWeNp0CGiyHYWj pxtq+nAu+dFsFjSNq2R1VBmLDQ== X-Google-Smtp-Source: ACHHUZ5R1zDalBxWMKNRehWDbQ8lRVG8zvqY54EpY1znGP+JKZfcPzxZW9HPRXLQpSbxiRtKcSldkg== X-Received: by 2002:a7b:c014:0:b0:3f8:f1db:d206 with SMTP id c20-20020a7bc014000000b003f8f1dbd206mr6380789wmb.25.1687166664061; Mon, 19 Jun 2023 02:24:24 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:d9e8:ddbf:7391:a0b0]) by smtp.gmail.com with ESMTPSA id q9-20020a7bce89000000b003f7cb42fa20sm10045229wmj.42.2023.06.19.02.24.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 02:24:23 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Andrew Halaney Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [RESEND PATCH v2 10/14] net: stmmac: dwmac-qcom-ethqos: prepare the driver for more PHY modes Date: Mon, 19 Jun 2023 11:23:58 +0200 Message-Id: <20230619092402.195578-11-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619092402.195578-1-brgl@bgdev.pl> References: <20230619092402.195578-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski In preparation for supporting SGMII, let's make the code a bit more generic. Add a new callback for MAC configuration so that we can assign a different variant of it in the future. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andrew Halaney --- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index a739e1d5c046..0ececc951528 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -92,11 +92,13 @@ struct ethqos_emac_driver_data { struct qcom_ethqos { struct platform_device *pdev; void __iomem *rgmii_base; + int (*configure_func)(struct qcom_ethqos *ethqos); =20 unsigned int link_clk_rate; struct clk *link_clk; struct phy *serdes_phy; unsigned int speed; + int phy_mode; =20 const struct ethqos_emac_por *por; unsigned int num_por; @@ -331,13 +333,11 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos= *ethqos) { struct device *dev =3D ðqos->pdev->dev; int phase_shift; - int phy_mode; int loopback; =20 /* Determine if the PHY adds a 2 ns TX delay or the MAC handles it */ - phy_mode =3D device_get_phy_mode(dev); - if (phy_mode =3D=3D PHY_INTERFACE_MODE_RGMII_ID || - phy_mode =3D=3D PHY_INTERFACE_MODE_RGMII_TXID) + if (ethqos->phy_mode =3D=3D PHY_INTERFACE_MODE_RGMII_ID || + ethqos->phy_mode =3D=3D PHY_INTERFACE_MODE_RGMII_TXID) phase_shift =3D 0; else phase_shift =3D RGMII_CONFIG2_TX_CLK_PHASE_SHIFT_EN; @@ -483,7 +483,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *= ethqos) return 0; } =20 -static int ethqos_configure(struct qcom_ethqos *ethqos) +static int ethqos_configure_rgmii(struct qcom_ethqos *ethqos) { struct device *dev =3D ðqos->pdev->dev; volatile unsigned int dll_lock; @@ -559,6 +559,11 @@ static int ethqos_configure(struct qcom_ethqos *ethqos) return 0; } =20 +static int ethqos_configure(struct qcom_ethqos *ethqos) +{ + return ethqos->configure_func(ethqos); +} + static void ethqos_fix_mac_speed(void *priv, unsigned int speed) { struct qcom_ethqos *ethqos =3D priv; @@ -650,6 +655,22 @@ static int qcom_ethqos_probe(struct platform_device *p= dev) goto out_config_dt; } =20 + ethqos->phy_mode =3D device_get_phy_mode(dev); + switch (ethqos->phy_mode) { + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: + ethqos->configure_func =3D ethqos_configure_rgmii; + break; + case -ENODEV: + ret =3D -ENODEV; + goto out_config_dt; + default: + ret =3D -EINVAL; + goto out_config_dt; + } + ethqos->pdev =3D pdev; ethqos->rgmii_base =3D devm_platform_ioremap_resource_byname(pdev, "rgmii= "); if (IS_ERR(ethqos->rgmii_base)) { --=20 2.39.2 From nobody Sat Feb 7 15:11:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C13DAEB64D9 for ; Mon, 19 Jun 2023 09:25:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231585AbjFSJZn (ORCPT ); Mon, 19 Jun 2023 05:25:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231449AbjFSJY3 (ORCPT ); Mon, 19 Jun 2023 05:24:29 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFBEB1A3 for ; Mon, 19 Jun 2023 02:24:26 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-4f62cf9755eso3999873e87.1 for ; Mon, 19 Jun 2023 02:24:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687166665; x=1689758665; 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=x8IJKtNsdBW540hrOificFtv5+xZ0NqYlT5TEOHx1Rg=; b=zzGOUZ2uzsuPMUj7xgWml1QV/Tr6XdMyXmX+xc7AZMeyVzpd1Th/8FJfRjlZ6b/Uq/ yd4EJjeffDrgCmQDIGR0pr9ZiQvZWe+HA2qtXVrxVCh7/mD/wsEn0fQfZnwDCkYwyM6L fBJSc0nl9690FCVc7nwMmmckb/MTr8dby/FMQCLaNvowlkJBNVOwKp05zJ1E8vhUPKna UTwVvG7tUC7R85ULg2ypelbyIxlnqpSSYMHTr85wDJ6h59nAlVONIgJtfu0twFOD4djT 07J8Krl5X42jZW97hTmWad2tLrnGOeEMKJyd4zXwM22fGU9oF5i0/K+qXseiInCCOJSO 60kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687166665; x=1689758665; 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=x8IJKtNsdBW540hrOificFtv5+xZ0NqYlT5TEOHx1Rg=; b=kfTjJH9W6fmWtykx6225+KFin7045JK4946fLY+lh5m5H6lFmRfoao3tv1Lp5iGpxa ZXqUzjkXzGagHRVxhFsbID2p1a4bLnth3GCd3jvzAYy6VCTntGMy52P/prhqlfalcDqr 8JWFm4VhGfzUaTMJcIpMAWIYNUUrddB4IgphjsAiH8dA1vRzPELPFTC3ehhV6lT9/gNk cMcdbNaTRb24ftklucXmJpEUXX8SjM1PuoikXAxmyu1cLFMiJ31UgY97D1ypr/WK1nHV LCF3ko2X1Im9pP/Hg3kxMt8CmSTSVQMEn4A6CnI4zxsvnX1A/IcWSG9GghwIB1AUH2aL L1zA== X-Gm-Message-State: AC+VfDx2/tHdDeu6lHA6G5zpcHUdme6qEwRU6RDcPwsxQE+jpy9tBobG 9SRl2PzNhG9l4fGETBAefGf9Nw== X-Google-Smtp-Source: ACHHUZ6Tcbw6KE5SoygObxk8oAVfpAVRz4iKBToqkTlVGVNorPJd1Ll1aCOQBwTd8HhnaFWn+tOQbw== X-Received: by 2002:a19:7718:0:b0:4f8:6d54:72f9 with SMTP id s24-20020a197718000000b004f86d5472f9mr1308228lfc.61.1687166665212; Mon, 19 Jun 2023 02:24:25 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:d9e8:ddbf:7391:a0b0]) by smtp.gmail.com with ESMTPSA id q9-20020a7bce89000000b003f7cb42fa20sm10045229wmj.42.2023.06.19.02.24.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 02:24:24 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Andrew Halaney Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [RESEND PATCH v2 11/14] net: stmmac: dwmac-qcom-ethqos: add support for SGMII Date: Mon, 19 Jun 2023 11:23:59 +0200 Message-Id: <20230619092402.195578-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619092402.195578-1-brgl@bgdev.pl> References: <20230619092402.195578-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski On sa8775p the MAC is connected to the external PHY over SGMII so add support for it to the driver. Signed-off-by: Bartosz Golaszewski --- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 0ececc951528..bdf59a179f87 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -75,6 +75,10 @@ #define RGMII_CONFIG2_DATA_DIVIDE_CLK_SEL BIT(6) #define RGMII_CONFIG2_TX_CLK_PHASE_SHIFT_EN BIT(5) =20 +/* MAC_CTRL_REG bits */ +#define ETHQOS_MAC_CTRL_SPEED_MODE BIT(14) +#define ETHQOS_MAC_CTRL_PORT_SEL BIT(15) + struct ethqos_emac_por { unsigned int offset; unsigned int value; @@ -92,6 +96,7 @@ struct ethqos_emac_driver_data { struct qcom_ethqos { struct platform_device *pdev; void __iomem *rgmii_base; + void __iomem *mac_base; int (*configure_func)(struct qcom_ethqos *ethqos); =20 unsigned int link_clk_rate; @@ -559,6 +564,33 @@ static int ethqos_configure_rgmii(struct qcom_ethqos *= ethqos) return 0; } =20 +static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos) +{ + int val; + + val =3D readl(ethqos->mac_base + MAC_CTRL_REG); + + switch (ethqos->speed) { + case SPEED_1000: + val &=3D ~ETHQOS_MAC_CTRL_PORT_SEL; + rgmii_updatel(ethqos, RGMII_CONFIG2_RGMII_CLK_SEL_CFG, + RGMII_CONFIG2_RGMII_CLK_SEL_CFG, + RGMII_IO_MACRO_CONFIG2); + break; + case SPEED_100: + val |=3D ETHQOS_MAC_CTRL_PORT_SEL | ETHQOS_MAC_CTRL_SPEED_MODE; + break; + case SPEED_10: + val |=3D ETHQOS_MAC_CTRL_PORT_SEL; + val &=3D ~ETHQOS_MAC_CTRL_SPEED_MODE; + break; + } + + writel(val, ethqos->mac_base + MAC_CTRL_REG); + + return val; +} + static int ethqos_configure(struct qcom_ethqos *ethqos) { return ethqos->configure_func(ethqos); @@ -663,6 +695,9 @@ static int qcom_ethqos_probe(struct platform_device *pd= ev) case PHY_INTERFACE_MODE_RGMII_TXID: ethqos->configure_func =3D ethqos_configure_rgmii; break; + case PHY_INTERFACE_MODE_SGMII: + ethqos->configure_func =3D ethqos_configure_sgmii; + break; case -ENODEV: ret =3D -ENODEV; goto out_config_dt; @@ -678,6 +713,8 @@ static int qcom_ethqos_probe(struct platform_device *pd= ev) goto out_config_dt; } =20 + ethqos->mac_base =3D stmmac_res.addr; + data =3D of_device_get_match_data(dev); ethqos->por =3D data->por; ethqos->num_por =3D data->num_por; --=20 2.39.2 From nobody Sat Feb 7 15:11:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9040EB64D9 for ; Mon, 19 Jun 2023 09:25:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231612AbjFSJZw (ORCPT ); Mon, 19 Jun 2023 05:25:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231454AbjFSJYa (ORCPT ); Mon, 19 Jun 2023 05:24:30 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 590241B4 for ; Mon, 19 Jun 2023 02:24:28 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4f849a0e371so3941358e87.1 for ; Mon, 19 Jun 2023 02:24:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687166666; x=1689758666; 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=DjzvLDkciXjZFL92+Kc0vSUQwlE6cL6G+2BzLekYlAI=; b=XNGhzaLmiL3KFTWhOvSO8p3J4tRL+xF8RjpYFWLGEPTdg3gX53kow5eWe+GjPmXtw0 sOJSIyFuACVYYRxWiyz0R7WM2rD1gwWMwsa39vDl23Zi5zZ0WBUndG4r92W534zVGbDH jv666tDWiF4qCqZ82WKGeOXBufFyzpZBKEzwPfEsy43G2Z8qWHZHMkDcuos8Nh9Ntrwr ujCEYuNqFXACZBpFHRRi5hv6NDQRqjQRNN+r/SMze9BWoTgc8xMxPwAlpKYE5CRlCDRh m6WjPkZt0YdAwFiPhjEOE9KX9kJIQA8BK/TaDHsrwYuXpROrOffd01l1wT8Cj4wzkFyj O1aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687166666; x=1689758666; 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=DjzvLDkciXjZFL92+Kc0vSUQwlE6cL6G+2BzLekYlAI=; b=AZCokGh3VqdUJx3ORe/KhFMBfZUIppublFo+ebBuLU1XY/bN9tWA9SnaJIqs4Ev5hI HOcT1DD5lH4AhJH+lq43w2A+5RYGhf3dXztbtC/SuuI4hSSqq1TOsavYDGk/c7u/WYA/ Du2RLTMuTssOa3PYhgghv+0ocdbAdS+jSWu7cq+NV68LdG2ePsTtCnTq0LtpJ2CwnupK hgpsgAqQ8+k/Q/q6vWckpc238gOpMbfCi5VeD4vi/xGNURSkmM251VSeP2M+e8Exq7FJ 4xVefRPea72TSNNWhmLjFmM5jOhrBfULIdsx0szsvfj+w+DozfRQ/byOBi40MlbdnoAL G0OQ== X-Gm-Message-State: AC+VfDy6asImLwdGvzJvDJYW78fi073o+/eDH2Gsf9PEZ2Z5VPJM7rgp lfio0UAQ+93eZqFwkRWkVcgNdQ== X-Google-Smtp-Source: ACHHUZ4anpGLkXxAz3jzfzAJHE59yvmhAwwgk3HqvnBqFL9PAYQbIBsx1uANXwdQxgAGAMhIDJka/Q== X-Received: by 2002:a19:5f08:0:b0:4f6:3677:553 with SMTP id t8-20020a195f08000000b004f636770553mr4429152lfb.38.1687166666442; Mon, 19 Jun 2023 02:24:26 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:d9e8:ddbf:7391:a0b0]) by smtp.gmail.com with ESMTPSA id q9-20020a7bce89000000b003f7cb42fa20sm10045229wmj.42.2023.06.19.02.24.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 02:24:26 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Andrew Halaney Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski , Jose Abreu Subject: [RESEND PATCH v2 12/14] net: stmmac: add new switch to struct plat_stmmacenet_data Date: Mon, 19 Jun 2023 11:24:00 +0200 Message-Id: <20230619092402.195578-13-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619092402.195578-1-brgl@bgdev.pl> References: <20230619092402.195578-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski On some platforms, the PCS can be integrated in the MAC so the driver will not see any PCS link activity. Add a switch that allows the platform drivers to let the core code know. Signed-off-by: Bartosz Golaszewski Reviewed-by: Jose Abreu --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- include/linux/stmmac.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_main.c index 5c645b6d5660..10e8a5606ba6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5798,7 +5798,7 @@ static void stmmac_common_interrupt(struct stmmac_pri= v *priv) } =20 /* PCS link status */ - if (priv->hw->pcs) { + if (priv->hw->pcs && !priv->plat->has_integrated_pcs) { if (priv->xstats.pcs_link) netif_carrier_on(priv->dev); else diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 225751a8fd8e..06090538fe2d 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -293,5 +293,6 @@ struct plat_stmmacenet_data { bool sph_disable; bool serdes_up_after_phy_linkup; const struct dwmac4_addrs *dwmac4_addrs; + bool has_integrated_pcs; }; #endif --=20 2.39.2 From nobody Sat Feb 7 15:11:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7006EEB64DA for ; Mon, 19 Jun 2023 09:26:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231351AbjFSJZ6 (ORCPT ); Mon, 19 Jun 2023 05:25:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231478AbjFSJYe (ORCPT ); Mon, 19 Jun 2023 05:24:34 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDB3AE65 for ; Mon, 19 Jun 2023 02:24:29 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4f76a4c211dso3994633e87.3 for ; Mon, 19 Jun 2023 02:24:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687166667; x=1689758667; 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=Y6jodbFVefGofwsOC02jBd4/o5V3o0lQxYLRG3ofRjU=; b=jU8Wd9mFcZhKKX0p6C6VEG7ievfAaJRkR/52fZK1EHMb6wma8TStUaEXvdJgseClqO eIEQQssCH+wlqmnuVqzP609KHwmvn7BrYjJgiXGwQMyU2zK/H4K2e/+y24P0HpOk8W1i SecwzuWX3Of1aPo2dkn4lrRuCK/4gwDtkomQUrEZhedPm8DMQ+6hDQa3xJRTEaSR6TC7 CD+uqLPyhSLuzq5cxeMXUOvbdYCfAM456Z3/FGYqKlNm4sFx4/cV1+t+bHreZgt5P2IV 05dBRymeMGUiJkmsJjPuvjlDYwC5A9xJSQZ1YzU/S9L9FkpUB69AGcH/ZCEb8dw/dBO1 uaFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687166667; x=1689758667; 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=Y6jodbFVefGofwsOC02jBd4/o5V3o0lQxYLRG3ofRjU=; b=ai5zeWCPS9Te0efzLHjSE+7Kb+Bik40Q1PUDM7GPE5J8veyUk/e807l5NQqh7v/HaN ipZ0wYFVZQKGiMTcCiq1BGyDypdUFg88nyDY+bShsr+m6lnH9/6IfIKiZIeLXGo+WiTg pDg5YJYzdplFRdpAgmditFRyO82jZjqHKFB80wO7Zi4tZx4KrCeze5y/vSuyBOzPJFiU DHacMZy8+Pr6XTsk7VA2fI2yTkNdN+5+BJ1T9iDF4lqs9SQQwVu/AzCFedhKLjGT80bh LFa9zbr58+rKxCx5PmFm6X7APJV6ENo/sz7TMFyFXH2lh0Vjo2FeE7D1w0a/dfDyQGe0 97ZQ== X-Gm-Message-State: AC+VfDwKpNVpr6X5zqdkWBANYdaqXC2jUNX6InFMy367MCr9RdtGiiZA cQfFNdATQX9cJVwXc0lIUWwYcA== X-Google-Smtp-Source: ACHHUZ64aSmZeaRayZqnyOMW64taQxIAjCHAjUgxv/OQQgJSg3V/UkyL8eNJlDKlvN8kbmXyQqPU1g== X-Received: by 2002:a05:6512:1dc:b0:4f6:2722:9a5a with SMTP id f28-20020a05651201dc00b004f627229a5amr5576347lfp.57.1687166667681; Mon, 19 Jun 2023 02:24:27 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:d9e8:ddbf:7391:a0b0]) by smtp.gmail.com with ESMTPSA id q9-20020a7bce89000000b003f7cb42fa20sm10045229wmj.42.2023.06.19.02.24.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 02:24:27 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Andrew Halaney Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski , Krzysztof Kozlowski Subject: [RESEND PATCH v2 13/14] dt-bindings: net: qcom,ethqos: add description for sa8775p Date: Mon, 19 Jun 2023 11:24:01 +0200 Message-Id: <20230619092402.195578-14-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619092402.195578-1-brgl@bgdev.pl> References: <20230619092402.195578-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski Add the compatible for the MAC controller on sa8775p platforms. This MAC works with a single interrupt so add minItems to the interrupts property. The fourth clock's name is different here so change it. Enable relevant PHY properties. Add the relevant compatibles to the binding document for snps,dwmac as well. Signed-off-by: Bartosz Golaszewski Reviewed-by: Krzysztof Kozlowski --- .../devicetree/bindings/net/qcom,ethqos.yaml | 12 +++++++++++- .../devicetree/bindings/net/snps,dwmac.yaml | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/net/qcom,ethqos.yaml b/Docum= entation/devicetree/bindings/net/qcom,ethqos.yaml index 60a38044fb19..7bdb412a0185 100644 --- a/Documentation/devicetree/bindings/net/qcom,ethqos.yaml +++ b/Documentation/devicetree/bindings/net/qcom,ethqos.yaml @@ -20,6 +20,7 @@ properties: compatible: enum: - qcom,qcs404-ethqos + - qcom,sa8775p-ethqos - qcom,sc8280xp-ethqos - qcom,sm8150-ethqos =20 @@ -32,11 +33,13 @@ properties: - const: rgmii =20 interrupts: + minItems: 1 items: - description: Combined signal for various interrupt events - description: The interrupt that occurs when Rx exits the LPI state =20 interrupt-names: + minItems: 1 items: - const: macirq - const: eth_lpi @@ -49,11 +52,18 @@ properties: - const: stmmaceth - const: pclk - const: ptp_ref - - const: rgmii + - enum: + - rgmii + - phyaux =20 iommus: maxItems: 1 =20 + phys: true + + phy-names: + const: serdes + required: - compatible - clocks diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Docume= ntation/devicetree/bindings/net/snps,dwmac.yaml index 363b3e3ea3a6..ddf9522a5dc2 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -67,6 +67,7 @@ properties: - loongson,ls2k-dwmac - loongson,ls7a-dwmac - qcom,qcs404-ethqos + - qcom,sa8775p-ethqos - qcom,sc8280xp-ethqos - qcom,sm8150-ethqos - renesas,r9a06g032-gmac @@ -582,6 +583,7 @@ allOf: - ingenic,x1600-mac - ingenic,x1830-mac - ingenic,x2000-mac + - qcom,sa8775p-ethqos - qcom,sc8280xp-ethqos - snps,dwmac-3.50a - snps,dwmac-4.10a @@ -638,6 +640,7 @@ allOf: - ingenic,x1830-mac - ingenic,x2000-mac - qcom,qcs404-ethqos + - qcom,sa8775p-ethqos - qcom,sc8280xp-ethqos - qcom,sm8150-ethqos - snps,dwmac-4.00 --=20 2.39.2 From nobody Sat Feb 7 15:11:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F942EB64DA for ; Mon, 19 Jun 2023 09:26:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231605AbjFSJ0E (ORCPT ); Mon, 19 Jun 2023 05:26:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231486AbjFSJYf (ORCPT ); Mon, 19 Jun 2023 05:24:35 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDDD8E73 for ; Mon, 19 Jun 2023 02:24:30 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3f9083d8849so24444365e9.0 for ; Mon, 19 Jun 2023 02:24:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687166669; x=1689758669; 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=djSwdyLw8xp+3Hm8dkeIbLA/6vtbTk1lxohdgQnQb6c=; b=bO9aSgZagrEBEIkG1MmJMrxVAwa3ITE67+vzozCxbo5GX2JvX6IfKatyAJc5WJTIvm gxOMs82gAZNA9K/kxyH7hJ0VA6YfM2ZcesWir5TIPi/SZK0J0TVI9ojxjAVP37+mIOww esqOSUtqQ3974YYJGBFNxj2Oy+mGr8sfCcEgJOlHJkJe/w5ntjLWJBao0H95atJpHDN9 XmtC25ManCI1DayUnp8V3MT+CiMzz3jAjofZoWchpuKpuZmtAWK370xvuOe8+AEc7pr3 LgrDipRfrSjXz5I75C18iGOW7ToIphj14Bt5hYJCYlwepgEAPJEp3v/Q6y1r3YVHTBJa TZzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687166669; x=1689758669; 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=djSwdyLw8xp+3Hm8dkeIbLA/6vtbTk1lxohdgQnQb6c=; b=cd7+2VvxsGo1DAUXBTfOfp5adfUmBDu0m6FIisSRwEzetF3ZStuosThZZEAlI8GLFZ gG5H/NPaxzuLtOyxDUH9QgQZRsXAG9qhGolxFGNNJVijJ3tP2frLz6BeFChEtOyzu+nZ bgoO/slemwV5SlVx8gwaOmzVboBGaH/naZfaucbc7NKKpcJcl7xugiGWoXW9MwHPLBV5 wozTxGKMQ5xxWycWve6o5dyU6x1uTO0CHLM/PUKixYKQ2Q1HZgQai1hovn7bCtU4HTB6 DaDx9YtuHwzLyeL0axXWfEEnKlSgFfmE+Jlt6nace6PQdJJqxRmxF/0ff2NHmoi3run5 i6sQ== X-Gm-Message-State: AC+VfDypLIecxt7jy/3UpUa2hm3RkFQH/9iJGxe0idQRRmwCwbzbIsf7 8eld+EJp9I3q3lXsMDMQvjlweg== X-Google-Smtp-Source: ACHHUZ55yZarh34rxCXvP4nDHHz58CibAdCjSGMHZcCrATZRRuYKSxCHkofo7a1tu72C48EhXAMc9g== X-Received: by 2002:a05:600c:b4e:b0:3f7:fcca:5e32 with SMTP id k14-20020a05600c0b4e00b003f7fcca5e32mr8241646wmr.17.1687166668922; Mon, 19 Jun 2023 02:24:28 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:d9e8:ddbf:7391:a0b0]) by smtp.gmail.com with ESMTPSA id q9-20020a7bce89000000b003f7cb42fa20sm10045229wmj.42.2023.06.19.02.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 02:24:28 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Andrew Halaney Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [RESEND PATCH v2 14/14] net: stmmac: dwmac-qcom-ethqos: add support for emac4 on sa8775p platforms Date: Mon, 19 Jun 2023 11:24:02 +0200 Message-Id: <20230619092402.195578-15-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619092402.195578-1-brgl@bgdev.pl> References: <20230619092402.195578-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski sa8775p uses EMAC version 4, add the relevant defines, rename the has_emac3 switch to has_emac_ge_3 (has emac greater-or-equal than 3) and add the new compatible. Signed-off-by: Bartosz Golaszewski --- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 65 +++++++++++++++---- 1 file changed, 51 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index bdf59a179f87..fa0fc53c56a3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -88,8 +88,9 @@ struct ethqos_emac_driver_data { const struct ethqos_emac_por *por; unsigned int num_por; bool rgmii_config_loopback_en; - bool has_emac3; + bool has_emac_ge_3; const char *link_clk_name; + bool has_integrated_pcs; struct dwmac4_addrs dwmac4_addrs; }; =20 @@ -108,7 +109,7 @@ struct qcom_ethqos { const struct ethqos_emac_por *por; unsigned int num_por; bool rgmii_config_loopback_en; - bool has_emac3; + bool has_emac_ge_3; }; =20 static int rgmii_readl(struct qcom_ethqos *ethqos, unsigned int offset) @@ -202,7 +203,7 @@ static const struct ethqos_emac_driver_data emac_v2_3_0= _data =3D { .por =3D emac_v2_3_0_por, .num_por =3D ARRAY_SIZE(emac_v2_3_0_por), .rgmii_config_loopback_en =3D true, - .has_emac3 =3D false, + .has_emac_ge_3 =3D false, }; =20 static const struct ethqos_emac_por emac_v2_1_0_por[] =3D { @@ -218,7 +219,7 @@ static const struct ethqos_emac_driver_data emac_v2_1_0= _data =3D { .por =3D emac_v2_1_0_por, .num_por =3D ARRAY_SIZE(emac_v2_1_0_por), .rgmii_config_loopback_en =3D false, - .has_emac3 =3D false, + .has_emac_ge_3 =3D false, }; =20 static const struct ethqos_emac_por emac_v3_0_0_por[] =3D { @@ -234,7 +235,41 @@ static const struct ethqos_emac_driver_data emac_v3_0_= 0_data =3D { .por =3D emac_v3_0_0_por, .num_por =3D ARRAY_SIZE(emac_v3_0_0_por), .rgmii_config_loopback_en =3D false, - .has_emac3 =3D true, + .has_emac_ge_3 =3D true, + .dwmac4_addrs =3D { + .dma_chan =3D 0x00008100, + .dma_chan_offset =3D 0x1000, + .mtl_chan =3D 0x00008000, + .mtl_chan_offset =3D 0x1000, + .mtl_ets_ctrl =3D 0x00008010, + .mtl_ets_ctrl_offset =3D 0x1000, + .mtl_txq_weight =3D 0x00008018, + .mtl_txq_weight_offset =3D 0x1000, + .mtl_send_slp_cred =3D 0x0000801c, + .mtl_send_slp_cred_offset =3D 0x1000, + .mtl_high_cred =3D 0x00008020, + .mtl_high_cred_offset =3D 0x1000, + .mtl_low_cred =3D 0x00008024, + .mtl_low_cred_offset =3D 0x1000, + }, +}; + +static const struct ethqos_emac_por emac_v4_0_0_por[] =3D { + { .offset =3D RGMII_IO_MACRO_CONFIG, .value =3D 0x40c01343 }, + { .offset =3D SDCC_HC_REG_DLL_CONFIG, .value =3D 0x2004642c }, + { .offset =3D SDCC_HC_REG_DDR_CONFIG, .value =3D 0x80040800 }, + { .offset =3D SDCC_HC_REG_DLL_CONFIG2, .value =3D 0x00200000 }, + { .offset =3D SDCC_USR_CTL, .value =3D 0x00010800 }, + { .offset =3D RGMII_IO_MACRO_CONFIG2, .value =3D 0x00002060 }, +}; + +static const struct ethqos_emac_driver_data emac_v4_0_0_data =3D { + .por =3D emac_v4_0_0_por, + .num_por =3D ARRAY_SIZE(emac_v3_0_0_por), + .rgmii_config_loopback_en =3D false, + .has_emac_ge_3 =3D true, + .link_clk_name =3D "phyaux", + .has_integrated_pcs =3D true, .dwmac4_addrs =3D { .dma_chan =3D 0x00008100, .dma_chan_offset =3D 0x1000, @@ -275,7 +310,7 @@ static int ethqos_dll_configure(struct qcom_ethqos *eth= qos) rgmii_updatel(ethqos, SDCC_DLL_CONFIG_DLL_EN, SDCC_DLL_CONFIG_DLL_EN, SDCC_HC_REG_DLL_CONFIG); =20 - if (!ethqos->has_emac3) { + if (!ethqos->has_emac_ge_3) { rgmii_updatel(ethqos, SDCC_DLL_MCLK_GATING_EN, 0, SDCC_HC_REG_DLL_CONFIG); =20 @@ -316,7 +351,7 @@ static int ethqos_dll_configure(struct qcom_ethqos *eth= qos) rgmii_updatel(ethqos, SDCC_DLL_CONFIG2_DDR_CAL_EN, SDCC_DLL_CONFIG2_DDR_CAL_EN, SDCC_HC_REG_DLL_CONFIG2); =20 - if (!ethqos->has_emac3) { + if (!ethqos->has_emac_ge_3) { rgmii_updatel(ethqos, SDCC_DLL_CONFIG2_DLL_CLOCK_DIS, 0, SDCC_HC_REG_DLL_CONFIG2); =20 @@ -386,7 +421,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *= ethqos) /* PRG_RCLK_DLY =3D TCXO period * TCXO_CYCLES_CNT / 2 * RX delay ns, * in practice this becomes PRG_RCLK_DLY =3D 52 * 4 / 2 * RX delay ns */ - if (ethqos->has_emac3) { + if (ethqos->has_emac_ge_3) { /* 0.9 ns */ rgmii_updatel(ethqos, SDCC_DDR_CONFIG_PRG_RCLK_DLY, 115, SDCC_HC_REG_DDR_CONFIG); @@ -421,7 +456,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *= ethqos) rgmii_updatel(ethqos, RGMII_CONFIG2_RSVD_CONFIG15, 0, RGMII_IO_MACRO_CONFIG2); =20 - if (ethqos->has_emac3) + if (ethqos->has_emac_ge_3) rgmii_updatel(ethqos, RGMII_CONFIG2_RX_PROG_SWAP, RGMII_CONFIG2_RX_PROG_SWAP, RGMII_IO_MACRO_CONFIG2); @@ -461,7 +496,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *= ethqos) RGMII_IO_MACRO_CONFIG); rgmii_updatel(ethqos, RGMII_CONFIG2_RSVD_CONFIG15, 0, RGMII_IO_MACRO_CONFIG2); - if (ethqos->has_emac3) + if (ethqos->has_emac_ge_3) rgmii_updatel(ethqos, RGMII_CONFIG2_RX_PROG_SWAP, RGMII_CONFIG2_RX_PROG_SWAP, RGMII_IO_MACRO_CONFIG2); @@ -510,7 +545,7 @@ static int ethqos_configure_rgmii(struct qcom_ethqos *e= thqos) rgmii_updatel(ethqos, SDCC_DLL_CONFIG_PDN, SDCC_DLL_CONFIG_PDN, SDCC_HC_REG_DLL_CONFIG); =20 - if (ethqos->has_emac3) { + if (ethqos->has_emac_ge_3) { if (ethqos->speed =3D=3D SPEED_1000) { rgmii_writel(ethqos, 0x1800000, SDCC_TEST_CTL); rgmii_writel(ethqos, 0x2C010800, SDCC_USR_CTL); @@ -540,7 +575,7 @@ static int ethqos_configure_rgmii(struct qcom_ethqos *e= thqos) SDCC_HC_REG_DLL_CONFIG); =20 /* Set USR_CTL bit 26 with mask of 3 bits */ - if (!ethqos->has_emac3) + if (!ethqos->has_emac_ge_3) rgmii_updatel(ethqos, GENMASK(26, 24), BIT(26), SDCC_USR_CTL); =20 @@ -719,7 +754,7 @@ static int qcom_ethqos_probe(struct platform_device *pd= ev) ethqos->por =3D data->por; ethqos->num_por =3D data->num_por; ethqos->rgmii_config_loopback_en =3D data->rgmii_config_loopback_en; - ethqos->has_emac3 =3D data->has_emac3; + ethqos->has_emac_ge_3 =3D data->has_emac_ge_3; =20 ethqos->link_clk =3D devm_clk_get(dev, data->link_clk_name ?: "rgmii"); if (IS_ERR(ethqos->link_clk)) { @@ -749,12 +784,13 @@ static int qcom_ethqos_probe(struct platform_device *= pdev) plat_dat->fix_mac_speed =3D ethqos_fix_mac_speed; plat_dat->dump_debug_regs =3D rgmii_dump; plat_dat->has_gmac4 =3D 1; - if (ethqos->has_emac3) + if (ethqos->has_emac_ge_3) plat_dat->dwmac4_addrs =3D &data->dwmac4_addrs; plat_dat->pmt =3D 1; plat_dat->tso_en =3D of_property_read_bool(np, "snps,tso"); if (of_device_is_compatible(np, "qcom,qcs404-ethqos")) plat_dat->rx_clk_runs_in_lpi =3D 1; + plat_dat->has_integrated_pcs =3D data->has_integrated_pcs; =20 if (ethqos->serdes_phy) { plat_dat->serdes_powerup =3D qcom_ethqos_serdes_powerup; @@ -775,6 +811,7 @@ static int qcom_ethqos_probe(struct platform_device *pd= ev) =20 static const struct of_device_id qcom_ethqos_match[] =3D { { .compatible =3D "qcom,qcs404-ethqos", .data =3D &emac_v2_3_0_data}, + { .compatible =3D "qcom,sa8775p-ethqos", .data =3D &emac_v4_0_0_data}, { .compatible =3D "qcom,sc8280xp-ethqos", .data =3D &emac_v3_0_0_data}, { .compatible =3D "qcom,sm8150-ethqos", .data =3D &emac_v2_1_0_data}, { } --=20 2.39.2