From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35DCACCFA1D for ; Thu, 6 Nov 2025 12:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jPOXVJ+1ageVItt7k9bueA27ISql9g34HUybdCz6ytE=; b=psRRMouw7GeOG3 yeSrcAySg7n5t6oY/h/M1g1bkROtgTm1wJCGlVN4ZnYF1kMfANw8I4y34SsFKZQua/F/aMtnZpqTB SgEzarSRFBnO35cU476h6klRFc3Ec6gD9TWOC4UEp6VqbeXfXyskoXgNbdHr7+HNY08pO+dFleIUK N0cLdTxGKsPQUd89O0ec2NrPjhaQJ6QbH8u5bYzgEIPRJQBaihID/d8ea70FVSHCw0ET/bHwtbkRW F4KDRcZKlylqlN4M9rwi01oQXLdPJDBUYio76iSnYHAjbZaQKUAJxnKmU2gnc/prZMwno5QTv5hqG eUjMRbtrSH7uBrcOEUcA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vGz6n-0000000FRln-2ioj; Thu, 06 Nov 2025 12:28:57 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vGGmw-0000000BqYB-21mA for linux-rockchip@lists.infradead.org; Tue, 04 Nov 2025 13:09:32 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-429b7eecf7cso3924773f8f.0 for ; Tue, 04 Nov 2025 05:09:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1762261769; x=1762866569; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6g7dsZ8u0SOZn4ZdglRbxzgGZbve11SxESJzoyiLLfA=; b=HvpKx/Zvv5oeq3707of+pofvBGjnmp7I4zdBmsdNbXoimBkV8IbR4UjBkibrMmCMXV rlIdZmcjXWWFBGuNHXqK3q3MFx2uaK5eiDlZcvuQwX9vk7Kxy44hEwqe3LW5R6sFVW6H 7bVW4GJM2LfiYiS7cD1cq6HUBrEcWdoH5RzUqDD9q3VoXdFxlyTwGYdJagT6wPDqLd3q wb7BijAS5n0cwWebmODK//3fZoY4zExYlYlQCmjO+kcN2LyeChVSl/Oiryd9SUdKiThJ otOmrGJYF1bXDWUrDpsbQbgetb5bUI7pPUrTb3XiSa4iWjIfxYxXonHJF1a4ljSt+W0s O7vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762261769; x=1762866569; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6g7dsZ8u0SOZn4ZdglRbxzgGZbve11SxESJzoyiLLfA=; b=Ad5B4DexxiFyatSQwcaVaKV2lpV7HAVItcmdGeW3tasRo3ZlmyxXX9zyN+MBGnJSM3 4sZkBGnRsEvbeJy4629r0qYliiuhFcxftsljqwCx15yi2+nSqOfxNtrXIqZrsNNlWXgu qIrHZudfHwhDVqiHrJHoEmdFKQ3mG6+q6VhsuZY4BugdGBMIQF6ZC8IgJda3fdG3B4CI 5JNkNzPYN8TQd4i33tfYBGAeieBe/d9bG27abbvUObRnvS0j94nSasQNxwISETyDT9cH GKdUyYUWM8AEMR/k8pSwmXvX6jMRlLPWIFpeNoyqVtO2xpI7I3hF6fpiwswiDDJJiK0V 7VxQ== X-Forwarded-Encrypted: i=1; AJvYcCUV8Nxxg6wLX4tgpnsWZL8htaqgTtkyN/1fFOLiHylVs+fEmHQsFS9vfCH65mBGFepyADzHtx6jSdbqnerc7Q==@lists.infradead.org X-Gm-Message-State: AOJu0YyS/OjbJtp8YjyniDJWhctRMI5CkQF/A7lZkV30NESVAVf1tPCw +vPukBxGVfB8/pn12GAV+1legBOb7oyMThjCq08l4+f93KyvudzHOmjWjjD5FRJR6bg= X-Gm-Gg: ASbGncta49vSbTbNbmLLfoqwiIiXllMNCTIuKm9yGWwpMk+T/hxOtUceHUjB/fELJT9 0baSmF8pqWMVRMMuUl/vt4Ztico0pt/AT95T21WKzgFnTUtkZmS08qZozZinf0+j3tS0o6Ks/MT P8AL5boWdX1sWpzJU2Iszg/TFqRybU25qceJMuXxtNyPZQlWLTX5aGkGSDSC8QJNfCRLkNzvOU5 oR/l8ADjwstT6PtykzQgo6wJ/HtVJW3exYjGIBdu1VQ3guSRNraLh5tcR2OH9grrShjAjluGEPY C3zWSulO9cv26aGxvoPFVgmv6g9NOkKxyPS/NtABoqC5VQvIpYNACHwrmukwVMvhmXms+8T0P+x khPbC9u1/8BXx+0gwsTlYy/zSCJIHEf3zoFDInCqyJUo7ETKtiJTzU7M7lN2wY5SX+PpYUw== X-Google-Smtp-Source: AGHT+IHlxOoZ7XT18Vfvo/agko5vs85w5rmhUqZJanFIi/Ov8ICdgLA4arr6qqZL3+QQYmU0g/EvZw== X-Received: by 2002:a05:6000:2082:b0:429:cff0:1929 with SMTP id ffacd0b85a97d-429dbcf3cebmr3258016f8f.29.1762261767675; Tue, 04 Nov 2025 05:09:27 -0800 (PST) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:9ea1:7ab7:4748:cae3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429dc18efd3sm4554431f8f.5.2025.11.04.05.09.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Nov 2025 05:09:19 -0800 (PST) From: Bartosz Golaszewski Date: Tue, 04 Nov 2025 14:08:55 +0100 Subject: [PATCH v4 4/8] net: stmmac: qcom-ethqos: wrap emac driver data in additional structure MIME-Version: 1.0 Message-Id: <20251104-qcom-sa8255p-emac-v4-4-f76660087cea@linaro.org> References: <20251104-qcom-sa8255p-emac-v4-0-f76660087cea@linaro.org> In-Reply-To: <20251104-qcom-sa8255p-emac-v4-0-f76660087cea@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Richard Cochran , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , Vinod Koul , Giuseppe Cavallaro , Jose Abreu , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Matthew Gerlach , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Keguang Zhang , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Jan Petrous , s32@nxp.com, Romain Gantois , Lad Prabhakar , Heiko Stuebner , Chen Wang , Inochi Amaoto , Emil Renner Berthing , Minda Chen , Drew Fustini , Guo Ren , Fu Wei , Nobuhiro Iwamatsu , Geert Uytterhoeven , Magnus Damm , Maxime Ripard , Shuang Liang , Zhi Li , Shangjuan Wei , "G. Jaya Kumaran" , Clark Wang , Linux Team , Frank Li , David Wu , Samin Guo , Christophe Roullier , Swathi K S Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Drew Fustini , linux-sunxi@lists.linux.dev, linux-amlogic@lists.infradead.org, linux-mips@vger.kernel.org, imx@lists.linux.dev, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, sophgo@lists.linux.dev, linux-riscv@lists.infradead.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5646; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=FNtfWUOF4aoHZQXzUDVa1raYDkAAFgkdXVleG8nnhtM=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBpCfrtSGh3xeSD73y28qW6sUz2LCQZ1x8oxw6JE fCMYH3pXYKJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaQn67QAKCRARpy6gFHHX cmFRD/9LIoa+4RVvj1jMsRAZr0/STyyV46NfgKs3xsOc2YEHRAOz2IvLEFMPEMLqGj35lZVCPH9 jSRQFfOKzF3nMtH4xjV+Cu4LwiaQXQE28lacAeiJV8FD9Rr+XOXXHX8Df3qgei9pQZuEJt0uVkA HGEhoQvCaamAtctMzCIKPxswzYgQgcm8KTsDBVkzcosF51LvOUGM3FU5AsMSTJ+y5EYbl79fmQO abIWx1tVli4V8gDjjPI9lvvUDrFDLMWvKV1+4NLJDXP3WG9L3ZtqcReQEeppHQNo7eNh8vK51dG 9mYIWUmoSSjdt9U01SFnNuJi4L7iH8fwfXfUXUP/8ySl2NSjbnmRFsXlTNh/F8eLnrP5HnQ7GAr lKbOKr0Gm5PxGJihrQIPoYClyEsmvSqkQzH85jCCbGK2CMEXliO9skRMOMzzmNMVHXQ5A7FDWjH Z7GnY4CHNagb6JYWOcYgXoqtlBh0LMp6KakWtYUs27PIoya8RT79KggmxQbICmRIorN3qe5vlp+ wwkxd1TdsI43sAz4xSAxc/GoWdCaR8tXJ5Gsfbqj6uvhuKjlMlMQc9e2edLCuyibRZ6ZvLxaXTO QGBkyWgH37pg6K7DXvtn+mg8uVLIttlIbPNO2NQRWJRlIYs4y5Kkh6fO/AG5Mfq8pSTnTRGgrd/ IiSxjqDYR86AsmA== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251104_050930_575229_46D944F8 X-CRM114-Status: GOOD ( 17.03 ) X-Mailman-Approved-At: Thu, 06 Nov 2025 04:28:36 -0800 X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org From: Bartosz Golaszewski As the first step in enabling power domain support in the driver, we'll split the device match data and runtime data structures into their general and power-management-specific parts. To allow that: first wrap the emac driver data in another layer which will later be expanded. Signed-off-by: Bartosz Golaszewski --- .../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 51 ++++++++++++++++------ 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 8493131ca32f5c6ca7e1654da0bbf4ffa1eefa4e..9cafe101049d5412d649b3beaca350c497ffc981 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -97,6 +97,10 @@ struct ethqos_emac_driver_data { bool needs_sgmii_loopback; }; +struct ethqos_emac_match_data { + const struct ethqos_emac_driver_data *drv_data; +}; + struct qcom_ethqos { struct platform_device *pdev; void __iomem *rgmii_base; @@ -214,6 +218,10 @@ static const struct ethqos_emac_driver_data emac_v2_3_0_data = { .has_emac_ge_3 = false, }; +static const struct ethqos_emac_match_data emac_qcs404_data = { + .drv_data = &emac_v2_3_0_data, +}; + static const struct ethqos_emac_por emac_v2_1_0_por[] = { { .offset = RGMII_IO_MACRO_CONFIG, .value = 0x40C01343 }, { .offset = SDCC_HC_REG_DLL_CONFIG, .value = 0x2004642C }, @@ -230,6 +238,10 @@ static const struct ethqos_emac_driver_data emac_v2_1_0_data = { .has_emac_ge_3 = false, }; +static const struct ethqos_emac_match_data emac_sm8150_data = { + .drv_data = &emac_v2_1_0_data, +}; + static const struct ethqos_emac_por emac_v3_0_0_por[] = { { .offset = RGMII_IO_MACRO_CONFIG, .value = 0x40c01343 }, { .offset = SDCC_HC_REG_DLL_CONFIG, .value = 0x2004642c }, @@ -262,6 +274,10 @@ static const struct ethqos_emac_driver_data emac_v3_0_0_data = { }, }; +static const struct ethqos_emac_match_data emac_sc8280xp_data = { + .drv_data = &emac_v3_0_0_data, +}; + static const struct ethqos_emac_por emac_v4_0_0_por[] = { { .offset = RGMII_IO_MACRO_CONFIG, .value = 0x40c01343 }, { .offset = SDCC_HC_REG_DLL_CONFIG, .value = 0x2004642c }, @@ -297,6 +313,10 @@ static const struct ethqos_emac_driver_data emac_v4_0_0_data = { }, }; +static const struct ethqos_emac_match_data emac_sa8775p_data = { + .drv_data = &emac_v4_0_0_data, +}; + static int ethqos_dll_configure(struct qcom_ethqos *ethqos) { struct device *dev = ðqos->pdev->dev; @@ -750,7 +770,8 @@ static void ethqos_ptp_clk_freq_config(struct stmmac_priv *priv) static int qcom_ethqos_probe(struct platform_device *pdev) { - const struct ethqos_emac_driver_data *data; + const struct ethqos_emac_driver_data *drv_data; + const struct ethqos_emac_match_data *data; struct plat_stmmacenet_data *plat_dat; struct stmmac_resources stmmac_res; struct device *dev = &pdev->dev; @@ -801,13 +822,15 @@ static int qcom_ethqos_probe(struct platform_device *pdev) ethqos->mac_base = stmmac_res.addr; data = device_get_match_data(dev); - ethqos->por = data->por; - ethqos->num_por = data->num_por; - ethqos->rgmii_config_loopback_en = data->rgmii_config_loopback_en; - ethqos->has_emac_ge_3 = data->has_emac_ge_3; - ethqos->needs_sgmii_loopback = data->needs_sgmii_loopback; + drv_data = data->drv_data; - ethqos->link_clk = devm_clk_get(dev, data->link_clk_name ?: "rgmii"); + ethqos->por = drv_data->por; + ethqos->num_por = drv_data->num_por; + ethqos->rgmii_config_loopback_en = drv_data->rgmii_config_loopback_en; + ethqos->has_emac_ge_3 = drv_data->has_emac_ge_3; + ethqos->needs_sgmii_loopback = drv_data->needs_sgmii_loopback; + + ethqos->link_clk = devm_clk_get(dev, drv_data->link_clk_name ?: "rgmii"); if (IS_ERR(ethqos->link_clk)) return dev_err_probe(dev, PTR_ERR(ethqos->link_clk), "Failed to get link_clk\n"); @@ -835,14 +858,14 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->ptp_clk_freq_config = ethqos_ptp_clk_freq_config; plat_dat->core_type = DWMAC_CORE_GMAC4; if (ethqos->has_emac_ge_3) - plat_dat->dwmac4_addrs = &data->dwmac4_addrs; + plat_dat->dwmac4_addrs = &drv_data->dwmac4_addrs; plat_dat->pmt = 1; if (device_property_present(dev, "snps,tso")) plat_dat->flags |= STMMAC_FLAG_TSO_EN; if (device_is_compatible(dev, "qcom,qcs404-ethqos")) plat_dat->flags |= STMMAC_FLAG_RX_CLK_RUNS_IN_LPI; - if (data->dma_addr_width) - plat_dat->host_dma_width = data->dma_addr_width; + if (drv_data->dma_addr_width) + plat_dat->host_dma_width = drv_data->dma_addr_width; if (ethqos->serdes_phy) { plat_dat->serdes_powerup = qcom_ethqos_serdes_powerup; @@ -857,10 +880,10 @@ static int qcom_ethqos_probe(struct platform_device *pdev) } static const struct of_device_id qcom_ethqos_match[] = { - { .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_data}, - { .compatible = "qcom,sa8775p-ethqos", .data = &emac_v4_0_0_data}, - { .compatible = "qcom,sc8280xp-ethqos", .data = &emac_v3_0_0_data}, - { .compatible = "qcom,sm8150-ethqos", .data = &emac_v2_1_0_data}, + { .compatible = "qcom,qcs404-ethqos", .data = &emac_qcs404_data}, + { .compatible = "qcom,sa8775p-ethqos", .data = &emac_sa8775p_data}, + { .compatible = "qcom,sc8280xp-ethqos", .data = &emac_sc8280xp_data}, + { .compatible = "qcom,sm8150-ethqos", .data = &emac_sm8150_data}, { } }; MODULE_DEVICE_TABLE(of, qcom_ethqos_match); -- 2.51.0 _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip