From patchwork Wed Sep 1 05:05:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12468277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CABDBC4320A for ; Wed, 1 Sep 2021 05:05:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5032610CF for ; Wed, 1 Sep 2021 05:05:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241921AbhIAFGa (ORCPT ); Wed, 1 Sep 2021 01:06:30 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:59399 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241912AbhIAFG2 (ORCPT ); Wed, 1 Sep 2021 01:06:28 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id F2FC75C01AC; Wed, 1 Sep 2021 01:05:31 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 01 Sep 2021 01:05:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=G403FiZrEXF10 NkUtZME2MVjN18F7TyLXuqbc0sKEq8=; b=GumAqXahjJk6BHXf3AqXxDaOqQrdn MKuRHdjirdLxJZ3lbJ8DfGVYa/CuDsUuufDkKQhJ74OSIMQHz6tMlH8Bh4KzB8vU Myn0pknz3ME9iLHI41qvkq050iPxembiwpAh8Y51SYjJelyfxokzMttPAMKDXEEF i+uN0Z+qTA55c70yIHc/B+8JwN4+iKzz4R8DvlyCbNd7TlUva6bVfnA6996ycKb7 I0T3CpjfZe6x/TT+fCtrZgtPun0NhobAO8tegOccr0QsWLJ6PJI7YUtWxHioJ9s8 nSyqcW3BKl4/sp2XUppGwdzFdfAd3a8z2+gNUreWbNvX6a4dwDdj72KEg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=G403FiZrEXF10NkUtZME2MVjN18F7TyLXuqbc0sKEq8=; b=CktxrdU6 cWvjo13WSlZC3Ng2yTkUXWSviPWutw5ra8OOLE+rE1v0X4QraWEgpfXMKyhxAfUR 25DazH1x6yOVb7z60+0l3kqiMYwkSKbSmG64TeaP1tYO25A07Qyc9TawRLgcjQIT Fr/T1YgW9Oh8irnJ6IJaNIl9OPOaf+F7ZxE1/VLmyN+pLpy+waFAADXIX1k4q4ho 128c0HszonBsAFCfXsPhYu82fyW4mwOKHGHyNOZECwKS3NwlEN4+X5DMCQ60tPfe hyb8Dp4O8WoFByTGpvK4puhRjpnwhXYnA391Mp07yLkPQfCe5wjb1Ix6vuwUx9ac drk54r3HSS0yGA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvvddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Sep 2021 01:05:30 -0400 (EDT) From: Samuel Holland To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Michael Turquette , Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Samuel Holland Subject: [PATCH 1/8] clk: sunxi-ng: Unregister clocks/resets when unbinding Date: Wed, 1 Sep 2021 00:05:19 -0500 Message-Id: <20210901050526.45673-2-samuel@sholland.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210901050526.45673-1-samuel@sholland.org> References: <20210901050526.45673-1-samuel@sholland.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Currently, unbinding a CCU driver unmaps the device's MMIO region, while leaving its clocks/resets and their providers registered. This can cause a page fault later when some clock operation tries to perform MMIO. Fix this by separating the CCU initialization from the memory allocation, and then using a devres callback to unregister the clocks and resets. This also fixes a memory leak of the `struct ccu_reset`, and uses the correct owner (the specific platform driver) for the clocks and resets. Early OF clock providers are never unregistered, and limited error handling is possible, so they are mostly unchanged. The error reporting is made more consistent by moving the message inside of_sunxi_ccu_probe. Signed-off-by: Samuel Holland --- drivers/clk/sunxi-ng/ccu-sun4i-a10.c | 2 +- drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c | 2 +- drivers/clk/sunxi-ng/ccu-sun50i-a100.c | 2 +- drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 2 +- drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c | 2 +- drivers/clk/sunxi-ng/ccu-sun50i-h6.c | 2 +- drivers/clk/sunxi-ng/ccu-sun50i-h616.c | 4 +- drivers/clk/sunxi-ng/ccu-sun5i.c | 2 +- drivers/clk/sunxi-ng/ccu-sun6i-a31.c | 2 +- drivers/clk/sunxi-ng/ccu-sun8i-a23.c | 2 +- drivers/clk/sunxi-ng/ccu-sun8i-a33.c | 2 +- drivers/clk/sunxi-ng/ccu-sun8i-a83t.c | 2 +- drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 2 +- drivers/clk/sunxi-ng/ccu-sun8i-h3.c | 2 +- drivers/clk/sunxi-ng/ccu-sun8i-r.c | 2 +- drivers/clk/sunxi-ng/ccu-sun8i-r40.c | 2 +- drivers/clk/sunxi-ng/ccu-sun8i-v3s.c | 2 +- drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c | 3 +- drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c | 3 +- drivers/clk/sunxi-ng/ccu-sun9i-a80.c | 2 +- drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c | 2 +- drivers/clk/sunxi-ng/ccu_common.c | 89 ++++++++++++++++++++---- drivers/clk/sunxi-ng/ccu_common.h | 6 +- 23 files changed, 100 insertions(+), 41 deletions(-) diff --git a/drivers/clk/sunxi-ng/ccu-sun4i-a10.c b/drivers/clk/sunxi-ng/ccu-sun4i-a10.c index f32366d9336e..bd9a8782fec3 100644 --- a/drivers/clk/sunxi-ng/ccu-sun4i-a10.c +++ b/drivers/clk/sunxi-ng/ccu-sun4i-a10.c @@ -1464,7 +1464,7 @@ static void __init sun4i_ccu_init(struct device_node *node, val &= ~GENMASK(7, 6); writel(val | (2 << 6), reg + SUN4I_AHB_REG); - sunxi_ccu_probe(node, reg, desc); + of_sunxi_ccu_probe(node, reg, desc); } static void __init sun4i_a10_ccu_setup(struct device_node *node) diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c b/drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c index a56142b90993..6f2a58970556 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c @@ -196,7 +196,7 @@ static int sun50i_a100_r_ccu_probe(struct platform_device *pdev) if (IS_ERR(reg)) return PTR_ERR(reg); - return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_a100_r_ccu_desc); + return devm_sunxi_ccu_probe(&pdev->dev, reg, &sun50i_a100_r_ccu_desc); } static const struct of_device_id sun50i_a100_r_ccu_ids[] = { diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a100.c b/drivers/clk/sunxi-ng/ccu-sun50i-a100.c index 81b48c73d389..913bb08e6dee 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-a100.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a100.c @@ -1247,7 +1247,7 @@ static int sun50i_a100_ccu_probe(struct platform_device *pdev) writel(val, reg + sun50i_a100_usb2_clk_regs[i]); } - ret = sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_a100_ccu_desc); + ret = devm_sunxi_ccu_probe(&pdev->dev, reg, &sun50i_a100_ccu_desc); if (ret) return ret; diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c index 149cfde817cb..54f25c624f02 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c @@ -955,7 +955,7 @@ static int sun50i_a64_ccu_probe(struct platform_device *pdev) writel(0x515, reg + SUN50I_A64_PLL_MIPI_REG); - ret = sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_a64_ccu_desc); + ret = devm_sunxi_ccu_probe(&pdev->dev, reg, &sun50i_a64_ccu_desc); if (ret) return ret; diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c index f8909a7ed553..f30d7eb5424d 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c @@ -232,7 +232,7 @@ static void __init sunxi_r_ccu_init(struct device_node *node, return; } - sunxi_ccu_probe(node, reg, desc); + of_sunxi_ccu_probe(node, reg, desc); } static void __init sun50i_h6_r_ccu_setup(struct device_node *node) diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c index bff446b78290..c0800da2fa3d 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c @@ -1240,7 +1240,7 @@ static int sun50i_h6_ccu_probe(struct platform_device *pdev) val |= BIT(24); writel(val, reg + SUN50I_H6_HDMI_CEC_CLK_REG); - return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_h6_ccu_desc); + return devm_sunxi_ccu_probe(&pdev->dev, reg, &sun50i_h6_ccu_desc); } static const struct of_device_id sun50i_h6_ccu_ids[] = { diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h616.c b/drivers/clk/sunxi-ng/ccu-sun50i-h616.c index 225307305880..22eb18079a15 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-h616.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-h616.c @@ -1141,9 +1141,7 @@ static void __init sun50i_h616_ccu_setup(struct device_node *node) val |= BIT(24); writel(val, reg + SUN50I_H616_HDMI_CEC_CLK_REG); - i = sunxi_ccu_probe(node, reg, &sun50i_h616_ccu_desc); - if (i) - pr_err("%pOF: probing clocks fails: %d\n", node, i); + of_sunxi_ccu_probe(node, reg, &sun50i_h616_ccu_desc); } CLK_OF_DECLARE(sun50i_h616_ccu, "allwinner,sun50i-h616-ccu", diff --git a/drivers/clk/sunxi-ng/ccu-sun5i.c b/drivers/clk/sunxi-ng/ccu-sun5i.c index b78e9b507c1c..1f4bc0e773a7 100644 --- a/drivers/clk/sunxi-ng/ccu-sun5i.c +++ b/drivers/clk/sunxi-ng/ccu-sun5i.c @@ -1012,7 +1012,7 @@ static void __init sun5i_ccu_init(struct device_node *node, val &= ~GENMASK(7, 6); writel(val | (2 << 6), reg + SUN5I_AHB_REG); - sunxi_ccu_probe(node, reg, desc); + of_sunxi_ccu_probe(node, reg, desc); } static void __init sun5i_a10s_ccu_setup(struct device_node *node) diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c index 9b40d53266a3..3df5c0b41580 100644 --- a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c +++ b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c @@ -1257,7 +1257,7 @@ static void __init sun6i_a31_ccu_setup(struct device_node *node) val |= 0x3 << 12; writel(val, reg + SUN6I_A31_AHB1_REG); - sunxi_ccu_probe(node, reg, &sun6i_a31_ccu_desc); + of_sunxi_ccu_probe(node, reg, &sun6i_a31_ccu_desc); ccu_mux_notifier_register(pll_cpu_clk.common.hw.clk, &sun6i_a31_cpu_nb); diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a23.c b/drivers/clk/sunxi-ng/ccu-sun8i-a23.c index 103aa504f6c8..577bb235d658 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-a23.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-a23.c @@ -745,7 +745,7 @@ static void __init sun8i_a23_ccu_setup(struct device_node *node) val &= ~BIT(16); writel(val, reg + SUN8I_A23_PLL_MIPI_REG); - sunxi_ccu_probe(node, reg, &sun8i_a23_ccu_desc); + of_sunxi_ccu_probe(node, reg, &sun8i_a23_ccu_desc); } CLK_OF_DECLARE(sun8i_a23_ccu, "allwinner,sun8i-a23-ccu", sun8i_a23_ccu_setup); diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c b/drivers/clk/sunxi-ng/ccu-sun8i-a33.c index 91838cd11037..8f65cd03f5ac 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-a33.c @@ -805,7 +805,7 @@ static void __init sun8i_a33_ccu_setup(struct device_node *node) val &= ~BIT(16); writel(val, reg + SUN8I_A33_PLL_MIPI_REG); - sunxi_ccu_probe(node, reg, &sun8i_a33_ccu_desc); + of_sunxi_ccu_probe(node, reg, &sun8i_a33_ccu_desc); /* Gate then ungate PLL CPU after any rate changes */ ccu_pll_notifier_register(&sun8i_a33_pll_cpu_nb); diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c b/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c index 2b434521c5cc..c2ddcd2ddab4 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c @@ -906,7 +906,7 @@ static int sun8i_a83t_ccu_probe(struct platform_device *pdev) sun8i_a83t_cpu_pll_fixup(reg + SUN8I_A83T_PLL_C0CPUX_REG); sun8i_a83t_cpu_pll_fixup(reg + SUN8I_A83T_PLL_C1CPUX_REG); - return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun8i_a83t_ccu_desc); + return devm_sunxi_ccu_probe(&pdev->dev, reg, &sun8i_a83t_ccu_desc); } static const struct of_device_id sun8i_a83t_ccu_ids[] = { diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c index 524f33275bc7..4b94b6041b27 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c @@ -342,7 +342,7 @@ static int sunxi_de2_clk_probe(struct platform_device *pdev) goto err_disable_mod_clk; } - ret = sunxi_ccu_probe(pdev->dev.of_node, reg, ccu_desc); + ret = devm_sunxi_ccu_probe(&pdev->dev, reg, ccu_desc); if (ret) goto err_assert_reset; diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c index 7e629a4493af..d2fc2903787d 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c @@ -1154,7 +1154,7 @@ static void __init sunxi_h3_h5_ccu_init(struct device_node *node, val &= ~GENMASK(19, 16); writel(val | (0 << 16), reg + SUN8I_H3_PLL_AUDIO_REG); - sunxi_ccu_probe(node, reg, desc); + of_sunxi_ccu_probe(node, reg, desc); /* Gate then ungate PLL CPU after any rate changes */ ccu_pll_notifier_register(&sun8i_h3_pll_cpu_nb); diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-r.c b/drivers/clk/sunxi-ng/ccu-sun8i-r.c index 4c8c491b87c2..9e754d1f754a 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-r.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-r.c @@ -265,7 +265,7 @@ static void __init sunxi_r_ccu_init(struct device_node *node, return; } - sunxi_ccu_probe(node, reg, desc); + of_sunxi_ccu_probe(node, reg, desc); } static void __init sun8i_a83t_r_ccu_setup(struct device_node *node) diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-r40.c b/drivers/clk/sunxi-ng/ccu-sun8i-r40.c index 84153418453f..002e0c3a04db 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-r40.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-r40.c @@ -1346,7 +1346,7 @@ static int sun8i_r40_ccu_probe(struct platform_device *pdev) if (IS_ERR(regmap)) return PTR_ERR(regmap); - ret = sunxi_ccu_probe(pdev->dev.of_node, reg, &sun8i_r40_ccu_desc); + ret = devm_sunxi_ccu_probe(&pdev->dev, reg, &sun8i_r40_ccu_desc); if (ret) return ret; diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c index f49724a22540..ce150f83ab54 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c @@ -822,7 +822,7 @@ static void __init sun8i_v3_v3s_ccu_init(struct device_node *node, val &= ~GENMASK(19, 16); writel(val, reg + SUN8I_V3S_PLL_AUDIO_REG); - sunxi_ccu_probe(node, reg, ccu_desc); + of_sunxi_ccu_probe(node, reg, ccu_desc); } static void __init sun8i_v3s_ccu_setup(struct device_node *node) diff --git a/drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c b/drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c index 6616e8114f62..261e64416f26 100644 --- a/drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c +++ b/drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c @@ -246,8 +246,7 @@ static int sun9i_a80_de_clk_probe(struct platform_device *pdev) goto err_disable_clk; } - ret = sunxi_ccu_probe(pdev->dev.of_node, reg, - &sun9i_a80_de_clk_desc); + ret = devm_sunxi_ccu_probe(&pdev->dev, reg, &sun9i_a80_de_clk_desc); if (ret) goto err_assert_reset; diff --git a/drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c b/drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c index 4b4a507d04ed..596243b3e0fa 100644 --- a/drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c +++ b/drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c @@ -117,8 +117,7 @@ static int sun9i_a80_usb_clk_probe(struct platform_device *pdev) return ret; } - ret = sunxi_ccu_probe(pdev->dev.of_node, reg, - &sun9i_a80_usb_clk_desc); + ret = devm_sunxi_ccu_probe(&pdev->dev, reg, &sun9i_a80_usb_clk_desc); if (ret) goto err_disable_clk; diff --git a/drivers/clk/sunxi-ng/ccu-sun9i-a80.c b/drivers/clk/sunxi-ng/ccu-sun9i-a80.c index ef29582676f6..97aaed0e6850 100644 --- a/drivers/clk/sunxi-ng/ccu-sun9i-a80.c +++ b/drivers/clk/sunxi-ng/ccu-sun9i-a80.c @@ -1231,7 +1231,7 @@ static int sun9i_a80_ccu_probe(struct platform_device *pdev) sun9i_a80_cpu_pll_fixup(reg + SUN9I_A80_PLL_C0CPUX_REG); sun9i_a80_cpu_pll_fixup(reg + SUN9I_A80_PLL_C1CPUX_REG); - return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun9i_a80_ccu_desc); + return devm_sunxi_ccu_probe(&pdev->dev, reg, &sun9i_a80_ccu_desc); } static const struct of_device_id sun9i_a80_ccu_ids[] = { diff --git a/drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c b/drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c index 7ecc3a5a5b5e..61ad7ee91c11 100644 --- a/drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c +++ b/drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c @@ -538,7 +538,7 @@ static void __init suniv_f1c100s_ccu_setup(struct device_node *node) val &= ~GENMASK(19, 16); writel(val | (3 << 16), reg + SUNIV_PLL_AUDIO_REG); - sunxi_ccu_probe(node, reg, &suniv_ccu_desc); + of_sunxi_ccu_probe(node, reg, &suniv_ccu_desc); /* Gate then ungate PLL CPU after any rate changes */ ccu_pll_notifier_register(&suniv_pll_cpu_nb); diff --git a/drivers/clk/sunxi-ng/ccu_common.c b/drivers/clk/sunxi-ng/ccu_common.c index 2e20e650b6c0..88cb569e5835 100644 --- a/drivers/clk/sunxi-ng/ccu_common.c +++ b/drivers/clk/sunxi-ng/ccu_common.c @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -14,6 +15,11 @@ #include "ccu_gate.h" #include "ccu_reset.h" +struct sunxi_ccu { + const struct sunxi_ccu_desc *desc; + struct ccu_reset reset; +}; + static DEFINE_SPINLOCK(ccu_lock); void ccu_helper_wait_for_lock(struct ccu_common *common, u32 lock) @@ -79,12 +85,15 @@ int ccu_pll_notifier_register(struct ccu_pll_nb *pll_nb) &pll_nb->clk_nb); } -int sunxi_ccu_probe(struct device_node *node, void __iomem *reg, - const struct sunxi_ccu_desc *desc) +static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev, + struct device_node *node, void __iomem *reg, + const struct sunxi_ccu_desc *desc) { struct ccu_reset *reset; int i, ret; + ccu->desc = desc; + for (i = 0; i < desc->num_ccu_clks; i++) { struct ccu_common *cclk = desc->ccu_clks[i]; @@ -103,7 +112,10 @@ int sunxi_ccu_probe(struct device_node *node, void __iomem *reg, continue; name = hw->init->name; - ret = of_clk_hw_register(node, hw); + if (dev) + ret = clk_hw_register(dev, hw); + else + ret = of_clk_hw_register(node, hw); if (ret) { pr_err("Couldn't register clock %d - %s\n", i, name); goto err_clk_unreg; @@ -115,15 +127,10 @@ int sunxi_ccu_probe(struct device_node *node, void __iomem *reg, if (ret) goto err_clk_unreg; - reset = kzalloc(sizeof(*reset), GFP_KERNEL); - if (!reset) { - ret = -ENOMEM; - goto err_alloc_reset; - } - + reset = &ccu->reset; reset->rcdev.of_node = node; reset->rcdev.ops = &ccu_reset_ops; - reset->rcdev.owner = THIS_MODULE; + reset->rcdev.owner = dev ? dev->driver->owner : THIS_MODULE; reset->rcdev.nr_resets = desc->num_resets; reset->base = reg; reset->lock = &ccu_lock; @@ -131,13 +138,11 @@ int sunxi_ccu_probe(struct device_node *node, void __iomem *reg, ret = reset_controller_register(&reset->rcdev); if (ret) - goto err_of_clk_unreg; + goto err_del_provider; return 0; -err_of_clk_unreg: - kfree(reset); -err_alloc_reset: +err_del_provider: of_clk_del_provider(node); err_clk_unreg: while (--i >= 0) { @@ -149,3 +154,59 @@ int sunxi_ccu_probe(struct device_node *node, void __iomem *reg, } return ret; } + +static void devm_sunxi_ccu_release(struct device *dev, void *res) +{ + struct sunxi_ccu *ccu = res; + const struct sunxi_ccu_desc *desc = ccu->desc; + int i; + + reset_controller_unregister(&ccu->reset.rcdev); + of_clk_del_provider(dev->of_node); + + for (i = 0; i < desc->hw_clks->num; i++) { + struct clk_hw *hw = desc->hw_clks->hws[i]; + + if (!hw) + continue; + clk_hw_unregister(hw); + } +} + +int devm_sunxi_ccu_probe(struct device *dev, void __iomem *reg, + const struct sunxi_ccu_desc *desc) +{ + struct sunxi_ccu *ccu; + int ret; + + ccu = devres_alloc(devm_sunxi_ccu_release, sizeof(*ccu), GFP_KERNEL); + if (!ccu) + return -ENOMEM; + + ret = sunxi_ccu_probe(ccu, dev, dev->of_node, reg, desc); + if (ret) { + devres_free(ccu); + return ret; + } + + devres_add(dev, ccu); + + return 0; +} + +void of_sunxi_ccu_probe(struct device_node *node, void __iomem *reg, + const struct sunxi_ccu_desc *desc) +{ + struct sunxi_ccu *ccu; + int ret; + + ccu = kzalloc(sizeof(*ccu), GFP_KERNEL); + if (!ccu) + return; + + ret = sunxi_ccu_probe(ccu, NULL, node, reg, desc); + if (ret) { + pr_err("%pOF: probing clocks failed: %d\n", node, ret); + kfree(ccu); + } +} diff --git a/drivers/clk/sunxi-ng/ccu_common.h b/drivers/clk/sunxi-ng/ccu_common.h index 04e7a12200a2..98a1834b58bb 100644 --- a/drivers/clk/sunxi-ng/ccu_common.h +++ b/drivers/clk/sunxi-ng/ccu_common.h @@ -63,7 +63,9 @@ struct ccu_pll_nb { int ccu_pll_notifier_register(struct ccu_pll_nb *pll_nb); -int sunxi_ccu_probe(struct device_node *node, void __iomem *reg, - const struct sunxi_ccu_desc *desc); +int devm_sunxi_ccu_probe(struct device *dev, void __iomem *reg, + const struct sunxi_ccu_desc *desc); +void of_sunxi_ccu_probe(struct device_node *node, void __iomem *reg, + const struct sunxi_ccu_desc *desc); #endif /* _COMMON_H_ */ From patchwork Wed Sep 1 05:05:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12468279 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27282C43214 for ; Wed, 1 Sep 2021 05:05:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0B44D61057 for ; Wed, 1 Sep 2021 05:05:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241924AbhIAFGb (ORCPT ); Wed, 1 Sep 2021 01:06:31 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:58787 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241918AbhIAFG3 (ORCPT ); Wed, 1 Sep 2021 01:06:29 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 8E88D5C01D4; Wed, 1 Sep 2021 01:05:32 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 01 Sep 2021 01:05:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=g/tkXc9ZH7xFT 64/AUCsHAFuJBmoKdWUnX2oc1IWSEE=; b=lfCJ5gu9uxsGTso75OC8PrFgijee6 KFOaDk3W13NKcBm3cjZYkbQsi9xsqH/sSPVALuIPLb+5JlHPp6T5vKCdnKC6+LDL lgy/kpmJxJahCvO6Mpbc8s0k9kWtFckRDe2ev7T3Q7FXK3Pt1uTUx5kZdSNwIFNL 82CyCWBPmo4kkyvF7yuBPfHMcKp2o1QUWVBdIi2zu+Ya2HgBmRE7eW5d5eln1q9Y LYMfSUUifdyTT3ZsmePoXYboopQGSK/5LB+3WY6znIgP/cBJ3cPTi3gDU7+BiD07 lzpbhzYtUHa9IU96Q/5d4DnUb7lLbJ6E3JTeaAO8lhXfcFUCqN1wJ/ytA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=g/tkXc9ZH7xFT64/AUCsHAFuJBmoKdWUnX2oc1IWSEE=; b=EX/xpIzE rrpwqlv88W+Tmx7zqhj5cWuJaWvqDdLICVFsqFyMebcfNAeKUcdxWQ+kimz8aYC1 J0PFxgDqRbxBLtTq9EeDa3AxdI+rA+fEJXJCWmgfdJGi2rigvngfqdBg/Jt544H9 Cj/TSV7Ljare0c0P1RNe+HOkAQsuZhRaf0rR6uNl82HmgY6CZvEc8NTVYOd+a6Gv IQz9TdY53wJ8VEEK7/yCyzWcsyt330fxvzGHTI5kAfG6ONGHjLmvwS4VFzDqh6QB TEYOLkHnW3z2lDS68d5VAuq9jpoD7DYgIz/56MDENH3zgvs/ZPxldmf2rdZnCQvY Rc6mf2GBnV8gxw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvvddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Sep 2021 01:05:32 -0400 (EDT) From: Samuel Holland To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Michael Turquette , Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Samuel Holland Subject: [PATCH 2/8] clk: sunxi-ng: Prevent unbinding CCUs via sysfs Date: Wed, 1 Sep 2021 00:05:20 -0500 Message-Id: <20210901050526.45673-3-samuel@sholland.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210901050526.45673-1-samuel@sholland.org> References: <20210901050526.45673-1-samuel@sholland.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org The CCU drivers are not really designed to be unbound. Unbinding a SoC's main CCU is especially pointless, as very few of the peripherals on the SoC will work without it. Let's avoid any potential problems by removing the bind/unbind attributes from sysfs for these drivers. This change is not applied to the "secondary" CCUs (DE, USB) as those could reasonably be unbound without making the system useless. Signed-off-by: Samuel Holland --- drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c | 1 + drivers/clk/sunxi-ng/ccu-sun50i-a100.c | 1 + drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 1 + drivers/clk/sunxi-ng/ccu-sun50i-h6.c | 1 + drivers/clk/sunxi-ng/ccu-sun8i-a83t.c | 1 + drivers/clk/sunxi-ng/ccu-sun8i-r40.c | 1 + drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c | 1 + drivers/clk/sunxi-ng/ccu-sun9i-a80.c | 1 + 8 files changed, 8 insertions(+) diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c b/drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c index 6f2a58970556..804729e0a208 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c @@ -208,6 +208,7 @@ static struct platform_driver sun50i_a100_r_ccu_driver = { .probe = sun50i_a100_r_ccu_probe, .driver = { .name = "sun50i-a100-r-ccu", + .suppress_bind_attrs = true, .of_match_table = sun50i_a100_r_ccu_ids, }, }; diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a100.c b/drivers/clk/sunxi-ng/ccu-sun50i-a100.c index 913bb08e6dee..1d475d5a3d91 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-a100.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a100.c @@ -1270,6 +1270,7 @@ static struct platform_driver sun50i_a100_ccu_driver = { .probe = sun50i_a100_ccu_probe, .driver = { .name = "sun50i-a100-ccu", + .suppress_bind_attrs = true, .of_match_table = sun50i_a100_ccu_ids, }, }; diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c index 54f25c624f02..fcbd914e84e0 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c @@ -978,6 +978,7 @@ static struct platform_driver sun50i_a64_ccu_driver = { .probe = sun50i_a64_ccu_probe, .driver = { .name = "sun50i-a64-ccu", + .suppress_bind_attrs = true, .of_match_table = sun50i_a64_ccu_ids, }, }; diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c index c0800da2fa3d..9a8902f702c5 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c @@ -1252,6 +1252,7 @@ static struct platform_driver sun50i_h6_ccu_driver = { .probe = sun50i_h6_ccu_probe, .driver = { .name = "sun50i-h6-ccu", + .suppress_bind_attrs = true, .of_match_table = sun50i_h6_ccu_ids, }, }; diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c b/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c index c2ddcd2ddab4..e663ab0c9935 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c @@ -918,6 +918,7 @@ static struct platform_driver sun8i_a83t_ccu_driver = { .probe = sun8i_a83t_ccu_probe, .driver = { .name = "sun8i-a83t-ccu", + .suppress_bind_attrs = true, .of_match_table = sun8i_a83t_ccu_ids, }, }; diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-r40.c b/drivers/clk/sunxi-ng/ccu-sun8i-r40.c index 002e0c3a04db..a2144ee728a0 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-r40.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-r40.c @@ -1369,6 +1369,7 @@ static struct platform_driver sun8i_r40_ccu_driver = { .probe = sun8i_r40_ccu_probe, .driver = { .name = "sun8i-r40-ccu", + .suppress_bind_attrs = true, .of_match_table = sun8i_r40_ccu_ids, }, }; diff --git a/drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c b/drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c index 261e64416f26..d2072972b614 100644 --- a/drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c +++ b/drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c @@ -268,6 +268,7 @@ static struct platform_driver sun9i_a80_de_clk_driver = { .probe = sun9i_a80_de_clk_probe, .driver = { .name = "sun9i-a80-de-clks", + .suppress_bind_attrs = true, .of_match_table = sun9i_a80_de_clk_ids, }, }; diff --git a/drivers/clk/sunxi-ng/ccu-sun9i-a80.c b/drivers/clk/sunxi-ng/ccu-sun9i-a80.c index 97aaed0e6850..68b30fdc60fd 100644 --- a/drivers/clk/sunxi-ng/ccu-sun9i-a80.c +++ b/drivers/clk/sunxi-ng/ccu-sun9i-a80.c @@ -1243,6 +1243,7 @@ static struct platform_driver sun9i_a80_ccu_driver = { .probe = sun9i_a80_ccu_probe, .driver = { .name = "sun9i-a80-ccu", + .suppress_bind_attrs = true, .of_match_table = sun9i_a80_ccu_ids, }, }; From patchwork Wed Sep 1 05:05:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12468281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 546DDC4320E for ; Wed, 1 Sep 2021 05:05:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3FD9B61090 for ; Wed, 1 Sep 2021 05:05:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241930AbhIAFGc (ORCPT ); Wed, 1 Sep 2021 01:06:32 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:60825 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241867AbhIAFGa (ORCPT ); Wed, 1 Sep 2021 01:06:30 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 2E41A5C01D8; Wed, 1 Sep 2021 01:05:34 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 01 Sep 2021 01:05:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=++HrPlGZ+qukq dajcrSz33+ED++t/T63RI31aUteFu8=; b=iJfcDUPrzdASsyU/bPixM0kQE82Jf Yx4xrZkcCN+FqOl6YdkO+TUu6jF9RUCjJZkQFIMAyWXH+vxPMObuiRQG16bGilcI JEIOVgDtEoGBnrX835cSlUzBNnnxe9PEavVS5cxN2l0C0RP+oGnZ/VSd9RIgPShW HPaPH4D2sVyM0TyGQqxML+XKWYwV8STP2H0sd2rThH2XMBD06XZese5CDh3wjytL cF4kB6GsflfY7saDQILjZr5gD2wnuspV5ANQYJQ72UyuRSFtLsr4pKQrzNxZWrb0 W4K3j16+2PiApWELwJL9LQVsvexp0aWR/z5bjIXQ/CSDx3MzZbwvzfUiA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=++HrPlGZ+qukqdajcrSz33+ED++t/T63RI31aUteFu8=; b=s4ulmAgg AEWKMaJuI7TreqcAv29aYi6Os4a/9QEgNmEDlcqptVmvRF16Tb/+zLI4V/lcM9FI w8mPwqpObiQfU0bbTPUkZZdUyRzh1VCWGkGWrODBH+KhAx98uc57yrjRs+OBZ0E/ 4z1qIHGOLvmI8L9fBzD7Zn3jzi+dOcHzCg+2yQmLZw3ROmdInGENb1XVCUTf6ZEv DXpYdzozrK/qlvT3Z/kZdJdYvELCGvm8aOi5ewHxNaHn0VAXfDPPTwtIwaXtbp4t VbfJnvJynB9IBKovUbBbtFrs3suufdw9pI+N9yPrJhwl56Iao65QYPbg8YNd22MH lbpdZd5DOuM8Jg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvvddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Sep 2021 01:05:32 -0400 (EDT) From: Samuel Holland To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Michael Turquette , Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Samuel Holland Subject: [PATCH 3/8] clk: sunxi-ng: Use a separate lock for each CCU instance Date: Wed, 1 Sep 2021 00:05:21 -0500 Message-Id: <20210901050526.45673-4-samuel@sholland.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210901050526.45673-1-samuel@sholland.org> References: <20210901050526.45673-1-samuel@sholland.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Some platforms have more than one CCU driver loaded: the main CCU, the PRCM, the display engine, and possibly others. All of these hardware blocks have separate MMIO spaces, so there is no need to synchronize between them. Signed-off-by: Samuel Holland --- drivers/clk/sunxi-ng/ccu_common.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/clk/sunxi-ng/ccu_common.c b/drivers/clk/sunxi-ng/ccu_common.c index 88cb569e5835..31af8b6b5286 100644 --- a/drivers/clk/sunxi-ng/ccu_common.c +++ b/drivers/clk/sunxi-ng/ccu_common.c @@ -17,11 +17,10 @@ struct sunxi_ccu { const struct sunxi_ccu_desc *desc; + spinlock_t lock; struct ccu_reset reset; }; -static DEFINE_SPINLOCK(ccu_lock); - void ccu_helper_wait_for_lock(struct ccu_common *common, u32 lock) { void __iomem *addr; @@ -94,6 +93,8 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev, ccu->desc = desc; + spin_lock_init(&ccu->lock); + for (i = 0; i < desc->num_ccu_clks; i++) { struct ccu_common *cclk = desc->ccu_clks[i]; @@ -101,7 +102,7 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev, continue; cclk->base = reg; - cclk->lock = &ccu_lock; + cclk->lock = &ccu->lock; } for (i = 0; i < desc->hw_clks->num ; i++) { @@ -133,7 +134,7 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev, reset->rcdev.owner = dev ? dev->driver->owner : THIS_MODULE; reset->rcdev.nr_resets = desc->num_resets; reset->base = reg; - reset->lock = &ccu_lock; + reset->lock = &ccu->lock; reset->reset_map = desc->resets; ret = reset_controller_register(&reset->rcdev); From patchwork Wed Sep 1 05:05:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12468283 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15892C4320E for ; Wed, 1 Sep 2021 05:05:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E42FC61059 for ; Wed, 1 Sep 2021 05:05:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241950AbhIAFGh (ORCPT ); Wed, 1 Sep 2021 01:06:37 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:45759 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241903AbhIAFGb (ORCPT ); Wed, 1 Sep 2021 01:06:31 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id C01AC5C0091; Wed, 1 Sep 2021 01:05:34 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 01 Sep 2021 01:05:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=1bTOo28Yws7Mc dNdX79AXy9UPylytP12nPD51NYQywQ=; b=pmlLt1UCyVAuqtAjsgWEHGcGNId98 qwYyuQwe86vQ0wJFAN7s9SE3EvNMwcd+SAnU0mxf5sDaH5r+XYeWeNJeTuaY47uk 2vPnjWg3hU611meAiBFtXUY0QKItbfk7g0donVgKf8tcV+pmiVFn49rF1DWxrzCQ IpglQymmJ1DG7iT17AbCJjQlwTg4bpygwikT8abakJyqbbK2J/YQlzLXy/DmAhoj V7skZMBmk09yINkmqQB+QVDxZicPSxQPKYOBiVkC3QMRPXdb5qzYwr3V18ATrG0e Jv9hstvvmloE0BHBAediI3Ypsen1jaDP6mkSzWBIdHdH3Zsq01tIJdl4g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=1bTOo28Yws7McdNdX79AXy9UPylytP12nPD51NYQywQ=; b=s0qunCvg 756zV/p+xoKEaMwEK9MDruCHKNYz7jDX8JedE957rGITDPRNX5EX8rnyLfv00atM pGvO03KSfJAjsZ3hTSG12YzRwZQfkn1kiesERFAg+eU7ecZEgA271r7iSKa06+JY YudD7qLOFIxij02k6Rz2T7sXuENQFyidEFSL8F5u4d3RM17rebgNh2+47EAAHgSi 6uWEQjkCDDITAMkznV1FYTEDs3XF+h15Tph4E98Ly3GO4CEBzMGT4JL/3v1srmRR 1ZfbtbutObUro9cyXnexTDKojNuO/nKmompnl+X/Nz+arF76ycpkGjbvTWB7jFcD 3sm71eiJFR/g/g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvvddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Sep 2021 01:05:34 -0400 (EDT) From: Samuel Holland To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Michael Turquette , Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Samuel Holland Subject: [PATCH 4/8] clk: sunxi-ng: Rename files to match Kconfig and drivers Date: Wed, 1 Sep 2021 00:05:22 -0500 Message-Id: <20210901050526.45673-5-samuel@sholland.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210901050526.45673-1-samuel@sholland.org> References: <20210901050526.45673-1-samuel@sholland.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org When the drivers are built as modules, the file name will become the module name. Rename the files so everything matches: the Kconfig symbol, the platform driver name (as seen in sysfs), and the module name. Signed-off-by: Samuel Holland --- drivers/clk/sunxi-ng/Makefile | 42 +++++++++---------- .../{ccu-sun4i-a10.c => sun4i-a10-ccu.c} | 2 +- .../{ccu-sun4i-a10.h => sun4i-a10-ccu.h} | 0 .../{ccu-sun50i-a100.c => sun50i-a100-ccu.c} | 2 +- .../{ccu-sun50i-a100.h => sun50i-a100-ccu.h} | 0 ...cu-sun50i-a100-r.c => sun50i-a100-r-ccu.c} | 2 +- ...cu-sun50i-a100-r.h => sun50i-a100-r-ccu.h} | 0 .../{ccu-sun50i-a64.c => sun50i-a64-ccu.c} | 2 +- .../{ccu-sun50i-a64.h => sun50i-a64-ccu.h} | 0 .../{ccu-sun50i-h6.c => sun50i-h6-ccu.c} | 2 +- .../{ccu-sun50i-h6.h => sun50i-h6-ccu.h} | 0 .../{ccu-sun50i-h6-r.c => sun50i-h6-r-ccu.c} | 2 +- .../{ccu-sun50i-h6-r.h => sun50i-h6-r-ccu.h} | 0 .../{ccu-sun50i-h616.c => sun50i-h616-ccu.c} | 2 +- .../{ccu-sun50i-h616.h => sun50i-h616-ccu.h} | 0 .../clk/sunxi-ng/{ccu-sun5i.c => sun5i-ccu.c} | 2 +- .../clk/sunxi-ng/{ccu-sun5i.h => sun5i-ccu.h} | 0 .../{ccu-sun6i-a31.c => sun6i-a31-ccu.c} | 2 +- .../{ccu-sun6i-a31.h => sun6i-a31-ccu.h} | 0 ...cu-sun8i-a23-a33.h => sun8i-a23-a33-ccu.h} | 0 .../{ccu-sun8i-a23.c => sun8i-a23-ccu.c} | 2 +- .../{ccu-sun8i-a33.c => sun8i-a33-ccu.c} | 2 +- .../{ccu-sun8i-a83t.c => sun8i-a83t-ccu.c} | 2 +- .../{ccu-sun8i-a83t.h => sun8i-a83t-ccu.h} | 0 .../{ccu-sun8i-de2.c => sun8i-de2-ccu.c} | 2 +- .../{ccu-sun8i-de2.h => sun8i-de2-ccu.h} | 0 .../{ccu-sun8i-h3.c => sun8i-h3-ccu.c} | 2 +- .../{ccu-sun8i-h3.h => sun8i-h3-ccu.h} | 0 .../sunxi-ng/{ccu-sun8i-r.c => sun8i-r-ccu.c} | 2 +- .../sunxi-ng/{ccu-sun8i-r.h => sun8i-r-ccu.h} | 0 .../{ccu-sun8i-r40.c => sun8i-r40-ccu.c} | 2 +- .../{ccu-sun8i-r40.h => sun8i-r40-ccu.h} | 0 .../{ccu-sun8i-v3s.c => sun8i-v3s-ccu.c} | 2 +- .../{ccu-sun8i-v3s.h => sun8i-v3s-ccu.h} | 0 .../{ccu-sun9i-a80.c => sun9i-a80-ccu.c} | 2 +- .../{ccu-sun9i-a80.h => sun9i-a80-ccu.h} | 0 ...{ccu-sun9i-a80-de.c => sun9i-a80-de-ccu.c} | 2 +- ...{ccu-sun9i-a80-de.h => sun9i-a80-de-ccu.h} | 0 ...cu-sun9i-a80-usb.c => sun9i-a80-usb-ccu.c} | 2 +- ...cu-sun9i-a80-usb.h => sun9i-a80-usb-ccu.h} | 0 ...cu-suniv-f1c100s.c => suniv-f1c100s-ccu.c} | 2 +- ...cu-suniv-f1c100s.h => suniv-f1c100s-ccu.h} | 0 42 files changed, 42 insertions(+), 42 deletions(-) rename drivers/clk/sunxi-ng/{ccu-sun4i-a10.c => sun4i-a10-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun4i-a10.h => sun4i-a10-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun50i-a100.c => sun50i-a100-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun50i-a100.h => sun50i-a100-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun50i-a100-r.c => sun50i-a100-r-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun50i-a100-r.h => sun50i-a100-r-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun50i-a64.c => sun50i-a64-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun50i-a64.h => sun50i-a64-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun50i-h6.c => sun50i-h6-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun50i-h6.h => sun50i-h6-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun50i-h6-r.c => sun50i-h6-r-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun50i-h6-r.h => sun50i-h6-r-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun50i-h616.c => sun50i-h616-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun50i-h616.h => sun50i-h616-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun5i.c => sun5i-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun5i.h => sun5i-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun6i-a31.c => sun6i-a31-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun6i-a31.h => sun6i-a31-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun8i-a23-a33.h => sun8i-a23-a33-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun8i-a23.c => sun8i-a23-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun8i-a33.c => sun8i-a33-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun8i-a83t.c => sun8i-a83t-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun8i-a83t.h => sun8i-a83t-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun8i-de2.c => sun8i-de2-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun8i-de2.h => sun8i-de2-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun8i-h3.c => sun8i-h3-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun8i-h3.h => sun8i-h3-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun8i-r.c => sun8i-r-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun8i-r.h => sun8i-r-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun8i-r40.c => sun8i-r40-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun8i-r40.h => sun8i-r40-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun8i-v3s.c => sun8i-v3s-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun8i-v3s.h => sun8i-v3s-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun9i-a80.c => sun9i-a80-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun9i-a80.h => sun9i-a80-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun9i-a80-de.c => sun9i-a80-de-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun9i-a80-de.h => sun9i-a80-de-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-sun9i-a80-usb.c => sun9i-a80-usb-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-sun9i-a80-usb.h => sun9i-a80-usb-ccu.h} (100%) rename drivers/clk/sunxi-ng/{ccu-suniv-f1c100s.c => suniv-f1c100s-ccu.c} (99%) rename drivers/clk/sunxi-ng/{ccu-suniv-f1c100s.h => suniv-f1c100s-ccu.h} (100%) diff --git a/drivers/clk/sunxi-ng/Makefile b/drivers/clk/sunxi-ng/Makefile index 96c324306d97..9ebf5920c93b 100644 --- a/drivers/clk/sunxi-ng/Makefile +++ b/drivers/clk/sunxi-ng/Makefile @@ -21,24 +21,24 @@ obj-y += ccu_nm.o obj-y += ccu_mp.o # SoC support -obj-$(CONFIG_SUNIV_F1C100S_CCU) += ccu-suniv-f1c100s.o -obj-$(CONFIG_SUN50I_A64_CCU) += ccu-sun50i-a64.o -obj-$(CONFIG_SUN50I_A100_CCU) += ccu-sun50i-a100.o -obj-$(CONFIG_SUN50I_A100_R_CCU) += ccu-sun50i-a100-r.o -obj-$(CONFIG_SUN50I_H6_CCU) += ccu-sun50i-h6.o -obj-$(CONFIG_SUN50I_H616_CCU) += ccu-sun50i-h616.o -obj-$(CONFIG_SUN50I_H6_R_CCU) += ccu-sun50i-h6-r.o -obj-$(CONFIG_SUN4I_A10_CCU) += ccu-sun4i-a10.o -obj-$(CONFIG_SUN5I_CCU) += ccu-sun5i.o -obj-$(CONFIG_SUN6I_A31_CCU) += ccu-sun6i-a31.o -obj-$(CONFIG_SUN8I_A23_CCU) += ccu-sun8i-a23.o -obj-$(CONFIG_SUN8I_A33_CCU) += ccu-sun8i-a33.o -obj-$(CONFIG_SUN8I_A83T_CCU) += ccu-sun8i-a83t.o -obj-$(CONFIG_SUN8I_H3_CCU) += ccu-sun8i-h3.o -obj-$(CONFIG_SUN8I_V3S_CCU) += ccu-sun8i-v3s.o -obj-$(CONFIG_SUN8I_DE2_CCU) += ccu-sun8i-de2.o -obj-$(CONFIG_SUN8I_R_CCU) += ccu-sun8i-r.o -obj-$(CONFIG_SUN8I_R40_CCU) += ccu-sun8i-r40.o -obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80.o -obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-de.o -obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-usb.o +obj-$(CONFIG_SUNIV_F1C100S_CCU) += suniv-f1c100s-ccu.o +obj-$(CONFIG_SUN50I_A64_CCU) += sun50i-a64-ccu.o +obj-$(CONFIG_SUN50I_A100_CCU) += sun50i-a100-ccu.o +obj-$(CONFIG_SUN50I_A100_R_CCU) += sun50i-a100-r-ccu.o +obj-$(CONFIG_SUN50I_H6_CCU) += sun50i-h6-ccu.o +obj-$(CONFIG_SUN50I_H616_CCU) += sun50i-h616-ccu.o +obj-$(CONFIG_SUN50I_H6_R_CCU) += sun50i-h6-r-ccu.o +obj-$(CONFIG_SUN4I_A10_CCU) += sun4i-a10-ccu.o +obj-$(CONFIG_SUN5I_CCU) += sun5i-ccu.o +obj-$(CONFIG_SUN6I_A31_CCU) += sun6i-a31-ccu.o +obj-$(CONFIG_SUN8I_A23_CCU) += sun8i-a23-ccu.o +obj-$(CONFIG_SUN8I_A33_CCU) += sun8i-a33-ccu.o +obj-$(CONFIG_SUN8I_A83T_CCU) += sun8i-a83t-ccu.o +obj-$(CONFIG_SUN8I_H3_CCU) += sun8i-h3-ccu.o +obj-$(CONFIG_SUN8I_V3S_CCU) += sun8i-v3s-ccu.o +obj-$(CONFIG_SUN8I_DE2_CCU) += sun8i-de2-ccu.o +obj-$(CONFIG_SUN8I_R_CCU) += sun8i-r-ccu.o +obj-$(CONFIG_SUN8I_R40_CCU) += sun8i-r40-ccu.o +obj-$(CONFIG_SUN9I_A80_CCU) += sun9i-a80-ccu.o +obj-$(CONFIG_SUN9I_A80_CCU) += sun9i-a80-de-ccu.o +obj-$(CONFIG_SUN9I_A80_CCU) += sun9i-a80-usb-ccu.o diff --git a/drivers/clk/sunxi-ng/ccu-sun4i-a10.c b/drivers/clk/sunxi-ng/sun4i-a10-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun4i-a10.c rename to drivers/clk/sunxi-ng/sun4i-a10-ccu.c index bd9a8782fec3..5d67f5666943 100644 --- a/drivers/clk/sunxi-ng/ccu-sun4i-a10.c +++ b/drivers/clk/sunxi-ng/sun4i-a10-ccu.c @@ -23,7 +23,7 @@ #include "ccu_phase.h" #include "ccu_sdm.h" -#include "ccu-sun4i-a10.h" +#include "sun4i-a10-ccu.h" static struct ccu_nkmp pll_core_clk = { .enable = BIT(31), diff --git a/drivers/clk/sunxi-ng/ccu-sun4i-a10.h b/drivers/clk/sunxi-ng/sun4i-a10-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun4i-a10.h rename to drivers/clk/sunxi-ng/sun4i-a10-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a100.c b/drivers/clk/sunxi-ng/sun50i-a100-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun50i-a100.c rename to drivers/clk/sunxi-ng/sun50i-a100-ccu.c index 1d475d5a3d91..5a813af9941c 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-a100.c +++ b/drivers/clk/sunxi-ng/sun50i-a100-ccu.c @@ -21,7 +21,7 @@ #include "ccu_nkmp.h" #include "ccu_nm.h" -#include "ccu-sun50i-a100.h" +#include "sun50i-a100-ccu.h" #define SUN50I_A100_PLL_SDM_ENABLE BIT(24) #define SUN50I_A100_PLL_OUTPUT_ENABLE BIT(27) diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a100.h b/drivers/clk/sunxi-ng/sun50i-a100-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun50i-a100.h rename to drivers/clk/sunxi-ng/sun50i-a100-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c b/drivers/clk/sunxi-ng/sun50i-a100-r-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c rename to drivers/clk/sunxi-ng/sun50i-a100-r-ccu.c index 804729e0a208..078ebdf8b093 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c +++ b/drivers/clk/sunxi-ng/sun50i-a100-r-ccu.c @@ -16,7 +16,7 @@ #include "ccu_mp.h" #include "ccu_nm.h" -#include "ccu-sun50i-a100-r.h" +#include "sun50i-a100-r-ccu.h" static const char * const cpus_r_apb2_parents[] = { "dcxo24M", "osc32k", "iosc", "pll-periph0" }; diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a100-r.h b/drivers/clk/sunxi-ng/sun50i-a100-r-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun50i-a100-r.h rename to drivers/clk/sunxi-ng/sun50i-a100-r-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/sun50i-a64-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun50i-a64.c rename to drivers/clk/sunxi-ng/sun50i-a64-ccu.c index fcbd914e84e0..ffc5ef5fab3c 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c +++ b/drivers/clk/sunxi-ng/sun50i-a64-ccu.c @@ -21,7 +21,7 @@ #include "ccu_nm.h" #include "ccu_phase.h" -#include "ccu-sun50i-a64.h" +#include "sun50i-a64-ccu.h" static struct ccu_nkmp pll_cpux_clk = { .enable = BIT(31), diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.h b/drivers/clk/sunxi-ng/sun50i-a64-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun50i-a64.h rename to drivers/clk/sunxi-ng/sun50i-a64-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c b/drivers/clk/sunxi-ng/sun50i-h6-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun50i-h6.c rename to drivers/clk/sunxi-ng/sun50i-h6-ccu.c index 9a8902f702c5..8876358710c5 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c +++ b/drivers/clk/sunxi-ng/sun50i-h6-ccu.c @@ -20,7 +20,7 @@ #include "ccu_nkmp.h" #include "ccu_nm.h" -#include "ccu-sun50i-h6.h" +#include "sun50i-h6-ccu.h" /* * The CPU PLL is actually NP clock, with P being /1, /2 or /4. However diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.h b/drivers/clk/sunxi-ng/sun50i-h6-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun50i-h6.h rename to drivers/clk/sunxi-ng/sun50i-h6-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c b/drivers/clk/sunxi-ng/sun50i-h6-r-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c rename to drivers/clk/sunxi-ng/sun50i-h6-r-ccu.c index f30d7eb5424d..bb7f9ed78c4c 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c +++ b/drivers/clk/sunxi-ng/sun50i-h6-r-ccu.c @@ -15,7 +15,7 @@ #include "ccu_mp.h" #include "ccu_nm.h" -#include "ccu-sun50i-h6-r.h" +#include "sun50i-h6-r-ccu.h" /* * Information about AR100 and AHB/APB clocks in R_CCU are gathered from diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.h b/drivers/clk/sunxi-ng/sun50i-h6-r-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun50i-h6-r.h rename to drivers/clk/sunxi-ng/sun50i-h6-r-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h616.c b/drivers/clk/sunxi-ng/sun50i-h616-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun50i-h616.c rename to drivers/clk/sunxi-ng/sun50i-h616-ccu.c index 22eb18079a15..71d75833253f 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-h616.c +++ b/drivers/clk/sunxi-ng/sun50i-h616-ccu.c @@ -22,7 +22,7 @@ #include "ccu_nkmp.h" #include "ccu_nm.h" -#include "ccu-sun50i-h616.h" +#include "sun50i-h616-ccu.h" /* * The CPU PLL is actually NP clock, with P being /1, /2 or /4. However diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h616.h b/drivers/clk/sunxi-ng/sun50i-h616-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun50i-h616.h rename to drivers/clk/sunxi-ng/sun50i-h616-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun5i.c b/drivers/clk/sunxi-ng/sun5i-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun5i.c rename to drivers/clk/sunxi-ng/sun5i-ccu.c index 1f4bc0e773a7..4763ef93319f 100644 --- a/drivers/clk/sunxi-ng/ccu-sun5i.c +++ b/drivers/clk/sunxi-ng/sun5i-ccu.c @@ -21,7 +21,7 @@ #include "ccu_phase.h" #include "ccu_sdm.h" -#include "ccu-sun5i.h" +#include "sun5i-ccu.h" static struct ccu_nkmp pll_core_clk = { .enable = BIT(31), diff --git a/drivers/clk/sunxi-ng/ccu-sun5i.h b/drivers/clk/sunxi-ng/sun5i-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun5i.h rename to drivers/clk/sunxi-ng/sun5i-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c b/drivers/clk/sunxi-ng/sun6i-a31-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun6i-a31.c rename to drivers/clk/sunxi-ng/sun6i-a31-ccu.c index 3df5c0b41580..b05c06a428ad 100644 --- a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c +++ b/drivers/clk/sunxi-ng/sun6i-a31-ccu.c @@ -26,7 +26,7 @@ #include "ccu_phase.h" #include "ccu_sdm.h" -#include "ccu-sun6i-a31.h" +#include "sun6i-a31-ccu.h" static SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_cpu_clk, "pll-cpu", "osc24M", 0x000, diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-a31.h b/drivers/clk/sunxi-ng/sun6i-a31-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun6i-a31.h rename to drivers/clk/sunxi-ng/sun6i-a31-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a23-a33.h b/drivers/clk/sunxi-ng/sun8i-a23-a33-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun8i-a23-a33.h rename to drivers/clk/sunxi-ng/sun8i-a23-a33-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a23.c b/drivers/clk/sunxi-ng/sun8i-a23-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun8i-a23.c rename to drivers/clk/sunxi-ng/sun8i-a23-ccu.c index 577bb235d658..5bbc66a762db 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-a23.c +++ b/drivers/clk/sunxi-ng/sun8i-a23-ccu.c @@ -21,7 +21,7 @@ #include "ccu_phase.h" #include "ccu_sdm.h" -#include "ccu-sun8i-a23-a33.h" +#include "sun8i-a23-a33-ccu.h" static struct ccu_nkmp pll_cpux_clk = { diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c b/drivers/clk/sunxi-ng/sun8i-a33-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun8i-a33.c rename to drivers/clk/sunxi-ng/sun8i-a33-ccu.c index 8f65cd03f5ac..6cd214b444d1 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c +++ b/drivers/clk/sunxi-ng/sun8i-a33-ccu.c @@ -20,7 +20,7 @@ #include "ccu_nm.h" #include "ccu_phase.h" -#include "ccu-sun8i-a23-a33.h" +#include "sun8i-a23-a33-ccu.h" static struct ccu_nkmp pll_cpux_clk = { .enable = BIT(31), diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c b/drivers/clk/sunxi-ng/sun8i-a83t-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun8i-a83t.c rename to drivers/clk/sunxi-ng/sun8i-a83t-ccu.c index e663ab0c9935..067eb9bb4b53 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c +++ b/drivers/clk/sunxi-ng/sun8i-a83t-ccu.c @@ -19,7 +19,7 @@ #include "ccu_nm.h" #include "ccu_phase.h" -#include "ccu-sun8i-a83t.h" +#include "sun8i-a83t-ccu.h" #define CCU_SUN8I_A83T_LOCK_REG 0x20c diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a83t.h b/drivers/clk/sunxi-ng/sun8i-a83t-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun8i-a83t.h rename to drivers/clk/sunxi-ng/sun8i-a83t-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c b/drivers/clk/sunxi-ng/sun8i-de2-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun8i-de2.c rename to drivers/clk/sunxi-ng/sun8i-de2-ccu.c index 4b94b6041b27..15d15448ac21 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c +++ b/drivers/clk/sunxi-ng/sun8i-de2-ccu.c @@ -15,7 +15,7 @@ #include "ccu_gate.h" #include "ccu_reset.h" -#include "ccu-sun8i-de2.h" +#include "sun8i-de2-ccu.h" static SUNXI_CCU_GATE(bus_mixer0_clk, "bus-mixer0", "bus-de", 0x04, BIT(0), 0); diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-de2.h b/drivers/clk/sunxi-ng/sun8i-de2-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun8i-de2.h rename to drivers/clk/sunxi-ng/sun8i-de2-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/sun8i-h3-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun8i-h3.c rename to drivers/clk/sunxi-ng/sun8i-h3-ccu.c index d2fc2903787d..c566cc1aa168 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c +++ b/drivers/clk/sunxi-ng/sun8i-h3-ccu.c @@ -21,7 +21,7 @@ #include "ccu_phase.h" #include "ccu_sdm.h" -#include "ccu-sun8i-h3.h" +#include "sun8i-h3-ccu.h" static SUNXI_CCU_NKMP_WITH_GATE_LOCK(pll_cpux_clk, "pll-cpux", "osc24M", 0x000, diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.h b/drivers/clk/sunxi-ng/sun8i-h3-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun8i-h3.h rename to drivers/clk/sunxi-ng/sun8i-h3-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-r.c b/drivers/clk/sunxi-ng/sun8i-r-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun8i-r.c rename to drivers/clk/sunxi-ng/sun8i-r-ccu.c index 9e754d1f754a..eb623b01df58 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-r.c +++ b/drivers/clk/sunxi-ng/sun8i-r-ccu.c @@ -15,7 +15,7 @@ #include "ccu_mp.h" #include "ccu_nm.h" -#include "ccu-sun8i-r.h" +#include "sun8i-r-ccu.h" static const struct clk_parent_data ar100_parents[] = { { .fw_name = "losc" }, diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-r.h b/drivers/clk/sunxi-ng/sun8i-r-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun8i-r.h rename to drivers/clk/sunxi-ng/sun8i-r-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-r40.c b/drivers/clk/sunxi-ng/sun8i-r40-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun8i-r40.c rename to drivers/clk/sunxi-ng/sun8i-r40-ccu.c index a2144ee728a0..7347b65a5051 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-r40.c +++ b/drivers/clk/sunxi-ng/sun8i-r40-ccu.c @@ -21,7 +21,7 @@ #include "ccu_nm.h" #include "ccu_phase.h" -#include "ccu-sun8i-r40.h" +#include "sun8i-r40-ccu.h" /* TODO: The result of N*K is required to be in [10, 88] range. */ static struct ccu_nkmp pll_cpu_clk = { diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-r40.h b/drivers/clk/sunxi-ng/sun8i-r40-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun8i-r40.h rename to drivers/clk/sunxi-ng/sun8i-r40-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c b/drivers/clk/sunxi-ng/sun8i-v3s-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun8i-v3s.c rename to drivers/clk/sunxi-ng/sun8i-v3s-ccu.c index ce150f83ab54..58b123ad1212 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c +++ b/drivers/clk/sunxi-ng/sun8i-v3s-ccu.c @@ -23,7 +23,7 @@ #include "ccu_nm.h" #include "ccu_phase.h" -#include "ccu-sun8i-v3s.h" +#include "sun8i-v3s-ccu.h" static SUNXI_CCU_NKMP_WITH_GATE_LOCK(pll_cpu_clk, "pll-cpu", "osc24M", 0x000, diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.h b/drivers/clk/sunxi-ng/sun8i-v3s-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun8i-v3s.h rename to drivers/clk/sunxi-ng/sun8i-v3s-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun9i-a80.c b/drivers/clk/sunxi-ng/sun9i-a80-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun9i-a80.c rename to drivers/clk/sunxi-ng/sun9i-a80-ccu.c index 68b30fdc60fd..bc0b89e18652 100644 --- a/drivers/clk/sunxi-ng/ccu-sun9i-a80.c +++ b/drivers/clk/sunxi-ng/sun9i-a80-ccu.c @@ -18,7 +18,7 @@ #include "ccu_nm.h" #include "ccu_phase.h" -#include "ccu-sun9i-a80.h" +#include "sun9i-a80-ccu.h" #define CCU_SUN9I_LOCK_REG 0x09c diff --git a/drivers/clk/sunxi-ng/ccu-sun9i-a80.h b/drivers/clk/sunxi-ng/sun9i-a80-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun9i-a80.h rename to drivers/clk/sunxi-ng/sun9i-a80-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c b/drivers/clk/sunxi-ng/sun9i-a80-de-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c rename to drivers/clk/sunxi-ng/sun9i-a80-de-ccu.c index d2072972b614..5be451411cb4 100644 --- a/drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c +++ b/drivers/clk/sunxi-ng/sun9i-a80-de-ccu.c @@ -14,7 +14,7 @@ #include "ccu_gate.h" #include "ccu_reset.h" -#include "ccu-sun9i-a80-de.h" +#include "sun9i-a80-de-ccu.h" static SUNXI_CCU_GATE(fe0_clk, "fe0", "fe0-div", 0x00, BIT(0), 0); diff --git a/drivers/clk/sunxi-ng/ccu-sun9i-a80-de.h b/drivers/clk/sunxi-ng/sun9i-a80-de-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun9i-a80-de.h rename to drivers/clk/sunxi-ng/sun9i-a80-de-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c b/drivers/clk/sunxi-ng/sun9i-a80-usb-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c rename to drivers/clk/sunxi-ng/sun9i-a80-usb-ccu.c index 596243b3e0fa..62417b6e4f74 100644 --- a/drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c +++ b/drivers/clk/sunxi-ng/sun9i-a80-usb-ccu.c @@ -12,7 +12,7 @@ #include "ccu_gate.h" #include "ccu_reset.h" -#include "ccu-sun9i-a80-usb.h" +#include "sun9i-a80-usb-ccu.h" static const struct clk_parent_data clk_parent_hosc[] = { { .fw_name = "hosc" }, diff --git a/drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.h b/drivers/clk/sunxi-ng/sun9i-a80-usb-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.h rename to drivers/clk/sunxi-ng/sun9i-a80-usb-ccu.h diff --git a/drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c b/drivers/clk/sunxi-ng/suniv-f1c100s-ccu.c similarity index 99% rename from drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c rename to drivers/clk/sunxi-ng/suniv-f1c100s-ccu.c index 61ad7ee91c11..850ab8af2471 100644 --- a/drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c +++ b/drivers/clk/sunxi-ng/suniv-f1c100s-ccu.c @@ -21,7 +21,7 @@ #include "ccu_nm.h" #include "ccu_phase.h" -#include "ccu-suniv-f1c100s.h" +#include "suniv-f1c100s-ccu.h" static struct ccu_nkmp pll_cpu_clk = { .enable = BIT(31), diff --git a/drivers/clk/sunxi-ng/ccu-suniv-f1c100s.h b/drivers/clk/sunxi-ng/suniv-f1c100s-ccu.h similarity index 100% rename from drivers/clk/sunxi-ng/ccu-suniv-f1c100s.h rename to drivers/clk/sunxi-ng/suniv-f1c100s-ccu.h From patchwork Wed Sep 1 05:05:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12468285 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AAF8C4320A for ; Wed, 1 Sep 2021 05:05:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 505D261058 for ; Wed, 1 Sep 2021 05:05:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241955AbhIAFGi (ORCPT ); Wed, 1 Sep 2021 01:06:38 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:55891 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241922AbhIAFGb (ORCPT ); Wed, 1 Sep 2021 01:06:31 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 6274B5C0192; Wed, 1 Sep 2021 01:05:35 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 01 Sep 2021 01:05:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=AnImziPhfH+l1 21jpnfIuI04ucw53R8ndu9hQhiBnb0=; b=aeCJQi987WsLL2flOmeY/HOKgl4wH v0Wl1LPzLjbtR6H82c0WV/g0dRl31DF9r1mmTnhm1JEKoTjFp6+5I6WB3a5MGdEc 46NhX1RukPhslnsnfPuYteILaEz8BDLCGzUHpOs5dFfyYD52uj3+KRRpoiIyx7xV QisfmmLw9RCCLRAykx6HVlCGrGVE3QBNylKHXjjXzsTlnlr6dnTlVYWBtp6ZMIf1 /bW7YEa++W79lm1KCNqxy4cT6aFen9fy+rDFbSp4JcmtjGRBmVNBEmS3AxHcATT1 YglxPSqjGgUyu5sMKlZqWJ/bURXs3RLra/XSv+VhFvfnpGPHPunw7SxSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=AnImziPhfH+l121jpnfIuI04ucw53R8ndu9hQhiBnb0=; b=F8HuZwH2 oPbIRD0OYsAQ7gdmzoexJZQ7NBmR/su4kcmKBp50Sc4bwTmHHBs5X7uOflvkk1GC 5/jg3kdxK3o4hgcIq6TenxPRHoyHZUAEBqNkCO+e+F2ynpc5358YILnr4SqmXgvM 2DZ98uK1WOZa9UgKnPmCHqszIbtic6AAYDQhZ6tpNzRXovxkpyQTNWRVsLh2XgvF heq3ZZ07lJak3+Rw1qFya7k/ghl0V1v5heCrzcB78AGkz9egbNl4r+NMOSXvTlot a9EqLFS+oQGvNq4dkpsYsUyylB4kRDlgnYoc8nraqQMmjN/G5cysdd6jiHG/qPSp ssJoozNbHIaxBA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvvddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Sep 2021 01:05:34 -0400 (EDT) From: Samuel Holland To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Michael Turquette , Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Samuel Holland Subject: [PATCH 5/8] clk: sunxi-ng: Export symbols used by CCU drivers Date: Wed, 1 Sep 2021 00:05:23 -0500 Message-Id: <20210901050526.45673-6-samuel@sholland.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210901050526.45673-1-samuel@sholland.org> References: <20210901050526.45673-1-samuel@sholland.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org For the individual drivers to be built as modules, the ops structs and callback registration functions must be exported. None of the helper functions are exported, because they are only referenced from the corresponding ops structs. of_sunxi_ccu_probe is not exported, because it is only used for built-in early OF clock providers. Signed-off-by: Samuel Holland --- drivers/clk/sunxi-ng/ccu_common.c | 2 ++ drivers/clk/sunxi-ng/ccu_div.c | 1 + drivers/clk/sunxi-ng/ccu_gate.c | 1 + drivers/clk/sunxi-ng/ccu_mp.c | 2 ++ drivers/clk/sunxi-ng/ccu_mult.c | 1 + drivers/clk/sunxi-ng/ccu_mux.c | 2 ++ drivers/clk/sunxi-ng/ccu_nk.c | 1 + drivers/clk/sunxi-ng/ccu_nkm.c | 1 + drivers/clk/sunxi-ng/ccu_nkmp.c | 1 + drivers/clk/sunxi-ng/ccu_nm.c | 1 + drivers/clk/sunxi-ng/ccu_phase.c | 1 + drivers/clk/sunxi-ng/ccu_reset.c | 1 + 12 files changed, 15 insertions(+) diff --git a/drivers/clk/sunxi-ng/ccu_common.c b/drivers/clk/sunxi-ng/ccu_common.c index 31af8b6b5286..3ab109582646 100644 --- a/drivers/clk/sunxi-ng/ccu_common.c +++ b/drivers/clk/sunxi-ng/ccu_common.c @@ -83,6 +83,7 @@ int ccu_pll_notifier_register(struct ccu_pll_nb *pll_nb) return clk_notifier_register(pll_nb->common->hw.clk, &pll_nb->clk_nb); } +EXPORT_SYMBOL_GPL(ccu_pll_notifier_register); static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev, struct device_node *node, void __iomem *reg, @@ -194,6 +195,7 @@ int devm_sunxi_ccu_probe(struct device *dev, void __iomem *reg, return 0; } +EXPORT_SYMBOL_GPL(devm_sunxi_ccu_probe); void of_sunxi_ccu_probe(struct device_node *node, void __iomem *reg, const struct sunxi_ccu_desc *desc) diff --git a/drivers/clk/sunxi-ng/ccu_div.c b/drivers/clk/sunxi-ng/ccu_div.c index 4c297089483c..74f82a5e340a 100644 --- a/drivers/clk/sunxi-ng/ccu_div.c +++ b/drivers/clk/sunxi-ng/ccu_div.c @@ -141,3 +141,4 @@ const struct clk_ops ccu_div_ops = { .recalc_rate = ccu_div_recalc_rate, .set_rate = ccu_div_set_rate, }; +EXPORT_SYMBOL_GPL(ccu_div_ops); diff --git a/drivers/clk/sunxi-ng/ccu_gate.c b/drivers/clk/sunxi-ng/ccu_gate.c index 3d5ca092b08f..3c568efaabff 100644 --- a/drivers/clk/sunxi-ng/ccu_gate.c +++ b/drivers/clk/sunxi-ng/ccu_gate.c @@ -124,3 +124,4 @@ const struct clk_ops ccu_gate_ops = { .set_rate = ccu_gate_set_rate, .recalc_rate = ccu_gate_recalc_rate, }; +EXPORT_SYMBOL_GPL(ccu_gate_ops); diff --git a/drivers/clk/sunxi-ng/ccu_mp.c b/drivers/clk/sunxi-ng/ccu_mp.c index 9d3a76604d94..cef8e7cba555 100644 --- a/drivers/clk/sunxi-ng/ccu_mp.c +++ b/drivers/clk/sunxi-ng/ccu_mp.c @@ -245,6 +245,7 @@ const struct clk_ops ccu_mp_ops = { .recalc_rate = ccu_mp_recalc_rate, .set_rate = ccu_mp_set_rate, }; +EXPORT_SYMBOL_GPL(ccu_mp_ops); /* * Support for MMC timing mode switching @@ -325,3 +326,4 @@ const struct clk_ops ccu_mp_mmc_ops = { .recalc_rate = ccu_mp_mmc_recalc_rate, .set_rate = ccu_mp_mmc_set_rate, }; +EXPORT_SYMBOL_GPL(ccu_mp_mmc_ops); diff --git a/drivers/clk/sunxi-ng/ccu_mult.c b/drivers/clk/sunxi-ng/ccu_mult.c index 7c8cf2e04e94..a7223bd3e9f9 100644 --- a/drivers/clk/sunxi-ng/ccu_mult.c +++ b/drivers/clk/sunxi-ng/ccu_mult.c @@ -170,3 +170,4 @@ const struct clk_ops ccu_mult_ops = { .recalc_rate = ccu_mult_recalc_rate, .set_rate = ccu_mult_set_rate, }; +EXPORT_SYMBOL_GPL(ccu_mult_ops); diff --git a/drivers/clk/sunxi-ng/ccu_mux.c b/drivers/clk/sunxi-ng/ccu_mux.c index 7d75da9a1f2e..785803cd7e51 100644 --- a/drivers/clk/sunxi-ng/ccu_mux.c +++ b/drivers/clk/sunxi-ng/ccu_mux.c @@ -251,6 +251,7 @@ const struct clk_ops ccu_mux_ops = { .determine_rate = __clk_mux_determine_rate, .recalc_rate = ccu_mux_recalc_rate, }; +EXPORT_SYMBOL_GPL(ccu_mux_ops); /* * This clock notifier is called when the frequency of the of the parent @@ -285,3 +286,4 @@ int ccu_mux_notifier_register(struct clk *clk, struct ccu_mux_nb *mux_nb) return clk_notifier_register(clk, &mux_nb->clk_nb); } +EXPORT_SYMBOL_GPL(ccu_mux_notifier_register); diff --git a/drivers/clk/sunxi-ng/ccu_nk.c b/drivers/clk/sunxi-ng/ccu_nk.c index aee68b00f3b2..b8fa0bf422fb 100644 --- a/drivers/clk/sunxi-ng/ccu_nk.c +++ b/drivers/clk/sunxi-ng/ccu_nk.c @@ -157,3 +157,4 @@ const struct clk_ops ccu_nk_ops = { .round_rate = ccu_nk_round_rate, .set_rate = ccu_nk_set_rate, }; +EXPORT_SYMBOL_GPL(ccu_nk_ops); diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c index b9cfee0276ea..583d3ba5e624 100644 --- a/drivers/clk/sunxi-ng/ccu_nkm.c +++ b/drivers/clk/sunxi-ng/ccu_nkm.c @@ -206,3 +206,4 @@ const struct clk_ops ccu_nkm_ops = { .recalc_rate = ccu_nkm_recalc_rate, .set_rate = ccu_nkm_set_rate, }; +EXPORT_SYMBOL_GPL(ccu_nkm_ops); diff --git a/drivers/clk/sunxi-ng/ccu_nkmp.c b/drivers/clk/sunxi-ng/ccu_nkmp.c index bda87b38c45c..ec5224ba5b99 100644 --- a/drivers/clk/sunxi-ng/ccu_nkmp.c +++ b/drivers/clk/sunxi-ng/ccu_nkmp.c @@ -230,3 +230,4 @@ const struct clk_ops ccu_nkmp_ops = { .round_rate = ccu_nkmp_round_rate, .set_rate = ccu_nkmp_set_rate, }; +EXPORT_SYMBOL_GPL(ccu_nkmp_ops); diff --git a/drivers/clk/sunxi-ng/ccu_nm.c b/drivers/clk/sunxi-ng/ccu_nm.c index e6bcc0a7170c..576e464bdf03 100644 --- a/drivers/clk/sunxi-ng/ccu_nm.c +++ b/drivers/clk/sunxi-ng/ccu_nm.c @@ -238,3 +238,4 @@ const struct clk_ops ccu_nm_ops = { .round_rate = ccu_nm_round_rate, .set_rate = ccu_nm_set_rate, }; +EXPORT_SYMBOL_GPL(ccu_nm_ops); diff --git a/drivers/clk/sunxi-ng/ccu_phase.c b/drivers/clk/sunxi-ng/ccu_phase.c index 92ab8bd66427..ededb36d531c 100644 --- a/drivers/clk/sunxi-ng/ccu_phase.c +++ b/drivers/clk/sunxi-ng/ccu_phase.c @@ -121,3 +121,4 @@ const struct clk_ops ccu_phase_ops = { .get_phase = ccu_phase_get_phase, .set_phase = ccu_phase_set_phase, }; +EXPORT_SYMBOL_GPL(ccu_phase_ops); diff --git a/drivers/clk/sunxi-ng/ccu_reset.c b/drivers/clk/sunxi-ng/ccu_reset.c index 483100e45df3..8413de004574 100644 --- a/drivers/clk/sunxi-ng/ccu_reset.c +++ b/drivers/clk/sunxi-ng/ccu_reset.c @@ -75,3 +75,4 @@ const struct reset_control_ops ccu_reset_ops = { .reset = ccu_reset_reset, .status = ccu_reset_status, }; +EXPORT_SYMBOL_GPL(ccu_reset_ops); From patchwork Wed Sep 1 05:05:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12468287 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95A4AC432BE for ; Wed, 1 Sep 2021 05:05:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 79D3B61057 for ; Wed, 1 Sep 2021 05:05:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241960AbhIAFGj (ORCPT ); Wed, 1 Sep 2021 01:06:39 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:60825 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241925AbhIAFGc (ORCPT ); Wed, 1 Sep 2021 01:06:32 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id EFB325C019C; Wed, 1 Sep 2021 01:05:35 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 01 Sep 2021 01:05:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=4e2oI5zdlCz+Q FIe2+F59HWSrI67X+JBq24r/vRVDKE=; b=D0ViyHtVNMkHBLJQjKwP4OKlR/Ge8 6NYtP1wT9FfZkmGHGVmYkmdeq/hAh4g2pwHMMYSCJzgsOrUVa1S0wohqEHsV0cfW 4xIhmhNU064DJbK3MWVIHIad0kIUdwgWsuZe/tjni3go3ptXofNS751EM6ItQW88 kc9JLkJOYQagW5ZUCtVTCeuP8JIrzrOXQl7LM518VLhQR4F3ra7Sq3Ck8lGxMblD Dm7NLKzABYoX/MRDtY79sp01Cim5LzxRYJh88NxjOrQdXehRVzoLzDqHNbJ2uG4i SD00me1a3D/RjuQ6Mleh3Wdglu/MD/zzNDuLS8b2025XO4f5tkaALgVSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=4e2oI5zdlCz+QFIe2+F59HWSrI67X+JBq24r/vRVDKE=; b=TIoAVugz CgRYpwBgL0OlnH7kL8PlRJRTAdyFUc0YZTp87/ZZh6N5ja/6OTAKQQeh5VHNYLOd VVfXXTnY1M7jaGBtJ4EmCQMnOHzgFs9KShaBGrwOCHQ/DUXIiBrUWXXCKF3MQgYC 43g7Z+x0oWN65RQeh5vlpwbpeZzAaqoiGnpE2zet0C7N415KedFJn2f+3hpFbLsE cUzgvd4314W3MRGeqBXy8LZ4mm4G31yEW8x0IN+V6r2nsQNFCRReIMxpYZc+k7kB PGCOEHspYuHVe1DUJ4xrm7rVZkApHWF8vDlEY7SrQu+p9UBqHG5YJPvRxMhw1RXR MtC/mu3IuyKBQw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvvddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Sep 2021 01:05:35 -0400 (EDT) From: Samuel Holland To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Michael Turquette , Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Samuel Holland Subject: [PATCH 6/8] clk: sunxi-ng: Allow drivers to be built as modules Date: Wed, 1 Sep 2021 00:05:24 -0500 Message-Id: <20210901050526.45673-7-samuel@sholland.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210901050526.45673-1-samuel@sholland.org> References: <20210901050526.45673-1-samuel@sholland.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org While it is useful to build all of the CCU drivers at once, only 1-3 of them will be loaded at a time, or possibly none of them if the kernel is booted on a non-sunxi platform. These CCU drivers are relatively large; 32-bit drivers have 30-50k of data each, while the 64-bit ones are 50-75k due to the increased pointer overhead. About half of that data comes from relocations. Let's allow the user to build these drivers as modules so only the necessary data is loaded. Signed-off-by: Samuel Holland --- drivers/clk/sunxi-ng/Kconfig | 16 ++++++++-------- drivers/clk/sunxi-ng/sun50i-a100-ccu.c | 3 ++- drivers/clk/sunxi-ng/sun50i-a100-r-ccu.c | 3 ++- drivers/clk/sunxi-ng/sun50i-a64-ccu.c | 6 ++++-- drivers/clk/sunxi-ng/sun50i-h6-ccu.c | 6 ++++-- drivers/clk/sunxi-ng/sun8i-a83t-ccu.c | 6 ++++-- drivers/clk/sunxi-ng/sun8i-de2-ccu.c | 8 +++++--- drivers/clk/sunxi-ng/sun8i-r40-ccu.c | 5 ++++- drivers/clk/sunxi-ng/sun9i-a80-ccu.c | 6 ++++-- drivers/clk/sunxi-ng/sun9i-a80-de-ccu.c | 6 ++++-- drivers/clk/sunxi-ng/sun9i-a80-usb-ccu.c | 6 ++++-- 11 files changed, 45 insertions(+), 26 deletions(-) diff --git a/drivers/clk/sunxi-ng/Kconfig b/drivers/clk/sunxi-ng/Kconfig index cd46d8853876..7cfdf21717f7 100644 --- a/drivers/clk/sunxi-ng/Kconfig +++ b/drivers/clk/sunxi-ng/Kconfig @@ -13,22 +13,22 @@ config SUNIV_F1C100S_CCU depends on MACH_SUNIV || COMPILE_TEST config SUN50I_A64_CCU - bool "Support for the Allwinner A64 CCU" + tristate "Support for the Allwinner A64 CCU" default ARM64 && ARCH_SUNXI depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST config SUN50I_A100_CCU - bool "Support for the Allwinner A100 CCU" + tristate "Support for the Allwinner A100 CCU" default ARM64 && ARCH_SUNXI depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST config SUN50I_A100_R_CCU - bool "Support for the Allwinner A100 PRCM CCU" + tristate "Support for the Allwinner A100 PRCM CCU" default ARM64 && ARCH_SUNXI depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST config SUN50I_H6_CCU - bool "Support for the Allwinner H6 CCU" + tristate "Support for the Allwinner H6 CCU" default ARM64 && ARCH_SUNXI depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST @@ -69,7 +69,7 @@ config SUN8I_A33_CCU depends on MACH_SUN8I || COMPILE_TEST config SUN8I_A83T_CCU - bool "Support for the Allwinner A83T CCU" + tristate "Support for the Allwinner A83T CCU" default MACH_SUN8I config SUN8I_H3_CCU @@ -83,16 +83,16 @@ config SUN8I_V3S_CCU depends on MACH_SUN8I || COMPILE_TEST config SUN8I_DE2_CCU - bool "Support for the Allwinner SoCs DE2 CCU" + tristate "Support for the Allwinner SoCs DE2 CCU" default MACH_SUN8I || (ARM64 && ARCH_SUNXI) config SUN8I_R40_CCU - bool "Support for the Allwinner R40 CCU" + tristate "Support for the Allwinner R40 CCU" default MACH_SUN8I depends on MACH_SUN8I || COMPILE_TEST config SUN9I_A80_CCU - bool "Support for the Allwinner A80 CCU" + tristate "Support for the Allwinner A80 CCU" default MACH_SUN9I depends on MACH_SUN9I || COMPILE_TEST diff --git a/drivers/clk/sunxi-ng/sun50i-a100-ccu.c b/drivers/clk/sunxi-ng/sun50i-a100-ccu.c index 5a813af9941c..5bb901c3b2f5 100644 --- a/drivers/clk/sunxi-ng/sun50i-a100-ccu.c +++ b/drivers/clk/sunxi-ng/sun50i-a100-ccu.c @@ -6,7 +6,6 @@ #include #include #include -#include #include #include "ccu_common.h" @@ -1275,3 +1274,5 @@ static struct platform_driver sun50i_a100_ccu_driver = { }, }; module_platform_driver(sun50i_a100_ccu_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun50i-a100-r-ccu.c b/drivers/clk/sunxi-ng/sun50i-a100-r-ccu.c index 078ebdf8b093..6842d69616a4 100644 --- a/drivers/clk/sunxi-ng/sun50i-a100-r-ccu.c +++ b/drivers/clk/sunxi-ng/sun50i-a100-r-ccu.c @@ -5,7 +5,6 @@ #include #include -#include #include #include "ccu_common.h" @@ -213,3 +212,5 @@ static struct platform_driver sun50i_a100_r_ccu_driver = { }, }; module_platform_driver(sun50i_a100_r_ccu_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun50i-a64-ccu.c b/drivers/clk/sunxi-ng/sun50i-a64-ccu.c index ffc5ef5fab3c..0e7ba14d58ca 100644 --- a/drivers/clk/sunxi-ng/sun50i-a64-ccu.c +++ b/drivers/clk/sunxi-ng/sun50i-a64-ccu.c @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include "ccu_common.h" @@ -982,4 +982,6 @@ static struct platform_driver sun50i_a64_ccu_driver = { .of_match_table = sun50i_a64_ccu_ids, }, }; -builtin_platform_driver(sun50i_a64_ccu_driver); +module_platform_driver(sun50i_a64_ccu_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun50i-h6-ccu.c b/drivers/clk/sunxi-ng/sun50i-h6-ccu.c index 8876358710c5..c28a09e4938d 100644 --- a/drivers/clk/sunxi-ng/sun50i-h6-ccu.c +++ b/drivers/clk/sunxi-ng/sun50i-h6-ccu.c @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include "ccu_common.h" @@ -1256,4 +1256,6 @@ static struct platform_driver sun50i_h6_ccu_driver = { .of_match_table = sun50i_h6_ccu_ids, }, }; -builtin_platform_driver(sun50i_h6_ccu_driver); +module_platform_driver(sun50i_h6_ccu_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun8i-a83t-ccu.c b/drivers/clk/sunxi-ng/sun8i-a83t-ccu.c index 067eb9bb4b53..8ae7b0417a6b 100644 --- a/drivers/clk/sunxi-ng/sun8i-a83t-ccu.c +++ b/drivers/clk/sunxi-ng/sun8i-a83t-ccu.c @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include "ccu_common.h" @@ -922,4 +922,6 @@ static struct platform_driver sun8i_a83t_ccu_driver = { .of_match_table = sun8i_a83t_ccu_ids, }, }; -builtin_platform_driver(sun8i_a83t_ccu_driver); +module_platform_driver(sun8i_a83t_ccu_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun8i-de2-ccu.c b/drivers/clk/sunxi-ng/sun8i-de2-ccu.c index 15d15448ac21..61c185cbc04a 100644 --- a/drivers/clk/sunxi-ng/sun8i-de2-ccu.c +++ b/drivers/clk/sunxi-ng/sun8i-de2-ccu.c @@ -5,8 +5,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -396,4 +396,6 @@ static struct platform_driver sunxi_de2_clk_driver = { .of_match_table = sunxi_de2_clk_ids, }, }; -builtin_platform_driver(sunxi_de2_clk_driver); +module_platform_driver(sunxi_de2_clk_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun8i-r40-ccu.c b/drivers/clk/sunxi-ng/sun8i-r40-ccu.c index 7347b65a5051..a090b21002b6 100644 --- a/drivers/clk/sunxi-ng/sun8i-r40-ccu.c +++ b/drivers/clk/sunxi-ng/sun8i-r40-ccu.c @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -1373,4 +1374,6 @@ static struct platform_driver sun8i_r40_ccu_driver = { .of_match_table = sun8i_r40_ccu_ids, }, }; -builtin_platform_driver(sun8i_r40_ccu_driver); +module_platform_driver(sun8i_r40_ccu_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun9i-a80-ccu.c b/drivers/clk/sunxi-ng/sun9i-a80-ccu.c index bc0b89e18652..ae654078eca5 100644 --- a/drivers/clk/sunxi-ng/sun9i-a80-ccu.c +++ b/drivers/clk/sunxi-ng/sun9i-a80-ccu.c @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include "ccu_common.h" @@ -1247,4 +1247,6 @@ static struct platform_driver sun9i_a80_ccu_driver = { .of_match_table = sun9i_a80_ccu_ids, }, }; -builtin_platform_driver(sun9i_a80_ccu_driver); +module_platform_driver(sun9i_a80_ccu_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun9i-a80-de-ccu.c b/drivers/clk/sunxi-ng/sun9i-a80-de-ccu.c index 5be451411cb4..69303f5d7747 100644 --- a/drivers/clk/sunxi-ng/sun9i-a80-de-ccu.c +++ b/drivers/clk/sunxi-ng/sun9i-a80-de-ccu.c @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include @@ -272,4 +272,6 @@ static struct platform_driver sun9i_a80_de_clk_driver = { .of_match_table = sun9i_a80_de_clk_ids, }, }; -builtin_platform_driver(sun9i_a80_de_clk_driver); +module_platform_driver(sun9i_a80_de_clk_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun9i-a80-usb-ccu.c b/drivers/clk/sunxi-ng/sun9i-a80-usb-ccu.c index 62417b6e4f74..a9cab6d70953 100644 --- a/drivers/clk/sunxi-ng/sun9i-a80-usb-ccu.c +++ b/drivers/clk/sunxi-ng/sun9i-a80-usb-ccu.c @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include "ccu_common.h" @@ -140,4 +140,6 @@ static struct platform_driver sun9i_a80_usb_clk_driver = { .of_match_table = sun9i_a80_usb_clk_ids, }, }; -builtin_platform_driver(sun9i_a80_usb_clk_driver); +module_platform_driver(sun9i_a80_usb_clk_driver); + +MODULE_LICENSE("GPL"); From patchwork Wed Sep 1 05:05:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12468289 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B869C43216 for ; Wed, 1 Sep 2021 05:05:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 012F561058 for ; Wed, 1 Sep 2021 05:05:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241966AbhIAFGk (ORCPT ); Wed, 1 Sep 2021 01:06:40 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:34713 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241932AbhIAFGd (ORCPT ); Wed, 1 Sep 2021 01:06:33 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id A2D045C01DB; Wed, 1 Sep 2021 01:05:36 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 01 Sep 2021 01:05:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=WNxuoMCYDmq5i viwux3z95XOQBk0bM34zKf5K/8nI6A=; b=jene/l8V/0ZhdTTOBcrNiwxcnb3U3 ZBnBbufsOkoxf+4yQ6lJJF9FoMkiwSrlSo+BoyJc4zu0LgQppYZn7OfSX/KF3lCV v1jQSukG/ORkThF/1/vOmPZG1tm8f0ZX2JYDdwM3IO/6Ut9bnmTVGXoZ5q/qzpkS 5yO6fKfVBcLjh0FQDQWAMEPpvNHCACnv6Wa9ZpBF759SEt8rWBVPBvK9MnlD/3yk XxiIyC02LAC3zMgxIAevA6F7gZC4/fUBUzDCvpHbx519Tsfovh0PbgP5/NX3n7sR nQ9OxjvWKRSkAZxjXtEjble4UypRRDxzzHLwI5kTtX19JGQ8qI/QoYY5Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=WNxuoMCYDmq5iviwux3z95XOQBk0bM34zKf5K/8nI6A=; b=J76t+Nci p7QvezC0iVBxk5XZop9fwne2v8TJt/oX4EBT0jZiZwsbTo/awE/URYBf/s45ekUU Zd3mHP8Dzuuz5T3gQ4rgb71zRjqOJzblQWqCSQpHSXpTHYQAGsEb5nQJv4K9lpHC 7xPzj3Wp8ZGhWHrAbH7kPYAQ9IZvn+Uu1wFDFcZ53DQ0eYT3e2AWzu556pSep6by +83/SvzfAIMuIZjlgF1FsWTGrBdEKig/KOA42+qz8tbk5X/p0FclIV1DP3AzePnT LBk0G2oBIhUh61ES173oKcvGVuCFRRmKZE6jMNb86NqzOHvYiKOytUhItcZXIHOs 7kWrYxwVzoLkOQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvvddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Sep 2021 01:05:36 -0400 (EDT) From: Samuel Holland To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Michael Turquette , Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Samuel Holland Subject: [PATCH 7/8] clk: sunxi-ng: Convert early providers to platform drivers Date: Wed, 1 Sep 2021 00:05:25 -0500 Message-Id: <20210901050526.45673-8-samuel@sholland.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210901050526.45673-1-samuel@sholland.org> References: <20210901050526.45673-1-samuel@sholland.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org The PRCM CCU drivers depend on clocks provided by other CCU drivers. For example, the sun8i-r-ccu driver uses the "pll-periph" clock provided by the SoC's main CCU. However, sun8i-r-ccu is an early OF clock provider, and many of the main CCUs (e.g. sun50i-a64-ccu) use platform drivers. This means that the consumer clocks will be orphaned until the supplier driver is bound. This can be avoided by converting the remaining CCUs to use platform drivers. Then fw_devlink will ensure the drivers are bound in the optimal order. The sun5i CCU is the only one which actually needs to be an early clock provider, because it provides the clock for the system timer. That one is left alone. Signed-off-by: Samuel Holland --- drivers/clk/sunxi-ng/Kconfig | 20 ++++---- drivers/clk/sunxi-ng/sun4i-a10-ccu.c | 57 +++++++++++++-------- drivers/clk/sunxi-ng/sun50i-h6-r-ccu.c | 55 ++++++++++++-------- drivers/clk/sunxi-ng/sun50i-h616-ccu.c | 32 ++++++++---- drivers/clk/sunxi-ng/sun6i-a31-ccu.c | 39 +++++++++++---- drivers/clk/sunxi-ng/sun8i-a23-ccu.c | 34 +++++++++---- drivers/clk/sunxi-ng/sun8i-a33-ccu.c | 39 +++++++++++---- drivers/clk/sunxi-ng/sun8i-h3-ccu.c | 61 ++++++++++++++-------- drivers/clk/sunxi-ng/sun8i-r-ccu.c | 64 ++++++++++++++---------- drivers/clk/sunxi-ng/sun8i-v3s-ccu.c | 56 +++++++++++++-------- drivers/clk/sunxi-ng/suniv-f1c100s-ccu.c | 37 ++++++++++---- 11 files changed, 322 insertions(+), 172 deletions(-) diff --git a/drivers/clk/sunxi-ng/Kconfig b/drivers/clk/sunxi-ng/Kconfig index 7cfdf21717f7..cbae3612a9ef 100644 --- a/drivers/clk/sunxi-ng/Kconfig +++ b/drivers/clk/sunxi-ng/Kconfig @@ -8,7 +8,7 @@ config SUNXI_CCU if SUNXI_CCU config SUNIV_F1C100S_CCU - bool "Support for the Allwinner newer F1C100s CCU" + tristate "Support for the Allwinner newer F1C100s CCU" default MACH_SUNIV depends on MACH_SUNIV || COMPILE_TEST @@ -33,17 +33,17 @@ config SUN50I_H6_CCU depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST config SUN50I_H616_CCU - bool "Support for the Allwinner H616 CCU" + tristate "Support for the Allwinner H616 CCU" default ARM64 && ARCH_SUNXI depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST config SUN50I_H6_R_CCU - bool "Support for the Allwinner H6 and H616 PRCM CCU" + tristate "Support for the Allwinner H6 and H616 PRCM CCU" default ARM64 && ARCH_SUNXI depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST config SUN4I_A10_CCU - bool "Support for the Allwinner A10/A20 CCU" + tristate "Support for the Allwinner A10/A20 CCU" default MACH_SUN4I default MACH_SUN7I depends on MACH_SUN4I || MACH_SUN7I || COMPILE_TEST @@ -54,17 +54,17 @@ config SUN5I_CCU depends on MACH_SUN5I || COMPILE_TEST config SUN6I_A31_CCU - bool "Support for the Allwinner A31/A31s CCU" + tristate "Support for the Allwinner A31/A31s CCU" default MACH_SUN6I depends on MACH_SUN6I || COMPILE_TEST config SUN8I_A23_CCU - bool "Support for the Allwinner A23 CCU" + tristate "Support for the Allwinner A23 CCU" default MACH_SUN8I depends on MACH_SUN8I || COMPILE_TEST config SUN8I_A33_CCU - bool "Support for the Allwinner A33 CCU" + tristate "Support for the Allwinner A33 CCU" default MACH_SUN8I depends on MACH_SUN8I || COMPILE_TEST @@ -73,12 +73,12 @@ config SUN8I_A83T_CCU default MACH_SUN8I config SUN8I_H3_CCU - bool "Support for the Allwinner H3 CCU" + tristate "Support for the Allwinner H3 CCU" default MACH_SUN8I || (ARM64 && ARCH_SUNXI) depends on MACH_SUN8I || (ARM64 && ARCH_SUNXI) || COMPILE_TEST config SUN8I_V3S_CCU - bool "Support for the Allwinner V3s CCU" + tristate "Support for the Allwinner V3s CCU" default MACH_SUN8I depends on MACH_SUN8I || COMPILE_TEST @@ -97,7 +97,7 @@ config SUN9I_A80_CCU depends on MACH_SUN9I || COMPILE_TEST config SUN8I_R_CCU - bool "Support for Allwinner SoCs' PRCM CCUs" + tristate "Support for Allwinner SoCs' PRCM CCUs" default MACH_SUN8I || (ARCH_SUNXI && ARM64) endif diff --git a/drivers/clk/sunxi-ng/sun4i-a10-ccu.c b/drivers/clk/sunxi-ng/sun4i-a10-ccu.c index 5d67f5666943..027b9667f472 100644 --- a/drivers/clk/sunxi-ng/sun4i-a10-ccu.c +++ b/drivers/clk/sunxi-ng/sun4i-a10-ccu.c @@ -7,7 +7,9 @@ #include #include -#include +#include +#include +#include #include "ccu_common.h" #include "ccu_reset.h" @@ -1425,18 +1427,19 @@ static const struct sunxi_ccu_desc sun7i_a20_ccu_desc = { .num_resets = ARRAY_SIZE(sunxi_a10_a20_ccu_resets), }; -static void __init sun4i_ccu_init(struct device_node *node, - const struct sunxi_ccu_desc *desc) +static int sun4i_a10_ccu_probe(struct platform_device *pdev) { + const struct sunxi_ccu_desc *desc; void __iomem *reg; u32 val; - reg = of_io_request_and_map(node, 0, of_node_full_name(node)); - if (IS_ERR(reg)) { - pr_err("%s: Could not map the clock registers\n", - of_node_full_name(node)); - return; - } + desc = of_device_get_match_data(&pdev->dev); + if (!desc) + return -EINVAL; + + reg = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(reg)) + return PTR_ERR(reg); val = readl(reg + SUN4I_PLL_AUDIO_REG); @@ -1464,19 +1467,29 @@ static void __init sun4i_ccu_init(struct device_node *node, val &= ~GENMASK(7, 6); writel(val | (2 << 6), reg + SUN4I_AHB_REG); - of_sunxi_ccu_probe(node, reg, desc); + return devm_sunxi_ccu_probe(&pdev->dev, reg, desc); } -static void __init sun4i_a10_ccu_setup(struct device_node *node) -{ - sun4i_ccu_init(node, &sun4i_a10_ccu_desc); -} -CLK_OF_DECLARE(sun4i_a10_ccu, "allwinner,sun4i-a10-ccu", - sun4i_a10_ccu_setup); +static const struct of_device_id sun4i_a10_ccu_ids[] = { + { + .compatible = "allwinner,sun4i-a10-ccu", + .data = &sun4i_a10_ccu_desc, + }, + { + .compatible = "allwinner,sun7i-a20-ccu", + .data = &sun7i_a20_ccu_desc, + }, + { } +}; -static void __init sun7i_a20_ccu_setup(struct device_node *node) -{ - sun4i_ccu_init(node, &sun7i_a20_ccu_desc); -} -CLK_OF_DECLARE(sun7i_a20_ccu, "allwinner,sun7i-a20-ccu", - sun7i_a20_ccu_setup); +static struct platform_driver sun4i_a10_ccu_driver = { + .probe = sun4i_a10_ccu_probe, + .driver = { + .name = "sun4i-a10-ccu", + .suppress_bind_attrs = true, + .of_match_table = sun4i_a10_ccu_ids, + }, +}; +module_platform_driver(sun4i_a10_ccu_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun50i-h6-r-ccu.c b/drivers/clk/sunxi-ng/sun50i-h6-r-ccu.c index bb7f9ed78c4c..2b2f809fd090 100644 --- a/drivers/clk/sunxi-ng/sun50i-h6-r-ccu.c +++ b/drivers/clk/sunxi-ng/sun50i-h6-r-ccu.c @@ -4,7 +4,8 @@ */ #include -#include +#include +#include #include #include "ccu_common.h" @@ -221,30 +222,42 @@ static const struct sunxi_ccu_desc sun50i_h616_r_ccu_desc = { .num_resets = ARRAY_SIZE(sun50i_h616_r_ccu_resets), }; -static void __init sunxi_r_ccu_init(struct device_node *node, - const struct sunxi_ccu_desc *desc) +static int sun50i_h6_r_ccu_probe(struct platform_device *pdev) { + const struct sunxi_ccu_desc *desc; void __iomem *reg; - reg = of_io_request_and_map(node, 0, of_node_full_name(node)); - if (IS_ERR(reg)) { - pr_err("%pOF: Could not map the clock registers\n", node); - return; - } + desc = of_device_get_match_data(&pdev->dev); + if (!desc) + return -EINVAL; - of_sunxi_ccu_probe(node, reg, desc); -} + reg = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(reg)) + return PTR_ERR(reg); -static void __init sun50i_h6_r_ccu_setup(struct device_node *node) -{ - sunxi_r_ccu_init(node, &sun50i_h6_r_ccu_desc); + return devm_sunxi_ccu_probe(&pdev->dev, reg, desc); } -CLK_OF_DECLARE(sun50i_h6_r_ccu, "allwinner,sun50i-h6-r-ccu", - sun50i_h6_r_ccu_setup); -static void __init sun50i_h616_r_ccu_setup(struct device_node *node) -{ - sunxi_r_ccu_init(node, &sun50i_h616_r_ccu_desc); -} -CLK_OF_DECLARE(sun50i_h616_r_ccu, "allwinner,sun50i-h616-r-ccu", - sun50i_h616_r_ccu_setup); +static const struct of_device_id sun50i_h6_r_ccu_ids[] = { + { + .compatible = "allwinner,sun50i-h6-r-ccu", + .data = &sun50i_h6_r_ccu_desc, + }, + { + .compatible = "allwinner,sun50i-h616-r-ccu", + .data = &sun50i_h616_r_ccu_desc, + }, + { } +}; + +static struct platform_driver sun50i_h6_r_ccu_driver = { + .probe = sun50i_h6_r_ccu_probe, + .driver = { + .name = "sun50i-h6-r-ccu", + .suppress_bind_attrs = true, + .of_match_table = sun50i_h6_r_ccu_ids, + }, +}; +module_platform_driver(sun50i_h6_r_ccu_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun50i-h616-ccu.c b/drivers/clk/sunxi-ng/sun50i-h616-ccu.c index 71d75833253f..4f6eb5474d4b 100644 --- a/drivers/clk/sunxi-ng/sun50i-h616-ccu.c +++ b/drivers/clk/sunxi-ng/sun50i-h616-ccu.c @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include "ccu_common.h" @@ -1082,17 +1082,15 @@ static const u32 usb2_clk_regs[] = { SUN50I_H616_USB3_CLK_REG, }; -static void __init sun50i_h616_ccu_setup(struct device_node *node) +static int sun50i_h616_ccu_probe(struct platform_device *pdev) { void __iomem *reg; u32 val; int i; - reg = of_io_request_and_map(node, 0, of_node_full_name(node)); - if (IS_ERR(reg)) { - pr_err("%pOF: Could not map clock registers\n", node); - return; - } + reg = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(reg)) + return PTR_ERR(reg); /* Enable the lock bits and the output enable bits on all PLLs */ for (i = 0; i < ARRAY_SIZE(pll_regs); i++) { @@ -1141,8 +1139,22 @@ static void __init sun50i_h616_ccu_setup(struct device_node *node) val |= BIT(24); writel(val, reg + SUN50I_H616_HDMI_CEC_CLK_REG); - of_sunxi_ccu_probe(node, reg, &sun50i_h616_ccu_desc); + return devm_sunxi_ccu_probe(&pdev->dev, reg, &sun50i_h616_ccu_desc); } -CLK_OF_DECLARE(sun50i_h616_ccu, "allwinner,sun50i-h616-ccu", - sun50i_h616_ccu_setup); +static const struct of_device_id sun50i_h616_ccu_ids[] = { + { .compatible = "allwinner,sun50i-h616-ccu" }, + { } +}; + +static struct platform_driver sun50i_h616_ccu_driver = { + .probe = sun50i_h616_ccu_probe, + .driver = { + .name = "sun50i-h616-ccu", + .suppress_bind_attrs = true, + .of_match_table = sun50i_h616_ccu_ids, + }, +}; +module_platform_driver(sun50i_h616_ccu_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun6i-a31-ccu.c b/drivers/clk/sunxi-ng/sun6i-a31-ccu.c index b05c06a428ad..36597a5262e1 100644 --- a/drivers/clk/sunxi-ng/sun6i-a31-ccu.c +++ b/drivers/clk/sunxi-ng/sun6i-a31-ccu.c @@ -9,7 +9,8 @@ #include #include -#include +#include +#include #include "ccu_common.h" #include "ccu_reset.h" @@ -1226,16 +1227,15 @@ static struct ccu_mux_nb sun6i_a31_cpu_nb = { .bypass_index = 1, /* index of 24 MHz oscillator */ }; -static void __init sun6i_a31_ccu_setup(struct device_node *node) +static int sun6i_a31_ccu_probe(struct platform_device *pdev) { void __iomem *reg; + int ret; u32 val; - reg = of_io_request_and_map(node, 0, of_node_full_name(node)); - if (IS_ERR(reg)) { - pr_err("%pOF: Could not map the clock registers\n", node); - return; - } + reg = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(reg)) + return PTR_ERR(reg); /* Force the PLL-Audio-1x divider to 1 */ val = readl(reg + SUN6I_A31_PLL_AUDIO_REG); @@ -1257,10 +1257,29 @@ static void __init sun6i_a31_ccu_setup(struct device_node *node) val |= 0x3 << 12; writel(val, reg + SUN6I_A31_AHB1_REG); - of_sunxi_ccu_probe(node, reg, &sun6i_a31_ccu_desc); + ret = devm_sunxi_ccu_probe(&pdev->dev, reg, &sun6i_a31_ccu_desc); + if (ret) + return ret; ccu_mux_notifier_register(pll_cpu_clk.common.hw.clk, &sun6i_a31_cpu_nb); + + return 0; } -CLK_OF_DECLARE(sun6i_a31_ccu, "allwinner,sun6i-a31-ccu", - sun6i_a31_ccu_setup); + +static const struct of_device_id sun6i_a31_ccu_ids[] = { + { .compatible = "allwinner,sun6i-a31-ccu" }, + { } +}; + +static struct platform_driver sun6i_a31_ccu_driver = { + .probe = sun6i_a31_ccu_probe, + .driver = { + .name = "sun6i-a31-ccu", + .suppress_bind_attrs = true, + .of_match_table = sun6i_a31_ccu_ids, + }, +}; +module_platform_driver(sun6i_a31_ccu_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun8i-a23-ccu.c b/drivers/clk/sunxi-ng/sun8i-a23-ccu.c index 5bbc66a762db..6c469fdcdab3 100644 --- a/drivers/clk/sunxi-ng/sun8i-a23-ccu.c +++ b/drivers/clk/sunxi-ng/sun8i-a23-ccu.c @@ -5,7 +5,8 @@ #include #include -#include +#include +#include #include "ccu_common.h" #include "ccu_reset.h" @@ -724,16 +725,14 @@ static const struct sunxi_ccu_desc sun8i_a23_ccu_desc = { .num_resets = ARRAY_SIZE(sun8i_a23_ccu_resets), }; -static void __init sun8i_a23_ccu_setup(struct device_node *node) +static int sun8i_a23_ccu_probe(struct platform_device *pdev) { void __iomem *reg; u32 val; - reg = of_io_request_and_map(node, 0, of_node_full_name(node)); - if (IS_ERR(reg)) { - pr_err("%pOF: Could not map the clock registers\n", node); - return; - } + reg = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(reg)) + return PTR_ERR(reg); /* Force the PLL-Audio-1x divider to 1 */ val = readl(reg + SUN8I_A23_PLL_AUDIO_REG); @@ -745,7 +744,22 @@ static void __init sun8i_a23_ccu_setup(struct device_node *node) val &= ~BIT(16); writel(val, reg + SUN8I_A23_PLL_MIPI_REG); - of_sunxi_ccu_probe(node, reg, &sun8i_a23_ccu_desc); + return devm_sunxi_ccu_probe(&pdev->dev, reg, &sun8i_a23_ccu_desc); } -CLK_OF_DECLARE(sun8i_a23_ccu, "allwinner,sun8i-a23-ccu", - sun8i_a23_ccu_setup); + +static const struct of_device_id sun8i_a23_ccu_ids[] = { + { .compatible = "allwinner,sun8i-a23-ccu" }, + { } +}; + +static struct platform_driver sun8i_a23_ccu_driver = { + .probe = sun8i_a23_ccu_probe, + .driver = { + .name = "sun8i-a23-ccu", + .suppress_bind_attrs = true, + .of_match_table = sun8i_a23_ccu_ids, + }, +}; +module_platform_driver(sun8i_a23_ccu_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun8i-a33-ccu.c b/drivers/clk/sunxi-ng/sun8i-a33-ccu.c index 6cd214b444d1..ac493198ea14 100644 --- a/drivers/clk/sunxi-ng/sun8i-a33-ccu.c +++ b/drivers/clk/sunxi-ng/sun8i-a33-ccu.c @@ -5,7 +5,8 @@ #include #include -#include +#include +#include #include "ccu_common.h" #include "ccu_reset.h" @@ -784,16 +785,15 @@ static struct ccu_mux_nb sun8i_a33_cpu_nb = { .bypass_index = 1, /* index of 24 MHz oscillator */ }; -static void __init sun8i_a33_ccu_setup(struct device_node *node) +static int sun8i_a33_ccu_probe(struct platform_device *pdev) { void __iomem *reg; + int ret; u32 val; - reg = of_io_request_and_map(node, 0, of_node_full_name(node)); - if (IS_ERR(reg)) { - pr_err("%pOF: Could not map the clock registers\n", node); - return; - } + reg = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(reg)) + return PTR_ERR(reg); /* Force the PLL-Audio-1x divider to 1 */ val = readl(reg + SUN8I_A33_PLL_AUDIO_REG); @@ -805,7 +805,9 @@ static void __init sun8i_a33_ccu_setup(struct device_node *node) val &= ~BIT(16); writel(val, reg + SUN8I_A33_PLL_MIPI_REG); - of_sunxi_ccu_probe(node, reg, &sun8i_a33_ccu_desc); + ret = devm_sunxi_ccu_probe(&pdev->dev, reg, &sun8i_a33_ccu_desc); + if (ret) + return ret; /* Gate then ungate PLL CPU after any rate changes */ ccu_pll_notifier_register(&sun8i_a33_pll_cpu_nb); @@ -813,6 +815,23 @@ static void __init sun8i_a33_ccu_setup(struct device_node *node) /* Reparent CPU during PLL CPU rate changes */ ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk, &sun8i_a33_cpu_nb); + + return 0; } -CLK_OF_DECLARE(sun8i_a33_ccu, "allwinner,sun8i-a33-ccu", - sun8i_a33_ccu_setup); + +static const struct of_device_id sun8i_a33_ccu_ids[] = { + { .compatible = "allwinner,sun8i-a33-ccu" }, + { } +}; + +static struct platform_driver sun8i_a33_ccu_driver = { + .probe = sun8i_a33_ccu_probe, + .driver = { + .name = "sun8i-a33-ccu", + .suppress_bind_attrs = true, + .of_match_table = sun8i_a33_ccu_ids, + }, +}; +module_platform_driver(sun8i_a33_ccu_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun8i-h3-ccu.c b/drivers/clk/sunxi-ng/sun8i-h3-ccu.c index c566cc1aa168..a93f48535f44 100644 --- a/drivers/clk/sunxi-ng/sun8i-h3-ccu.c +++ b/drivers/clk/sunxi-ng/sun8i-h3-ccu.c @@ -5,7 +5,9 @@ #include #include -#include +#include +#include +#include #include "ccu_common.h" #include "ccu_reset.h" @@ -1137,24 +1139,29 @@ static struct ccu_mux_nb sun8i_h3_cpu_nb = { .bypass_index = 1, /* index of 24 MHz oscillator */ }; -static void __init sunxi_h3_h5_ccu_init(struct device_node *node, - const struct sunxi_ccu_desc *desc) +static int sun8i_h3_ccu_probe(struct platform_device *pdev) { + const struct sunxi_ccu_desc *desc; void __iomem *reg; + int ret; u32 val; - reg = of_io_request_and_map(node, 0, of_node_full_name(node)); - if (IS_ERR(reg)) { - pr_err("%pOF: Could not map the clock registers\n", node); - return; - } + desc = of_device_get_match_data(&pdev->dev); + if (!desc) + return -EINVAL; + + reg = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(reg)) + return PTR_ERR(reg); /* Force the PLL-Audio-1x divider to 1 */ val = readl(reg + SUN8I_H3_PLL_AUDIO_REG); val &= ~GENMASK(19, 16); writel(val | (0 << 16), reg + SUN8I_H3_PLL_AUDIO_REG); - of_sunxi_ccu_probe(node, reg, desc); + ret = devm_sunxi_ccu_probe(&pdev->dev, reg, desc); + if (ret) + return ret; /* Gate then ungate PLL CPU after any rate changes */ ccu_pll_notifier_register(&sun8i_h3_pll_cpu_nb); @@ -1162,18 +1169,30 @@ static void __init sunxi_h3_h5_ccu_init(struct device_node *node, /* Reparent CPU during PLL CPU rate changes */ ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk, &sun8i_h3_cpu_nb); -} -static void __init sun8i_h3_ccu_setup(struct device_node *node) -{ - sunxi_h3_h5_ccu_init(node, &sun8i_h3_ccu_desc); + return 0; } -CLK_OF_DECLARE(sun8i_h3_ccu, "allwinner,sun8i-h3-ccu", - sun8i_h3_ccu_setup); -static void __init sun50i_h5_ccu_setup(struct device_node *node) -{ - sunxi_h3_h5_ccu_init(node, &sun50i_h5_ccu_desc); -} -CLK_OF_DECLARE(sun50i_h5_ccu, "allwinner,sun50i-h5-ccu", - sun50i_h5_ccu_setup); +static const struct of_device_id sun8i_h3_ccu_ids[] = { + { + .compatible = "allwinner,sun8i-h3-ccu", + .data = &sun8i_h3_ccu_desc, + }, + { + .compatible = "allwinner,sun50i-h5-ccu", + .data = &sun50i_h5_ccu_desc, + }, + { } +}; + +static struct platform_driver sun8i_h3_ccu_driver = { + .probe = sun8i_h3_ccu_probe, + .driver = { + .name = "sun8i-h3-ccu", + .suppress_bind_attrs = true, + .of_match_table = sun8i_h3_ccu_ids, + }, +}; +module_platform_driver(sun8i_h3_ccu_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun8i-r-ccu.c b/drivers/clk/sunxi-ng/sun8i-r-ccu.c index eb623b01df58..56c242e71127 100644 --- a/drivers/clk/sunxi-ng/sun8i-r-ccu.c +++ b/drivers/clk/sunxi-ng/sun8i-r-ccu.c @@ -4,7 +4,8 @@ */ #include -#include +#include +#include #include #include "ccu_common.h" @@ -254,37 +255,46 @@ static const struct sunxi_ccu_desc sun50i_a64_r_ccu_desc = { .num_resets = ARRAY_SIZE(sun50i_a64_r_ccu_resets), }; -static void __init sunxi_r_ccu_init(struct device_node *node, - const struct sunxi_ccu_desc *desc) +static int sun8i_r_ccu_probe(struct platform_device *pdev) { + const struct sunxi_ccu_desc *desc; void __iomem *reg; - reg = of_io_request_and_map(node, 0, of_node_full_name(node)); - if (IS_ERR(reg)) { - pr_err("%pOF: Could not map the clock registers\n", node); - return; - } + desc = of_device_get_match_data(&pdev->dev); + if (!desc) + return -EINVAL; - of_sunxi_ccu_probe(node, reg, desc); -} + reg = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(reg)) + return PTR_ERR(reg); -static void __init sun8i_a83t_r_ccu_setup(struct device_node *node) -{ - sunxi_r_ccu_init(node, &sun8i_a83t_r_ccu_desc); + return devm_sunxi_ccu_probe(&pdev->dev, reg, desc); } -CLK_OF_DECLARE(sun8i_a83t_r_ccu, "allwinner,sun8i-a83t-r-ccu", - sun8i_a83t_r_ccu_setup); -static void __init sun8i_h3_r_ccu_setup(struct device_node *node) -{ - sunxi_r_ccu_init(node, &sun8i_h3_r_ccu_desc); -} -CLK_OF_DECLARE(sun8i_h3_r_ccu, "allwinner,sun8i-h3-r-ccu", - sun8i_h3_r_ccu_setup); +static const struct of_device_id sun8i_r_ccu_ids[] = { + { + .compatible = "allwinner,sun8i-a83t-r-ccu", + .data = &sun8i_a83t_r_ccu_desc, + }, + { + .compatible = "allwinner,sun8i-h3-r-ccu", + .data = &sun8i_h3_r_ccu_desc, + }, + { + .compatible = "allwinner,sun50i-a64-r-ccu", + .data = &sun50i_a64_r_ccu_desc, + }, + { } +}; -static void __init sun50i_a64_r_ccu_setup(struct device_node *node) -{ - sunxi_r_ccu_init(node, &sun50i_a64_r_ccu_desc); -} -CLK_OF_DECLARE(sun50i_a64_r_ccu, "allwinner,sun50i-a64-r-ccu", - sun50i_a64_r_ccu_setup); +static struct platform_driver sun8i_r_ccu_driver = { + .probe = sun8i_r_ccu_probe, + .driver = { + .name = "sun8i-r-ccu", + .suppress_bind_attrs = true, + .of_match_table = sun8i_r_ccu_ids, + }, +}; +module_platform_driver(sun8i_r_ccu_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/sun8i-v3s-ccu.c b/drivers/clk/sunxi-ng/sun8i-v3s-ccu.c index 58b123ad1212..5ce0fe0e3358 100644 --- a/drivers/clk/sunxi-ng/sun8i-v3s-ccu.c +++ b/drivers/clk/sunxi-ng/sun8i-v3s-ccu.c @@ -8,7 +8,9 @@ #include #include -#include +#include +#include +#include #include "ccu_common.h" #include "ccu_reset.h" @@ -805,38 +807,48 @@ static const struct sunxi_ccu_desc sun8i_v3_ccu_desc = { .num_resets = ARRAY_SIZE(sun8i_v3_ccu_resets), }; -static void __init sun8i_v3_v3s_ccu_init(struct device_node *node, - const struct sunxi_ccu_desc *ccu_desc) +static int sun8i_v3s_ccu_probe(struct platform_device *pdev) { + const struct sunxi_ccu_desc *desc; void __iomem *reg; u32 val; - reg = of_io_request_and_map(node, 0, of_node_full_name(node)); - if (IS_ERR(reg)) { - pr_err("%pOF: Could not map the clock registers\n", node); - return; - } + desc = of_device_get_match_data(&pdev->dev); + if (!desc) + return -EINVAL; + + reg = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(reg)) + return PTR_ERR(reg); /* Force the PLL-Audio-1x divider to 1 */ val = readl(reg + SUN8I_V3S_PLL_AUDIO_REG); val &= ~GENMASK(19, 16); writel(val, reg + SUN8I_V3S_PLL_AUDIO_REG); - of_sunxi_ccu_probe(node, reg, ccu_desc); -} - -static void __init sun8i_v3s_ccu_setup(struct device_node *node) -{ - sun8i_v3_v3s_ccu_init(node, &sun8i_v3s_ccu_desc); + return devm_sunxi_ccu_probe(&pdev->dev, reg, desc); } -static void __init sun8i_v3_ccu_setup(struct device_node *node) -{ - sun8i_v3_v3s_ccu_init(node, &sun8i_v3_ccu_desc); -} +static const struct of_device_id sun8i_v3s_ccu_ids[] = { + { + .compatible = "allwinner,sun8i-v3-ccu", + .data = &sun8i_v3_ccu_desc, + }, + { + .compatible = "allwinner,sun8i-v3s-ccu", + .data = &sun8i_v3s_ccu_desc, + }, + { } +}; -CLK_OF_DECLARE(sun8i_v3s_ccu, "allwinner,sun8i-v3s-ccu", - sun8i_v3s_ccu_setup); +static struct platform_driver sun8i_v3s_ccu_driver = { + .probe = sun8i_v3s_ccu_probe, + .driver = { + .name = "sun8i-v3s-ccu", + .suppress_bind_attrs = true, + .of_match_table = sun8i_v3s_ccu_ids, + }, +}; +module_platform_driver(sun8i_v3s_ccu_driver); -CLK_OF_DECLARE(sun8i_v3_ccu, "allwinner,sun8i-v3-ccu", - sun8i_v3_ccu_setup); +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/suniv-f1c100s-ccu.c b/drivers/clk/sunxi-ng/suniv-f1c100s-ccu.c index 850ab8af2471..de602340f460 100644 --- a/drivers/clk/sunxi-ng/suniv-f1c100s-ccu.c +++ b/drivers/clk/sunxi-ng/suniv-f1c100s-ccu.c @@ -6,7 +6,8 @@ #include #include -#include +#include +#include #include "ccu_common.h" #include "ccu_reset.h" @@ -525,20 +526,21 @@ static struct ccu_mux_nb suniv_cpu_nb = { static void __init suniv_f1c100s_ccu_setup(struct device_node *node) { void __iomem *reg; + int ret; u32 val; - reg = of_io_request_and_map(node, 0, of_node_full_name(node)); - if (IS_ERR(reg)) { - pr_err("%pOF: Could not map the clock registers\n", node); - return; - } + reg = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(reg)) + return PTR_ERR(reg); /* Force the PLL-Audio-1x divider to 4 */ val = readl(reg + SUNIV_PLL_AUDIO_REG); val &= ~GENMASK(19, 16); writel(val | (3 << 16), reg + SUNIV_PLL_AUDIO_REG); - of_sunxi_ccu_probe(node, reg, &suniv_ccu_desc); + ret = devm_sunxi_ccu_probe(&pdev->dev, reg, &suniv_ccu_desc); + if (ret) + return ret; /* Gate then ungate PLL CPU after any rate changes */ ccu_pll_notifier_register(&suniv_pll_cpu_nb); @@ -546,6 +548,23 @@ static void __init suniv_f1c100s_ccu_setup(struct device_node *node) /* Reparent CPU during PLL CPU rate changes */ ccu_mux_notifier_register(pll_cpu_clk.common.hw.clk, &suniv_cpu_nb); + + return 0; } -CLK_OF_DECLARE(suniv_f1c100s_ccu, "allwinner,suniv-f1c100s-ccu", - suniv_f1c100s_ccu_setup); + +static const struct of_device_id suniv_f1c100s_ccu_ids[] = { + { .compatible = "allwinner,suniv-f1c100s-ccu" }, + { } +}; + +static struct platform_driver suniv_f1c100s_ccu_driver = { + .probe = suniv_f1c100s_ccu_probe, + .driver = { + .name = "suniv-f1c100s-ccu", + .suppress_bind_attrs = true, + .of_match_table = suniv_f1c100s_ccu_ids, + }, +}; +module_platform_driver(suniv_f1c100s_ccu_driver); + +MODULE_LICENSE("GPL"); From patchwork Wed Sep 1 05:05:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12468291 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E18EC4320A for ; Wed, 1 Sep 2021 05:05:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5475361057 for ; Wed, 1 Sep 2021 05:05:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241972AbhIAFGk (ORCPT ); Wed, 1 Sep 2021 01:06:40 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:38075 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241935AbhIAFGd (ORCPT ); Wed, 1 Sep 2021 01:06:33 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 31C435C01E7; Wed, 1 Sep 2021 01:05:37 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 01 Sep 2021 01:05:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=8mv7j7KBB2uyL uFOCm+bMLa9wn2hDUe88jDS++BBLho=; b=hLu5bHfXW02pnPQBlZo4z8o9ae40K 3CcPEQr1WDBWJSMZ33oNT7wAb8hp+B0sFDi43jOy/JdZZuq/DJBSTaLI/4tOVzpL 1Lq1zoPay8gKlF96yCQkSH3umLfWbRtA8PXfaqaMqWK+ux9hcyAR8+oN4fFPrMWp 3WEXmgnSgbHVWnuaLMbzz6yroWAZKAiWwowKC+BW+Iyhczm4CyVbMteeNGEmGkJl RINLAE5bfdC4Qvye6Tjm7fl6HPdj+yh/qxa+po2QUP5nc19ePTbPLsDLlP4Jy4Uj Gxf9k+JUmiZZOX4DJRglxH9jNjCTYCYMTf0Hl9wMztWSzZ+Q9b8YKKQXw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=8mv7j7KBB2uyLuFOCm+bMLa9wn2hDUe88jDS++BBLho=; b=qV/BSfYw sTQPivtDv+FEiKiOROdbRYjFw9NJ4OI5fIF8ZitvYxtIUjn3JWbxy7at04VEg20M yTgJ29Mn/C7ZZqv9k3M/Us7T9NTv0zEY9WLOcBoUlByxOvVForObpmLKY4Ez6MWA P/ifzbK+R3pDQ3JSutzbn244VCEbUEWrW0pMJjut3T1sM8KNeeCcGPUqjN6E8xjU BvtvUri6b85hDbjiV11ecJYW2usvJSP03HJdgYizo/9U1tmes/2L7Kg6BUYr+B1f uxKkj8ZmfiJMMTgDJs0laplMeDf/RrlZDkkvOQKUZEeW9v22Dvgh0EfVytliS+ne zaE+iLDlB9FC9g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvvddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Sep 2021 01:05:36 -0400 (EDT) From: Samuel Holland To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Michael Turquette , Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Samuel Holland Subject: [PATCH 8/8] clk: sunxi-ng: Allow the CCU core to be built as a module Date: Wed, 1 Sep 2021 00:05:26 -0500 Message-Id: <20210901050526.45673-9-samuel@sholland.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210901050526.45673-1-samuel@sholland.org> References: <20210901050526.45673-1-samuel@sholland.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Like the individual CCU drivers, it can be beneficial for memory consumption of cross-platform configurations to only load the CCU core on the relevant platform. For example, a generic arm64 kernel sees the following improvement when building the CCU core and drivers as modules: before: text data bss dec hex filename 13882360 5251670 360800 19494830 12977ae vmlinux after: text data bss dec hex filename 13734787 5086442 360800 19182029 124b1cd vmlinux So the result is a 390KB total reduction in kernel image size. The one early clock provider (sun5i) requires the core to be built in. Now that loading the MMC driver will trigger loading the CCU core, the MMC timing mode functions do not need a compile-time fallback. Signed-off-by: Samuel Holland --- drivers/clk/Makefile | 2 +- drivers/clk/sunxi-ng/Kconfig | 3 ++- drivers/clk/sunxi-ng/Makefile | 33 +++++++++++++++++-------------- drivers/clk/sunxi-ng/ccu_common.c | 3 +++ drivers/mmc/host/Kconfig | 1 + include/linux/clk/sunxi-ng.h | 15 -------------- 6 files changed, 25 insertions(+), 32 deletions(-) diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 2b91d34c582b..009c4b41a45a 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -110,7 +110,7 @@ obj-$(CONFIG_PLAT_SPEAR) += spear/ obj-y += sprd/ obj-$(CONFIG_ARCH_STI) += st/ obj-$(CONFIG_ARCH_SUNXI) += sunxi/ -obj-$(CONFIG_SUNXI_CCU) += sunxi-ng/ +obj-y += sunxi-ng/ obj-$(CONFIG_ARCH_TEGRA) += tegra/ obj-y += ti/ obj-$(CONFIG_CLK_UNIPHIER) += uniphier/ diff --git a/drivers/clk/sunxi-ng/Kconfig b/drivers/clk/sunxi-ng/Kconfig index cbae3612a9ef..ee383658ff4d 100644 --- a/drivers/clk/sunxi-ng/Kconfig +++ b/drivers/clk/sunxi-ng/Kconfig @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only config SUNXI_CCU - bool "Clock support for Allwinner SoCs" + tristate "Clock support for Allwinner SoCs" depends on ARCH_SUNXI || COMPILE_TEST select RESET_CONTROLLER default ARCH_SUNXI @@ -52,6 +52,7 @@ config SUN5I_CCU bool "Support for the Allwinner sun5i family CCM" default MACH_SUN5I depends on MACH_SUN5I || COMPILE_TEST + depends on SUNXI_CCU=y config SUN6I_A31_CCU tristate "Support for the Allwinner A31/A31s CCU" diff --git a/drivers/clk/sunxi-ng/Makefile b/drivers/clk/sunxi-ng/Makefile index 9ebf5920c93b..6e9eb004fca0 100644 --- a/drivers/clk/sunxi-ng/Makefile +++ b/drivers/clk/sunxi-ng/Makefile @@ -1,24 +1,27 @@ # SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_SUNXI_CCU) += sunxi-ccu.o + # Common objects -obj-y += ccu_common.o -obj-y += ccu_mmc_timing.o -obj-y += ccu_reset.o +sunxi-ccu-y += ccu_common.o +sunxi-ccu-y += ccu_mmc_timing.o +sunxi-ccu-y += ccu_reset.o # Base clock types -obj-y += ccu_div.o -obj-y += ccu_frac.o -obj-y += ccu_gate.o -obj-y += ccu_mux.o -obj-y += ccu_mult.o -obj-y += ccu_phase.o -obj-y += ccu_sdm.o +sunxi-ccu-y += ccu_div.o +sunxi-ccu-y += ccu_frac.o +sunxi-ccu-y += ccu_gate.o +sunxi-ccu-y += ccu_mux.o +sunxi-ccu-y += ccu_mult.o +sunxi-ccu-y += ccu_phase.o +sunxi-ccu-y += ccu_sdm.o # Multi-factor clocks -obj-y += ccu_nk.o -obj-y += ccu_nkm.o -obj-y += ccu_nkmp.o -obj-y += ccu_nm.o -obj-y += ccu_mp.o +sunxi-ccu-y += ccu_nk.o +sunxi-ccu-y += ccu_nkm.o +sunxi-ccu-y += ccu_nkmp.o +sunxi-ccu-y += ccu_nm.o +sunxi-ccu-y += ccu_mp.o # SoC support obj-$(CONFIG_SUNIV_F1C100S_CCU) += suniv-f1c100s-ccu.o diff --git a/drivers/clk/sunxi-ng/ccu_common.c b/drivers/clk/sunxi-ng/ccu_common.c index 3ab109582646..d9619ad32f5c 100644 --- a/drivers/clk/sunxi-ng/ccu_common.c +++ b/drivers/clk/sunxi-ng/ccu_common.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "ccu_common.h" @@ -213,3 +214,5 @@ void of_sunxi_ccu_probe(struct device_node *node, void __iomem *reg, kfree(ccu); } } + +MODULE_LICENSE("GPL"); diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 71313961cc54..1247c9455dea 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -964,6 +964,7 @@ config MMC_REALTEK_USB config MMC_SUNXI tristate "Allwinner sunxi SD/MMC Host Controller support" depends on ARCH_SUNXI || COMPILE_TEST + depends on SUNXI_CCU help This selects support for the SD/MMC Host Controller on Allwinner sunxi SoCs. diff --git a/include/linux/clk/sunxi-ng.h b/include/linux/clk/sunxi-ng.h index 3cd14acde0a1..cf32123b39f5 100644 --- a/include/linux/clk/sunxi-ng.h +++ b/include/linux/clk/sunxi-ng.h @@ -6,22 +6,7 @@ #ifndef _LINUX_CLK_SUNXI_NG_H_ #define _LINUX_CLK_SUNXI_NG_H_ -#include - -#ifdef CONFIG_SUNXI_CCU int sunxi_ccu_set_mmc_timing_mode(struct clk *clk, bool new_mode); int sunxi_ccu_get_mmc_timing_mode(struct clk *clk); -#else -static inline int sunxi_ccu_set_mmc_timing_mode(struct clk *clk, - bool new_mode) -{ - return -ENOTSUPP; -} - -static inline int sunxi_ccu_get_mmc_timing_mode(struct clk *clk) -{ - return -ENOTSUPP; -} -#endif #endif