diff options
author | Arnd Bergmann <arnd@arndb.de> | 2011-09-30 16:54:11 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2011-09-30 16:54:11 -0400 |
commit | 2cd050062f1ad5834d07f9b392b7d04848f79667 (patch) | |
tree | 583398562ed28b83cbe05cde67da0c66bf905e10 | |
parent | 9be6eb412e313e0b6e6dc90a737bae4df4bded4d (diff) | |
parent | be73246058737beec52ae232bcab7776332a9e06 (diff) |
Merge branch 'omap/cleanup' into next/cleanup
37 files changed, 594 insertions, 751 deletions
diff --git a/arch/arm/include/asm/device.h b/arch/arm/include/asm/device.h index 9f390ce335cb..b5c9f5b1f6a3 100644 --- a/arch/arm/include/asm/device.h +++ b/arch/arm/include/asm/device.h | |||
@@ -12,7 +12,12 @@ struct dev_archdata { | |||
12 | #endif | 12 | #endif |
13 | }; | 13 | }; |
14 | 14 | ||
15 | struct omap_device; | ||
16 | |||
15 | struct pdev_archdata { | 17 | struct pdev_archdata { |
18 | #ifdef CONFIG_ARCH_OMAP | ||
19 | struct omap_device *od; | ||
20 | #endif | ||
16 | }; | 21 | }; |
17 | 22 | ||
18 | #endif | 23 | #endif |
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c index ab7395d84bc8..91f9abbd3250 100644 --- a/arch/arm/mach-omap1/mcbsp.c +++ b/arch/arm/mach-omap1/mcbsp.c | |||
@@ -31,6 +31,7 @@ | |||
31 | static int dsp_use; | 31 | static int dsp_use; |
32 | static struct clk *api_clk; | 32 | static struct clk *api_clk; |
33 | static struct clk *dsp_clk; | 33 | static struct clk *dsp_clk; |
34 | static struct platform_device **omap_mcbsp_devices; | ||
34 | 35 | ||
35 | static void omap1_mcbsp_request(unsigned int id) | 36 | static void omap1_mcbsp_request(unsigned int id) |
36 | { | 37 | { |
@@ -78,6 +79,17 @@ static struct omap_mcbsp_ops omap1_mcbsp_ops = { | |||
78 | .free = omap1_mcbsp_free, | 79 | .free = omap1_mcbsp_free, |
79 | }; | 80 | }; |
80 | 81 | ||
82 | #define OMAP7XX_MCBSP1_BASE 0xfffb1000 | ||
83 | #define OMAP7XX_MCBSP2_BASE 0xfffb1800 | ||
84 | |||
85 | #define OMAP1510_MCBSP1_BASE 0xe1011800 | ||
86 | #define OMAP1510_MCBSP2_BASE 0xfffb1000 | ||
87 | #define OMAP1510_MCBSP3_BASE 0xe1017000 | ||
88 | |||
89 | #define OMAP1610_MCBSP1_BASE 0xe1011800 | ||
90 | #define OMAP1610_MCBSP2_BASE 0xfffb1000 | ||
91 | #define OMAP1610_MCBSP3_BASE 0xe1017000 | ||
92 | |||
81 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) | 93 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
82 | struct resource omap7xx_mcbsp_res[][6] = { | 94 | struct resource omap7xx_mcbsp_res[][6] = { |
83 | { | 95 | { |
@@ -369,6 +381,39 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = { | |||
369 | #define OMAP16XX_MCBSP_COUNT 0 | 381 | #define OMAP16XX_MCBSP_COUNT 0 |
370 | #endif | 382 | #endif |
371 | 383 | ||
384 | static void omap_mcbsp_register_board_cfg(struct resource *res, int res_count, | ||
385 | struct omap_mcbsp_platform_data *config, int size) | ||
386 | { | ||
387 | int i; | ||
388 | |||
389 | omap_mcbsp_devices = kzalloc(size * sizeof(struct platform_device *), | ||
390 | GFP_KERNEL); | ||
391 | if (!omap_mcbsp_devices) { | ||
392 | printk(KERN_ERR "Could not register McBSP devices\n"); | ||
393 | return; | ||
394 | } | ||
395 | |||
396 | for (i = 0; i < size; i++) { | ||
397 | struct platform_device *new_mcbsp; | ||
398 | int ret; | ||
399 | |||
400 | new_mcbsp = platform_device_alloc("omap-mcbsp", i + 1); | ||
401 | if (!new_mcbsp) | ||
402 | continue; | ||
403 | platform_device_add_resources(new_mcbsp, &res[i * res_count], | ||
404 | res_count); | ||
405 | config[i].reg_size = 2; | ||
406 | config[i].reg_step = 2; | ||
407 | new_mcbsp->dev.platform_data = &config[i]; | ||
408 | ret = platform_device_add(new_mcbsp); | ||
409 | if (ret) { | ||
410 | platform_device_put(new_mcbsp); | ||
411 | continue; | ||
412 | } | ||
413 | omap_mcbsp_devices[i] = new_mcbsp; | ||
414 | } | ||
415 | } | ||
416 | |||
372 | static int __init omap1_mcbsp_init(void) | 417 | static int __init omap1_mcbsp_init(void) |
373 | { | 418 | { |
374 | if (!cpu_class_is_omap1()) | 419 | if (!cpu_class_is_omap1()) |
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index 618216c8f742..45dafe2e8552 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c | |||
@@ -243,17 +243,11 @@ static void __init omap_2430sdp_init(void) | |||
243 | "Secondary LCD backlight"); | 243 | "Secondary LCD backlight"); |
244 | } | 244 | } |
245 | 245 | ||
246 | static void __init omap_2430sdp_map_io(void) | ||
247 | { | ||
248 | omap2_set_globals_243x(); | ||
249 | omap243x_map_common_io(); | ||
250 | } | ||
251 | |||
252 | MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board") | 246 | MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board") |
253 | /* Maintainer: Syed Khasim - Texas Instruments Inc */ | 247 | /* Maintainer: Syed Khasim - Texas Instruments Inc */ |
254 | .boot_params = 0x80000100, | 248 | .boot_params = 0x80000100, |
255 | .reserve = omap_reserve, | 249 | .reserve = omap_reserve, |
256 | .map_io = omap_2430sdp_map_io, | 250 | .map_io = omap243x_map_io, |
257 | .init_early = omap2430_init_early, | 251 | .init_early = omap2430_init_early, |
258 | .init_irq = omap2_init_irq, | 252 | .init_irq = omap2_init_irq, |
259 | .init_machine = omap_2430sdp_init, | 253 | .init_machine = omap_2430sdp_init, |
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index ab19d305f61e..44a3e2c7b58b 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c | |||
@@ -825,17 +825,11 @@ static void __init omap_4430sdp_init(void) | |||
825 | omap_4430sdp_display_init(); | 825 | omap_4430sdp_display_init(); |
826 | } | 826 | } |
827 | 827 | ||
828 | static void __init omap_4430sdp_map_io(void) | ||
829 | { | ||
830 | omap2_set_globals_443x(); | ||
831 | omap44xx_map_common_io(); | ||
832 | } | ||
833 | |||
834 | MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board") | 828 | MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board") |
835 | /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */ | 829 | /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */ |
836 | .boot_params = 0x80000100, | 830 | .boot_params = 0x80000100, |
837 | .reserve = omap_reserve, | 831 | .reserve = omap_reserve, |
838 | .map_io = omap_4430sdp_map_io, | 832 | .map_io = omap4_map_io, |
839 | .init_early = omap4430_init_early, | 833 | .init_early = omap4430_init_early, |
840 | .init_irq = gic_init_irq, | 834 | .init_irq = gic_init_irq, |
841 | .init_machine = omap_4430sdp_init, | 835 | .init_machine = omap_4430sdp_init, |
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c index cf546f86014e..852843638fa9 100644 --- a/arch/arm/mach-omap2/board-apollon.c +++ b/arch/arm/mach-omap2/board-apollon.c | |||
@@ -337,17 +337,11 @@ static void __init omap_apollon_init(void) | |||
337 | omap_sdrc_init(NULL, NULL); | 337 | omap_sdrc_init(NULL, NULL); |
338 | } | 338 | } |
339 | 339 | ||
340 | static void __init omap_apollon_map_io(void) | ||
341 | { | ||
342 | omap2_set_globals_242x(); | ||
343 | omap242x_map_common_io(); | ||
344 | } | ||
345 | |||
346 | MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon") | 340 | MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon") |
347 | /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */ | 341 | /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */ |
348 | .boot_params = 0x80000100, | 342 | .boot_params = 0x80000100, |
349 | .reserve = omap_reserve, | 343 | .reserve = omap_reserve, |
350 | .map_io = omap_apollon_map_io, | 344 | .map_io = omap242x_map_io, |
351 | .init_early = omap2420_init_early, | 345 | .init_early = omap2420_init_early, |
352 | .init_irq = omap2_init_irq, | 346 | .init_irq = omap2_init_irq, |
353 | .init_machine = omap_apollon_init, | 347 | .init_machine = omap_apollon_init, |
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c index 4b1f6c68c358..059b74dd9289 100644 --- a/arch/arm/mach-omap2/board-devkit8000.c +++ b/arch/arm/mach-omap2/board-devkit8000.c | |||
@@ -397,11 +397,6 @@ static struct platform_device keys_gpio = { | |||
397 | }, | 397 | }, |
398 | }; | 398 | }; |
399 | 399 | ||
400 | static void __init devkit8000_init_irq(void) | ||
401 | { | ||
402 | omap3_init_irq(); | ||
403 | } | ||
404 | |||
405 | #define OMAP_DM9000_BASE 0x2c000000 | 400 | #define OMAP_DM9000_BASE 0x2c000000 |
406 | 401 | ||
407 | static struct resource omap_dm9000_resources[] = { | 402 | static struct resource omap_dm9000_resources[] = { |
@@ -665,7 +660,7 @@ MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000") | |||
665 | .reserve = omap_reserve, | 660 | .reserve = omap_reserve, |
666 | .map_io = omap3_map_io, | 661 | .map_io = omap3_map_io, |
667 | .init_early = omap35xx_init_early, | 662 | .init_early = omap35xx_init_early, |
668 | .init_irq = devkit8000_init_irq, | 663 | .init_irq = omap3_init_irq, |
669 | .init_machine = devkit8000_init, | 664 | .init_machine = devkit8000_init, |
670 | .timer = &omap3_secure_timer, | 665 | .timer = &omap3_secure_timer, |
671 | MACHINE_END | 666 | MACHINE_END |
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c index aa1b0cbe19d2..30a6f527510c 100644 --- a/arch/arm/mach-omap2/board-flash.c +++ b/arch/arm/mach-omap2/board-flash.c | |||
@@ -148,11 +148,6 @@ __init board_nand_init(struct mtd_partition *nand_parts, | |||
148 | board_nand_data.gpmc_irq = OMAP_GPMC_IRQ_BASE + cs; | 148 | board_nand_data.gpmc_irq = OMAP_GPMC_IRQ_BASE + cs; |
149 | gpmc_nand_init(&board_nand_data); | 149 | gpmc_nand_init(&board_nand_data); |
150 | } | 150 | } |
151 | #else | ||
152 | void | ||
153 | __init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs, int nand_type) | ||
154 | { | ||
155 | } | ||
156 | #endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ | 151 | #endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ |
157 | 152 | ||
158 | /** | 153 | /** |
diff --git a/arch/arm/mach-omap2/board-flash.h b/arch/arm/mach-omap2/board-flash.h index c240a3f8d163..d25503a98417 100644 --- a/arch/arm/mach-omap2/board-flash.h +++ b/arch/arm/mach-omap2/board-flash.h | |||
@@ -24,7 +24,26 @@ struct flash_partitions { | |||
24 | int nr_parts; | 24 | int nr_parts; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | #if defined(CONFIG_MTD_NAND_OMAP2) || \ | ||
28 | defined(CONFIG_MTD_NAND_OMAP2_MODULE) || \ | ||
29 | defined(CONFIG_MTD_ONENAND_OMAP2) || \ | ||
30 | defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) | ||
27 | extern void board_flash_init(struct flash_partitions [], | 31 | extern void board_flash_init(struct flash_partitions [], |
28 | char chip_sel[][GPMC_CS_NUM], int nand_type); | 32 | char chip_sel[][GPMC_CS_NUM], int nand_type); |
33 | #else | ||
34 | static inline void board_flash_init(struct flash_partitions part[], | ||
35 | char chip_sel[][GPMC_CS_NUM], int nand_type) | ||
36 | { | ||
37 | } | ||
38 | #endif | ||
39 | |||
40 | #if defined(CONFIG_MTD_NAND_OMAP2) || \ | ||
41 | defined(CONFIG_MTD_NAND_OMAP2_MODULE) | ||
29 | extern void board_nand_init(struct mtd_partition *nand_parts, | 42 | extern void board_nand_init(struct mtd_partition *nand_parts, |
30 | u8 nr_parts, u8 cs, int nand_type); | 43 | u8 nr_parts, u8 cs, int nand_type); |
44 | #else | ||
45 | static inline void board_nand_init(struct mtd_partition *nand_parts, | ||
46 | u8 nr_parts, u8 cs, int nand_type) | ||
47 | { | ||
48 | } | ||
49 | #endif | ||
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c index 948fde010c69..8486142dcae7 100644 --- a/arch/arm/mach-omap2/board-h4.c +++ b/arch/arm/mach-omap2/board-h4.c | |||
@@ -290,11 +290,6 @@ static struct omap_board_config_kernel h4_config[] __initdata = { | |||
290 | { OMAP_TAG_LCD, &h4_lcd_config }, | 290 | { OMAP_TAG_LCD, &h4_lcd_config }, |
291 | }; | 291 | }; |
292 | 292 | ||
293 | static void __init omap_h4_init_irq(void) | ||
294 | { | ||
295 | omap2_init_irq(); | ||
296 | } | ||
297 | |||
298 | static struct at24_platform_data m24c01 = { | 293 | static struct at24_platform_data m24c01 = { |
299 | .byte_len = SZ_1K / 8, | 294 | .byte_len = SZ_1K / 8, |
300 | .page_size = 16, | 295 | .page_size = 16, |
@@ -369,19 +364,13 @@ static void __init omap_h4_init(void) | |||
369 | h4_init_flash(); | 364 | h4_init_flash(); |
370 | } | 365 | } |
371 | 366 | ||
372 | static void __init omap_h4_map_io(void) | ||
373 | { | ||
374 | omap2_set_globals_242x(); | ||
375 | omap242x_map_common_io(); | ||
376 | } | ||
377 | |||
378 | MACHINE_START(OMAP_H4, "OMAP2420 H4 board") | 367 | MACHINE_START(OMAP_H4, "OMAP2420 H4 board") |
379 | /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */ | 368 | /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */ |
380 | .boot_params = 0x80000100, | 369 | .boot_params = 0x80000100, |
381 | .reserve = omap_reserve, | 370 | .reserve = omap_reserve, |
382 | .map_io = omap_h4_map_io, | 371 | .map_io = omap242x_map_io, |
383 | .init_early = omap2420_init_early, | 372 | .init_early = omap2420_init_early, |
384 | .init_irq = omap_h4_init_irq, | 373 | .init_irq = omap2_init_irq, |
385 | .init_machine = omap_h4_init, | 374 | .init_machine = omap_h4_init, |
386 | .timer = &omap2_timer, | 375 | .timer = &omap2_timer, |
387 | MACHINE_END | 376 | MACHINE_END |
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c index 77a4e19222e2..d1f4a0292c42 100644 --- a/arch/arm/mach-omap2/board-n8x0.c +++ b/arch/arm/mach-omap2/board-n8x0.c | |||
@@ -616,12 +616,6 @@ static struct i2c_board_info n810_i2c_board_info_2[] __initdata = { | |||
616 | }, | 616 | }, |
617 | }; | 617 | }; |
618 | 618 | ||
619 | static void __init n8x0_map_io(void) | ||
620 | { | ||
621 | omap2_set_globals_242x(); | ||
622 | omap242x_map_common_io(); | ||
623 | } | ||
624 | |||
625 | #ifdef CONFIG_OMAP_MUX | 619 | #ifdef CONFIG_OMAP_MUX |
626 | static struct omap_board_mux board_mux[] __initdata = { | 620 | static struct omap_board_mux board_mux[] __initdata = { |
627 | /* I2S codec port pins for McBSP block */ | 621 | /* I2S codec port pins for McBSP block */ |
@@ -692,7 +686,7 @@ static void __init n8x0_init_machine(void) | |||
692 | MACHINE_START(NOKIA_N800, "Nokia N800") | 686 | MACHINE_START(NOKIA_N800, "Nokia N800") |
693 | .boot_params = 0x80000100, | 687 | .boot_params = 0x80000100, |
694 | .reserve = omap_reserve, | 688 | .reserve = omap_reserve, |
695 | .map_io = n8x0_map_io, | 689 | .map_io = omap242x_map_io, |
696 | .init_early = omap2420_init_early, | 690 | .init_early = omap2420_init_early, |
697 | .init_irq = omap2_init_irq, | 691 | .init_irq = omap2_init_irq, |
698 | .init_machine = n8x0_init_machine, | 692 | .init_machine = n8x0_init_machine, |
@@ -702,7 +696,7 @@ MACHINE_END | |||
702 | MACHINE_START(NOKIA_N810, "Nokia N810") | 696 | MACHINE_START(NOKIA_N810, "Nokia N810") |
703 | .boot_params = 0x80000100, | 697 | .boot_params = 0x80000100, |
704 | .reserve = omap_reserve, | 698 | .reserve = omap_reserve, |
705 | .map_io = n8x0_map_io, | 699 | .map_io = omap242x_map_io, |
706 | .init_early = omap2420_init_early, | 700 | .init_early = omap2420_init_early, |
707 | .init_irq = omap2_init_irq, | 701 | .init_irq = omap2_init_irq, |
708 | .init_machine = n8x0_init_machine, | 702 | .init_machine = n8x0_init_machine, |
@@ -712,7 +706,7 @@ MACHINE_END | |||
712 | MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX") | 706 | MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX") |
713 | .boot_params = 0x80000100, | 707 | .boot_params = 0x80000100, |
714 | .reserve = omap_reserve, | 708 | .reserve = omap_reserve, |
715 | .map_io = n8x0_map_io, | 709 | .map_io = omap242x_map_io, |
716 | .init_early = omap2420_init_early, | 710 | .init_early = omap2420_init_early, |
717 | .init_irq = omap2_init_irq, | 711 | .init_irq = omap2_init_irq, |
718 | .init_machine = n8x0_init_machine, | 712 | .init_machine = n8x0_init_machine, |
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index ce3234d6a344..e085371eb494 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c | |||
@@ -449,11 +449,6 @@ static void __init omap3_beagle_init_early(void) | |||
449 | omap2_init_common_infrastructure(); | 449 | omap2_init_common_infrastructure(); |
450 | } | 450 | } |
451 | 451 | ||
452 | static void __init omap3_beagle_init_irq(void) | ||
453 | { | ||
454 | omap3_init_irq(); | ||
455 | } | ||
456 | |||
457 | static struct platform_device *omap3_beagle_devices[] __initdata = { | 452 | static struct platform_device *omap3_beagle_devices[] __initdata = { |
458 | &leds_gpio, | 453 | &leds_gpio, |
459 | &keys_gpio, | 454 | &keys_gpio, |
@@ -561,7 +556,7 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board") | |||
561 | .reserve = omap_reserve, | 556 | .reserve = omap_reserve, |
562 | .map_io = omap3_map_io, | 557 | .map_io = omap3_map_io, |
563 | .init_early = omap3_beagle_init_early, | 558 | .init_early = omap3_beagle_init_early, |
564 | .init_irq = omap3_beagle_init_irq, | 559 | .init_irq = omap3_init_irq, |
565 | .init_machine = omap3_beagle_init, | 560 | .init_machine = omap3_beagle_init, |
566 | .timer = &omap3_secure_timer, | 561 | .timer = &omap3_secure_timer, |
567 | MACHINE_END | 562 | MACHINE_END |
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c index 807c27406792..fa58a0f1584a 100644 --- a/arch/arm/mach-omap2/board-omap3stalker.c +++ b/arch/arm/mach-omap2/board-omap3stalker.c | |||
@@ -428,11 +428,6 @@ static int __init omap3_stalker_i2c_init(void) | |||
428 | static struct omap_board_config_kernel omap3_stalker_config[] __initdata = { | 428 | static struct omap_board_config_kernel omap3_stalker_config[] __initdata = { |
429 | }; | 429 | }; |
430 | 430 | ||
431 | static void __init omap3_stalker_init_irq(void) | ||
432 | { | ||
433 | omap3_init_irq(); | ||
434 | } | ||
435 | |||
436 | static struct platform_device *omap3_stalker_devices[] __initdata = { | 431 | static struct platform_device *omap3_stalker_devices[] __initdata = { |
437 | &keys_gpio, | 432 | &keys_gpio, |
438 | }; | 433 | }; |
@@ -492,7 +487,7 @@ MACHINE_START(SBC3530, "OMAP3 STALKER") | |||
492 | .boot_params = 0x80000100, | 487 | .boot_params = 0x80000100, |
493 | .map_io = omap3_map_io, | 488 | .map_io = omap3_map_io, |
494 | .init_early = omap35xx_init_early, | 489 | .init_early = omap35xx_init_early, |
495 | .init_irq = omap3_stalker_init_irq, | 490 | .init_irq = omap3_init_irq, |
496 | .init_machine = omap3_stalker_init, | 491 | .init_machine = omap3_stalker_init, |
497 | .timer = &omap3_secure_timer, | 492 | .timer = &omap3_secure_timer, |
498 | MACHINE_END | 493 | MACHINE_END |
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c index f7f18092f36d..05488fbc20d5 100644 --- a/arch/arm/mach-omap2/board-omap3touchbook.c +++ b/arch/arm/mach-omap2/board-omap3touchbook.c | |||
@@ -326,11 +326,6 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
326 | }; | 326 | }; |
327 | #endif | 327 | #endif |
328 | 328 | ||
329 | static void __init omap3_touchbook_init_irq(void) | ||
330 | { | ||
331 | omap3_init_irq(); | ||
332 | } | ||
333 | |||
334 | static struct platform_device *omap3_touchbook_devices[] __initdata = { | 329 | static struct platform_device *omap3_touchbook_devices[] __initdata = { |
335 | &omap3_touchbook_lcd_device, | 330 | &omap3_touchbook_lcd_device, |
336 | &leds_gpio, | 331 | &leds_gpio, |
@@ -403,7 +398,7 @@ MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board") | |||
403 | .reserve = omap_reserve, | 398 | .reserve = omap_reserve, |
404 | .map_io = omap3_map_io, | 399 | .map_io = omap3_map_io, |
405 | .init_early = omap3430_init_early, | 400 | .init_early = omap3430_init_early, |
406 | .init_irq = omap3_touchbook_init_irq, | 401 | .init_irq = omap3_init_irq, |
407 | .init_machine = omap3_touchbook_init, | 402 | .init_machine = omap3_touchbook_init, |
408 | .timer = &omap3_secure_timer, | 403 | .timer = &omap3_secure_timer, |
409 | MACHINE_END | 404 | MACHINE_END |
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index 1bce76589784..e26929049a4d 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c | |||
@@ -570,17 +570,11 @@ static void __init omap4_panda_init(void) | |||
570 | omap4_panda_display_init(); | 570 | omap4_panda_display_init(); |
571 | } | 571 | } |
572 | 572 | ||
573 | static void __init omap4_panda_map_io(void) | ||
574 | { | ||
575 | omap2_set_globals_443x(); | ||
576 | omap44xx_map_common_io(); | ||
577 | } | ||
578 | |||
579 | MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board") | 573 | MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board") |
580 | /* Maintainer: David Anders - Texas Instruments Inc */ | 574 | /* Maintainer: David Anders - Texas Instruments Inc */ |
581 | .boot_params = 0x80000100, | 575 | .boot_params = 0x80000100, |
582 | .reserve = omap_reserve, | 576 | .reserve = omap_reserve, |
583 | .map_io = omap4_panda_map_io, | 577 | .map_io = omap4_map_io, |
584 | .init_early = omap4430_init_early, | 578 | .init_early = omap4430_init_early, |
585 | .init_irq = gic_init_irq, | 579 | .init_irq = gic_init_irq, |
586 | .init_machine = omap4_panda_init, | 580 | .init_machine = omap4_panda_init, |
diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c index a3182e846b14..a98db616e0d4 100644 --- a/arch/arm/mach-omap2/board-rm680.c +++ b/arch/arm/mach-omap2/board-rm680.c | |||
@@ -143,16 +143,10 @@ static void __init rm680_init(void) | |||
143 | rm680_peripherals_init(); | 143 | rm680_peripherals_init(); |
144 | } | 144 | } |
145 | 145 | ||
146 | static void __init rm680_map_io(void) | ||
147 | { | ||
148 | omap2_set_globals_3xxx(); | ||
149 | omap34xx_map_common_io(); | ||
150 | } | ||
151 | |||
152 | MACHINE_START(NOKIA_RM680, "Nokia RM-680 board") | 146 | MACHINE_START(NOKIA_RM680, "Nokia RM-680 board") |
153 | .boot_params = 0x80000100, | 147 | .boot_params = 0x80000100, |
154 | .reserve = omap_reserve, | 148 | .reserve = omap_reserve, |
155 | .map_io = rm680_map_io, | 149 | .map_io = omap3_map_io, |
156 | .init_early = omap3630_init_early, | 150 | .init_early = omap3630_init_early, |
157 | .init_irq = omap3_init_irq, | 151 | .init_irq = omap3_init_irq, |
158 | .init_machine = rm680_init, | 152 | .init_machine = rm680_init, |
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c index 32a79e28379c..8677a06aa4a7 100644 --- a/arch/arm/mach-omap2/board-rx51.c +++ b/arch/arm/mach-omap2/board-rx51.c | |||
@@ -139,12 +139,6 @@ static void __init rx51_init(void) | |||
139 | platform_device_register(&leds_gpio); | 139 | platform_device_register(&leds_gpio); |
140 | } | 140 | } |
141 | 141 | ||
142 | static void __init rx51_map_io(void) | ||
143 | { | ||
144 | omap2_set_globals_3xxx(); | ||
145 | omap34xx_map_common_io(); | ||
146 | } | ||
147 | |||
148 | static void __init rx51_reserve(void) | 142 | static void __init rx51_reserve(void) |
149 | { | 143 | { |
150 | rx51_video_mem_init(); | 144 | rx51_video_mem_init(); |
@@ -155,7 +149,7 @@ MACHINE_START(NOKIA_RX51, "Nokia RX-51 board") | |||
155 | /* Maintainer: Lauri Leukkunen <lauri.leukkunen@nokia.com> */ | 149 | /* Maintainer: Lauri Leukkunen <lauri.leukkunen@nokia.com> */ |
156 | .boot_params = 0x80000100, | 150 | .boot_params = 0x80000100, |
157 | .reserve = rx51_reserve, | 151 | .reserve = rx51_reserve, |
158 | .map_io = rx51_map_io, | 152 | .map_io = omap3_map_io, |
159 | .init_early = omap3430_init_early, | 153 | .init_early = omap3430_init_early, |
160 | .init_irq = omap3_init_irq, | 154 | .init_irq = omap3_init_irq, |
161 | .init_machine = rx51_init, | 155 | .init_machine = rx51_init, |
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c index 3f20cbb9967b..de61f15c48e2 100644 --- a/arch/arm/mach-omap2/common.c +++ b/arch/arm/mach-omap2/common.c | |||
@@ -56,6 +56,12 @@ void __init omap2_set_globals_242x(void) | |||
56 | { | 56 | { |
57 | __omap2_set_globals(&omap242x_globals); | 57 | __omap2_set_globals(&omap242x_globals); |
58 | } | 58 | } |
59 | |||
60 | void __init omap242x_map_io(void) | ||
61 | { | ||
62 | omap2_set_globals_242x(); | ||
63 | omap242x_map_common_io(); | ||
64 | } | ||
59 | #endif | 65 | #endif |
60 | 66 | ||
61 | #if defined(CONFIG_SOC_OMAP2430) | 67 | #if defined(CONFIG_SOC_OMAP2430) |
@@ -74,6 +80,12 @@ void __init omap2_set_globals_243x(void) | |||
74 | { | 80 | { |
75 | __omap2_set_globals(&omap243x_globals); | 81 | __omap2_set_globals(&omap243x_globals); |
76 | } | 82 | } |
83 | |||
84 | void __init omap243x_map_io(void) | ||
85 | { | ||
86 | omap2_set_globals_243x(); | ||
87 | omap243x_map_common_io(); | ||
88 | } | ||
77 | #endif | 89 | #endif |
78 | 90 | ||
79 | #if defined(CONFIG_ARCH_OMAP3) | 91 | #if defined(CONFIG_ARCH_OMAP3) |
@@ -138,5 +150,11 @@ void __init omap2_set_globals_443x(void) | |||
138 | omap2_set_globals_control(&omap4_globals); | 150 | omap2_set_globals_control(&omap4_globals); |
139 | omap2_set_globals_prcm(&omap4_globals); | 151 | omap2_set_globals_prcm(&omap4_globals); |
140 | } | 152 | } |
153 | |||
154 | void __init omap4_map_io(void) | ||
155 | { | ||
156 | omap2_set_globals_443x(); | ||
157 | omap44xx_map_common_io(); | ||
158 | } | ||
141 | #endif | 159 | #endif |
142 | 160 | ||
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 1077ad663f93..10adf66be7ba 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c | |||
@@ -44,7 +44,7 @@ static int __init omap3_l3_init(void) | |||
44 | { | 44 | { |
45 | int l; | 45 | int l; |
46 | struct omap_hwmod *oh; | 46 | struct omap_hwmod *oh; |
47 | struct omap_device *od; | 47 | struct platform_device *pdev; |
48 | char oh_name[L3_MODULES_MAX_LEN]; | 48 | char oh_name[L3_MODULES_MAX_LEN]; |
49 | 49 | ||
50 | /* | 50 | /* |
@@ -61,12 +61,12 @@ static int __init omap3_l3_init(void) | |||
61 | if (!oh) | 61 | if (!oh) |
62 | pr_err("could not look up %s\n", oh_name); | 62 | pr_err("could not look up %s\n", oh_name); |
63 | 63 | ||
64 | od = omap_device_build("omap_l3_smx", 0, oh, NULL, 0, | 64 | pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0, |
65 | NULL, 0, 0); | 65 | NULL, 0, 0); |
66 | 66 | ||
67 | WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name); | 67 | WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); |
68 | 68 | ||
69 | return IS_ERR(od) ? PTR_ERR(od) : 0; | 69 | return IS_ERR(pdev) ? PTR_ERR(pdev) : 0; |
70 | } | 70 | } |
71 | postcore_initcall(omap3_l3_init); | 71 | postcore_initcall(omap3_l3_init); |
72 | 72 | ||
@@ -74,7 +74,7 @@ static int __init omap4_l3_init(void) | |||
74 | { | 74 | { |
75 | int l, i; | 75 | int l, i; |
76 | struct omap_hwmod *oh[3]; | 76 | struct omap_hwmod *oh[3]; |
77 | struct omap_device *od; | 77 | struct platform_device *pdev; |
78 | char oh_name[L3_MODULES_MAX_LEN]; | 78 | char oh_name[L3_MODULES_MAX_LEN]; |
79 | 79 | ||
80 | /* | 80 | /* |
@@ -92,12 +92,12 @@ static int __init omap4_l3_init(void) | |||
92 | pr_err("could not look up %s\n", oh_name); | 92 | pr_err("could not look up %s\n", oh_name); |
93 | } | 93 | } |
94 | 94 | ||
95 | od = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL, | 95 | pdev = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL, |
96 | 0, NULL, 0, 0); | 96 | 0, NULL, 0, 0); |
97 | 97 | ||
98 | WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name); | 98 | WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); |
99 | 99 | ||
100 | return IS_ERR(od) ? PTR_ERR(od) : 0; | 100 | return IS_ERR(pdev) ? PTR_ERR(pdev) : 0; |
101 | } | 101 | } |
102 | postcore_initcall(omap4_l3_init); | 102 | postcore_initcall(omap4_l3_init); |
103 | 103 | ||
@@ -232,7 +232,7 @@ struct omap_device_pm_latency omap_keyboard_latency[] = { | |||
232 | int __init omap4_keyboard_init(struct omap4_keypad_platform_data | 232 | int __init omap4_keyboard_init(struct omap4_keypad_platform_data |
233 | *sdp4430_keypad_data, struct omap_board_data *bdata) | 233 | *sdp4430_keypad_data, struct omap_board_data *bdata) |
234 | { | 234 | { |
235 | struct omap_device *od; | 235 | struct platform_device *pdev; |
236 | struct omap_hwmod *oh; | 236 | struct omap_hwmod *oh; |
237 | struct omap4_keypad_platform_data *keypad_data; | 237 | struct omap4_keypad_platform_data *keypad_data; |
238 | unsigned int id = -1; | 238 | unsigned int id = -1; |
@@ -247,15 +247,15 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data | |||
247 | 247 | ||
248 | keypad_data = sdp4430_keypad_data; | 248 | keypad_data = sdp4430_keypad_data; |
249 | 249 | ||
250 | od = omap_device_build(name, id, oh, keypad_data, | 250 | pdev = omap_device_build(name, id, oh, keypad_data, |
251 | sizeof(struct omap4_keypad_platform_data), | 251 | sizeof(struct omap4_keypad_platform_data), |
252 | omap_keyboard_latency, | 252 | omap_keyboard_latency, |
253 | ARRAY_SIZE(omap_keyboard_latency), 0); | 253 | ARRAY_SIZE(omap_keyboard_latency), 0); |
254 | 254 | ||
255 | if (IS_ERR(od)) { | 255 | if (IS_ERR(pdev)) { |
256 | WARN(1, "Can't build omap_device for %s:%s.\n", | 256 | WARN(1, "Can't build omap_device for %s:%s.\n", |
257 | name, oh->name); | 257 | name, oh->name); |
258 | return PTR_ERR(od); | 258 | return PTR_ERR(pdev); |
259 | } | 259 | } |
260 | oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); | 260 | oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); |
261 | 261 | ||
@@ -274,7 +274,7 @@ static struct omap_device_pm_latency mbox_latencies[] = { | |||
274 | static inline void omap_init_mbox(void) | 274 | static inline void omap_init_mbox(void) |
275 | { | 275 | { |
276 | struct omap_hwmod *oh; | 276 | struct omap_hwmod *oh; |
277 | struct omap_device *od; | 277 | struct platform_device *pdev; |
278 | 278 | ||
279 | oh = omap_hwmod_lookup("mailbox"); | 279 | oh = omap_hwmod_lookup("mailbox"); |
280 | if (!oh) { | 280 | if (!oh) { |
@@ -282,10 +282,10 @@ static inline void omap_init_mbox(void) | |||
282 | return; | 282 | return; |
283 | } | 283 | } |
284 | 284 | ||
285 | od = omap_device_build("omap-mailbox", -1, oh, NULL, 0, | 285 | pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0, |
286 | mbox_latencies, ARRAY_SIZE(mbox_latencies), 0); | 286 | mbox_latencies, ARRAY_SIZE(mbox_latencies), 0); |
287 | WARN(IS_ERR(od), "%s: could not build device, err %ld\n", | 287 | WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n", |
288 | __func__, PTR_ERR(od)); | 288 | __func__, PTR_ERR(pdev)); |
289 | } | 289 | } |
290 | #else | 290 | #else |
291 | static inline void omap_init_mbox(void) { } | 291 | static inline void omap_init_mbox(void) { } |
@@ -344,7 +344,7 @@ struct omap_device_pm_latency omap_mcspi_latency[] = { | |||
344 | 344 | ||
345 | static int omap_mcspi_init(struct omap_hwmod *oh, void *unused) | 345 | static int omap_mcspi_init(struct omap_hwmod *oh, void *unused) |
346 | { | 346 | { |
347 | struct omap_device *od; | 347 | struct platform_device *pdev; |
348 | char *name = "omap2_mcspi"; | 348 | char *name = "omap2_mcspi"; |
349 | struct omap2_mcspi_platform_config *pdata; | 349 | struct omap2_mcspi_platform_config *pdata; |
350 | static int spi_num; | 350 | static int spi_num; |
@@ -371,10 +371,10 @@ static int omap_mcspi_init(struct omap_hwmod *oh, void *unused) | |||
371 | } | 371 | } |
372 | 372 | ||
373 | spi_num++; | 373 | spi_num++; |
374 | od = omap_device_build(name, spi_num, oh, pdata, | 374 | pdev = omap_device_build(name, spi_num, oh, pdata, |
375 | sizeof(*pdata), omap_mcspi_latency, | 375 | sizeof(*pdata), omap_mcspi_latency, |
376 | ARRAY_SIZE(omap_mcspi_latency), 0); | 376 | ARRAY_SIZE(omap_mcspi_latency), 0); |
377 | WARN(IS_ERR(od), "Can't build omap_device for %s:%s\n", | 377 | WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n", |
378 | name, oh->name); | 378 | name, oh->name); |
379 | kfree(pdata); | 379 | kfree(pdata); |
380 | return 0; | 380 | return 0; |
@@ -709,7 +709,7 @@ static struct omap_device_pm_latency omap_wdt_latency[] = { | |||
709 | static int __init omap_init_wdt(void) | 709 | static int __init omap_init_wdt(void) |
710 | { | 710 | { |
711 | int id = -1; | 711 | int id = -1; |
712 | struct omap_device *od; | 712 | struct platform_device *pdev; |
713 | struct omap_hwmod *oh; | 713 | struct omap_hwmod *oh; |
714 | char *oh_name = "wd_timer2"; | 714 | char *oh_name = "wd_timer2"; |
715 | char *dev_name = "omap_wdt"; | 715 | char *dev_name = "omap_wdt"; |
@@ -723,10 +723,10 @@ static int __init omap_init_wdt(void) | |||
723 | return -EINVAL; | 723 | return -EINVAL; |
724 | } | 724 | } |
725 | 725 | ||
726 | od = omap_device_build(dev_name, id, oh, NULL, 0, | 726 | pdev = omap_device_build(dev_name, id, oh, NULL, 0, |
727 | omap_wdt_latency, | 727 | omap_wdt_latency, |
728 | ARRAY_SIZE(omap_wdt_latency), 0); | 728 | ARRAY_SIZE(omap_wdt_latency), 0); |
729 | WARN(IS_ERR(od), "Can't build omap_device for %s:%s.\n", | 729 | WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n", |
730 | dev_name, oh->name); | 730 | dev_name, oh->name); |
731 | return 0; | 731 | return 0; |
732 | } | 732 | } |
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index a5b7a236aa5b..18693f6de041 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c | |||
@@ -78,7 +78,7 @@ int __init omap_display_init(struct omap_dss_board_info *board_data) | |||
78 | { | 78 | { |
79 | int r = 0; | 79 | int r = 0; |
80 | struct omap_hwmod *oh; | 80 | struct omap_hwmod *oh; |
81 | struct omap_device *od; | 81 | struct platform_device *pdev; |
82 | int i, oh_count; | 82 | int i, oh_count; |
83 | struct omap_display_platform_data pdata; | 83 | struct omap_display_platform_data pdata; |
84 | const struct omap_dss_hwmod_data *curr_dss_hwmod; | 84 | const struct omap_dss_hwmod_data *curr_dss_hwmod; |
@@ -108,13 +108,13 @@ int __init omap_display_init(struct omap_dss_board_info *board_data) | |||
108 | return -ENODEV; | 108 | return -ENODEV; |
109 | } | 109 | } |
110 | 110 | ||
111 | od = omap_device_build(curr_dss_hwmod[i].dev_name, | 111 | pdev = omap_device_build(curr_dss_hwmod[i].dev_name, |
112 | curr_dss_hwmod[i].id, oh, &pdata, | 112 | curr_dss_hwmod[i].id, oh, &pdata, |
113 | sizeof(struct omap_display_platform_data), | 113 | sizeof(struct omap_display_platform_data), |
114 | omap_dss_latency, | 114 | omap_dss_latency, |
115 | ARRAY_SIZE(omap_dss_latency), 0); | 115 | ARRAY_SIZE(omap_dss_latency), 0); |
116 | 116 | ||
117 | if (WARN((IS_ERR(od)), "Could not build omap_device for %s\n", | 117 | if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n", |
118 | curr_dss_hwmod[i].oh_name)) | 118 | curr_dss_hwmod[i].oh_name)) |
119 | return -ENODEV; | 119 | return -ENODEV; |
120 | } | 120 | } |
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c index c9ff0e79703d..ae8cb3fb1830 100644 --- a/arch/arm/mach-omap2/dma.c +++ b/arch/arm/mach-omap2/dma.c | |||
@@ -228,7 +228,7 @@ static u32 configure_dma_errata(void) | |||
228 | /* One time initializations */ | 228 | /* One time initializations */ |
229 | static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused) | 229 | static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused) |
230 | { | 230 | { |
231 | struct omap_device *od; | 231 | struct platform_device *pdev; |
232 | struct omap_system_dma_plat_info *p; | 232 | struct omap_system_dma_plat_info *p; |
233 | struct resource *mem; | 233 | struct resource *mem; |
234 | char *name = "omap_dma_system"; | 234 | char *name = "omap_dma_system"; |
@@ -258,23 +258,23 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused) | |||
258 | 258 | ||
259 | p->errata = configure_dma_errata(); | 259 | p->errata = configure_dma_errata(); |
260 | 260 | ||
261 | od = omap_device_build(name, 0, oh, p, sizeof(*p), | 261 | pdev = omap_device_build(name, 0, oh, p, sizeof(*p), |
262 | omap2_dma_latency, ARRAY_SIZE(omap2_dma_latency), 0); | 262 | omap2_dma_latency, ARRAY_SIZE(omap2_dma_latency), 0); |
263 | kfree(p); | 263 | kfree(p); |
264 | if (IS_ERR(od)) { | 264 | if (IS_ERR(pdev)) { |
265 | pr_err("%s: Can't build omap_device for %s:%s.\n", | 265 | pr_err("%s: Can't build omap_device for %s:%s.\n", |
266 | __func__, name, oh->name); | 266 | __func__, name, oh->name); |
267 | return PTR_ERR(od); | 267 | return PTR_ERR(pdev); |
268 | } | 268 | } |
269 | 269 | ||
270 | mem = platform_get_resource(&od->pdev, IORESOURCE_MEM, 0); | 270 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
271 | if (!mem) { | 271 | if (!mem) { |
272 | dev_err(&od->pdev.dev, "%s: no mem resource\n", __func__); | 272 | dev_err(&pdev->dev, "%s: no mem resource\n", __func__); |
273 | return -EINVAL; | 273 | return -EINVAL; |
274 | } | 274 | } |
275 | dma_base = ioremap(mem->start, resource_size(mem)); | 275 | dma_base = ioremap(mem->start, resource_size(mem)); |
276 | if (!dma_base) { | 276 | if (!dma_base) { |
277 | dev_err(&od->pdev.dev, "%s: ioremap fail\n", __func__); | 277 | dev_err(&pdev->dev, "%s: ioremap fail\n", __func__); |
278 | return -ENOMEM; | 278 | return -ENOMEM; |
279 | } | 279 | } |
280 | 280 | ||
@@ -283,7 +283,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused) | |||
283 | (d->lch_count), GFP_KERNEL); | 283 | (d->lch_count), GFP_KERNEL); |
284 | 284 | ||
285 | if (!d->chan) { | 285 | if (!d->chan) { |
286 | dev_err(&od->pdev.dev, "%s: kzalloc fail\n", __func__); | 286 | dev_err(&pdev->dev, "%s: kzalloc fail\n", __func__); |
287 | return -ENOMEM; | 287 | return -ENOMEM; |
288 | } | 288 | } |
289 | return 0; | 289 | return 0; |
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c index 2765cdc3152d..652ccc574196 100644 --- a/arch/arm/mach-omap2/gpio.c +++ b/arch/arm/mach-omap2/gpio.c | |||
@@ -34,7 +34,7 @@ static struct omap_device_pm_latency omap_gpio_latency[] = { | |||
34 | 34 | ||
35 | static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) | 35 | static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) |
36 | { | 36 | { |
37 | struct omap_device *od; | 37 | struct platform_device *pdev; |
38 | struct omap_gpio_platform_data *pdata; | 38 | struct omap_gpio_platform_data *pdata; |
39 | struct omap_gpio_dev_attr *dev_attr; | 39 | struct omap_gpio_dev_attr *dev_attr; |
40 | char *name = "omap_gpio"; | 40 | char *name = "omap_gpio"; |
@@ -107,19 +107,19 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) | |||
107 | return -EINVAL; | 107 | return -EINVAL; |
108 | } | 108 | } |
109 | 109 | ||
110 | od = omap_device_build(name, id - 1, oh, pdata, | 110 | pdev = omap_device_build(name, id - 1, oh, pdata, |
111 | sizeof(*pdata), omap_gpio_latency, | 111 | sizeof(*pdata), omap_gpio_latency, |
112 | ARRAY_SIZE(omap_gpio_latency), | 112 | ARRAY_SIZE(omap_gpio_latency), |
113 | false); | 113 | false); |
114 | kfree(pdata); | 114 | kfree(pdata); |
115 | 115 | ||
116 | if (IS_ERR(od)) { | 116 | if (IS_ERR(pdev)) { |
117 | WARN(1, "Can't build omap_device for %s:%s.\n", | 117 | WARN(1, "Can't build omap_device for %s:%s.\n", |
118 | name, oh->name); | 118 | name, oh->name); |
119 | return PTR_ERR(od); | 119 | return PTR_ERR(pdev); |
120 | } | 120 | } |
121 | 121 | ||
122 | omap_device_disable_idle_on_suspend(od); | 122 | omap_device_disable_idle_on_suspend(pdev); |
123 | 123 | ||
124 | gpio_bank_count++; | 124 | gpio_bank_count++; |
125 | return 0; | 125 | return 0; |
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c index a9b45c76e1d3..cc8791952a05 100644 --- a/arch/arm/mach-omap2/hsmmc.c +++ b/arch/arm/mach-omap2/hsmmc.c | |||
@@ -430,7 +430,7 @@ static struct omap_device_pm_latency omap_hsmmc_latency[] = { | |||
430 | void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr) | 430 | void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr) |
431 | { | 431 | { |
432 | struct omap_hwmod *oh; | 432 | struct omap_hwmod *oh; |
433 | struct omap_device *od; | 433 | struct platform_device *pdev; |
434 | struct omap_device_pm_latency *ohl; | 434 | struct omap_device_pm_latency *ohl; |
435 | char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN]; | 435 | char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN]; |
436 | struct omap_mmc_platform_data *mmc_data; | 436 | struct omap_mmc_platform_data *mmc_data; |
@@ -471,9 +471,9 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr) | |||
471 | mmc_data->controller_flags = mmc_dev_attr->flags; | 471 | mmc_data->controller_flags = mmc_dev_attr->flags; |
472 | } | 472 | } |
473 | 473 | ||
474 | od = omap_device_build(name, ctrl_nr - 1, oh, mmc_data, | 474 | pdev = omap_device_build(name, ctrl_nr - 1, oh, mmc_data, |
475 | sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false); | 475 | sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false); |
476 | if (IS_ERR(od)) { | 476 | if (IS_ERR(pdev)) { |
477 | WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name); | 477 | WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name); |
478 | kfree(mmc_data->slots[0].name); | 478 | kfree(mmc_data->slots[0].name); |
479 | goto done; | 479 | goto done; |
@@ -482,7 +482,7 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr) | |||
482 | * return device handle to board setup code | 482 | * return device handle to board setup code |
483 | * required to populate for regulator framework structure | 483 | * required to populate for regulator framework structure |
484 | */ | 484 | */ |
485 | hsmmcinfo->dev = &od->pdev.dev; | 485 | hsmmcinfo->dev = &pdev->dev; |
486 | 486 | ||
487 | done: | 487 | done: |
488 | kfree(mmc_data); | 488 | kfree(mmc_data); |
diff --git a/arch/arm/mach-omap2/hwspinlock.c b/arch/arm/mach-omap2/hwspinlock.c index 06d4a80660a5..0b3ae9d9c3b3 100644 --- a/arch/arm/mach-omap2/hwspinlock.c +++ b/arch/arm/mach-omap2/hwspinlock.c | |||
@@ -35,7 +35,7 @@ int __init hwspinlocks_init(void) | |||
35 | { | 35 | { |
36 | int retval = 0; | 36 | int retval = 0; |
37 | struct omap_hwmod *oh; | 37 | struct omap_hwmod *oh; |
38 | struct omap_device *od; | 38 | struct platform_device *pdev; |
39 | const char *oh_name = "spinlock"; | 39 | const char *oh_name = "spinlock"; |
40 | const char *dev_name = "omap_hwspinlock"; | 40 | const char *dev_name = "omap_hwspinlock"; |
41 | 41 | ||
@@ -48,13 +48,13 @@ int __init hwspinlocks_init(void) | |||
48 | if (oh == NULL) | 48 | if (oh == NULL) |
49 | return -EINVAL; | 49 | return -EINVAL; |
50 | 50 | ||
51 | od = omap_device_build(dev_name, 0, oh, NULL, 0, | 51 | pdev = omap_device_build(dev_name, 0, oh, NULL, 0, |
52 | omap_spinlock_latency, | 52 | omap_spinlock_latency, |
53 | ARRAY_SIZE(omap_spinlock_latency), false); | 53 | ARRAY_SIZE(omap_spinlock_latency), false); |
54 | if (IS_ERR(od)) { | 54 | if (IS_ERR(pdev)) { |
55 | pr_err("Can't build omap_device for %s:%s\n", dev_name, | 55 | pr_err("Can't build omap_device for %s:%s\n", dev_name, |
56 | oh_name); | 56 | oh_name); |
57 | retval = PTR_ERR(od); | 57 | retval = PTR_ERR(pdev); |
58 | } | 58 | } |
59 | 59 | ||
60 | return retval; | 60 | return retval; |
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c index 4a6ef6ab8458..5063f253c4b9 100644 --- a/arch/arm/mach-omap2/mcbsp.c +++ b/arch/arm/mach-omap2/mcbsp.c | |||
@@ -27,66 +27,69 @@ | |||
27 | 27 | ||
28 | #include "control.h" | 28 | #include "control.h" |
29 | 29 | ||
30 | /* McBSP internal signal muxing functions */ | 30 | /* |
31 | * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle. | ||
32 | * Sidetone needs non-gated ICLK and sidetone autoidle is broken. | ||
33 | */ | ||
34 | #include "cm2xxx_3xxx.h" | ||
35 | #include "cm-regbits-34xx.h" | ||
31 | 36 | ||
32 | void omap2_mcbsp1_mux_clkr_src(u8 mux) | 37 | /* McBSP internal signal muxing function */ |
38 | static int omap2_mcbsp1_mux_rx_clk(struct device *dev, const char *signal, | ||
39 | const char *src) | ||
33 | { | 40 | { |
34 | u32 v; | 41 | u32 v; |
35 | 42 | ||
36 | v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); | 43 | v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); |
37 | if (mux == CLKR_SRC_CLKR) | ||
38 | v &= ~OMAP2_MCBSP1_CLKR_MASK; | ||
39 | else if (mux == CLKR_SRC_CLKX) | ||
40 | v |= OMAP2_MCBSP1_CLKR_MASK; | ||
41 | omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); | ||
42 | } | ||
43 | EXPORT_SYMBOL(omap2_mcbsp1_mux_clkr_src); | ||
44 | 44 | ||
45 | void omap2_mcbsp1_mux_fsr_src(u8 mux) | 45 | if (!strcmp(signal, "clkr")) { |
46 | { | 46 | if (!strcmp(src, "clkr")) |
47 | u32 v; | 47 | v &= ~OMAP2_MCBSP1_CLKR_MASK; |
48 | else if (!strcmp(src, "clkx")) | ||
49 | v |= OMAP2_MCBSP1_CLKR_MASK; | ||
50 | else | ||
51 | return -EINVAL; | ||
52 | } else if (!strcmp(signal, "fsr")) { | ||
53 | if (!strcmp(src, "fsr")) | ||
54 | v &= ~OMAP2_MCBSP1_FSR_MASK; | ||
55 | else if (!strcmp(src, "fsx")) | ||
56 | v |= OMAP2_MCBSP1_FSR_MASK; | ||
57 | else | ||
58 | return -EINVAL; | ||
59 | } else { | ||
60 | return -EINVAL; | ||
61 | } | ||
48 | 62 | ||
49 | v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); | ||
50 | if (mux == FSR_SRC_FSR) | ||
51 | v &= ~OMAP2_MCBSP1_FSR_MASK; | ||
52 | else if (mux == FSR_SRC_FSX) | ||
53 | v |= OMAP2_MCBSP1_FSR_MASK; | ||
54 | omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); | 63 | omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); |
64 | |||
65 | return 0; | ||
55 | } | 66 | } |
56 | EXPORT_SYMBOL(omap2_mcbsp1_mux_fsr_src); | ||
57 | 67 | ||
58 | /* McBSP CLKS source switching function */ | 68 | /* McBSP CLKS source switching function */ |
59 | 69 | static int omap2_mcbsp_set_clk_src(struct device *dev, struct clk *clk, | |
60 | int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id) | 70 | const char *src) |
61 | { | 71 | { |
62 | struct omap_mcbsp *mcbsp; | ||
63 | struct clk *fck_src; | 72 | struct clk *fck_src; |
64 | char *fck_src_name; | 73 | char *fck_src_name; |
65 | int r; | 74 | int r; |
66 | 75 | ||
67 | if (!omap_mcbsp_check_valid_id(id)) { | 76 | if (!strcmp(src, "clks_ext")) |
68 | pr_err("%s: Invalid id (%d)\n", __func__, id + 1); | ||
69 | return -EINVAL; | ||
70 | } | ||
71 | mcbsp = id_to_mcbsp_ptr(id); | ||
72 | |||
73 | if (fck_src_id == MCBSP_CLKS_PAD_SRC) | ||
74 | fck_src_name = "pad_fck"; | 77 | fck_src_name = "pad_fck"; |
75 | else if (fck_src_id == MCBSP_CLKS_PRCM_SRC) | 78 | else if (!strcmp(src, "clks_fclk")) |
76 | fck_src_name = "prcm_fck"; | 79 | fck_src_name = "prcm_fck"; |
77 | else | 80 | else |
78 | return -EINVAL; | 81 | return -EINVAL; |
79 | 82 | ||
80 | fck_src = clk_get(mcbsp->dev, fck_src_name); | 83 | fck_src = clk_get(dev, fck_src_name); |
81 | if (IS_ERR_OR_NULL(fck_src)) { | 84 | if (IS_ERR_OR_NULL(fck_src)) { |
82 | pr_err("omap-mcbsp: %s: could not clk_get() %s\n", "clks", | 85 | pr_err("omap-mcbsp: %s: could not clk_get() %s\n", "clks", |
83 | fck_src_name); | 86 | fck_src_name); |
84 | return -EINVAL; | 87 | return -EINVAL; |
85 | } | 88 | } |
86 | 89 | ||
87 | pm_runtime_put_sync(mcbsp->dev); | 90 | pm_runtime_put_sync(dev); |
88 | 91 | ||
89 | r = clk_set_parent(mcbsp->fclk, fck_src); | 92 | r = clk_set_parent(clk, fck_src); |
90 | if (IS_ERR_VALUE(r)) { | 93 | if (IS_ERR_VALUE(r)) { |
91 | pr_err("omap-mcbsp: %s: could not clk_set_parent() to %s\n", | 94 | pr_err("omap-mcbsp: %s: could not clk_set_parent() to %s\n", |
92 | "clks", fck_src_name); | 95 | "clks", fck_src_name); |
@@ -94,13 +97,30 @@ int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id) | |||
94 | return -EINVAL; | 97 | return -EINVAL; |
95 | } | 98 | } |
96 | 99 | ||
97 | pm_runtime_get_sync(mcbsp->dev); | 100 | pm_runtime_get_sync(dev); |
98 | 101 | ||
99 | clk_put(fck_src); | 102 | clk_put(fck_src); |
100 | 103 | ||
101 | return 0; | 104 | return 0; |
102 | } | 105 | } |
103 | EXPORT_SYMBOL(omap2_mcbsp_set_clks_src); | 106 | |
107 | static int omap3_enable_st_clock(unsigned int id, bool enable) | ||
108 | { | ||
109 | unsigned int w; | ||
110 | |||
111 | /* | ||
112 | * Sidetone uses McBSP ICLK - which must not idle when sidetones | ||
113 | * are enabled or sidetones start sounding ugly. | ||
114 | */ | ||
115 | w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE); | ||
116 | if (enable) | ||
117 | w &= ~(1 << (id - 2)); | ||
118 | else | ||
119 | w |= 1 << (id - 2); | ||
120 | omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE); | ||
121 | |||
122 | return 0; | ||
123 | } | ||
104 | 124 | ||
105 | struct omap_device_pm_latency omap2_mcbsp_latency[] = { | 125 | struct omap_device_pm_latency omap2_mcbsp_latency[] = { |
106 | { | 126 | { |
@@ -116,7 +136,7 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused) | |||
116 | char *name = "omap-mcbsp"; | 136 | char *name = "omap-mcbsp"; |
117 | struct omap_hwmod *oh_device[2]; | 137 | struct omap_hwmod *oh_device[2]; |
118 | struct omap_mcbsp_platform_data *pdata = NULL; | 138 | struct omap_mcbsp_platform_data *pdata = NULL; |
119 | struct omap_device *od; | 139 | struct platform_device *pdev; |
120 | 140 | ||
121 | sscanf(oh->name, "mcbsp%d", &id); | 141 | sscanf(oh->name, "mcbsp%d", &id); |
122 | 142 | ||
@@ -126,7 +146,13 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused) | |||
126 | return -ENOMEM; | 146 | return -ENOMEM; |
127 | } | 147 | } |
128 | 148 | ||
129 | pdata->mcbsp_config_type = oh->class->rev; | 149 | pdata->reg_step = 4; |
150 | if (oh->class->rev < MCBSP_CONFIG_TYPE2) { | ||
151 | pdata->reg_size = 2; | ||
152 | } else { | ||
153 | pdata->reg_size = 4; | ||
154 | pdata->has_ccr = true; | ||
155 | } | ||
130 | 156 | ||
131 | if (oh->class->rev == MCBSP_CONFIG_TYPE3) { | 157 | if (oh->class->rev == MCBSP_CONFIG_TYPE3) { |
132 | if (id == 2) | 158 | if (id == 2) |
@@ -137,22 +163,29 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused) | |||
137 | pdata->buffer_size = 0x80; | 163 | pdata->buffer_size = 0x80; |
138 | } | 164 | } |
139 | 165 | ||
166 | if (oh->class->rev >= MCBSP_CONFIG_TYPE3) | ||
167 | pdata->has_wakeup = true; | ||
168 | |||
140 | oh_device[0] = oh; | 169 | oh_device[0] = oh; |
141 | 170 | ||
142 | if (oh->dev_attr) { | 171 | if (oh->dev_attr) { |
143 | oh_device[1] = omap_hwmod_lookup(( | 172 | oh_device[1] = omap_hwmod_lookup(( |
144 | (struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone); | 173 | (struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone); |
174 | pdata->enable_st_clock = omap3_enable_st_clock; | ||
145 | count++; | 175 | count++; |
146 | } | 176 | } |
147 | od = omap_device_build_ss(name, id, oh_device, count, pdata, | 177 | pdev = omap_device_build_ss(name, id, oh_device, count, pdata, |
148 | sizeof(*pdata), omap2_mcbsp_latency, | 178 | sizeof(*pdata), omap2_mcbsp_latency, |
149 | ARRAY_SIZE(omap2_mcbsp_latency), false); | 179 | ARRAY_SIZE(omap2_mcbsp_latency), false); |
150 | kfree(pdata); | 180 | kfree(pdata); |
151 | if (IS_ERR(od)) { | 181 | if (IS_ERR(pdev)) { |
152 | pr_err("%s: Can't build omap_device for %s:%s.\n", __func__, | 182 | pr_err("%s: Can't build omap_device for %s:%s.\n", __func__, |
153 | name, oh->name); | 183 | name, oh->name); |
154 | return PTR_ERR(od); | 184 | return PTR_ERR(pdev); |
155 | } | 185 | } |
186 | pdata->set_clk_src = omap2_mcbsp_set_clk_src; | ||
187 | if (id == 1) | ||
188 | pdata->mux_signal = omap2_mcbsp1_mux_rx_clk; | ||
156 | omap_mcbsp_count++; | 189 | omap_mcbsp_count++; |
157 | return 0; | 190 | return 0; |
158 | } | 191 | } |
diff --git a/arch/arm/mach-omap2/opp.c b/arch/arm/mach-omap2/opp.c index ab8b35b780b5..9262a6b47702 100644 --- a/arch/arm/mach-omap2/opp.c +++ b/arch/arm/mach-omap2/opp.c | |||
@@ -69,7 +69,7 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def, | |||
69 | opp_def->hwmod_name, i); | 69 | opp_def->hwmod_name, i); |
70 | return -EINVAL; | 70 | return -EINVAL; |
71 | } | 71 | } |
72 | dev = &oh->od->pdev.dev; | 72 | dev = &oh->od->pdev->dev; |
73 | 73 | ||
74 | r = opp_add(dev, opp_def->freq, opp_def->u_volt); | 74 | r = opp_add(dev, opp_def->freq, opp_def->u_volt); |
75 | if (r) { | 75 | if (r) { |
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index 472bf22d5e84..25b8c7f43852 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c | |||
@@ -60,19 +60,19 @@ EXPORT_SYMBOL(omap4_get_dsp_device); | |||
60 | static int _init_omap_device(char *name, struct device **new_dev) | 60 | static int _init_omap_device(char *name, struct device **new_dev) |
61 | { | 61 | { |
62 | struct omap_hwmod *oh; | 62 | struct omap_hwmod *oh; |
63 | struct omap_device *od; | 63 | struct platform_device *pdev; |
64 | 64 | ||
65 | oh = omap_hwmod_lookup(name); | 65 | oh = omap_hwmod_lookup(name); |
66 | if (WARN(!oh, "%s: could not find omap_hwmod for %s\n", | 66 | if (WARN(!oh, "%s: could not find omap_hwmod for %s\n", |
67 | __func__, name)) | 67 | __func__, name)) |
68 | return -ENODEV; | 68 | return -ENODEV; |
69 | 69 | ||
70 | od = omap_device_build(oh->name, 0, oh, NULL, 0, pm_lats, 0, false); | 70 | pdev = omap_device_build(oh->name, 0, oh, NULL, 0, pm_lats, 0, false); |
71 | if (WARN(IS_ERR(od), "%s: could not build omap_device for %s\n", | 71 | if (WARN(IS_ERR(pdev), "%s: could not build omap_device for %s\n", |
72 | __func__, name)) | 72 | __func__, name)) |
73 | return -ENODEV; | 73 | return -ENODEV; |
74 | 74 | ||
75 | *new_dev = &od->pdev.dev; | 75 | *new_dev = &pdev->dev; |
76 | 76 | ||
77 | return 0; | 77 | return 0; |
78 | } | 78 | } |
@@ -136,8 +136,8 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state) | |||
136 | 136 | ||
137 | ret = pwrdm_set_next_pwrst(pwrdm, state); | 137 | ret = pwrdm_set_next_pwrst(pwrdm, state); |
138 | if (ret) { | 138 | if (ret) { |
139 | printk(KERN_ERR "Unable to set state of powerdomain: %s\n", | 139 | pr_err("%s: unable to set state of powerdomain: %s\n", |
140 | pwrdm->name); | 140 | __func__, pwrdm->name); |
141 | goto err; | 141 | goto err; |
142 | } | 142 | } |
143 | 143 | ||
@@ -161,11 +161,11 @@ err: | |||
161 | } | 161 | } |
162 | 162 | ||
163 | /* | 163 | /* |
164 | * This API is to be called during init to put the various voltage | 164 | * This API is to be called during init to set the various voltage |
165 | * domains to the voltage as per the opp table. Typically we boot up | 165 | * domains to the voltage as per the opp table. Typically we boot up |
166 | * at the nominal voltage. So this function finds out the rate of | 166 | * at the nominal voltage. So this function finds out the rate of |
167 | * the clock associated with the voltage domain, finds out the correct | 167 | * the clock associated with the voltage domain, finds out the correct |
168 | * opp entry and puts the voltage domain to the voltage specifies | 168 | * opp entry and sets the voltage domain to the voltage specified |
169 | * in the opp entry | 169 | * in the opp entry |
170 | */ | 170 | */ |
171 | static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, | 171 | static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, |
@@ -177,21 +177,20 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, | |||
177 | unsigned long freq, bootup_volt; | 177 | unsigned long freq, bootup_volt; |
178 | 178 | ||
179 | if (!vdd_name || !clk_name || !dev) { | 179 | if (!vdd_name || !clk_name || !dev) { |
180 | printk(KERN_ERR "%s: Invalid parameters!\n", __func__); | 180 | pr_err("%s: invalid parameters\n", __func__); |
181 | goto exit; | 181 | goto exit; |
182 | } | 182 | } |
183 | 183 | ||
184 | voltdm = omap_voltage_domain_lookup(vdd_name); | 184 | voltdm = omap_voltage_domain_lookup(vdd_name); |
185 | if (IS_ERR(voltdm)) { | 185 | if (IS_ERR(voltdm)) { |
186 | printk(KERN_ERR "%s: Unable to get vdd pointer for vdd_%s\n", | 186 | pr_err("%s: unable to get vdd pointer for vdd_%s\n", |
187 | __func__, vdd_name); | 187 | __func__, vdd_name); |
188 | goto exit; | 188 | goto exit; |
189 | } | 189 | } |
190 | 190 | ||
191 | clk = clk_get(NULL, clk_name); | 191 | clk = clk_get(NULL, clk_name); |
192 | if (IS_ERR(clk)) { | 192 | if (IS_ERR(clk)) { |
193 | printk(KERN_ERR "%s: unable to get clk %s\n", | 193 | pr_err("%s: unable to get clk %s\n", __func__, clk_name); |
194 | __func__, clk_name); | ||
195 | goto exit; | 194 | goto exit; |
196 | } | 195 | } |
197 | 196 | ||
@@ -200,14 +199,14 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, | |||
200 | 199 | ||
201 | opp = opp_find_freq_ceil(dev, &freq); | 200 | opp = opp_find_freq_ceil(dev, &freq); |
202 | if (IS_ERR(opp)) { | 201 | if (IS_ERR(opp)) { |
203 | printk(KERN_ERR "%s: unable to find boot up OPP for vdd_%s\n", | 202 | pr_err("%s: unable to find boot up OPP for vdd_%s\n", |
204 | __func__, vdd_name); | 203 | __func__, vdd_name); |
205 | goto exit; | 204 | goto exit; |
206 | } | 205 | } |
207 | 206 | ||
208 | bootup_volt = opp_get_voltage(opp); | 207 | bootup_volt = opp_get_voltage(opp); |
209 | if (!bootup_volt) { | 208 | if (!bootup_volt) { |
210 | printk(KERN_ERR "%s: unable to find voltage corresponding" | 209 | pr_err("%s: unable to find voltage corresponding " |
211 | "to the bootup OPP for vdd_%s\n", __func__, vdd_name); | 210 | "to the bootup OPP for vdd_%s\n", __func__, vdd_name); |
212 | goto exit; | 211 | goto exit; |
213 | } | 212 | } |
@@ -216,8 +215,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, | |||
216 | return 0; | 215 | return 0; |
217 | 216 | ||
218 | exit: | 217 | exit: |
219 | printk(KERN_ERR "%s: Unable to put vdd_%s to its init voltage\n\n", | 218 | pr_err("%s: unable to set vdd_%s\n", __func__, vdd_name); |
220 | __func__, vdd_name); | ||
221 | return -EINVAL; | 219 | return -EINVAL; |
222 | } | 220 | } |
223 | 221 | ||
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c index bf089e743ed9..cf0c216132ab 100644 --- a/arch/arm/mach-omap2/pm24xx.c +++ b/arch/arm/mach-omap2/pm24xx.c | |||
@@ -53,8 +53,6 @@ | |||
53 | #include "powerdomain.h" | 53 | #include "powerdomain.h" |
54 | #include "clockdomain.h" | 54 | #include "clockdomain.h" |
55 | 55 | ||
56 | static int omap2_pm_debug; | ||
57 | |||
58 | #ifdef CONFIG_SUSPEND | 56 | #ifdef CONFIG_SUSPEND |
59 | static suspend_state_t suspend_state = PM_SUSPEND_ON; | 57 | static suspend_state_t suspend_state = PM_SUSPEND_ON; |
60 | static inline bool is_suspending(void) | 58 | static inline bool is_suspending(void) |
@@ -96,7 +94,6 @@ static int omap2_fclks_active(void) | |||
96 | static void omap2_enter_full_retention(void) | 94 | static void omap2_enter_full_retention(void) |
97 | { | 95 | { |
98 | u32 l; | 96 | u32 l; |
99 | struct timespec ts_preidle, ts_postidle, ts_idle; | ||
100 | 97 | ||
101 | /* There is 1 reference hold for all children of the oscillator | 98 | /* There is 1 reference hold for all children of the oscillator |
102 | * clock, the following will remove it. If no one else uses the | 99 | * clock, the following will remove it. If no one else uses the |
@@ -124,10 +121,6 @@ static void omap2_enter_full_retention(void) | |||
124 | 121 | ||
125 | omap2_gpio_prepare_for_idle(0); | 122 | omap2_gpio_prepare_for_idle(0); |
126 | 123 | ||
127 | if (omap2_pm_debug) { | ||
128 | getnstimeofday(&ts_preidle); | ||
129 | } | ||
130 | |||
131 | /* One last check for pending IRQs to avoid extra latency due | 124 | /* One last check for pending IRQs to avoid extra latency due |
132 | * to sleeping unnecessarily. */ | 125 | * to sleeping unnecessarily. */ |
133 | if (omap_irq_pending()) | 126 | if (omap_irq_pending()) |
@@ -155,13 +148,6 @@ static void omap2_enter_full_retention(void) | |||
155 | console_unlock(); | 148 | console_unlock(); |
156 | 149 | ||
157 | no_sleep: | 150 | no_sleep: |
158 | if (omap2_pm_debug) { | ||
159 | unsigned long long tmp; | ||
160 | |||
161 | getnstimeofday(&ts_postidle); | ||
162 | ts_idle = timespec_sub(ts_postidle, ts_preidle); | ||
163 | tmp = timespec_to_ns(&ts_idle) * NSEC_PER_USEC; | ||
164 | } | ||
165 | omap2_gpio_resume_after_idle(); | 151 | omap2_gpio_resume_after_idle(); |
166 | 152 | ||
167 | clk_enable(osc_ck); | 153 | clk_enable(osc_ck); |
@@ -219,7 +205,6 @@ static int omap2_allow_mpu_retention(void) | |||
219 | static void omap2_enter_mpu_retention(void) | 205 | static void omap2_enter_mpu_retention(void) |
220 | { | 206 | { |
221 | int only_idle = 0; | 207 | int only_idle = 0; |
222 | struct timespec ts_preidle, ts_postidle, ts_idle; | ||
223 | 208 | ||
224 | /* Putting MPU into the WFI state while a transfer is active | 209 | /* Putting MPU into the WFI state while a transfer is active |
225 | * seems to cause the I2C block to timeout. Why? Good question. */ | 210 | * seems to cause the I2C block to timeout. Why? Good question. */ |
@@ -246,19 +231,7 @@ static void omap2_enter_mpu_retention(void) | |||
246 | only_idle = 1; | 231 | only_idle = 1; |
247 | } | 232 | } |
248 | 233 | ||
249 | if (omap2_pm_debug) { | ||
250 | getnstimeofday(&ts_preidle); | ||
251 | } | ||
252 | |||
253 | omap2_sram_idle(); | 234 | omap2_sram_idle(); |
254 | |||
255 | if (omap2_pm_debug) { | ||
256 | unsigned long long tmp; | ||
257 | |||
258 | getnstimeofday(&ts_postidle); | ||
259 | ts_idle = timespec_sub(ts_postidle, ts_preidle); | ||
260 | tmp = timespec_to_ns(&ts_idle) * NSEC_PER_USEC; | ||
261 | } | ||
262 | } | 235 | } |
263 | 236 | ||
264 | static int omap2_can_sleep(void) | 237 | static int omap2_can_sleep(void) |
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 7255d9bce868..c8cbd00a41af 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -55,7 +55,7 @@ | |||
55 | static suspend_state_t suspend_state = PM_SUSPEND_ON; | 55 | static suspend_state_t suspend_state = PM_SUSPEND_ON; |
56 | static inline bool is_suspending(void) | 56 | static inline bool is_suspending(void) |
57 | { | 57 | { |
58 | return (suspend_state != PM_SUSPEND_ON); | 58 | return (suspend_state != PM_SUSPEND_ON) && console_suspend_enabled; |
59 | } | 59 | } |
60 | #else | 60 | #else |
61 | static inline bool is_suspending(void) | 61 | static inline bool is_suspending(void) |
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 466fc722fa0f..3d1c1d393f8f 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
@@ -711,7 +711,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata) | |||
711 | { | 711 | { |
712 | struct omap_uart_state *uart; | 712 | struct omap_uart_state *uart; |
713 | struct omap_hwmod *oh; | 713 | struct omap_hwmod *oh; |
714 | struct omap_device *od; | 714 | struct platform_device *pdev; |
715 | void *pdata = NULL; | 715 | void *pdata = NULL; |
716 | u32 pdata_size = 0; | 716 | u32 pdata_size = 0; |
717 | char *name; | 717 | char *name; |
@@ -799,20 +799,20 @@ void __init omap_serial_init_port(struct omap_board_data *bdata) | |||
799 | if (WARN_ON(!oh)) | 799 | if (WARN_ON(!oh)) |
800 | return; | 800 | return; |
801 | 801 | ||
802 | od = omap_device_build(name, uart->num, oh, pdata, pdata_size, | 802 | pdev = omap_device_build(name, uart->num, oh, pdata, pdata_size, |
803 | omap_uart_latency, | 803 | omap_uart_latency, |
804 | ARRAY_SIZE(omap_uart_latency), false); | 804 | ARRAY_SIZE(omap_uart_latency), false); |
805 | WARN(IS_ERR(od), "Could not build omap_device for %s: %s.\n", | 805 | WARN(IS_ERR(pdev), "Could not build omap_device for %s: %s.\n", |
806 | name, oh->name); | 806 | name, oh->name); |
807 | 807 | ||
808 | omap_device_disable_idle_on_suspend(od); | 808 | omap_device_disable_idle_on_suspend(pdev); |
809 | oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); | 809 | oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); |
810 | 810 | ||
811 | uart->irq = oh->mpu_irqs[0].irq; | 811 | uart->irq = oh->mpu_irqs[0].irq; |
812 | uart->regshift = 2; | 812 | uart->regshift = 2; |
813 | uart->mapbase = oh->slaves[0]->addr->pa_start; | 813 | uart->mapbase = oh->slaves[0]->addr->pa_start; |
814 | uart->membase = omap_hwmod_get_mpu_rt_va(oh); | 814 | uart->membase = omap_hwmod_get_mpu_rt_va(oh); |
815 | uart->pdev = &od->pdev; | 815 | uart->pdev = pdev; |
816 | 816 | ||
817 | oh->dev_attr = uart; | 817 | oh->dev_attr = uart; |
818 | 818 | ||
@@ -846,8 +846,8 @@ void __init omap_serial_init_port(struct omap_board_data *bdata) | |||
846 | 846 | ||
847 | if ((cpu_is_omap34xx() && uart->padconf) || | 847 | if ((cpu_is_omap34xx() && uart->padconf) || |
848 | (uart->wk_en && uart->wk_mask)) { | 848 | (uart->wk_en && uart->wk_mask)) { |
849 | device_init_wakeup(&od->pdev.dev, true); | 849 | device_init_wakeup(&pdev->dev, true); |
850 | DEV_CREATE_FILE(&od->pdev.dev, &dev_attr_sleep_timeout); | 850 | DEV_CREATE_FILE(&pdev->dev, &dev_attr_sleep_timeout); |
851 | } | 851 | } |
852 | 852 | ||
853 | /* Enable the MDR1 errata for OMAP3 */ | 853 | /* Enable the MDR1 errata for OMAP3 */ |
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c index 10d3c5ee8018..624264d8e1a5 100644 --- a/arch/arm/mach-omap2/sr_device.c +++ b/arch/arm/mach-omap2/sr_device.c | |||
@@ -80,7 +80,7 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data, | |||
80 | static int sr_dev_init(struct omap_hwmod *oh, void *user) | 80 | static int sr_dev_init(struct omap_hwmod *oh, void *user) |
81 | { | 81 | { |
82 | struct omap_sr_data *sr_data; | 82 | struct omap_sr_data *sr_data; |
83 | struct omap_device *od; | 83 | struct platform_device *pdev; |
84 | struct omap_volt_data *volt_data; | 84 | struct omap_volt_data *volt_data; |
85 | char *name = "smartreflex"; | 85 | char *name = "smartreflex"; |
86 | static int i; | 86 | static int i; |
@@ -120,10 +120,10 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user) | |||
120 | 120 | ||
121 | sr_data->enable_on_init = sr_enable_on_init; | 121 | sr_data->enable_on_init = sr_enable_on_init; |
122 | 122 | ||
123 | od = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data), | 123 | pdev = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data), |
124 | omap_sr_latency, | 124 | omap_sr_latency, |
125 | ARRAY_SIZE(omap_sr_latency), 0); | 125 | ARRAY_SIZE(omap_sr_latency), 0); |
126 | if (IS_ERR(od)) | 126 | if (IS_ERR(pdev)) |
127 | pr_warning("%s: Could not build omap_device for %s: %s.\n\n", | 127 | pr_warning("%s: Could not build omap_device for %s: %s.\n\n", |
128 | __func__, name, oh->name); | 128 | __func__, name, oh->name); |
129 | exit: | 129 | exit: |
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c index ea28f98d5d6a..bd9a06b3ee89 100644 --- a/arch/arm/plat-omap/devices.c +++ b/arch/arm/plat-omap/devices.c | |||
@@ -26,54 +26,8 @@ | |||
26 | #include <plat/mmc.h> | 26 | #include <plat/mmc.h> |
27 | #include <mach/gpio.h> | 27 | #include <mach/gpio.h> |
28 | #include <plat/menelaus.h> | 28 | #include <plat/menelaus.h> |
29 | #include <plat/mcbsp.h> | ||
30 | #include <plat/omap44xx.h> | 29 | #include <plat/omap44xx.h> |
31 | 30 | ||
32 | /*-------------------------------------------------------------------------*/ | ||
33 | |||
34 | #if defined(CONFIG_OMAP_MCBSP) || defined(CONFIG_OMAP_MCBSP_MODULE) | ||
35 | |||
36 | static struct platform_device **omap_mcbsp_devices; | ||
37 | |||
38 | void omap_mcbsp_register_board_cfg(struct resource *res, int res_count, | ||
39 | struct omap_mcbsp_platform_data *config, int size) | ||
40 | { | ||
41 | int i; | ||
42 | |||
43 | omap_mcbsp_devices = kzalloc(size * sizeof(struct platform_device *), | ||
44 | GFP_KERNEL); | ||
45 | if (!omap_mcbsp_devices) { | ||
46 | printk(KERN_ERR "Could not register McBSP devices\n"); | ||
47 | return; | ||
48 | } | ||
49 | |||
50 | for (i = 0; i < size; i++) { | ||
51 | struct platform_device *new_mcbsp; | ||
52 | int ret; | ||
53 | |||
54 | new_mcbsp = platform_device_alloc("omap-mcbsp", i + 1); | ||
55 | if (!new_mcbsp) | ||
56 | continue; | ||
57 | platform_device_add_resources(new_mcbsp, &res[i * res_count], | ||
58 | res_count); | ||
59 | new_mcbsp->dev.platform_data = &config[i]; | ||
60 | ret = platform_device_add(new_mcbsp); | ||
61 | if (ret) { | ||
62 | platform_device_put(new_mcbsp); | ||
63 | continue; | ||
64 | } | ||
65 | omap_mcbsp_devices[i] = new_mcbsp; | ||
66 | } | ||
67 | } | ||
68 | |||
69 | #else | ||
70 | void omap_mcbsp_register_board_cfg(struct resource *res, int res_count, | ||
71 | struct omap_mcbsp_platform_data *config, int size) | ||
72 | { } | ||
73 | #endif | ||
74 | |||
75 | /*-------------------------------------------------------------------------*/ | ||
76 | |||
77 | #if defined(CONFIG_SND_OMAP_SOC_MCPDM) || \ | 31 | #if defined(CONFIG_SND_OMAP_SOC_MCPDM) || \ |
78 | defined(CONFIG_SND_OMAP_SOC_MCPDM_MODULE) | 32 | defined(CONFIG_SND_OMAP_SOC_MCPDM_MODULE) |
79 | 33 | ||
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c index 3341ca4703e9..0c7caf2458b4 100644 --- a/arch/arm/plat-omap/i2c.c +++ b/arch/arm/plat-omap/i2c.c | |||
@@ -135,7 +135,7 @@ static inline int omap2_i2c_add_bus(int bus_id) | |||
135 | { | 135 | { |
136 | int l; | 136 | int l; |
137 | struct omap_hwmod *oh; | 137 | struct omap_hwmod *oh; |
138 | struct omap_device *od; | 138 | struct platform_device *pdev; |
139 | char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN]; | 139 | char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN]; |
140 | struct omap_i2c_bus_platform_data *pdata; | 140 | struct omap_i2c_bus_platform_data *pdata; |
141 | 141 | ||
@@ -160,12 +160,12 @@ static inline int omap2_i2c_add_bus(int bus_id) | |||
160 | */ | 160 | */ |
161 | if (cpu_is_omap34xx()) | 161 | if (cpu_is_omap34xx()) |
162 | pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat; | 162 | pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat; |
163 | od = omap_device_build(name, bus_id, oh, pdata, | 163 | pdev = omap_device_build(name, bus_id, oh, pdata, |
164 | sizeof(struct omap_i2c_bus_platform_data), | 164 | sizeof(struct omap_i2c_bus_platform_data), |
165 | omap_i2c_latency, ARRAY_SIZE(omap_i2c_latency), 0); | 165 | omap_i2c_latency, ARRAY_SIZE(omap_i2c_latency), 0); |
166 | WARN(IS_ERR(od), "Could not build omap_device for %s\n", name); | 166 | WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name); |
167 | 167 | ||
168 | return PTR_ERR(od); | 168 | return PTR_ERR(pdev); |
169 | } | 169 | } |
170 | #else | 170 | #else |
171 | static inline int omap2_i2c_add_bus(int bus_id) | 171 | static inline int omap2_i2c_add_bus(int bus_id) |
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h index 5cac97e36079..abda2c7e499b 100644 --- a/arch/arm/plat-omap/include/plat/common.h +++ b/arch/arm/plat-omap/include/plat/common.h | |||
@@ -83,7 +83,11 @@ void omap2_set_globals_sdrc(struct omap_globals *); | |||
83 | void omap2_set_globals_control(struct omap_globals *); | 83 | void omap2_set_globals_control(struct omap_globals *); |
84 | void omap2_set_globals_prcm(struct omap_globals *); | 84 | void omap2_set_globals_prcm(struct omap_globals *); |
85 | 85 | ||
86 | void omap242x_map_io(void); | ||
87 | void omap243x_map_io(void); | ||
86 | void omap3_map_io(void); | 88 | void omap3_map_io(void); |
89 | void omap4_map_io(void); | ||
90 | |||
87 | 91 | ||
88 | /** | 92 | /** |
89 | * omap_test_timeout - busy-loop, testing a condition | 93 | * omap_test_timeout - busy-loop, testing a condition |
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h index 9882c657b2d4..8fa74e2c9d6e 100644 --- a/arch/arm/plat-omap/include/plat/mcbsp.h +++ b/arch/arm/plat-omap/include/plat/mcbsp.h | |||
@@ -25,9 +25,7 @@ | |||
25 | #define __ASM_ARCH_OMAP_MCBSP_H | 25 | #define __ASM_ARCH_OMAP_MCBSP_H |
26 | 26 | ||
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | 28 | #include <linux/clk.h> | |
29 | #include <mach/hardware.h> | ||
30 | #include <plat/clock.h> | ||
31 | 29 | ||
32 | /* macro for building platform_device for McBSP ports */ | 30 | /* macro for building platform_device for McBSP ports */ |
33 | #define OMAP_MCBSP_PLATFORM_DEVICE(port_nr) \ | 31 | #define OMAP_MCBSP_PLATFORM_DEVICE(port_nr) \ |
@@ -40,104 +38,60 @@ static struct platform_device omap_mcbsp##port_nr = { \ | |||
40 | #define MCBSP_CONFIG_TYPE3 0x3 | 38 | #define MCBSP_CONFIG_TYPE3 0x3 |
41 | #define MCBSP_CONFIG_TYPE4 0x4 | 39 | #define MCBSP_CONFIG_TYPE4 0x4 |
42 | 40 | ||
43 | #define OMAP7XX_MCBSP1_BASE 0xfffb1000 | 41 | /* McBSP register numbers. Register address offset = num * reg_step */ |
44 | #define OMAP7XX_MCBSP2_BASE 0xfffb1800 | 42 | enum { |
45 | 43 | /* Common registers */ | |
46 | #define OMAP1510_MCBSP1_BASE 0xe1011800 | 44 | OMAP_MCBSP_REG_SPCR2 = 4, |
47 | #define OMAP1510_MCBSP2_BASE 0xfffb1000 | 45 | OMAP_MCBSP_REG_SPCR1, |
48 | #define OMAP1510_MCBSP3_BASE 0xe1017000 | 46 | OMAP_MCBSP_REG_RCR2, |
49 | 47 | OMAP_MCBSP_REG_RCR1, | |
50 | #define OMAP1610_MCBSP1_BASE 0xe1011800 | 48 | OMAP_MCBSP_REG_XCR2, |
51 | #define OMAP1610_MCBSP2_BASE 0xfffb1000 | 49 | OMAP_MCBSP_REG_XCR1, |
52 | #define OMAP1610_MCBSP3_BASE 0xe1017000 | 50 | OMAP_MCBSP_REG_SRGR2, |
53 | 51 | OMAP_MCBSP_REG_SRGR1, | |
54 | #ifdef CONFIG_ARCH_OMAP1 | 52 | OMAP_MCBSP_REG_MCR2, |
55 | 53 | OMAP_MCBSP_REG_MCR1, | |
56 | #define OMAP_MCBSP_REG_DRR2 0x00 | 54 | OMAP_MCBSP_REG_RCERA, |
57 | #define OMAP_MCBSP_REG_DRR1 0x02 | 55 | OMAP_MCBSP_REG_RCERB, |
58 | #define OMAP_MCBSP_REG_DXR2 0x04 | 56 | OMAP_MCBSP_REG_XCERA, |
59 | #define OMAP_MCBSP_REG_DXR1 0x06 | 57 | OMAP_MCBSP_REG_XCERB, |
60 | #define OMAP_MCBSP_REG_DRR 0x02 | 58 | OMAP_MCBSP_REG_PCR0, |
61 | #define OMAP_MCBSP_REG_DXR 0x06 | 59 | OMAP_MCBSP_REG_RCERC, |
62 | #define OMAP_MCBSP_REG_SPCR2 0x08 | 60 | OMAP_MCBSP_REG_RCERD, |
63 | #define OMAP_MCBSP_REG_SPCR1 0x0a | 61 | OMAP_MCBSP_REG_XCERC, |
64 | #define OMAP_MCBSP_REG_RCR2 0x0c | 62 | OMAP_MCBSP_REG_XCERD, |
65 | #define OMAP_MCBSP_REG_RCR1 0x0e | 63 | OMAP_MCBSP_REG_RCERE, |
66 | #define OMAP_MCBSP_REG_XCR2 0x10 | 64 | OMAP_MCBSP_REG_RCERF, |
67 | #define OMAP_MCBSP_REG_XCR1 0x12 | 65 | OMAP_MCBSP_REG_XCERE, |
68 | #define OMAP_MCBSP_REG_SRGR2 0x14 | 66 | OMAP_MCBSP_REG_XCERF, |
69 | #define OMAP_MCBSP_REG_SRGR1 0x16 | 67 | OMAP_MCBSP_REG_RCERG, |
70 | #define OMAP_MCBSP_REG_MCR2 0x18 | 68 | OMAP_MCBSP_REG_RCERH, |
71 | #define OMAP_MCBSP_REG_MCR1 0x1a | 69 | OMAP_MCBSP_REG_XCERG, |
72 | #define OMAP_MCBSP_REG_RCERA 0x1c | 70 | OMAP_MCBSP_REG_XCERH, |
73 | #define OMAP_MCBSP_REG_RCERB 0x1e | 71 | |
74 | #define OMAP_MCBSP_REG_XCERA 0x20 | 72 | /* OMAP1-OMAP2420 registers */ |
75 | #define OMAP_MCBSP_REG_XCERB 0x22 | 73 | OMAP_MCBSP_REG_DRR2 = 0, |
76 | #define OMAP_MCBSP_REG_PCR0 0x24 | 74 | OMAP_MCBSP_REG_DRR1, |
77 | #define OMAP_MCBSP_REG_RCERC 0x26 | 75 | OMAP_MCBSP_REG_DXR2, |
78 | #define OMAP_MCBSP_REG_RCERD 0x28 | 76 | OMAP_MCBSP_REG_DXR1, |
79 | #define OMAP_MCBSP_REG_XCERC 0x2A | 77 | |
80 | #define OMAP_MCBSP_REG_XCERD 0x2C | 78 | /* OMAP2430 and onwards */ |
81 | #define OMAP_MCBSP_REG_RCERE 0x2E | 79 | OMAP_MCBSP_REG_DRR = 0, |
82 | #define OMAP_MCBSP_REG_RCERF 0x30 | 80 | OMAP_MCBSP_REG_DXR = 2, |
83 | #define OMAP_MCBSP_REG_XCERE 0x32 | 81 | OMAP_MCBSP_REG_SYSCON = 35, |
84 | #define OMAP_MCBSP_REG_XCERF 0x34 | 82 | OMAP_MCBSP_REG_THRSH2, |
85 | #define OMAP_MCBSP_REG_RCERG 0x36 | 83 | OMAP_MCBSP_REG_THRSH1, |
86 | #define OMAP_MCBSP_REG_RCERH 0x38 | 84 | OMAP_MCBSP_REG_IRQST = 40, |
87 | #define OMAP_MCBSP_REG_XCERG 0x3A | 85 | OMAP_MCBSP_REG_IRQEN, |
88 | #define OMAP_MCBSP_REG_XCERH 0x3C | 86 | OMAP_MCBSP_REG_WAKEUPEN, |
89 | 87 | OMAP_MCBSP_REG_XCCR, | |
90 | /* Dummy defines, these are not available on omap1 */ | 88 | OMAP_MCBSP_REG_RCCR, |
91 | #define OMAP_MCBSP_REG_XCCR 0x00 | 89 | OMAP_MCBSP_REG_XBUFFSTAT, |
92 | #define OMAP_MCBSP_REG_RCCR 0x00 | 90 | OMAP_MCBSP_REG_RBUFFSTAT, |
93 | 91 | OMAP_MCBSP_REG_SSELCR, | |
94 | #else | 92 | }; |
95 | |||
96 | #define OMAP_MCBSP_REG_DRR2 0x00 | ||
97 | #define OMAP_MCBSP_REG_DRR1 0x04 | ||
98 | #define OMAP_MCBSP_REG_DXR2 0x08 | ||
99 | #define OMAP_MCBSP_REG_DXR1 0x0C | ||
100 | #define OMAP_MCBSP_REG_DRR 0x00 | ||
101 | #define OMAP_MCBSP_REG_DXR 0x08 | ||
102 | #define OMAP_MCBSP_REG_SPCR2 0x10 | ||
103 | #define OMAP_MCBSP_REG_SPCR1 0x14 | ||
104 | #define OMAP_MCBSP_REG_RCR2 0x18 | ||
105 | #define OMAP_MCBSP_REG_RCR1 0x1C | ||
106 | #define OMAP_MCBSP_REG_XCR2 0x20 | ||
107 | #define OMAP_MCBSP_REG_XCR1 0x24 | ||
108 | #define OMAP_MCBSP_REG_SRGR2 0x28 | ||
109 | #define OMAP_MCBSP_REG_SRGR1 0x2C | ||
110 | #define OMAP_MCBSP_REG_MCR2 0x30 | ||
111 | #define OMAP_MCBSP_REG_MCR1 0x34 | ||
112 | #define OMAP_MCBSP_REG_RCERA 0x38 | ||
113 | #define OMAP_MCBSP_REG_RCERB 0x3C | ||
114 | #define OMAP_MCBSP_REG_XCERA 0x40 | ||
115 | #define OMAP_MCBSP_REG_XCERB 0x44 | ||
116 | #define OMAP_MCBSP_REG_PCR0 0x48 | ||
117 | #define OMAP_MCBSP_REG_RCERC 0x4C | ||
118 | #define OMAP_MCBSP_REG_RCERD 0x50 | ||
119 | #define OMAP_MCBSP_REG_XCERC 0x54 | ||
120 | #define OMAP_MCBSP_REG_XCERD 0x58 | ||
121 | #define OMAP_MCBSP_REG_RCERE 0x5C | ||
122 | #define OMAP_MCBSP_REG_RCERF 0x60 | ||
123 | #define OMAP_MCBSP_REG_XCERE 0x64 | ||
124 | #define OMAP_MCBSP_REG_XCERF 0x68 | ||
125 | #define OMAP_MCBSP_REG_RCERG 0x6C | ||
126 | #define OMAP_MCBSP_REG_RCERH 0x70 | ||
127 | #define OMAP_MCBSP_REG_XCERG 0x74 | ||
128 | #define OMAP_MCBSP_REG_XCERH 0x78 | ||
129 | #define OMAP_MCBSP_REG_SYSCON 0x8C | ||
130 | #define OMAP_MCBSP_REG_THRSH2 0x90 | ||
131 | #define OMAP_MCBSP_REG_THRSH1 0x94 | ||
132 | #define OMAP_MCBSP_REG_IRQST 0xA0 | ||
133 | #define OMAP_MCBSP_REG_IRQEN 0xA4 | ||
134 | #define OMAP_MCBSP_REG_WAKEUPEN 0xA8 | ||
135 | #define OMAP_MCBSP_REG_XCCR 0xAC | ||
136 | #define OMAP_MCBSP_REG_RCCR 0xB0 | ||
137 | #define OMAP_MCBSP_REG_XBUFFSTAT 0xB4 | ||
138 | #define OMAP_MCBSP_REG_RBUFFSTAT 0xB8 | ||
139 | #define OMAP_MCBSP_REG_SSELCR 0xBC | ||
140 | 93 | ||
94 | /* OMAP3 sidetone control registers */ | ||
141 | #define OMAP_ST_REG_REV 0x00 | 95 | #define OMAP_ST_REG_REV 0x00 |
142 | #define OMAP_ST_REG_SYSCONFIG 0x10 | 96 | #define OMAP_ST_REG_SYSCONFIG 0x10 |
143 | #define OMAP_ST_REG_IRQSTATUS 0x18 | 97 | #define OMAP_ST_REG_IRQSTATUS 0x18 |
@@ -146,8 +100,6 @@ static struct platform_device omap_mcbsp##port_nr = { \ | |||
146 | #define OMAP_ST_REG_SFIRCR 0x28 | 100 | #define OMAP_ST_REG_SFIRCR 0x28 |
147 | #define OMAP_ST_REG_SSELCR 0x2C | 101 | #define OMAP_ST_REG_SSELCR 0x2C |
148 | 102 | ||
149 | #endif | ||
150 | |||
151 | /************************** McBSP SPCR1 bit definitions ***********************/ | 103 | /************************** McBSP SPCR1 bit definitions ***********************/ |
152 | #define RRST 0x0001 | 104 | #define RRST 0x0001 |
153 | #define RRDY 0x0002 | 105 | #define RRDY 0x0002 |
@@ -344,20 +296,20 @@ typedef enum { | |||
344 | struct omap_mcbsp_ops { | 296 | struct omap_mcbsp_ops { |
345 | void (*request)(unsigned int); | 297 | void (*request)(unsigned int); |
346 | void (*free)(unsigned int); | 298 | void (*free)(unsigned int); |
347 | int (*set_clks_src)(u8, u8); | ||
348 | }; | 299 | }; |
349 | 300 | ||
350 | struct omap_mcbsp_platform_data { | 301 | struct omap_mcbsp_platform_data { |
351 | unsigned long phys_base; | ||
352 | u8 dma_rx_sync, dma_tx_sync; | ||
353 | u16 rx_irq, tx_irq; | ||
354 | struct omap_mcbsp_ops *ops; | 302 | struct omap_mcbsp_ops *ops; |
355 | #ifdef CONFIG_ARCH_OMAP3 | ||
356 | /* Sidetone block for McBSP 2 and 3 */ | ||
357 | unsigned long phys_base_st; | ||
358 | #endif | ||
359 | u16 buffer_size; | 303 | u16 buffer_size; |
360 | unsigned int mcbsp_config_type; | 304 | u8 reg_size; |
305 | u8 reg_step; | ||
306 | |||
307 | /* McBSP platform and instance specific features */ | ||
308 | bool has_wakeup; /* Wakeup capability */ | ||
309 | bool has_ccr; /* Transceiver has configuration control registers */ | ||
310 | int (*enable_st_clock)(unsigned int, bool); | ||
311 | int (*set_clk_src)(struct device *dev, struct clk *clk, const char *src); | ||
312 | int (*mux_signal)(struct device *dev, const char *signal, const char *src); | ||
361 | }; | 313 | }; |
362 | 314 | ||
363 | struct omap_mcbsp_st_data { | 315 | struct omap_mcbsp_st_data { |
@@ -389,14 +341,12 @@ struct omap_mcbsp { | |||
389 | spinlock_t lock; | 341 | spinlock_t lock; |
390 | struct omap_mcbsp_platform_data *pdata; | 342 | struct omap_mcbsp_platform_data *pdata; |
391 | struct clk *fclk; | 343 | struct clk *fclk; |
392 | #ifdef CONFIG_ARCH_OMAP3 | ||
393 | struct omap_mcbsp_st_data *st_data; | 344 | struct omap_mcbsp_st_data *st_data; |
394 | int dma_op_mode; | 345 | int dma_op_mode; |
395 | u16 max_tx_thres; | 346 | u16 max_tx_thres; |
396 | u16 max_rx_thres; | 347 | u16 max_rx_thres; |
397 | #endif | ||
398 | void *reg_cache; | 348 | void *reg_cache; |
399 | unsigned int mcbsp_config_type; | 349 | int reg_cache_size; |
400 | }; | 350 | }; |
401 | 351 | ||
402 | /** | 352 | /** |
@@ -408,16 +358,10 @@ struct omap_mcbsp_dev_attr { | |||
408 | }; | 358 | }; |
409 | 359 | ||
410 | extern struct omap_mcbsp **mcbsp_ptr; | 360 | extern struct omap_mcbsp **mcbsp_ptr; |
411 | extern int omap_mcbsp_count, omap_mcbsp_cache_size; | 361 | extern int omap_mcbsp_count; |
412 | |||
413 | #define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count) | ||
414 | #define id_to_mcbsp_ptr(id) mcbsp_ptr[id]; | ||
415 | 362 | ||
416 | int omap_mcbsp_init(void); | 363 | int omap_mcbsp_init(void); |
417 | void omap_mcbsp_register_board_cfg(struct resource *res, int res_count, | ||
418 | struct omap_mcbsp_platform_data *config, int size); | ||
419 | void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config); | 364 | void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config); |
420 | #ifdef CONFIG_ARCH_OMAP3 | ||
421 | void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold); | 365 | void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold); |
422 | void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold); | 366 | void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold); |
423 | u16 omap_mcbsp_get_max_tx_threshold(unsigned int id); | 367 | u16 omap_mcbsp_get_max_tx_threshold(unsigned int id); |
@@ -426,18 +370,6 @@ u16 omap_mcbsp_get_fifo_size(unsigned int id); | |||
426 | u16 omap_mcbsp_get_tx_delay(unsigned int id); | 370 | u16 omap_mcbsp_get_tx_delay(unsigned int id); |
427 | u16 omap_mcbsp_get_rx_delay(unsigned int id); | 371 | u16 omap_mcbsp_get_rx_delay(unsigned int id); |
428 | int omap_mcbsp_get_dma_op_mode(unsigned int id); | 372 | int omap_mcbsp_get_dma_op_mode(unsigned int id); |
429 | #else | ||
430 | static inline void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold) | ||
431 | { } | ||
432 | static inline void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold) | ||
433 | { } | ||
434 | static inline u16 omap_mcbsp_get_max_tx_threshold(unsigned int id) { return 0; } | ||
435 | static inline u16 omap_mcbsp_get_max_rx_threshold(unsigned int id) { return 0; } | ||
436 | static inline u16 omap_mcbsp_get_fifo_size(unsigned int id) { return 0; } | ||
437 | static inline u16 omap_mcbsp_get_tx_delay(unsigned int id) { return 0; } | ||
438 | static inline u16 omap_mcbsp_get_rx_delay(unsigned int id) { return 0; } | ||
439 | static inline int omap_mcbsp_get_dma_op_mode(unsigned int id) { return 0; } | ||
440 | #endif | ||
441 | int omap_mcbsp_request(unsigned int id); | 373 | int omap_mcbsp_request(unsigned int id); |
442 | void omap_mcbsp_free(unsigned int id); | 374 | void omap_mcbsp_free(unsigned int id); |
443 | void omap_mcbsp_start(unsigned int id, int tx, int rx); | 375 | void omap_mcbsp_start(unsigned int id, int tx, int rx); |
@@ -453,21 +385,11 @@ void omap2_mcbsp1_mux_fsr_src(u8 mux); | |||
453 | int omap_mcbsp_dma_ch_params(unsigned int id, unsigned int stream); | 385 | int omap_mcbsp_dma_ch_params(unsigned int id, unsigned int stream); |
454 | int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream); | 386 | int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream); |
455 | 387 | ||
456 | #ifdef CONFIG_ARCH_OMAP3 | ||
457 | /* Sidetone specific API */ | 388 | /* Sidetone specific API */ |
458 | int omap_st_set_chgain(unsigned int id, int channel, s16 chgain); | 389 | int omap_st_set_chgain(unsigned int id, int channel, s16 chgain); |
459 | int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain); | 390 | int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain); |
460 | int omap_st_enable(unsigned int id); | 391 | int omap_st_enable(unsigned int id); |
461 | int omap_st_disable(unsigned int id); | 392 | int omap_st_disable(unsigned int id); |
462 | int omap_st_is_enabled(unsigned int id); | 393 | int omap_st_is_enabled(unsigned int id); |
463 | #else | ||
464 | static inline int omap_st_set_chgain(unsigned int id, int channel, | ||
465 | s16 chgain) { return 0; } | ||
466 | static inline int omap_st_get_chgain(unsigned int id, int channel, | ||
467 | s16 *chgain) { return 0; } | ||
468 | static inline int omap_st_enable(unsigned int id) { return 0; } | ||
469 | static inline int omap_st_disable(unsigned int id) { return 0; } | ||
470 | static inline int omap_st_is_enabled(unsigned int id) { return 0; } | ||
471 | #endif | ||
472 | 394 | ||
473 | #endif | 395 | #endif |
diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h index ee405b36df4b..d4d9b96f961e 100644 --- a/arch/arm/plat-omap/include/plat/omap_device.h +++ b/arch/arm/plat-omap/include/plat/omap_device.h | |||
@@ -68,7 +68,7 @@ extern struct device omap_device_parent; | |||
68 | * | 68 | * |
69 | */ | 69 | */ |
70 | struct omap_device { | 70 | struct omap_device { |
71 | struct platform_device pdev; | 71 | struct platform_device *pdev; |
72 | struct omap_hwmod **hwmods; | 72 | struct omap_hwmod **hwmods; |
73 | struct omap_device_pm_latency *pm_lats; | 73 | struct omap_device_pm_latency *pm_lats; |
74 | u32 dev_wakeup_lat; | 74 | u32 dev_wakeup_lat; |
@@ -88,24 +88,18 @@ int omap_device_shutdown(struct platform_device *pdev); | |||
88 | 88 | ||
89 | /* Core code interface */ | 89 | /* Core code interface */ |
90 | 90 | ||
91 | int omap_device_count_resources(struct omap_device *od); | 91 | struct platform_device *omap_device_build(const char *pdev_name, int pdev_id, |
92 | int omap_device_fill_resources(struct omap_device *od, struct resource *res); | ||
93 | |||
94 | struct omap_device *omap_device_build(const char *pdev_name, int pdev_id, | ||
95 | struct omap_hwmod *oh, void *pdata, | 92 | struct omap_hwmod *oh, void *pdata, |
96 | int pdata_len, | 93 | int pdata_len, |
97 | struct omap_device_pm_latency *pm_lats, | 94 | struct omap_device_pm_latency *pm_lats, |
98 | int pm_lats_cnt, int is_early_device); | 95 | int pm_lats_cnt, int is_early_device); |
99 | 96 | ||
100 | struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, | 97 | struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id, |
101 | struct omap_hwmod **oh, int oh_cnt, | 98 | struct omap_hwmod **oh, int oh_cnt, |
102 | void *pdata, int pdata_len, | 99 | void *pdata, int pdata_len, |
103 | struct omap_device_pm_latency *pm_lats, | 100 | struct omap_device_pm_latency *pm_lats, |
104 | int pm_lats_cnt, int is_early_device); | 101 | int pm_lats_cnt, int is_early_device); |
105 | 102 | ||
106 | int omap_device_register(struct omap_device *od); | ||
107 | int omap_early_device_register(struct omap_device *od); | ||
108 | |||
109 | void __iomem *omap_device_get_rt_va(struct omap_device *od); | 103 | void __iomem *omap_device_get_rt_va(struct omap_device *od); |
110 | 104 | ||
111 | /* OMAP PM interface */ | 105 | /* OMAP PM interface */ |
@@ -122,11 +116,6 @@ int omap_device_enable_hwmods(struct omap_device *od); | |||
122 | int omap_device_disable_clocks(struct omap_device *od); | 116 | int omap_device_disable_clocks(struct omap_device *od); |
123 | int omap_device_enable_clocks(struct omap_device *od); | 117 | int omap_device_enable_clocks(struct omap_device *od); |
124 | 118 | ||
125 | static inline void omap_device_disable_idle_on_suspend(struct omap_device *od) | ||
126 | { | ||
127 | od->flags |= OMAP_DEVICE_NO_IDLE_ON_SUSPEND; | ||
128 | } | ||
129 | |||
130 | /* | 119 | /* |
131 | * Entries should be kept in latency order ascending | 120 | * Entries should be kept in latency order ascending |
132 | * | 121 | * |
@@ -157,6 +146,17 @@ struct omap_device_pm_latency { | |||
157 | #define OMAP_DEVICE_LATENCY_AUTO_ADJUST BIT(1) | 146 | #define OMAP_DEVICE_LATENCY_AUTO_ADJUST BIT(1) |
158 | 147 | ||
159 | /* Get omap_device pointer from platform_device pointer */ | 148 | /* Get omap_device pointer from platform_device pointer */ |
160 | #define to_omap_device(x) container_of((x), struct omap_device, pdev) | 149 | static inline struct omap_device *to_omap_device(struct platform_device *pdev) |
150 | { | ||
151 | return pdev ? pdev->archdata.od : NULL; | ||
152 | } | ||
153 | |||
154 | static inline | ||
155 | void omap_device_disable_idle_on_suspend(struct platform_device *pdev) | ||
156 | { | ||
157 | struct omap_device *od = to_omap_device(pdev); | ||
158 | |||
159 | od->flags |= OMAP_DEVICE_NO_IDLE_ON_SUSPEND; | ||
160 | } | ||
161 | 161 | ||
162 | #endif | 162 | #endif |
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c index 6c62af108710..4b15cd7926d7 100644 --- a/arch/arm/plat-omap/mcbsp.c +++ b/arch/arm/plat-omap/mcbsp.c | |||
@@ -24,45 +24,40 @@ | |||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | 25 | ||
26 | #include <plat/mcbsp.h> | 26 | #include <plat/mcbsp.h> |
27 | #include <plat/omap_device.h> | ||
28 | #include <linux/pm_runtime.h> | 27 | #include <linux/pm_runtime.h> |
29 | 28 | ||
30 | /* XXX These "sideways" includes are a sign that something is wrong */ | ||
31 | #include "../mach-omap2/cm2xxx_3xxx.h" | ||
32 | #include "../mach-omap2/cm-regbits-34xx.h" | ||
33 | |||
34 | struct omap_mcbsp **mcbsp_ptr; | 29 | struct omap_mcbsp **mcbsp_ptr; |
35 | int omap_mcbsp_count, omap_mcbsp_cache_size; | 30 | int omap_mcbsp_count; |
31 | |||
32 | #define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count) | ||
33 | #define id_to_mcbsp_ptr(id) mcbsp_ptr[id]; | ||
36 | 34 | ||
37 | static void omap_mcbsp_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val) | 35 | static void omap_mcbsp_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val) |
38 | { | 36 | { |
39 | if (cpu_class_is_omap1()) { | 37 | void __iomem *addr = mcbsp->io_base + reg * mcbsp->pdata->reg_step; |
40 | ((u16 *)mcbsp->reg_cache)[reg / sizeof(u16)] = (u16)val; | 38 | |
41 | __raw_writew((u16)val, mcbsp->io_base + reg); | 39 | if (mcbsp->pdata->reg_size == 2) { |
42 | } else if (cpu_is_omap2420()) { | 40 | ((u16 *)mcbsp->reg_cache)[reg] = (u16)val; |
43 | ((u16 *)mcbsp->reg_cache)[reg / sizeof(u32)] = (u16)val; | 41 | __raw_writew((u16)val, addr); |
44 | __raw_writew((u16)val, mcbsp->io_base + reg); | ||
45 | } else { | 42 | } else { |
46 | ((u32 *)mcbsp->reg_cache)[reg / sizeof(u32)] = val; | 43 | ((u32 *)mcbsp->reg_cache)[reg] = val; |
47 | __raw_writel(val, mcbsp->io_base + reg); | 44 | __raw_writel(val, addr); |
48 | } | 45 | } |
49 | } | 46 | } |
50 | 47 | ||
51 | static int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg, bool from_cache) | 48 | static int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg, bool from_cache) |
52 | { | 49 | { |
53 | if (cpu_class_is_omap1()) { | 50 | void __iomem *addr = mcbsp->io_base + reg * mcbsp->pdata->reg_step; |
54 | return !from_cache ? __raw_readw(mcbsp->io_base + reg) : | 51 | |
55 | ((u16 *)mcbsp->reg_cache)[reg / sizeof(u16)]; | 52 | if (mcbsp->pdata->reg_size == 2) { |
56 | } else if (cpu_is_omap2420()) { | 53 | return !from_cache ? __raw_readw(addr) : |
57 | return !from_cache ? __raw_readw(mcbsp->io_base + reg) : | 54 | ((u16 *)mcbsp->reg_cache)[reg]; |
58 | ((u16 *)mcbsp->reg_cache)[reg / sizeof(u32)]; | ||
59 | } else { | 55 | } else { |
60 | return !from_cache ? __raw_readl(mcbsp->io_base + reg) : | 56 | return !from_cache ? __raw_readl(addr) : |
61 | ((u32 *)mcbsp->reg_cache)[reg / sizeof(u32)]; | 57 | ((u32 *)mcbsp->reg_cache)[reg]; |
62 | } | 58 | } |
63 | } | 59 | } |
64 | 60 | ||
65 | #ifdef CONFIG_ARCH_OMAP3 | ||
66 | static void omap_mcbsp_st_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val) | 61 | static void omap_mcbsp_st_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val) |
67 | { | 62 | { |
68 | __raw_writel(val, mcbsp->st_data->io_base_st + reg); | 63 | __raw_writel(val, mcbsp->st_data->io_base_st + reg); |
@@ -72,7 +67,6 @@ static int omap_mcbsp_st_read(struct omap_mcbsp *mcbsp, u16 reg) | |||
72 | { | 67 | { |
73 | return __raw_readl(mcbsp->st_data->io_base_st + reg); | 68 | return __raw_readl(mcbsp->st_data->io_base_st + reg); |
74 | } | 69 | } |
75 | #endif | ||
76 | 70 | ||
77 | #define MCBSP_READ(mcbsp, reg) \ | 71 | #define MCBSP_READ(mcbsp, reg) \ |
78 | omap_mcbsp_read(mcbsp, OMAP_MCBSP_REG_##reg, 0) | 72 | omap_mcbsp_read(mcbsp, OMAP_MCBSP_REG_##reg, 0) |
@@ -187,7 +181,7 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config) | |||
187 | MCBSP_WRITE(mcbsp, MCR2, config->mcr2); | 181 | MCBSP_WRITE(mcbsp, MCR2, config->mcr2); |
188 | MCBSP_WRITE(mcbsp, MCR1, config->mcr1); | 182 | MCBSP_WRITE(mcbsp, MCR1, config->mcr1); |
189 | MCBSP_WRITE(mcbsp, PCR0, config->pcr0); | 183 | MCBSP_WRITE(mcbsp, PCR0, config->pcr0); |
190 | if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) { | 184 | if (mcbsp->pdata->has_ccr) { |
191 | MCBSP_WRITE(mcbsp, XCCR, config->xccr); | 185 | MCBSP_WRITE(mcbsp, XCCR, config->xccr); |
192 | MCBSP_WRITE(mcbsp, RCCR, config->rccr); | 186 | MCBSP_WRITE(mcbsp, RCCR, config->rccr); |
193 | } | 187 | } |
@@ -239,46 +233,28 @@ int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream) | |||
239 | } | 233 | } |
240 | mcbsp = id_to_mcbsp_ptr(id); | 234 | mcbsp = id_to_mcbsp_ptr(id); |
241 | 235 | ||
242 | data_reg = mcbsp->phys_dma_base; | 236 | if (mcbsp->pdata->reg_size == 2) { |
243 | |||
244 | if (mcbsp->mcbsp_config_type < MCBSP_CONFIG_TYPE2) { | ||
245 | if (stream) | 237 | if (stream) |
246 | data_reg += OMAP_MCBSP_REG_DRR1; | 238 | data_reg = OMAP_MCBSP_REG_DRR1; |
247 | else | 239 | else |
248 | data_reg += OMAP_MCBSP_REG_DXR1; | 240 | data_reg = OMAP_MCBSP_REG_DXR1; |
249 | } else { | 241 | } else { |
250 | if (stream) | 242 | if (stream) |
251 | data_reg += OMAP_MCBSP_REG_DRR; | 243 | data_reg = OMAP_MCBSP_REG_DRR; |
252 | else | 244 | else |
253 | data_reg += OMAP_MCBSP_REG_DXR; | 245 | data_reg = OMAP_MCBSP_REG_DXR; |
254 | } | 246 | } |
255 | 247 | ||
256 | return data_reg; | 248 | return mcbsp->phys_dma_base + data_reg * mcbsp->pdata->reg_step; |
257 | } | 249 | } |
258 | EXPORT_SYMBOL(omap_mcbsp_dma_reg_params); | 250 | EXPORT_SYMBOL(omap_mcbsp_dma_reg_params); |
259 | 251 | ||
260 | #ifdef CONFIG_ARCH_OMAP3 | ||
261 | static struct omap_device *find_omap_device_by_dev(struct device *dev) | ||
262 | { | ||
263 | struct platform_device *pdev = container_of(dev, | ||
264 | struct platform_device, dev); | ||
265 | return container_of(pdev, struct omap_device, pdev); | ||
266 | } | ||
267 | |||
268 | static void omap_st_on(struct omap_mcbsp *mcbsp) | 252 | static void omap_st_on(struct omap_mcbsp *mcbsp) |
269 | { | 253 | { |
270 | unsigned int w; | 254 | unsigned int w; |
271 | struct omap_device *od; | ||
272 | 255 | ||
273 | od = find_omap_device_by_dev(mcbsp->dev); | 256 | if (mcbsp->pdata->enable_st_clock) |
274 | 257 | mcbsp->pdata->enable_st_clock(mcbsp->id, 1); | |
275 | /* | ||
276 | * Sidetone uses McBSP ICLK - which must not idle when sidetones | ||
277 | * are enabled or sidetones start sounding ugly. | ||
278 | */ | ||
279 | w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE); | ||
280 | w &= ~(1 << (mcbsp->id - 2)); | ||
281 | omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE); | ||
282 | 258 | ||
283 | /* Enable McBSP Sidetone */ | 259 | /* Enable McBSP Sidetone */ |
284 | w = MCBSP_READ(mcbsp, SSELCR); | 260 | w = MCBSP_READ(mcbsp, SSELCR); |
@@ -292,9 +268,6 @@ static void omap_st_on(struct omap_mcbsp *mcbsp) | |||
292 | static void omap_st_off(struct omap_mcbsp *mcbsp) | 268 | static void omap_st_off(struct omap_mcbsp *mcbsp) |
293 | { | 269 | { |
294 | unsigned int w; | 270 | unsigned int w; |
295 | struct omap_device *od; | ||
296 | |||
297 | od = find_omap_device_by_dev(mcbsp->dev); | ||
298 | 271 | ||
299 | w = MCBSP_ST_READ(mcbsp, SSELCR); | 272 | w = MCBSP_ST_READ(mcbsp, SSELCR); |
300 | MCBSP_ST_WRITE(mcbsp, SSELCR, w & ~(ST_SIDETONEEN)); | 273 | MCBSP_ST_WRITE(mcbsp, SSELCR, w & ~(ST_SIDETONEEN)); |
@@ -302,17 +275,13 @@ static void omap_st_off(struct omap_mcbsp *mcbsp) | |||
302 | w = MCBSP_READ(mcbsp, SSELCR); | 275 | w = MCBSP_READ(mcbsp, SSELCR); |
303 | MCBSP_WRITE(mcbsp, SSELCR, w & ~(SIDETONEEN)); | 276 | MCBSP_WRITE(mcbsp, SSELCR, w & ~(SIDETONEEN)); |
304 | 277 | ||
305 | w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE); | 278 | if (mcbsp->pdata->enable_st_clock) |
306 | w |= 1 << (mcbsp->id - 2); | 279 | mcbsp->pdata->enable_st_clock(mcbsp->id, 0); |
307 | omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE); | ||
308 | } | 280 | } |
309 | 281 | ||
310 | static void omap_st_fir_write(struct omap_mcbsp *mcbsp, s16 *fir) | 282 | static void omap_st_fir_write(struct omap_mcbsp *mcbsp, s16 *fir) |
311 | { | 283 | { |
312 | u16 val, i; | 284 | u16 val, i; |
313 | struct omap_device *od; | ||
314 | |||
315 | od = find_omap_device_by_dev(mcbsp->dev); | ||
316 | 285 | ||
317 | val = MCBSP_ST_READ(mcbsp, SSELCR); | 286 | val = MCBSP_ST_READ(mcbsp, SSELCR); |
318 | 287 | ||
@@ -340,9 +309,6 @@ static void omap_st_chgain(struct omap_mcbsp *mcbsp) | |||
340 | { | 309 | { |
341 | u16 w; | 310 | u16 w; |
342 | struct omap_mcbsp_st_data *st_data = mcbsp->st_data; | 311 | struct omap_mcbsp_st_data *st_data = mcbsp->st_data; |
343 | struct omap_device *od; | ||
344 | |||
345 | od = find_omap_device_by_dev(mcbsp->dev); | ||
346 | 312 | ||
347 | w = MCBSP_ST_READ(mcbsp, SSELCR); | 313 | w = MCBSP_ST_READ(mcbsp, SSELCR); |
348 | 314 | ||
@@ -525,14 +491,13 @@ void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold) | |||
525 | { | 491 | { |
526 | struct omap_mcbsp *mcbsp; | 492 | struct omap_mcbsp *mcbsp; |
527 | 493 | ||
528 | if (!cpu_is_omap34xx() && !cpu_is_omap44xx()) | ||
529 | return; | ||
530 | |||
531 | if (!omap_mcbsp_check_valid_id(id)) { | 494 | if (!omap_mcbsp_check_valid_id(id)) { |
532 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | 495 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); |
533 | return; | 496 | return; |
534 | } | 497 | } |
535 | mcbsp = id_to_mcbsp_ptr(id); | 498 | mcbsp = id_to_mcbsp_ptr(id); |
499 | if (mcbsp->pdata->buffer_size == 0) | ||
500 | return; | ||
536 | 501 | ||
537 | if (threshold && threshold <= mcbsp->max_tx_thres) | 502 | if (threshold && threshold <= mcbsp->max_tx_thres) |
538 | MCBSP_WRITE(mcbsp, THRSH2, threshold - 1); | 503 | MCBSP_WRITE(mcbsp, THRSH2, threshold - 1); |
@@ -548,14 +513,13 @@ void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold) | |||
548 | { | 513 | { |
549 | struct omap_mcbsp *mcbsp; | 514 | struct omap_mcbsp *mcbsp; |
550 | 515 | ||
551 | if (!cpu_is_omap34xx() && !cpu_is_omap44xx()) | ||
552 | return; | ||
553 | |||
554 | if (!omap_mcbsp_check_valid_id(id)) { | 516 | if (!omap_mcbsp_check_valid_id(id)) { |
555 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | 517 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); |
556 | return; | 518 | return; |
557 | } | 519 | } |
558 | mcbsp = id_to_mcbsp_ptr(id); | 520 | mcbsp = id_to_mcbsp_ptr(id); |
521 | if (mcbsp->pdata->buffer_size == 0) | ||
522 | return; | ||
559 | 523 | ||
560 | if (threshold && threshold <= mcbsp->max_rx_thres) | 524 | if (threshold && threshold <= mcbsp->max_rx_thres) |
561 | MCBSP_WRITE(mcbsp, THRSH1, threshold - 1); | 525 | MCBSP_WRITE(mcbsp, THRSH1, threshold - 1); |
@@ -625,6 +589,8 @@ u16 omap_mcbsp_get_tx_delay(unsigned int id) | |||
625 | return -ENODEV; | 589 | return -ENODEV; |
626 | } | 590 | } |
627 | mcbsp = id_to_mcbsp_ptr(id); | 591 | mcbsp = id_to_mcbsp_ptr(id); |
592 | if (mcbsp->pdata->buffer_size == 0) | ||
593 | return 0; | ||
628 | 594 | ||
629 | /* Returns the number of free locations in the buffer */ | 595 | /* Returns the number of free locations in the buffer */ |
630 | buffstat = MCBSP_READ(mcbsp, XBUFFSTAT); | 596 | buffstat = MCBSP_READ(mcbsp, XBUFFSTAT); |
@@ -648,6 +614,8 @@ u16 omap_mcbsp_get_rx_delay(unsigned int id) | |||
648 | return -ENODEV; | 614 | return -ENODEV; |
649 | } | 615 | } |
650 | mcbsp = id_to_mcbsp_ptr(id); | 616 | mcbsp = id_to_mcbsp_ptr(id); |
617 | if (mcbsp->pdata->buffer_size == 0) | ||
618 | return 0; | ||
651 | 619 | ||
652 | /* Returns the number of used locations in the buffer */ | 620 | /* Returns the number of used locations in the buffer */ |
653 | buffstat = MCBSP_READ(mcbsp, RBUFFSTAT); | 621 | buffstat = MCBSP_READ(mcbsp, RBUFFSTAT); |
@@ -683,46 +651,6 @@ int omap_mcbsp_get_dma_op_mode(unsigned int id) | |||
683 | } | 651 | } |
684 | EXPORT_SYMBOL(omap_mcbsp_get_dma_op_mode); | 652 | EXPORT_SYMBOL(omap_mcbsp_get_dma_op_mode); |
685 | 653 | ||
686 | static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp) | ||
687 | { | ||
688 | struct omap_device *od; | ||
689 | |||
690 | od = find_omap_device_by_dev(mcbsp->dev); | ||
691 | /* | ||
692 | * Enable wakup behavior, smart idle and all wakeups | ||
693 | * REVISIT: some wakeups may be unnecessary | ||
694 | */ | ||
695 | if (cpu_is_omap34xx() || cpu_is_omap44xx()) { | ||
696 | MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN); | ||
697 | } | ||
698 | } | ||
699 | |||
700 | static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp) | ||
701 | { | ||
702 | struct omap_device *od; | ||
703 | |||
704 | od = find_omap_device_by_dev(mcbsp->dev); | ||
705 | |||
706 | /* | ||
707 | * Disable wakup behavior, smart idle and all wakeups | ||
708 | */ | ||
709 | if (cpu_is_omap34xx() || cpu_is_omap44xx()) { | ||
710 | /* | ||
711 | * HW bug workaround - If no_idle mode is taken, we need to | ||
712 | * go to smart_idle before going to always_idle, or the | ||
713 | * device will not hit retention anymore. | ||
714 | */ | ||
715 | |||
716 | MCBSP_WRITE(mcbsp, WAKEUPEN, 0); | ||
717 | } | ||
718 | } | ||
719 | #else | ||
720 | static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp) {} | ||
721 | static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp) {} | ||
722 | static inline void omap_st_start(struct omap_mcbsp *mcbsp) {} | ||
723 | static inline void omap_st_stop(struct omap_mcbsp *mcbsp) {} | ||
724 | #endif | ||
725 | |||
726 | int omap_mcbsp_request(unsigned int id) | 654 | int omap_mcbsp_request(unsigned int id) |
727 | { | 655 | { |
728 | struct omap_mcbsp *mcbsp; | 656 | struct omap_mcbsp *mcbsp; |
@@ -735,7 +663,7 @@ int omap_mcbsp_request(unsigned int id) | |||
735 | } | 663 | } |
736 | mcbsp = id_to_mcbsp_ptr(id); | 664 | mcbsp = id_to_mcbsp_ptr(id); |
737 | 665 | ||
738 | reg_cache = kzalloc(omap_mcbsp_cache_size, GFP_KERNEL); | 666 | reg_cache = kzalloc(mcbsp->reg_cache_size, GFP_KERNEL); |
739 | if (!reg_cache) { | 667 | if (!reg_cache) { |
740 | return -ENOMEM; | 668 | return -ENOMEM; |
741 | } | 669 | } |
@@ -757,8 +685,9 @@ int omap_mcbsp_request(unsigned int id) | |||
757 | 685 | ||
758 | pm_runtime_get_sync(mcbsp->dev); | 686 | pm_runtime_get_sync(mcbsp->dev); |
759 | 687 | ||
760 | /* Do procedure specific to omap34xx arch, if applicable */ | 688 | /* Enable wakeup behavior */ |
761 | omap34xx_mcbsp_request(mcbsp); | 689 | if (mcbsp->pdata->has_wakeup) |
690 | MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN); | ||
762 | 691 | ||
763 | /* | 692 | /* |
764 | * Make sure that transmitter, receiver and sample-rate generator are | 693 | * Make sure that transmitter, receiver and sample-rate generator are |
@@ -795,8 +724,9 @@ err_clk_disable: | |||
795 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) | 724 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) |
796 | mcbsp->pdata->ops->free(id); | 725 | mcbsp->pdata->ops->free(id); |
797 | 726 | ||
798 | /* Do procedure specific to omap34xx arch, if applicable */ | 727 | /* Disable wakeup behavior */ |
799 | omap34xx_mcbsp_free(mcbsp); | 728 | if (mcbsp->pdata->has_wakeup) |
729 | MCBSP_WRITE(mcbsp, WAKEUPEN, 0); | ||
800 | 730 | ||
801 | pm_runtime_put_sync(mcbsp->dev); | 731 | pm_runtime_put_sync(mcbsp->dev); |
802 | 732 | ||
@@ -825,8 +755,9 @@ void omap_mcbsp_free(unsigned int id) | |||
825 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) | 755 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) |
826 | mcbsp->pdata->ops->free(id); | 756 | mcbsp->pdata->ops->free(id); |
827 | 757 | ||
828 | /* Do procedure specific to omap34xx arch, if applicable */ | 758 | /* Disable wakeup behavior */ |
829 | omap34xx_mcbsp_free(mcbsp); | 759 | if (mcbsp->pdata->has_wakeup) |
760 | MCBSP_WRITE(mcbsp, WAKEUPEN, 0); | ||
830 | 761 | ||
831 | pm_runtime_put_sync(mcbsp->dev); | 762 | pm_runtime_put_sync(mcbsp->dev); |
832 | 763 | ||
@@ -866,7 +797,7 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx) | |||
866 | } | 797 | } |
867 | mcbsp = id_to_mcbsp_ptr(id); | 798 | mcbsp = id_to_mcbsp_ptr(id); |
868 | 799 | ||
869 | if (cpu_is_omap34xx()) | 800 | if (mcbsp->st_data) |
870 | omap_st_start(mcbsp); | 801 | omap_st_start(mcbsp); |
871 | 802 | ||
872 | /* Only enable SRG, if McBSP is master */ | 803 | /* Only enable SRG, if McBSP is master */ |
@@ -904,7 +835,7 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx) | |||
904 | MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 7)); | 835 | MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 7)); |
905 | } | 836 | } |
906 | 837 | ||
907 | if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) { | 838 | if (mcbsp->pdata->has_ccr) { |
908 | /* Release the transmitter and receiver */ | 839 | /* Release the transmitter and receiver */ |
909 | w = MCBSP_READ_CACHE(mcbsp, XCCR); | 840 | w = MCBSP_READ_CACHE(mcbsp, XCCR); |
910 | w &= ~(tx ? XDISABLE : 0); | 841 | w &= ~(tx ? XDISABLE : 0); |
@@ -934,7 +865,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx) | |||
934 | 865 | ||
935 | /* Reset transmitter */ | 866 | /* Reset transmitter */ |
936 | tx &= 1; | 867 | tx &= 1; |
937 | if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) { | 868 | if (mcbsp->pdata->has_ccr) { |
938 | w = MCBSP_READ_CACHE(mcbsp, XCCR); | 869 | w = MCBSP_READ_CACHE(mcbsp, XCCR); |
939 | w |= (tx ? XDISABLE : 0); | 870 | w |= (tx ? XDISABLE : 0); |
940 | MCBSP_WRITE(mcbsp, XCCR, w); | 871 | MCBSP_WRITE(mcbsp, XCCR, w); |
@@ -944,7 +875,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx) | |||
944 | 875 | ||
945 | /* Reset receiver */ | 876 | /* Reset receiver */ |
946 | rx &= 1; | 877 | rx &= 1; |
947 | if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) { | 878 | if (mcbsp->pdata->has_ccr) { |
948 | w = MCBSP_READ_CACHE(mcbsp, RCCR); | 879 | w = MCBSP_READ_CACHE(mcbsp, RCCR); |
949 | w |= (rx ? RDISABLE : 0); | 880 | w |= (rx ? RDISABLE : 0); |
950 | MCBSP_WRITE(mcbsp, RCCR, w); | 881 | MCBSP_WRITE(mcbsp, RCCR, w); |
@@ -961,39 +892,72 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx) | |||
961 | MCBSP_WRITE(mcbsp, SPCR2, w & ~(1 << 6)); | 892 | MCBSP_WRITE(mcbsp, SPCR2, w & ~(1 << 6)); |
962 | } | 893 | } |
963 | 894 | ||
964 | if (cpu_is_omap34xx()) | 895 | if (mcbsp->st_data) |
965 | omap_st_stop(mcbsp); | 896 | omap_st_stop(mcbsp); |
966 | } | 897 | } |
967 | EXPORT_SYMBOL(omap_mcbsp_stop); | 898 | EXPORT_SYMBOL(omap_mcbsp_stop); |
968 | 899 | ||
969 | /* | ||
970 | * The following functions are only required on an OMAP1-only build. | ||
971 | * mach-omap2/mcbsp.c contains the real functions | ||
972 | */ | ||
973 | #ifndef CONFIG_ARCH_OMAP2PLUS | ||
974 | int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id) | 900 | int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id) |
975 | { | 901 | { |
976 | WARN(1, "%s: should never be called on an OMAP1-only kernel\n", | 902 | struct omap_mcbsp *mcbsp; |
977 | __func__); | 903 | const char *src; |
978 | return -EINVAL; | 904 | |
905 | if (!omap_mcbsp_check_valid_id(id)) { | ||
906 | pr_err("%s: Invalid id (%d)\n", __func__, id + 1); | ||
907 | return -EINVAL; | ||
908 | } | ||
909 | mcbsp = id_to_mcbsp_ptr(id); | ||
910 | |||
911 | if (fck_src_id == MCBSP_CLKS_PAD_SRC) | ||
912 | src = "clks_ext"; | ||
913 | else if (fck_src_id == MCBSP_CLKS_PRCM_SRC) | ||
914 | src = "clks_fclk"; | ||
915 | else | ||
916 | return -EINVAL; | ||
917 | |||
918 | if (mcbsp->pdata->set_clk_src) | ||
919 | return mcbsp->pdata->set_clk_src(mcbsp->dev, mcbsp->fclk, src); | ||
920 | else | ||
921 | return -EINVAL; | ||
979 | } | 922 | } |
923 | EXPORT_SYMBOL(omap2_mcbsp_set_clks_src); | ||
980 | 924 | ||
981 | void omap2_mcbsp1_mux_clkr_src(u8 mux) | 925 | void omap2_mcbsp1_mux_clkr_src(u8 mux) |
982 | { | 926 | { |
983 | WARN(1, "%s: should never be called on an OMAP1-only kernel\n", | 927 | struct omap_mcbsp *mcbsp; |
984 | __func__); | 928 | const char *src; |
985 | return; | 929 | |
930 | if (mux == CLKR_SRC_CLKR) | ||
931 | src = "clkr"; | ||
932 | else if (mux == CLKR_SRC_CLKX) | ||
933 | src = "clkx"; | ||
934 | else | ||
935 | return; | ||
936 | |||
937 | mcbsp = id_to_mcbsp_ptr(0); | ||
938 | if (mcbsp->pdata->mux_signal) | ||
939 | mcbsp->pdata->mux_signal(mcbsp->dev, "clkr", src); | ||
986 | } | 940 | } |
941 | EXPORT_SYMBOL(omap2_mcbsp1_mux_clkr_src); | ||
987 | 942 | ||
988 | void omap2_mcbsp1_mux_fsr_src(u8 mux) | 943 | void omap2_mcbsp1_mux_fsr_src(u8 mux) |
989 | { | 944 | { |
990 | WARN(1, "%s: should never be called on an OMAP1-only kernel\n", | 945 | struct omap_mcbsp *mcbsp; |
991 | __func__); | 946 | const char *src; |
992 | return; | 947 | |
948 | if (mux == FSR_SRC_FSR) | ||
949 | src = "fsr"; | ||
950 | else if (mux == FSR_SRC_FSX) | ||
951 | src = "fsx"; | ||
952 | else | ||
953 | return; | ||
954 | |||
955 | mcbsp = id_to_mcbsp_ptr(0); | ||
956 | if (mcbsp->pdata->mux_signal) | ||
957 | mcbsp->pdata->mux_signal(mcbsp->dev, "fsr", src); | ||
993 | } | 958 | } |
994 | #endif | 959 | EXPORT_SYMBOL(omap2_mcbsp1_mux_fsr_src); |
995 | 960 | ||
996 | #ifdef CONFIG_ARCH_OMAP3 | ||
997 | #define max_thres(m) (mcbsp->pdata->buffer_size) | 961 | #define max_thres(m) (mcbsp->pdata->buffer_size) |
998 | #define valid_threshold(m, val) ((val) <= max_thres(m)) | 962 | #define valid_threshold(m, val) ((val) <= max_thres(m)) |
999 | #define THRESHOLD_PROP_BUILDER(prop) \ | 963 | #define THRESHOLD_PROP_BUILDER(prop) \ |
@@ -1084,6 +1048,17 @@ unlock: | |||
1084 | 1048 | ||
1085 | static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store); | 1049 | static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store); |
1086 | 1050 | ||
1051 | static const struct attribute *additional_attrs[] = { | ||
1052 | &dev_attr_max_tx_thres.attr, | ||
1053 | &dev_attr_max_rx_thres.attr, | ||
1054 | &dev_attr_dma_op_mode.attr, | ||
1055 | NULL, | ||
1056 | }; | ||
1057 | |||
1058 | static const struct attribute_group additional_attr_group = { | ||
1059 | .attrs = (struct attribute **)additional_attrs, | ||
1060 | }; | ||
1061 | |||
1087 | static ssize_t st_taps_show(struct device *dev, | 1062 | static ssize_t st_taps_show(struct device *dev, |
1088 | struct device_attribute *attr, char *buf) | 1063 | struct device_attribute *attr, char *buf) |
1089 | { | 1064 | { |
@@ -1142,27 +1117,6 @@ out: | |||
1142 | 1117 | ||
1143 | static DEVICE_ATTR(st_taps, 0644, st_taps_show, st_taps_store); | 1118 | static DEVICE_ATTR(st_taps, 0644, st_taps_show, st_taps_store); |
1144 | 1119 | ||
1145 | static const struct attribute *additional_attrs[] = { | ||
1146 | &dev_attr_max_tx_thres.attr, | ||
1147 | &dev_attr_max_rx_thres.attr, | ||
1148 | &dev_attr_dma_op_mode.attr, | ||
1149 | NULL, | ||
1150 | }; | ||
1151 | |||
1152 | static const struct attribute_group additional_attr_group = { | ||
1153 | .attrs = (struct attribute **)additional_attrs, | ||
1154 | }; | ||
1155 | |||
1156 | static inline int __devinit omap_additional_add(struct device *dev) | ||
1157 | { | ||
1158 | return sysfs_create_group(&dev->kobj, &additional_attr_group); | ||
1159 | } | ||
1160 | |||
1161 | static inline void __devexit omap_additional_remove(struct device *dev) | ||
1162 | { | ||
1163 | sysfs_remove_group(&dev->kobj, &additional_attr_group); | ||
1164 | } | ||
1165 | |||
1166 | static const struct attribute *sidetone_attrs[] = { | 1120 | static const struct attribute *sidetone_attrs[] = { |
1167 | &dev_attr_st_taps.attr, | 1121 | &dev_attr_st_taps.attr, |
1168 | NULL, | 1122 | NULL, |
@@ -1172,10 +1126,9 @@ static const struct attribute_group sidetone_attr_group = { | |||
1172 | .attrs = (struct attribute **)sidetone_attrs, | 1126 | .attrs = (struct attribute **)sidetone_attrs, |
1173 | }; | 1127 | }; |
1174 | 1128 | ||
1175 | static int __devinit omap_st_add(struct omap_mcbsp *mcbsp) | 1129 | static int __devinit omap_st_add(struct omap_mcbsp *mcbsp, |
1130 | struct resource *res) | ||
1176 | { | 1131 | { |
1177 | struct platform_device *pdev; | ||
1178 | struct resource *res; | ||
1179 | struct omap_mcbsp_st_data *st_data; | 1132 | struct omap_mcbsp_st_data *st_data; |
1180 | int err; | 1133 | int err; |
1181 | 1134 | ||
@@ -1185,9 +1138,6 @@ static int __devinit omap_st_add(struct omap_mcbsp *mcbsp) | |||
1185 | goto err1; | 1138 | goto err1; |
1186 | } | 1139 | } |
1187 | 1140 | ||
1188 | pdev = container_of(mcbsp->dev, struct platform_device, dev); | ||
1189 | |||
1190 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sidetone"); | ||
1191 | st_data->io_base_st = ioremap(res->start, resource_size(res)); | 1141 | st_data->io_base_st = ioremap(res->start, resource_size(res)); |
1192 | if (!st_data->io_base_st) { | 1142 | if (!st_data->io_base_st) { |
1193 | err = -ENOMEM; | 1143 | err = -ENOMEM; |
@@ -1214,59 +1164,10 @@ static void __devexit omap_st_remove(struct omap_mcbsp *mcbsp) | |||
1214 | { | 1164 | { |
1215 | struct omap_mcbsp_st_data *st_data = mcbsp->st_data; | 1165 | struct omap_mcbsp_st_data *st_data = mcbsp->st_data; |
1216 | 1166 | ||
1217 | if (st_data) { | 1167 | sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group); |
1218 | sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group); | 1168 | iounmap(st_data->io_base_st); |
1219 | iounmap(st_data->io_base_st); | 1169 | kfree(st_data); |
1220 | kfree(st_data); | ||
1221 | } | ||
1222 | } | ||
1223 | |||
1224 | static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp) | ||
1225 | { | ||
1226 | mcbsp->dma_op_mode = MCBSP_DMA_MODE_ELEMENT; | ||
1227 | if (cpu_is_omap34xx()) { | ||
1228 | /* | ||
1229 | * Initially configure the maximum thresholds to a safe value. | ||
1230 | * The McBSP FIFO usage with these values should not go under | ||
1231 | * 16 locations. | ||
1232 | * If the whole FIFO without safety buffer is used, than there | ||
1233 | * is a possibility that the DMA will be not able to push the | ||
1234 | * new data on time, causing channel shifts in runtime. | ||
1235 | */ | ||
1236 | mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10; | ||
1237 | mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10; | ||
1238 | /* | ||
1239 | * REVISIT: Set dmap_op_mode to THRESHOLD as default | ||
1240 | * for mcbsp2 instances. | ||
1241 | */ | ||
1242 | if (omap_additional_add(mcbsp->dev)) | ||
1243 | dev_warn(mcbsp->dev, | ||
1244 | "Unable to create additional controls\n"); | ||
1245 | |||
1246 | if (mcbsp->id == 2 || mcbsp->id == 3) | ||
1247 | if (omap_st_add(mcbsp)) | ||
1248 | dev_warn(mcbsp->dev, | ||
1249 | "Unable to create sidetone controls\n"); | ||
1250 | |||
1251 | } else { | ||
1252 | mcbsp->max_tx_thres = -EINVAL; | ||
1253 | mcbsp->max_rx_thres = -EINVAL; | ||
1254 | } | ||
1255 | } | ||
1256 | |||
1257 | static inline void __devexit omap34xx_device_exit(struct omap_mcbsp *mcbsp) | ||
1258 | { | ||
1259 | if (cpu_is_omap34xx()) { | ||
1260 | omap_additional_remove(mcbsp->dev); | ||
1261 | |||
1262 | if (mcbsp->id == 2 || mcbsp->id == 3) | ||
1263 | omap_st_remove(mcbsp); | ||
1264 | } | ||
1265 | } | 1170 | } |
1266 | #else | ||
1267 | static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp) {} | ||
1268 | static inline void __devexit omap34xx_device_exit(struct omap_mcbsp *mcbsp) {} | ||
1269 | #endif /* CONFIG_ARCH_OMAP3 */ | ||
1270 | 1171 | ||
1271 | /* | 1172 | /* |
1272 | * McBSP1 and McBSP3 are directly mapped on 1610 and 1510. | 1173 | * McBSP1 and McBSP3 are directly mapped on 1610 and 1510. |
@@ -1316,7 +1217,7 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev) | |||
1316 | } | 1217 | } |
1317 | } | 1218 | } |
1318 | mcbsp->phys_base = res->start; | 1219 | mcbsp->phys_base = res->start; |
1319 | omap_mcbsp_cache_size = resource_size(res); | 1220 | mcbsp->reg_cache_size = resource_size(res); |
1320 | mcbsp->io_base = ioremap(res->start, resource_size(res)); | 1221 | mcbsp->io_base = ioremap(res->start, resource_size(res)); |
1321 | if (!mcbsp->io_base) { | 1222 | if (!mcbsp->io_base) { |
1322 | ret = -ENOMEM; | 1223 | ret = -ENOMEM; |
@@ -1364,15 +1265,52 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev) | |||
1364 | mcbsp->pdata = pdata; | 1265 | mcbsp->pdata = pdata; |
1365 | mcbsp->dev = &pdev->dev; | 1266 | mcbsp->dev = &pdev->dev; |
1366 | mcbsp_ptr[id] = mcbsp; | 1267 | mcbsp_ptr[id] = mcbsp; |
1367 | mcbsp->mcbsp_config_type = pdata->mcbsp_config_type; | ||
1368 | platform_set_drvdata(pdev, mcbsp); | 1268 | platform_set_drvdata(pdev, mcbsp); |
1369 | pm_runtime_enable(mcbsp->dev); | 1269 | pm_runtime_enable(mcbsp->dev); |
1370 | 1270 | ||
1371 | /* Initialize mcbsp properties for OMAP34XX if needed / applicable */ | 1271 | mcbsp->dma_op_mode = MCBSP_DMA_MODE_ELEMENT; |
1372 | omap34xx_device_init(mcbsp); | 1272 | if (mcbsp->pdata->buffer_size) { |
1273 | /* | ||
1274 | * Initially configure the maximum thresholds to a safe value. | ||
1275 | * The McBSP FIFO usage with these values should not go under | ||
1276 | * 16 locations. | ||
1277 | * If the whole FIFO without safety buffer is used, than there | ||
1278 | * is a possibility that the DMA will be not able to push the | ||
1279 | * new data on time, causing channel shifts in runtime. | ||
1280 | */ | ||
1281 | mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10; | ||
1282 | mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10; | ||
1283 | |||
1284 | ret = sysfs_create_group(&mcbsp->dev->kobj, | ||
1285 | &additional_attr_group); | ||
1286 | if (ret) { | ||
1287 | dev_err(mcbsp->dev, | ||
1288 | "Unable to create additional controls\n"); | ||
1289 | goto err_thres; | ||
1290 | } | ||
1291 | } else { | ||
1292 | mcbsp->max_tx_thres = -EINVAL; | ||
1293 | mcbsp->max_rx_thres = -EINVAL; | ||
1294 | } | ||
1295 | |||
1296 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sidetone"); | ||
1297 | if (res) { | ||
1298 | ret = omap_st_add(mcbsp, res); | ||
1299 | if (ret) { | ||
1300 | dev_err(mcbsp->dev, | ||
1301 | "Unable to create sidetone controls\n"); | ||
1302 | goto err_st; | ||
1303 | } | ||
1304 | } | ||
1373 | 1305 | ||
1374 | return 0; | 1306 | return 0; |
1375 | 1307 | ||
1308 | err_st: | ||
1309 | if (mcbsp->pdata->buffer_size) | ||
1310 | sysfs_remove_group(&mcbsp->dev->kobj, | ||
1311 | &additional_attr_group); | ||
1312 | err_thres: | ||
1313 | clk_put(mcbsp->fclk); | ||
1376 | err_res: | 1314 | err_res: |
1377 | iounmap(mcbsp->io_base); | 1315 | iounmap(mcbsp->io_base); |
1378 | err_ioremap: | 1316 | err_ioremap: |
@@ -1392,7 +1330,12 @@ static int __devexit omap_mcbsp_remove(struct platform_device *pdev) | |||
1392 | mcbsp->pdata->ops->free) | 1330 | mcbsp->pdata->ops->free) |
1393 | mcbsp->pdata->ops->free(mcbsp->id); | 1331 | mcbsp->pdata->ops->free(mcbsp->id); |
1394 | 1332 | ||
1395 | omap34xx_device_exit(mcbsp); | 1333 | if (mcbsp->pdata->buffer_size) |
1334 | sysfs_remove_group(&mcbsp->dev->kobj, | ||
1335 | &additional_attr_group); | ||
1336 | |||
1337 | if (mcbsp->st_data) | ||
1338 | omap_st_remove(mcbsp); | ||
1396 | 1339 | ||
1397 | clk_put(mcbsp->fclk); | 1340 | clk_put(mcbsp->fclk); |
1398 | 1341 | ||
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c index 02609eee0562..26aee5cc1fc1 100644 --- a/arch/arm/plat-omap/omap_device.c +++ b/arch/arm/plat-omap/omap_device.c | |||
@@ -94,6 +94,9 @@ | |||
94 | #define USE_WAKEUP_LAT 0 | 94 | #define USE_WAKEUP_LAT 0 |
95 | #define IGNORE_WAKEUP_LAT 1 | 95 | #define IGNORE_WAKEUP_LAT 1 |
96 | 96 | ||
97 | static int omap_device_register(struct platform_device *pdev); | ||
98 | static int omap_early_device_register(struct platform_device *pdev); | ||
99 | |||
97 | /* Private functions */ | 100 | /* Private functions */ |
98 | 101 | ||
99 | /** | 102 | /** |
@@ -114,7 +117,7 @@ static int _omap_device_activate(struct omap_device *od, u8 ignore_lat) | |||
114 | { | 117 | { |
115 | struct timespec a, b, c; | 118 | struct timespec a, b, c; |
116 | 119 | ||
117 | pr_debug("omap_device: %s: activating\n", od->pdev.name); | 120 | dev_dbg(&od->pdev->dev, "omap_device: activating\n"); |
118 | 121 | ||
119 | while (od->pm_lat_level > 0) { | 122 | while (od->pm_lat_level > 0) { |
120 | struct omap_device_pm_latency *odpl; | 123 | struct omap_device_pm_latency *odpl; |
@@ -138,25 +141,24 @@ static int _omap_device_activate(struct omap_device *od, u8 ignore_lat) | |||
138 | c = timespec_sub(b, a); | 141 | c = timespec_sub(b, a); |
139 | act_lat = timespec_to_ns(&c); | 142 | act_lat = timespec_to_ns(&c); |
140 | 143 | ||
141 | pr_debug("omap_device: %s: pm_lat %d: activate: elapsed time " | 144 | dev_dbg(&od->pdev->dev, |
142 | "%llu nsec\n", od->pdev.name, od->pm_lat_level, | 145 | "omap_device: pm_lat %d: activate: elapsed time " |
143 | act_lat); | 146 | "%llu nsec\n", od->pm_lat_level, act_lat); |
144 | 147 | ||
145 | if (act_lat > odpl->activate_lat) { | 148 | if (act_lat > odpl->activate_lat) { |
146 | odpl->activate_lat_worst = act_lat; | 149 | odpl->activate_lat_worst = act_lat; |
147 | if (odpl->flags & OMAP_DEVICE_LATENCY_AUTO_ADJUST) { | 150 | if (odpl->flags & OMAP_DEVICE_LATENCY_AUTO_ADJUST) { |
148 | odpl->activate_lat = act_lat; | 151 | odpl->activate_lat = act_lat; |
149 | pr_warning("omap_device: %s.%d: new worst case " | 152 | dev_dbg(&od->pdev->dev, |
150 | "activate latency %d: %llu\n", | 153 | "new worst case activate latency " |
151 | od->pdev.name, od->pdev.id, | 154 | "%d: %llu\n", |
152 | od->pm_lat_level, act_lat); | 155 | od->pm_lat_level, act_lat); |
153 | } else | 156 | } else |
154 | pr_warning("omap_device: %s.%d: activate " | 157 | dev_warn(&od->pdev->dev, |
155 | "latency %d higher than exptected. " | 158 | "activate latency %d " |
156 | "(%llu > %d)\n", | 159 | "higher than exptected. (%llu > %d)\n", |
157 | od->pdev.name, od->pdev.id, | 160 | od->pm_lat_level, act_lat, |
158 | od->pm_lat_level, act_lat, | 161 | odpl->activate_lat); |
159 | odpl->activate_lat); | ||
160 | } | 162 | } |
161 | 163 | ||
162 | od->dev_wakeup_lat -= odpl->activate_lat; | 164 | od->dev_wakeup_lat -= odpl->activate_lat; |
@@ -183,7 +185,7 @@ static int _omap_device_deactivate(struct omap_device *od, u8 ignore_lat) | |||
183 | { | 185 | { |
184 | struct timespec a, b, c; | 186 | struct timespec a, b, c; |
185 | 187 | ||
186 | pr_debug("omap_device: %s: deactivating\n", od->pdev.name); | 188 | dev_dbg(&od->pdev->dev, "omap_device: deactivating\n"); |
187 | 189 | ||
188 | while (od->pm_lat_level < od->pm_lats_cnt) { | 190 | while (od->pm_lat_level < od->pm_lats_cnt) { |
189 | struct omap_device_pm_latency *odpl; | 191 | struct omap_device_pm_latency *odpl; |
@@ -206,28 +208,26 @@ static int _omap_device_deactivate(struct omap_device *od, u8 ignore_lat) | |||
206 | c = timespec_sub(b, a); | 208 | c = timespec_sub(b, a); |
207 | deact_lat = timespec_to_ns(&c); | 209 | deact_lat = timespec_to_ns(&c); |
208 | 210 | ||
209 | pr_debug("omap_device: %s: pm_lat %d: deactivate: elapsed time " | 211 | dev_dbg(&od->pdev->dev, |
210 | "%llu nsec\n", od->pdev.name, od->pm_lat_level, | 212 | "omap_device: pm_lat %d: deactivate: elapsed time " |
211 | deact_lat); | 213 | "%llu nsec\n", od->pm_lat_level, deact_lat); |
212 | 214 | ||
213 | if (deact_lat > odpl->deactivate_lat) { | 215 | if (deact_lat > odpl->deactivate_lat) { |
214 | odpl->deactivate_lat_worst = deact_lat; | 216 | odpl->deactivate_lat_worst = deact_lat; |
215 | if (odpl->flags & OMAP_DEVICE_LATENCY_AUTO_ADJUST) { | 217 | if (odpl->flags & OMAP_DEVICE_LATENCY_AUTO_ADJUST) { |
216 | odpl->deactivate_lat = deact_lat; | 218 | odpl->deactivate_lat = deact_lat; |
217 | pr_warning("omap_device: %s.%d: new worst case " | 219 | dev_dbg(&od->pdev->dev, |
218 | "deactivate latency %d: %llu\n", | 220 | "new worst case deactivate latency " |
219 | od->pdev.name, od->pdev.id, | 221 | "%d: %llu\n", |
220 | od->pm_lat_level, deact_lat); | 222 | od->pm_lat_level, deact_lat); |
221 | } else | 223 | } else |
222 | pr_warning("omap_device: %s.%d: deactivate " | 224 | dev_warn(&od->pdev->dev, |
223 | "latency %d higher than exptected. " | 225 | "deactivate latency %d " |
224 | "(%llu > %d)\n", | 226 | "higher than exptected. (%llu > %d)\n", |
225 | od->pdev.name, od->pdev.id, | 227 | od->pm_lat_level, deact_lat, |
226 | od->pm_lat_level, deact_lat, | 228 | odpl->deactivate_lat); |
227 | odpl->deactivate_lat); | ||
228 | } | 229 | } |
229 | 230 | ||
230 | |||
231 | od->dev_wakeup_lat += odpl->activate_lat; | 231 | od->dev_wakeup_lat += odpl->activate_lat; |
232 | 232 | ||
233 | od->pm_lat_level++; | 233 | od->pm_lat_level++; |
@@ -245,28 +245,27 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias, | |||
245 | if (!clk_alias || !clk_name) | 245 | if (!clk_alias || !clk_name) |
246 | return; | 246 | return; |
247 | 247 | ||
248 | pr_debug("omap_device: %s: Creating %s -> %s\n", | 248 | dev_dbg(&od->pdev->dev, "Creating %s -> %s\n", clk_alias, clk_name); |
249 | dev_name(&od->pdev.dev), clk_alias, clk_name); | ||
250 | 249 | ||
251 | r = clk_get_sys(dev_name(&od->pdev.dev), clk_alias); | 250 | r = clk_get_sys(dev_name(&od->pdev->dev), clk_alias); |
252 | if (!IS_ERR(r)) { | 251 | if (!IS_ERR(r)) { |
253 | pr_warning("omap_device: %s: alias %s already exists\n", | 252 | dev_warn(&od->pdev->dev, |
254 | dev_name(&od->pdev.dev), clk_alias); | 253 | "alias %s already exists\n", clk_alias); |
255 | clk_put(r); | 254 | clk_put(r); |
256 | return; | 255 | return; |
257 | } | 256 | } |
258 | 257 | ||
259 | r = omap_clk_get_by_name(clk_name); | 258 | r = omap_clk_get_by_name(clk_name); |
260 | if (IS_ERR(r)) { | 259 | if (IS_ERR(r)) { |
261 | pr_err("omap_device: %s: omap_clk_get_by_name for %s failed\n", | 260 | dev_err(&od->pdev->dev, |
262 | dev_name(&od->pdev.dev), clk_name); | 261 | "omap_clk_get_by_name for %s failed\n", clk_name); |
263 | return; | 262 | return; |
264 | } | 263 | } |
265 | 264 | ||
266 | l = clkdev_alloc(r, clk_alias, dev_name(&od->pdev.dev)); | 265 | l = clkdev_alloc(r, clk_alias, dev_name(&od->pdev->dev)); |
267 | if (!l) { | 266 | if (!l) { |
268 | pr_err("omap_device: %s: clkdev_alloc for %s failed\n", | 267 | dev_err(&od->pdev->dev, |
269 | dev_name(&od->pdev.dev), clk_alias); | 268 | "clkdev_alloc for %s failed\n", clk_alias); |
270 | return; | 269 | return; |
271 | } | 270 | } |
272 | 271 | ||
@@ -343,7 +342,7 @@ u32 omap_device_get_context_loss_count(struct platform_device *pdev) | |||
343 | * much memory to allocate before calling | 342 | * much memory to allocate before calling |
344 | * omap_device_fill_resources(). Returns the count. | 343 | * omap_device_fill_resources(). Returns the count. |
345 | */ | 344 | */ |
346 | int omap_device_count_resources(struct omap_device *od) | 345 | static int omap_device_count_resources(struct omap_device *od) |
347 | { | 346 | { |
348 | int c = 0; | 347 | int c = 0; |
349 | int i; | 348 | int i; |
@@ -352,7 +351,7 @@ int omap_device_count_resources(struct omap_device *od) | |||
352 | c += omap_hwmod_count_resources(od->hwmods[i]); | 351 | c += omap_hwmod_count_resources(od->hwmods[i]); |
353 | 352 | ||
354 | pr_debug("omap_device: %s: counted %d total resources across %d " | 353 | pr_debug("omap_device: %s: counted %d total resources across %d " |
355 | "hwmods\n", od->pdev.name, c, od->hwmods_cnt); | 354 | "hwmods\n", od->pdev->name, c, od->hwmods_cnt); |
356 | 355 | ||
357 | return c; | 356 | return c; |
358 | } | 357 | } |
@@ -374,7 +373,8 @@ int omap_device_count_resources(struct omap_device *od) | |||
374 | * functions to get device resources. Hacking around the existing | 373 | * functions to get device resources. Hacking around the existing |
375 | * platform_device code wastes memory. Returns 0. | 374 | * platform_device code wastes memory. Returns 0. |
376 | */ | 375 | */ |
377 | int omap_device_fill_resources(struct omap_device *od, struct resource *res) | 376 | static int omap_device_fill_resources(struct omap_device *od, |
377 | struct resource *res) | ||
378 | { | 378 | { |
379 | int c = 0; | 379 | int c = 0; |
380 | int i, r; | 380 | int i, r; |
@@ -405,7 +405,7 @@ int omap_device_fill_resources(struct omap_device *od, struct resource *res) | |||
405 | * information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise, | 405 | * information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise, |
406 | * passes along the return value of omap_device_build_ss(). | 406 | * passes along the return value of omap_device_build_ss(). |
407 | */ | 407 | */ |
408 | struct omap_device *omap_device_build(const char *pdev_name, int pdev_id, | 408 | struct platform_device *omap_device_build(const char *pdev_name, int pdev_id, |
409 | struct omap_hwmod *oh, void *pdata, | 409 | struct omap_hwmod *oh, void *pdata, |
410 | int pdata_len, | 410 | int pdata_len, |
411 | struct omap_device_pm_latency *pm_lats, | 411 | struct omap_device_pm_latency *pm_lats, |
@@ -438,15 +438,15 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id, | |||
438 | * platform_device record. Returns an ERR_PTR() on error, or passes | 438 | * platform_device record. Returns an ERR_PTR() on error, or passes |
439 | * along the return value of omap_device_register(). | 439 | * along the return value of omap_device_register(). |
440 | */ | 440 | */ |
441 | struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, | 441 | struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id, |
442 | struct omap_hwmod **ohs, int oh_cnt, | 442 | struct omap_hwmod **ohs, int oh_cnt, |
443 | void *pdata, int pdata_len, | 443 | void *pdata, int pdata_len, |
444 | struct omap_device_pm_latency *pm_lats, | 444 | struct omap_device_pm_latency *pm_lats, |
445 | int pm_lats_cnt, int is_early_device) | 445 | int pm_lats_cnt, int is_early_device) |
446 | { | 446 | { |
447 | int ret = -ENOMEM; | 447 | int ret = -ENOMEM; |
448 | struct platform_device *pdev; | ||
448 | struct omap_device *od; | 449 | struct omap_device *od; |
449 | char *pdev_name2; | ||
450 | struct resource *res = NULL; | 450 | struct resource *res = NULL; |
451 | int i, res_count; | 451 | int i, res_count; |
452 | struct omap_hwmod **hwmods; | 452 | struct omap_hwmod **hwmods; |
@@ -457,72 +457,76 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, | |||
457 | if (!pdata && pdata_len > 0) | 457 | if (!pdata && pdata_len > 0) |
458 | return ERR_PTR(-EINVAL); | 458 | return ERR_PTR(-EINVAL); |
459 | 459 | ||
460 | pdev = platform_device_alloc(pdev_name, pdev_id); | ||
461 | if (!pdev) { | ||
462 | ret = -ENOMEM; | ||
463 | goto odbs_exit; | ||
464 | } | ||
465 | |||
460 | pr_debug("omap_device: %s: building with %d hwmods\n", pdev_name, | 466 | pr_debug("omap_device: %s: building with %d hwmods\n", pdev_name, |
461 | oh_cnt); | 467 | oh_cnt); |
462 | 468 | ||
463 | od = kzalloc(sizeof(struct omap_device), GFP_KERNEL); | 469 | od = kzalloc(sizeof(struct omap_device), GFP_KERNEL); |
464 | if (!od) | 470 | if (!od) { |
465 | return ERR_PTR(-ENOMEM); | 471 | ret = -ENOMEM; |
466 | 472 | goto odbs_exit1; | |
473 | } | ||
467 | od->hwmods_cnt = oh_cnt; | 474 | od->hwmods_cnt = oh_cnt; |
468 | 475 | ||
469 | hwmods = kzalloc(sizeof(struct omap_hwmod *) * oh_cnt, | 476 | hwmods = kzalloc(sizeof(struct omap_hwmod *) * oh_cnt, |
470 | GFP_KERNEL); | 477 | GFP_KERNEL); |
471 | if (!hwmods) | 478 | if (!hwmods) |
472 | goto odbs_exit1; | 479 | goto odbs_exit2; |
473 | 480 | ||
474 | memcpy(hwmods, ohs, sizeof(struct omap_hwmod *) * oh_cnt); | 481 | memcpy(hwmods, ohs, sizeof(struct omap_hwmod *) * oh_cnt); |
475 | od->hwmods = hwmods; | 482 | od->hwmods = hwmods; |
476 | 483 | od->pdev = pdev; | |
477 | pdev_name2 = kzalloc(strlen(pdev_name) + 1, GFP_KERNEL); | ||
478 | if (!pdev_name2) | ||
479 | goto odbs_exit2; | ||
480 | strcpy(pdev_name2, pdev_name); | ||
481 | |||
482 | od->pdev.name = pdev_name2; | ||
483 | od->pdev.id = pdev_id; | ||
484 | 484 | ||
485 | res_count = omap_device_count_resources(od); | 485 | res_count = omap_device_count_resources(od); |
486 | if (res_count > 0) { | 486 | if (res_count > 0) { |
487 | res = kzalloc(sizeof(struct resource) * res_count, GFP_KERNEL); | 487 | res = kzalloc(sizeof(struct resource) * res_count, GFP_KERNEL); |
488 | if (!res) | 488 | if (!res) |
489 | goto odbs_exit3; | 489 | goto odbs_exit3; |
490 | } | ||
491 | omap_device_fill_resources(od, res); | ||
492 | 490 | ||
493 | od->pdev.num_resources = res_count; | 491 | omap_device_fill_resources(od, res); |
494 | od->pdev.resource = res; | 492 | |
493 | ret = platform_device_add_resources(pdev, res, res_count); | ||
494 | kfree(res); | ||
495 | 495 | ||
496 | ret = platform_device_add_data(&od->pdev, pdata, pdata_len); | 496 | if (ret) |
497 | goto odbs_exit3; | ||
498 | } | ||
499 | |||
500 | ret = platform_device_add_data(pdev, pdata, pdata_len); | ||
497 | if (ret) | 501 | if (ret) |
498 | goto odbs_exit4; | 502 | goto odbs_exit3; |
499 | 503 | ||
500 | od->pm_lats = pm_lats; | 504 | pdev->archdata.od = od; |
501 | od->pm_lats_cnt = pm_lats_cnt; | ||
502 | 505 | ||
503 | if (is_early_device) | 506 | if (is_early_device) |
504 | ret = omap_early_device_register(od); | 507 | ret = omap_early_device_register(pdev); |
505 | else | 508 | else |
506 | ret = omap_device_register(od); | 509 | ret = omap_device_register(pdev); |
510 | if (ret) | ||
511 | goto odbs_exit3; | ||
512 | |||
513 | od->pm_lats = pm_lats; | ||
514 | od->pm_lats_cnt = pm_lats_cnt; | ||
507 | 515 | ||
508 | for (i = 0; i < oh_cnt; i++) { | 516 | for (i = 0; i < oh_cnt; i++) { |
509 | hwmods[i]->od = od; | 517 | hwmods[i]->od = od; |
510 | _add_hwmod_clocks_clkdev(od, hwmods[i]); | 518 | _add_hwmod_clocks_clkdev(od, hwmods[i]); |
511 | } | 519 | } |
512 | 520 | ||
513 | if (ret) | 521 | return pdev; |
514 | goto odbs_exit4; | ||
515 | |||
516 | return od; | ||
517 | 522 | ||
518 | odbs_exit4: | ||
519 | kfree(res); | ||
520 | odbs_exit3: | 523 | odbs_exit3: |
521 | kfree(pdev_name2); | ||
522 | odbs_exit2: | ||
523 | kfree(hwmods); | 524 | kfree(hwmods); |
524 | odbs_exit1: | 525 | odbs_exit2: |
525 | kfree(od); | 526 | kfree(od); |
527 | odbs_exit1: | ||
528 | platform_device_put(pdev); | ||
529 | odbs_exit: | ||
526 | 530 | ||
527 | pr_err("omap_device: %s: build failed (%d)\n", pdev_name, ret); | 531 | pr_err("omap_device: %s: build failed (%d)\n", pdev_name, ret); |
528 | 532 | ||
@@ -538,11 +542,11 @@ odbs_exit1: | |||
538 | * platform_early_add_device() on the underlying platform_device. | 542 | * platform_early_add_device() on the underlying platform_device. |
539 | * Returns 0 by default. | 543 | * Returns 0 by default. |
540 | */ | 544 | */ |
541 | int omap_early_device_register(struct omap_device *od) | 545 | static int omap_early_device_register(struct platform_device *pdev) |
542 | { | 546 | { |
543 | struct platform_device *devices[1]; | 547 | struct platform_device *devices[1]; |
544 | 548 | ||
545 | devices[0] = &(od->pdev); | 549 | devices[0] = pdev; |
546 | early_platform_add_devices(devices, 1); | 550 | early_platform_add_devices(devices, 1); |
547 | return 0; | 551 | return 0; |
548 | } | 552 | } |
@@ -638,13 +642,13 @@ static struct dev_pm_domain omap_device_pm_domain = { | |||
638 | * platform_device_register() on the underlying platform_device. | 642 | * platform_device_register() on the underlying platform_device. |
639 | * Returns the return value of platform_device_register(). | 643 | * Returns the return value of platform_device_register(). |
640 | */ | 644 | */ |
641 | int omap_device_register(struct omap_device *od) | 645 | static int omap_device_register(struct platform_device *pdev) |
642 | { | 646 | { |
643 | pr_debug("omap_device: %s: registering\n", od->pdev.name); | 647 | pr_debug("omap_device: %s: registering\n", pdev->name); |
644 | 648 | ||
645 | od->pdev.dev.parent = &omap_device_parent; | 649 | pdev->dev.parent = &omap_device_parent; |
646 | od->pdev.dev.pm_domain = &omap_device_pm_domain; | 650 | pdev->dev.pm_domain = &omap_device_pm_domain; |
647 | return platform_device_register(&od->pdev); | 651 | return platform_device_add(pdev); |
648 | } | 652 | } |
649 | 653 | ||
650 | 654 | ||
@@ -671,8 +675,9 @@ int omap_device_enable(struct platform_device *pdev) | |||
671 | od = to_omap_device(pdev); | 675 | od = to_omap_device(pdev); |
672 | 676 | ||
673 | if (od->_state == OMAP_DEVICE_STATE_ENABLED) { | 677 | if (od->_state == OMAP_DEVICE_STATE_ENABLED) { |
674 | WARN(1, "omap_device: %s.%d: %s() called from invalid state %d\n", | 678 | dev_warn(&pdev->dev, |
675 | od->pdev.name, od->pdev.id, __func__, od->_state); | 679 | "omap_device: %s() called from invalid state %d\n", |
680 | __func__, od->_state); | ||
676 | return -EINVAL; | 681 | return -EINVAL; |
677 | } | 682 | } |
678 | 683 | ||
@@ -710,8 +715,9 @@ int omap_device_idle(struct platform_device *pdev) | |||
710 | od = to_omap_device(pdev); | 715 | od = to_omap_device(pdev); |
711 | 716 | ||
712 | if (od->_state != OMAP_DEVICE_STATE_ENABLED) { | 717 | if (od->_state != OMAP_DEVICE_STATE_ENABLED) { |
713 | WARN(1, "omap_device: %s.%d: %s() called from invalid state %d\n", | 718 | dev_warn(&pdev->dev, |
714 | od->pdev.name, od->pdev.id, __func__, od->_state); | 719 | "omap_device: %s() called from invalid state %d\n", |
720 | __func__, od->_state); | ||
715 | return -EINVAL; | 721 | return -EINVAL; |
716 | } | 722 | } |
717 | 723 | ||
@@ -742,8 +748,9 @@ int omap_device_shutdown(struct platform_device *pdev) | |||
742 | 748 | ||
743 | if (od->_state != OMAP_DEVICE_STATE_ENABLED && | 749 | if (od->_state != OMAP_DEVICE_STATE_ENABLED && |
744 | od->_state != OMAP_DEVICE_STATE_IDLE) { | 750 | od->_state != OMAP_DEVICE_STATE_IDLE) { |
745 | WARN(1, "omap_device: %s.%d: %s() called from invalid state %d\n", | 751 | dev_warn(&pdev->dev, |
746 | od->pdev.name, od->pdev.id, __func__, od->_state); | 752 | "omap_device: %s() called from invalid state %d\n", |
753 | __func__, od->_state); | ||
747 | return -EINVAL; | 754 | return -EINVAL; |
748 | } | 755 | } |
749 | 756 | ||