clk: sunxi-ng: Lifetime fixes and module support
Subsystems (3)
Samuel Holland
maintainercover clk: sunxi-ng: Lifetime fixes and module support
This series makes the CCU drivers a bit better behaved, by allowing them to be cleanly loaded/unloaded and bound/unbound without leaking memory or crashing.
- Patches 1 fixes some object lifetime and reference counting issues with the drivers.
- Patch 2 disarms a sysfs footgun.
- Patch 3 takes advantage of the structure added in patch 1 to improve performance a bit by splitting up the lock.
- Patches 4-8 allow the drivers and CCU core to be built as modules. As part of this, patch 7 converts most of the early OF providers to platform drivers.
Samuel Holland (8):
clk: sunxi-ng: Unregister clocks/resets when unbinding
clk: sunxi-ng: Prevent unbinding CCUs via sysfs
clk: sunxi-ng: Use a separate lock for each CCU instance
clk: sunxi-ng: Rename files to match Kconfig and drivers
clk: sunxi-ng: Export symbols used by CCU drivers
clk: sunxi-ng: Allow drivers to be built as modules
clk: sunxi-ng: Convert early providers to platform drivers
clk: sunxi-ng: Allow the CCU core to be built as a module
drivers/clk/Makefile | 2 +-
drivers/clk/sunxi-ng/Kconfig | 39 +++----
drivers/clk/sunxi-ng/Makefile | 75 ++++++-------
drivers/clk/sunxi-ng/ccu_common.c | 101 +++++++++++++++---
drivers/clk/sunxi-ng/ccu_common.h | 6 +-
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 +
.../{ccu-sun4i-a10.c => sun4i-a10-ccu.c} | 59 ++++++----
.../{ccu-sun4i-a10.h => sun4i-a10-ccu.h} | 0
.../{ccu-sun50i-a100.c => sun50i-a100-ccu.c} | 8 +-
.../{ccu-sun50i-a100.h => sun50i-a100-ccu.h} | 0
...cu-sun50i-a100-r.c => sun50i-a100-r-ccu.c} | 8 +-
...cu-sun50i-a100-r.h => sun50i-a100-r-ccu.h} | 0
.../{ccu-sun50i-a64.c => sun50i-a64-ccu.c} | 11 +-
.../{ccu-sun50i-a64.h => sun50i-a64-ccu.h} | 0
.../{ccu-sun50i-h6.c => sun50i-h6-ccu.c} | 11 +-
.../{ccu-sun50i-h6.h => sun50i-h6-ccu.h} | 0
.../{ccu-sun50i-h6-r.c => sun50i-h6-r-ccu.c} | 57 ++++++----
.../{ccu-sun50i-h6-r.h => sun50i-h6-r-ccu.h} | 0
.../{ccu-sun50i-h616.c => sun50i-h616-ccu.c} | 36 ++++---
.../{ccu-sun50i-h616.h => sun50i-h616-ccu.h} | 0
.../clk/sunxi-ng/{ccu-sun5i.c => sun5i-ccu.c} | 4 +-
.../clk/sunxi-ng/{ccu-sun5i.h => sun5i-ccu.h} | 0
.../{ccu-sun6i-a31.c => sun6i-a31-ccu.c} | 41 +++++--
.../{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} | 36 +++++--
.../{ccu-sun8i-a33.c => sun8i-a33-ccu.c} | 41 +++++--
.../{ccu-sun8i-a83t.c => sun8i-a83t-ccu.c} | 11 +-
.../{ccu-sun8i-a83t.h => sun8i-a83t-ccu.h} | 0
.../{ccu-sun8i-de2.c => sun8i-de2-ccu.c} | 12 ++-
.../{ccu-sun8i-de2.h => sun8i-de2-ccu.h} | 0
.../{ccu-sun8i-h3.c => sun8i-h3-ccu.c} | 63 +++++++----
.../{ccu-sun8i-h3.h => sun8i-h3-ccu.h} | 0
.../sunxi-ng/{ccu-sun8i-r.c => sun8i-r-ccu.c} | 66 +++++++-----
.../sunxi-ng/{ccu-sun8i-r.h => sun8i-r-ccu.h} | 0
.../{ccu-sun8i-r40.c => sun8i-r40-ccu.c} | 10 +-
.../{ccu-sun8i-r40.h => sun8i-r40-ccu.h} | 0
.../{ccu-sun8i-v3s.c => sun8i-v3s-ccu.c} | 58 ++++++----
.../{ccu-sun8i-v3s.h => sun8i-v3s-ccu.h} | 0
.../{ccu-sun9i-a80.c => sun9i-a80-ccu.c} | 11 +-
.../{ccu-sun9i-a80.h => sun9i-a80-ccu.h} | 0
...{ccu-sun9i-a80-de.c => sun9i-a80-de-ccu.c} | 12 ++-
...{ccu-sun9i-a80-de.h => sun9i-a80-de-ccu.h} | 0
...cu-sun9i-a80-usb.c => sun9i-a80-usb-ccu.c} | 11 +-
...cu-sun9i-a80-usb.h => sun9i-a80-usb-ccu.h} | 0
...cu-suniv-f1c100s.c => suniv-f1c100s-ccu.c} | 39 +++++--
...cu-suniv-f1c100s.h => suniv-f1c100s-ccu.h} | 0
drivers/mmc/host/Kconfig | 1 +
include/linux/clk/sunxi-ng.h | 15 ---
59 files changed, 551 insertions(+), 306 deletions(-)
rename drivers/clk/sunxi-ng/{ccu-sun4i-a10.c => sun4i-a10-ccu.c} (98%)
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} (97%)
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} (87%)
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} (98%)
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} (98%)
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} (97%)
rename drivers/clk/sunxi-ng/{ccu-sun8i-a33.c => sun8i-a33-ccu.c} (97%)
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} (98%)
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} (97%)
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} (87%)
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} (96%)
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} (97%)
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} (95%)
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} (96%)
rename drivers/clk/sunxi-ng/{ccu-suniv-f1c100s.h => suniv-f1c100s-ccu.h} (100%)Signature · 1 line
2.31.1
Samuel Holland
maintainerPATCH 1/8 clk: sunxi-ng: Unregister clocks/resets when unbinding
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.
--- 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(-)
drivers/clk/sunxi-ng/ccu-sun4i-a10.c +1 -1
@@ -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)
drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c +1 -1
@@ -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[] = {
drivers/clk/sunxi-ng/ccu-sun50i-a100.c +1 -1
@@ -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;
drivers/clk/sunxi-ng/ccu-sun50i-a64.c +1 -1
@@ -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;
drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c +1 -1
@@ -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)
drivers/clk/sunxi-ng/ccu-sun50i-h6.c +1 -1
@@ -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[] = {
drivers/clk/sunxi-ng/ccu-sun50i-h616.c +1 -3
@@ -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",
drivers/clk/sunxi-ng/ccu-sun5i.c +1 -1
@@ -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)
drivers/clk/sunxi-ng/ccu-sun6i-a31.c +1 -1
@@ -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);
drivers/clk/sunxi-ng/ccu-sun8i-a23.c +1 -1
@@ -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);
drivers/clk/sunxi-ng/ccu-sun8i-a33.c +1 -1
@@ -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);
drivers/clk/sunxi-ng/ccu-sun8i-a83t.c +1 -1
@@ -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[] = {
drivers/clk/sunxi-ng/ccu-sun8i-de2.c +1 -1
@@ -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;
drivers/clk/sunxi-ng/ccu-sun8i-h3.c +1 -1
@@ -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);
drivers/clk/sunxi-ng/ccu-sun8i-r.c +1 -1
@@ -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)
drivers/clk/sunxi-ng/ccu-sun8i-r40.c +1 -1
@@ -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;
drivers/clk/sunxi-ng/ccu-sun8i-v3s.c +1 -1
@@ -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)
drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c +1 -2
@@ -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;
drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c +1 -2
@@ -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;
drivers/clk/sunxi-ng/ccu-sun9i-a80.c +1 -1
@@ -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[] = {
drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c +1 -1
@@ -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);
drivers/clk/sunxi-ng/ccu_common.c +75 -14
137 lines not on this page · raw message
drivers/clk/sunxi-ng/ccu_common.h +4 -2
@@ -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_ */
Signature · 1 line
2.31.1
Samuel Holland
maintainerPATCH 2/8 clk: sunxi-ng: Prevent unbinding CCUs via sysfs
In reply to Samuel HollandThe 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.
--- 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(+)
drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c +1 -0
@@ -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, }, };
drivers/clk/sunxi-ng/ccu-sun50i-a100.c +1 -0
@@ -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, }, };
drivers/clk/sunxi-ng/ccu-sun50i-a64.c +1 -0
@@ -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, }, };
drivers/clk/sunxi-ng/ccu-sun50i-h6.c +1 -0
@@ -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, }, };
drivers/clk/sunxi-ng/ccu-sun8i-a83t.c +1 -0
@@ -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, }, };
drivers/clk/sunxi-ng/ccu-sun8i-r40.c +1 -0
@@ -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, }, };
drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c +1 -0
@@ -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, }, };
drivers/clk/sunxi-ng/ccu-sun9i-a80.c +1 -0
@@ -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, }, };
Signature · 1 line
2.31.1
Samuel Holland
maintainerPATCH 3/8 clk: sunxi-ng: Use a separate lock for each CCU instance
In reply to Samuel HollandSome 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.
--- drivers/clk/sunxi-ng/ccu_common.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/clk/sunxi-ng/ccu_common.c +5 -4
@@ -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);
Signature · 1 line
2.31.1
Re: [PATCH 3/8] clk: sunxi-ng: Use a separate lock for each CCU instance
Quoted 6 lines · Samuel Holland
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 <[email protected]>
Applied the first three patches
Maxime
Samuel Holland
maintainerPATCH 4/8 clk: sunxi-ng: Rename files to match Kconfig and drivers
In reply to Samuel HollandWhen 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.
---
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%)drivers/clk/sunxi-ng/Makefile +21 -21
@@ -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
drivers/clk/sunxi-ng/sun4i-a10-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun4i-a10.c +1 -1
@@ -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 ),
drivers/clk/sunxi-ng/sun4i-a10-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun4i-a10.h +0 -0
drivers/clk/sunxi-ng/sun50i-a100-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun50i-a100.c +1 -1
@@ -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)
drivers/clk/sunxi-ng/sun50i-a100-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun50i-a100.h +0 -0
drivers/clk/sunxi-ng/sun50i-a100-r-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c +1 -1
@@ -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" };
drivers/clk/sunxi-ng/sun50i-a100-r-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun50i-a100-r.h +0 -0
drivers/clk/sunxi-ng/sun50i-a64-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun50i-a64.c +1 -1
@@ -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 ),
drivers/clk/sunxi-ng/sun50i-a64-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun50i-a64.h +0 -0
drivers/clk/sunxi-ng/sun50i-h6-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun50i-h6.c +1 -1
@@ -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
drivers/clk/sunxi-ng/sun50i-h6-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun50i-h6.h +0 -0
drivers/clk/sunxi-ng/sun50i-h6-r-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c +1 -1
@@ -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
drivers/clk/sunxi-ng/sun50i-h6-r-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun50i-h6-r.h +0 -0
drivers/clk/sunxi-ng/sun50i-h616-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun50i-h616.c +1 -1
@@ -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
drivers/clk/sunxi-ng/sun50i-h616-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun50i-h616.h +0 -0
drivers/clk/sunxi-ng/sun5i-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun5i.c +1 -1
@@ -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 ),
drivers/clk/sunxi-ng/sun5i-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun5i.h +0 -0
drivers/clk/sunxi-ng/sun6i-a31-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun6i-a31.c +1 -1
@@ -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,
drivers/clk/sunxi-ng/sun6i-a31-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun6i-a31.h +0 -0
drivers/clk/sunxi-ng/sun8i-a23-a33-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun8i-a23-a33.h +0 -0
drivers/clk/sunxi-ng/sun8i-a23-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun8i-a23.c +1 -1
@@ -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 = {
drivers/clk/sunxi-ng/sun8i-a33-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun8i-a33.c +1 -1
@@ -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 ),
drivers/clk/sunxi-ng/sun8i-a83t-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun8i-a83t.c +1 -1
@@ -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
drivers/clk/sunxi-ng/sun8i-a83t-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun8i-a83t.h +0 -0
drivers/clk/sunxi-ng/sun8i-de2-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun8i-de2.c +1 -1
@@ -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);
drivers/clk/sunxi-ng/sun8i-de2-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun8i-de2.h +0 -0
drivers/clk/sunxi-ng/sun8i-h3-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun8i-h3.c +1 -1
@@ -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,
drivers/clk/sunxi-ng/sun8i-h3-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun8i-h3.h +0 -0
drivers/clk/sunxi-ng/sun8i-r-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun8i-r.c +1 -1
@@ -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" },
drivers/clk/sunxi-ng/sun8i-r-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun8i-r.h +0 -0
drivers/clk/sunxi-ng/sun8i-r40-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun8i-r40.c +1 -1
@@ -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 = {
drivers/clk/sunxi-ng/sun8i-r40-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun8i-r40.h +0 -0
drivers/clk/sunxi-ng/sun8i-v3s-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun8i-v3s.c +1 -1
@@ -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,
drivers/clk/sunxi-ng/sun8i-v3s-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun8i-v3s.h +0 -0
drivers/clk/sunxi-ng/sun9i-a80-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun9i-a80.c +1 -1
@@ -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
drivers/clk/sunxi-ng/sun9i-a80-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun9i-a80.h +0 -0
drivers/clk/sunxi-ng/sun9i-a80-de-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c +1 -1
@@ -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);
drivers/clk/sunxi-ng/sun9i-a80-de-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun9i-a80-de.h +0 -0
drivers/clk/sunxi-ng/sun9i-a80-usb-ccu.c renamed from drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c +1 -1
@@ -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" },
drivers/clk/sunxi-ng/sun9i-a80-usb-ccu.h renamed from drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.h +0 -0
drivers/clk/sunxi-ng/suniv-f1c100s-ccu.c renamed from drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c +1 -1
@@ -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 ),
drivers/clk/sunxi-ng/suniv-f1c100s-ccu.h renamed from drivers/clk/sunxi-ng/ccu-suniv-f1c100s.h +0 -0
Signature · 1 line
2.31.1
Re: [PATCH 4/8] clk: sunxi-ng: Rename files to match Kconfig and drivers
Hi,
Quoted 5 lines · Samuel Holland
When the drivers are built as modules, the file name will become the module name. Rename the files so everything matches: the
Kconfigsymbol, the platform driver name (as seen in sysfs), and the module name.Signed-off-by Samuel Holland <[email protected]>
I'm not a big fan of big renames like this, it makes merging and backporting patches harder in the long term.
I assume you did this to make the module autoloading work? If so, using MODULE_ALIAS would be less intrusive
Maxime
Samuel Holland
maintainerRe: [PATCH 4/8] clk: sunxi-ng: Rename files to match Kconfig and drivers
Hi Maxime,
Quoted 11 lines · Maxime Ripard
Hi,
Quoted 5 lines · Samuel Holland
When the drivers are built as modules, the file name will become the module name. Rename the files so everything matches: the
Kconfigsymbol, the platform driver name (as seen in sysfs), and the module name.Signed-off-by Samuel Holland <[email protected]>I'm not a big fan of big renames like this, it makes merging and backporting patches harder in the long term.
I can split this into two commits, first the .c files and then the .h files, so everything is a 100% rename, if that makes a difference.
Quoted 2 lines
I assume you did this to make the module autoloading work? If so, using
MODULE_ALIASwould be less intrusive
Autoloading should work anyway, since there is a module alias for the compatible string. This change is more about the principle of least surprise. The compatible is allwinner,sun50i-a64-ccu, the Kconfig symbol is SUN50I_A64_CCU, the driver name (in /sys/bus/platform/drivers) is sun50i_a64_ccu, but yet the module name is ccu-sun50i-a64???
Once we allow building modules, the names are ABI, and this inconsistency will bother me until the end of time :)
If there is a way to completely rename the module without renaming the files (not adding an alias), then that would be enough for me.
Regards,
Samuel
Stephen Boyd
maintainerRe: [PATCH 4/8] clk: sunxi-ng: Rename files to match Kconfig and drivers
Quoting Samuel Holland (2021-09-03 13:57:14)
Quoted 27 lines
Hi Maxime,
Quoted 11 lines · Maxime Ripard
Hi,
Quoted 5 lines · Samuel Holland
When the drivers are built as modules, the file name will become the module name. Rename the files so everything matches: the
Kconfigsymbol, the platform driver name (as seen in sysfs), and the module name.Signed-off-by Samuel Holland <[email protected]>I'm not a big fan of big renames like this, it makes merging and backporting patches harder in the long term.
I can split this into two commits, first the .c files and then the .h files, so everything is a 100% rename, if that makes a difference.
Quoted 2 lines
I assume you did this to make the module autoloading work? If so, using
MODULE_ALIASwould be less intrusiveAutoloading should work anyway, since there is a module alias for the compatible string. This change is more about the principle of least surprise. The compatible is allwinner,sun50i-a64-ccu, the
Kconfigsymbol isSUN50I_A64_CCU, the driver name (in/sys/bus/platform/drivers) issun50i_a64_ccu, but yet the module name is ccu-sun50i-a64???
Quoted 5 lines
Once we allow building modules, the names are ABI, and this inconsistency will bother me until the end of time :)
If there is a way to completely rename the module without renaming the files (not adding an alias), then that would be enough for me.
Yes. You have to use Makefile logic to make an object manually that renames the old one. The linker will build oldname.o as new-module-name.o and then make a .ko out of it if the final goal is a module.
new-module-name-y := oldname.o obj-$(CONFIG_YOUR_SYMBOL_HERE) += new-module-name.o
Re: [PATCH 4/8] clk: sunxi-ng: Rename files to match Kconfig and drivers
In reply to Samuel HollandHi,
Quoted 18 lines · Samuel Holland
Hi Maxime,
Quoted 11 lines · Maxime Ripard
Hi,
Quoted 5 lines · Samuel Holland
When the drivers are built as modules, the file name will become the module name. Rename the files so everything matches: the
Kconfigsymbol, the platform driver name (as seen in sysfs), and the module name.Signed-off-by Samuel Holland <[email protected]>I'm not a big fan of big renames like this, it makes merging and backporting patches harder in the long term.
I can split this into two commits, first the .c files and then the .h files, so everything is a 100% rename, if that makes a difference.
Quoted 8 lines
Quoted 2 lines
I assume you did this to make the module autoloading work? If so, using
MODULE_ALIASwould be less intrusiveAutoloading should work anyway, since there is a module alias for the compatible string. This change is more about the principle of least surprise. The compatible is allwinner,sun50i-a64-ccu, the
Kconfigsymbol isSUN50I_A64_CCU, the driver name (in/sys/bus/platform/drivers) issun50i_a64_ccu, but yet the module name is ccu-sun50i-a64???
We can't really do much for the compatible, and it's the standard practice there anyway. However, it looks much more common for Kconfig to have a pattern like $FRAMEWORK_$SOC, so maybe we could just rename the Kconfig (and drivers name) to CCU_SUN50I_A64? It's not been exposed to the defconfig so far anyway, so we can change them without any real harm
Quoted 5 lines
Once we allow building modules, the names are ABI, and this inconsistency will bother me until the end of time :)
If there is a way to completely rename the module without renaming the files (not adding an alias), then that would be enough for me.
Otherwise, yeah, we can do what Stephen suggested
Maxime
Samuel Holland
maintainerPATCH 5/8 clk: sunxi-ng: Export symbols used by CCU drivers
In reply to Samuel HollandFor 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.
--- 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(+)
drivers/clk/sunxi-ng/ccu_common.c +2 -0
@@ -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)
drivers/clk/sunxi-ng/ccu_div.c +1 -0
@@ -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);
drivers/clk/sunxi-ng/ccu_gate.c +1 -0
@@ -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);
drivers/clk/sunxi-ng/ccu_mp.c +2 -0
@@ -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);
drivers/clk/sunxi-ng/ccu_mult.c +1 -0
@@ -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);
drivers/clk/sunxi-ng/ccu_mux.c +2 -0
@@ -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);
drivers/clk/sunxi-ng/ccu_nk.c +1 -0
@@ -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);
drivers/clk/sunxi-ng/ccu_nkm.c +1 -0
@@ -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);
drivers/clk/sunxi-ng/ccu_nkmp.c +1 -0
@@ -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);
drivers/clk/sunxi-ng/ccu_nm.c +1 -0
@@ -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);
drivers/clk/sunxi-ng/ccu_phase.c +1 -0
@@ -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);
drivers/clk/sunxi-ng/ccu_reset.c +1 -0
@@ -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);
Signature · 1 line
2.31.1
Re: [PATCH 5/8] clk: sunxi-ng: Export symbols used by CCU drivers
Quoted 28 lines · Samuel Holland
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_probeis not exported, because it is only used for built-in early OF clock providers.Signed-off-by Samuel Holland <[email protected]>--- 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(+)drivers/clk/sunxi-ng/ccu_common.c +0
-0
drivers/clk/sunxi-ng/ccu_common.c int ccu_pll_notifier_register(struct ccu_pll_nb *pll_nb) · line 86
Quoted 4 lines
drivers/clk/sunxi-ng/ccu_common.c +1
-0@@ -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);
These symbol names aren't exactly specific to sunxi. Maybe we could apply symbol namespaces?
ChenYu
Samuel Holland
maintainerPATCH 6/8 clk: sunxi-ng: Allow drivers to be built as modules
In reply to Samuel HollandWhile 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.
--- 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(-)
drivers/clk/sunxi-ng/Kconfig +8 -8
@@ -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
drivers/clk/sunxi-ng/sun50i-a100-ccu.c +2 -1
@@ -6,7 +6,6 @@#include <linux/clk-provider.h> #include <linux/io.h> #include <linux/module.h> -#include <linux/of_address.h> #include <linux/platform_device.h> #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" );
drivers/clk/sunxi-ng/sun50i-a100-r-ccu.c +2 -1
@@ -5,7 +5,6 @@#include <linux/clk-provider.h> #include <linux/module.h> -#include <linux/of_address.h> #include <linux/platform_device.h> #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" );
drivers/clk/sunxi-ng/sun50i-a64-ccu.c +4 -2
@@ -5,7 +5,7 @@#include <linux/clk-provider.h> #include <linux/io.h> -#include <linux/of_address.h> +#include <linux/module.h> #include <linux/platform_device.h> #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" );
drivers/clk/sunxi-ng/sun50i-h6-ccu.c +4 -2
@@ -5,7 +5,7 @@#include <linux/clk-provider.h> #include <linux/io.h> -#include <linux/of_address.h> +#include <linux/module.h> #include <linux/platform_device.h> #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" );
drivers/clk/sunxi-ng/sun8i-a83t-ccu.c +4 -2
@@ -5,7 +5,7 @@#include <linux/clk-provider.h> #include <linux/io.h> -#include <linux/of_address.h> +#include <linux/module.h> #include <linux/platform_device.h> #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" );
drivers/clk/sunxi-ng/sun8i-de2-ccu.c +5 -3
@@ -5,8 +5,8 @@#include <linux/clk.h> #include <linux/clk-provider.h> -#include <linux/of_address.h> -#include <linux/of_platform.h> +#include <linux/module.h> +#include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/reset.h>
@@ -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" );
drivers/clk/sunxi-ng/sun8i-r40-ccu.c +4 -1
@@ -5,6 +5,7 @@#include <linux/clk-provider.h> #include <linux/io.h> +#include <linux/module.h> #include <linux/platform_device.h> #include <linux/regmap.h>
@@ -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" );
drivers/clk/sunxi-ng/sun9i-a80-ccu.c +4 -2
@@ -5,7 +5,7 @@#include <linux/clk-provider.h> #include <linux/io.h> -#include <linux/of_address.h> +#include <linux/module.h> #include <linux/platform_device.h> #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" );
drivers/clk/sunxi-ng/sun9i-a80-de-ccu.c +4 -2
@@ -5,7 +5,7 @@#include <linux/clk.h> #include <linux/clk-provider.h> -#include <linux/of_address.h> +#include <linux/module.h> #include <linux/platform_device.h> #include <linux/reset.h>
@@ -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" );
drivers/clk/sunxi-ng/sun9i-a80-usb-ccu.c +4 -2
@@ -5,7 +5,7 @@#include <linux/clk.h> #include <linux/clk-provider.h> -#include <linux/of_address.h> +#include <linux/module.h> #include <linux/platform_device.h> #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" );
Signature · 1 line
2.31.1
Samuel Holland
maintainerPATCH 7/8 clk: sunxi-ng: Convert early providers to platform drivers
In reply to Samuel HollandThe 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.
--- 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(-)
drivers/clk/sunxi-ng/Kconfig +10 -10
@@ -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
drivers/clk/sunxi-ng/sun4i-a10-ccu.c +35 -22
79 lines not on this page · raw message
drivers/clk/sunxi-ng/sun50i-h6-r-ccu.c +34 -21
71 lines not on this page · raw message
drivers/clk/sunxi-ng/sun50i-h616-ccu.c +22 -10
@@ -7,7 +7,7 @@#include <linux/clk-provider.h> #include <linux/io.h> -#include <linux/of_address.h> +#include <linux/module.h> #include <linux/platform_device.h> #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" );
drivers/clk/sunxi-ng/sun6i-a31-ccu.c +29 -10
@@ -9,7 +9,8 @@#include <linux/clk-provider.h> #include <linux/io.h> -#include <linux/of_address.h> +#include <linux/module.h> +#include <linux/platform_device.h> #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" );
drivers/clk/sunxi-ng/sun8i-a23-ccu.c +24 -10
@@ -5,7 +5,8 @@#include <linux/clk-provider.h> #include <linux/io.h> -#include <linux/of_address.h> +#include <linux/module.h> +#include <linux/platform_device.h> #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" );
drivers/clk/sunxi-ng/sun8i-a33-ccu.c +29 -10
@@ -5,7 +5,8 @@#include <linux/clk-provider.h> #include <linux/io.h> -#include <linux/of_address.h> +#include <linux/module.h> +#include <linux/platform_device.h> #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" );
drivers/clk/sunxi-ng/sun8i-h3-ccu.c +40 -21
89 lines not on this page · raw message
drivers/clk/sunxi-ng/sun8i-r-ccu.c +37 -27
81 lines not on this page · raw message
drivers/clk/sunxi-ng/sun8i-v3s-ccu.c +34 -22
79 lines not on this page · raw message
drivers/clk/sunxi-ng/suniv-f1c100s-ccu.c +28 -9
@@ -6,7 +6,8 @@#include <linux/clk-provider.h> #include <linux/io.h> -#include <linux/of_address.h> +#include <linux/module.h> +#include <linux/platform_device.h> #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" );
Signature · 1 line
2.31.1
Re: [PATCH 7/8] clk: sunxi-ng: Convert early providers to platform drivers
Hi,
Quoted 11 lines · Samuel Holland
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_devlinkwill ensure the drivers are bound in the optimal order.
Quoted 5 lines
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 <[email protected]>
The patch looks great to me, thanks for doing this work
I'm surprised you were able to convert the A10 and F1C100S as well, since they don't have the arch timer.
It seems we only use the fixed 24MHz clock on the A10 for the timer and the interrupt controller doesn't have a parent clock, so it works. The A10 timer can be fed with one PLL though and would require that dependency, but I guess no one ever cared. It's easy enough to revert if someone complains anyway.
Maxime
Samuel Holland
maintainerPATCH 8/8 clk: sunxi-ng: Allow the CCU core to be built as a module
In reply to Samuel HollandLike 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 vmlinuxafter:
text data bss dec hex filename
13734787 5086442 360800 19182029 124b1cd vmlinuxSo 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.
--- 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(-)
drivers/clk/Makefile +1 -1
@@ -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/
drivers/clk/sunxi-ng/Kconfig +2 -1
@@ -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"
drivers/clk/sunxi-ng/Makefile +18 -15
@@ -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
drivers/clk/sunxi-ng/ccu_common.c +3 -0
@@ -9,6 +9,7 @@#include <linux/clk-provider.h> #include <linux/device.h> #include <linux/iopoll.h> +#include <linux/module.h> #include <linux/slab.h> #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" );
drivers/mmc/host/Kconfig +1 -0
@@ -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.
include/linux/clk/sunxi-ng.h +0 -15
@@ -6,22 +6,7 @@#ifndef _LINUX_CLK_SUNXI_NG_H_#define _LINUX_CLK_SUNXI_NG_H_ -#include <linux/errno.h> - -#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
Signature · 1 line
2.31.1