Migrate MSM to clkdev
Subsystems (3)
cover Migrate MSM to clkdev
These two patches migrate the current MSM clock code to clkdev. In the process clock-dummy.c is removed since clk_get() implemented in clkdev already returns -ENOENT for non-existent clocks.
Prepared against davidb/linx-msm.git for-next.
Stephen Boyd (2):
msm: clock: Remove references to clk_ops_pcom
msm: clock: Migrate to clkdev
arch/arm/Kconfig | 1 + arch/arm/mach-msm/Makefile | 6 +--- arch/arm/mach-msm/board-msm7x30.c | 1 + arch/arm/mach-msm/board-msm8960.c | 1 + arch/arm/mach-msm/board-qsd8x50.c | 1 + arch/arm/mach-msm/board-trout.c | 1 + arch/arm/mach-msm/clock-7x30.h | 30 ++++++++++------- arch/arm/mach-msm/clock-debug.c | 3 +- arch/arm/mach-msm/clock-dummy.c | 54 ------------------------------- arch/arm/mach-msm/clock-pcom.c | 6 +++ arch/arm/mach-msm/clock-pcom.h | 16 +++++---- arch/arm/mach-msm/clock.c | 50 ++++------------------------ arch/arm/mach-msm/clock.h | 3 +- arch/arm/mach-msm/devices-msm7x00.c | 32 +++++++++--------- arch/arm/mach-msm/devices-msm7x30.c | 5 ++- arch/arm/mach-msm/devices-qsd8x50.c | 23 +++++++------ arch/arm/mach-msm/devices.h | 8 +++-- arch/arm/mach-msm/include/mach/board.h | 4 +- arch/arm/mach-msm/include/mach/clkdev.h | 19 +++++++++++ 19 files changed, 105 insertions(+), 159 deletions(-) delete mode 100644 arch/arm/mach-msm/clock-dummy.c create mode 100644 arch/arm/mach-msm/include/mach/clkdev.h
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 1/2 msm: clock: Remove references to clk_ops_pcom
Not all devices use proc_comm and determining if a clock is local vs. remote is fragile when done by comparing clk_ops pointers. Instead, implement an is_local() function for all clk_ops to determine if the clock is local. Doing this allows us to remove the last references to clk_ops_pcom from clock.c and compile it for targets with CONFIG_MSM_PROC_COMM=n.
We don't need to set the clk_ops at runtime until 7x30 local clock detection comes in. Right now it's just complicating things so just set the ops pointer statically.
--- arch/arm/mach-msm/Makefile | 6 +--- arch/arm/mach-msm/clock-7x30.h | 1 + arch/arm/mach-msm/clock-debug.c | 3 +- arch/arm/mach-msm/clock-dummy.c | 54 --------------------------------------- arch/arm/mach-msm/clock-pcom.c | 6 ++++ arch/arm/mach-msm/clock.c | 17 +----------- arch/arm/mach-msm/clock.h | 1 + 7 files changed, 11 insertions(+), 77 deletions(-) delete mode 100644 arch/arm/mach-msm/clock-dummy.c
arch/arm/mach-msm/Makefile +1 -5
@@ -1,7 +1,6 @@ obj-y += io.o idle.o timer.o -ifdef CONFIG_MSM_PROC_COMM +obj-y += clock.o obj-$(CONFIG_DEBUG_FS) += clock-debug.o -endif obj-$(CONFIG_MSM_VIC) += irq-vic.o obj-$(CONFIG_MSM_IOMMU) += iommu.o iommu_dev.o devices-iommu.o
@@ -9,11 +8,8 @@ obj-$(CONFIG_MSM_IOMMU) += iommu.o iommu_dev.o devices-iommu.o obj-$(CONFIG_ARCH_MSM7X00A) += dma.o irq.o acpuclock-arm11.o obj-$(CONFIG_ARCH_MSM7X30) += dma.o obj-$(CONFIG_ARCH_QSD8X50) += dma.o sirc.o -obj-$(CONFIG_ARCH_MSM8X60) += clock-dummy.o -obj-$(CONFIG_ARCH_MSM8960) += clock-dummy.o obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o -obj-$(CONFIG_MSM_PROC_COMM) += clock.o obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o obj-$(CONFIG_MSM_SMD) += last_radio_log.o
arch/arm/mach-msm/clock-7x30.h +1 -0
@@ -162,6 +162,7 @@ extern int internal_pwr_rail_ctl_auto(unsigned rail_id, bool enable); .flags = clk_flags, \ .dev = clk_dev, \ .dbg_name = #l_id, \ + .ops = &clk_ops_pcom, \ }#endif
arch/arm/mach-msm/clock-debug.c +1 -2
@@ -19,7 +19,6 @@#include <linux/debugfs.h> #include <linux/clk.h> #include "clock.h" -#include "clock-pcom.h" static int clock_debug_rate_set (void *data,u64 val) {
@@ -79,7 +78,7 @@ static int clock_debug_local_get(void *data, u64 *val) {struct clk *clock = data; - *val = clock->ops != &clk_ops_pcom; + *val = clock->ops->is_local (clock->id);return 0 ; }
arch/arm/mach-msm/clock-dummy.c deleted +0 -54
54 lines not on this page · raw message
arch/arm/mach-msm/clock-pcom.c +6 -0
@@ -117,6 +117,11 @@ long pc_clk_round_rate(unsigned id, unsigned rate)return rate; } +static bool pc_clk_is_local (unsigned id) +{ +return false; +} +struct clk_ops clk_ops_pcom = { .enable = pc_clk_enable, .disable = pc_clk_disable,
@@ -129,4 +134,5 @@ struct clk_ops clk_ops_pcom = { .get_rate = pc_clk_get_rate, .is_enabled = pc_clk_is_enabled, .round_rate = pc_clk_round_rate, + .is_local = pc_clk_is_local, };
arch/arm/mach-msm/clock.c +1 -16
@@ -21,9 +21,6 @@#include <linux/pm_qos_params.h> #include "clock.h" -#include "proc_comm.h" -#include "clock-7x30.h" -#include "clock-pcom.h" static DEFINE_MUTEX (clocks_mutex);static DEFINE_SPINLOCK (clocks_lock);
@@ -84,8 +81,6 @@ EXPORT_SYMBOL(clk_disable);int clk_reset (struct clk *clk,enum clk_reset_action action) { -if (!clk->ops->reset) - clk->ops->reset = &pc_clk_reset;return clk->ops->reset (clk->remote_id, action); }EXPORT_SYMBOL (clk_reset);
@@ -162,23 +157,13 @@ EXPORT_SYMBOL(clk_set_flags);*/ static struct clk *ebi1_clk; -static void __init set_clock_ops (struct clk *clk) -{ -if (!clk->ops) { - clk->ops = &clk_ops_pcom; - clk->id = clk->remote_id; - } -} -void __init msm_clock_init (struct clk *clock_tbl,unsigned num_clocks) {unsigned n;mutex_lock (&clocks_mutex); -for (n =0 ; n < num_clocks; n++) { -set_clock_ops (&clock_tbl[n]); +for (n =0 ; n < num_clocks; n++)list_add_tail (&clock_tbl[n].list, &clocks); - }mutex_unlock (&clocks_mutex); ebi1_clk =clk_get (NULL ,"ebi1_clk" );
arch/arm/mach-msm/clock.h +1 -0
@@ -43,6 +43,7 @@ struct clk_ops {unsigned (*get_rate)(unsigned id);unsigned (*is_enabled)(unsigned id);long (*round_rate)(unsigned id,unsigned rate); +bool (*is_local)(unsigned id); };struct clk {
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 2/2 msm: clock: Migrate to clkdev
In reply to Stephen BoydMigrating to clkdev has several advantages:
* Less code in mach-msm/clock.c
* A more robust clk_get() implementation
* clk_add_alias() support
* clk_get_sys() support
In general, this will help board authors setup clock aliases and break the dependency on device pointers in the clock tables.
--- arch/arm/Kconfig | 1 + arch/arm/mach-msm/board-msm7x30.c | 1 + arch/arm/mach-msm/board-msm8960.c | 1 + arch/arm/mach-msm/board-qsd8x50.c | 1 + arch/arm/mach-msm/board-trout.c | 1 + arch/arm/mach-msm/clock-7x30.h | 31 +++++++++++++----------- arch/arm/mach-msm/clock-pcom.h | 16 +++++++----- arch/arm/mach-msm/clock.c | 39 ++++++++----------------------- arch/arm/mach-msm/clock.h | 2 - arch/arm/mach-msm/devices-msm7x00.c | 32 ++++++++++++------------ arch/arm/mach-msm/devices-msm7x30.c | 5 ++- arch/arm/mach-msm/devices-qsd8x50.c | 23 +++++++++-------- arch/arm/mach-msm/devices.h | 8 ++++-- arch/arm/mach-msm/include/mach/board.h | 4 +- arch/arm/mach-msm/include/mach/clkdev.h | 19 +++++++++++++++ 15 files changed, 98 insertions(+), 86 deletions(-) create mode 100644 arch/arm/mach-msm/include/mach/clkdev.h
arch/arm/Kconfig +1 -0
@@ -619,6 +619,7 @@ config ARCH_MSM select HAVE_CLK select GENERIC_CLOCKEVENTS select ARCH_REQUIRE_GPIOLIB + select CLKDEV_LOOKUP help Support for Qualcomm MSM/QSD based systems. This runs on the apps processor of the MSM/QSD and depends on a shared memory
arch/arm/mach-msm/board-msm7x30.c +1 -0
@@ -23,6 +23,7 @@#include <linux/io.h> #include <linux/smsc911x.h> #include <linux/usb/msm_hsusb.h> +#include <linux/clkdev.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
arch/arm/mach-msm/board-msm8960.c +1 -0
@@ -19,6 +19,7 @@#include <linux/platform_device.h> #include <linux/io.h> #include <linux/irq.h> +#include <linux/clkdev.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
arch/arm/mach-msm/board-qsd8x50.c +1 -0
@@ -22,6 +22,7 @@#include <linux/delay.h> #include <linux/usb/msm_hsusb.h> #include <linux/err.h> +#include <linux/clkdev.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
arch/arm/mach-msm/board-trout.c +1 -0
@@ -17,6 +17,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> +#include <linux/clkdev.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
arch/arm/mach-msm/clock-7x30.h +17 -14
@@ -147,23 +147,26 @@ void pll_disable(uint32_t pll);extern int internal_pwr_rail_ctl_auto (unsigned rail_id,bool enable);#define CLK_7X30 (clk_name, clk_id, clk_dev, clk_flags) { \ - .name = clk_name, \ - .id = L_7X30_##clk_id, \ - .remote_id = P_##clk_id, \ - .flags = clk_flags, \ - .dev = clk_dev, \ - .dbg_name = #clk_id, \ + .con_id = clk_name, \ + .dev_id = clk_dev, \ + .clk = &(struct clk){ \ + .id = L_7X30_##clk_id, \ + .remote_id = P_##clk_id, \ + .flags = clk_flags, \ + .dbg_name = #clk_id, \ + }, \ }#define CLK_7X30S (clk_name, l_id, r_id, clk_dev, clk_flags) { \ - .name = clk_name, \ - .id = L_7X30_##l_id, \ - .remote_id = P_##r_id, \ - .flags = clk_flags, \ - .dev = clk_dev, \ - .dbg_name = #l_id, \ - .ops = &clk_ops_pcom, \ + .con_id = clk_name, \ + .dev_id = clk_dev, \ + .clk = &(struct clk){ \ + .id = L_7X30_##l_id, \ + .remote_id = P_##r_id, \ + .flags = clk_flags, \ + .dbg_name = #l_id, \ + .ops = &clk_ops_pcom, \ + }, \ }#endif -
arch/arm/mach-msm/clock-pcom.h +9 -7
@@ -143,13 +143,15 @@ extern struct clk_ops clk_ops_pcom;int pc_clk_reset (unsigned id,enum clk_reset_action action);#define CLK_PCOM (clk_name, clk_id, clk_dev, clk_flags) { \ - .name = clk_name, \ - .id = P_##clk_id, \ - .remote_id = P_##clk_id, \ - .ops = &clk_ops_pcom, \ - .flags = clk_flags, \ - .dev = clk_dev, \ - .dbg_name = #clk_id, \ + .con_id = clk_name, \ + .dev_id = clk_dev, \ + .clk = &(struct clk){ \ + .id = P_##clk_id, \ + .remote_id = P_##clk_id, \ + .ops = &clk_ops_pcom, \ + .flags = clk_flags, \ + .dbg_name = #clk_id, \ + }, \ }#endif
arch/arm/mach-msm/clock.c +10 -29
@@ -19,6 +19,11 @@#include <linux/err.h> #include <linux/spinlock.h> #include <linux/pm_qos_params.h> +#include <linux/mutex.h> +#include <linux/clk.h> +#include <linux/string.h> +#include <linux/module.h> +#include <linux/clkdev.h> #include "clock.h"
@@ -29,32 +34,6 @@ static LIST_HEAD(clocks);/* * Standard clock functions defined in include/linux/clk.h */ -struct clk *clk_get (struct device *dev,const char *id) -{ -struct clk *clk; - -mutex_lock (&clocks_mutex); - -list_for_each_entry (clk, &clocks, list) -if (!strcmp (id, clk->name) && clk->dev == dev) - goto found_it; - -list_for_each_entry (clk, &clocks, list) -if (!strcmp (id, clk->name) && clk->dev ==NULL ) - goto found_it; - - clk =ERR_PTR (-ENOENT ); -found_it: -mutex_unlock (&clocks_mutex); -return clk; -} -EXPORT_SYMBOL (clk_get); - -void clk_put (struct clk *clk) -{ -} -EXPORT_SYMBOL (clk_put); -int clk_enable (struct clk *clk) {unsigned long flags;
@@ -157,13 +136,15 @@ EXPORT_SYMBOL(clk_set_flags);*/ static struct clk *ebi1_clk; -void __init msm_clock_init (struct clk *clock_tbl,unsigned num_clocks) +void __init msm_clock_init (struct clk_lookup *clock_tbl,unsigned num_clocks) {unsigned n;mutex_lock (&clocks_mutex); -for (n =0 ; n < num_clocks; n++) -list_add_tail (&clock_tbl[n].list, &clocks); +for (n =0 ; n < num_clocks; n++) { +clkdev_add (&clock_tbl[n]); +list_add_tail (&clock_tbl[n].clk->list, &clocks); + }mutex_unlock (&clocks_mutex); ebi1_clk =clk_get (NULL ,"ebi1_clk" );
arch/arm/mach-msm/clock.h +0 -2
@@ -51,11 +51,9 @@ struct clk {uint32_t remote_id;uint32_t count;uint32_t flags; -const char *name;struct clk_ops *ops;const char *dbg_name;struct list_head list; -struct device *dev; };#define OFF CLKFLAG_AUTO_OFF
arch/arm/mach-msm/devices-msm7x00.c +16 -16
@@ -15,6 +15,7 @@#include <linux/kernel.h> #include <linux/platform_device.h> +#include <linux/clkdev.h> #include <mach/irqs.h> #include <mach/msm_iomap.h>
@@ -24,7 +25,6 @@#include <linux/mtd/nand.h> #include <linux/mtd/partitions.h> -#include "clock.h" #include "clock-pcom.h" #include <mach/mmc.h>
@@ -418,7 +418,7 @@ struct platform_device msm_device_mdp = { .resource = resources_mdp, }; -struct clk msm_clocks_7x01a[] = { +struct clk_lookup msm_clocks_7x01a[] = {CLK_PCOM ("adm_clk" ,ADM_CLK ,NULL ,0 ),CLK_PCOM ("adsp_clk" ,ADSP_CLK ,NULL ,0 ),CLK_PCOM ("ebi1_clk" ,EBI1_CLK ,NULL ,0 ),
@@ -427,7 +427,7 @@ struct clk msm_clocks_7x01a[] = {CLK_PCOM ("emdh_clk" ,EMDH_CLK ,NULL ,OFF ),CLK_PCOM ("gp_clk" ,GP_CLK ,NULL ,0 ),CLK_PCOM ("grp_clk" ,GRP_3D_CLK ,NULL ,OFF ), -CLK_PCOM ("i2c_clk" ,I2C_CLK , &msm_device_i2c.dev,0 ), +CLK_PCOM ("i2c_clk" ,I2C_CLK ,"msm_i2c.0" ,0 ),CLK_PCOM ("icodec_rx_clk" ,ICODEC_RX_CLK ,NULL ,0 ),CLK_PCOM ("icodec_tx_clk" ,ICODEC_TX_CLK ,NULL ,0 ), CLK_PCOM("imem_clk", IMEM_CLK, NULL, OFF),
@@ -437,25 +437,25 @@ struct clk msm_clocks_7x01a[] = {CLK_PCOM ("pcm_clk" ,PCM_CLK ,NULL ,0 ),CLK_PCOM ("mddi_clk" ,PMDH_CLK ,NULL ,OFF |CLK_MINMAX ),CLK_PCOM ("sdac_clk" ,SDAC_CLK ,NULL ,OFF ), -CLK_PCOM ("sdc_clk" ,SDC1_CLK , &msm_device_sdc1.dev,OFF ), -CLK_PCOM ("sdc_pclk" ,SDC1_P_CLK , &msm_device_sdc1.dev,OFF ), -CLK_PCOM ("sdc_clk" ,SDC2_CLK , &msm_device_sdc2.dev,OFF ), -CLK_PCOM ("sdc_pclk" ,SDC2_P_CLK , &msm_device_sdc2.dev,OFF ), -CLK_PCOM ("sdc_clk" ,SDC3_CLK , &msm_device_sdc3.dev,OFF ), -CLK_PCOM ("sdc_pclk" ,SDC3_P_CLK , &msm_device_sdc3.dev,OFF ), -CLK_PCOM ("sdc_clk" ,SDC4_CLK , &msm_device_sdc4.dev,OFF ), -CLK_PCOM ("sdc_pclk" ,SDC4_P_CLK , &msm_device_sdc4.dev,OFF ), +CLK_PCOM ("sdc_clk" ,SDC1_CLK ,"msm_sdcc.1" ,OFF ), +CLK_PCOM ("sdc_pclk" ,SDC1_P_CLK ,"msm_sdcc.1" ,OFF ), +CLK_PCOM ("sdc_clk" ,SDC2_CLK ,"msm_sdcc.2" ,OFF ), +CLK_PCOM ("sdc_pclk" ,SDC2_P_CLK ,"msm_sdcc.2" ,OFF ), +CLK_PCOM ("sdc_clk" ,SDC3_CLK ,"msm_sdcc.3" ,OFF ), +CLK_PCOM ("sdc_pclk" ,SDC3_P_CLK ,"msm_sdcc.3" ,OFF ), +CLK_PCOM ("sdc_clk" ,SDC4_CLK ,"msm_sdcc.4" ,OFF ), +CLK_PCOM ("sdc_pclk" ,SDC4_P_CLK ,"msm_sdcc.4" ,OFF ),CLK_PCOM ("tsif_clk" ,TSIF_CLK ,NULL ,0 ),CLK_PCOM ("tsif_ref_clk" ,TSIF_REF_CLK ,NULL ,0 ),CLK_PCOM ("tv_dac_clk" ,TV_DAC_CLK ,NULL ,0 ),CLK_PCOM ("tv_enc_clk" ,TV_ENC_CLK ,NULL ,0 ), -CLK_PCOM ("uart_clk" ,UART1_CLK , &msm_device_uart1.dev,OFF ), -CLK_PCOM ("uart_clk" ,UART2_CLK , &msm_device_uart2.dev,0 ), -CLK_PCOM ("uart_clk" ,UART3_CLK , &msm_device_uart3.dev,OFF ), +CLK_PCOM ("uart_clk" ,UART1_CLK ,"msm_serial.0" ,OFF ), +CLK_PCOM ("uart_clk" ,UART2_CLK ,"msm_serial.1" ,0 ), +CLK_PCOM ("uart_clk" ,UART3_CLK ,"msm_serial.2" ,OFF ),CLK_PCOM ("uart1dm_clk" ,UART1DM_CLK ,NULL ,OFF ),CLK_PCOM ("uart2dm_clk" ,UART2DM_CLK ,NULL ,0 ), -CLK_PCOM ("usb_hs_clk" ,USB_HS_CLK , &msm_device_hsusb.dev,OFF ), -CLK_PCOM ("usb_hs_pclk" ,USB_HS_P_CLK , &msm_device_hsusb.dev,OFF ), +CLK_PCOM ("usb_hs_clk" ,USB_HS_CLK ,"msm_hsusb" ,OFF ), +CLK_PCOM ("usb_hs_pclk" ,USB_HS_P_CLK ,"msm_hsusb" ,OFF ),CLK_PCOM ("usb_otg_clk" ,USB_OTG_CLK ,NULL ,0 ),CLK_PCOM ("vdc_clk" ,VDC_CLK ,NULL ,OFF ), CLK_PCOM("vfe_clk", VFE_CLK, NULL, OFF),
arch/arm/mach-msm/devices-msm7x30.c +3 -2
@@ -17,6 +17,7 @@#include <linux/platform_device.h> #include <linux/dma-mapping.h> +#include <linux/clkdev.h> #include <mach/irqs.h> #include <mach/msm_iomap.h> #include <mach/dma.h>
@@ -129,7 +130,7 @@ struct platform_device msm_device_hsusb_host = { }, }; -struct clk msm_clocks_7x30[] = { +struct clk_lookup msm_clocks_7x30[] = {CLK_PCOM ("adm_clk" ,ADM_CLK ,NULL ,0 ),CLK_PCOM ("adsp_clk" ,ADSP_CLK ,NULL ,0 ),CLK_PCOM ("cam_m_clk" ,CAM_M_CLK ,NULL ,0 ),
@@ -181,7 +182,7 @@ struct clk msm_clocks_7x30[] = {CLK_7X30S ("tv_src_clk" ,TV_CLK ,TV_ENC_CLK ,NULL ,0 ),CLK_PCOM ("tv_dac_clk" ,TV_DAC_CLK ,NULL ,0 ),CLK_PCOM ("tv_enc_clk" ,TV_ENC_CLK ,NULL ,0 ), -CLK_PCOM ("uart_clk" ,UART2_CLK , &msm_device_uart2.dev,0 ), +CLK_PCOM ("uart_clk" ,UART2_CLK ,"msm_serial.1" ,0 ),CLK_PCOM ("usb_phy_clk" ,USB_PHY_CLK ,NULL ,0 ),CLK_PCOM ("usb_hs_clk" ,USB_HS_CLK ,NULL ,OFF ), CLK_PCOM("usb_hs_pclk", USB_HS_P_CLK, NULL, OFF),
arch/arm/mach-msm/devices-qsd8x50.c +12 -11
@@ -15,8 +15,9 @@#include <linux/kernel.h> #include <linux/platform_device.h> - +#include <linux/clkdev.h> #include <linux/dma-mapping.h> +#include <mach/irqs.h> #include <mach/msm_iomap.h> #include <mach/dma.h>
@@ -314,7 +315,7 @@ int __init msm_add_sdcc(unsigned int controller,return platform_device_register (pdev); } -struct clk msm_clocks_8x50[] = { +struct clk_lookup msm_clocks_8x50[] = {CLK_PCOM ("adm_clk" ,ADM_CLK ,NULL ,0 ),CLK_PCOM ("ce_clk" ,CE_CLK ,NULL ,0 ),CLK_PCOM ("ebi1_clk" ,EBI1_CLK ,NULL ,CLK_MIN ),
@@ -336,14 +337,14 @@ struct clk msm_clocks_8x50[] = {CLK_PCOM ("pbus_clk" ,PBUS_CLK ,NULL ,CLK_MIN ),CLK_PCOM ("pcm_clk" ,PCM_CLK ,NULL ,0 ),CLK_PCOM ("sdac_clk" ,SDAC_CLK ,NULL ,OFF ), -CLK_PCOM ("sdc_clk" ,SDC1_CLK , &msm_device_sdc1.dev,OFF ), -CLK_PCOM ("sdc_pclk" ,SDC1_P_CLK , &msm_device_sdc1.dev,OFF ), -CLK_PCOM ("sdc_clk" ,SDC2_CLK , &msm_device_sdc2.dev,OFF ), -CLK_PCOM ("sdc_pclk" ,SDC2_P_CLK , &msm_device_sdc2.dev,OFF ), -CLK_PCOM ("sdc_clk" ,SDC3_CLK , &msm_device_sdc3.dev,OFF ), -CLK_PCOM ("sdc_pclk" ,SDC3_P_CLK , &msm_device_sdc3.dev,OFF ), -CLK_PCOM ("sdc_clk" ,SDC4_CLK , &msm_device_sdc4.dev,OFF ), -CLK_PCOM ("sdc_pclk" ,SDC4_P_CLK , &msm_device_sdc4.dev,OFF ), +CLK_PCOM ("sdc_clk" ,SDC1_CLK ,"msm_sdcc.1" ,OFF ), +CLK_PCOM ("sdc_pclk" ,SDC1_P_CLK ,"msm_sdcc.1" ,OFF ), +CLK_PCOM ("sdc_clk" ,SDC2_CLK ,"msm_sdcc.2" ,OFF ), +CLK_PCOM ("sdc_pclk" ,SDC2_P_CLK ,"msm_sdcc.2" ,OFF ), +CLK_PCOM ("sdc_clk" ,SDC3_CLK ,"msm_sdcc.3" ,OFF ), +CLK_PCOM ("sdc_pclk" ,SDC3_P_CLK ,"msm_sdcc.3" ,OFF ), +CLK_PCOM ("sdc_clk" ,SDC4_CLK ,"msm_sdcc.4" ,OFF ), +CLK_PCOM ("sdc_pclk" ,SDC4_P_CLK ,"msm_sdcc.4" ,OFF ),CLK_PCOM ("spi_clk" ,SPI_CLK ,NULL ,0 ),CLK_PCOM ("tsif_clk" ,TSIF_CLK ,NULL ,0 ), CLK_PCOM("tsif_ref_clk", TSIF_REF_CLK, NULL, 0),
@@ -351,7 +352,7 @@ struct clk msm_clocks_8x50[] = {CLK_PCOM ("tv_enc_clk" ,TV_ENC_CLK ,NULL ,0 ),CLK_PCOM ("uart_clk" ,UART1_CLK ,NULL ,OFF ),CLK_PCOM ("uart_clk" ,UART2_CLK ,NULL ,0 ), -CLK_PCOM ("uart_clk" ,UART3_CLK , &msm_device_uart3.dev,OFF ), +CLK_PCOM ("uart_clk" ,UART3_CLK ,"msm_serial.2" ,OFF ),CLK_PCOM ("uartdm_clk" ,UART1DM_CLK ,NULL ,OFF ),CLK_PCOM ("uartdm_clk" ,UART2DM_CLK ,NULL ,0 ), CLK_PCOM("usb_hs_clk", USB_HS_CLK, NULL, OFF),
arch/arm/mach-msm/devices.h +5 -3
@@ -16,6 +16,8 @@#ifndef __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_uart1;
@@ -44,13 +46,13 @@ extern struct platform_device msm_device_mddi0;extern struct platform_device msm_device_mddi1;extern struct platform_device msm_device_mdp; -extern struct clk msm_clocks_7x01a[]; +extern struct clk_lookup msm_clocks_7x01a[];extern unsigned msm_num_clocks_7x01a; -extern struct clk msm_clocks_7x30[]; +extern struct clk_lookup msm_clocks_7x30[];extern unsigned msm_num_clocks_7x30; -extern struct clk msm_clocks_8x50[]; +extern struct clk_lookup msm_clocks_8x50[];extern unsigned msm_num_clocks_8x50;#endif
arch/arm/mach-msm/include/mach/board.h +2 -2
@@ -31,7 +31,7 @@ struct msm_acpu_clock_platform_dataunsigned long wait_for_irq_khz; }; -struct clk ; +struct clk_lookup ;extern struct sys_timer msm_timer;
@@ -41,7 +41,7 @@ void __init msm_add_devices(void);void __init msm_map_common_io (void );void __init msm_init_irq (void );void __init msm_init_gpio (void ); -void __init msm_clock_init (struct clk *clock_tbl,unsigned num_clocks); +void __init msm_clock_init (struct clk_lookup *clock_tbl,unsigned num_clocks);void __init msm_acpu_clock_init (struct msm_acpu_clock_platform_data *); int __init msm_add_sdcc(unsigned int controller, struct msm_mmc_platform_data *plat,
arch/arm/mach-msm/include/mach/clkdev.h new file +19 -0
@@ -0,0 +1,19 @@ +/* Copyright (c) 2011, Code Aurora Forum. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 and +* only version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ +#ifndef __ASM_ARCH_MSM_CLKDEV_H +#define __ASM_ARCH_MSM_CLKDEV_H + +struct clk ; + +static inline int __clk_get (struct clk *clk) {return 1 ; } +static inline void __clk_put (struct clk *clk) { } +#endif
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [PATCH 2/2] msm: clock: Migrate to clkdev
Quoted 24 lines · Stephen Boyd
Migrating to clkdev has several advantages:
* Less code in
mach-msm/clock.c* A more robust
clk_get()implementation*
clk_add_alias()support*
clk_get_sys()supportIn general, this will help board authors setup clock aliases and break the dependency on device pointers in the clock tables.
Signed-off-by Stephen Boyd <[email protected]>--- arch/arm/Kconfig | 1 + arch/arm/mach-msm/board-msm7x30.c | 1 + arch/arm/mach-msm/board-msm8960.c | 1 + arch/arm/mach-msm/board-qsd8x50.c | 1 + arch/arm/mach-msm/board-trout.c | 1 + arch/arm/mach-msm/clock-7x30.h | 31 +++++++++++++----------- arch/arm/mach-msm/clock-pcom.h | 16 +++++++----- arch/arm/mach-msm/clock.c | 39 ++++++++----------------------- arch/arm/mach-msm/clock.h | 2 -
Quoted 8 lines
arch/arm/mach-msm/devices-msm7x00.c | 32 ++++++++++++------------ arch/arm/mach-msm/devices-msm7x30.c | 5 ++- arch/arm/mach-msm/devices-qsd8x50.c | 23 +++++++++-------- arch/arm/mach-msm/devices.h | 8 ++++-- arch/arm/mach-msm/include/mach/board.h | 4 +- arch/arm/mach-msm/include/mach/clkdev.h | 19 +++++++++++++++ 15 files changed, 98 insertions(+), 86 deletions(-) create mode 100644 arch/arm/mach-msm/include/mach/clkdev.h
This doesn't seem to apply cleanly. Do you mind resending this against the msm for/next branch.
Thanks,
David
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.