Commit 421faca0 authored by Stephen Boyd's avatar Stephen Boyd Committed by David Brown

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: default avatarPankaj Jangra <jangra.pankaj9@gmail.com>
Acked-by: default avatarMike Turquette <mturquette@linaro.org>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: default avatarDavid Brown <davidb@codeaurora.org>
parent 2dfd9c1f
...@@ -59,6 +59,7 @@ static struct platform_device smc91x_device = { ...@@ -59,6 +59,7 @@ static struct platform_device smc91x_device = {
}; };
static struct platform_device *devices[] __initdata = { static struct platform_device *devices[] __initdata = {
&msm_clock_7x01a,
&msm_device_gpio_7201, &msm_device_gpio_7201,
&msm_device_uart3, &msm_device_uart3,
&msm_device_smd, &msm_device_smd,
...@@ -91,7 +92,6 @@ static void __init halibut_fixup(struct tag *tags, char **cmdline, ...@@ -91,7 +92,6 @@ static void __init halibut_fixup(struct tag *tags, char **cmdline,
static void __init halibut_map_io(void) static void __init halibut_map_io(void)
{ {
msm_map_common_io(); msm_map_common_io();
msm_clock_init(msm_clocks_7x01a, msm_num_clocks_7x01a);
} }
static void __init halibut_init_late(void) static void __init halibut_init_late(void)
......
...@@ -89,6 +89,7 @@ struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = { ...@@ -89,6 +89,7 @@ struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
}; };
static struct platform_device *devices[] __initdata = { static struct platform_device *devices[] __initdata = {
&msm_clock_7x30,
&msm_device_gpio_7x30, &msm_device_gpio_7x30,
#if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER) #if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER)
&msm_device_uart2, &msm_device_uart2,
...@@ -116,7 +117,6 @@ static void __init msm7x30_init(void) ...@@ -116,7 +117,6 @@ static void __init msm7x30_init(void)
static void __init msm7x30_map_io(void) static void __init msm7x30_map_io(void)
{ {
msm_map_msm7x30_io(); msm_map_msm7x30_io();
msm_clock_init(msm_clocks_7x30, msm_num_clocks_7x30);
} }
static void __init msm7x30_init_late(void) static void __init msm7x30_init_late(void)
......
...@@ -89,6 +89,7 @@ static struct msm_otg_platform_data msm_otg_pdata = { ...@@ -89,6 +89,7 @@ static struct msm_otg_platform_data msm_otg_pdata = {
}; };
static struct platform_device *devices[] __initdata = { static struct platform_device *devices[] __initdata = {
&msm_clock_8x50,
&msm_device_gpio_8x50, &msm_device_gpio_8x50,
&msm_device_uart3, &msm_device_uart3,
&msm_device_smd, &msm_device_smd,
...@@ -172,7 +173,6 @@ static void __init qsd8x50_init_mmc(void) ...@@ -172,7 +173,6 @@ static void __init qsd8x50_init_mmc(void)
static void __init qsd8x50_map_io(void) static void __init qsd8x50_map_io(void)
{ {
msm_map_qsd8x50_io(); msm_map_qsd8x50_io();
msm_clock_init(msm_clocks_8x50, msm_num_clocks_8x50);
} }
static void __init qsd8x50_init_irq(void) static void __init qsd8x50_init_irq(void)
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
extern int trout_init_mmc(unsigned int); extern int trout_init_mmc(unsigned int);
static struct platform_device *devices[] __initdata = { static struct platform_device *devices[] __initdata = {
&msm_clock_7x01a,
&msm_device_gpio_7201, &msm_device_gpio_7201,
&msm_device_uart3, &msm_device_uart3,
&msm_device_smd, &msm_device_smd,
...@@ -94,8 +95,6 @@ static void __init trout_map_io(void) ...@@ -94,8 +95,6 @@ static void __init trout_map_io(void)
/* route UART3 to the "H2W" extended usb connector */ /* route UART3 to the "H2W" extended usb connector */
writeb(0x80, TROUT_CPLD_BASE + 0x00); writeb(0x80, TROUT_CPLD_BASE + 0x00);
#endif #endif
msm_clock_init(msm_clocks_7x01a, msm_num_clocks_7x01a);
} }
static void __init trout_init_late(void) static void __init trout_init_late(void)
......
...@@ -14,8 +14,9 @@ ...@@ -14,8 +14,9 @@
*/ */
#include <linux/err.h> #include <linux/err.h>
#include <linux/ctype.h> #include <linux/platform_device.h>
#include <linux/stddef.h> #include <linux/module.h>
#include <mach/clk.h> #include <mach/clk.h>
#include "proc_comm.h" #include "proc_comm.h"
...@@ -126,3 +127,21 @@ struct clk_ops clk_ops_pcom = { ...@@ -126,3 +127,21 @@ struct clk_ops clk_ops_pcom = {
.round_rate = pc_clk_round_rate, .round_rate = pc_clk_round_rate,
.is_local = pc_clk_is_local, .is_local = pc_clk_is_local,
}; };
static int msm_clock_pcom_probe(struct platform_device *pdev)
{
const struct pcom_clk_pdata *pdata = pdev->dev.platform_data;
msm_clock_init(pdata->lookup, pdata->num_lookups);
return 0;
}
static struct platform_driver msm_clock_pcom_driver = {
.probe = msm_clock_pcom_probe,
.driver = {
.name = "msm-clock-pcom",
.owner = THIS_MODULE,
},
};
module_platform_driver(msm_clock_pcom_driver);
MODULE_LICENSE("GPL v2");
...@@ -123,6 +123,11 @@ ...@@ -123,6 +123,11 @@
struct clk_ops; struct clk_ops;
extern struct clk_ops clk_ops_pcom; extern struct clk_ops clk_ops_pcom;
struct pcom_clk_pdata {
struct clk_lookup *lookup;
u32 num_lookups;
};
int pc_clk_reset(unsigned id, enum clk_reset_action action); int pc_clk_reset(unsigned id, enum clk_reset_action action);
#define CLK_PCOM(clk_name, clk_id, clk_dev, clk_flags) { \ #define CLK_PCOM(clk_name, clk_id, clk_dev, clk_flags) { \
......
...@@ -116,7 +116,7 @@ EXPORT_SYMBOL(clk_get_parent); ...@@ -116,7 +116,7 @@ EXPORT_SYMBOL(clk_get_parent);
*/ */
static struct clk *ebi1_clk; static struct clk *ebi1_clk;
void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks) void msm_clock_init(struct clk_lookup *clock_tbl, size_t num_clocks)
{ {
unsigned n; unsigned n;
......
...@@ -63,4 +63,7 @@ static inline int __init clock_debug_init(void) { return 0; } ...@@ -63,4 +63,7 @@ static inline int __init clock_debug_init(void) { return 0; }
static inline int __init clock_debug_add(struct clk *clock) { return 0; } static inline int __init clock_debug_add(struct clk *clock) { return 0; }
#endif #endif
struct clk_lookup;
void msm_clock_init(struct clk_lookup *clock_tbl, size_t num_clocks);
#endif #endif
...@@ -425,7 +425,7 @@ struct platform_device msm_device_mdp = { ...@@ -425,7 +425,7 @@ struct platform_device msm_device_mdp = {
.resource = resources_mdp, .resource = resources_mdp,
}; };
struct clk_lookup msm_clocks_7x01a[] = { static struct clk_lookup msm_clocks_7x01a[] = {
CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), CLK_PCOM("adm_clk", ADM_CLK, NULL, 0),
CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0), CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0),
CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, 0), CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, 0),
...@@ -469,4 +469,12 @@ struct clk_lookup msm_clocks_7x01a[] = { ...@@ -469,4 +469,12 @@ struct clk_lookup msm_clocks_7x01a[] = {
CLK_PCOM("vfe_mdc_clk", VFE_MDC_CLK, NULL, OFF), CLK_PCOM("vfe_mdc_clk", VFE_MDC_CLK, NULL, OFF),
}; };
unsigned msm_num_clocks_7x01a = ARRAY_SIZE(msm_clocks_7x01a); static struct pcom_clk_pdata msm_clock_7x01a_pdata = {
.lookup = msm_clocks_7x01a,
.num_lookups = ARRAY_SIZE(msm_clocks_7x01a),
};
struct platform_device msm_clock_7x01a = {
.name = "msm-clock-pcom",
.dev.platform_data = &msm_clock_7x01a_pdata,
};
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <asm/mach/flash.h> #include <asm/mach/flash.h>
#include "clock.h"
#include "clock-pcom.h" #include "clock-pcom.h"
#include <linux/platform_data/mmc-msm_sdcc.h> #include <linux/platform_data/mmc-msm_sdcc.h>
...@@ -160,7 +161,7 @@ struct platform_device msm_device_hsusb_host = { ...@@ -160,7 +161,7 @@ struct platform_device msm_device_hsusb_host = {
}, },
}; };
struct clk_lookup msm_clocks_7x30[] = { static struct clk_lookup msm_clocks_7x30[] = {
CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), CLK_PCOM("adm_clk", ADM_CLK, NULL, 0),
CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0), CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0),
CLK_PCOM("cam_m_clk", CAM_M_CLK, NULL, 0), CLK_PCOM("cam_m_clk", CAM_M_CLK, NULL, 0),
...@@ -234,5 +235,12 @@ struct clk_lookup msm_clocks_7x30[] = { ...@@ -234,5 +235,12 @@ struct clk_lookup msm_clocks_7x30[] = {
CLK_PCOM("csi_vfe_clk", CSI0_VFE_CLK, NULL, 0), CLK_PCOM("csi_vfe_clk", CSI0_VFE_CLK, NULL, 0),
}; };
unsigned msm_num_clocks_7x30 = ARRAY_SIZE(msm_clocks_7x30); static struct pcom_clk_pdata msm_clock_7x30_pdata = {
.lookup = msm_clocks_7x30,
.num_lookups = ARRAY_SIZE(msm_clocks_7x30),
};
struct platform_device msm_clock_7x30 = {
.name = "msm-clock-pcom",
.dev.platform_data = &msm_clock_7x30_pdata,
};
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <asm/mach/flash.h> #include <asm/mach/flash.h>
#include <linux/platform_data/mmc-msm_sdcc.h> #include <linux/platform_data/mmc-msm_sdcc.h>
#include "clock.h"
#include "clock-pcom.h" #include "clock-pcom.h"
static struct resource msm_gpio_resources[] = { static struct resource msm_gpio_resources[] = {
...@@ -322,7 +323,7 @@ int __init msm_add_sdcc(unsigned int controller, ...@@ -322,7 +323,7 @@ int __init msm_add_sdcc(unsigned int controller,
return platform_device_register(pdev); return platform_device_register(pdev);
} }
struct clk_lookup msm_clocks_8x50[] = { static struct clk_lookup msm_clocks_8x50[] = {
CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), CLK_PCOM("adm_clk", ADM_CLK, NULL, 0),
CLK_PCOM("ce_clk", CE_CLK, NULL, 0), CLK_PCOM("ce_clk", CE_CLK, NULL, 0),
CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, CLK_MIN), CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, CLK_MIN),
...@@ -376,5 +377,12 @@ struct clk_lookup msm_clocks_8x50[] = { ...@@ -376,5 +377,12 @@ struct clk_lookup msm_clocks_8x50[] = {
CLK_PCOM("usb_phy_clk", USB_PHY_CLK, NULL, 0), CLK_PCOM("usb_phy_clk", USB_PHY_CLK, NULL, 0),
}; };
unsigned msm_num_clocks_8x50 = ARRAY_SIZE(msm_clocks_8x50); static struct pcom_clk_pdata msm_clock_8x50_pdata = {
.lookup = msm_clocks_8x50,
.num_lookups = ARRAY_SIZE(msm_clocks_8x50),
};
struct platform_device msm_clock_8x50 = {
.name = "msm-clock-pcom",
.dev.platform_data = &msm_clock_8x50_pdata,
};
...@@ -16,10 +16,6 @@ ...@@ -16,10 +16,6 @@
#ifndef __ARCH_ARM_MACH_MSM_DEVICES_H #ifndef __ARCH_ARM_MACH_MSM_DEVICES_H
#define __ARCH_ARM_MACH_MSM_DEVICES_H #define __ARCH_ARM_MACH_MSM_DEVICES_H
#include <linux/clkdev.h>
#include "clock.h"
extern struct platform_device msm_device_gpio_7201; extern struct platform_device msm_device_gpio_7201;
extern struct platform_device msm_device_gpio_7x30; extern struct platform_device msm_device_gpio_7x30;
extern struct platform_device msm_device_gpio_8x50; extern struct platform_device msm_device_gpio_8x50;
...@@ -50,13 +46,8 @@ extern struct platform_device msm_device_mddi0; ...@@ -50,13 +46,8 @@ extern struct platform_device msm_device_mddi0;
extern struct platform_device msm_device_mddi1; extern struct platform_device msm_device_mddi1;
extern struct platform_device msm_device_mdp; extern struct platform_device msm_device_mdp;
extern struct clk_lookup msm_clocks_7x01a[]; extern struct platform_device msm_clock_7x01a;
extern unsigned msm_num_clocks_7x01a; extern struct platform_device msm_clock_7x30;
extern struct platform_device msm_clock_8x50;
extern struct clk_lookup msm_clocks_7x30[];
extern unsigned msm_num_clocks_7x30;
extern struct clk_lookup msm_clocks_8x50[];
extern unsigned msm_num_clocks_8x50;
#endif #endif
...@@ -20,16 +20,11 @@ ...@@ -20,16 +20,11 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/platform_data/mmc-msm_sdcc.h> #include <linux/platform_data/mmc-msm_sdcc.h>
/* platform device data structures */
struct clk_lookup;
/* common init routines for use by arch/arm/mach-msm/board-*.c */ /* common init routines for use by arch/arm/mach-msm/board-*.c */
void __init msm_add_devices(void); void __init msm_add_devices(void);
void __init msm_init_irq(void); void __init msm_init_irq(void);
void __init msm_init_gpio(void); void __init msm_init_gpio(void);
void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks);
int __init msm_add_sdcc(unsigned int controller, int __init msm_add_sdcc(unsigned int controller,
struct msm_mmc_platform_data *plat, struct msm_mmc_platform_data *plat,
unsigned int stat_irq, unsigned long stat_irq_flags); unsigned int stat_irq, unsigned long stat_irq_flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment