Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

m68k: coldfire: remove private clk_get/clk_put

Only three SoCs remain that use the custom clk_get/clk_put.
Move these over to clkdev_lookup tables as well. As before,
treat the "sys.0" and "pll.0" clocks as system-wide clocks,
and all the other ones as device specific.

The "name" field in 'struct clock' is now unused, so rename
that as well as a cleanup and to reduce the object code size.
The DEFINE_CLK macro could be changed the same way, but it
is less churn to just leave those in place, that can be
done as a follow-up later if someone is interested.

Acked-by: Greg Ungerer <gerg@linux-m68k.org>
Tested-by: Greg Ungerer <gerg@linux-m68k.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+128 -158
+1 -4
arch/m68k/Kconfig.cpu
··· 29 29 select CPU_HAS_NO_MULDIV64 30 30 select GENERIC_CSUM 31 31 select GPIOLIB 32 + select CLKDEV_LOOKUP 32 33 select HAVE_LEGACY_CLK 33 34 34 35 endchoice ··· 328 327 config COLDFIRE_SLTIMERS 329 328 bool 330 329 select LEGACY_TIMER_TICK 331 - 332 - config COLDFIRE_CLKDEV_LOOKUP 333 - def_bool !(M5206 || M5206e || M53xx || M5441x) 334 - select CLKDEV_LOOKUP 335 330 336 331 endif # COLDFIRE 337 332
-21
arch/m68k/coldfire/clk.c
··· 71 71 .disable = __clk_disable1, 72 72 }; 73 73 #endif /* MCFPM_PPMCR1 */ 74 - 75 - struct clk *clk_get(struct device *dev, const char *id) 76 - { 77 - const char *clk_name = dev ? dev_name(dev) : id ? id : NULL; 78 - struct clk *clk; 79 - unsigned i; 80 - 81 - for (i = 0; (clk = mcf_clks[i]) != NULL; ++i) 82 - if (!strcmp(clk->name, clk_name)) 83 - return clk; 84 - pr_warn("clk_get: didn't find clock %s\n", clk_name); 85 - return ERR_PTR(-ENOENT); 86 - } 87 - EXPORT_SYMBOL(clk_get); 88 - 89 - void clk_put(struct clk *clk) 90 - { 91 - if (clk->enabled != 0) 92 - pr_warn("clk_put %s still enabled\n", clk->name); 93 - } 94 - EXPORT_SYMBOL(clk_put); 95 74 #endif /* MCFPM_PPMCR0 */ 96 75 97 76 int clk_enable(struct clk *clk)
+26 -25
arch/m68k/coldfire/m520x.c
··· 12 12 13 13 /***************************************************************************/ 14 14 15 + #include <linux/clkdev.h> 15 16 #include <linux/kernel.h> 16 17 #include <linux/param.h> 17 18 #include <linux/init.h> ··· 49 48 DEFINE_CLK(0, "gpio.0", 41, MCF_BUSCLK); 50 49 DEFINE_CLK(0, "sdram.0", 42, MCF_CLK); 51 50 52 - struct clk *mcf_clks[] = { 53 - &__clk_0_2, /* flexbus */ 54 - &__clk_0_12, /* fec.0 */ 55 - &__clk_0_17, /* edma */ 56 - &__clk_0_18, /* intc.0 */ 57 - &__clk_0_21, /* iack.0 */ 58 - &__clk_0_22, /* imx1-i2c.0 */ 59 - &__clk_0_23, /* mcfqspi.0 */ 60 - &__clk_0_24, /* mcfuart.0 */ 61 - &__clk_0_25, /* mcfuart.1 */ 62 - &__clk_0_26, /* mcfuart.2 */ 63 - &__clk_0_28, /* mcftmr.0 */ 64 - &__clk_0_29, /* mcftmr.1 */ 65 - &__clk_0_30, /* mcftmr.2 */ 66 - &__clk_0_31, /* mcftmr.3 */ 67 - 68 - &__clk_0_32, /* mcfpit.0 */ 69 - &__clk_0_33, /* mcfpit.1 */ 70 - &__clk_0_34, /* mcfeport.0 */ 71 - &__clk_0_35, /* mcfwdt.0 */ 72 - &__clk_0_36, /* pll.0 */ 73 - &__clk_0_40, /* sys.0 */ 74 - &__clk_0_41, /* gpio.0 */ 75 - &__clk_0_42, /* sdram.0 */ 76 - NULL, 51 + static struct clk_lookup m520x_clk_lookup[] = { 52 + CLKDEV_INIT(NULL, "flexbus", &__clk_0_2), 53 + CLKDEV_INIT("fec.0", NULL, &__clk_0_12), 54 + CLKDEV_INIT("edma", NULL, &__clk_0_17), 55 + CLKDEV_INIT("intc.0", NULL, &__clk_0_18), 56 + CLKDEV_INIT("iack.0", NULL, &__clk_0_21), 57 + CLKDEV_INIT("imx1-i2c.0", NULL, &__clk_0_22), 58 + CLKDEV_INIT("mcfqspi.0", NULL, &__clk_0_23), 59 + CLKDEV_INIT("mcfuart.0", NULL, &__clk_0_24), 60 + CLKDEV_INIT("mcfuart.1", NULL, &__clk_0_25), 61 + CLKDEV_INIT("mcfuart.2", NULL, &__clk_0_26), 62 + CLKDEV_INIT("mcftmr.0", NULL, &__clk_0_28), 63 + CLKDEV_INIT("mcftmr.1", NULL, &__clk_0_29), 64 + CLKDEV_INIT("mcftmr.2", NULL, &__clk_0_30), 65 + CLKDEV_INIT("mcftmr.3", NULL, &__clk_0_31), 66 + CLKDEV_INIT("mcfpit.0", NULL, &__clk_0_32), 67 + CLKDEV_INIT("mcfpit.1", NULL, &__clk_0_33), 68 + CLKDEV_INIT("mcfeport.0", NULL, &__clk_0_34), 69 + CLKDEV_INIT("mcfwdt.0", NULL, &__clk_0_35), 70 + CLKDEV_INIT(NULL, "pll.0", &__clk_0_36), 71 + CLKDEV_INIT(NULL, "sys.0", &__clk_0_40), 72 + CLKDEV_INIT("gpio.0", NULL, &__clk_0_41), 73 + CLKDEV_INIT("sdram.0", NULL, &__clk_0_42), 77 74 }; 78 75 79 76 static struct clk * const enable_clks[] __initconst = { ··· 114 115 /* make sure these clocks are disabled */ 115 116 for (i = 0; i < ARRAY_SIZE(disable_clks); ++i) 116 117 __clk_init_disabled(disable_clks[i]); 118 + 119 + clkdev_add_table(m520x_clk_lookup, ARRAY_SIZE(m520x_clk_lookup)); 117 120 } 118 121 119 122 /***************************************************************************/
+39 -39
arch/m68k/coldfire/m53xx.c
··· 13 13 14 14 /***************************************************************************/ 15 15 16 + #include <linux/clkdev.h> 16 17 #include <linux/kernel.h> 17 18 #include <linux/param.h> 18 19 #include <linux/init.h> ··· 66 65 DEFINE_CLK(1, "skha.0", 33, MCF_CLK); 67 66 DEFINE_CLK(1, "rng.0", 34, MCF_CLK); 68 67 69 - struct clk *mcf_clks[] = { 70 - &__clk_0_2, /* flexbus */ 71 - &__clk_0_8, /* mcfcan.0 */ 72 - &__clk_0_12, /* fec.0 */ 73 - &__clk_0_17, /* edma */ 74 - &__clk_0_18, /* intc.0 */ 75 - &__clk_0_19, /* intc.1 */ 76 - &__clk_0_21, /* iack.0 */ 77 - &__clk_0_22, /* imx1-i2c.0 */ 78 - &__clk_0_23, /* mcfqspi.0 */ 79 - &__clk_0_24, /* mcfuart.0 */ 80 - &__clk_0_25, /* mcfuart.1 */ 81 - &__clk_0_26, /* mcfuart.2 */ 82 - &__clk_0_28, /* mcftmr.0 */ 83 - &__clk_0_29, /* mcftmr.1 */ 84 - &__clk_0_30, /* mcftmr.2 */ 85 - &__clk_0_31, /* mcftmr.3 */ 86 - 87 - &__clk_0_32, /* mcfpit.0 */ 88 - &__clk_0_33, /* mcfpit.1 */ 89 - &__clk_0_34, /* mcfpit.2 */ 90 - &__clk_0_35, /* mcfpit.3 */ 91 - &__clk_0_36, /* mcfpwm.0 */ 92 - &__clk_0_37, /* mcfeport.0 */ 93 - &__clk_0_38, /* mcfwdt.0 */ 94 - &__clk_0_40, /* sys.0 */ 95 - &__clk_0_41, /* gpio.0 */ 96 - &__clk_0_42, /* mcfrtc.0 */ 97 - &__clk_0_43, /* mcflcd.0 */ 98 - &__clk_0_44, /* mcfusb-otg.0 */ 99 - &__clk_0_45, /* mcfusb-host.0 */ 100 - &__clk_0_46, /* sdram.0 */ 101 - &__clk_0_47, /* ssi.0 */ 102 - &__clk_0_48, /* pll.0 */ 103 - 104 - &__clk_1_32, /* mdha.0 */ 105 - &__clk_1_33, /* skha.0 */ 106 - &__clk_1_34, /* rng.0 */ 107 - NULL, 68 + static struct clk_lookup m53xx_clk_lookup[] = { 69 + CLKDEV_INIT("flexbus", NULL, &__clk_0_2), 70 + CLKDEV_INIT("mcfcan.0", NULL, &__clk_0_8), 71 + CLKDEV_INIT("fec.0", NULL, &__clk_0_12), 72 + CLKDEV_INIT("edma", NULL, &__clk_0_17), 73 + CLKDEV_INIT("intc.0", NULL, &__clk_0_18), 74 + CLKDEV_INIT("intc.1", NULL, &__clk_0_19), 75 + CLKDEV_INIT("iack.0", NULL, &__clk_0_21), 76 + CLKDEV_INIT("imx1-i2c.0", NULL, &__clk_0_22), 77 + CLKDEV_INIT("mcfqspi.0", NULL, &__clk_0_23), 78 + CLKDEV_INIT("mcfuart.0", NULL, &__clk_0_24), 79 + CLKDEV_INIT("mcfuart.1", NULL, &__clk_0_25), 80 + CLKDEV_INIT("mcfuart.2", NULL, &__clk_0_26), 81 + CLKDEV_INIT("mcftmr.0", NULL, &__clk_0_28), 82 + CLKDEV_INIT("mcftmr.1", NULL, &__clk_0_29), 83 + CLKDEV_INIT("mcftmr.2", NULL, &__clk_0_30), 84 + CLKDEV_INIT("mcftmr.3", NULL, &__clk_0_31), 85 + CLKDEV_INIT("mcfpit.0", NULL, &__clk_0_32), 86 + CLKDEV_INIT("mcfpit.1", NULL, &__clk_0_33), 87 + CLKDEV_INIT("mcfpit.2", NULL, &__clk_0_34), 88 + CLKDEV_INIT("mcfpit.3", NULL, &__clk_0_35), 89 + CLKDEV_INIT("mcfpwm.0", NULL, &__clk_0_36), 90 + CLKDEV_INIT("mcfeport.0", NULL, &__clk_0_37), 91 + CLKDEV_INIT("mcfwdt.0", NULL, &__clk_0_38), 92 + CLKDEV_INIT(NULL, "sys.0", &__clk_0_40), 93 + CLKDEV_INIT("gpio.0", NULL, &__clk_0_41), 94 + CLKDEV_INIT("mcfrtc.0", NULL, &__clk_0_42), 95 + CLKDEV_INIT("mcflcd.0", NULL, &__clk_0_43), 96 + CLKDEV_INIT("mcfusb-otg.0", NULL, &__clk_0_44), 97 + CLKDEV_INIT("mcfusb-host.0", NULL, &__clk_0_45), 98 + CLKDEV_INIT("sdram.0", NULL, &__clk_0_46), 99 + CLKDEV_INIT("ssi.0", NULL, &__clk_0_47), 100 + CLKDEV_INIT(NULL, "pll.0", &__clk_0_48), 101 + CLKDEV_INIT("mdha.0", NULL, &__clk_1_32), 102 + CLKDEV_INIT("skha.0", NULL, &__clk_1_33), 103 + CLKDEV_INIT("rng.0", NULL, &__clk_1_34), 108 104 }; 109 105 110 106 static struct clk * const enable_clks[] __initconst = { ··· 156 158 /* make sure these clocks are disabled */ 157 159 for (i = 0; i < ARRAY_SIZE(disable_clks); ++i) 158 160 __clk_init_disabled(disable_clks[i]); 161 + 162 + clkdev_add_table(m53xx_clk_lookup, ARRAY_SIZE(m53xx_clk_lookup)); 159 163 } 160 164 161 165 /***************************************************************************/
+62 -64
arch/m68k/coldfire/m5441x.c
··· 5 5 * (C) Copyright Steven King <sfking@fdwdc.com> 6 6 */ 7 7 8 + #include <linux/clkdev.h> 8 9 #include <linux/kernel.h> 9 10 #include <linux/param.h> 10 11 #include <linux/init.h> ··· 79 78 DEFINE_CLK(2, "ahb.0", 1, MCF_CLK); 80 79 DEFINE_CLK(2, "per.0", 2, MCF_CLK); 81 80 82 - struct clk *mcf_clks[] = { 83 - &__clk_0_2, 84 - &__clk_0_8, 85 - &__clk_0_9, 86 - &__clk_0_14, 87 - &__clk_0_15, 88 - &__clk_0_17, 89 - &__clk_0_18, 90 - &__clk_0_19, 91 - &__clk_0_20, 92 - &__clk_0_22, 93 - &__clk_0_23, 94 - &__clk_0_24, 95 - &__clk_0_25, 96 - &__clk_0_26, 97 - &__clk_0_27, 98 - &__clk_0_28, 99 - &__clk_0_29, 100 - &__clk_0_30, 101 - &__clk_0_31, 102 - &__clk_0_32, 103 - &__clk_0_33, 104 - &__clk_0_34, 105 - &__clk_0_35, 106 - &__clk_0_37, 107 - &__clk_0_38, 108 - &__clk_0_39, 109 - &__clk_0_42, 110 - &__clk_0_43, 111 - &__clk_0_44, 112 - &__clk_0_45, 113 - &__clk_0_46, 114 - &__clk_0_47, 115 - &__clk_0_48, 116 - &__clk_0_49, 117 - &__clk_0_50, 118 - &__clk_0_51, 119 - &__clk_0_53, 120 - &__clk_0_54, 121 - &__clk_0_55, 122 - &__clk_0_56, 123 - &__clk_0_63, 124 - 125 - &__clk_1_2, 126 - &__clk_1_4, 127 - &__clk_1_5, 128 - &__clk_1_6, 129 - &__clk_1_7, 130 - &__clk_1_24, 131 - &__clk_1_25, 132 - &__clk_1_26, 133 - &__clk_1_27, 134 - &__clk_1_28, 135 - &__clk_1_29, 136 - &__clk_1_34, 137 - &__clk_1_36, 138 - &__clk_1_37, 139 - 140 - &__clk_2_0, 141 - &__clk_2_1, 142 - &__clk_2_2, 143 - 144 - NULL, 81 + static struct clk_lookup m5411x_clk_lookup[] = { 82 + CLKDEV_INIT("flexbus", NULL, &__clk_0_2), 83 + CLKDEV_INIT("mcfcan.0", NULL, &__clk_0_8), 84 + CLKDEV_INIT("mcfcan.1", NULL, &__clk_0_9), 85 + CLKDEV_INIT("imx1-i2c.1", NULL, &__clk_0_14), 86 + CLKDEV_INIT("mcfdspi.1", NULL, &__clk_0_15), 87 + CLKDEV_INIT("edma", NULL, &__clk_0_17), 88 + CLKDEV_INIT("intc.0", NULL, &__clk_0_18), 89 + CLKDEV_INIT("intc.1", NULL, &__clk_0_19), 90 + CLKDEV_INIT("intc.2", NULL, &__clk_0_20), 91 + CLKDEV_INIT("imx1-i2c.0", NULL, &__clk_0_22), 92 + CLKDEV_INIT("fsl-dspi.0", NULL, &__clk_0_23), 93 + CLKDEV_INIT("mcfuart.0", NULL, &__clk_0_24), 94 + CLKDEV_INIT("mcfuart.1", NULL, &__clk_0_25), 95 + CLKDEV_INIT("mcfuart.2", NULL, &__clk_0_26), 96 + CLKDEV_INIT("mcfuart.3", NULL, &__clk_0_27), 97 + CLKDEV_INIT("mcftmr.0", NULL, &__clk_0_28), 98 + CLKDEV_INIT("mcftmr.1", NULL, &__clk_0_29), 99 + CLKDEV_INIT("mcftmr.2", NULL, &__clk_0_30), 100 + CLKDEV_INIT("mcftmr.3", NULL, &__clk_0_31), 101 + CLKDEV_INIT("mcfpit.0", NULL, &__clk_0_32), 102 + CLKDEV_INIT("mcfpit.1", NULL, &__clk_0_33), 103 + CLKDEV_INIT("mcfpit.2", NULL, &__clk_0_34), 104 + CLKDEV_INIT("mcfpit.3", NULL, &__clk_0_35), 105 + CLKDEV_INIT("mcfeport.0", NULL, &__clk_0_37), 106 + CLKDEV_INIT("mcfadc.0", NULL, &__clk_0_38), 107 + CLKDEV_INIT("mcfdac.0", NULL, &__clk_0_39), 108 + CLKDEV_INIT("mcfrtc.0", NULL, &__clk_0_42), 109 + CLKDEV_INIT("mcfsim.0", NULL, &__clk_0_43), 110 + CLKDEV_INIT("mcfusb-otg.0", NULL, &__clk_0_44), 111 + CLKDEV_INIT("mcfusb-host.0", NULL, &__clk_0_45), 112 + CLKDEV_INIT("mcfddr-sram.0", NULL, &__clk_0_46), 113 + CLKDEV_INIT("mcfssi.0", NULL, &__clk_0_47), 114 + CLKDEV_INIT(NULL, "pll.0", &__clk_0_48), 115 + CLKDEV_INIT("mcfrng.0", NULL, &__clk_0_49), 116 + CLKDEV_INIT("mcfssi.1", NULL, &__clk_0_50), 117 + CLKDEV_INIT("sdhci-esdhc-mcf.0", NULL, &__clk_0_51), 118 + CLKDEV_INIT("enet-fec.0", NULL, &__clk_0_53), 119 + CLKDEV_INIT("enet-fec.1", NULL, &__clk_0_54), 120 + CLKDEV_INIT("switch.0", NULL, &__clk_0_55), 121 + CLKDEV_INIT("switch.1", NULL, &__clk_0_56), 122 + CLKDEV_INIT("nand.0", NULL, &__clk_0_63), 123 + CLKDEV_INIT("mcfow.0", NULL, &__clk_1_2), 124 + CLKDEV_INIT("imx1-i2c.2", NULL, &__clk_1_4), 125 + CLKDEV_INIT("imx1-i2c.3", NULL, &__clk_1_5), 126 + CLKDEV_INIT("imx1-i2c.4", NULL, &__clk_1_6), 127 + CLKDEV_INIT("imx1-i2c.5", NULL, &__clk_1_7), 128 + CLKDEV_INIT("mcfuart.4", NULL, &__clk_1_24), 129 + CLKDEV_INIT("mcfuart.5", NULL, &__clk_1_25), 130 + CLKDEV_INIT("mcfuart.6", NULL, &__clk_1_26), 131 + CLKDEV_INIT("mcfuart.7", NULL, &__clk_1_27), 132 + CLKDEV_INIT("mcfuart.8", NULL, &__clk_1_28), 133 + CLKDEV_INIT("mcfuart.9", NULL, &__clk_1_29), 134 + CLKDEV_INIT("mcfpwm.0", NULL, &__clk_1_34), 135 + CLKDEV_INIT(NULL, "sys.0", &__clk_1_36), 136 + CLKDEV_INIT("gpio.0", NULL, &__clk_1_37), 137 + CLKDEV_INIT("ipg.0", NULL, &__clk_2_0), 138 + CLKDEV_INIT("ahb.0", NULL, &__clk_2_1), 139 + CLKDEV_INIT("per.0", NULL, &__clk_2_2), 145 140 }; 146 - 147 141 148 142 static struct clk * const enable_clks[] __initconst = { 149 143 /* make sure these clocks are enabled */ ··· 224 228 /* make sure these clocks are disabled */ 225 229 for (i = 0; i < ARRAY_SIZE(disable_clks); ++i) 226 230 __clk_init_disabled(disable_clks[i]); 231 + 232 + clkdev_add_table(m5411x_clk_lookup, ARRAY_SIZE(m5411x_clk_lookup)); 227 233 } 228 234 229 235 static void __init m5441x_uarts_init(void)
-5
arch/m68k/include/asm/mcfclk.h
··· 15 15 }; 16 16 17 17 struct clk { 18 - const char *name; 19 18 struct clk_ops *clk_ops; 20 19 unsigned long rate; 21 20 unsigned long enabled; 22 21 u8 slot; 23 22 }; 24 - 25 - extern struct clk *mcf_clks[]; 26 23 27 24 #ifdef MCFPM_PPMCR0 28 25 extern struct clk_ops clk_ops0; ··· 31 34 32 35 #define DEFINE_CLK(clk_bank, clk_name, clk_slot, clk_rate) \ 33 36 static struct clk __clk_##clk_bank##_##clk_slot = { \ 34 - .name = clk_name, \ 35 37 .clk_ops = &clk_ops##clk_bank, \ 36 38 .rate = clk_rate, \ 37 39 .slot = clk_slot, \ ··· 41 45 #else 42 46 #define DEFINE_CLK(clk_ref, clk_name, clk_rate) \ 43 47 static struct clk clk_##clk_ref = { \ 44 - .name = clk_name, \ 45 48 .rate = clk_rate, \ 46 49 } 47 50 #endif /* MCFPM_PPMCR0 */