diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2013-06-17 13:43:18 -0400 |
---|---|---|
committer | David Brown <davidb@codeaurora.org> | 2013-06-24 16:07:53 -0400 |
commit | 421faca0b538d1ed5f2065cbbc6bbec38f49a54f (patch) | |
tree | cedbfa77fe9d4af303684b80fb8bb84e6c76f22c | |
parent | 2dfd9c1f7722bcaa9d2d4af090af2050df85203b (diff) |
ARM: msm: Make proc_comm clock control into a platform driver
To move closer to the generic struct clock framework move the
proc_comm based clock code to a platform driver. The data
describing the struct clks still live in the devices-$ARCH file,
but the clock initialization is done at driver binding time.
Cc: Saravana Kannan <skannan@codeaurora.org>
Reviewed-by: Pankaj Jangra <jangra.pankaj9@gmail.com>
Acked-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
-rw-r--r-- | arch/arm/mach-msm/board-halibut.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-msm/board-msm7x30.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-msm/board-qsd8x50.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-msm/board-trout.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-msm/clock-pcom.c | 23 | ||||
-rw-r--r-- | arch/arm/mach-msm/clock-pcom.h | 5 | ||||
-rw-r--r-- | arch/arm/mach-msm/clock.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-msm/clock.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-msm/devices-msm7x00.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-msm/devices-msm7x30.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-msm/devices-qsd8x50.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-msm/devices.h | 15 | ||||
-rw-r--r-- | arch/arm/mach-msm/include/mach/board.h | 5 |
13 files changed, 67 insertions, 31 deletions
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c index 82eaf88d2026..803651ad4f62 100644 --- a/arch/arm/mach-msm/board-halibut.c +++ b/arch/arm/mach-msm/board-halibut.c | |||
@@ -59,6 +59,7 @@ static struct platform_device smc91x_device = { | |||
59 | }; | 59 | }; |
60 | 60 | ||
61 | static struct platform_device *devices[] __initdata = { | 61 | static struct platform_device *devices[] __initdata = { |
62 | &msm_clock_7x01a, | ||
62 | &msm_device_gpio_7201, | 63 | &msm_device_gpio_7201, |
63 | &msm_device_uart3, | 64 | &msm_device_uart3, |
64 | &msm_device_smd, | 65 | &msm_device_smd, |
@@ -91,7 +92,6 @@ static void __init halibut_fixup(struct tag *tags, char **cmdline, | |||
91 | static void __init halibut_map_io(void) | 92 | static void __init halibut_map_io(void) |
92 | { | 93 | { |
93 | msm_map_common_io(); | 94 | msm_map_common_io(); |
94 | msm_clock_init(msm_clocks_7x01a, msm_num_clocks_7x01a); | ||
95 | } | 95 | } |
96 | 96 | ||
97 | static void __init halibut_init_late(void) | 97 | static void __init halibut_init_late(void) |
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c index 520c141acd03..db3d8c0bc8a4 100644 --- a/arch/arm/mach-msm/board-msm7x30.c +++ b/arch/arm/mach-msm/board-msm7x30.c | |||
@@ -89,6 +89,7 @@ struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = { | |||
89 | }; | 89 | }; |
90 | 90 | ||
91 | static struct platform_device *devices[] __initdata = { | 91 | static struct platform_device *devices[] __initdata = { |
92 | &msm_clock_7x30, | ||
92 | &msm_device_gpio_7x30, | 93 | &msm_device_gpio_7x30, |
93 | #if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER) | 94 | #if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER) |
94 | &msm_device_uart2, | 95 | &msm_device_uart2, |
@@ -116,7 +117,6 @@ static void __init msm7x30_init(void) | |||
116 | static void __init msm7x30_map_io(void) | 117 | static void __init msm7x30_map_io(void) |
117 | { | 118 | { |
118 | msm_map_msm7x30_io(); | 119 | msm_map_msm7x30_io(); |
119 | msm_clock_init(msm_clocks_7x30, msm_num_clocks_7x30); | ||
120 | } | 120 | } |
121 | 121 | ||
122 | static void __init msm7x30_init_late(void) | 122 | static void __init msm7x30_init_late(void) |
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c index 38a532d6937c..f14a73d86bc0 100644 --- a/arch/arm/mach-msm/board-qsd8x50.c +++ b/arch/arm/mach-msm/board-qsd8x50.c | |||
@@ -89,6 +89,7 @@ static struct msm_otg_platform_data msm_otg_pdata = { | |||
89 | }; | 89 | }; |
90 | 90 | ||
91 | static struct platform_device *devices[] __initdata = { | 91 | static struct platform_device *devices[] __initdata = { |
92 | &msm_clock_8x50, | ||
92 | &msm_device_gpio_8x50, | 93 | &msm_device_gpio_8x50, |
93 | &msm_device_uart3, | 94 | &msm_device_uart3, |
94 | &msm_device_smd, | 95 | &msm_device_smd, |
@@ -172,7 +173,6 @@ static void __init qsd8x50_init_mmc(void) | |||
172 | static void __init qsd8x50_map_io(void) | 173 | static void __init qsd8x50_map_io(void) |
173 | { | 174 | { |
174 | msm_map_qsd8x50_io(); | 175 | msm_map_qsd8x50_io(); |
175 | msm_clock_init(msm_clocks_8x50, msm_num_clocks_8x50); | ||
176 | } | 176 | } |
177 | 177 | ||
178 | static void __init qsd8x50_init_irq(void) | 178 | static void __init qsd8x50_init_irq(void) |
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c index 80fe1c5ff5c1..64a46eb4fc49 100644 --- a/arch/arm/mach-msm/board-trout.c +++ b/arch/arm/mach-msm/board-trout.c | |||
@@ -36,6 +36,7 @@ | |||
36 | extern int trout_init_mmc(unsigned int); | 36 | extern int trout_init_mmc(unsigned int); |
37 | 37 | ||
38 | static struct platform_device *devices[] __initdata = { | 38 | static struct platform_device *devices[] __initdata = { |
39 | &msm_clock_7x01a, | ||
39 | &msm_device_gpio_7201, | 40 | &msm_device_gpio_7201, |
40 | &msm_device_uart3, | 41 | &msm_device_uart3, |
41 | &msm_device_smd, | 42 | &msm_device_smd, |
@@ -94,8 +95,6 @@ static void __init trout_map_io(void) | |||
94 | /* route UART3 to the "H2W" extended usb connector */ | 95 | /* route UART3 to the "H2W" extended usb connector */ |
95 | writeb(0x80, TROUT_CPLD_BASE + 0x00); | 96 | writeb(0x80, TROUT_CPLD_BASE + 0x00); |
96 | #endif | 97 | #endif |
97 | |||
98 | msm_clock_init(msm_clocks_7x01a, msm_num_clocks_7x01a); | ||
99 | } | 98 | } |
100 | 99 | ||
101 | static void __init trout_init_late(void) | 100 | static void __init trout_init_late(void) |
diff --git a/arch/arm/mach-msm/clock-pcom.c b/arch/arm/mach-msm/clock-pcom.c index bb75f8e75ce2..632173186a69 100644 --- a/arch/arm/mach-msm/clock-pcom.c +++ b/arch/arm/mach-msm/clock-pcom.c | |||
@@ -14,8 +14,9 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <linux/ctype.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/stddef.h> | 18 | #include <linux/module.h> |
19 | |||
19 | #include <mach/clk.h> | 20 | #include <mach/clk.h> |
20 | 21 | ||
21 | #include "proc_comm.h" | 22 | #include "proc_comm.h" |
@@ -126,3 +127,21 @@ struct clk_ops clk_ops_pcom = { | |||
126 | .round_rate = pc_clk_round_rate, | 127 | .round_rate = pc_clk_round_rate, |
127 | .is_local = pc_clk_is_local, | 128 | .is_local = pc_clk_is_local, |
128 | }; | 129 | }; |
130 | |||
131 | static int msm_clock_pcom_probe(struct platform_device *pdev) | ||
132 | { | ||
133 | const struct pcom_clk_pdata *pdata = pdev->dev.platform_data; | ||
134 | msm_clock_init(pdata->lookup, pdata->num_lookups); | ||
135 | return 0; | ||
136 | } | ||
137 | |||
138 | static struct platform_driver msm_clock_pcom_driver = { | ||
139 | .probe = msm_clock_pcom_probe, | ||
140 | .driver = { | ||
141 | .name = "msm-clock-pcom", | ||
142 | .owner = THIS_MODULE, | ||
143 | }, | ||
144 | }; | ||
145 | module_platform_driver(msm_clock_pcom_driver); | ||
146 | |||
147 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/arch/arm/mach-msm/clock-pcom.h b/arch/arm/mach-msm/clock-pcom.h index 974d0032f3a3..87406a373d2b 100644 --- a/arch/arm/mach-msm/clock-pcom.h +++ b/arch/arm/mach-msm/clock-pcom.h | |||
@@ -123,6 +123,11 @@ | |||
123 | struct clk_ops; | 123 | struct clk_ops; |
124 | extern struct clk_ops clk_ops_pcom; | 124 | extern struct clk_ops clk_ops_pcom; |
125 | 125 | ||
126 | struct pcom_clk_pdata { | ||
127 | struct clk_lookup *lookup; | ||
128 | u32 num_lookups; | ||
129 | }; | ||
130 | |||
126 | int pc_clk_reset(unsigned id, enum clk_reset_action action); | 131 | int pc_clk_reset(unsigned id, enum clk_reset_action action); |
127 | 132 | ||
128 | #define CLK_PCOM(clk_name, clk_id, clk_dev, clk_flags) { \ | 133 | #define CLK_PCOM(clk_name, clk_id, clk_dev, clk_flags) { \ |
diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c index 8d07b256d8ea..d72dd3770298 100644 --- a/arch/arm/mach-msm/clock.c +++ b/arch/arm/mach-msm/clock.c | |||
@@ -116,7 +116,7 @@ EXPORT_SYMBOL(clk_get_parent); | |||
116 | */ | 116 | */ |
117 | static struct clk *ebi1_clk; | 117 | static struct clk *ebi1_clk; |
118 | 118 | ||
119 | void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks) | 119 | void msm_clock_init(struct clk_lookup *clock_tbl, size_t num_clocks) |
120 | { | 120 | { |
121 | unsigned n; | 121 | unsigned n; |
122 | 122 | ||
diff --git a/arch/arm/mach-msm/clock.h b/arch/arm/mach-msm/clock.h index a25ff58c2f3f..cc76bfe9ba46 100644 --- a/arch/arm/mach-msm/clock.h +++ b/arch/arm/mach-msm/clock.h | |||
@@ -63,4 +63,7 @@ static inline int __init clock_debug_init(void) { return 0; } | |||
63 | static inline int __init clock_debug_add(struct clk *clock) { return 0; } | 63 | static inline int __init clock_debug_add(struct clk *clock) { return 0; } |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | struct clk_lookup; | ||
67 | void msm_clock_init(struct clk_lookup *clock_tbl, size_t num_clocks); | ||
68 | |||
66 | #endif | 69 | #endif |
diff --git a/arch/arm/mach-msm/devices-msm7x00.c b/arch/arm/mach-msm/devices-msm7x00.c index 1a0a2306b115..9edfe68e9fe9 100644 --- a/arch/arm/mach-msm/devices-msm7x00.c +++ b/arch/arm/mach-msm/devices-msm7x00.c | |||
@@ -425,7 +425,7 @@ struct platform_device msm_device_mdp = { | |||
425 | .resource = resources_mdp, | 425 | .resource = resources_mdp, |
426 | }; | 426 | }; |
427 | 427 | ||
428 | struct clk_lookup msm_clocks_7x01a[] = { | 428 | static struct clk_lookup msm_clocks_7x01a[] = { |
429 | CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), | 429 | CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), |
430 | CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0), | 430 | CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0), |
431 | CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, 0), | 431 | CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, 0), |
@@ -469,4 +469,12 @@ struct clk_lookup msm_clocks_7x01a[] = { | |||
469 | CLK_PCOM("vfe_mdc_clk", VFE_MDC_CLK, NULL, OFF), | 469 | CLK_PCOM("vfe_mdc_clk", VFE_MDC_CLK, NULL, OFF), |
470 | }; | 470 | }; |
471 | 471 | ||
472 | unsigned msm_num_clocks_7x01a = ARRAY_SIZE(msm_clocks_7x01a); | 472 | static struct pcom_clk_pdata msm_clock_7x01a_pdata = { |
473 | .lookup = msm_clocks_7x01a, | ||
474 | .num_lookups = ARRAY_SIZE(msm_clocks_7x01a), | ||
475 | }; | ||
476 | |||
477 | struct platform_device msm_clock_7x01a = { | ||
478 | .name = "msm-clock-pcom", | ||
479 | .dev.platform_data = &msm_clock_7x01a_pdata, | ||
480 | }; | ||
diff --git a/arch/arm/mach-msm/devices-msm7x30.c b/arch/arm/mach-msm/devices-msm7x30.c index d233c515973d..6444f0e618f6 100644 --- a/arch/arm/mach-msm/devices-msm7x30.c +++ b/arch/arm/mach-msm/devices-msm7x30.c | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #include <asm/mach/flash.h> | 29 | #include <asm/mach/flash.h> |
30 | 30 | ||
31 | #include "clock.h" | ||
31 | #include "clock-pcom.h" | 32 | #include "clock-pcom.h" |
32 | 33 | ||
33 | #include <linux/platform_data/mmc-msm_sdcc.h> | 34 | #include <linux/platform_data/mmc-msm_sdcc.h> |
@@ -160,7 +161,7 @@ struct platform_device msm_device_hsusb_host = { | |||
160 | }, | 161 | }, |
161 | }; | 162 | }; |
162 | 163 | ||
163 | struct clk_lookup msm_clocks_7x30[] = { | 164 | static struct clk_lookup msm_clocks_7x30[] = { |
164 | CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), | 165 | CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), |
165 | CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0), | 166 | CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0), |
166 | CLK_PCOM("cam_m_clk", CAM_M_CLK, NULL, 0), | 167 | CLK_PCOM("cam_m_clk", CAM_M_CLK, NULL, 0), |
@@ -234,5 +235,12 @@ struct clk_lookup msm_clocks_7x30[] = { | |||
234 | CLK_PCOM("csi_vfe_clk", CSI0_VFE_CLK, NULL, 0), | 235 | CLK_PCOM("csi_vfe_clk", CSI0_VFE_CLK, NULL, 0), |
235 | }; | 236 | }; |
236 | 237 | ||
237 | unsigned msm_num_clocks_7x30 = ARRAY_SIZE(msm_clocks_7x30); | 238 | static struct pcom_clk_pdata msm_clock_7x30_pdata = { |
239 | .lookup = msm_clocks_7x30, | ||
240 | .num_lookups = ARRAY_SIZE(msm_clocks_7x30), | ||
241 | }; | ||
238 | 242 | ||
243 | struct platform_device msm_clock_7x30 = { | ||
244 | .name = "msm-clock-pcom", | ||
245 | .dev.platform_data = &msm_clock_7x30_pdata, | ||
246 | }; | ||
diff --git a/arch/arm/mach-msm/devices-qsd8x50.c b/arch/arm/mach-msm/devices-qsd8x50.c index 2e1b3ec9dfc7..caa9a1f0bcbd 100644 --- a/arch/arm/mach-msm/devices-qsd8x50.c +++ b/arch/arm/mach-msm/devices-qsd8x50.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <asm/mach/flash.h> | 28 | #include <asm/mach/flash.h> |
29 | 29 | ||
30 | #include <linux/platform_data/mmc-msm_sdcc.h> | 30 | #include <linux/platform_data/mmc-msm_sdcc.h> |
31 | #include "clock.h" | ||
31 | #include "clock-pcom.h" | 32 | #include "clock-pcom.h" |
32 | 33 | ||
33 | static struct resource msm_gpio_resources[] = { | 34 | static struct resource msm_gpio_resources[] = { |
@@ -322,7 +323,7 @@ int __init msm_add_sdcc(unsigned int controller, | |||
322 | return platform_device_register(pdev); | 323 | return platform_device_register(pdev); |
323 | } | 324 | } |
324 | 325 | ||
325 | struct clk_lookup msm_clocks_8x50[] = { | 326 | static struct clk_lookup msm_clocks_8x50[] = { |
326 | CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), | 327 | CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), |
327 | CLK_PCOM("ce_clk", CE_CLK, NULL, 0), | 328 | CLK_PCOM("ce_clk", CE_CLK, NULL, 0), |
328 | CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, CLK_MIN), | 329 | CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, CLK_MIN), |
@@ -376,5 +377,12 @@ struct clk_lookup msm_clocks_8x50[] = { | |||
376 | CLK_PCOM("usb_phy_clk", USB_PHY_CLK, NULL, 0), | 377 | CLK_PCOM("usb_phy_clk", USB_PHY_CLK, NULL, 0), |
377 | }; | 378 | }; |
378 | 379 | ||
379 | unsigned msm_num_clocks_8x50 = ARRAY_SIZE(msm_clocks_8x50); | 380 | static struct pcom_clk_pdata msm_clock_8x50_pdata = { |
381 | .lookup = msm_clocks_8x50, | ||
382 | .num_lookups = ARRAY_SIZE(msm_clocks_8x50), | ||
383 | }; | ||
380 | 384 | ||
385 | struct platform_device msm_clock_8x50 = { | ||
386 | .name = "msm-clock-pcom", | ||
387 | .dev.platform_data = &msm_clock_8x50_pdata, | ||
388 | }; | ||
diff --git a/arch/arm/mach-msm/devices.h b/arch/arm/mach-msm/devices.h index da902cf51161..dccefad9f9b9 100644 --- a/arch/arm/mach-msm/devices.h +++ b/arch/arm/mach-msm/devices.h | |||
@@ -16,10 +16,6 @@ | |||
16 | #ifndef __ARCH_ARM_MACH_MSM_DEVICES_H | 16 | #ifndef __ARCH_ARM_MACH_MSM_DEVICES_H |
17 | #define __ARCH_ARM_MACH_MSM_DEVICES_H | 17 | #define __ARCH_ARM_MACH_MSM_DEVICES_H |
18 | 18 | ||
19 | #include <linux/clkdev.h> | ||
20 | |||
21 | #include "clock.h" | ||
22 | |||
23 | extern struct platform_device msm_device_gpio_7201; | 19 | extern struct platform_device msm_device_gpio_7201; |
24 | extern struct platform_device msm_device_gpio_7x30; | 20 | extern struct platform_device msm_device_gpio_7x30; |
25 | extern struct platform_device msm_device_gpio_8x50; | 21 | extern struct platform_device msm_device_gpio_8x50; |
@@ -50,13 +46,8 @@ extern struct platform_device msm_device_mddi0; | |||
50 | extern struct platform_device msm_device_mddi1; | 46 | extern struct platform_device msm_device_mddi1; |
51 | extern struct platform_device msm_device_mdp; | 47 | extern struct platform_device msm_device_mdp; |
52 | 48 | ||
53 | extern struct clk_lookup msm_clocks_7x01a[]; | 49 | extern struct platform_device msm_clock_7x01a; |
54 | extern unsigned msm_num_clocks_7x01a; | 50 | extern struct platform_device msm_clock_7x30; |
55 | 51 | extern struct platform_device msm_clock_8x50; | |
56 | extern struct clk_lookup msm_clocks_7x30[]; | ||
57 | extern unsigned msm_num_clocks_7x30; | ||
58 | |||
59 | extern struct clk_lookup msm_clocks_8x50[]; | ||
60 | extern unsigned msm_num_clocks_8x50; | ||
61 | 52 | ||
62 | #endif | 53 | #endif |
diff --git a/arch/arm/mach-msm/include/mach/board.h b/arch/arm/mach-msm/include/mach/board.h index 8cebedb11233..c34e246a3e07 100644 --- a/arch/arm/mach-msm/include/mach/board.h +++ b/arch/arm/mach-msm/include/mach/board.h | |||
@@ -20,16 +20,11 @@ | |||
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <linux/platform_data/mmc-msm_sdcc.h> | 21 | #include <linux/platform_data/mmc-msm_sdcc.h> |
22 | 22 | ||
23 | /* platform device data structures */ | ||
24 | |||
25 | struct clk_lookup; | ||
26 | |||
27 | /* common init routines for use by arch/arm/mach-msm/board-*.c */ | 23 | /* common init routines for use by arch/arm/mach-msm/board-*.c */ |
28 | 24 | ||
29 | void __init msm_add_devices(void); | 25 | void __init msm_add_devices(void); |
30 | void __init msm_init_irq(void); | 26 | void __init msm_init_irq(void); |
31 | void __init msm_init_gpio(void); | 27 | void __init msm_init_gpio(void); |
32 | void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks); | ||
33 | int __init msm_add_sdcc(unsigned int controller, | 28 | int __init msm_add_sdcc(unsigned int controller, |
34 | struct msm_mmc_platform_data *plat, | 29 | struct msm_mmc_platform_data *plat, |
35 | unsigned int stat_irq, unsigned long stat_irq_flags); | 30 | unsigned int stat_irq, unsigned long stat_irq_flags); |