diff options
Diffstat (limited to 'arch/arm/mach-omap2')
23 files changed, 246 insertions, 138 deletions
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index be0f62bf9037..41b581fd0213 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
@@ -26,6 +26,8 @@ config SOC_HAS_OMAP2_SDRC | |||
26 | 26 | ||
27 | config SOC_HAS_REALTIME_COUNTER | 27 | config SOC_HAS_REALTIME_COUNTER |
28 | bool "Real time free running counter" | 28 | bool "Real time free running counter" |
29 | depends on SOC_OMAP5 | ||
30 | default y | ||
29 | 31 | ||
30 | config ARCH_OMAP2 | 32 | config ARCH_OMAP2 |
31 | bool "TI OMAP2" | 33 | bool "TI OMAP2" |
@@ -79,7 +81,6 @@ config SOC_OMAP5 | |||
79 | select ARM_GIC | 81 | select ARM_GIC |
80 | select CPU_V7 | 82 | select CPU_V7 |
81 | select HAVE_SMP | 83 | select HAVE_SMP |
82 | select SOC_HAS_REALTIME_COUNTER | ||
83 | select COMMON_CLK | 84 | select COMMON_CLK |
84 | 85 | ||
85 | comment "OMAP Core Type" | 86 | comment "OMAP Core Type" |
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 7b201546834d..bb73afc9ac17 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c | |||
@@ -157,6 +157,7 @@ static struct omap_dss_device sdp3430_lcd_device = { | |||
157 | 157 | ||
158 | static struct tfp410_platform_data dvi_panel = { | 158 | static struct tfp410_platform_data dvi_panel = { |
159 | .power_down_gpio = -1, | 159 | .power_down_gpio = -1, |
160 | .i2c_bus_num = -1, | ||
160 | }; | 161 | }; |
161 | 162 | ||
162 | static struct omap_dss_device sdp3430_dvi_device = { | 163 | static struct omap_dss_device sdp3430_dvi_device = { |
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c index 4be58fd071f6..f81a303b87ff 100644 --- a/arch/arm/mach-omap2/board-am3517evm.c +++ b/arch/arm/mach-omap2/board-am3517evm.c | |||
@@ -208,6 +208,7 @@ static struct omap_dss_device am3517_evm_tv_device = { | |||
208 | 208 | ||
209 | static struct tfp410_platform_data dvi_panel = { | 209 | static struct tfp410_platform_data dvi_panel = { |
210 | .power_down_gpio = -1, | 210 | .power_down_gpio = -1, |
211 | .i2c_bus_num = -1, | ||
211 | }; | 212 | }; |
212 | 213 | ||
213 | static struct omap_dss_device am3517_evm_dvi_device = { | 214 | static struct omap_dss_device am3517_evm_dvi_device = { |
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index c8e37dc00892..b3102c2f4a3c 100644 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c | |||
@@ -241,6 +241,7 @@ static struct omap_dss_device cm_t35_lcd_device = { | |||
241 | 241 | ||
242 | static struct tfp410_platform_data dvi_panel = { | 242 | static struct tfp410_platform_data dvi_panel = { |
243 | .power_down_gpio = CM_T35_DVI_EN_GPIO, | 243 | .power_down_gpio = CM_T35_DVI_EN_GPIO, |
244 | .i2c_bus_num = -1, | ||
244 | }; | 245 | }; |
245 | 246 | ||
246 | static struct omap_dss_device cm_t35_dvi_device = { | 247 | static struct omap_dss_device cm_t35_dvi_device = { |
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c index 7667eb749522..12865af25d3a 100644 --- a/arch/arm/mach-omap2/board-devkit8000.c +++ b/arch/arm/mach-omap2/board-devkit8000.c | |||
@@ -141,6 +141,7 @@ static struct omap_dss_device devkit8000_lcd_device = { | |||
141 | 141 | ||
142 | static struct tfp410_platform_data dvi_panel = { | 142 | static struct tfp410_platform_data dvi_panel = { |
143 | .power_down_gpio = -1, | 143 | .power_down_gpio = -1, |
144 | .i2c_bus_num = 1, | ||
144 | }; | 145 | }; |
145 | 146 | ||
146 | static struct omap_dss_device devkit8000_dvi_device = { | 147 | static struct omap_dss_device devkit8000_dvi_device = { |
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c index 9a3878ec2256..3be1311f9e33 100644 --- a/arch/arm/mach-omap2/board-h4.c +++ b/arch/arm/mach-omap2/board-h4.c | |||
@@ -27,14 +27,12 @@ | |||
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/input/matrix_keypad.h> | 28 | #include <linux/input/matrix_keypad.h> |
29 | #include <linux/mfd/menelaus.h> | 29 | #include <linux/mfd/menelaus.h> |
30 | #include <linux/omap-dma.h> | ||
30 | 31 | ||
31 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
32 | #include <asm/mach/arch.h> | 33 | #include <asm/mach/arch.h> |
33 | #include <asm/mach/map.h> | 34 | #include <asm/mach/map.h> |
34 | 35 | ||
35 | #include <linux/omap-dma.h> | ||
36 | #include <plat/debug-devices.h> | ||
37 | |||
38 | #include <video/omapdss.h> | 36 | #include <video/omapdss.h> |
39 | #include <video/omap-panel-generic-dpi.h> | 37 | #include <video/omap-panel-generic-dpi.h> |
40 | 38 | ||
@@ -42,11 +40,9 @@ | |||
42 | #include "mux.h" | 40 | #include "mux.h" |
43 | #include "control.h" | 41 | #include "control.h" |
44 | #include "gpmc.h" | 42 | #include "gpmc.h" |
43 | #include "gpmc-smc91x.h" | ||
45 | 44 | ||
46 | #define H4_FLASH_CS 0 | 45 | #define H4_FLASH_CS 0 |
47 | #define H4_SMC91X_CS 1 | ||
48 | |||
49 | #define H4_ETHR_GPIO_IRQ 92 | ||
50 | 46 | ||
51 | #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE) | 47 | #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE) |
52 | static const uint32_t board_matrix_keys[] = { | 48 | static const uint32_t board_matrix_keys[] = { |
@@ -250,71 +246,31 @@ static u32 is_gpmc_muxed(void) | |||
250 | return 0; | 246 | return 0; |
251 | } | 247 | } |
252 | 248 | ||
253 | static inline void __init h4_init_debug(void) | 249 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91x_MODULE) |
254 | { | ||
255 | int eth_cs; | ||
256 | unsigned long cs_mem_base; | ||
257 | unsigned int muxed, rate; | ||
258 | struct clk *gpmc_fck; | ||
259 | |||
260 | eth_cs = H4_SMC91X_CS; | ||
261 | 250 | ||
262 | gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */ | 251 | static struct omap_smc91x_platform_data board_smc91x_data = { |
263 | if (IS_ERR(gpmc_fck)) { | 252 | .cs = 1, |
264 | WARN_ON(1); | 253 | .gpio_irq = 92, |
265 | return; | 254 | .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_LOWLEVEL, |
266 | } | 255 | }; |
267 | |||
268 | clk_prepare_enable(gpmc_fck); | ||
269 | rate = clk_get_rate(gpmc_fck); | ||
270 | clk_disable_unprepare(gpmc_fck); | ||
271 | clk_put(gpmc_fck); | ||
272 | 256 | ||
257 | static void __init board_smc91x_init(void) | ||
258 | { | ||
273 | if (is_gpmc_muxed()) | 259 | if (is_gpmc_muxed()) |
274 | muxed = 0x200; | 260 | board_smc91x_data.flags |= GPMC_MUX_ADD_DATA; |
275 | else | ||
276 | muxed = 0; | ||
277 | |||
278 | /* Make sure CS1 timings are correct */ | ||
279 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, | ||
280 | 0x00011000 | muxed); | ||
281 | |||
282 | if (rate >= 160000000) { | ||
283 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f01); | ||
284 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080803); | ||
285 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1c0b1c0a); | ||
286 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); | ||
287 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); | ||
288 | } else if (rate >= 130000000) { | ||
289 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); | ||
290 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); | ||
291 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); | ||
292 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); | ||
293 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); | ||
294 | } else {/* rate = 100000000 */ | ||
295 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); | ||
296 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); | ||
297 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); | ||
298 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x031A1F1F); | ||
299 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000003C2); | ||
300 | } | ||
301 | |||
302 | if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { | ||
303 | printk(KERN_ERR "Failed to request GPMC mem for smc91x\n"); | ||
304 | goto out; | ||
305 | } | ||
306 | 261 | ||
307 | udelay(100); | 262 | omap_mux_init_gpio(board_smc91x_data.gpio_irq, OMAP_PIN_INPUT); |
263 | gpmc_smc91x_init(&board_smc91x_data); | ||
264 | } | ||
308 | 265 | ||
309 | omap_mux_init_gpio(92, 0); | 266 | #else |
310 | if (debug_card_init(cs_mem_base, H4_ETHR_GPIO_IRQ) < 0) | ||
311 | gpmc_cs_free(eth_cs); | ||
312 | 267 | ||
313 | out: | 268 | static inline void board_smc91x_init(void) |
314 | clk_disable_unprepare(gpmc_fck); | 269 | { |
315 | clk_put(gpmc_fck); | ||
316 | } | 270 | } |
317 | 271 | ||
272 | #endif | ||
273 | |||
318 | static void __init h4_init_flash(void) | 274 | static void __init h4_init_flash(void) |
319 | { | 275 | { |
320 | unsigned long base; | 276 | unsigned long base; |
@@ -371,6 +327,7 @@ static void __init omap_h4_init(void) | |||
371 | omap_serial_init(); | 327 | omap_serial_init(); |
372 | omap_sdrc_init(NULL, NULL); | 328 | omap_sdrc_init(NULL, NULL); |
373 | h4_init_flash(); | 329 | h4_init_flash(); |
330 | board_smc91x_init(); | ||
374 | 331 | ||
375 | omap_display_init(&h4_dss_data); | 332 | omap_display_init(&h4_dss_data); |
376 | } | 333 | } |
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 54647d6286b4..3985f35aee06 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c | |||
@@ -240,6 +240,7 @@ static struct omap_dss_device omap3_evm_tv_device = { | |||
240 | 240 | ||
241 | static struct tfp410_platform_data dvi_panel = { | 241 | static struct tfp410_platform_data dvi_panel = { |
242 | .power_down_gpio = OMAP3EVM_DVI_PANEL_EN_GPIO, | 242 | .power_down_gpio = OMAP3EVM_DVI_PANEL_EN_GPIO, |
243 | .i2c_bus_num = -1, | ||
243 | }; | 244 | }; |
244 | 245 | ||
245 | static struct omap_dss_device omap3_evm_dvi_device = { | 246 | static struct omap_dss_device omap3_evm_dvi_device = { |
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c index d8638b3b4f94..53a6cbcf9747 100644 --- a/arch/arm/mach-omap2/board-omap3stalker.c +++ b/arch/arm/mach-omap2/board-omap3stalker.c | |||
@@ -118,6 +118,7 @@ static struct omap_dss_device omap3_stalker_tv_device = { | |||
118 | 118 | ||
119 | static struct tfp410_platform_data dvi_panel = { | 119 | static struct tfp410_platform_data dvi_panel = { |
120 | .power_down_gpio = DSS_ENABLE_GPIO, | 120 | .power_down_gpio = DSS_ENABLE_GPIO, |
121 | .i2c_bus_num = -1, | ||
121 | }; | 122 | }; |
122 | 123 | ||
123 | static struct omap_dss_device omap3_stalker_dvi_device = { | 124 | static struct omap_dss_device omap3_stalker_dvi_device = { |
diff --git a/arch/arm/mach-omap2/cclock44xx_data.c b/arch/arm/mach-omap2/cclock44xx_data.c index aa56c3e5bb34..5789a5e25563 100644 --- a/arch/arm/mach-omap2/cclock44xx_data.c +++ b/arch/arm/mach-omap2/cclock44xx_data.c | |||
@@ -40,6 +40,14 @@ | |||
40 | #define OMAP4430_MODULEMODE_HWCTRL_SHIFT 0 | 40 | #define OMAP4430_MODULEMODE_HWCTRL_SHIFT 0 |
41 | #define OMAP4430_MODULEMODE_SWCTRL_SHIFT 1 | 41 | #define OMAP4430_MODULEMODE_SWCTRL_SHIFT 1 |
42 | 42 | ||
43 | /* | ||
44 | * OMAP4 ABE DPLL default frequency. In OMAP4460 TRM version V, section | ||
45 | * "3.6.3.2.3 CM1_ABE Clock Generator" states that the "DPLL_ABE_X2_CLK | ||
46 | * must be set to 196.608 MHz" and hence, the DPLL locked frequency is | ||
47 | * half of this value. | ||
48 | */ | ||
49 | #define OMAP4_DPLL_ABE_DEFFREQ 98304000 | ||
50 | |||
43 | /* Root clocks */ | 51 | /* Root clocks */ |
44 | 52 | ||
45 | DEFINE_CLK_FIXED_RATE(extalt_clkin_ck, CLK_IS_ROOT, 59000000, 0x0); | 53 | DEFINE_CLK_FIXED_RATE(extalt_clkin_ck, CLK_IS_ROOT, 59000000, 0x0); |
@@ -124,6 +132,8 @@ static struct dpll_data dpll_abe_dd = { | |||
124 | .enable_mask = OMAP4430_DPLL_EN_MASK, | 132 | .enable_mask = OMAP4430_DPLL_EN_MASK, |
125 | .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK, | 133 | .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK, |
126 | .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK, | 134 | .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK, |
135 | .m4xen_mask = OMAP4430_DPLL_REGM4XEN_MASK, | ||
136 | .lpmode_mask = OMAP4430_DPLL_LPMODE_EN_MASK, | ||
127 | .max_multiplier = 2047, | 137 | .max_multiplier = 2047, |
128 | .max_divider = 128, | 138 | .max_divider = 128, |
129 | .min_divider = 1, | 139 | .min_divider = 1, |
@@ -233,7 +243,7 @@ static struct dpll_data dpll_core_dd = { | |||
233 | 243 | ||
234 | 244 | ||
235 | static const char *dpll_core_ck_parents[] = { | 245 | static const char *dpll_core_ck_parents[] = { |
236 | "sys_clkin_ck", | 246 | "sys_clkin_ck", "core_hsd_byp_clk_mux_ck" |
237 | }; | 247 | }; |
238 | 248 | ||
239 | static struct clk dpll_core_ck; | 249 | static struct clk dpll_core_ck; |
@@ -286,9 +296,9 @@ DEFINE_CLK_DIVIDER(div_core_ck, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, 0x0, | |||
286 | OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_CORE_SHIFT, | 296 | OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_CORE_SHIFT, |
287 | OMAP4430_CLKSEL_CORE_WIDTH, 0x0, NULL); | 297 | OMAP4430_CLKSEL_CORE_WIDTH, 0x0, NULL); |
288 | 298 | ||
289 | DEFINE_CLK_OMAP_HSDIVIDER(div_iva_hs_clk, "dpll_core_m5x2_ck", | 299 | DEFINE_CLK_DIVIDER(div_iva_hs_clk, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, |
290 | &dpll_core_m5x2_ck, 0x0, OMAP4430_CM_BYPCLK_DPLL_IVA, | 300 | 0x0, OMAP4430_CM_BYPCLK_DPLL_IVA, OMAP4430_CLKSEL_0_1_SHIFT, |
291 | OMAP4430_CLKSEL_0_1_MASK); | 301 | OMAP4430_CLKSEL_0_1_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL); |
292 | 302 | ||
293 | DEFINE_CLK_DIVIDER(div_mpu_hs_clk, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, | 303 | DEFINE_CLK_DIVIDER(div_mpu_hs_clk, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, |
294 | 0x0, OMAP4430_CM_BYPCLK_DPLL_MPU, OMAP4430_CLKSEL_0_1_SHIFT, | 304 | 0x0, OMAP4430_CM_BYPCLK_DPLL_MPU, OMAP4430_CLKSEL_0_1_SHIFT, |
@@ -363,8 +373,21 @@ static struct dpll_data dpll_iva_dd = { | |||
363 | .min_divider = 1, | 373 | .min_divider = 1, |
364 | }; | 374 | }; |
365 | 375 | ||
376 | static const char *dpll_iva_ck_parents[] = { | ||
377 | "sys_clkin_ck", "iva_hsd_byp_clk_mux_ck" | ||
378 | }; | ||
379 | |||
366 | static struct clk dpll_iva_ck; | 380 | static struct clk dpll_iva_ck; |
367 | 381 | ||
382 | static const struct clk_ops dpll_ck_ops = { | ||
383 | .enable = &omap3_noncore_dpll_enable, | ||
384 | .disable = &omap3_noncore_dpll_disable, | ||
385 | .recalc_rate = &omap3_dpll_recalc, | ||
386 | .round_rate = &omap2_dpll_round_rate, | ||
387 | .set_rate = &omap3_noncore_dpll_set_rate, | ||
388 | .get_parent = &omap2_init_dpll_parent, | ||
389 | }; | ||
390 | |||
368 | static struct clk_hw_omap dpll_iva_ck_hw = { | 391 | static struct clk_hw_omap dpll_iva_ck_hw = { |
369 | .hw = { | 392 | .hw = { |
370 | .clk = &dpll_iva_ck, | 393 | .clk = &dpll_iva_ck, |
@@ -373,7 +396,7 @@ static struct clk_hw_omap dpll_iva_ck_hw = { | |||
373 | .ops = &clkhwops_omap3_dpll, | 396 | .ops = &clkhwops_omap3_dpll, |
374 | }; | 397 | }; |
375 | 398 | ||
376 | DEFINE_STRUCT_CLK(dpll_iva_ck, dpll_core_ck_parents, dpll_abe_ck_ops); | 399 | DEFINE_STRUCT_CLK(dpll_iva_ck, dpll_iva_ck_parents, dpll_ck_ops); |
377 | 400 | ||
378 | static const char *dpll_iva_x2_ck_parents[] = { | 401 | static const char *dpll_iva_x2_ck_parents[] = { |
379 | "dpll_iva_ck", | 402 | "dpll_iva_ck", |
@@ -416,6 +439,10 @@ static struct dpll_data dpll_mpu_dd = { | |||
416 | .min_divider = 1, | 439 | .min_divider = 1, |
417 | }; | 440 | }; |
418 | 441 | ||
442 | static const char *dpll_mpu_ck_parents[] = { | ||
443 | "sys_clkin_ck", "div_mpu_hs_clk" | ||
444 | }; | ||
445 | |||
419 | static struct clk dpll_mpu_ck; | 446 | static struct clk dpll_mpu_ck; |
420 | 447 | ||
421 | static struct clk_hw_omap dpll_mpu_ck_hw = { | 448 | static struct clk_hw_omap dpll_mpu_ck_hw = { |
@@ -426,7 +453,7 @@ static struct clk_hw_omap dpll_mpu_ck_hw = { | |||
426 | .ops = &clkhwops_omap3_dpll, | 453 | .ops = &clkhwops_omap3_dpll, |
427 | }; | 454 | }; |
428 | 455 | ||
429 | DEFINE_STRUCT_CLK(dpll_mpu_ck, dpll_core_ck_parents, dpll_abe_ck_ops); | 456 | DEFINE_STRUCT_CLK(dpll_mpu_ck, dpll_mpu_ck_parents, dpll_ck_ops); |
430 | 457 | ||
431 | DEFINE_CLK_FIXED_FACTOR(mpu_periphclk, "dpll_mpu_ck", &dpll_mpu_ck, 0x0, 1, 2); | 458 | DEFINE_CLK_FIXED_FACTOR(mpu_periphclk, "dpll_mpu_ck", &dpll_mpu_ck, 0x0, 1, 2); |
432 | 459 | ||
@@ -464,6 +491,9 @@ static struct dpll_data dpll_per_dd = { | |||
464 | .min_divider = 1, | 491 | .min_divider = 1, |
465 | }; | 492 | }; |
466 | 493 | ||
494 | static const char *dpll_per_ck_parents[] = { | ||
495 | "sys_clkin_ck", "per_hsd_byp_clk_mux_ck" | ||
496 | }; | ||
467 | 497 | ||
468 | static struct clk dpll_per_ck; | 498 | static struct clk dpll_per_ck; |
469 | 499 | ||
@@ -475,7 +505,7 @@ static struct clk_hw_omap dpll_per_ck_hw = { | |||
475 | .ops = &clkhwops_omap3_dpll, | 505 | .ops = &clkhwops_omap3_dpll, |
476 | }; | 506 | }; |
477 | 507 | ||
478 | DEFINE_STRUCT_CLK(dpll_per_ck, dpll_core_ck_parents, dpll_abe_ck_ops); | 508 | DEFINE_STRUCT_CLK(dpll_per_ck, dpll_per_ck_parents, dpll_ck_ops); |
479 | 509 | ||
480 | DEFINE_CLK_DIVIDER(dpll_per_m2_ck, "dpll_per_ck", &dpll_per_ck, 0x0, | 510 | DEFINE_CLK_DIVIDER(dpll_per_m2_ck, "dpll_per_ck", &dpll_per_ck, 0x0, |
481 | OMAP4430_CM_DIV_M2_DPLL_PER, OMAP4430_DPLL_CLKOUT_DIV_SHIFT, | 511 | OMAP4430_CM_DIV_M2_DPLL_PER, OMAP4430_DPLL_CLKOUT_DIV_SHIFT, |
@@ -559,6 +589,10 @@ static struct dpll_data dpll_usb_dd = { | |||
559 | .min_divider = 1, | 589 | .min_divider = 1, |
560 | }; | 590 | }; |
561 | 591 | ||
592 | static const char *dpll_usb_ck_parents[] = { | ||
593 | "sys_clkin_ck", "usb_hs_clk_div_ck" | ||
594 | }; | ||
595 | |||
562 | static struct clk dpll_usb_ck; | 596 | static struct clk dpll_usb_ck; |
563 | 597 | ||
564 | static struct clk_hw_omap dpll_usb_ck_hw = { | 598 | static struct clk_hw_omap dpll_usb_ck_hw = { |
@@ -569,7 +603,7 @@ static struct clk_hw_omap dpll_usb_ck_hw = { | |||
569 | .ops = &clkhwops_omap3_dpll, | 603 | .ops = &clkhwops_omap3_dpll, |
570 | }; | 604 | }; |
571 | 605 | ||
572 | DEFINE_STRUCT_CLK(dpll_usb_ck, dpll_core_ck_parents, dpll_abe_ck_ops); | 606 | DEFINE_STRUCT_CLK(dpll_usb_ck, dpll_usb_ck_parents, dpll_ck_ops); |
573 | 607 | ||
574 | static const char *dpll_usb_clkdcoldo_ck_parents[] = { | 608 | static const char *dpll_usb_clkdcoldo_ck_parents[] = { |
575 | "dpll_usb_ck", | 609 | "dpll_usb_ck", |
@@ -696,9 +730,13 @@ DEFINE_CLK_DIVIDER(syc_clk_div_ck, "sys_clkin_ck", &sys_clkin_ck, 0x0, | |||
696 | OMAP4430_CM_ABE_DSS_SYS_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT, | 730 | OMAP4430_CM_ABE_DSS_SYS_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT, |
697 | OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL); | 731 | OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL); |
698 | 732 | ||
733 | static const char *dbgclk_mux_ck_parents[] = { | ||
734 | "sys_clkin_ck" | ||
735 | }; | ||
736 | |||
699 | static struct clk dbgclk_mux_ck; | 737 | static struct clk dbgclk_mux_ck; |
700 | DEFINE_STRUCT_CLK_HW_OMAP(dbgclk_mux_ck, NULL); | 738 | DEFINE_STRUCT_CLK_HW_OMAP(dbgclk_mux_ck, NULL); |
701 | DEFINE_STRUCT_CLK(dbgclk_mux_ck, dpll_core_ck_parents, | 739 | DEFINE_STRUCT_CLK(dbgclk_mux_ck, dbgclk_mux_ck_parents, |
702 | dpll_usb_clkdcoldo_ck_ops); | 740 | dpll_usb_clkdcoldo_ck_ops); |
703 | 741 | ||
704 | /* Leaf clocks controlled by modules */ | 742 | /* Leaf clocks controlled by modules */ |
@@ -1935,10 +1973,10 @@ static struct omap_clk omap44xx_clks[] = { | |||
1935 | CLK("4803e000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), | 1973 | CLK("4803e000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), |
1936 | CLK("48086000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), | 1974 | CLK("48086000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), |
1937 | CLK("48088000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), | 1975 | CLK("48088000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), |
1938 | CLK("49038000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), | 1976 | CLK("40138000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), |
1939 | CLK("4903a000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), | 1977 | CLK("4013a000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), |
1940 | CLK("4903c000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), | 1978 | CLK("4013c000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), |
1941 | CLK("4903e000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), | 1979 | CLK("4013e000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), |
1942 | CLK(NULL, "cpufreq_ck", &dpll_mpu_ck, CK_443X), | 1980 | CLK(NULL, "cpufreq_ck", &dpll_mpu_ck, CK_443X), |
1943 | }; | 1981 | }; |
1944 | 1982 | ||
@@ -1955,6 +1993,7 @@ int __init omap4xxx_clk_init(void) | |||
1955 | { | 1993 | { |
1956 | u32 cpu_clkflg; | 1994 | u32 cpu_clkflg; |
1957 | struct omap_clk *c; | 1995 | struct omap_clk *c; |
1996 | int rc; | ||
1958 | 1997 | ||
1959 | if (cpu_is_omap443x()) { | 1998 | if (cpu_is_omap443x()) { |
1960 | cpu_mask = RATE_IN_4430; | 1999 | cpu_mask = RATE_IN_4430; |
@@ -1983,5 +2022,18 @@ int __init omap4xxx_clk_init(void) | |||
1983 | omap2_clk_enable_init_clocks(enable_init_clks, | 2022 | omap2_clk_enable_init_clocks(enable_init_clks, |
1984 | ARRAY_SIZE(enable_init_clks)); | 2023 | ARRAY_SIZE(enable_init_clks)); |
1985 | 2024 | ||
2025 | /* | ||
2026 | * On OMAP4460 the ABE DPLL fails to turn on if in idle low-power | ||
2027 | * state when turning the ABE clock domain. Workaround this by | ||
2028 | * locking the ABE DPLL on boot. | ||
2029 | */ | ||
2030 | if (cpu_is_omap446x()) { | ||
2031 | rc = clk_set_parent(&abe_dpll_refclk_mux_ck, &sys_32k_ck); | ||
2032 | if (!rc) | ||
2033 | rc = clk_set_rate(&dpll_abe_ck, OMAP4_DPLL_ABE_DEFFREQ); | ||
2034 | if (rc) | ||
2035 | pr_err("%s: failed to configure ABE DPLL!\n", __func__); | ||
2036 | } | ||
2037 | |||
1986 | return 0; | 2038 | return 0; |
1987 | } | 2039 | } |
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index 9917f793c3b6..b40204837bd7 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h | |||
@@ -195,6 +195,10 @@ struct clksel { | |||
195 | * @enable_mask: mask of the DPLL mode bitfield in @control_reg | 195 | * @enable_mask: mask of the DPLL mode bitfield in @control_reg |
196 | * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate() | 196 | * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate() |
197 | * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate() | 197 | * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate() |
198 | * @last_rounded_m4xen: cache of the last M4X result of | ||
199 | * omap4_dpll_regm4xen_round_rate() | ||
200 | * @last_rounded_lpmode: cache of the last lpmode result of | ||
201 | * omap4_dpll_lpmode_recalc() | ||
198 | * @max_multiplier: maximum valid non-bypass multiplier value (actual) | 202 | * @max_multiplier: maximum valid non-bypass multiplier value (actual) |
199 | * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate() | 203 | * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate() |
200 | * @min_divider: minimum valid non-bypass divider value (actual) | 204 | * @min_divider: minimum valid non-bypass divider value (actual) |
@@ -205,6 +209,8 @@ struct clksel { | |||
205 | * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg | 209 | * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg |
206 | * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg | 210 | * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg |
207 | * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg | 211 | * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg |
212 | * @lpmode_mask: mask of the DPLL low-power mode bitfield in @control_reg | ||
213 | * @m4xen_mask: mask of the DPLL M4X multiplier bitfield in @control_reg | ||
208 | * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg | 214 | * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg |
209 | * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs | 215 | * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs |
210 | * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs | 216 | * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs |
@@ -233,6 +239,8 @@ struct dpll_data { | |||
233 | u32 enable_mask; | 239 | u32 enable_mask; |
234 | unsigned long last_rounded_rate; | 240 | unsigned long last_rounded_rate; |
235 | u16 last_rounded_m; | 241 | u16 last_rounded_m; |
242 | u8 last_rounded_m4xen; | ||
243 | u8 last_rounded_lpmode; | ||
236 | u16 max_multiplier; | 244 | u16 max_multiplier; |
237 | u8 last_rounded_n; | 245 | u8 last_rounded_n; |
238 | u8 min_divider; | 246 | u8 min_divider; |
@@ -245,6 +253,8 @@ struct dpll_data { | |||
245 | u32 idlest_mask; | 253 | u32 idlest_mask; |
246 | u32 dco_mask; | 254 | u32 dco_mask; |
247 | u32 sddiv_mask; | 255 | u32 sddiv_mask; |
256 | u32 lpmode_mask; | ||
257 | u32 m4xen_mask; | ||
248 | u8 auto_recal_bit; | 258 | u8 auto_recal_bit; |
249 | u8 recal_en_bit; | 259 | u8 recal_en_bit; |
250 | u8 recal_st_bit; | 260 | u8 recal_st_bit; |
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c index 384873580b23..7faf82d4e85c 100644 --- a/arch/arm/mach-omap2/clockdomain.c +++ b/arch/arm/mach-omap2/clockdomain.c | |||
@@ -998,7 +998,8 @@ int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk) | |||
998 | spin_lock_irqsave(&clkdm->lock, flags); | 998 | spin_lock_irqsave(&clkdm->lock, flags); |
999 | 999 | ||
1000 | /* corner case: disabling unused clocks */ | 1000 | /* corner case: disabling unused clocks */ |
1001 | if (__clk_get_enable_count(clk) == 0) | 1001 | if ((__clk_get_enable_count(clk) == 0) && |
1002 | (atomic_read(&clkdm->usecount) == 0)) | ||
1002 | goto ccd_exit; | 1003 | goto ccd_exit; |
1003 | 1004 | ||
1004 | if (atomic_read(&clkdm->usecount) == 0) { | 1005 | if (atomic_read(&clkdm->usecount) == 0) { |
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c index 5c2fd4863b2b..2dabb9ecb986 100644 --- a/arch/arm/mach-omap2/common.c +++ b/arch/arm/mach-omap2/common.c | |||
@@ -16,8 +16,6 @@ | |||
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/platform_data/dsp-omap.h> | 17 | #include <linux/platform_data/dsp-omap.h> |
18 | 18 | ||
19 | #include <plat/vram.h> | ||
20 | |||
21 | #include "common.h" | 19 | #include "common.h" |
22 | #include "omap-secure.h" | 20 | #include "omap-secure.h" |
23 | 21 | ||
@@ -32,7 +30,6 @@ int __weak omap_secure_ram_reserve_memblock(void) | |||
32 | 30 | ||
33 | void __init omap_reserve(void) | 31 | void __init omap_reserve(void) |
34 | { | 32 | { |
35 | omap_vram_reserve_sdram_memblock(); | ||
36 | omap_dsp_reserve_sdram_memblock(); | 33 | omap_dsp_reserve_sdram_memblock(); |
37 | omap_secure_ram_reserve_memblock(); | 34 | omap_secure_ram_reserve_memblock(); |
38 | omap_barrier_reserve_memblock(); | 35 | omap_barrier_reserve_memblock(); |
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c index bca7a8885703..22590dbe8f14 100644 --- a/arch/arm/mach-omap2/cpuidle34xx.c +++ b/arch/arm/mach-omap2/cpuidle34xx.c | |||
@@ -40,6 +40,8 @@ struct omap3_idle_statedata { | |||
40 | u32 core_state; | 40 | u32 core_state; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | static struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd; | ||
44 | |||
43 | static struct omap3_idle_statedata omap3_idle_data[] = { | 45 | static struct omap3_idle_statedata omap3_idle_data[] = { |
44 | { | 46 | { |
45 | .mpu_state = PWRDM_POWER_ON, | 47 | .mpu_state = PWRDM_POWER_ON, |
@@ -71,7 +73,7 @@ static struct omap3_idle_statedata omap3_idle_data[] = { | |||
71 | }, | 73 | }, |
72 | }; | 74 | }; |
73 | 75 | ||
74 | static struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd; | 76 | /* Private functions */ |
75 | 77 | ||
76 | static int __omap3_enter_idle(struct cpuidle_device *dev, | 78 | static int __omap3_enter_idle(struct cpuidle_device *dev, |
77 | struct cpuidle_driver *drv, | 79 | struct cpuidle_driver *drv, |
@@ -260,11 +262,11 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev, | |||
260 | return ret; | 262 | return ret; |
261 | } | 263 | } |
262 | 264 | ||
263 | DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev); | 265 | static DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev); |
264 | 266 | ||
265 | struct cpuidle_driver omap3_idle_driver = { | 267 | static struct cpuidle_driver omap3_idle_driver = { |
266 | .name = "omap3_idle", | 268 | .name = "omap3_idle", |
267 | .owner = THIS_MODULE, | 269 | .owner = THIS_MODULE, |
268 | .states = { | 270 | .states = { |
269 | { | 271 | { |
270 | .enter = omap3_enter_idle_bm, | 272 | .enter = omap3_enter_idle_bm, |
@@ -327,6 +329,8 @@ struct cpuidle_driver omap3_idle_driver = { | |||
327 | .safe_state_index = 0, | 329 | .safe_state_index = 0, |
328 | }; | 330 | }; |
329 | 331 | ||
332 | /* Public functions */ | ||
333 | |||
330 | /** | 334 | /** |
331 | * omap3_idle_init - Init routine for OMAP3 idle | 335 | * omap3_idle_init - Init routine for OMAP3 idle |
332 | * | 336 | * |
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c index 288bee6cbb76..d639aef0deda 100644 --- a/arch/arm/mach-omap2/cpuidle44xx.c +++ b/arch/arm/mach-omap2/cpuidle44xx.c | |||
@@ -54,6 +54,8 @@ static struct clockdomain *cpu_clkdm[NR_CPUS]; | |||
54 | static atomic_t abort_barrier; | 54 | static atomic_t abort_barrier; |
55 | static bool cpu_done[NR_CPUS]; | 55 | static bool cpu_done[NR_CPUS]; |
56 | 56 | ||
57 | /* Private functions */ | ||
58 | |||
57 | /** | 59 | /** |
58 | * omap4_enter_idle_coupled_[simple/coupled] - OMAP4 cpuidle entry functions | 60 | * omap4_enter_idle_coupled_[simple/coupled] - OMAP4 cpuidle entry functions |
59 | * @dev: cpuidle device | 61 | * @dev: cpuidle device |
@@ -161,9 +163,19 @@ fail: | |||
161 | return index; | 163 | return index; |
162 | } | 164 | } |
163 | 165 | ||
164 | DEFINE_PER_CPU(struct cpuidle_device, omap4_idle_dev); | 166 | /* |
167 | * For each cpu, setup the broadcast timer because local timers | ||
168 | * stops for the states above C1. | ||
169 | */ | ||
170 | static void omap_setup_broadcast_timer(void *arg) | ||
171 | { | ||
172 | int cpu = smp_processor_id(); | ||
173 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu); | ||
174 | } | ||
175 | |||
176 | static DEFINE_PER_CPU(struct cpuidle_device, omap4_idle_dev); | ||
165 | 177 | ||
166 | struct cpuidle_driver omap4_idle_driver = { | 178 | static struct cpuidle_driver omap4_idle_driver = { |
167 | .name = "omap4_idle", | 179 | .name = "omap4_idle", |
168 | .owner = THIS_MODULE, | 180 | .owner = THIS_MODULE, |
169 | .en_core_tk_irqen = 1, | 181 | .en_core_tk_irqen = 1, |
@@ -178,7 +190,7 @@ struct cpuidle_driver omap4_idle_driver = { | |||
178 | .desc = "MPUSS ON" | 190 | .desc = "MPUSS ON" |
179 | }, | 191 | }, |
180 | { | 192 | { |
181 | /* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */ | 193 | /* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */ |
182 | .exit_latency = 328 + 440, | 194 | .exit_latency = 328 + 440, |
183 | .target_residency = 960, | 195 | .target_residency = 960, |
184 | .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED, | 196 | .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED, |
@@ -200,15 +212,7 @@ struct cpuidle_driver omap4_idle_driver = { | |||
200 | .safe_state_index = 0, | 212 | .safe_state_index = 0, |
201 | }; | 213 | }; |
202 | 214 | ||
203 | /* | 215 | /* Public functions */ |
204 | * For each cpu, setup the broadcast timer because local timers | ||
205 | * stops for the states above C1. | ||
206 | */ | ||
207 | static void omap_setup_broadcast_timer(void *arg) | ||
208 | { | ||
209 | int cpu = smp_processor_id(); | ||
210 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu); | ||
211 | } | ||
212 | 216 | ||
213 | /** | 217 | /** |
214 | * omap4_idle_init - Init routine for OMAP4 idle | 218 | * omap4_idle_init - Init routine for OMAP4 idle |
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c index fafb28c0dcbc..2bb18838cba9 100644 --- a/arch/arm/mach-omap2/dpll3xxx.c +++ b/arch/arm/mach-omap2/dpll3xxx.c | |||
@@ -291,16 +291,13 @@ static void _lookup_sddiv(struct clk_hw_omap *clk, u8 *sd_div, u16 m, u8 n) | |||
291 | 291 | ||
292 | /* | 292 | /* |
293 | * _omap3_noncore_dpll_program - set non-core DPLL M,N values directly | 293 | * _omap3_noncore_dpll_program - set non-core DPLL M,N values directly |
294 | * @clk: struct clk * of DPLL to set | 294 | * @clk: struct clk * of DPLL to set |
295 | * @m: DPLL multiplier to set | 295 | * @freqsel: FREQSEL value to set |
296 | * @n: DPLL divider to set | ||
297 | * @freqsel: FREQSEL value to set | ||
298 | * | 296 | * |
299 | * Program the DPLL with the supplied M, N values, and wait for the DPLL to | 297 | * Program the DPLL with the last M, N values calculated, and wait for |
300 | * lock.. Returns -EINVAL upon error, or 0 upon success. | 298 | * the DPLL to lock. Returns -EINVAL upon error, or 0 upon success. |
301 | */ | 299 | */ |
302 | static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 m, u8 n, | 300 | static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 freqsel) |
303 | u16 freqsel) | ||
304 | { | 301 | { |
305 | struct dpll_data *dd = clk->dpll_data; | 302 | struct dpll_data *dd = clk->dpll_data; |
306 | u8 dco, sd_div; | 303 | u8 dco, sd_div; |
@@ -323,23 +320,45 @@ static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 m, u8 n, | |||
323 | /* Set DPLL multiplier, divider */ | 320 | /* Set DPLL multiplier, divider */ |
324 | v = __raw_readl(dd->mult_div1_reg); | 321 | v = __raw_readl(dd->mult_div1_reg); |
325 | v &= ~(dd->mult_mask | dd->div1_mask); | 322 | v &= ~(dd->mult_mask | dd->div1_mask); |
326 | v |= m << __ffs(dd->mult_mask); | 323 | v |= dd->last_rounded_m << __ffs(dd->mult_mask); |
327 | v |= (n - 1) << __ffs(dd->div1_mask); | 324 | v |= (dd->last_rounded_n - 1) << __ffs(dd->div1_mask); |
328 | 325 | ||
329 | /* Configure dco and sd_div for dplls that have these fields */ | 326 | /* Configure dco and sd_div for dplls that have these fields */ |
330 | if (dd->dco_mask) { | 327 | if (dd->dco_mask) { |
331 | _lookup_dco(clk, &dco, m, n); | 328 | _lookup_dco(clk, &dco, dd->last_rounded_m, dd->last_rounded_n); |
332 | v &= ~(dd->dco_mask); | 329 | v &= ~(dd->dco_mask); |
333 | v |= dco << __ffs(dd->dco_mask); | 330 | v |= dco << __ffs(dd->dco_mask); |
334 | } | 331 | } |
335 | if (dd->sddiv_mask) { | 332 | if (dd->sddiv_mask) { |
336 | _lookup_sddiv(clk, &sd_div, m, n); | 333 | _lookup_sddiv(clk, &sd_div, dd->last_rounded_m, |
334 | dd->last_rounded_n); | ||
337 | v &= ~(dd->sddiv_mask); | 335 | v &= ~(dd->sddiv_mask); |
338 | v |= sd_div << __ffs(dd->sddiv_mask); | 336 | v |= sd_div << __ffs(dd->sddiv_mask); |
339 | } | 337 | } |
340 | 338 | ||
341 | __raw_writel(v, dd->mult_div1_reg); | 339 | __raw_writel(v, dd->mult_div1_reg); |
342 | 340 | ||
341 | /* Set 4X multiplier and low-power mode */ | ||
342 | if (dd->m4xen_mask || dd->lpmode_mask) { | ||
343 | v = __raw_readl(dd->control_reg); | ||
344 | |||
345 | if (dd->m4xen_mask) { | ||
346 | if (dd->last_rounded_m4xen) | ||
347 | v |= dd->m4xen_mask; | ||
348 | else | ||
349 | v &= ~dd->m4xen_mask; | ||
350 | } | ||
351 | |||
352 | if (dd->lpmode_mask) { | ||
353 | if (dd->last_rounded_lpmode) | ||
354 | v |= dd->lpmode_mask; | ||
355 | else | ||
356 | v &= ~dd->lpmode_mask; | ||
357 | } | ||
358 | |||
359 | __raw_writel(v, dd->control_reg); | ||
360 | } | ||
361 | |||
343 | /* We let the clock framework set the other output dividers later */ | 362 | /* We let the clock framework set the other output dividers later */ |
344 | 363 | ||
345 | /* REVISIT: Set ramp-up delay? */ | 364 | /* REVISIT: Set ramp-up delay? */ |
@@ -492,8 +511,7 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate, | |||
492 | pr_debug("%s: %s: set rate: locking rate to %lu.\n", | 511 | pr_debug("%s: %s: set rate: locking rate to %lu.\n", |
493 | __func__, __clk_get_name(hw->clk), rate); | 512 | __func__, __clk_get_name(hw->clk), rate); |
494 | 513 | ||
495 | ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m, | 514 | ret = omap3_noncore_dpll_program(clk, freqsel); |
496 | dd->last_rounded_n, freqsel); | ||
497 | if (!ret) | 515 | if (!ret) |
498 | new_parent = dd->clk_ref; | 516 | new_parent = dd->clk_ref; |
499 | } | 517 | } |
diff --git a/arch/arm/mach-omap2/dpll44xx.c b/arch/arm/mach-omap2/dpll44xx.c index d3326c474fdc..d28b0f726715 100644 --- a/arch/arm/mach-omap2/dpll44xx.c +++ b/arch/arm/mach-omap2/dpll44xx.c | |||
@@ -20,6 +20,15 @@ | |||
20 | #include "clock44xx.h" | 20 | #include "clock44xx.h" |
21 | #include "cm-regbits-44xx.h" | 21 | #include "cm-regbits-44xx.h" |
22 | 22 | ||
23 | /* | ||
24 | * Maximum DPLL input frequency (FINT) and output frequency (FOUT) that | ||
25 | * can supported when using the DPLL low-power mode. Frequencies are | ||
26 | * defined in OMAP4430/60 Public TRM section 3.6.3.3.2 "Enable Control, | ||
27 | * Status, and Low-Power Operation Mode". | ||
28 | */ | ||
29 | #define OMAP4_DPLL_LP_FINT_MAX 1000000 | ||
30 | #define OMAP4_DPLL_LP_FOUT_MAX 100000000 | ||
31 | |||
23 | /* Supported only on OMAP4 */ | 32 | /* Supported only on OMAP4 */ |
24 | int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk) | 33 | int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk) |
25 | { | 34 | { |
@@ -82,6 +91,31 @@ const struct clk_hw_omap_ops clkhwops_omap4_dpllmx = { | |||
82 | }; | 91 | }; |
83 | 92 | ||
84 | /** | 93 | /** |
94 | * omap4_dpll_lpmode_recalc - compute DPLL low-power setting | ||
95 | * @dd: pointer to the dpll data structure | ||
96 | * | ||
97 | * Calculates if low-power mode can be enabled based upon the last | ||
98 | * multiplier and divider values calculated. If low-power mode can be | ||
99 | * enabled, then the bit to enable low-power mode is stored in the | ||
100 | * last_rounded_lpmode variable. This implementation is based upon the | ||
101 | * criteria for enabling low-power mode as described in the OMAP4430/60 | ||
102 | * Public TRM section 3.6.3.3.2 "Enable Control, Status, and Low-Power | ||
103 | * Operation Mode". | ||
104 | */ | ||
105 | static void omap4_dpll_lpmode_recalc(struct dpll_data *dd) | ||
106 | { | ||
107 | long fint, fout; | ||
108 | |||
109 | fint = __clk_get_rate(dd->clk_ref) / (dd->last_rounded_n + 1); | ||
110 | fout = fint * dd->last_rounded_m; | ||
111 | |||
112 | if ((fint < OMAP4_DPLL_LP_FINT_MAX) && (fout < OMAP4_DPLL_LP_FOUT_MAX)) | ||
113 | dd->last_rounded_lpmode = 1; | ||
114 | else | ||
115 | dd->last_rounded_lpmode = 0; | ||
116 | } | ||
117 | |||
118 | /** | ||
85 | * omap4_dpll_regm4xen_recalc - compute DPLL rate, considering REGM4XEN bit | 119 | * omap4_dpll_regm4xen_recalc - compute DPLL rate, considering REGM4XEN bit |
86 | * @clk: struct clk * of the DPLL to compute the rate for | 120 | * @clk: struct clk * of the DPLL to compute the rate for |
87 | * | 121 | * |
@@ -130,7 +164,6 @@ long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw, | |||
130 | unsigned long *parent_rate) | 164 | unsigned long *parent_rate) |
131 | { | 165 | { |
132 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); | 166 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); |
133 | u32 v; | ||
134 | struct dpll_data *dd; | 167 | struct dpll_data *dd; |
135 | long r; | 168 | long r; |
136 | 169 | ||
@@ -139,18 +172,31 @@ long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw, | |||
139 | 172 | ||
140 | dd = clk->dpll_data; | 173 | dd = clk->dpll_data; |
141 | 174 | ||
142 | /* regm4xen adds a multiplier of 4 to DPLL calculations */ | 175 | dd->last_rounded_m4xen = 0; |
143 | v = __raw_readl(dd->control_reg) & OMAP4430_DPLL_REGM4XEN_MASK; | ||
144 | |||
145 | if (v) | ||
146 | target_rate = target_rate / OMAP4430_REGM4XEN_MULT; | ||
147 | 176 | ||
177 | /* | ||
178 | * First try to compute the DPLL configuration for | ||
179 | * target rate without using the 4X multiplier. | ||
180 | */ | ||
148 | r = omap2_dpll_round_rate(hw, target_rate, NULL); | 181 | r = omap2_dpll_round_rate(hw, target_rate, NULL); |
182 | if (r != ~0) | ||
183 | goto out; | ||
184 | |||
185 | /* | ||
186 | * If we did not find a valid DPLL configuration, try again, but | ||
187 | * this time see if using the 4X multiplier can help. Enabling the | ||
188 | * 4X multiplier is equivalent to dividing the target rate by 4. | ||
189 | */ | ||
190 | r = omap2_dpll_round_rate(hw, target_rate / OMAP4430_REGM4XEN_MULT, | ||
191 | NULL); | ||
149 | if (r == ~0) | 192 | if (r == ~0) |
150 | return r; | 193 | return r; |
151 | 194 | ||
152 | if (v) | 195 | dd->last_rounded_rate *= OMAP4430_REGM4XEN_MULT; |
153 | clk->dpll_data->last_rounded_rate *= OMAP4430_REGM4XEN_MULT; | 196 | dd->last_rounded_m4xen = 1; |
197 | |||
198 | out: | ||
199 | omap4_dpll_lpmode_recalc(dd); | ||
154 | 200 | ||
155 | return clk->dpll_data->last_rounded_rate; | 201 | return dd->last_rounded_rate; |
156 | } | 202 | } |
diff --git a/arch/arm/mach-omap2/i2c.c b/arch/arm/mach-omap2/i2c.c index df6d6acbc9ed..b9074dde3b9c 100644 --- a/arch/arm/mach-omap2/i2c.c +++ b/arch/arm/mach-omap2/i2c.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "soc.h" | 22 | #include "soc.h" |
23 | #include "omap_hwmod.h" | 23 | #include "omap_hwmod.h" |
24 | #include "omap_device.h" | 24 | #include "omap_device.h" |
25 | #include "omap-pm.h" | ||
25 | 26 | ||
26 | #include "prm.h" | 27 | #include "prm.h" |
27 | #include "common.h" | 28 | #include "common.h" |
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 26126343d6ac..6a217c98db54 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
@@ -135,10 +135,7 @@ static int __init _omap_mux_init_gpio(struct omap_mux_partition *partition, | |||
135 | 135 | ||
136 | old_mode = omap_mux_read(partition, gpio_mux->reg_offset); | 136 | old_mode = omap_mux_read(partition, gpio_mux->reg_offset); |
137 | mux_mode = val & ~(OMAP_MUX_NR_MODES - 1); | 137 | mux_mode = val & ~(OMAP_MUX_NR_MODES - 1); |
138 | if (partition->flags & OMAP_MUX_GPIO_IN_MODE3) | 138 | mux_mode |= partition->gpio; |
139 | mux_mode |= OMAP_MUX_MODE3; | ||
140 | else | ||
141 | mux_mode |= OMAP_MUX_MODE4; | ||
142 | pr_debug("%s: Setting signal %s.gpio%i 0x%04x -> 0x%04x\n", __func__, | 139 | pr_debug("%s: Setting signal %s.gpio%i 0x%04x -> 0x%04x\n", __func__, |
143 | gpio_mux->muxnames[0], gpio, old_mode, mux_mode); | 140 | gpio_mux->muxnames[0], gpio, old_mode, mux_mode); |
144 | omap_mux_write(partition, mux_mode, gpio_mux->reg_offset); | 141 | omap_mux_write(partition, mux_mode, gpio_mux->reg_offset); |
@@ -800,7 +797,7 @@ int __init omap_mux_late_init(void) | |||
800 | struct omap_mux *m = &e->mux; | 797 | struct omap_mux *m = &e->mux; |
801 | u16 mode = omap_mux_read(partition, m->reg_offset); | 798 | u16 mode = omap_mux_read(partition, m->reg_offset); |
802 | 799 | ||
803 | if (OMAP_MODE_GPIO(mode)) | 800 | if (OMAP_MODE_GPIO(partition, mode)) |
804 | continue; | 801 | continue; |
805 | 802 | ||
806 | #ifndef CONFIG_DEBUG_FS | 803 | #ifndef CONFIG_DEBUG_FS |
@@ -1065,7 +1062,7 @@ static void __init omap_mux_init_list(struct omap_mux_partition *partition, | |||
1065 | } | 1062 | } |
1066 | #else | 1063 | #else |
1067 | /* Skip pins that are not muxed as GPIO by bootloader */ | 1064 | /* Skip pins that are not muxed as GPIO by bootloader */ |
1068 | if (!OMAP_MODE_GPIO(omap_mux_read(partition, | 1065 | if (!OMAP_MODE_GPIO(partition, omap_mux_read(partition, |
1069 | superset->reg_offset))) { | 1066 | superset->reg_offset))) { |
1070 | superset++; | 1067 | superset++; |
1071 | continue; | 1068 | continue; |
@@ -1132,6 +1129,7 @@ int __init omap_mux_init(const char *name, u32 flags, | |||
1132 | 1129 | ||
1133 | partition->name = name; | 1130 | partition->name = name; |
1134 | partition->flags = flags; | 1131 | partition->flags = flags; |
1132 | partition->gpio = flags & OMAP_MUX_MODE7; | ||
1135 | partition->size = mux_size; | 1133 | partition->size = mux_size; |
1136 | partition->phys = mux_pbase; | 1134 | partition->phys = mux_pbase; |
1137 | partition->base = ioremap(mux_pbase, mux_size); | 1135 | partition->base = ioremap(mux_pbase, mux_size); |
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h index 76f9b3c2f586..fdb22f14021f 100644 --- a/arch/arm/mach-omap2/mux.h +++ b/arch/arm/mach-omap2/mux.h | |||
@@ -58,7 +58,8 @@ | |||
58 | #define OMAP_PIN_OFF_INPUT_PULLDOWN (OMAP_OFF_EN | OMAP_OFF_PULL_EN) | 58 | #define OMAP_PIN_OFF_INPUT_PULLDOWN (OMAP_OFF_EN | OMAP_OFF_PULL_EN) |
59 | #define OMAP_PIN_OFF_WAKEUPENABLE OMAP_WAKEUP_EN | 59 | #define OMAP_PIN_OFF_WAKEUPENABLE OMAP_WAKEUP_EN |
60 | 60 | ||
61 | #define OMAP_MODE_GPIO(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE4) | 61 | #define OMAP_MODE_GPIO(partition, x) (((x) & OMAP_MUX_MODE7) == \ |
62 | partition->gpio) | ||
62 | #define OMAP_MODE_UART(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE0) | 63 | #define OMAP_MODE_UART(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE0) |
63 | 64 | ||
64 | /* Flags for omapX_mux_init */ | 65 | /* Flags for omapX_mux_init */ |
@@ -79,13 +80,20 @@ | |||
79 | /* | 80 | /* |
80 | * omap_mux_init flags definition: | 81 | * omap_mux_init flags definition: |
81 | * | 82 | * |
83 | * OMAP_GPIO_MUX_MODE, bits 0-2: gpio muxing mode, same like pad control | ||
84 | * register which includes values from 0-7. | ||
82 | * OMAP_MUX_REG_8BIT: Ensure that access to padconf is done in 8 bits. | 85 | * OMAP_MUX_REG_8BIT: Ensure that access to padconf is done in 8 bits. |
83 | * The default value is 16 bits. | 86 | * The default value is 16 bits. |
84 | * OMAP_MUX_GPIO_IN_MODE3: The GPIO is selected in mode3. | ||
85 | * The default is mode4. | ||
86 | */ | 87 | */ |
87 | #define OMAP_MUX_REG_8BIT (1 << 0) | 88 | #define OMAP_MUX_GPIO_IN_MODE0 OMAP_MUX_MODE0 |
88 | #define OMAP_MUX_GPIO_IN_MODE3 (1 << 1) | 89 | #define OMAP_MUX_GPIO_IN_MODE1 OMAP_MUX_MODE1 |
90 | #define OMAP_MUX_GPIO_IN_MODE2 OMAP_MUX_MODE2 | ||
91 | #define OMAP_MUX_GPIO_IN_MODE3 OMAP_MUX_MODE3 | ||
92 | #define OMAP_MUX_GPIO_IN_MODE4 OMAP_MUX_MODE4 | ||
93 | #define OMAP_MUX_GPIO_IN_MODE5 OMAP_MUX_MODE5 | ||
94 | #define OMAP_MUX_GPIO_IN_MODE6 OMAP_MUX_MODE6 | ||
95 | #define OMAP_MUX_GPIO_IN_MODE7 OMAP_MUX_MODE7 | ||
96 | #define OMAP_MUX_REG_8BIT (1 << 3) | ||
89 | 97 | ||
90 | /** | 98 | /** |
91 | * struct omap_board_data - board specific device data | 99 | * struct omap_board_data - board specific device data |
@@ -105,6 +113,7 @@ struct omap_board_data { | |||
105 | * struct mux_partition - contain partition related information | 113 | * struct mux_partition - contain partition related information |
106 | * @name: name of the current partition | 114 | * @name: name of the current partition |
107 | * @flags: flags specific to this partition | 115 | * @flags: flags specific to this partition |
116 | * @gpio: gpio mux mode | ||
108 | * @phys: physical address | 117 | * @phys: physical address |
109 | * @size: partition size | 118 | * @size: partition size |
110 | * @base: virtual address after ioremap | 119 | * @base: virtual address after ioremap |
@@ -114,6 +123,7 @@ struct omap_board_data { | |||
114 | struct omap_mux_partition { | 123 | struct omap_mux_partition { |
115 | const char *name; | 124 | const char *name; |
116 | u32 flags; | 125 | u32 flags; |
126 | u32 gpio; | ||
117 | u32 phys; | 127 | u32 phys; |
118 | u32 size; | 128 | u32 size; |
119 | void __iomem *base; | 129 | void __iomem *base; |
diff --git a/arch/arm/mach-omap2/mux34xx.c b/arch/arm/mach-omap2/mux34xx.c index c47140bbbec4..c53609f46294 100644 --- a/arch/arm/mach-omap2/mux34xx.c +++ b/arch/arm/mach-omap2/mux34xx.c | |||
@@ -2053,7 +2053,7 @@ int __init omap3_mux_init(struct omap_board_mux *board_subset, int flags) | |||
2053 | return -EINVAL; | 2053 | return -EINVAL; |
2054 | } | 2054 | } |
2055 | 2055 | ||
2056 | return omap_mux_init("core", 0, | 2056 | return omap_mux_init("core", OMAP_MUX_GPIO_IN_MODE4, |
2057 | OMAP3_CONTROL_PADCONF_MUX_PBASE, | 2057 | OMAP3_CONTROL_PADCONF_MUX_PBASE, |
2058 | OMAP3_CONTROL_PADCONF_MUX_SIZE, | 2058 | OMAP3_CONTROL_PADCONF_MUX_SIZE, |
2059 | omap3_muxmodes, package_subset, board_subset, | 2059 | omap3_muxmodes, package_subset, board_subset, |
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 93d102535c85..04fdbc4c499b 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
@@ -27,8 +27,7 @@ | |||
27 | #include <linux/pm_runtime.h> | 27 | #include <linux/pm_runtime.h> |
28 | #include <linux/console.h> | 28 | #include <linux/console.h> |
29 | #include <linux/omap-dma.h> | 29 | #include <linux/omap-dma.h> |
30 | 30 | #include <linux/platform_data/serial-omap.h> | |
31 | #include <plat/omap-serial.h> | ||
32 | 31 | ||
33 | #include "common.h" | 32 | #include "common.h" |
34 | #include "omap_hwmod.h" | 33 | #include "omap_hwmod.h" |
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index 7016637b531c..06e141543623 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c | |||
@@ -190,7 +190,7 @@ static struct device_node * __init omap_get_timer_dt(struct of_device_id *match, | |||
190 | * kernel registering these devices remove them dynamically from the device | 190 | * kernel registering these devices remove them dynamically from the device |
191 | * tree on boot. | 191 | * tree on boot. |
192 | */ | 192 | */ |
193 | void __init omap_dmtimer_init(void) | 193 | static void __init omap_dmtimer_init(void) |
194 | { | 194 | { |
195 | struct device_node *np; | 195 | struct device_node *np; |
196 | 196 | ||
@@ -210,7 +210,7 @@ void __init omap_dmtimer_init(void) | |||
210 | * | 210 | * |
211 | * Get the timer errata flags that are specific to the OMAP device being used. | 211 | * Get the timer errata flags that are specific to the OMAP device being used. |
212 | */ | 212 | */ |
213 | u32 __init omap_dm_timer_get_errata(void) | 213 | static u32 __init omap_dm_timer_get_errata(void) |
214 | { | 214 | { |
215 | if (cpu_is_omap24xx()) | 215 | if (cpu_is_omap24xx()) |
216 | return 0; | 216 | return 0; |
@@ -392,7 +392,7 @@ static struct of_device_id omap_counter_match[] __initdata = { | |||
392 | }; | 392 | }; |
393 | 393 | ||
394 | /* Setup free-running counter for clocksource */ | 394 | /* Setup free-running counter for clocksource */ |
395 | static int __init omap2_sync32k_clocksource_init(void) | 395 | static int __init __maybe_unused omap2_sync32k_clocksource_init(void) |
396 | { | 396 | { |
397 | int ret; | 397 | int ret; |
398 | struct device_node *np = NULL; | 398 | struct device_node *np = NULL; |
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c index d1dbe125b34f..2e44e8a22884 100644 --- a/arch/arm/mach-omap2/usb-host.c +++ b/arch/arm/mach-omap2/usb-host.c | |||
@@ -508,6 +508,10 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata) | |||
508 | if (cpu_is_omap34xx()) { | 508 | if (cpu_is_omap34xx()) { |
509 | setup_ehci_io_mux(pdata->port_mode); | 509 | setup_ehci_io_mux(pdata->port_mode); |
510 | setup_ohci_io_mux(pdata->port_mode); | 510 | setup_ohci_io_mux(pdata->port_mode); |
511 | |||
512 | if (omap_rev() <= OMAP3430_REV_ES2_1) | ||
513 | usbhs_data.single_ulpi_bypass = true; | ||
514 | |||
511 | } else if (cpu_is_omap44xx()) { | 515 | } else if (cpu_is_omap44xx()) { |
512 | setup_4430ehci_io_mux(pdata->port_mode); | 516 | setup_4430ehci_io_mux(pdata->port_mode); |
513 | setup_4430ohci_io_mux(pdata->port_mode); | 517 | setup_4430ohci_io_mux(pdata->port_mode); |