aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-msm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-02 17:42:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-02 17:42:51 -0400
commit42daabf62bfa3c00974b43f030dadcf704c0db59 (patch)
tree255f279cad48557227d974d67cbbc8390d057404 /arch/arm/mach-msm
parent0bf6a210a43f7118d858806200127e421649fc4e (diff)
parent8c3d913888cfb0066d62831969c3a992f7e4aba5 (diff)
Merge tag 'late-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC late changes from Arnd Bergmann: "These are changes that arrived a little late before the merge window or that have multiple dependencies on previous branches so they did not fit into one of the earlier ones. There are 10 branches merged here, a total of 39 non-merge commits. Contents are a mixed bag for the above reasons: * Two new SoC platforms: ST microelectronics stixxxx and the TI 'Nspire' graphing calculator. These should have been in the 'soc' branch but were a little late * Support for the Exynos 5420 variant in mach-exynos, which is based on the other exynos branches to avoid conflicts. * Various small changes for sh-mobile, ux500 and davinci * Common clk support for MSM" * tag 'late-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (39 commits) ARM: ux500: bail out on alien cpus ARM: davinci: da850: adopt to pinctrl-single change for configuring multiple pins serial: sh-sci: Initialise variables before access in sci_set_termios() ARM: stih41x: Add B2020 board support ARM: stih41x: Add B2000 board support ARM: sti: Add DEBUG_LL console support ARM: sti: Add STiH416 SOC support ARM: sti: Add STiH415 SOC support ARM: msm: Migrate to common clock framework ARM: msm: Make proc_comm clock control into a platform driver ARM: msm: Prepare clk_get() users in mach-msm for clock-pcom driver ARM: msm: Remove clock-7x30.h include file ARM: msm: Remove custom clk_set_{max,min}_rate() API ARM: msm: Remove custom clk_set_flags() API msm: iommu: Use clk_set_rate() instead of clk_set_min_rate() msm: iommu: Convert to clk_prepare/unprepare msm_sdcc: Convert to clk_prepare/unprepare usb: otg: msm: Convert to clk_prepare/unprepare msm_serial: Use devm_clk_get() and properly return errors msm_serial: Convert to clk_prepare/unprepare ...
Diffstat (limited to 'arch/arm/mach-msm')
-rw-r--r--arch/arm/mach-msm/Makefile10
-rw-r--r--arch/arm/mach-msm/board-halibut.c2
-rw-r--r--arch/arm/mach-msm/board-msm7x30.c2
-rw-r--r--arch/arm/mach-msm/board-qsd8x50.c2
-rw-r--r--arch/arm/mach-msm/board-trout-panel.c19
-rw-r--r--arch/arm/mach-msm/board-trout.c3
-rw-r--r--arch/arm/mach-msm/clock-7x30.h155
-rw-r--r--arch/arm/mach-msm/clock-debug.c130
-rw-r--r--arch/arm/mach-msm/clock-pcom.c149
-rw-r--r--arch/arm/mach-msm/clock-pcom.h31
-rw-r--r--arch/arm/mach-msm/clock.c166
-rw-r--r--arch/arm/mach-msm/clock.h51
-rw-r--r--arch/arm/mach-msm/devices-msm7x00.c12
-rw-r--r--arch/arm/mach-msm/devices-msm7x30.c15
-rw-r--r--arch/arm/mach-msm/devices-qsd8x50.c12
-rw-r--r--arch/arm/mach-msm/devices.h15
-rw-r--r--arch/arm/mach-msm/dma.c5
-rw-r--r--arch/arm/mach-msm/include/mach/board.h5
-rw-r--r--arch/arm/mach-msm/include/mach/clk.h9
19 files changed, 180 insertions, 613 deletions
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 1a26d04c9400..d257ff40e16b 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -1,16 +1,18 @@
1obj-y += io.o timer.o 1obj-y += io.o timer.o
2obj-y += clock.o 2obj-y += clock.o
3obj-$(CONFIG_DEBUG_FS) += clock-debug.o
4 3
5obj-$(CONFIG_MSM_VIC) += irq-vic.o 4obj-$(CONFIG_MSM_VIC) += irq-vic.o
6obj-$(CONFIG_MSM_IOMMU) += devices-iommu.o 5obj-$(CONFIG_MSM_IOMMU) += devices-iommu.o
7 6
8obj-$(CONFIG_ARCH_MSM7X00A) += dma.o irq.o 7obj-$(CONFIG_ARCH_MSM7X00A) += irq.o
9obj-$(CONFIG_ARCH_MSM7X30) += dma.o 8obj-$(CONFIG_ARCH_QSD8X50) += sirc.o
10obj-$(CONFIG_ARCH_QSD8X50) += dma.o sirc.o
11 9
12obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o 10obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o
13 11
12obj-$(CONFIG_ARCH_MSM7X00A) += dma.o
13obj-$(CONFIG_ARCH_MSM7X30) += dma.o
14obj-$(CONFIG_ARCH_QSD8X50) += dma.o
15
14obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o 16obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o
15obj-$(CONFIG_MSM_SMD) += last_radio_log.o 17obj-$(CONFIG_MSM_SMD) += last_radio_log.o
16obj-$(CONFIG_MSM_SCM) += scm.o scm-boot.o 18obj-$(CONFIG_MSM_SCM) += scm.o scm-boot.o
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
61static struct platform_device *devices[] __initdata = { 61static 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,
91static void __init halibut_map_io(void) 92static 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
97static void __init halibut_init_late(void) 97static 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
91static struct platform_device *devices[] __initdata = { 91static 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)
116static void __init msm7x30_map_io(void) 117static 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
122static void __init msm7x30_init_late(void) 122static 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
91static struct platform_device *devices[] __initdata = { 91static 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)
172static void __init qsd8x50_map_io(void) 173static 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
178static void __init qsd8x50_init_irq(void) 178static void __init qsd8x50_init_irq(void)
diff --git a/arch/arm/mach-msm/board-trout-panel.c b/arch/arm/mach-msm/board-trout-panel.c
index f9a5db6d2ced..77b0a26f897f 100644
--- a/arch/arm/mach-msm/board-trout-panel.c
+++ b/arch/arm/mach-msm/board-trout-panel.c
@@ -7,7 +7,6 @@
7#include <linux/platform_device.h> 7#include <linux/platform_device.h>
8#include <linux/delay.h> 8#include <linux/delay.h>
9#include <linux/leds.h> 9#include <linux/leds.h>
10#include <linux/clk.h>
11#include <linux/err.h> 10#include <linux/err.h>
12 11
13#include <asm/io.h> 12#include <asm/io.h>
@@ -19,6 +18,7 @@
19 18
20#include "board-trout.h" 19#include "board-trout.h"
21#include "proc_comm.h" 20#include "proc_comm.h"
21#include "clock-pcom.h"
22#include "devices.h" 22#include "devices.h"
23 23
24#define TROUT_DEFAULT_BACKLIGHT_BRIGHTNESS 255 24#define TROUT_DEFAULT_BACKLIGHT_BRIGHTNESS 255
@@ -170,7 +170,6 @@ static struct mddi_table mddi_toshiba_init_table[] = {
170#define INTMASK_VWAKEOUT (1U << 0) 170#define INTMASK_VWAKEOUT (1U << 0)
171 171
172 172
173static struct clk *gp_clk;
174static int trout_new_backlight = 1; 173static int trout_new_backlight = 1;
175static struct vreg *vreg_mddi_1v5; 174static struct vreg *vreg_mddi_1v5;
176static struct vreg *vreg_lcm_2v85; 175static struct vreg *vreg_lcm_2v85;
@@ -273,18 +272,14 @@ int __init trout_init_panel(void)
273 } else { 272 } else {
274 uint32_t config = PCOM_GPIO_CFG(27, 1, GPIO_OUTPUT, 273 uint32_t config = PCOM_GPIO_CFG(27, 1, GPIO_OUTPUT,
275 GPIO_NO_PULL, GPIO_8MA); 274 GPIO_NO_PULL, GPIO_8MA);
275 uint32_t id = P_GP_CLK;
276 uint32_t rate = 19200000;
277
276 msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &config, 0); 278 msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &config, 0);
277 279
278 gp_clk = clk_get(NULL, "gp_clk"); 280 msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate);
279 if (IS_ERR(gp_clk)) { 281 if (id < 0)
280 printk(KERN_ERR "trout_init_panel: could not get gp" 282 pr_err("trout_init_panel: set clock rate failed\n");
281 "clock\n");
282 gp_clk = NULL;
283 }
284 rc = clk_set_rate(gp_clk, 19200000);
285 if (rc)
286 printk(KERN_ERR "trout_init_panel: set clock rate "
287 "failed\n");
288 } 283 }
289 284
290 rc = platform_device_register(&msm_device_mdp); 285 rc = platform_device_register(&msm_device_mdp);
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 @@
36extern int trout_init_mmc(unsigned int); 36extern int trout_init_mmc(unsigned int);
37 37
38static struct platform_device *devices[] __initdata = { 38static 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
101static void __init trout_init_late(void) 100static void __init trout_init_late(void)
diff --git a/arch/arm/mach-msm/clock-7x30.h b/arch/arm/mach-msm/clock-7x30.h
deleted file mode 100644
index 14104453688b..000000000000
--- a/arch/arm/mach-msm/clock-7x30.h
+++ /dev/null
@@ -1,155 +0,0 @@
1/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef __ARCH_ARM_MACH_MSM_CLOCK_7X30_H
14#define __ARCH_ARM_MACH_MSM_CLOCK_7X30_H
15
16enum {
17 L_7X30_NONE_CLK = -1,
18 L_7X30_ADM_CLK,
19 L_7X30_I2C_CLK,
20 L_7X30_I2C_2_CLK,
21 L_7X30_QUP_I2C_CLK,
22 L_7X30_UART1DM_CLK,
23 L_7X30_UART1DM_P_CLK,
24 L_7X30_UART2DM_CLK,
25 L_7X30_UART2DM_P_CLK,
26 L_7X30_EMDH_CLK,
27 L_7X30_EMDH_P_CLK,
28 L_7X30_PMDH_CLK,
29 L_7X30_PMDH_P_CLK,
30 L_7X30_GRP_2D_CLK,
31 L_7X30_GRP_2D_P_CLK,
32 L_7X30_GRP_3D_SRC_CLK,
33 L_7X30_GRP_3D_CLK,
34 L_7X30_GRP_3D_P_CLK,
35 L_7X30_IMEM_CLK,
36 L_7X30_SDC1_CLK,
37 L_7X30_SDC1_P_CLK,
38 L_7X30_SDC2_CLK,
39 L_7X30_SDC2_P_CLK,
40 L_7X30_SDC3_CLK,
41 L_7X30_SDC3_P_CLK,
42 L_7X30_SDC4_CLK,
43 L_7X30_SDC4_P_CLK,
44 L_7X30_MDP_CLK,
45 L_7X30_MDP_P_CLK,
46 L_7X30_MDP_LCDC_PCLK_CLK,
47 L_7X30_MDP_LCDC_PAD_PCLK_CLK,
48 L_7X30_MDP_VSYNC_CLK,
49 L_7X30_MI2S_CODEC_RX_M_CLK,
50 L_7X30_MI2S_CODEC_RX_S_CLK,
51 L_7X30_MI2S_CODEC_TX_M_CLK,
52 L_7X30_MI2S_CODEC_TX_S_CLK,
53 L_7X30_MI2S_M_CLK,
54 L_7X30_MI2S_S_CLK,
55 L_7X30_LPA_CODEC_CLK,
56 L_7X30_LPA_CORE_CLK,
57 L_7X30_LPA_P_CLK,
58 L_7X30_MIDI_CLK,
59 L_7X30_MDC_CLK,
60 L_7X30_ROTATOR_IMEM_CLK,
61 L_7X30_ROTATOR_P_CLK,
62 L_7X30_SDAC_M_CLK,
63 L_7X30_SDAC_CLK,
64 L_7X30_UART1_CLK,
65 L_7X30_UART2_CLK,
66 L_7X30_UART3_CLK,
67 L_7X30_TV_CLK,
68 L_7X30_TV_DAC_CLK,
69 L_7X30_TV_ENC_CLK,
70 L_7X30_HDMI_CLK,
71 L_7X30_TSIF_REF_CLK,
72 L_7X30_TSIF_P_CLK,
73 L_7X30_USB_HS_SRC_CLK,
74 L_7X30_USB_HS_CLK,
75 L_7X30_USB_HS_CORE_CLK,
76 L_7X30_USB_HS_P_CLK,
77 L_7X30_USB_HS2_CLK,
78 L_7X30_USB_HS2_CORE_CLK,
79 L_7X30_USB_HS2_P_CLK,
80 L_7X30_USB_HS3_CLK,
81 L_7X30_USB_HS3_CORE_CLK,
82 L_7X30_USB_HS3_P_CLK,
83 L_7X30_VFE_CLK,
84 L_7X30_VFE_P_CLK,
85 L_7X30_VFE_MDC_CLK,
86 L_7X30_VFE_CAMIF_CLK,
87 L_7X30_CAMIF_PAD_P_CLK,
88 L_7X30_CAM_M_CLK,
89 L_7X30_JPEG_CLK,
90 L_7X30_JPEG_P_CLK,
91 L_7X30_VPE_CLK,
92 L_7X30_MFC_CLK,
93 L_7X30_MFC_DIV2_CLK,
94 L_7X30_MFC_P_CLK,
95 L_7X30_SPI_CLK,
96 L_7X30_SPI_P_CLK,
97 L_7X30_CSI0_CLK,
98 L_7X30_CSI0_VFE_CLK,
99 L_7X30_CSI0_P_CLK,
100 L_7X30_CSI1_CLK,
101 L_7X30_CSI1_VFE_CLK,
102 L_7X30_CSI1_P_CLK,
103 L_7X30_GLBL_ROOT_CLK,
104
105 L_7X30_AXI_LI_VG_CLK,
106 L_7X30_AXI_LI_GRP_CLK,
107 L_7X30_AXI_LI_JPEG_CLK,
108 L_7X30_AXI_GRP_2D_CLK,
109 L_7X30_AXI_MFC_CLK,
110 L_7X30_AXI_VPE_CLK,
111 L_7X30_AXI_LI_VFE_CLK,
112 L_7X30_AXI_LI_APPS_CLK,
113 L_7X30_AXI_MDP_CLK,
114 L_7X30_AXI_IMEM_CLK,
115 L_7X30_AXI_LI_ADSP_A_CLK,
116 L_7X30_AXI_ROTATOR_CLK,
117
118 L_7X30_NR_CLKS
119};
120
121struct clk_ops;
122extern struct clk_ops clk_ops_7x30;
123
124struct clk_ops *clk_7x30_is_local(uint32_t id);
125int clk_7x30_init(void);
126
127void pll_enable(uint32_t pll);
128void pll_disable(uint32_t pll);
129
130extern int internal_pwr_rail_ctl_auto(unsigned rail_id, bool enable);
131
132#define CLK_7X30(clk_name, clk_id, clk_dev, clk_flags) { \
133 .con_id = clk_name, \
134 .dev_id = clk_dev, \
135 .clk = &(struct clk){ \
136 .id = L_7X30_##clk_id, \
137 .remote_id = P_##clk_id, \
138 .flags = clk_flags, \
139 .dbg_name = #clk_id, \
140 }, \
141 }
142
143#define CLK_7X30S(clk_name, l_id, r_id, clk_dev, clk_flags) { \
144 .con_id = clk_name, \
145 .dev_id = clk_dev, \
146 .clk = &(struct clk){ \
147 .id = L_7X30_##l_id, \
148 .remote_id = P_##r_id, \
149 .flags = clk_flags, \
150 .dbg_name = #l_id, \
151 .ops = &clk_ops_pcom, \
152 }, \
153 }
154
155#endif
diff --git a/arch/arm/mach-msm/clock-debug.c b/arch/arm/mach-msm/clock-debug.c
deleted file mode 100644
index b0fbdf1cbdd1..000000000000
--- a/arch/arm/mach-msm/clock-debug.c
+++ /dev/null
@@ -1,130 +0,0 @@
1/*
2 * Copyright (C) 2007 Google, Inc.
3 * Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#include <linux/kernel.h>
17#include <linux/module.h>
18#include <linux/ctype.h>
19#include <linux/debugfs.h>
20#include <linux/clk.h>
21#include "clock.h"
22
23static int clock_debug_rate_set(void *data, u64 val)
24{
25 struct clk *clock = data;
26 int ret;
27
28 /* Only increases to max rate will succeed, but that's actually good
29 * for debugging purposes so we don't check for error. */
30 if (clock->flags & CLK_MAX)
31 clk_set_max_rate(clock, val);
32 if (clock->flags & CLK_MIN)
33 ret = clk_set_min_rate(clock, val);
34 else
35 ret = clk_set_rate(clock, val);
36 if (ret != 0)
37 printk(KERN_ERR "clk_set%s_rate failed (%d)\n",
38 (clock->flags & CLK_MIN) ? "_min" : "", ret);
39 return ret;
40}
41
42static int clock_debug_rate_get(void *data, u64 *val)
43{
44 struct clk *clock = data;
45 *val = clk_get_rate(clock);
46 return 0;
47}
48
49DEFINE_SIMPLE_ATTRIBUTE(clock_rate_fops, clock_debug_rate_get,
50 clock_debug_rate_set, "%llu\n");
51
52static int clock_debug_enable_set(void *data, u64 val)
53{
54 struct clk *clock = data;
55 int rc = 0;
56
57 if (val)
58 rc = clock->ops->enable(clock->id);
59 else
60 clock->ops->disable(clock->id);
61
62 return rc;
63}
64
65static int clock_debug_enable_get(void *data, u64 *val)
66{
67 struct clk *clock = data;
68
69 *val = clock->ops->is_enabled(clock->id);
70
71 return 0;
72}
73
74DEFINE_SIMPLE_ATTRIBUTE(clock_enable_fops, clock_debug_enable_get,
75 clock_debug_enable_set, "%llu\n");
76
77static int clock_debug_local_get(void *data, u64 *val)
78{
79 struct clk *clock = data;
80
81 *val = clock->ops->is_local(clock->id);
82
83 return 0;
84}
85
86DEFINE_SIMPLE_ATTRIBUTE(clock_local_fops, clock_debug_local_get,
87 NULL, "%llu\n");
88
89static struct dentry *debugfs_base;
90
91int __init clock_debug_init(void)
92{
93 debugfs_base = debugfs_create_dir("clk", NULL);
94 if (!debugfs_base)
95 return -ENOMEM;
96 return 0;
97}
98
99int __init clock_debug_add(struct clk *clock)
100{
101 char temp[50], *ptr;
102 struct dentry *clk_dir;
103
104 if (!debugfs_base)
105 return -ENOMEM;
106
107 strlcpy(temp, clock->dbg_name, ARRAY_SIZE(temp));
108 for (ptr = temp; *ptr; ptr++)
109 *ptr = tolower(*ptr);
110
111 clk_dir = debugfs_create_dir(temp, debugfs_base);
112 if (!clk_dir)
113 return -ENOMEM;
114
115 if (!debugfs_create_file("rate", S_IRUGO | S_IWUSR, clk_dir,
116 clock, &clock_rate_fops))
117 goto error;
118
119 if (!debugfs_create_file("enable", S_IRUGO | S_IWUSR, clk_dir,
120 clock, &clock_enable_fops))
121 goto error;
122
123 if (!debugfs_create_file("is_local", S_IRUGO, clk_dir, clock,
124 &clock_local_fops))
125 goto error;
126 return 0;
127error:
128 debugfs_remove_recursive(clk_dir);
129 return -ENOMEM;
130}
diff --git a/arch/arm/mach-msm/clock-pcom.c b/arch/arm/mach-msm/clock-pcom.c
index a52c970df157..9a80449518e6 100644
--- a/arch/arm/mach-msm/clock-pcom.c
+++ b/arch/arm/mach-msm/clock-pcom.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2007 Google, Inc. 2 * Copyright (C) 2007 Google, Inc.
3 * Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved. 3 * Copyright (c) 2007-2012, The Linux Foundation. All rights reserved.
4 * 4 *
5 * This software is licensed under the terms of the GNU General Public 5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and 6 * License version 2, as published by the Free Software Foundation, and
@@ -13,20 +13,33 @@
13 * 13 *
14 */ 14 */
15 15
16#include <linux/kernel.h>
16#include <linux/err.h> 17#include <linux/err.h>
17#include <linux/ctype.h> 18#include <linux/platform_device.h>
18#include <linux/stddef.h> 19#include <linux/module.h>
20#include <linux/clk-provider.h>
21#include <linux/clkdev.h>
22
19#include <mach/clk.h> 23#include <mach/clk.h>
20 24
21#include "proc_comm.h" 25#include "proc_comm.h"
22#include "clock.h" 26#include "clock.h"
23#include "clock-pcom.h" 27#include "clock-pcom.h"
24 28
25/* 29struct clk_pcom {
26 * glue for the proc_comm interface 30 unsigned id;
27 */ 31 unsigned long flags;
28static int pc_clk_enable(unsigned id) 32 struct msm_clk msm_clk;
33};
34
35static inline struct clk_pcom *to_clk_pcom(struct clk_hw *hw)
29{ 36{
37 return container_of(to_msm_clk(hw), struct clk_pcom, msm_clk);
38}
39
40static int pc_clk_enable(struct clk_hw *hw)
41{
42 unsigned id = to_clk_pcom(hw)->id;
30 int rc = msm_proc_comm(PCOM_CLKCTL_RPC_ENABLE, &id, NULL); 43 int rc = msm_proc_comm(PCOM_CLKCTL_RPC_ENABLE, &id, NULL);
31 if (rc < 0) 44 if (rc < 0)
32 return rc; 45 return rc;
@@ -34,14 +47,16 @@ static int pc_clk_enable(unsigned id)
34 return (int)id < 0 ? -EINVAL : 0; 47 return (int)id < 0 ? -EINVAL : 0;
35} 48}
36 49
37static void pc_clk_disable(unsigned id) 50static void pc_clk_disable(struct clk_hw *hw)
38{ 51{
52 unsigned id = to_clk_pcom(hw)->id;
39 msm_proc_comm(PCOM_CLKCTL_RPC_DISABLE, &id, NULL); 53 msm_proc_comm(PCOM_CLKCTL_RPC_DISABLE, &id, NULL);
40} 54}
41 55
42int pc_clk_reset(unsigned id, enum clk_reset_action action) 56static int pc_clk_reset(struct clk_hw *hw, enum clk_reset_action action)
43{ 57{
44 int rc; 58 int rc;
59 unsigned id = to_clk_pcom(hw)->id;
45 60
46 if (action == CLK_RESET_ASSERT) 61 if (action == CLK_RESET_ASSERT)
47 rc = msm_proc_comm(PCOM_CLKCTL_RPC_RESET_ASSERT, &id, NULL); 62 rc = msm_proc_comm(PCOM_CLKCTL_RPC_RESET_ASSERT, &id, NULL);
@@ -54,85 +69,109 @@ int pc_clk_reset(unsigned id, enum clk_reset_action action)
54 return (int)id < 0 ? -EINVAL : 0; 69 return (int)id < 0 ? -EINVAL : 0;
55} 70}
56 71
57static int pc_clk_set_rate(unsigned id, unsigned rate) 72static int pc_clk_set_rate(struct clk_hw *hw, unsigned long new_rate,
73 unsigned long p_rate)
58{ 74{
59 /* The rate _might_ be rounded off to the nearest KHz value by the 75 struct clk_pcom *p = to_clk_pcom(hw);
76 unsigned id = p->id, rate = new_rate;
77 int rc;
78
79 /*
80 * The rate _might_ be rounded off to the nearest KHz value by the
60 * remote function. So a return value of 0 doesn't necessarily mean 81 * remote function. So a return value of 0 doesn't necessarily mean
61 * that the exact rate was set successfully. 82 * that the exact rate was set successfully.
62 */ 83 */
63 int rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate); 84 if (p->flags & CLKFLAG_MIN)
64 if (rc < 0) 85 rc = msm_proc_comm(PCOM_CLKCTL_RPC_MIN_RATE, &id, &rate);
65 return rc;
66 else
67 return (int)id < 0 ? -EINVAL : 0;
68}
69
70static int pc_clk_set_min_rate(unsigned id, unsigned rate)
71{
72 int rc = msm_proc_comm(PCOM_CLKCTL_RPC_MIN_RATE, &id, &rate);
73 if (rc < 0)
74 return rc;
75 else
76 return (int)id < 0 ? -EINVAL : 0;
77}
78
79static int pc_clk_set_max_rate(unsigned id, unsigned rate)
80{
81 int rc = msm_proc_comm(PCOM_CLKCTL_RPC_MAX_RATE, &id, &rate);
82 if (rc < 0)
83 return rc;
84 else 86 else
85 return (int)id < 0 ? -EINVAL : 0; 87 rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate);
86}
87
88static int pc_clk_set_flags(unsigned id, unsigned flags)
89{
90 int rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_FLAGS, &id, &flags);
91 if (rc < 0) 88 if (rc < 0)
92 return rc; 89 return rc;
93 else 90 else
94 return (int)id < 0 ? -EINVAL : 0; 91 return (int)id < 0 ? -EINVAL : 0;
95} 92}
96 93
97static unsigned pc_clk_get_rate(unsigned id) 94static unsigned long pc_clk_recalc_rate(struct clk_hw *hw, unsigned long p_rate)
98{ 95{
96 unsigned id = to_clk_pcom(hw)->id;
99 if (msm_proc_comm(PCOM_CLKCTL_RPC_RATE, &id, NULL)) 97 if (msm_proc_comm(PCOM_CLKCTL_RPC_RATE, &id, NULL))
100 return 0; 98 return 0;
101 else 99 else
102 return id; 100 return id;
103} 101}
104 102
105static unsigned pc_clk_is_enabled(unsigned id) 103static int pc_clk_is_enabled(struct clk_hw *hw)
106{ 104{
105 unsigned id = to_clk_pcom(hw)->id;
107 if (msm_proc_comm(PCOM_CLKCTL_RPC_ENABLED, &id, NULL)) 106 if (msm_proc_comm(PCOM_CLKCTL_RPC_ENABLED, &id, NULL))
108 return 0; 107 return 0;
109 else 108 else
110 return id; 109 return id;
111} 110}
112 111
113static long pc_clk_round_rate(unsigned id, unsigned rate) 112static long pc_clk_round_rate(struct clk_hw *hw, unsigned long rate,
113 unsigned long *p_rate)
114{ 114{
115
116 /* Not really supported; pc_clk_set_rate() does rounding on it's own. */ 115 /* Not really supported; pc_clk_set_rate() does rounding on it's own. */
117 return rate; 116 return rate;
118} 117}
119 118
120static bool pc_clk_is_local(unsigned id) 119static struct clk_ops clk_ops_pcom = {
121{
122 return false;
123}
124
125struct clk_ops clk_ops_pcom = {
126 .enable = pc_clk_enable, 120 .enable = pc_clk_enable,
127 .disable = pc_clk_disable, 121 .disable = pc_clk_disable,
128 .auto_off = pc_clk_disable,
129 .reset = pc_clk_reset,
130 .set_rate = pc_clk_set_rate, 122 .set_rate = pc_clk_set_rate,
131 .set_min_rate = pc_clk_set_min_rate, 123 .recalc_rate = pc_clk_recalc_rate,
132 .set_max_rate = pc_clk_set_max_rate,
133 .set_flags = pc_clk_set_flags,
134 .get_rate = pc_clk_get_rate,
135 .is_enabled = pc_clk_is_enabled, 124 .is_enabled = pc_clk_is_enabled,
136 .round_rate = pc_clk_round_rate, 125 .round_rate = pc_clk_round_rate,
137 .is_local = pc_clk_is_local,
138}; 126};
127
128static int msm_clock_pcom_probe(struct platform_device *pdev)
129{
130 const struct pcom_clk_pdata *pdata = pdev->dev.platform_data;
131 int i, ret;
132
133 for (i = 0; i < pdata->num_lookups; i++) {
134 const struct clk_pcom_desc *desc = &pdata->lookup[i];
135 struct clk *c;
136 struct clk_pcom *p;
137 struct clk_hw *hw;
138 struct clk_init_data init;
139
140 p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
141 if (!p)
142 return -ENOMEM;
143
144 p->id = desc->id;
145 p->flags = desc->flags;
146 p->msm_clk.reset = pc_clk_reset;
147
148 hw = &p->msm_clk.hw;
149 hw->init = &init;
150
151 init.name = desc->name;
152 init.ops = &clk_ops_pcom;
153 init.num_parents = 0;
154 init.flags = CLK_IS_ROOT;
155
156 if (!(p->flags & CLKFLAG_AUTO_OFF))
157 init.flags |= CLK_IGNORE_UNUSED;
158
159 c = devm_clk_register(&pdev->dev, hw);
160 ret = clk_register_clkdev(c, desc->con, desc->dev);
161 if (ret)
162 return ret;
163 }
164
165 return 0;
166}
167
168static struct platform_driver msm_clock_pcom_driver = {
169 .probe = msm_clock_pcom_probe,
170 .driver = {
171 .name = "msm-clock-pcom",
172 .owner = THIS_MODULE,
173 },
174};
175module_platform_driver(msm_clock_pcom_driver);
176
177MODULE_LICENSE("GPL v2");
diff --git a/arch/arm/mach-msm/clock-pcom.h b/arch/arm/mach-msm/clock-pcom.h
index 974d0032f3a3..5bb164fd46a8 100644
--- a/arch/arm/mach-msm/clock-pcom.h
+++ b/arch/arm/mach-msm/clock-pcom.h
@@ -1,4 +1,5 @@
1/* Copyright (c) 2009, Code Aurora Forum. All rights reserved. 1/*
2 * Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
2 * 3 *
3 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
@@ -120,21 +121,25 @@
120 121
121#define P_NR_CLKS 102 122#define P_NR_CLKS 102
122 123
123struct clk_ops; 124struct clk_pcom_desc {
124extern struct clk_ops clk_ops_pcom; 125 unsigned id;
126 const char *name;
127 const char *con;
128 const char *dev;
129 unsigned long flags;
130};
125 131
126int pc_clk_reset(unsigned id, enum clk_reset_action action); 132struct pcom_clk_pdata {
133 struct clk_pcom_desc *lookup;
134 u32 num_lookups;
135};
127 136
128#define CLK_PCOM(clk_name, clk_id, clk_dev, clk_flags) { \ 137#define CLK_PCOM(clk_name, clk_id, clk_dev, clk_flags) { \
129 .con_id = clk_name, \ 138 .id = P_##clk_id, \
130 .dev_id = clk_dev, \ 139 .name = #clk_id, \
131 .clk = &(struct clk){ \ 140 .con = clk_name, \
132 .id = P_##clk_id, \ 141 .dev = clk_dev, \
133 .remote_id = P_##clk_id, \ 142 .flags = clk_flags, \
134 .ops = &clk_ops_pcom, \
135 .flags = clk_flags, \
136 .dbg_name = #clk_id, \
137 }, \
138 } 143 }
139 144
140#endif 145#endif
diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c
index d9145dfc2a3b..35ea02b52483 100644
--- a/arch/arm/mach-msm/clock.c
+++ b/arch/arm/mach-msm/clock.c
@@ -1,7 +1,7 @@
1/* arch/arm/mach-msm/clock.c 1/* arch/arm/mach-msm/clock.c
2 * 2 *
3 * Copyright (C) 2007 Google, Inc. 3 * Copyright (C) 2007 Google, Inc.
4 * Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2007-2012, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This software is licensed under the terms of the GNU General Public 6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 7 * License version 2, as published by the Free Software Foundation, and
@@ -14,171 +14,15 @@
14 * 14 *
15 */ 15 */
16 16
17#include <linux/kernel.h> 17#include <linux/clk-provider.h>
18#include <linux/list.h>
19#include <linux/err.h>
20#include <linux/spinlock.h>
21#include <linux/pm_qos.h>
22#include <linux/mutex.h>
23#include <linux/clk.h>
24#include <linux/string.h>
25#include <linux/module.h> 18#include <linux/module.h>
26#include <linux/clkdev.h>
27 19
28#include "clock.h" 20#include "clock.h"
29 21
30static DEFINE_MUTEX(clocks_mutex);
31static DEFINE_SPINLOCK(clocks_lock);
32static LIST_HEAD(clocks);
33
34/*
35 * Standard clock functions defined in include/linux/clk.h
36 */
37int clk_enable(struct clk *clk)
38{
39 unsigned long flags;
40 spin_lock_irqsave(&clocks_lock, flags);
41 clk->count++;
42 if (clk->count == 1)
43 clk->ops->enable(clk->id);
44 spin_unlock_irqrestore(&clocks_lock, flags);
45 return 0;
46}
47EXPORT_SYMBOL(clk_enable);
48
49void clk_disable(struct clk *clk)
50{
51 unsigned long flags;
52 spin_lock_irqsave(&clocks_lock, flags);
53 BUG_ON(clk->count == 0);
54 clk->count--;
55 if (clk->count == 0)
56 clk->ops->disable(clk->id);
57 spin_unlock_irqrestore(&clocks_lock, flags);
58}
59EXPORT_SYMBOL(clk_disable);
60
61int clk_reset(struct clk *clk, enum clk_reset_action action) 22int clk_reset(struct clk *clk, enum clk_reset_action action)
62{ 23{
63 return clk->ops->reset(clk->remote_id, action); 24 struct clk_hw *hw = __clk_get_hw(clk);
25 struct msm_clk *m = to_msm_clk(hw);
26 return m->reset(hw, action);
64} 27}
65EXPORT_SYMBOL(clk_reset); 28EXPORT_SYMBOL(clk_reset);
66
67unsigned long clk_get_rate(struct clk *clk)
68{
69 return clk->ops->get_rate(clk->id);
70}
71EXPORT_SYMBOL(clk_get_rate);
72
73int clk_set_rate(struct clk *clk, unsigned long rate)
74{
75 int ret;
76 if (clk->flags & CLKFLAG_MAX) {
77 ret = clk->ops->set_max_rate(clk->id, rate);
78 if (ret)
79 return ret;
80 }
81 if (clk->flags & CLKFLAG_MIN) {
82 ret = clk->ops->set_min_rate(clk->id, rate);
83 if (ret)
84 return ret;
85 }
86
87 if (clk->flags & CLKFLAG_MAX || clk->flags & CLKFLAG_MIN)
88 return ret;
89
90 return clk->ops->set_rate(clk->id, rate);
91}
92EXPORT_SYMBOL(clk_set_rate);
93
94long clk_round_rate(struct clk *clk, unsigned long rate)
95{
96 return clk->ops->round_rate(clk->id, rate);
97}
98EXPORT_SYMBOL(clk_round_rate);
99
100int clk_set_min_rate(struct clk *clk, unsigned long rate)
101{
102 return clk->ops->set_min_rate(clk->id, rate);
103}
104EXPORT_SYMBOL(clk_set_min_rate);
105
106int clk_set_max_rate(struct clk *clk, unsigned long rate)
107{
108 return clk->ops->set_max_rate(clk->id, rate);
109}
110EXPORT_SYMBOL(clk_set_max_rate);
111
112int clk_set_parent(struct clk *clk, struct clk *parent)
113{
114 return -ENOSYS;
115}
116EXPORT_SYMBOL(clk_set_parent);
117
118struct clk *clk_get_parent(struct clk *clk)
119{
120 return ERR_PTR(-ENOSYS);
121}
122EXPORT_SYMBOL(clk_get_parent);
123
124int clk_set_flags(struct clk *clk, unsigned long flags)
125{
126 if (clk == NULL || IS_ERR(clk))
127 return -EINVAL;
128 return clk->ops->set_flags(clk->id, flags);
129}
130EXPORT_SYMBOL(clk_set_flags);
131
132/* EBI1 is the only shared clock that several clients want to vote on as of
133 * this commit. If this changes in the future, then it might be better to
134 * make clk_min_rate handle the voting or make ebi1_clk_set_min_rate more
135 * generic to support different clocks.
136 */
137static struct clk *ebi1_clk;
138
139void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks)
140{
141 unsigned n;
142
143 mutex_lock(&clocks_mutex);
144 for (n = 0; n < num_clocks; n++) {
145 clkdev_add(&clock_tbl[n]);
146 list_add_tail(&clock_tbl[n].clk->list, &clocks);
147 }
148 mutex_unlock(&clocks_mutex);
149
150 ebi1_clk = clk_get(NULL, "ebi1_clk");
151 BUG_ON(ebi1_clk == NULL);
152
153}
154
155/* The bootloader and/or AMSS may have left various clocks enabled.
156 * Disable any clocks that belong to us (CLKFLAG_AUTO_OFF) but have
157 * not been explicitly enabled by a clk_enable() call.
158 */
159static int __init clock_late_init(void)
160{
161 unsigned long flags;
162 struct clk *clk;
163 unsigned count = 0;
164
165 clock_debug_init();
166 mutex_lock(&clocks_mutex);
167 list_for_each_entry(clk, &clocks, list) {
168 clock_debug_add(clk);
169 if (clk->flags & CLKFLAG_AUTO_OFF) {
170 spin_lock_irqsave(&clocks_lock, flags);
171 if (!clk->count) {
172 count++;
173 clk->ops->auto_off(clk->id);
174 }
175 spin_unlock_irqrestore(&clocks_lock, flags);
176 }
177 }
178 mutex_unlock(&clocks_mutex);
179 pr_info("clock_late_init() disabled %d unused clocks\n", count);
180 return 0;
181}
182
183late_initcall(clock_late_init);
184
diff --git a/arch/arm/mach-msm/clock.h b/arch/arm/mach-msm/clock.h
index 2c007f606d29..42d29dd7aafc 100644
--- a/arch/arm/mach-msm/clock.h
+++ b/arch/arm/mach-msm/clock.h
@@ -1,7 +1,7 @@
1/* arch/arm/mach-msm/clock.h 1/* arch/arm/mach-msm/clock.h
2 * 2 *
3 * Copyright (C) 2007 Google, Inc. 3 * Copyright (C) 2007 Google, Inc.
4 * Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2007-2012, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This software is licensed under the terms of the GNU General Public 6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 7 * License version 2, as published by the Free Software Foundation, and
@@ -17,56 +17,27 @@
17#ifndef __ARCH_ARM_MACH_MSM_CLOCK_H 17#ifndef __ARCH_ARM_MACH_MSM_CLOCK_H
18#define __ARCH_ARM_MACH_MSM_CLOCK_H 18#define __ARCH_ARM_MACH_MSM_CLOCK_H
19 19
20#include <linux/init.h> 20#include <linux/clk-provider.h>
21#include <linux/list.h>
22#include <mach/clk.h> 21#include <mach/clk.h>
23 22
24#define CLKFLAG_INVERT 0x00000001
25#define CLKFLAG_NOINVERT 0x00000002
26#define CLKFLAG_NONEST 0x00000004
27#define CLKFLAG_NORESET 0x00000008
28
29#define CLK_FIRST_AVAILABLE_FLAG 0x00000100 23#define CLK_FIRST_AVAILABLE_FLAG 0x00000100
30#define CLKFLAG_AUTO_OFF 0x00000200 24#define CLKFLAG_AUTO_OFF 0x00000200
31#define CLKFLAG_MIN 0x00000400 25#define CLKFLAG_MIN 0x00000400
32#define CLKFLAG_MAX 0x00000800 26#define CLKFLAG_MAX 0x00000800
33 27
34struct clk_ops {
35 int (*enable)(unsigned id);
36 void (*disable)(unsigned id);
37 void (*auto_off)(unsigned id);
38 int (*reset)(unsigned id, enum clk_reset_action action);
39 int (*set_rate)(unsigned id, unsigned rate);
40 int (*set_min_rate)(unsigned id, unsigned rate);
41 int (*set_max_rate)(unsigned id, unsigned rate);
42 int (*set_flags)(unsigned id, unsigned flags);
43 unsigned (*get_rate)(unsigned id);
44 unsigned (*is_enabled)(unsigned id);
45 long (*round_rate)(unsigned id, unsigned rate);
46 bool (*is_local)(unsigned id);
47};
48
49struct clk {
50 uint32_t id;
51 uint32_t remote_id;
52 uint32_t count;
53 uint32_t flags;
54 struct clk_ops *ops;
55 const char *dbg_name;
56 struct list_head list;
57};
58
59#define OFF CLKFLAG_AUTO_OFF 28#define OFF CLKFLAG_AUTO_OFF
60#define CLK_MIN CLKFLAG_MIN 29#define CLK_MIN CLKFLAG_MIN
61#define CLK_MAX CLKFLAG_MAX 30#define CLK_MAX CLKFLAG_MAX
62#define CLK_MINMAX (CLK_MIN | CLK_MAX) 31#define CLK_MINMAX (CLK_MIN | CLK_MAX)
63 32
64#ifdef CONFIG_DEBUG_FS 33struct msm_clk {
65int __init clock_debug_init(void); 34 int (*reset)(struct clk_hw *hw, enum clk_reset_action action);
66int __init clock_debug_add(struct clk *clock); 35 struct clk_hw hw;
67#else 36};
68static inline int __init clock_debug_init(void) { return 0; } 37
69static inline int __init clock_debug_add(struct clk *clock) { return 0; } 38static inline struct msm_clk *to_msm_clk(struct clk_hw *hw)
70#endif 39{
40 return container_of(hw, struct msm_clk, hw);
41}
71 42
72#endif 43#endif
diff --git a/arch/arm/mach-msm/devices-msm7x00.c b/arch/arm/mach-msm/devices-msm7x00.c
index 1a0a2306b115..6d50fb964863 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
428struct clk_lookup msm_clocks_7x01a[] = { 428static struct clk_pcom_desc 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
472unsigned msm_num_clocks_7x01a = ARRAY_SIZE(msm_clocks_7x01a); 472static struct pcom_clk_pdata msm_clock_7x01a_pdata = {
473 .lookup = msm_clocks_7x01a,
474 .num_lookups = ARRAY_SIZE(msm_clocks_7x01a),
475};
476
477struct 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 12f482c07740..d4db75acff56 100644
--- a/arch/arm/mach-msm/devices-msm7x30.c
+++ b/arch/arm/mach-msm/devices-msm7x30.c
@@ -28,8 +28,8 @@
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#include "clock-7x30.h"
33 33
34#include <linux/platform_data/mmc-msm_sdcc.h> 34#include <linux/platform_data/mmc-msm_sdcc.h>
35 35
@@ -161,7 +161,7 @@ struct platform_device msm_device_hsusb_host = {
161 }, 161 },
162}; 162};
163 163
164struct clk_lookup msm_clocks_7x30[] = { 164static struct clk_pcom_desc msm_clocks_7x30[] = {
165 CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), 165 CLK_PCOM("adm_clk", ADM_CLK, NULL, 0),
166 CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0), 166 CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0),
167 CLK_PCOM("cam_m_clk", CAM_M_CLK, NULL, 0), 167 CLK_PCOM("cam_m_clk", CAM_M_CLK, NULL, 0),
@@ -177,7 +177,6 @@ struct clk_lookup msm_clocks_7x30[] = {
177 CLK_PCOM("grp_2d_pclk", GRP_2D_P_CLK, NULL, 0), 177 CLK_PCOM("grp_2d_pclk", GRP_2D_P_CLK, NULL, 0),
178 CLK_PCOM("grp_clk", GRP_3D_CLK, NULL, 0), 178 CLK_PCOM("grp_clk", GRP_3D_CLK, NULL, 0),
179 CLK_PCOM("grp_pclk", GRP_3D_P_CLK, NULL, 0), 179 CLK_PCOM("grp_pclk", GRP_3D_P_CLK, NULL, 0),
180 CLK_7X30S("grp_src_clk", GRP_3D_SRC_CLK, GRP_3D_CLK, NULL, 0),
181 CLK_PCOM("hdmi_clk", HDMI_CLK, NULL, 0), 180 CLK_PCOM("hdmi_clk", HDMI_CLK, NULL, 0),
182 CLK_PCOM("imem_clk", IMEM_CLK, NULL, OFF), 181 CLK_PCOM("imem_clk", IMEM_CLK, NULL, OFF),
183 CLK_PCOM("jpeg_clk", JPEG_CLK, NULL, OFF), 182 CLK_PCOM("jpeg_clk", JPEG_CLK, NULL, OFF),
@@ -210,7 +209,6 @@ struct clk_lookup msm_clocks_7x30[] = {
210 CLK_PCOM("sdac_clk", SDAC_CLK, NULL, OFF), 209 CLK_PCOM("sdac_clk", SDAC_CLK, NULL, OFF),
211 CLK_PCOM("spi_clk", SPI_CLK, NULL, 0), 210 CLK_PCOM("spi_clk", SPI_CLK, NULL, 0),
212 CLK_PCOM("spi_pclk", SPI_P_CLK, NULL, 0), 211 CLK_PCOM("spi_pclk", SPI_P_CLK, NULL, 0),
213 CLK_7X30S("tv_src_clk", TV_CLK, TV_ENC_CLK, NULL, 0),
214 CLK_PCOM("tv_dac_clk", TV_DAC_CLK, NULL, 0), 212 CLK_PCOM("tv_dac_clk", TV_DAC_CLK, NULL, 0),
215 CLK_PCOM("tv_enc_clk", TV_ENC_CLK, NULL, 0), 213 CLK_PCOM("tv_enc_clk", TV_ENC_CLK, NULL, 0),
216 CLK_PCOM("uart_clk", UART2_CLK, "msm_serial.1", 0), 214 CLK_PCOM("uart_clk", UART2_CLK, "msm_serial.1", 0),
@@ -237,5 +235,12 @@ struct clk_lookup msm_clocks_7x30[] = {
237 CLK_PCOM("csi_vfe_clk", CSI0_VFE_CLK, NULL, 0), 235 CLK_PCOM("csi_vfe_clk", CSI0_VFE_CLK, NULL, 0),
238}; 236};
239 237
240unsigned msm_num_clocks_7x30 = ARRAY_SIZE(msm_clocks_7x30); 238static struct pcom_clk_pdata msm_clock_7x30_pdata = {
239 .lookup = msm_clocks_7x30,
240 .num_lookups = ARRAY_SIZE(msm_clocks_7x30),
241};
241 242
243struct 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..f5518112284b 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
33static struct resource msm_gpio_resources[] = { 34static 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
325struct clk_lookup msm_clocks_8x50[] = { 326static struct clk_pcom_desc 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
379unsigned msm_num_clocks_8x50 = ARRAY_SIZE(msm_clocks_8x50); 380static struct pcom_clk_pdata msm_clock_8x50_pdata = {
381 .lookup = msm_clocks_8x50,
382 .num_lookups = ARRAY_SIZE(msm_clocks_8x50),
383};
380 384
385struct 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
23extern struct platform_device msm_device_gpio_7201; 19extern struct platform_device msm_device_gpio_7201;
24extern struct platform_device msm_device_gpio_7x30; 20extern struct platform_device msm_device_gpio_7x30;
25extern struct platform_device msm_device_gpio_8x50; 21extern struct platform_device msm_device_gpio_8x50;
@@ -50,13 +46,8 @@ extern struct platform_device msm_device_mddi0;
50extern struct platform_device msm_device_mddi1; 46extern struct platform_device msm_device_mddi1;
51extern struct platform_device msm_device_mdp; 47extern struct platform_device msm_device_mdp;
52 48
53extern struct clk_lookup msm_clocks_7x01a[]; 49extern struct platform_device msm_clock_7x01a;
54extern unsigned msm_num_clocks_7x01a; 50extern struct platform_device msm_clock_7x30;
55 51extern struct platform_device msm_clock_8x50;
56extern struct clk_lookup msm_clocks_7x30[];
57extern unsigned msm_num_clocks_7x30;
58
59extern struct clk_lookup msm_clocks_8x50[];
60extern unsigned msm_num_clocks_8x50;
61 52
62#endif 53#endif
diff --git a/arch/arm/mach-msm/dma.c b/arch/arm/mach-msm/dma.c
index b279fd8a31b1..f8f6adfa07c6 100644
--- a/arch/arm/mach-msm/dma.c
+++ b/arch/arm/mach-msm/dma.c
@@ -284,6 +284,7 @@ static int __init msm_init_datamover(void)
284 clk = clk_get(NULL, "adm_clk"); 284 clk = clk_get(NULL, "adm_clk");
285 if (IS_ERR(clk)) 285 if (IS_ERR(clk))
286 return PTR_ERR(clk); 286 return PTR_ERR(clk);
287 clk_prepare(clk);
287 msm_dmov_clk = clk; 288 msm_dmov_clk = clk;
288 ret = request_irq(INT_ADM_AARM, msm_datamover_irq_handler, 0, "msmdatamover", NULL); 289 ret = request_irq(INT_ADM_AARM, msm_datamover_irq_handler, 0, "msmdatamover", NULL);
289 if (ret) 290 if (ret)
@@ -291,6 +292,4 @@ static int __init msm_init_datamover(void)
291 disable_irq(INT_ADM_AARM); 292 disable_irq(INT_ADM_AARM);
292 return 0; 293 return 0;
293} 294}
294 295module_init(msm_init_datamover);
295arch_initcall(msm_init_datamover);
296
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
25struct 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
29void __init msm_add_devices(void); 25void __init msm_add_devices(void);
30void __init msm_init_irq(void); 26void __init msm_init_irq(void);
31void __init msm_init_gpio(void); 27void __init msm_init_gpio(void);
32void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks);
33int __init msm_add_sdcc(unsigned int controller, 28int __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);
diff --git a/arch/arm/mach-msm/include/mach/clk.h b/arch/arm/mach-msm/include/mach/clk.h
index e8d38428d813..fd4f4a7a83b3 100644
--- a/arch/arm/mach-msm/include/mach/clk.h
+++ b/arch/arm/mach-msm/include/mach/clk.h
@@ -25,16 +25,7 @@ enum clk_reset_action {
25 25
26struct clk; 26struct clk;
27 27
28/* Rate is minimum clock rate in Hz */
29int clk_set_min_rate(struct clk *clk, unsigned long rate);
30
31/* Rate is maximum clock rate in Hz */
32int clk_set_max_rate(struct clk *clk, unsigned long rate);
33
34/* Assert/Deassert reset to a hardware block associated with a clock */ 28/* Assert/Deassert reset to a hardware block associated with a clock */
35int clk_reset(struct clk *clk, enum clk_reset_action action); 29int clk_reset(struct clk *clk, enum clk_reset_action action);
36 30
37/* Set clock-specific configuration parameters */
38int clk_set_flags(struct clk *clk, unsigned long flags);
39
40#endif 31#endif