aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/Kconfig40
-rw-r--r--arch/arm/mach-omap2/Makefile24
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c14
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c45
-rwxr-xr-xarch/arm/mach-omap2/board-3630sdp.c101
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c27
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c86
-rw-r--r--arch/arm/mach-omap2/board-apollon.c16
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c507
-rw-r--r--arch/arm/mach-omap2/board-generic.c10
-rw-r--r--arch/arm/mach-omap2/board-h4.c20
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c251
-rw-r--r--arch/arm/mach-omap2/board-ldp.c16
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c16
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c41
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c191
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c115
-rw-r--r--arch/arm/mach-omap2/board-overo.c47
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c181
-rw-r--r--arch/arm/mach-omap2/board-rx51-sdram.c221
-rw-r--r--arch/arm/mach-omap2/board-rx51.c24
-rw-r--r--arch/arm/mach-omap2/board-zoom-debugboard.c72
-rwxr-xr-xarch/arm/mach-omap2/board-zoom-peripherals.c267
-rw-r--r--arch/arm/mach-omap2/board-zoom2.c241
-rw-r--r--arch/arm/mach-omap2/board-zoom3.c59
-rw-r--r--arch/arm/mach-omap2/clock.c10
-rw-r--r--arch/arm/mach-omap2/clock.h2
-rw-r--r--arch/arm/mach-omap2/clock24xx.c8
-rw-r--r--arch/arm/mach-omap2/clock34xx.c18
-rw-r--r--arch/arm/mach-omap2/clock34xx.h6
-rw-r--r--arch/arm/mach-omap2/clockdomain.c6
-rw-r--r--arch/arm/mach-omap2/clockdomains.h2
-rw-r--r--arch/arm/mach-omap2/cm.h6
-rw-r--r--arch/arm/mach-omap2/control.c385
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c318
-rw-r--r--arch/arm/mach-omap2/devices.c56
-rw-r--r--arch/arm/mach-omap2/emu.c66
-rw-r--r--arch/arm/mach-omap2/gpmc-onenand.c6
-rw-r--r--arch/arm/mach-omap2/gpmc-smc91x.c6
-rw-r--r--arch/arm/mach-omap2/gpmc.c106
-rw-r--r--arch/arm/mach-omap2/id.c165
-rw-r--r--arch/arm/mach-omap2/include/mach/board-zoom.h5
-rw-r--r--arch/arm/mach-omap2/include/mach/clkdev.h5
-rw-r--r--arch/arm/mach-omap2/include/mach/debug-macro.S59
-rw-r--r--arch/arm/mach-omap2/include/mach/entry-macro.S124
-rw-r--r--arch/arm/mach-omap2/include/mach/gpio.h5
-rw-r--r--arch/arm/mach-omap2/include/mach/hardware.h5
-rw-r--r--arch/arm/mach-omap2/include/mach/io.h5
-rw-r--r--arch/arm/mach-omap2/include/mach/irqs.h5
-rw-r--r--arch/arm/mach-omap2/include/mach/memory.h5
-rw-r--r--arch/arm/mach-omap2/include/mach/smp.h5
-rw-r--r--arch/arm/mach-omap2/include/mach/system.h5
-rw-r--r--arch/arm/mach-omap2/include/mach/timex.h5
-rw-r--r--arch/arm/mach-omap2/include/mach/uncompress.h5
-rw-r--r--arch/arm/mach-omap2/include/mach/vmalloc.h20
-rw-r--r--arch/arm/mach-omap2/io.c40
-rw-r--r--arch/arm/mach-omap2/iommu2.c2
-rw-r--r--arch/arm/mach-omap2/irq.c78
-rw-r--r--arch/arm/mach-omap2/mailbox.c144
-rw-r--r--arch/arm/mach-omap2/mcbsp.c8
-rw-r--r--arch/arm/mach-omap2/mmc-twl4030.c23
-rw-r--r--arch/arm/mach-omap2/mux.c19
-rw-r--r--arch/arm/mach-omap2/omap-smp.c29
-rw-r--r--arch/arm/mach-omap2/omap3-iommu.c64
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c28
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420.h6
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430.h6
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_34xx.h6
-rw-r--r--arch/arm/mach-omap2/pm-debug.c40
-rw-r--r--arch/arm/mach-omap2/pm.h16
-rw-r--r--arch/arm/mach-omap2/pm24xx.c16
-rw-r--r--arch/arm/mach-omap2/pm34xx.c426
-rw-r--r--arch/arm/mach-omap2/powerdomain.c6
-rw-r--r--arch/arm/mach-omap2/powerdomains.h2
-rw-r--r--arch/arm/mach-omap2/powerdomains24xx.h2
-rw-r--r--arch/arm/mach-omap2/powerdomains34xx.h10
-rw-r--r--arch/arm/mach-omap2/prcm.c411
-rw-r--r--arch/arm/mach-omap2/prm-regbits-34xx.h2
-rw-r--r--arch/arm/mach-omap2/prm.h6
-rw-r--r--arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h51
-rw-r--r--arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h2
-rw-r--r--arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h2
-rw-r--r--arch/arm/mach-omap2/sdrc.c35
-rw-r--r--arch/arm/mach-omap2/sdrc.h11
-rw-r--r--arch/arm/mach-omap2/sdrc2xxx.c8
-rw-r--r--arch/arm/mach-omap2/serial.c40
-rw-r--r--arch/arm/mach-omap2/sleep24xx.S2
-rw-r--r--arch/arm/mach-omap2/sleep34xx.S220
-rw-r--r--arch/arm/mach-omap2/sram242x.S4
-rw-r--r--arch/arm/mach-omap2/sram243x.S4
-rw-r--r--arch/arm/mach-omap2/timer-gp.c7
-rw-r--r--arch/arm/mach-omap2/usb-ehci.c192
-rw-r--r--arch/arm/mach-omap2/usb-musb.c4
-rw-r--r--arch/arm/mach-omap2/usb-tusb6010.c4
94 files changed, 5239 insertions, 793 deletions
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 75b1c7efae7e..7309aab305a9 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -65,6 +65,10 @@ config MACH_OMAP3EVM
65 bool "OMAP 3530 EVM board" 65 bool "OMAP 3530 EVM board"
66 depends on ARCH_OMAP3 && ARCH_OMAP34XX 66 depends on ARCH_OMAP3 && ARCH_OMAP34XX
67 67
68config MACH_OMAP3517EVM
69 bool "OMAP3517/ AM3517 EVM board"
70 depends on ARCH_OMAP3 && ARCH_OMAP34XX
71
68config MACH_OMAP3_PANDORA 72config MACH_OMAP3_PANDORA
69 bool "OMAP3 Pandora" 73 bool "OMAP3 Pandora"
70 depends on ARCH_OMAP3 && ARCH_OMAP34XX 74 depends on ARCH_OMAP3 && ARCH_OMAP34XX
@@ -73,9 +77,21 @@ config MACH_OMAP_3430SDP
73 bool "OMAP 3430 SDP board" 77 bool "OMAP 3430 SDP board"
74 depends on ARCH_OMAP3 && ARCH_OMAP34XX 78 depends on ARCH_OMAP3 && ARCH_OMAP34XX
75 79
80config MACH_NOKIA_N800
81 bool
82
83config MACH_NOKIA_N810
84 bool
85
86config MACH_NOKIA_N810_WIMAX
87 bool
88
76config MACH_NOKIA_N8X0 89config MACH_NOKIA_N8X0
77 bool "Nokia N800/N810" 90 bool "Nokia N800/N810"
78 depends on ARCH_OMAP2420 91 depends on ARCH_OMAP2420
92 select MACH_NOKIA_N800
93 select MACH_NOKIA_N810
94 select MACH_NOKIA_N810_WIMAX
79 95
80config MACH_NOKIA_RX51 96config MACH_NOKIA_RX51
81 bool "Nokia RX-51 board" 97 bool "Nokia RX-51 board"
@@ -85,6 +101,30 @@ config MACH_OMAP_ZOOM2
85 bool "OMAP3 Zoom2 board" 101 bool "OMAP3 Zoom2 board"
86 depends on ARCH_OMAP3 && ARCH_OMAP34XX 102 depends on ARCH_OMAP3 && ARCH_OMAP34XX
87 103
104config MACH_OMAP_ZOOM3
105 bool "OMAP3630 Zoom3 board"
106 depends on ARCH_OMAP3 && ARCH_OMAP34XX
107
108config MACH_CM_T35
109 bool "CompuLab CM-T35 module"
110 depends on ARCH_OMAP3 && ARCH_OMAP34XX
111
112config MACH_IGEP0020
113 bool "IGEP0020"
114 depends on ARCH_OMAP3 && ARCH_OMAP34XX
115
116config MACH_OMAP_3630SDP
117 bool "OMAP3630 SDP board"
118 depends on ARCH_OMAP3 && ARCH_OMAP34XX
119
88config MACH_OMAP_4430SDP 120config MACH_OMAP_4430SDP
89 bool "OMAP 4430 SDP board" 121 bool "OMAP 4430 SDP board"
90 depends on ARCH_OMAP4 122 depends on ARCH_OMAP4
123
124config OMAP3_EMU
125 bool "OMAP3 debugging peripherals"
126 depends on ARCH_OMAP3
127 select OC_ETM
128 help
129 Say Y here to enable debugging hardware of omap3
130
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 8cb16777661a..32548a4510c5 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -31,7 +31,7 @@ obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o
31ifeq ($(CONFIG_PM),y) 31ifeq ($(CONFIG_PM),y)
32obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o 32obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o
33obj-$(CONFIG_ARCH_OMAP24XX) += sleep24xx.o 33obj-$(CONFIG_ARCH_OMAP24XX) += sleep24xx.o
34obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o 34obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o cpuidle34xx.o
35obj-$(CONFIG_PM_DEBUG) += pm-debug.o 35obj-$(CONFIG_PM_DEBUG) += pm-debug.o
36endif 36endif
37 37
@@ -44,6 +44,12 @@ obj-$(CONFIG_ARCH_OMAP4) += cm4xxx.o
44obj-$(CONFIG_ARCH_OMAP2) += clock24xx.o 44obj-$(CONFIG_ARCH_OMAP2) += clock24xx.o
45obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o 45obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o
46 46
47# EMU peripherals
48obj-$(CONFIG_OMAP3_EMU) += emu.o
49
50obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o
51mailbox_mach-objs := mailbox.o
52
47iommu-y += iommu2.o 53iommu-y += iommu2.o
48iommu-$(CONFIG_ARCH_OMAP3) += omap3-iommu.o 54iommu-$(CONFIG_ARCH_OMAP3) += omap3-iommu.o
49 55
@@ -69,17 +75,33 @@ obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o \
69 mmc-twl4030.o 75 mmc-twl4030.o
70obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o 76obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o
71obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \ 77obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \
78 board-rx51-sdram.o \
72 board-rx51-peripherals.o \ 79 board-rx51-peripherals.o \
73 mmc-twl4030.o 80 mmc-twl4030.o
74obj-$(CONFIG_MACH_OMAP_ZOOM2) += board-zoom2.o \ 81obj-$(CONFIG_MACH_OMAP_ZOOM2) += board-zoom2.o \
82 board-zoom-peripherals.o \
83 mmc-twl4030.o \
84 board-zoom-debugboard.o
85obj-$(CONFIG_MACH_OMAP_ZOOM3) += board-zoom3.o \
86 board-zoom-peripherals.o \
75 mmc-twl4030.o \ 87 mmc-twl4030.o \
76 board-zoom-debugboard.o 88 board-zoom-debugboard.o
89obj-$(CONFIG_MACH_OMAP_3630SDP) += board-3630sdp.o \
90 board-zoom-peripherals.o \
91 mmc-twl4030.o
92obj-$(CONFIG_MACH_CM_T35) += board-cm-t35.o \
93 mmc-twl4030.o
94obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o \
95 mmc-twl4030.o
77 96
78obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o 97obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o
79 98
99obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o
100
80# Platform specific device init code 101# Platform specific device init code
81obj-y += usb-musb.o 102obj-y += usb-musb.o
82obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o 103obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o
104obj-y += usb-ehci.o
83 105
84onenand-$(CONFIG_MTD_ONENAND_OMAP2) := gpmc-onenand.o 106onenand-$(CONFIG_MTD_ONENAND_OMAP2) := gpmc-onenand.o
85obj-y += $(onenand-m) $(onenand-y) 107obj-y += $(onenand-m) $(onenand-y)
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index 42217b32f835..db9374bc528b 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -31,12 +31,12 @@
31#include <asm/mach/flash.h> 31#include <asm/mach/flash.h>
32 32
33#include <mach/gpio.h> 33#include <mach/gpio.h>
34#include <mach/mux.h> 34#include <plat/mux.h>
35#include <mach/board.h> 35#include <plat/board.h>
36#include <mach/common.h> 36#include <plat/common.h>
37#include <mach/gpmc.h> 37#include <plat/gpmc.h>
38#include <mach/usb.h> 38#include <plat/usb.h>
39#include <mach/gpmc-smc91x.h> 39#include <plat/gpmc-smc91x.h>
40 40
41#include "mmc-twl4030.h" 41#include "mmc-twl4030.h"
42 42
@@ -221,7 +221,7 @@ static void __init omap_2430sdp_map_io(void)
221MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board") 221MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
222 /* Maintainer: Syed Khasim - Texas Instruments Inc */ 222 /* Maintainer: Syed Khasim - Texas Instruments Inc */
223 .phys_io = 0x48000000, 223 .phys_io = 0x48000000,
224 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 224 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
225 .boot_params = 0x80000100, 225 .boot_params = 0x80000100,
226 .map_io = omap_2430sdp_map_io, 226 .map_io = omap_2430sdp_map_io,
227 .init_irq = omap_2430sdp_init_irq, 227 .init_irq = omap_2430sdp_init_irq,
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index efaf053eba85..491364e44c7d 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -17,6 +17,7 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/input.h> 19#include <linux/input.h>
20#include <linux/input/matrix_keypad.h>
20#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
21#include <linux/spi/ads7846.h> 22#include <linux/spi/ads7846.h>
22#include <linux/i2c/twl4030.h> 23#include <linux/i2c/twl4030.h>
@@ -29,17 +30,16 @@
29#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
30#include <asm/mach/map.h> 31#include <asm/mach/map.h>
31 32
32#include <mach/mcspi.h> 33#include <plat/mcspi.h>
33#include <mach/mux.h> 34#include <plat/mux.h>
34#include <mach/board.h> 35#include <plat/board.h>
35#include <mach/usb.h> 36#include <plat/usb.h>
36#include <mach/common.h> 37#include <plat/common.h>
37#include <mach/dma.h> 38#include <plat/dma.h>
38#include <mach/gpmc.h> 39#include <plat/gpmc.h>
39 40
40#include <mach/control.h> 41#include <plat/control.h>
41#include <mach/keypad.h> 42#include <plat/gpmc-smc91x.h>
42#include <mach/gpmc-smc91x.h>
43 43
44#include "sdram-qimonda-hyb18m512160af-6.h" 44#include "sdram-qimonda-hyb18m512160af-6.h"
45#include "mmc-twl4030.h" 45#include "mmc-twl4030.h"
@@ -410,6 +410,15 @@ static struct regulator_init_data sdp3430_vpll2 = {
410 .consumer_supplies = &sdp3430_vdvi_supply, 410 .consumer_supplies = &sdp3430_vdvi_supply,
411}; 411};
412 412
413static struct twl4030_codec_audio_data sdp3430_audio = {
414 .audio_mclk = 26000000,
415};
416
417static struct twl4030_codec_data sdp3430_codec = {
418 .audio_mclk = 26000000,
419 .audio = &sdp3430_audio,
420};
421
413static struct twl4030_platform_data sdp3430_twldata = { 422static struct twl4030_platform_data sdp3430_twldata = {
414 .irq_base = TWL4030_IRQ_BASE, 423 .irq_base = TWL4030_IRQ_BASE,
415 .irq_end = TWL4030_IRQ_END, 424 .irq_end = TWL4030_IRQ_END,
@@ -420,6 +429,7 @@ static struct twl4030_platform_data sdp3430_twldata = {
420 .madc = &sdp3430_madc_data, 429 .madc = &sdp3430_madc_data,
421 .keypad = &sdp3430_kp_data, 430 .keypad = &sdp3430_kp_data,
422 .usb = &sdp3430_usb_data, 431 .usb = &sdp3430_usb_data,
432 .codec = &sdp3430_codec,
423 433
424 .vaux1 = &sdp3430_vaux1, 434 .vaux1 = &sdp3430_vaux1,
425 .vaux2 = &sdp3430_vaux2, 435 .vaux2 = &sdp3430_vaux2,
@@ -484,6 +494,18 @@ static void enable_board_wakeup_source(void)
484 omap_cfg_reg(AF26_34XX_SYS_NIRQ); /* T2 interrupt line (keypad) */ 494 omap_cfg_reg(AF26_34XX_SYS_NIRQ); /* T2 interrupt line (keypad) */
485} 495}
486 496
497static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
498
499 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
500 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
501 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
502
503 .phy_reset = true,
504 .reset_gpio_port[0] = 57,
505 .reset_gpio_port[1] = 61,
506 .reset_gpio_port[2] = -EINVAL
507};
508
487static void __init omap_3430sdp_init(void) 509static void __init omap_3430sdp_init(void)
488{ 510{
489 omap3430_i2c_init(); 511 omap3430_i2c_init();
@@ -500,6 +522,7 @@ static void __init omap_3430sdp_init(void)
500 usb_musb_init(); 522 usb_musb_init();
501 board_smc91x_init(); 523 board_smc91x_init();
502 enable_board_wakeup_source(); 524 enable_board_wakeup_source();
525 usb_ehci_init(&ehci_pdata);
503} 526}
504 527
505static void __init omap_3430sdp_map_io(void) 528static void __init omap_3430sdp_map_io(void)
@@ -511,7 +534,7 @@ static void __init omap_3430sdp_map_io(void)
511MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board") 534MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
512 /* Maintainer: Syed Khasim - Texas Instruments Inc */ 535 /* Maintainer: Syed Khasim - Texas Instruments Inc */
513 .phys_io = 0x48000000, 536 .phys_io = 0x48000000,
514 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 537 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
515 .boot_params = 0x80000100, 538 .boot_params = 0x80000100,
516 .map_io = omap_3430sdp_map_io, 539 .map_io = omap_3430sdp_map_io,
517 .init_irq = omap_3430sdp_init_irq, 540 .init_irq = omap_3430sdp_init_irq,
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c
new file mode 100755
index 000000000000..348b70b98336
--- /dev/null
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -0,0 +1,101 @@
1/*
2 * Copyright (C) 2009 Texas Instruments Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include <linux/kernel.h>
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/input.h>
13#include <linux/gpio.h>
14
15#include <asm/mach-types.h>
16#include <asm/mach/arch.h>
17
18#include <plat/common.h>
19#include <plat/board.h>
20#include <plat/gpmc-smc91x.h>
21#include <plat/mux.h>
22#include <plat/usb.h>
23
24#include <mach/board-zoom.h>
25
26#include "sdram-hynix-h8mbx00u0mer-0em.h"
27
28#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
29
30static struct omap_smc91x_platform_data board_smc91x_data = {
31 .cs = 3,
32 .flags = GPMC_MUX_ADD_DATA | IORESOURCE_IRQ_LOWLEVEL,
33};
34
35static void __init board_smc91x_init(void)
36{
37 board_smc91x_data.gpio_irq = 158;
38 gpmc_smc91x_init(&board_smc91x_data);
39}
40
41#else
42
43static inline void board_smc91x_init(void)
44{
45}
46
47#endif /* defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) */
48
49static void enable_board_wakeup_source(void)
50{
51 omap_cfg_reg(AF26_34XX_SYS_NIRQ); /* T2 interrupt line (keypad) */
52}
53
54static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
55
56 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
57 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
58 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
59
60 .phy_reset = true,
61 .reset_gpio_port[0] = 126,
62 .reset_gpio_port[1] = 61,
63 .reset_gpio_port[2] = -EINVAL
64};
65
66static void __init omap_sdp_map_io(void)
67{
68 omap2_set_globals_343x();
69 omap2_map_common_io();
70}
71
72static struct omap_board_config_kernel sdp_config[] __initdata = {
73};
74
75static void __init omap_sdp_init_irq(void)
76{
77 omap_board_config = sdp_config;
78 omap_board_config_size = ARRAY_SIZE(sdp_config);
79 omap2_init_common_hw(h8mbx00u0mer0em_sdrc_params,
80 h8mbx00u0mer0em_sdrc_params);
81 omap_init_irq();
82 omap_gpio_init();
83}
84
85static void __init omap_sdp_init(void)
86{
87 zoom_peripherals_init();
88 board_smc91x_init();
89 enable_board_wakeup_source();
90 usb_ehci_init(&ehci_pdata);
91}
92
93MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
94 .phys_io = 0x48000000,
95 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
96 .boot_params = 0x80000100,
97 .map_io = omap_sdp_map_io,
98 .init_irq = omap_sdp_init_irq,
99 .init_machine = omap_sdp_init,
100 .timer = &omap_timer,
101MACHINE_END
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index eb37c40ea83a..0c6be6b4a7e2 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -23,10 +23,10 @@
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25 25
26#include <mach/board.h> 26#include <plat/board.h>
27#include <mach/common.h> 27#include <plat/common.h>
28#include <mach/control.h> 28#include <plat/control.h>
29#include <mach/timer-gp.h> 29#include <plat/timer-gp.h>
30#include <asm/hardware/gic.h> 30#include <asm/hardware/gic.h>
31 31
32static struct platform_device sdp4430_lcd_device = { 32static struct platform_device sdp4430_lcd_device = {
@@ -52,12 +52,23 @@ static struct omap_board_config_kernel sdp4430_config[] __initdata = {
52 52
53static void __init gic_init_irq(void) 53static void __init gic_init_irq(void)
54{ 54{
55 gic_dist_init(0, OMAP2_IO_ADDRESS(OMAP44XX_GIC_DIST_BASE), 29); 55 void __iomem *base;
56 gic_cpu_init(0, OMAP2_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE)); 56
57 /* Static mapping, never released */
58 base = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K);
59 BUG_ON(!base);
60 gic_dist_init(0, base, 29);
61
62 /* Static mapping, never released */
63 gic_cpu_base_addr = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
64 BUG_ON(!gic_cpu_base_addr);
65 gic_cpu_init(0, gic_cpu_base_addr);
57} 66}
58 67
59static void __init omap_4430sdp_init_irq(void) 68static void __init omap_4430sdp_init_irq(void)
60{ 69{
70 omap_board_config = sdp4430_config;
71 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
61 omap2_init_common_hw(NULL, NULL); 72 omap2_init_common_hw(NULL, NULL);
62#ifdef CONFIG_OMAP_32K_TIMER 73#ifdef CONFIG_OMAP_32K_TIMER
63 omap2_gp_clockevent_set_gptimer(1); 74 omap2_gp_clockevent_set_gptimer(1);
@@ -70,8 +81,6 @@ static void __init omap_4430sdp_init_irq(void)
70static void __init omap_4430sdp_init(void) 81static void __init omap_4430sdp_init(void)
71{ 82{
72 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); 83 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
73 omap_board_config = sdp4430_config;
74 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
75 omap_serial_init(); 84 omap_serial_init();
76} 85}
77 86
@@ -84,7 +93,7 @@ static void __init omap_4430sdp_map_io(void)
84MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board") 93MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
85 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */ 94 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
86 .phys_io = 0x48000000, 95 .phys_io = 0x48000000,
87 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 96 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
88 .boot_params = 0x80000100, 97 .boot_params = 0x80000100,
89 .map_io = omap_4430sdp_map_io, 98 .map_io = omap_4430sdp_map_io,
90 .init_irq = omap_4430sdp_init_irq, 99 .init_irq = omap_4430sdp_init_irq,
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
new file mode 100644
index 000000000000..415a13d767cc
--- /dev/null
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -0,0 +1,86 @@
1/*
2 * linux/arch/arm/mach-omap2/board-am3517evm.c
3 *
4 * Copyright (C) 2009 Texas Instruments Incorporated
5 * Author: Ranjith Lohithakshan <ranjithl@ti.com>
6 *
7 * Based on mach-omap2/board-omap3evm.c
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation version 2.
12 *
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
14 * whether express or implied; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 */
18
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/platform_device.h>
22#include <linux/gpio.h>
23
24#include <mach/hardware.h>
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27#include <asm/mach/map.h>
28
29#include <plat/board.h>
30#include <plat/common.h>
31#include <plat/usb.h>
32
33/*
34 * Board initialization
35 */
36static struct omap_board_config_kernel am3517_evm_config[] __initdata = {
37};
38
39static struct platform_device *am3517_evm_devices[] __initdata = {
40};
41
42static void __init am3517_evm_init_irq(void)
43{
44 omap_board_config = am3517_evm_config;
45 omap_board_config_size = ARRAY_SIZE(am3517_evm_config);
46
47 omap2_init_common_hw(NULL, NULL);
48 omap_init_irq();
49 omap_gpio_init();
50}
51
52static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
53 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
54 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
55 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
56
57 .phy_reset = true,
58 .reset_gpio_port[0] = 57,
59 .reset_gpio_port[1] = -EINVAL,
60 .reset_gpio_port[2] = -EINVAL
61};
62
63static void __init am3517_evm_init(void)
64{
65 platform_add_devices(am3517_evm_devices,
66 ARRAY_SIZE(am3517_evm_devices));
67
68 omap_serial_init();
69 usb_ehci_init(&ehci_pdata);
70}
71
72static void __init am3517_evm_map_io(void)
73{
74 omap2_set_globals_343x();
75 omap2_map_common_io();
76}
77
78MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
79 .phys_io = 0x48000000,
80 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
81 .boot_params = 0x80000100,
82 .map_io = am3517_evm_map_io,
83 .init_irq = am3517_evm_init_irq,
84 .init_machine = am3517_evm_init,
85 .timer = &omap_timer,
86MACHINE_END
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index a1132288c701..8a2ce77a02ec 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -33,13 +33,13 @@
33#include <asm/mach/flash.h> 33#include <asm/mach/flash.h>
34 34
35#include <mach/gpio.h> 35#include <mach/gpio.h>
36#include <mach/led.h> 36#include <plat/led.h>
37#include <mach/mux.h> 37#include <plat/mux.h>
38#include <mach/usb.h> 38#include <plat/usb.h>
39#include <mach/board.h> 39#include <plat/board.h>
40#include <mach/common.h> 40#include <plat/common.h>
41#include <mach/gpmc.h> 41#include <plat/gpmc.h>
42#include <mach/control.h> 42#include <plat/control.h>
43 43
44/* LED & Switch macros */ 44/* LED & Switch macros */
45#define LED0_GPIO13 13 45#define LED0_GPIO13 13
@@ -333,7 +333,7 @@ static void __init omap_apollon_map_io(void)
333MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon") 333MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon")
334 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */ 334 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
335 .phys_io = 0x48000000, 335 .phys_io = 0x48000000,
336 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 336 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
337 .boot_params = 0x80000100, 337 .boot_params = 0x80000100,
338 .map_io = omap_apollon_map_io, 338 .map_io = omap_apollon_map_io,
339 .init_irq = omap_apollon_init_irq, 339 .init_irq = omap_apollon_init_irq,
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
new file mode 100644
index 000000000000..22c45290db63
--- /dev/null
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -0,0 +1,507 @@
1/*
2 * board-cm-t35.c (CompuLab CM-T35 module)
3 *
4 * Copyright (C) 2009 CompuLab, Ltd.
5 * Author: Mike Rapoport <mike@compulab.co.il>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 *
21 */
22
23#include <linux/kernel.h>
24#include <linux/init.h>
25#include <linux/platform_device.h>
26#include <linux/input.h>
27#include <linux/input/matrix_keypad.h>
28#include <linux/delay.h>
29#include <linux/gpio.h>
30
31#include <linux/i2c/at24.h>
32#include <linux/i2c/twl4030.h>
33#include <linux/regulator/machine.h>
34
35#include <asm/mach-types.h>
36#include <asm/mach/arch.h>
37#include <asm/mach/map.h>
38
39#include <plat/board.h>
40#include <plat/common.h>
41#include <plat/mux.h>
42#include <plat/nand.h>
43#include <plat/gpmc.h>
44#include <plat/usb.h>
45
46#include <mach/hardware.h>
47
48#include "sdram-micron-mt46h32m32lf-6.h"
49#include "mmc-twl4030.h"
50
51#define CM_T35_GPIO_PENDOWN 57
52
53#define CM_T35_SMSC911X_CS 5
54#define CM_T35_SMSC911X_GPIO 163
55#define SB_T35_SMSC911X_CS 4
56#define SB_T35_SMSC911X_GPIO 65
57
58#define NAND_BLOCK_SIZE SZ_128K
59#define GPMC_CS0_BASE 0x60
60#define GPMC_CS0_BASE_ADDR (OMAP34XX_GPMC_VIRT + GPMC_CS0_BASE)
61
62#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
63#include <linux/smsc911x.h>
64
65static struct smsc911x_platform_config cm_t35_smsc911x_config = {
66 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
67 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
68 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
69 .phy_interface = PHY_INTERFACE_MODE_MII,
70};
71
72static struct resource cm_t35_smsc911x_resources[] = {
73 {
74 .flags = IORESOURCE_MEM,
75 },
76 {
77 .start = OMAP_GPIO_IRQ(CM_T35_SMSC911X_GPIO),
78 .end = OMAP_GPIO_IRQ(CM_T35_SMSC911X_GPIO),
79 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
80 },
81};
82
83static struct platform_device cm_t35_smsc911x_device = {
84 .name = "smsc911x",
85 .id = 0,
86 .num_resources = ARRAY_SIZE(cm_t35_smsc911x_resources),
87 .resource = cm_t35_smsc911x_resources,
88 .dev = {
89 .platform_data = &cm_t35_smsc911x_config,
90 },
91};
92
93static struct resource sb_t35_smsc911x_resources[] = {
94 {
95 .flags = IORESOURCE_MEM,
96 },
97 {
98 .start = OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO),
99 .end = OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO),
100 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
101 },
102};
103
104static struct platform_device sb_t35_smsc911x_device = {
105 .name = "smsc911x",
106 .id = 1,
107 .num_resources = ARRAY_SIZE(sb_t35_smsc911x_resources),
108 .resource = sb_t35_smsc911x_resources,
109 .dev = {
110 .platform_data = &cm_t35_smsc911x_config,
111 },
112};
113
114static void __init cm_t35_init_smsc911x(struct platform_device *dev,
115 int cs, int irq_gpio)
116{
117 unsigned long cs_mem_base;
118
119 if (gpmc_cs_request(cs, SZ_16M, &cs_mem_base) < 0) {
120 pr_err("CM-T35: Failed request for GPMC mem for smsc911x\n");
121 return;
122 }
123
124 dev->resource[0].start = cs_mem_base + 0x0;
125 dev->resource[0].end = cs_mem_base + 0xff;
126
127 if ((gpio_request(irq_gpio, "ETH IRQ") == 0) &&
128 (gpio_direction_input(irq_gpio) == 0)) {
129 gpio_export(irq_gpio, 0);
130 } else {
131 pr_err("CM-T35: could not obtain gpio for SMSC911X IRQ\n");
132 return;
133 }
134
135 platform_device_register(dev);
136}
137
138static void __init cm_t35_init_ethernet(void)
139{
140 cm_t35_init_smsc911x(&cm_t35_smsc911x_device,
141 CM_T35_SMSC911X_CS, CM_T35_SMSC911X_GPIO);
142 cm_t35_init_smsc911x(&sb_t35_smsc911x_device,
143 SB_T35_SMSC911X_CS, SB_T35_SMSC911X_GPIO);
144}
145#else
146static inline void __init cm_t35_init_ethernet(void) { return; }
147#endif
148
149#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
150#include <linux/leds.h>
151
152static struct gpio_led cm_t35_leds[] = {
153 [0] = {
154 .gpio = 186,
155 .name = "cm-t35:green",
156 .default_trigger = "heartbeat",
157 .active_low = 0,
158 },
159};
160
161static struct gpio_led_platform_data cm_t35_led_pdata = {
162 .num_leds = ARRAY_SIZE(cm_t35_leds),
163 .leds = cm_t35_leds,
164};
165
166static struct platform_device cm_t35_led_device = {
167 .name = "leds-gpio",
168 .id = -1,
169 .dev = {
170 .platform_data = &cm_t35_led_pdata,
171 },
172};
173
174static void __init cm_t35_init_led(void)
175{
176 platform_device_register(&cm_t35_led_device);
177}
178#else
179static inline void cm_t35_init_led(void) {}
180#endif
181
182#if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
183#include <linux/mtd/mtd.h>
184#include <linux/mtd/nand.h>
185#include <linux/mtd/partitions.h>
186
187static struct mtd_partition cm_t35_nand_partitions[] = {
188 {
189 .name = "xloader",
190 .offset = 0, /* Offset = 0x00000 */
191 .size = 4 * NAND_BLOCK_SIZE,
192 .mask_flags = MTD_WRITEABLE
193 },
194 {
195 .name = "uboot",
196 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
197 .size = 15 * NAND_BLOCK_SIZE,
198 },
199 {
200 .name = "uboot environment",
201 .offset = MTDPART_OFS_APPEND, /* Offset = 0x260000 */
202 .size = 2 * NAND_BLOCK_SIZE,
203 },
204 {
205 .name = "linux",
206 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
207 .size = 32 * NAND_BLOCK_SIZE,
208 },
209 {
210 .name = "rootfs",
211 .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */
212 .size = MTDPART_SIZ_FULL,
213 },
214};
215
216static struct omap_nand_platform_data cm_t35_nand_data = {
217 .parts = cm_t35_nand_partitions,
218 .nr_parts = ARRAY_SIZE(cm_t35_nand_partitions),
219 .dma_channel = -1, /* disable DMA in OMAP NAND driver */
220 .cs = 0,
221 .gpmc_cs_baseaddr = (void __iomem *)GPMC_CS0_BASE_ADDR,
222 .gpmc_baseaddr = (void __iomem *)OMAP34XX_GPMC_VIRT,
223
224};
225
226static struct resource cm_t35_nand_resource = {
227 .flags = IORESOURCE_MEM,
228};
229
230static struct platform_device cm_t35_nand_device = {
231 .name = "omap2-nand",
232 .id = -1,
233 .num_resources = 1,
234 .resource = &cm_t35_nand_resource,
235 .dev = {
236 .platform_data = &cm_t35_nand_data,
237 },
238};
239
240static void __init cm_t35_init_nand(void)
241{
242 if (platform_device_register(&cm_t35_nand_device) < 0)
243 pr_err("CM-T35: Unable to register NAND device\n");
244}
245#else
246static inline void cm_t35_init_nand(void) {}
247#endif
248
249#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
250 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
251#include <linux/spi/spi.h>
252#include <linux/spi/ads7846.h>
253
254#include <plat/mcspi.h>
255
256static struct omap2_mcspi_device_config ads7846_mcspi_config = {
257 .turbo_mode = 0,
258 .single_channel = 1, /* 0: slave, 1: master */
259};
260
261static int ads7846_get_pendown_state(void)
262{
263 return !gpio_get_value(CM_T35_GPIO_PENDOWN);
264}
265
266static struct ads7846_platform_data ads7846_config = {
267 .x_max = 0x0fff,
268 .y_max = 0x0fff,
269 .x_plate_ohms = 180,
270 .pressure_max = 255,
271 .debounce_max = 10,
272 .debounce_tol = 3,
273 .debounce_rep = 1,
274 .get_pendown_state = ads7846_get_pendown_state,
275 .keep_vref_on = 1,
276};
277
278static struct spi_board_info cm_t35_spi_board_info[] __initdata = {
279 {
280 .modalias = "ads7846",
281 .bus_num = 1,
282 .chip_select = 0,
283 .max_speed_hz = 1500000,
284 .controller_data = &ads7846_mcspi_config,
285 .irq = OMAP_GPIO_IRQ(CM_T35_GPIO_PENDOWN),
286 .platform_data = &ads7846_config,
287 },
288};
289
290static void __init cm_t35_init_ads7846(void)
291{
292 if ((gpio_request(CM_T35_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) &&
293 (gpio_direction_input(CM_T35_GPIO_PENDOWN) == 0)) {
294 gpio_export(CM_T35_GPIO_PENDOWN, 0);
295 } else {
296 pr_err("CM-T35: could not obtain gpio for ADS7846_PENDOWN\n");
297 return;
298 }
299
300 spi_register_board_info(cm_t35_spi_board_info,
301 ARRAY_SIZE(cm_t35_spi_board_info));
302}
303#else
304static inline void cm_t35_init_ads7846(void) {}
305#endif
306
307static struct regulator_consumer_supply cm_t35_vmmc1_supply = {
308 .supply = "vmmc",
309};
310
311static struct regulator_consumer_supply cm_t35_vsim_supply = {
312 .supply = "vmmc_aux",
313};
314
315/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
316static struct regulator_init_data cm_t35_vmmc1 = {
317 .constraints = {
318 .min_uV = 1850000,
319 .max_uV = 3150000,
320 .valid_modes_mask = REGULATOR_MODE_NORMAL
321 | REGULATOR_MODE_STANDBY,
322 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
323 | REGULATOR_CHANGE_MODE
324 | REGULATOR_CHANGE_STATUS,
325 },
326 .num_consumer_supplies = 1,
327 .consumer_supplies = &cm_t35_vmmc1_supply,
328};
329
330/* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
331static struct regulator_init_data cm_t35_vsim = {
332 .constraints = {
333 .min_uV = 1800000,
334 .max_uV = 3000000,
335 .valid_modes_mask = REGULATOR_MODE_NORMAL
336 | REGULATOR_MODE_STANDBY,
337 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
338 | REGULATOR_CHANGE_MODE
339 | REGULATOR_CHANGE_STATUS,
340 },
341 .num_consumer_supplies = 1,
342 .consumer_supplies = &cm_t35_vsim_supply,
343};
344
345static struct twl4030_usb_data cm_t35_usb_data = {
346 .usb_mode = T2_USB_MODE_ULPI,
347};
348
349static int cm_t35_keymap[] = {
350 KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_LEFT),
351 KEY(1, 0, KEY_UP), KEY(1, 1, KEY_ENTER), KEY(1, 2, KEY_DOWN),
352 KEY(2, 0, KEY_RIGHT), KEY(2, 1, KEY_C), KEY(2, 2, KEY_D),
353};
354
355static struct matrix_keymap_data cm_t35_keymap_data = {
356 .keymap = cm_t35_keymap,
357 .keymap_size = ARRAY_SIZE(cm_t35_keymap),
358};
359
360static struct twl4030_keypad_data cm_t35_kp_data = {
361 .keymap_data = &cm_t35_keymap_data,
362 .rows = 3,
363 .cols = 3,
364 .rep = 1,
365};
366
367static struct twl4030_hsmmc_info mmc[] = {
368 {
369 .mmc = 1,
370 .wires = 4,
371 .gpio_cd = -EINVAL,
372 .gpio_wp = -EINVAL,
373
374 },
375 {
376 .mmc = 2,
377 .wires = 4,
378 .transceiver = 1,
379 .gpio_cd = -EINVAL,
380 .gpio_wp = -EINVAL,
381 .ocr_mask = 0x00100000, /* 3.3V */
382 },
383 {} /* Terminator */
384};
385
386static struct ehci_hcd_omap_platform_data ehci_pdata = {
387 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
388 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
389 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
390
391 .phy_reset = true,
392 .reset_gpio_port[0] = -EINVAL,
393 .reset_gpio_port[1] = -EINVAL,
394 .reset_gpio_port[2] = -EINVAL
395};
396
397static int cm_t35_twl_gpio_setup(struct device *dev, unsigned gpio,
398 unsigned ngpio)
399{
400 int wlan_rst = gpio + 2;
401
402 if ((gpio_request(wlan_rst, "WLAN RST") == 0) &&
403 (gpio_direction_output(wlan_rst, 1) == 0)) {
404 gpio_export(wlan_rst, 0);
405
406 udelay(10);
407 gpio_set_value(wlan_rst, 0);
408 udelay(10);
409 gpio_set_value(wlan_rst, 1);
410 } else {
411 pr_err("CM-T35: could not obtain gpio for WiFi reset\n");
412 }
413
414 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
415 mmc[0].gpio_cd = gpio + 0;
416 twl4030_mmc_init(mmc);
417
418 /* link regulators to MMC adapters */
419 cm_t35_vmmc1_supply.dev = mmc[0].dev;
420 cm_t35_vsim_supply.dev = mmc[0].dev;
421
422 /* setup USB with proper PHY reset GPIOs */
423 ehci_pdata.reset_gpio_port[0] = gpio + 6;
424 ehci_pdata.reset_gpio_port[1] = gpio + 7;
425
426 usb_ehci_init(&ehci_pdata);
427
428 return 0;
429}
430
431static struct twl4030_gpio_platform_data cm_t35_gpio_data = {
432 .gpio_base = OMAP_MAX_GPIO_LINES,
433 .irq_base = TWL4030_GPIO_IRQ_BASE,
434 .irq_end = TWL4030_GPIO_IRQ_END,
435 .setup = cm_t35_twl_gpio_setup,
436};
437
438static struct twl4030_platform_data cm_t35_twldata = {
439 .irq_base = TWL4030_IRQ_BASE,
440 .irq_end = TWL4030_IRQ_END,
441
442 /* platform_data for children goes here */
443 .keypad = &cm_t35_kp_data,
444 .usb = &cm_t35_usb_data,
445 .gpio = &cm_t35_gpio_data,
446 .vmmc1 = &cm_t35_vmmc1,
447 .vsim = &cm_t35_vsim,
448};
449
450static struct i2c_board_info __initdata cm_t35_i2c_boardinfo[] = {
451 {
452 I2C_BOARD_INFO("tps65930", 0x48),
453 .flags = I2C_CLIENT_WAKE,
454 .irq = INT_34XX_SYS_NIRQ,
455 .platform_data = &cm_t35_twldata,
456 },
457};
458
459static void __init cm_t35_init_i2c(void)
460{
461 omap_register_i2c_bus(1, 2600, cm_t35_i2c_boardinfo,
462 ARRAY_SIZE(cm_t35_i2c_boardinfo));
463}
464
465static struct omap_board_config_kernel cm_t35_config[] __initdata = {
466};
467
468static void __init cm_t35_init_irq(void)
469{
470 omap_board_config = cm_t35_config;
471 omap_board_config_size = ARRAY_SIZE(cm_t35_config);
472
473 omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
474 mt46h32m32lf6_sdrc_params);
475 omap_init_irq();
476 omap_gpio_init();
477}
478
479static void __init cm_t35_map_io(void)
480{
481 omap2_set_globals_343x();
482 omap2_map_common_io();
483}
484
485static void __init cm_t35_init(void)
486{
487 omap_serial_init();
488 cm_t35_init_i2c();
489 cm_t35_init_nand();
490 cm_t35_init_ads7846();
491 cm_t35_init_ethernet();
492 cm_t35_init_led();
493
494 usb_musb_init();
495
496 omap_cfg_reg(AF26_34XX_SYS_NIRQ);
497}
498
499MACHINE_START(CM_T35, "Compulab CM-T35")
500 .phys_io = 0x48000000,
501 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
502 .boot_params = 0x80000100,
503 .map_io = cm_t35_map_io,
504 .init_irq = cm_t35_init_irq,
505 .init_machine = cm_t35_init,
506 .timer = &omap_timer,
507MACHINE_END
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 2e09a1c444cb..7e6e6ca88be5 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -26,10 +26,10 @@
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27 27
28#include <mach/gpio.h> 28#include <mach/gpio.h>
29#include <mach/mux.h> 29#include <plat/mux.h>
30#include <mach/usb.h> 30#include <plat/usb.h>
31#include <mach/board.h> 31#include <plat/board.h>
32#include <mach/common.h> 32#include <plat/common.h>
33 33
34static struct omap_board_config_kernel generic_config[] = { 34static struct omap_board_config_kernel generic_config[] = {
35}; 35};
@@ -56,7 +56,7 @@ static void __init omap_generic_map_io(void)
56MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx") 56MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
57 /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */ 57 /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
58 .phys_io = 0x48000000, 58 .phys_io = 0x48000000,
59 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 59 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
60 .boot_params = 0x80000100, 60 .boot_params = 0x80000100,
61 .map_io = omap_generic_map_io, 61 .map_io = omap_generic_map_io,
62 .init_irq = omap_generic_init_irq, 62 .init_irq = omap_generic_init_irq,
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index eaa02d012c5c..cfb7f1257d20 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -31,16 +31,16 @@
31#include <asm/mach/map.h> 31#include <asm/mach/map.h>
32#include <asm/mach/flash.h> 32#include <asm/mach/flash.h>
33 33
34#include <mach/control.h> 34#include <plat/control.h>
35#include <mach/gpio.h> 35#include <mach/gpio.h>
36#include <mach/mux.h> 36#include <plat/mux.h>
37#include <mach/usb.h> 37#include <plat/usb.h>
38#include <mach/board.h> 38#include <plat/board.h>
39#include <mach/common.h> 39#include <plat/common.h>
40#include <mach/keypad.h> 40#include <plat/keypad.h>
41#include <mach/menelaus.h> 41#include <plat/menelaus.h>
42#include <mach/dma.h> 42#include <plat/dma.h>
43#include <mach/gpmc.h> 43#include <plat/gpmc.h>
44 44
45#define H4_FLASH_CS 0 45#define H4_FLASH_CS 0
46#define H4_SMC91X_CS 1 46#define H4_SMC91X_CS 1
@@ -376,7 +376,7 @@ static void __init omap_h4_map_io(void)
376MACHINE_START(OMAP_H4, "OMAP2420 H4 board") 376MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
377 /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */ 377 /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
378 .phys_io = 0x48000000, 378 .phys_io = 0x48000000,
379 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 379 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
380 .boot_params = 0x80000100, 380 .boot_params = 0x80000100,
381 .map_io = omap_h4_map_io, 381 .map_io = omap_h4_map_io,
382 .init_irq = omap_h4_init_irq, 382 .init_irq = omap_h4_init_irq,
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
new file mode 100644
index 000000000000..fa62e80c13b7
--- /dev/null
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -0,0 +1,251 @@
1/*
2 * Copyright (C) 2009 Integration Software and Electronic Engineering.
3 *
4 * Modified from mach-omap2/board-generic.c
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/delay.h>
15#include <linux/err.h>
16#include <linux/clk.h>
17#include <linux/io.h>
18#include <linux/gpio.h>
19#include <linux/interrupt.h>
20
21#include <linux/regulator/machine.h>
22#include <linux/i2c/twl4030.h>
23
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26
27#include <plat/board.h>
28#include <plat/common.h>
29#include <plat/gpmc.h>
30#include <plat/mux.h>
31#include <plat/usb.h>
32
33#include "mmc-twl4030.h"
34
35#define IGEP2_SMSC911X_CS 5
36#define IGEP2_SMSC911X_GPIO 176
37#define IGEP2_GPIO_USBH_NRESET 24
38#define IGEP2_GPIO_LED0_RED 26
39#define IGEP2_GPIO_LED0_GREEN 27
40#define IGEP2_GPIO_LED1_RED 28
41
42#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
43
44#include <linux/smsc911x.h>
45
46static struct smsc911x_platform_config igep2_smsc911x_config = {
47 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
48 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
49 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS ,
50 .phy_interface = PHY_INTERFACE_MODE_MII,
51};
52
53static struct resource igep2_smsc911x_resources[] = {
54 {
55 .flags = IORESOURCE_MEM,
56 },
57 {
58 .start = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
59 .end = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
60 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
61 },
62};
63
64static struct platform_device igep2_smsc911x_device = {
65 .name = "smsc911x",
66 .id = 0,
67 .num_resources = ARRAY_SIZE(igep2_smsc911x_resources),
68 .resource = igep2_smsc911x_resources,
69 .dev = {
70 .platform_data = &igep2_smsc911x_config,
71 },
72};
73
74static inline void __init igep2_init_smsc911x(void)
75{
76 unsigned long cs_mem_base;
77
78 if (gpmc_cs_request(IGEP2_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
79 pr_err("IGEP v2: Failed request for GPMC mem for smsc911x\n");
80 gpmc_cs_free(IGEP2_SMSC911X_CS);
81 return;
82 }
83
84 igep2_smsc911x_resources[0].start = cs_mem_base + 0x0;
85 igep2_smsc911x_resources[0].end = cs_mem_base + 0xff;
86
87 if ((gpio_request(IGEP2_SMSC911X_GPIO, "SMSC911X IRQ") == 0) &&
88 (gpio_direction_input(IGEP2_SMSC911X_GPIO) == 0)) {
89 gpio_export(IGEP2_SMSC911X_GPIO, 0);
90 } else {
91 pr_err("IGEP v2: Could not obtain gpio for for SMSC911X IRQ\n");
92 return;
93 }
94
95 platform_device_register(&igep2_smsc911x_device);
96}
97
98#else
99static inline void __init igep2_init_smsc911x(void) { }
100#endif
101
102static struct omap_board_config_kernel igep2_config[] __initdata = {
103};
104
105static struct regulator_consumer_supply igep2_vmmc1_supply = {
106 .supply = "vmmc",
107};
108
109/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
110static struct regulator_init_data igep2_vmmc1 = {
111 .constraints = {
112 .min_uV = 1850000,
113 .max_uV = 3150000,
114 .valid_modes_mask = REGULATOR_MODE_NORMAL
115 | REGULATOR_MODE_STANDBY,
116 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
117 | REGULATOR_CHANGE_MODE
118 | REGULATOR_CHANGE_STATUS,
119 },
120 .num_consumer_supplies = 1,
121 .consumer_supplies = &igep2_vmmc1_supply,
122};
123
124static struct twl4030_hsmmc_info mmc[] = {
125 {
126 .mmc = 1,
127 .wires = 4,
128 .gpio_cd = -EINVAL,
129 .gpio_wp = -EINVAL,
130 },
131 {
132 .mmc = 2,
133 .wires = 4,
134 .gpio_cd = -EINVAL,
135 .gpio_wp = -EINVAL,
136 },
137 {} /* Terminator */
138};
139
140static int igep2_twl_gpio_setup(struct device *dev,
141 unsigned gpio, unsigned ngpio)
142{
143 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
144 mmc[0].gpio_cd = gpio + 0;
145 twl4030_mmc_init(mmc);
146
147 /* link regulators to MMC adapters ... we "know" the
148 * regulators will be set up only *after* we return.
149 */
150 igep2_vmmc1_supply.dev = mmc[0].dev;
151
152 return 0;
153};
154
155static struct twl4030_gpio_platform_data igep2_gpio_data = {
156 .gpio_base = OMAP_MAX_GPIO_LINES,
157 .irq_base = TWL4030_GPIO_IRQ_BASE,
158 .irq_end = TWL4030_GPIO_IRQ_END,
159 .use_leds = false,
160 .setup = igep2_twl_gpio_setup,
161};
162
163static struct twl4030_usb_data igep2_usb_data = {
164 .usb_mode = T2_USB_MODE_ULPI,
165};
166
167static void __init igep2_init_irq(void)
168{
169 omap_board_config = igep2_config;
170 omap_board_config_size = ARRAY_SIZE(igep2_config);
171 omap2_init_common_hw(NULL, NULL);
172 omap_init_irq();
173 omap_gpio_init();
174}
175
176static struct twl4030_platform_data igep2_twldata = {
177 .irq_base = TWL4030_IRQ_BASE,
178 .irq_end = TWL4030_IRQ_END,
179
180 /* platform_data for children goes here */
181 .usb = &igep2_usb_data,
182 .gpio = &igep2_gpio_data,
183 .vmmc1 = &igep2_vmmc1,
184
185};
186
187static struct i2c_board_info __initdata igep2_i2c_boardinfo[] = {
188 {
189 I2C_BOARD_INFO("twl4030", 0x48),
190 .flags = I2C_CLIENT_WAKE,
191 .irq = INT_34XX_SYS_NIRQ,
192 .platform_data = &igep2_twldata,
193 },
194};
195
196static int __init igep2_i2c_init(void)
197{
198 omap_register_i2c_bus(1, 2600, igep2_i2c_boardinfo,
199 ARRAY_SIZE(igep2_i2c_boardinfo));
200 /* Bus 3 is attached to the DVI port where devices like the pico DLP
201 * projector don't work reliably with 400kHz */
202 omap_register_i2c_bus(3, 100, NULL, 0);
203 return 0;
204}
205
206static void __init igep2_init(void)
207{
208 igep2_i2c_init();
209 omap_serial_init();
210 usb_musb_init();
211
212 igep2_init_smsc911x();
213
214 /* GPIO userspace leds */
215 if ((gpio_request(IGEP2_GPIO_LED0_RED, "GPIO_LED0_RED") == 0) &&
216 (gpio_direction_output(IGEP2_GPIO_LED0_RED, 1) == 0)) {
217 gpio_export(IGEP2_GPIO_LED0_RED, 0);
218 gpio_set_value(IGEP2_GPIO_LED0_RED, 0);
219 } else
220 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_RED\n");
221
222 if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "GPIO_LED0_GREEN") == 0) &&
223 (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 1) == 0)) {
224 gpio_export(IGEP2_GPIO_LED0_GREEN, 0);
225 gpio_set_value(IGEP2_GPIO_LED0_GREEN, 0);
226 } else
227 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n");
228
229 if ((gpio_request(IGEP2_GPIO_LED1_RED, "GPIO_LED1_RED") == 0) &&
230 (gpio_direction_output(IGEP2_GPIO_LED1_RED, 1) == 0)) {
231 gpio_export(IGEP2_GPIO_LED1_RED, 0);
232 gpio_set_value(IGEP2_GPIO_LED1_RED, 0);
233 } else
234 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n");
235}
236
237static void __init igep2_map_io(void)
238{
239 omap2_set_globals_343x();
240 omap2_map_common_io();
241}
242
243MACHINE_START(IGEP0020, "IGEP v2 board")
244 .phys_io = 0x48000000,
245 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
246 .boot_params = 0x80000100,
247 .map_io = igep2_map_io,
248 .init_irq = igep2_init_irq,
249 .init_machine = igep2_init,
250 .timer = &omap_timer,
251MACHINE_END
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index d110a7fdfbd8..c062238fe881 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -16,6 +16,7 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/input.h> 18#include <linux/input.h>
19#include <linux/input/matrix_keypad.h>
19#include <linux/gpio_keys.h> 20#include <linux/gpio_keys.h>
20#include <linux/workqueue.h> 21#include <linux/workqueue.h>
21#include <linux/err.h> 22#include <linux/err.h>
@@ -32,16 +33,15 @@
32#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
33#include <asm/mach/map.h> 34#include <asm/mach/map.h>
34 35
35#include <mach/mcspi.h> 36#include <plat/mcspi.h>
36#include <mach/gpio.h> 37#include <mach/gpio.h>
37#include <mach/board.h> 38#include <plat/board.h>
38#include <mach/common.h> 39#include <plat/common.h>
39#include <mach/gpmc.h> 40#include <plat/gpmc.h>
40 41
41#include <asm/delay.h> 42#include <asm/delay.h>
42#include <mach/control.h> 43#include <plat/control.h>
43#include <mach/usb.h> 44#include <plat/usb.h>
44#include <mach/keypad.h>
45 45
46#include "mmc-twl4030.h" 46#include "mmc-twl4030.h"
47 47
@@ -399,7 +399,7 @@ static void __init omap_ldp_map_io(void)
399 399
400MACHINE_START(OMAP_LDP, "OMAP LDP board") 400MACHINE_START(OMAP_LDP, "OMAP LDP board")
401 .phys_io = 0x48000000, 401 .phys_io = 0x48000000,
402 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 402 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
403 .boot_params = 0x80000100, 403 .boot_params = 0x80000100,
404 .map_io = omap_ldp_map_io, 404 .map_io = omap_ldp_map_io,
405 .init_irq = omap_ldp_init_irq, 405 .init_irq = omap_ldp_init_irq,
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 8341632d260b..764ab1ed576d 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -23,12 +23,12 @@
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25 25
26#include <mach/board.h> 26#include <plat/board.h>
27#include <mach/common.h> 27#include <plat/common.h>
28#include <mach/irqs.h> 28#include <mach/irqs.h>
29#include <mach/mcspi.h> 29#include <plat/mcspi.h>
30#include <mach/onenand.h> 30#include <plat/onenand.h>
31#include <mach/serial.h> 31#include <plat/serial.h>
32 32
33static struct omap2_mcspi_device_config p54spi_mcspi_config = { 33static struct omap2_mcspi_device_config p54spi_mcspi_config = {
34 .turbo_mode = 0, 34 .turbo_mode = 0,
@@ -121,7 +121,7 @@ static void __init n8x0_init_machine(void)
121 121
122MACHINE_START(NOKIA_N800, "Nokia N800") 122MACHINE_START(NOKIA_N800, "Nokia N800")
123 .phys_io = 0x48000000, 123 .phys_io = 0x48000000,
124 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 124 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
125 .boot_params = 0x80000100, 125 .boot_params = 0x80000100,
126 .map_io = n8x0_map_io, 126 .map_io = n8x0_map_io,
127 .init_irq = n8x0_init_irq, 127 .init_irq = n8x0_init_irq,
@@ -131,7 +131,7 @@ MACHINE_END
131 131
132MACHINE_START(NOKIA_N810, "Nokia N810") 132MACHINE_START(NOKIA_N810, "Nokia N810")
133 .phys_io = 0x48000000, 133 .phys_io = 0x48000000,
134 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 134 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
135 .boot_params = 0x80000100, 135 .boot_params = 0x80000100,
136 .map_io = n8x0_map_io, 136 .map_io = n8x0_map_io,
137 .init_irq = n8x0_init_irq, 137 .init_irq = n8x0_init_irq,
@@ -141,7 +141,7 @@ MACHINE_END
141 141
142MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX") 142MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
143 .phys_io = 0x48000000, 143 .phys_io = 0x48000000,
144 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 144 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
145 .boot_params = 0x80000100, 145 .boot_params = 0x80000100,
146 .map_io = n8x0_map_io, 146 .map_io = n8x0_map_io,
147 .init_irq = n8x0_init_irq, 147 .init_irq = n8x0_init_irq,
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 70df6b4dbcd4..41480bd0e58a 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -37,13 +37,13 @@
37#include <asm/mach/map.h> 37#include <asm/mach/map.h>
38#include <asm/mach/flash.h> 38#include <asm/mach/flash.h>
39 39
40#include <mach/board.h> 40#include <plat/board.h>
41#include <mach/common.h> 41#include <plat/common.h>
42#include <mach/gpmc.h> 42#include <plat/gpmc.h>
43#include <mach/nand.h> 43#include <plat/nand.h>
44#include <mach/mux.h> 44#include <plat/mux.h>
45#include <mach/usb.h> 45#include <plat/usb.h>
46#include <mach/timer-gp.h> 46#include <plat/timer-gp.h>
47 47
48#include "mmc-twl4030.h" 48#include "mmc-twl4030.h"
49 49
@@ -162,7 +162,7 @@ static int beagle_twl_gpio_setup(struct device *dev,
162 162
163 /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */ 163 /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */
164 gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR"); 164 gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR");
165 gpio_direction_output(gpio + TWL4030_GPIO_MAX, 1); 165 gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
166 166
167 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ 167 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
168 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 168 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -254,6 +254,15 @@ static struct twl4030_usb_data beagle_usb_data = {
254 .usb_mode = T2_USB_MODE_ULPI, 254 .usb_mode = T2_USB_MODE_ULPI,
255}; 255};
256 256
257static struct twl4030_codec_audio_data beagle_audio_data = {
258 .audio_mclk = 26000000,
259};
260
261static struct twl4030_codec_data beagle_codec_data = {
262 .audio_mclk = 26000000,
263 .audio = &beagle_audio_data,
264};
265
257static struct twl4030_platform_data beagle_twldata = { 266static struct twl4030_platform_data beagle_twldata = {
258 .irq_base = TWL4030_IRQ_BASE, 267 .irq_base = TWL4030_IRQ_BASE,
259 .irq_end = TWL4030_IRQ_END, 268 .irq_end = TWL4030_IRQ_END,
@@ -261,6 +270,7 @@ static struct twl4030_platform_data beagle_twldata = {
261 /* platform_data for children goes here */ 270 /* platform_data for children goes here */
262 .usb = &beagle_usb_data, 271 .usb = &beagle_usb_data,
263 .gpio = &beagle_gpio_data, 272 .gpio = &beagle_gpio_data,
273 .codec = &beagle_codec_data,
264 .vmmc1 = &beagle_vmmc1, 274 .vmmc1 = &beagle_vmmc1,
265 .vsim = &beagle_vsim, 275 .vsim = &beagle_vsim,
266 .vdac = &beagle_vdac, 276 .vdac = &beagle_vdac,
@@ -400,6 +410,18 @@ static void __init omap3beagle_flash_init(void)
400 } 410 }
401} 411}
402 412
413static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
414
415 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
416 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
417 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
418
419 .phy_reset = true,
420 .reset_gpio_port[0] = -EINVAL,
421 .reset_gpio_port[1] = 147,
422 .reset_gpio_port[2] = -EINVAL
423};
424
403static void __init omap3_beagle_init(void) 425static void __init omap3_beagle_init(void)
404{ 426{
405 omap3_beagle_i2c_init(); 427 omap3_beagle_i2c_init();
@@ -413,6 +435,7 @@ static void __init omap3_beagle_init(void)
413 gpio_direction_output(170, true); 435 gpio_direction_output(170, true);
414 436
415 usb_musb_init(); 437 usb_musb_init();
438 usb_ehci_init(&ehci_pdata);
416 omap3beagle_flash_init(); 439 omap3beagle_flash_init();
417 440
418 /* Ensure SDRC pins are mux'd for self-refresh */ 441 /* Ensure SDRC pins are mux'd for self-refresh */
@@ -429,7 +452,7 @@ static void __init omap3_beagle_map_io(void)
429MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board") 452MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
430 /* Maintainer: Syed Mohammed Khasim - http://beagleboard.org */ 453 /* Maintainer: Syed Mohammed Khasim - http://beagleboard.org */
431 .phys_io = 0x48000000, 454 .phys_io = 0x48000000,
432 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 455 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
433 .boot_params = 0x80000100, 456 .boot_params = 0x80000100,
434 .map_io = omap3_beagle_map_io, 457 .map_io = omap3_beagle_map_io,
435 .init_irq = omap3_beagle_init_irq, 458 .init_irq = omap3_beagle_init_irq,
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index e4ec0c591216..5efc2e9068db 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -20,36 +20,76 @@
20#include <linux/clk.h> 20#include <linux/clk.h>
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <linux/input.h> 22#include <linux/input.h>
23#include <linux/input/matrix_keypad.h>
23#include <linux/leds.h> 24#include <linux/leds.h>
25#include <linux/interrupt.h>
24 26
25#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
26#include <linux/spi/ads7846.h> 28#include <linux/spi/ads7846.h>
27#include <linux/i2c/twl4030.h> 29#include <linux/i2c/twl4030.h>
28#include <linux/usb/otg.h> 30#include <linux/usb/otg.h>
31#include <linux/smsc911x.h>
32
33#include <linux/regulator/machine.h>
29 34
30#include <mach/hardware.h> 35#include <mach/hardware.h>
31#include <asm/mach-types.h> 36#include <asm/mach-types.h>
32#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
33#include <asm/mach/map.h> 38#include <asm/mach/map.h>
34 39
35#include <mach/board.h> 40#include <plat/board.h>
36#include <mach/mux.h> 41#include <plat/mux.h>
37#include <mach/usb.h> 42#include <plat/usb.h>
38#include <mach/common.h> 43#include <plat/common.h>
39#include <mach/mcspi.h> 44#include <plat/mcspi.h>
40#include <mach/keypad.h>
41 45
42#include "sdram-micron-mt46h32m32lf-6.h" 46#include "sdram-micron-mt46h32m32lf-6.h"
43#include "mmc-twl4030.h" 47#include "mmc-twl4030.h"
44 48
45#define OMAP3_EVM_TS_GPIO 175 49#define OMAP3_EVM_TS_GPIO 175
50#define OMAP3_EVM_EHCI_VBUS 22
51#define OMAP3_EVM_EHCI_SELECT 61
46 52
47#define OMAP3EVM_ETHR_START 0x2c000000 53#define OMAP3EVM_ETHR_START 0x2c000000
48#define OMAP3EVM_ETHR_SIZE 1024 54#define OMAP3EVM_ETHR_SIZE 1024
55#define OMAP3EVM_ETHR_ID_REV 0x50
49#define OMAP3EVM_ETHR_GPIO_IRQ 176 56#define OMAP3EVM_ETHR_GPIO_IRQ 176
50#define OMAP3EVM_SMC911X_CS 5 57#define OMAP3EVM_SMSC911X_CS 5
58
59static u8 omap3_evm_version;
60
61u8 get_omap3_evm_rev(void)
62{
63 return omap3_evm_version;
64}
65EXPORT_SYMBOL(get_omap3_evm_rev);
66
67static void __init omap3_evm_get_revision(void)
68{
69 void __iomem *ioaddr;
70 unsigned int smsc_id;
71
72 /* Ethernet PHY ID is stored at ID_REV register */
73 ioaddr = ioremap_nocache(OMAP3EVM_ETHR_START, SZ_1K);
74 if (!ioaddr)
75 return;
76 smsc_id = readl(ioaddr + OMAP3EVM_ETHR_ID_REV) & 0xFFFF0000;
77 iounmap(ioaddr);
78
79 switch (smsc_id) {
80 /*SMSC9115 chipset*/
81 case 0x01150000:
82 omap3_evm_version = OMAP3EVM_BOARD_GEN_1;
83 break;
84 /*SMSC 9220 chipset*/
85 case 0x92200000:
86 default:
87 omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
88 }
89}
51 90
52static struct resource omap3evm_smc911x_resources[] = { 91#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
92static struct resource omap3evm_smsc911x_resources[] = {
53 [0] = { 93 [0] = {
54 .start = OMAP3EVM_ETHR_START, 94 .start = OMAP3EVM_ETHR_START,
55 .end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1), 95 .end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1),
@@ -58,24 +98,34 @@ static struct resource omap3evm_smc911x_resources[] = {
58 [1] = { 98 [1] = {
59 .start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ), 99 .start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
60 .end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ), 100 .end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
61 .flags = IORESOURCE_IRQ, 101 .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW),
62 }, 102 },
63}; 103};
64 104
65static struct platform_device omap3evm_smc911x_device = { 105static struct smsc911x_platform_config smsc911x_config = {
66 .name = "smc911x", 106 .phy_interface = PHY_INTERFACE_MODE_MII,
107 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
108 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
109 .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS),
110};
111
112static struct platform_device omap3evm_smsc911x_device = {
113 .name = "smsc911x",
67 .id = -1, 114 .id = -1,
68 .num_resources = ARRAY_SIZE(omap3evm_smc911x_resources), 115 .num_resources = ARRAY_SIZE(omap3evm_smsc911x_resources),
69 .resource = &omap3evm_smc911x_resources[0], 116 .resource = &omap3evm_smsc911x_resources[0],
117 .dev = {
118 .platform_data = &smsc911x_config,
119 },
70}; 120};
71 121
72static inline void __init omap3evm_init_smc911x(void) 122static inline void __init omap3evm_init_smsc911x(void)
73{ 123{
74 int eth_cs; 124 int eth_cs;
75 struct clk *l3ck; 125 struct clk *l3ck;
76 unsigned int rate; 126 unsigned int rate;
77 127
78 eth_cs = OMAP3EVM_SMC911X_CS; 128 eth_cs = OMAP3EVM_SMSC911X_CS;
79 129
80 l3ck = clk_get(NULL, "l3_ck"); 130 l3ck = clk_get(NULL, "l3_ck");
81 if (IS_ERR(l3ck)) 131 if (IS_ERR(l3ck))
@@ -83,15 +133,58 @@ static inline void __init omap3evm_init_smc911x(void)
83 else 133 else
84 rate = clk_get_rate(l3ck); 134 rate = clk_get_rate(l3ck);
85 135
86 if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMC911x irq") < 0) { 136 if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) {
87 printk(KERN_ERR "Failed to request GPIO%d for smc911x IRQ\n", 137 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
88 OMAP3EVM_ETHR_GPIO_IRQ); 138 OMAP3EVM_ETHR_GPIO_IRQ);
89 return; 139 return;
90 } 140 }
91 141
92 gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ); 142 gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ);
143 platform_device_register(&omap3evm_smsc911x_device);
93} 144}
94 145
146#else
147static inline void __init omap3evm_init_smsc911x(void) { return; }
148#endif
149
150static struct regulator_consumer_supply omap3evm_vmmc1_supply = {
151 .supply = "vmmc",
152};
153
154static struct regulator_consumer_supply omap3evm_vsim_supply = {
155 .supply = "vmmc_aux",
156};
157
158/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
159static struct regulator_init_data omap3evm_vmmc1 = {
160 .constraints = {
161 .min_uV = 1850000,
162 .max_uV = 3150000,
163 .valid_modes_mask = REGULATOR_MODE_NORMAL
164 | REGULATOR_MODE_STANDBY,
165 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
166 | REGULATOR_CHANGE_MODE
167 | REGULATOR_CHANGE_STATUS,
168 },
169 .num_consumer_supplies = 1,
170 .consumer_supplies = &omap3evm_vmmc1_supply,
171};
172
173/* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
174static struct regulator_init_data omap3evm_vsim = {
175 .constraints = {
176 .min_uV = 1800000,
177 .max_uV = 3000000,
178 .valid_modes_mask = REGULATOR_MODE_NORMAL
179 | REGULATOR_MODE_STANDBY,
180 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
181 | REGULATOR_CHANGE_MODE
182 | REGULATOR_CHANGE_STATUS,
183 },
184 .num_consumer_supplies = 1,
185 .consumer_supplies = &omap3evm_vsim_supply,
186};
187
95static struct twl4030_hsmmc_info mmc[] = { 188static struct twl4030_hsmmc_info mmc[] = {
96 { 189 {
97 .mmc = 1, 190 .mmc = 1,
@@ -134,6 +227,10 @@ static int omap3evm_twl_gpio_setup(struct device *dev,
134 mmc[0].gpio_cd = gpio + 0; 227 mmc[0].gpio_cd = gpio + 0;
135 twl4030_mmc_init(mmc); 228 twl4030_mmc_init(mmc);
136 229
230 /* link regulators to MMC adapters */
231 omap3evm_vmmc1_supply.dev = mmc[0].dev;
232 omap3evm_vsim_supply.dev = mmc[0].dev;
233
137 /* 234 /*
138 * Most GPIOs are for USB OTG. Some are mostly sent to 235 * Most GPIOs are for USB OTG. Some are mostly sent to
139 * the P2 connector; notably LEDA for the LCD backlight. 236 * the P2 connector; notably LEDA for the LCD backlight.
@@ -194,6 +291,15 @@ static struct twl4030_madc_platform_data omap3evm_madc_data = {
194 .irq_line = 1, 291 .irq_line = 1,
195}; 292};
196 293
294static struct twl4030_codec_audio_data omap3evm_audio_data = {
295 .audio_mclk = 26000000,
296};
297
298static struct twl4030_codec_data omap3evm_codec_data = {
299 .audio_mclk = 26000000,
300 .audio = &omap3evm_audio_data,
301};
302
197static struct twl4030_platform_data omap3evm_twldata = { 303static struct twl4030_platform_data omap3evm_twldata = {
198 .irq_base = TWL4030_IRQ_BASE, 304 .irq_base = TWL4030_IRQ_BASE,
199 .irq_end = TWL4030_IRQ_END, 305 .irq_end = TWL4030_IRQ_END,
@@ -203,6 +309,7 @@ static struct twl4030_platform_data omap3evm_twldata = {
203 .madc = &omap3evm_madc_data, 309 .madc = &omap3evm_madc_data,
204 .usb = &omap3evm_usb_data, 310 .usb = &omap3evm_usb_data,
205 .gpio = &omap3evm_gpio_data, 311 .gpio = &omap3evm_gpio_data,
312 .codec = &omap3evm_codec_data,
206}; 313};
207 314
208static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = { 315static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = {
@@ -216,6 +323,13 @@ static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = {
216 323
217static int __init omap3_evm_i2c_init(void) 324static int __init omap3_evm_i2c_init(void)
218{ 325{
326 /*
327 * REVISIT: These entries can be set in omap3evm_twl_data
328 * after a merge with MFD tree
329 */
330 omap3evm_twldata.vmmc1 = &omap3evm_vmmc1;
331 omap3evm_twldata.vsim = &omap3evm_vsim;
332
219 omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo, 333 omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo,
220 ARRAY_SIZE(omap3evm_i2c_boardinfo)); 334 ARRAY_SIZE(omap3evm_i2c_boardinfo));
221 omap_register_i2c_bus(2, 400, NULL, 0); 335 omap_register_i2c_bus(2, 400, NULL, 0);
@@ -289,16 +403,29 @@ static void __init omap3_evm_init_irq(void)
289 omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL); 403 omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL);
290 omap_init_irq(); 404 omap_init_irq();
291 omap_gpio_init(); 405 omap_gpio_init();
292 omap3evm_init_smc911x();
293} 406}
294 407
295static struct platform_device *omap3_evm_devices[] __initdata = { 408static struct platform_device *omap3_evm_devices[] __initdata = {
296 &omap3_evm_lcd_device, 409 &omap3_evm_lcd_device,
297 &omap3evm_smc911x_device, 410};
411
412static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
413
414 .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN,
415 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
416 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
417
418 .phy_reset = true,
419 /* PHY reset GPIO will be runtime programmed based on EVM version */
420 .reset_gpio_port[0] = -EINVAL,
421 .reset_gpio_port[1] = -EINVAL,
422 .reset_gpio_port[2] = -EINVAL
298}; 423};
299 424
300static void __init omap3_evm_init(void) 425static void __init omap3_evm_init(void)
301{ 426{
427 omap3_evm_get_revision();
428
302 omap3_evm_i2c_init(); 429 omap3_evm_i2c_init();
303 430
304 platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices)); 431 platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices));
@@ -311,8 +438,32 @@ static void __init omap3_evm_init(void)
311 /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */ 438 /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
312 usb_nop_xceiv_register(); 439 usb_nop_xceiv_register();
313#endif 440#endif
441 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
442 /* enable EHCI VBUS using GPIO22 */
443 omap_cfg_reg(AF9_34XX_GPIO22);
444 gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS");
445 gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0);
446 gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1);
447
448 /* Select EHCI port on main board */
449 omap_cfg_reg(U3_34XX_GPIO61);
450 gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port");
451 gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0);
452 gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0);
453
454 /* setup EHCI phy reset config */
455 omap_cfg_reg(AH14_34XX_GPIO21);
456 ehci_pdata.reset_gpio_port[1] = 21;
457
458 } else {
459 /* setup EHCI phy reset on MDC */
460 omap_cfg_reg(AF4_34XX_GPIO135_OUT);
461 ehci_pdata.reset_gpio_port[1] = 135;
462 }
314 usb_musb_init(); 463 usb_musb_init();
464 usb_ehci_init(&ehci_pdata);
315 ads7846_dev_init(); 465 ads7846_dev_init();
466 omap3evm_init_smsc911x();
316} 467}
317 468
318static void __init omap3_evm_map_io(void) 469static void __init omap3_evm_map_io(void)
@@ -324,7 +475,7 @@ static void __init omap3_evm_map_io(void)
324MACHINE_START(OMAP3EVM, "OMAP3 EVM") 475MACHINE_START(OMAP3EVM, "OMAP3 EVM")
325 /* Maintainer: Syed Mohammed Khasim - Texas Instruments */ 476 /* Maintainer: Syed Mohammed Khasim - Texas Instruments */
326 .phys_io = 0x48000000, 477 .phys_io = 0x48000000,
327 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 478 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
328 .boot_params = 0x80000100, 479 .boot_params = 0x80000100,
329 .map_io = omap3_evm_map_io, 480 .map_io = omap3_evm_map_io,
330 .init_irq = omap3_evm_init_irq, 481 .init_irq = omap3_evm_init_irq,
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 7f6bf8772af7..2db5ba5b3bf7 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -27,20 +27,20 @@
27#include <linux/i2c/twl4030.h> 27#include <linux/i2c/twl4030.h>
28#include <linux/leds.h> 28#include <linux/leds.h>
29#include <linux/input.h> 29#include <linux/input.h>
30#include <linux/input/matrix_keypad.h>
30#include <linux/gpio_keys.h> 31#include <linux/gpio_keys.h>
31 32
32#include <asm/mach-types.h> 33#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
34#include <asm/mach/map.h> 35#include <asm/mach/map.h>
35 36
36#include <mach/board.h> 37#include <plat/board.h>
37#include <mach/common.h> 38#include <plat/common.h>
38#include <mach/gpio.h> 39#include <mach/gpio.h>
39#include <mach/hardware.h> 40#include <mach/hardware.h>
40#include <mach/mcspi.h> 41#include <plat/mcspi.h>
41#include <mach/usb.h> 42#include <plat/usb.h>
42#include <mach/keypad.h> 43#include <plat/mux.h>
43#include <mach/mux.h>
44 44
45#include "sdram-micron-mt46h32m32lf-6.h" 45#include "sdram-micron-mt46h32m32lf-6.h"
46#include "mmc-twl4030.h" 46#include "mmc-twl4030.h"
@@ -134,50 +134,50 @@ static void __init pandora_keys_gpio_init(void)
134} 134}
135 135
136static int board_keymap[] = { 136static int board_keymap[] = {
137 /* col, row, code */ 137 /* row, col, code */
138 KEY(0, 0, KEY_9), 138 KEY(0, 0, KEY_9),
139 KEY(0, 1, KEY_0), 139 KEY(0, 1, KEY_8),
140 KEY(0, 2, KEY_BACKSPACE), 140 KEY(0, 2, KEY_I),
141 KEY(0, 3, KEY_O), 141 KEY(0, 3, KEY_J),
142 KEY(0, 4, KEY_P), 142 KEY(0, 4, KEY_N),
143 KEY(0, 5, KEY_K), 143 KEY(0, 5, KEY_M),
144 KEY(0, 6, KEY_L), 144 KEY(1, 0, KEY_0),
145 KEY(0, 7, KEY_ENTER),
146 KEY(1, 0, KEY_8),
147 KEY(1, 1, KEY_7), 145 KEY(1, 1, KEY_7),
148 KEY(1, 2, KEY_6), 146 KEY(1, 2, KEY_U),
149 KEY(1, 3, KEY_5), 147 KEY(1, 3, KEY_H),
150 KEY(1, 4, KEY_4), 148 KEY(1, 4, KEY_B),
151 KEY(1, 5, KEY_3), 149 KEY(1, 5, KEY_SPACE),
152 KEY(1, 6, KEY_2), 150 KEY(2, 0, KEY_BACKSPACE),
153 KEY(1, 7, KEY_1), 151 KEY(2, 1, KEY_6),
154 KEY(2, 0, KEY_I),
155 KEY(2, 1, KEY_U),
156 KEY(2, 2, KEY_Y), 152 KEY(2, 2, KEY_Y),
157 KEY(2, 3, KEY_T), 153 KEY(2, 3, KEY_G),
158 KEY(2, 4, KEY_R), 154 KEY(2, 4, KEY_V),
159 KEY(2, 5, KEY_E), 155 KEY(2, 5, KEY_FN),
160 KEY(2, 6, KEY_W), 156 KEY(3, 0, KEY_O),
161 KEY(2, 7, KEY_Q), 157 KEY(3, 1, KEY_5),
162 KEY(3, 0, KEY_J), 158 KEY(3, 2, KEY_T),
163 KEY(3, 1, KEY_H),
164 KEY(3, 2, KEY_G),
165 KEY(3, 3, KEY_F), 159 KEY(3, 3, KEY_F),
166 KEY(3, 4, KEY_D), 160 KEY(3, 4, KEY_C),
167 KEY(3, 5, KEY_S), 161 KEY(4, 0, KEY_P),
168 KEY(3, 6, KEY_A), 162 KEY(4, 1, KEY_4),
169 KEY(3, 7, KEY_LEFTSHIFT), 163 KEY(4, 2, KEY_R),
170 KEY(4, 0, KEY_N), 164 KEY(4, 3, KEY_D),
171 KEY(4, 1, KEY_B),
172 KEY(4, 2, KEY_V),
173 KEY(4, 3, KEY_C),
174 KEY(4, 4, KEY_X), 165 KEY(4, 4, KEY_X),
175 KEY(4, 5, KEY_Z), 166 KEY(5, 0, KEY_K),
176 KEY(4, 6, KEY_DOT), 167 KEY(5, 1, KEY_3),
177 KEY(4, 7, KEY_COMMA), 168 KEY(5, 2, KEY_E),
178 KEY(5, 0, KEY_M), 169 KEY(5, 3, KEY_S),
179 KEY(5, 1, KEY_SPACE), 170 KEY(5, 4, KEY_Z),
180 KEY(5, 2, KEY_FN), 171 KEY(6, 0, KEY_L),
172 KEY(6, 1, KEY_2),
173 KEY(6, 2, KEY_W),
174 KEY(6, 3, KEY_A),
175 KEY(6, 4, KEY_DOT),
176 KEY(7, 0, KEY_ENTER),
177 KEY(7, 1, KEY_1),
178 KEY(7, 2, KEY_Q),
179 KEY(7, 3, KEY_LEFTSHIFT),
180 KEY(7, 4, KEY_COMMA),
181}; 181};
182 182
183static struct matrix_keymap_data board_map_data = { 183static struct matrix_keymap_data board_map_data = {
@@ -281,11 +281,21 @@ static struct twl4030_usb_data omap3pandora_usb_data = {
281 .usb_mode = T2_USB_MODE_ULPI, 281 .usb_mode = T2_USB_MODE_ULPI,
282}; 282};
283 283
284static struct twl4030_codec_audio_data omap3pandora_audio_data = {
285 .audio_mclk = 26000000,
286};
287
288static struct twl4030_codec_data omap3pandora_codec_data = {
289 .audio_mclk = 26000000,
290 .audio = &omap3pandora_audio_data,
291};
292
284static struct twl4030_platform_data omap3pandora_twldata = { 293static struct twl4030_platform_data omap3pandora_twldata = {
285 .irq_base = TWL4030_IRQ_BASE, 294 .irq_base = TWL4030_IRQ_BASE,
286 .irq_end = TWL4030_IRQ_END, 295 .irq_end = TWL4030_IRQ_END,
287 .gpio = &omap3pandora_gpio_data, 296 .gpio = &omap3pandora_gpio_data,
288 .usb = &omap3pandora_usb_data, 297 .usb = &omap3pandora_usb_data,
298 .codec = &omap3pandora_codec_data,
289 .vmmc1 = &pandora_vmmc1, 299 .vmmc1 = &pandora_vmmc1,
290 .vmmc2 = &pandora_vmmc2, 300 .vmmc2 = &pandora_vmmc2,
291 .keypad = &pandora_kp_data, 301 .keypad = &pandora_kp_data,
@@ -387,6 +397,18 @@ static struct platform_device *omap3pandora_devices[] __initdata = {
387 &pandora_keys_gpio, 397 &pandora_keys_gpio,
388}; 398};
389 399
400static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
401
402 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
403 .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
404 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
405
406 .phy_reset = true,
407 .reset_gpio_port[0] = 16,
408 .reset_gpio_port[1] = -EINVAL,
409 .reset_gpio_port[2] = -EINVAL
410};
411
390static void __init omap3pandora_init(void) 412static void __init omap3pandora_init(void)
391{ 413{
392 omap3pandora_i2c_init(); 414 omap3pandora_i2c_init();
@@ -396,6 +418,7 @@ static void __init omap3pandora_init(void)
396 spi_register_board_info(omap3pandora_spi_board_info, 418 spi_register_board_info(omap3pandora_spi_board_info,
397 ARRAY_SIZE(omap3pandora_spi_board_info)); 419 ARRAY_SIZE(omap3pandora_spi_board_info));
398 omap3pandora_ads7846_init(); 420 omap3pandora_ads7846_init();
421 usb_ehci_init(&ehci_pdata);
399 pandora_keys_gpio_init(); 422 pandora_keys_gpio_init();
400 usb_musb_init(); 423 usb_musb_init();
401 424
@@ -412,7 +435,7 @@ static void __init omap3pandora_map_io(void)
412 435
413MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console") 436MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
414 .phys_io = 0x48000000, 437 .phys_io = 0x48000000,
415 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 438 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
416 .boot_params = 0x80000100, 439 .boot_params = 0x80000100,
417 .map_io = omap3pandora_map_io, 440 .map_io = omap3pandora_map_io,
418 .init_irq = omap3pandora_init_irq, 441 .init_irq = omap3pandora_init_irq,
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 9917d2fddc2f..52dfd51a938e 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -38,14 +38,14 @@
38#include <asm/mach/flash.h> 38#include <asm/mach/flash.h>
39#include <asm/mach/map.h> 39#include <asm/mach/map.h>
40 40
41#include <mach/board.h> 41#include <plat/board.h>
42#include <mach/common.h> 42#include <plat/common.h>
43#include <mach/gpio.h> 43#include <mach/gpio.h>
44#include <mach/gpmc.h> 44#include <plat/gpmc.h>
45#include <mach/hardware.h> 45#include <mach/hardware.h>
46#include <mach/nand.h> 46#include <plat/nand.h>
47#include <mach/mux.h> 47#include <plat/mux.h>
48#include <mach/usb.h> 48#include <plat/usb.h>
49 49
50#include "sdram-micron-mt46h32m32lf-6.h" 50#include "sdram-micron-mt46h32m32lf-6.h"
51#include "mmc-twl4030.h" 51#include "mmc-twl4030.h"
@@ -67,7 +67,7 @@
67#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ 67#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
68 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 68 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
69 69
70#include <mach/mcspi.h> 70#include <plat/mcspi.h>
71#include <linux/spi/spi.h> 71#include <linux/spi/spi.h>
72#include <linux/spi/ads7846.h> 72#include <linux/spi/ads7846.h>
73 73
@@ -329,6 +329,15 @@ static struct regulator_init_data overo_vmmc1 = {
329 .consumer_supplies = &overo_vmmc1_supply, 329 .consumer_supplies = &overo_vmmc1_supply,
330}; 330};
331 331
332static struct twl4030_codec_audio_data overo_audio_data = {
333 .audio_mclk = 26000000,
334};
335
336static struct twl4030_codec_data overo_codec_data = {
337 .audio_mclk = 26000000,
338 .audio = &overo_audio_data,
339};
340
332/* mmc2 (WLAN) and Bluetooth don't use twl4030 regulators */ 341/* mmc2 (WLAN) and Bluetooth don't use twl4030 regulators */
333 342
334static struct twl4030_platform_data overo_twldata = { 343static struct twl4030_platform_data overo_twldata = {
@@ -336,6 +345,7 @@ static struct twl4030_platform_data overo_twldata = {
336 .irq_end = TWL4030_IRQ_END, 345 .irq_end = TWL4030_IRQ_END,
337 .gpio = &overo_gpio_data, 346 .gpio = &overo_gpio_data,
338 .usb = &overo_usb_data, 347 .usb = &overo_usb_data,
348 .codec = &overo_codec_data,
339 .vmmc1 = &overo_vmmc1, 349 .vmmc1 = &overo_vmmc1,
340}; 350};
341 351
@@ -384,6 +394,18 @@ static struct platform_device *overo_devices[] __initdata = {
384 &overo_lcd_device, 394 &overo_lcd_device,
385}; 395};
386 396
397static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
398 .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN,
399 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
400 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
401
402 .phy_reset = true,
403 .reset_gpio_port[0] = -EINVAL,
404 .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET,
405 .reset_gpio_port[2] = -EINVAL
406};
407
408
387static void __init overo_init(void) 409static void __init overo_init(void)
388{ 410{
389 overo_i2c_init(); 411 overo_i2c_init();
@@ -391,6 +413,7 @@ static void __init overo_init(void)
391 omap_serial_init(); 413 omap_serial_init();
392 overo_flash_init(); 414 overo_flash_init();
393 usb_musb_init(); 415 usb_musb_init();
416 usb_ehci_init(&ehci_pdata);
394 overo_ads7846_init(); 417 overo_ads7846_init();
395 overo_init_smsc911x(); 418 overo_init_smsc911x();
396 419
@@ -433,14 +456,6 @@ static void __init overo_init(void)
433 else 456 else
434 printk(KERN_ERR "could not obtain gpio for " 457 printk(KERN_ERR "could not obtain gpio for "
435 "OVERO_GPIO_USBH_CPEN\n"); 458 "OVERO_GPIO_USBH_CPEN\n");
436
437 if ((gpio_request(OVERO_GPIO_USBH_NRESET,
438 "OVERO_GPIO_USBH_NRESET") == 0) &&
439 (gpio_direction_output(OVERO_GPIO_USBH_NRESET, 1) == 0))
440 gpio_export(OVERO_GPIO_USBH_NRESET, 0);
441 else
442 printk(KERN_ERR "could not obtain gpio for "
443 "OVERO_GPIO_USBH_NRESET\n");
444} 459}
445 460
446static void __init overo_map_io(void) 461static void __init overo_map_io(void)
@@ -451,7 +466,7 @@ static void __init overo_map_io(void)
451 466
452MACHINE_START(OVERO, "Gumstix Overo") 467MACHINE_START(OVERO, "Gumstix Overo")
453 .phys_io = 0x48000000, 468 .phys_io = 0x48000000,
454 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 469 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
455 .boot_params = 0x80000100, 470 .boot_params = 0x80000100,
456 .map_io = overo_map_io, 471 .map_io = overo_map_io,
457 .init_irq = overo_init_irq, 472 .init_irq = overo_init_irq,
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 2b0eb1ba5d7f..15ce6514c5fd 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -12,30 +12,139 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/input.h> 14#include <linux/input.h>
15#include <linux/input/matrix_keypad.h>
15#include <linux/spi/spi.h> 16#include <linux/spi/spi.h>
17#include <linux/spi/wl12xx.h>
16#include <linux/i2c.h> 18#include <linux/i2c.h>
17#include <linux/i2c/twl4030.h> 19#include <linux/i2c/twl4030.h>
18#include <linux/clk.h> 20#include <linux/clk.h>
19#include <linux/delay.h> 21#include <linux/delay.h>
20#include <linux/regulator/machine.h> 22#include <linux/regulator/machine.h>
21#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <linux/gpio_keys.h>
22#include <linux/mmc/host.h> 25#include <linux/mmc/host.h>
23 26
24#include <mach/mcspi.h> 27#include <plat/mcspi.h>
25#include <mach/mux.h> 28#include <plat/mux.h>
26#include <mach/board.h> 29#include <plat/board.h>
27#include <mach/common.h> 30#include <plat/common.h>
28#include <mach/dma.h> 31#include <plat/dma.h>
29#include <mach/gpmc.h> 32#include <plat/gpmc.h>
30#include <mach/keypad.h> 33#include <plat/onenand.h>
31#include <mach/onenand.h> 34#include <plat/gpmc-smc91x.h>
32#include <mach/gpmc-smc91x.h>
33 35
34#include "mmc-twl4030.h" 36#include "mmc-twl4030.h"
35 37
36#define SYSTEM_REV_B_USES_VAUX3 0x1699 38#define SYSTEM_REV_B_USES_VAUX3 0x1699
37#define SYSTEM_REV_S_USES_VAUX3 0x8 39#define SYSTEM_REV_S_USES_VAUX3 0x8
38 40
41#define RX51_WL1251_POWER_GPIO 87
42#define RX51_WL1251_IRQ_GPIO 42
43
44/* list all spi devices here */
45enum {
46 RX51_SPI_WL1251,
47};
48
49static struct wl12xx_platform_data wl1251_pdata;
50
51static struct omap2_mcspi_device_config wl1251_mcspi_config = {
52 .turbo_mode = 0,
53 .single_channel = 1,
54};
55
56static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
57 [RX51_SPI_WL1251] = {
58 .modalias = "wl1251",
59 .bus_num = 4,
60 .chip_select = 0,
61 .max_speed_hz = 48000000,
62 .mode = SPI_MODE_2,
63 .controller_data = &wl1251_mcspi_config,
64 .platform_data = &wl1251_pdata,
65 },
66};
67
68#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
69
70#define RX51_GPIO_CAMERA_LENS_COVER 110
71#define RX51_GPIO_CAMERA_FOCUS 68
72#define RX51_GPIO_CAMERA_CAPTURE 69
73#define RX51_GPIO_KEYPAD_SLIDE 71
74#define RX51_GPIO_LOCK_BUTTON 113
75#define RX51_GPIO_PROXIMITY 89
76
77#define RX51_GPIO_DEBOUNCE_TIMEOUT 10
78
79static struct gpio_keys_button rx51_gpio_keys[] = {
80 {
81 .desc = "Camera Lens Cover",
82 .type = EV_SW,
83 .code = SW_CAMERA_LENS_COVER,
84 .gpio = RX51_GPIO_CAMERA_LENS_COVER,
85 .active_low = 1,
86 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
87 }, {
88 .desc = "Camera Focus",
89 .type = EV_KEY,
90 .code = KEY_CAMERA_FOCUS,
91 .gpio = RX51_GPIO_CAMERA_FOCUS,
92 .active_low = 1,
93 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
94 }, {
95 .desc = "Camera Capture",
96 .type = EV_KEY,
97 .code = KEY_CAMERA,
98 .gpio = RX51_GPIO_CAMERA_CAPTURE,
99 .active_low = 1,
100 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
101 }, {
102 .desc = "Lock Button",
103 .type = EV_KEY,
104 .code = KEY_SCREENLOCK,
105 .gpio = RX51_GPIO_LOCK_BUTTON,
106 .active_low = 1,
107 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
108 }, {
109 .desc = "Keypad Slide",
110 .type = EV_SW,
111 .code = SW_KEYPAD_SLIDE,
112 .gpio = RX51_GPIO_KEYPAD_SLIDE,
113 .active_low = 1,
114 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
115 }, {
116 .desc = "Proximity Sensor",
117 .type = EV_SW,
118 .code = SW_FRONT_PROXIMITY,
119 .gpio = RX51_GPIO_PROXIMITY,
120 .active_low = 0,
121 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
122 }
123};
124
125static struct gpio_keys_platform_data rx51_gpio_keys_data = {
126 .buttons = rx51_gpio_keys,
127 .nbuttons = ARRAY_SIZE(rx51_gpio_keys),
128};
129
130static struct platform_device rx51_gpio_keys_device = {
131 .name = "gpio-keys",
132 .id = -1,
133 .dev = {
134 .platform_data = &rx51_gpio_keys_data,
135 },
136};
137
138static void __init rx51_add_gpio_keys(void)
139{
140 platform_device_register(&rx51_gpio_keys_device);
141}
142#else
143static void __init rx51_add_gpio_keys(void)
144{
145}
146#endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */
147
39static int board_keymap[] = { 148static int board_keymap[] = {
40 KEY(0, 0, KEY_Q), 149 KEY(0, 0, KEY_Q),
41 KEY(0, 1, KEY_O), 150 KEY(0, 1, KEY_O),
@@ -536,10 +645,64 @@ static inline void board_smc91x_init(void)
536 645
537#endif 646#endif
538 647
648static void rx51_wl1251_set_power(bool enable)
649{
650 gpio_set_value(RX51_WL1251_POWER_GPIO, enable);
651}
652
653static void __init rx51_init_wl1251(void)
654{
655 int irq, ret;
656
657 ret = gpio_request(RX51_WL1251_POWER_GPIO, "wl1251 power");
658 if (ret < 0)
659 goto error;
660
661 ret = gpio_direction_output(RX51_WL1251_POWER_GPIO, 0);
662 if (ret < 0)
663 goto err_power;
664
665 ret = gpio_request(RX51_WL1251_IRQ_GPIO, "wl1251 irq");
666 if (ret < 0)
667 goto err_power;
668
669 ret = gpio_direction_input(RX51_WL1251_IRQ_GPIO);
670 if (ret < 0)
671 goto err_irq;
672
673 irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO);
674 if (irq < 0)
675 goto err_irq;
676
677 wl1251_pdata.set_power = rx51_wl1251_set_power;
678 rx51_peripherals_spi_board_info[RX51_SPI_WL1251].irq = irq;
679
680 return;
681
682err_irq:
683 gpio_free(RX51_WL1251_IRQ_GPIO);
684
685err_power:
686 gpio_free(RX51_WL1251_POWER_GPIO);
687
688error:
689 printk(KERN_ERR "wl1251 board initialisation failed\n");
690 wl1251_pdata.set_power = NULL;
691
692 /*
693 * Now rx51_peripherals_spi_board_info[1].irq is zero and
694 * set_power is null, and wl1251_probe() will fail.
695 */
696}
697
539void __init rx51_peripherals_init(void) 698void __init rx51_peripherals_init(void)
540{ 699{
541 rx51_i2c_init(); 700 rx51_i2c_init();
542 board_onenand_init(); 701 board_onenand_init();
543 board_smc91x_init(); 702 board_smc91x_init();
703 rx51_add_gpio_keys();
704 rx51_init_wl1251();
705 spi_register_board_info(rx51_peripherals_spi_board_info,
706 ARRAY_SIZE(rx51_peripherals_spi_board_info));
544} 707}
545 708
diff --git a/arch/arm/mach-omap2/board-rx51-sdram.c b/arch/arm/mach-omap2/board-rx51-sdram.c
new file mode 100644
index 000000000000..f392844195d2
--- /dev/null
+++ b/arch/arm/mach-omap2/board-rx51-sdram.c
@@ -0,0 +1,221 @@
1/*
2 * SDRC register values for RX51
3 *
4 * Copyright (C) 2008 Nokia Corporation
5 *
6 * Lauri Leukkunen <lauri.leukkunen@nokia.com>
7 *
8 * Original code by Juha Yrjola <juha.yrjola@solidboot.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/clk.h>
17#include <linux/err.h>
18#include <linux/io.h>
19
20#include <plat/io.h>
21#include <plat/common.h>
22#include <plat/clock.h>
23#include <plat/sdrc.h>
24
25
26/* In picoseconds, except for tREF (ns), tXP, tCKE, tWTR (clks) */
27struct sdram_timings {
28 u32 casl;
29 u32 tDAL;
30 u32 tDPL;
31 u32 tRRD;
32 u32 tRCD;
33 u32 tRP;
34 u32 tRAS;
35 u32 tRC;
36 u32 tRFC;
37 u32 tXSR;
38
39 u32 tREF; /* in ns */
40
41 u32 tXP;
42 u32 tCKE;
43 u32 tWTR;
44};
45
46struct omap_sdrc_params rx51_sdrc_params[4];
47
48static const struct sdram_timings rx51_timings[] = {
49 {
50 .casl = 3,
51 .tDAL = 33000,
52 .tDPL = 15000,
53 .tRRD = 12000,
54 .tRCD = 22500,
55 .tRP = 18000,
56 .tRAS = 42000,
57 .tRC = 66000,
58 .tRFC = 138000,
59 .tXSR = 200000,
60
61 .tREF = 7800,
62
63 .tXP = 2,
64 .tCKE = 2,
65 .tWTR = 2
66 },
67};
68
69static unsigned long sdrc_get_fclk_period(long rate)
70{
71 /* In picoseconds */
72 return 1000000000 / rate;
73}
74
75static unsigned int sdrc_ps_to_ticks(unsigned int time_ps, long rate)
76{
77 unsigned long tick_ps;
78
79 /* Calculate in picosecs to yield more exact results */
80 tick_ps = sdrc_get_fclk_period(rate);
81
82 return (time_ps + tick_ps - 1) / tick_ps;
83}
84#undef DEBUG
85#ifdef DEBUG
86static int set_sdrc_timing_regval(u32 *regval, int st_bit, int end_bit,
87 int ticks, long rate, const char *name)
88#else
89static int set_sdrc_timing_regval(u32 *regval, int st_bit, int end_bit,
90 int ticks)
91#endif
92{
93 int mask, nr_bits;
94
95 nr_bits = end_bit - st_bit + 1;
96 if (ticks >= 1 << nr_bits)
97 return -1;
98 mask = (1 << nr_bits) - 1;
99 *regval &= ~(mask << st_bit);
100 *regval |= ticks << st_bit;
101#ifdef DEBUG
102 printk(KERN_INFO "SDRC %s: %i ticks %i ns\n", name, ticks,
103 (unsigned int)sdrc_get_fclk_period(rate) * ticks /
104 1000);
105#endif
106
107 return 0;
108}
109
110#ifdef DEBUG
111#define SDRC_SET_ONE(reg, st, end, field, rate) \
112 if (set_sdrc_timing_regval((reg), (st), (end), \
113 rx51_timings->field, (rate), #field) < 0) \
114 err = -1;
115#else
116#define SDRC_SET_ONE(reg, st, end, field, rate) \
117 if (set_sdrc_timing_regval((reg), (st), (end), \
118 rx51_timings->field) < 0) \
119 err = -1;
120#endif
121
122#ifdef DEBUG
123static int set_sdrc_timing_regval_ps(u32 *regval, int st_bit, int end_bit,
124 int time, long rate, const char *name)
125#else
126static int set_sdrc_timing_regval_ps(u32 *regval, int st_bit, int end_bit,
127 int time, long rate)
128#endif
129{
130 int ticks, ret;
131 ret = 0;
132
133 if (time == 0)
134 ticks = 0;
135 else
136 ticks = sdrc_ps_to_ticks(time, rate);
137
138#ifdef DEBUG
139 ret = set_sdrc_timing_regval(regval, st_bit, end_bit, ticks,
140 rate, name);
141#else
142 ret = set_sdrc_timing_regval(regval, st_bit, end_bit, ticks);
143#endif
144
145 return ret;
146}
147
148#ifdef DEBUG
149#define SDRC_SET_ONE_PS(reg, st, end, field, rate) \
150 if (set_sdrc_timing_regval_ps((reg), (st), (end), \
151 rx51_timings->field, \
152 (rate), #field) < 0) \
153 err = -1;
154
155#else
156#define SDRC_SET_ONE_PS(reg, st, end, field, rate) \
157 if (set_sdrc_timing_regval_ps((reg), (st), (end), \
158 rx51_timings->field, (rate)) < 0) \
159 err = -1;
160#endif
161
162static int sdrc_timings(int id, long rate)
163{
164 u32 ticks_per_ms;
165 u32 rfr, l;
166 u32 actim_ctrla = 0, actim_ctrlb = 0;
167 u32 rfr_ctrl;
168 int err = 0;
169 long l3_rate = rate / 1000;
170
171 SDRC_SET_ONE_PS(&actim_ctrla, 0, 4, tDAL, l3_rate);
172 SDRC_SET_ONE_PS(&actim_ctrla, 6, 8, tDPL, l3_rate);
173 SDRC_SET_ONE_PS(&actim_ctrla, 9, 11, tRRD, l3_rate);
174 SDRC_SET_ONE_PS(&actim_ctrla, 12, 14, tRCD, l3_rate);
175 SDRC_SET_ONE_PS(&actim_ctrla, 15, 17, tRP, l3_rate);
176 SDRC_SET_ONE_PS(&actim_ctrla, 18, 21, tRAS, l3_rate);
177 SDRC_SET_ONE_PS(&actim_ctrla, 22, 26, tRC, l3_rate);
178 SDRC_SET_ONE_PS(&actim_ctrla, 27, 31, tRFC, l3_rate);
179
180 SDRC_SET_ONE_PS(&actim_ctrlb, 0, 7, tXSR, l3_rate);
181
182 SDRC_SET_ONE(&actim_ctrlb, 8, 10, tXP, l3_rate);
183 SDRC_SET_ONE(&actim_ctrlb, 12, 14, tCKE, l3_rate);
184 SDRC_SET_ONE(&actim_ctrlb, 16, 17, tWTR, l3_rate);
185
186 ticks_per_ms = l3_rate;
187 rfr = rx51_timings[0].tREF * ticks_per_ms / 1000000;
188 if (rfr > 65535 + 50)
189 rfr = 65535;
190 else
191 rfr -= 50;
192
193#ifdef DEBUG
194 printk(KERN_INFO "SDRC tREF: %i ticks\n", rfr);
195#endif
196
197 l = rfr << 8;
198 rfr_ctrl = l | 0x1; /* autorefresh, reload counter with 1xARCV */
199
200 rx51_sdrc_params[id].rate = rate;
201 rx51_sdrc_params[id].actim_ctrla = actim_ctrla;
202 rx51_sdrc_params[id].actim_ctrlb = actim_ctrlb;
203 rx51_sdrc_params[id].rfr_ctrl = rfr_ctrl;
204 rx51_sdrc_params[id].mr = 0x32;
205
206 rx51_sdrc_params[id + 1].rate = 0;
207
208 return err;
209}
210
211struct omap_sdrc_params *rx51_get_sdram_timings(void)
212{
213 int err;
214
215 err = sdrc_timings(0, 41500000);
216 err |= sdrc_timings(1, 83000000);
217 err |= sdrc_timings(2, 166000000);
218
219 return &rx51_sdrc_params[0];
220}
221
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index f9196c3b1a7b..1bb1de245917 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -22,14 +22,15 @@
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24 24
25#include <mach/mcspi.h> 25#include <plat/mcspi.h>
26#include <mach/mux.h> 26#include <plat/mux.h>
27#include <mach/board.h> 27#include <plat/board.h>
28#include <mach/common.h> 28#include <plat/common.h>
29#include <mach/keypad.h> 29#include <plat/dma.h>
30#include <mach/dma.h> 30#include <plat/gpmc.h>
31#include <mach/gpmc.h> 31#include <plat/usb.h>
32#include <mach/usb.h> 32
33struct omap_sdrc_params *rx51_get_sdram_timings(void);
33 34
34static struct omap_lcd_config rx51_lcd_config = { 35static struct omap_lcd_config rx51_lcd_config = {
35 .ctrl_name = "internal", 36 .ctrl_name = "internal",
@@ -56,9 +57,12 @@ static struct omap_board_config_kernel rx51_config[] = {
56 57
57static void __init rx51_init_irq(void) 58static void __init rx51_init_irq(void)
58{ 59{
60 struct omap_sdrc_params *sdrc_params;
61
59 omap_board_config = rx51_config; 62 omap_board_config = rx51_config;
60 omap_board_config_size = ARRAY_SIZE(rx51_config); 63 omap_board_config_size = ARRAY_SIZE(rx51_config);
61 omap2_init_common_hw(NULL, NULL); 64 sdrc_params = rx51_get_sdram_timings();
65 omap2_init_common_hw(sdrc_params, sdrc_params);
62 omap_init_irq(); 66 omap_init_irq();
63 omap_gpio_init(); 67 omap_gpio_init();
64} 68}
@@ -85,7 +89,7 @@ static void __init rx51_map_io(void)
85MACHINE_START(NOKIA_RX51, "Nokia RX-51 board") 89MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
86 /* Maintainer: Lauri Leukkunen <lauri.leukkunen@nokia.com> */ 90 /* Maintainer: Lauri Leukkunen <lauri.leukkunen@nokia.com> */
87 .phys_io = 0x48000000, 91 .phys_io = 0x48000000,
88 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 92 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
89 .boot_params = 0x80000100, 93 .boot_params = 0x80000100,
90 .map_io = rx51_map_io, 94 .map_io = rx51_map_io,
91 .init_irq = rx51_init_irq, 95 .init_irq = rx51_init_irq,
diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c
index 1f13e2a1f322..bb4018b60642 100644
--- a/arch/arm/mach-omap2/board-zoom-debugboard.c
+++ b/arch/arm/mach-omap2/board-zoom-debugboard.c
@@ -14,20 +14,20 @@
14#include <linux/smsc911x.h> 14#include <linux/smsc911x.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16 16
17#include <mach/gpmc.h> 17#include <plat/gpmc.h>
18 18
19#define ZOOM2_SMSC911X_CS 7 19#define ZOOM_SMSC911X_CS 7
20#define ZOOM2_SMSC911X_GPIO 158 20#define ZOOM_SMSC911X_GPIO 158
21#define ZOOM2_QUADUART_CS 3 21#define ZOOM_QUADUART_CS 3
22#define ZOOM2_QUADUART_GPIO 102 22#define ZOOM_QUADUART_GPIO 102
23#define QUART_CLK 1843200 23#define QUART_CLK 1843200
24#define DEBUG_BASE 0x08000000 24#define DEBUG_BASE 0x08000000
25#define ZOOM2_ETHR_START DEBUG_BASE 25#define ZOOM_ETHR_START DEBUG_BASE
26 26
27static struct resource zoom2_smsc911x_resources[] = { 27static struct resource zoom_smsc911x_resources[] = {
28 [0] = { 28 [0] = {
29 .start = ZOOM2_ETHR_START, 29 .start = ZOOM_ETHR_START,
30 .end = ZOOM2_ETHR_START + SZ_4K, 30 .end = ZOOM_ETHR_START + SZ_4K,
31 .flags = IORESOURCE_MEM, 31 .flags = IORESOURCE_MEM,
32 }, 32 },
33 [1] = { 33 [1] = {
@@ -35,42 +35,42 @@ static struct resource zoom2_smsc911x_resources[] = {
35 }, 35 },
36}; 36};
37 37
38static struct smsc911x_platform_config zoom2_smsc911x_config = { 38static struct smsc911x_platform_config zoom_smsc911x_config = {
39 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 39 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
40 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, 40 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
41 .flags = SMSC911X_USE_32BIT, 41 .flags = SMSC911X_USE_32BIT,
42 .phy_interface = PHY_INTERFACE_MODE_MII, 42 .phy_interface = PHY_INTERFACE_MODE_MII,
43}; 43};
44 44
45static struct platform_device zoom2_smsc911x_device = { 45static struct platform_device zoom_smsc911x_device = {
46 .name = "smsc911x", 46 .name = "smsc911x",
47 .id = -1, 47 .id = -1,
48 .num_resources = ARRAY_SIZE(zoom2_smsc911x_resources), 48 .num_resources = ARRAY_SIZE(zoom_smsc911x_resources),
49 .resource = zoom2_smsc911x_resources, 49 .resource = zoom_smsc911x_resources,
50 .dev = { 50 .dev = {
51 .platform_data = &zoom2_smsc911x_config, 51 .platform_data = &zoom_smsc911x_config,
52 }, 52 },
53}; 53};
54 54
55static inline void __init zoom2_init_smsc911x(void) 55static inline void __init zoom_init_smsc911x(void)
56{ 56{
57 int eth_cs; 57 int eth_cs;
58 unsigned long cs_mem_base; 58 unsigned long cs_mem_base;
59 int eth_gpio = 0; 59 int eth_gpio = 0;
60 60
61 eth_cs = ZOOM2_SMSC911X_CS; 61 eth_cs = ZOOM_SMSC911X_CS;
62 62
63 if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { 63 if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
64 printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n"); 64 printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n");
65 return; 65 return;
66 } 66 }
67 67
68 zoom2_smsc911x_resources[0].start = cs_mem_base + 0x0; 68 zoom_smsc911x_resources[0].start = cs_mem_base + 0x0;
69 zoom2_smsc911x_resources[0].end = cs_mem_base + 0xff; 69 zoom_smsc911x_resources[0].end = cs_mem_base + 0xff;
70 70
71 eth_gpio = ZOOM2_SMSC911X_GPIO; 71 eth_gpio = ZOOM_SMSC911X_GPIO;
72 72
73 zoom2_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio); 73 zoom_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
74 74
75 if (gpio_request(eth_gpio, "smsc911x irq") < 0) { 75 if (gpio_request(eth_gpio, "smsc911x irq") < 0) {
76 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n", 76 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
@@ -94,7 +94,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
94 } 94 }
95}; 95};
96 96
97static struct platform_device zoom2_debugboard_serial_device = { 97static struct platform_device zoom_debugboard_serial_device = {
98 .name = "serial8250", 98 .name = "serial8250",
99 .id = 3, 99 .id = 3,
100 .dev = { 100 .dev = {
@@ -102,13 +102,13 @@ static struct platform_device zoom2_debugboard_serial_device = {
102 }, 102 },
103}; 103};
104 104
105static inline void __init zoom2_init_quaduart(void) 105static inline void __init zoom_init_quaduart(void)
106{ 106{
107 int quart_cs; 107 int quart_cs;
108 unsigned long cs_mem_base; 108 unsigned long cs_mem_base;
109 int quart_gpio = 0; 109 int quart_gpio = 0;
110 110
111 quart_cs = ZOOM2_QUADUART_CS; 111 quart_cs = ZOOM_QUADUART_CS;
112 112
113 if (gpmc_cs_request(quart_cs, SZ_1M, &cs_mem_base) < 0) { 113 if (gpmc_cs_request(quart_cs, SZ_1M, &cs_mem_base) < 0) {
114 printk(KERN_ERR "Failed to request GPMC mem" 114 printk(KERN_ERR "Failed to request GPMC mem"
@@ -116,7 +116,7 @@ static inline void __init zoom2_init_quaduart(void)
116 return; 116 return;
117 } 117 }
118 118
119 quart_gpio = ZOOM2_QUADUART_GPIO; 119 quart_gpio = ZOOM_QUADUART_GPIO;
120 120
121 if (gpio_request(quart_gpio, "TL16CP754C GPIO") < 0) { 121 if (gpio_request(quart_gpio, "TL16CP754C GPIO") < 0) {
122 printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C\n", 122 printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C\n",
@@ -126,15 +126,15 @@ static inline void __init zoom2_init_quaduart(void)
126 gpio_direction_input(quart_gpio); 126 gpio_direction_input(quart_gpio);
127} 127}
128 128
129static inline int omap_zoom2_debugboard_detect(void) 129static inline int omap_zoom_debugboard_detect(void)
130{ 130{
131 int debug_board_detect = 0; 131 int debug_board_detect = 0;
132 int ret = 1; 132 int ret = 1;
133 133
134 debug_board_detect = ZOOM2_SMSC911X_GPIO; 134 debug_board_detect = ZOOM_SMSC911X_GPIO;
135 135
136 if (gpio_request(debug_board_detect, "Zoom2 debug board detect") < 0) { 136 if (gpio_request(debug_board_detect, "Zoom debug board detect") < 0) {
137 printk(KERN_ERR "Failed to request GPIO%d for Zoom2 debug" 137 printk(KERN_ERR "Failed to request GPIO%d for Zoom debug"
138 "board detect\n", debug_board_detect); 138 "board detect\n", debug_board_detect);
139 return 0; 139 return 0;
140 } 140 }
@@ -147,17 +147,17 @@ static inline int omap_zoom2_debugboard_detect(void)
147 return ret; 147 return ret;
148} 148}
149 149
150static struct platform_device *zoom2_devices[] __initdata = { 150static struct platform_device *zoom_devices[] __initdata = {
151 &zoom2_smsc911x_device, 151 &zoom_smsc911x_device,
152 &zoom2_debugboard_serial_device, 152 &zoom_debugboard_serial_device,
153}; 153};
154 154
155int __init omap_zoom2_debugboard_init(void) 155int __init zoom_debugboard_init(void)
156{ 156{
157 if (!omap_zoom2_debugboard_detect()) 157 if (!omap_zoom_debugboard_detect())
158 return 0; 158 return 0;
159 159
160 zoom2_init_smsc911x(); 160 zoom_init_smsc911x();
161 zoom2_init_quaduart(); 161 zoom_init_quaduart();
162 return platform_add_devices(zoom2_devices, ARRAY_SIZE(zoom2_devices)); 162 return platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices));
163} 163}
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
new file mode 100755
index 000000000000..f14baa392760
--- /dev/null
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -0,0 +1,267 @@
1/*
2 * Copyright (C) 2009 Texas Instruments Inc.
3 *
4 * Modified from mach-omap2/board-zoom2.c
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/input.h>
15#include <linux/input/matrix_keypad.h>
16#include <linux/gpio.h>
17#include <linux/i2c/twl4030.h>
18#include <linux/regulator/machine.h>
19
20#include <asm/mach-types.h>
21#include <asm/mach/arch.h>
22#include <asm/mach/map.h>
23
24#include <plat/common.h>
25#include <plat/usb.h>
26
27#include "mmc-twl4030.h"
28
29/* Zoom2 has Qwerty keyboard*/
30static int board_keymap[] = {
31 KEY(0, 0, KEY_E),
32 KEY(0, 1, KEY_R),
33 KEY(0, 2, KEY_T),
34 KEY(0, 3, KEY_HOME),
35 KEY(0, 6, KEY_I),
36 KEY(0, 7, KEY_LEFTSHIFT),
37 KEY(1, 0, KEY_D),
38 KEY(1, 1, KEY_F),
39 KEY(1, 2, KEY_G),
40 KEY(1, 3, KEY_SEND),
41 KEY(1, 6, KEY_K),
42 KEY(1, 7, KEY_ENTER),
43 KEY(2, 0, KEY_X),
44 KEY(2, 1, KEY_C),
45 KEY(2, 2, KEY_V),
46 KEY(2, 3, KEY_END),
47 KEY(2, 6, KEY_DOT),
48 KEY(2, 7, KEY_CAPSLOCK),
49 KEY(3, 0, KEY_Z),
50 KEY(3, 1, KEY_KPPLUS),
51 KEY(3, 2, KEY_B),
52 KEY(3, 3, KEY_F1),
53 KEY(3, 6, KEY_O),
54 KEY(3, 7, KEY_SPACE),
55 KEY(4, 0, KEY_W),
56 KEY(4, 1, KEY_Y),
57 KEY(4, 2, KEY_U),
58 KEY(4, 3, KEY_F2),
59 KEY(4, 4, KEY_VOLUMEUP),
60 KEY(4, 6, KEY_L),
61 KEY(4, 7, KEY_LEFT),
62 KEY(5, 0, KEY_S),
63 KEY(5, 1, KEY_H),
64 KEY(5, 2, KEY_J),
65 KEY(5, 3, KEY_F3),
66 KEY(5, 5, KEY_VOLUMEDOWN),
67 KEY(5, 6, KEY_M),
68 KEY(5, 7, KEY_ENTER),
69 KEY(6, 0, KEY_Q),
70 KEY(6, 1, KEY_A),
71 KEY(6, 2, KEY_N),
72 KEY(6, 3, KEY_BACKSPACE),
73 KEY(6, 6, KEY_P),
74 KEY(6, 7, KEY_SELECT),
75 KEY(7, 0, KEY_PROG1), /*MACRO 1 <User defined> */
76 KEY(7, 1, KEY_PROG2), /*MACRO 2 <User defined> */
77 KEY(7, 2, KEY_PROG3), /*MACRO 3 <User defined> */
78 KEY(7, 3, KEY_PROG4), /*MACRO 4 <User defined> */
79 KEY(7, 5, KEY_RIGHT),
80 KEY(7, 6, KEY_UP),
81 KEY(7, 7, KEY_DOWN)
82};
83
84static struct matrix_keymap_data board_map_data = {
85 .keymap = board_keymap,
86 .keymap_size = ARRAY_SIZE(board_keymap),
87};
88
89static struct twl4030_keypad_data zoom_kp_twl4030_data = {
90 .keymap_data = &board_map_data,
91 .rows = 8,
92 .cols = 8,
93 .rep = 1,
94};
95
96static struct regulator_consumer_supply zoom_vmmc1_supply = {
97 .supply = "vmmc",
98};
99
100static struct regulator_consumer_supply zoom_vsim_supply = {
101 .supply = "vmmc_aux",
102};
103
104static struct regulator_consumer_supply zoom_vmmc2_supply = {
105 .supply = "vmmc",
106};
107
108/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
109static struct regulator_init_data zoom_vmmc1 = {
110 .constraints = {
111 .min_uV = 1850000,
112 .max_uV = 3150000,
113 .valid_modes_mask = REGULATOR_MODE_NORMAL
114 | REGULATOR_MODE_STANDBY,
115 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
116 | REGULATOR_CHANGE_MODE
117 | REGULATOR_CHANGE_STATUS,
118 },
119 .num_consumer_supplies = 1,
120 .consumer_supplies = &zoom_vmmc1_supply,
121};
122
123/* VMMC2 for MMC2 card */
124static struct regulator_init_data zoom_vmmc2 = {
125 .constraints = {
126 .min_uV = 1850000,
127 .max_uV = 1850000,
128 .apply_uV = true,
129 .valid_modes_mask = REGULATOR_MODE_NORMAL
130 | REGULATOR_MODE_STANDBY,
131 .valid_ops_mask = REGULATOR_CHANGE_MODE
132 | REGULATOR_CHANGE_STATUS,
133 },
134 .num_consumer_supplies = 1,
135 .consumer_supplies = &zoom_vmmc2_supply,
136};
137
138/* VSIM for OMAP VDD_MMC1A (i/o for DAT4..DAT7) */
139static struct regulator_init_data zoom_vsim = {
140 .constraints = {
141 .min_uV = 1800000,
142 .max_uV = 3000000,
143 .valid_modes_mask = REGULATOR_MODE_NORMAL
144 | REGULATOR_MODE_STANDBY,
145 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
146 | REGULATOR_CHANGE_MODE
147 | REGULATOR_CHANGE_STATUS,
148 },
149 .num_consumer_supplies = 1,
150 .consumer_supplies = &zoom_vsim_supply,
151};
152
153static struct twl4030_hsmmc_info mmc[] __initdata = {
154 {
155 .mmc = 1,
156 .wires = 4,
157 .gpio_wp = -EINVAL,
158 },
159 {
160 .mmc = 2,
161 .wires = 4,
162 .gpio_wp = -EINVAL,
163 },
164 {} /* Terminator */
165};
166
167static int zoom_twl_gpio_setup(struct device *dev,
168 unsigned gpio, unsigned ngpio)
169{
170 /* gpio + 0 is "mmc0_cd" (input/IRQ),
171 * gpio + 1 is "mmc1_cd" (input/IRQ)
172 */
173 mmc[0].gpio_cd = gpio + 0;
174 mmc[1].gpio_cd = gpio + 1;
175 twl4030_mmc_init(mmc);
176
177 /* link regulators to MMC adapters ... we "know" the
178 * regulators will be set up only *after* we return.
179 */
180 zoom_vmmc1_supply.dev = mmc[0].dev;
181 zoom_vsim_supply.dev = mmc[0].dev;
182 zoom_vmmc2_supply.dev = mmc[1].dev;
183
184 return 0;
185}
186
187
188static int zoom_batt_table[] = {
189/* 0 C*/
19030800, 29500, 28300, 27100,
19126000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
19217200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
19311600, 11200, 10800, 10400, 10000, 9630, 9280, 8950, 8620, 8310,
1948020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830,
1955640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170,
1964040, 3910, 3790, 3670, 3550
197};
198
199static struct twl4030_bci_platform_data zoom_bci_data = {
200 .battery_tmp_tbl = zoom_batt_table,
201 .tblsize = ARRAY_SIZE(zoom_batt_table),
202};
203
204static struct twl4030_usb_data zoom_usb_data = {
205 .usb_mode = T2_USB_MODE_ULPI,
206};
207
208static struct twl4030_gpio_platform_data zoom_gpio_data = {
209 .gpio_base = OMAP_MAX_GPIO_LINES,
210 .irq_base = TWL4030_GPIO_IRQ_BASE,
211 .irq_end = TWL4030_GPIO_IRQ_END,
212 .setup = zoom_twl_gpio_setup,
213};
214
215static struct twl4030_madc_platform_data zoom_madc_data = {
216 .irq_line = 1,
217};
218
219static struct twl4030_codec_audio_data zoom_audio_data = {
220 .audio_mclk = 26000000,
221};
222
223static struct twl4030_codec_data zoom_codec_data = {
224 .audio_mclk = 26000000,
225 .audio = &zoom_audio_data,
226};
227
228static struct twl4030_platform_data zoom_twldata = {
229 .irq_base = TWL4030_IRQ_BASE,
230 .irq_end = TWL4030_IRQ_END,
231
232 /* platform_data for children goes here */
233 .bci = &zoom_bci_data,
234 .madc = &zoom_madc_data,
235 .usb = &zoom_usb_data,
236 .gpio = &zoom_gpio_data,
237 .keypad = &zoom_kp_twl4030_data,
238 .codec = &zoom_codec_data,
239 .vmmc2 = &zoom_vmmc2,
240 .vsim = &zoom_vsim,
241
242};
243
244static struct i2c_board_info __initdata zoom_i2c_boardinfo[] = {
245 {
246 I2C_BOARD_INFO("twl5030", 0x48),
247 .flags = I2C_CLIENT_WAKE,
248 .irq = INT_34XX_SYS_NIRQ,
249 .platform_data = &zoom_twldata,
250 },
251};
252
253static int __init omap_i2c_init(void)
254{
255 omap_register_i2c_bus(1, 2400, zoom_i2c_boardinfo,
256 ARRAY_SIZE(zoom_i2c_boardinfo));
257 omap_register_i2c_bus(2, 400, NULL, 0);
258 omap_register_i2c_bus(3, 400, NULL, 0);
259 return 0;
260}
261
262void __init zoom_peripherals_init(void)
263{
264 omap_i2c_init();
265 omap_serial_init();
266 usb_musb_init();
267}
diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c
index fd3369d5e5cb..d94d047c7dce 100644
--- a/arch/arm/mach-omap2/board-zoom2.c
+++ b/arch/arm/mach-omap2/board-zoom2.c
@@ -14,223 +14,41 @@
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/input.h> 15#include <linux/input.h>
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/i2c/twl4030.h>
18#include <linux/regulator/machine.h>
19 17
20#include <asm/mach-types.h> 18#include <asm/mach-types.h>
21#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
22 20
23#include <mach/common.h> 21#include <plat/common.h>
24#include <mach/usb.h> 22#include <plat/board.h>
25#include <mach/keypad.h>
26 23
27#include "mmc-twl4030.h" 24#include <mach/board-zoom.h>
28#include "sdram-micron-mt46h32m32lf-6.h"
29
30/* Zoom2 has Qwerty keyboard*/
31static int board_keymap[] = {
32 KEY(0, 0, KEY_E),
33 KEY(1, 0, KEY_R),
34 KEY(2, 0, KEY_T),
35 KEY(3, 0, KEY_HOME),
36 KEY(6, 0, KEY_I),
37 KEY(7, 0, KEY_LEFTSHIFT),
38 KEY(0, 1, KEY_D),
39 KEY(1, 1, KEY_F),
40 KEY(2, 1, KEY_G),
41 KEY(3, 1, KEY_SEND),
42 KEY(6, 1, KEY_K),
43 KEY(7, 1, KEY_ENTER),
44 KEY(0, 2, KEY_X),
45 KEY(1, 2, KEY_C),
46 KEY(2, 2, KEY_V),
47 KEY(3, 2, KEY_END),
48 KEY(6, 2, KEY_DOT),
49 KEY(7, 2, KEY_CAPSLOCK),
50 KEY(0, 3, KEY_Z),
51 KEY(1, 3, KEY_KPPLUS),
52 KEY(2, 3, KEY_B),
53 KEY(3, 3, KEY_F1),
54 KEY(6, 3, KEY_O),
55 KEY(7, 3, KEY_SPACE),
56 KEY(0, 4, KEY_W),
57 KEY(1, 4, KEY_Y),
58 KEY(2, 4, KEY_U),
59 KEY(3, 4, KEY_F2),
60 KEY(4, 4, KEY_VOLUMEUP),
61 KEY(6, 4, KEY_L),
62 KEY(7, 4, KEY_LEFT),
63 KEY(0, 5, KEY_S),
64 KEY(1, 5, KEY_H),
65 KEY(2, 5, KEY_J),
66 KEY(3, 5, KEY_F3),
67 KEY(5, 5, KEY_VOLUMEDOWN),
68 KEY(6, 5, KEY_M),
69 KEY(4, 5, KEY_ENTER),
70 KEY(7, 5, KEY_RIGHT),
71 KEY(0, 6, KEY_Q),
72 KEY(1, 6, KEY_A),
73 KEY(2, 6, KEY_N),
74 KEY(3, 6, KEY_BACKSPACE),
75 KEY(6, 6, KEY_P),
76 KEY(7, 6, KEY_UP),
77 KEY(6, 7, KEY_SELECT),
78 KEY(7, 7, KEY_DOWN),
79 KEY(0, 7, KEY_PROG1), /*MACRO 1 <User defined> */
80 KEY(1, 7, KEY_PROG2), /*MACRO 2 <User defined> */
81 KEY(2, 7, KEY_PROG3), /*MACRO 3 <User defined> */
82 KEY(3, 7, KEY_PROG4), /*MACRO 4 <User defined> */
83 0
84};
85
86static struct matrix_keymap_data board_map_data = {
87 .keymap = board_keymap,
88 .keymap_size = ARRAY_SIZE(board_keymap),
89};
90
91static struct twl4030_keypad_data zoom2_kp_twl4030_data = {
92 .keymap_data = &board_map_data,
93 .rows = 8,
94 .cols = 8,
95 .rep = 1,
96};
97
98static struct omap_board_config_kernel zoom2_config[] __initdata = {
99};
100
101static struct regulator_consumer_supply zoom2_vmmc1_supply = {
102 .supply = "vmmc",
103};
104
105static struct regulator_consumer_supply zoom2_vsim_supply = {
106 .supply = "vmmc_aux",
107};
108
109static struct regulator_consumer_supply zoom2_vmmc2_supply = {
110 .supply = "vmmc",
111};
112
113/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
114static struct regulator_init_data zoom2_vmmc1 = {
115 .constraints = {
116 .min_uV = 1850000,
117 .max_uV = 3150000,
118 .valid_modes_mask = REGULATOR_MODE_NORMAL
119 | REGULATOR_MODE_STANDBY,
120 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
121 | REGULATOR_CHANGE_MODE
122 | REGULATOR_CHANGE_STATUS,
123 },
124 .num_consumer_supplies = 1,
125 .consumer_supplies = &zoom2_vmmc1_supply,
126};
127
128/* VMMC2 for MMC2 card */
129static struct regulator_init_data zoom2_vmmc2 = {
130 .constraints = {
131 .min_uV = 1850000,
132 .max_uV = 1850000,
133 .apply_uV = true,
134 .valid_modes_mask = REGULATOR_MODE_NORMAL
135 | REGULATOR_MODE_STANDBY,
136 .valid_ops_mask = REGULATOR_CHANGE_MODE
137 | REGULATOR_CHANGE_STATUS,
138 },
139 .num_consumer_supplies = 1,
140 .consumer_supplies = &zoom2_vmmc2_supply,
141};
142
143/* VSIM for OMAP VDD_MMC1A (i/o for DAT4..DAT7) */
144static struct regulator_init_data zoom2_vsim = {
145 .constraints = {
146 .min_uV = 1800000,
147 .max_uV = 3000000,
148 .valid_modes_mask = REGULATOR_MODE_NORMAL
149 | REGULATOR_MODE_STANDBY,
150 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
151 | REGULATOR_CHANGE_MODE
152 | REGULATOR_CHANGE_STATUS,
153 },
154 .num_consumer_supplies = 1,
155 .consumer_supplies = &zoom2_vsim_supply,
156};
157
158static struct twl4030_hsmmc_info mmc[] __initdata = {
159 {
160 .mmc = 1,
161 .wires = 4,
162 .gpio_wp = -EINVAL,
163 },
164 {
165 .mmc = 2,
166 .wires = 4,
167 .gpio_wp = -EINVAL,
168 },
169 {} /* Terminator */
170};
171 25
172static int zoom2_twl_gpio_setup(struct device *dev, 26#include "sdram-micron-mt46h32m32lf-6.h"
173 unsigned gpio, unsigned ngpio)
174{
175 /* gpio + 0 is "mmc0_cd" (input/IRQ),
176 * gpio + 1 is "mmc1_cd" (input/IRQ)
177 */
178 mmc[0].gpio_cd = gpio + 0;
179 mmc[1].gpio_cd = gpio + 1;
180 twl4030_mmc_init(mmc);
181
182 /* link regulators to MMC adapters ... we "know" the
183 * regulators will be set up only *after* we return.
184 */
185 zoom2_vmmc1_supply.dev = mmc[0].dev;
186 zoom2_vsim_supply.dev = mmc[0].dev;
187 zoom2_vmmc2_supply.dev = mmc[1].dev;
188
189 return 0;
190}
191
192
193static int zoom2_batt_table[] = {
194/* 0 C*/
19530800, 29500, 28300, 27100,
19626000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
19717200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
19811600, 11200, 10800, 10400, 10000, 9630, 9280, 8950, 8620, 8310,
1998020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830,
2005640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170,
2014040, 3910, 3790, 3670, 3550
202};
203
204static struct twl4030_bci_platform_data zoom2_bci_data = {
205 .battery_tmp_tbl = zoom2_batt_table,
206 .tblsize = ARRAY_SIZE(zoom2_batt_table),
207};
208
209static struct twl4030_usb_data zoom2_usb_data = {
210 .usb_mode = T2_USB_MODE_ULPI,
211};
212 27
213static void __init omap_zoom2_init_irq(void) 28static void __init omap_zoom2_init_irq(void)
214{ 29{
215 omap_board_config = zoom2_config;
216 omap_board_config_size = ARRAY_SIZE(zoom2_config);
217 omap2_init_common_hw(mt46h32m32lf6_sdrc_params, 30 omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
218 mt46h32m32lf6_sdrc_params); 31 mt46h32m32lf6_sdrc_params);
219 omap_init_irq(); 32 omap_init_irq();
220 omap_gpio_init(); 33 omap_gpio_init();
221} 34}
222 35
223static struct twl4030_gpio_platform_data zoom2_gpio_data = { 36/* REVISIT: These audio entries can be removed once MFD code is merged */
224 .gpio_base = OMAP_MAX_GPIO_LINES, 37#if 0
225 .irq_base = TWL4030_GPIO_IRQ_BASE,
226 .irq_end = TWL4030_GPIO_IRQ_END,
227 .setup = zoom2_twl_gpio_setup,
228};
229 38
230static struct twl4030_madc_platform_data zoom2_madc_data = { 39static struct twl4030_madc_platform_data zoom2_madc_data = {
231 .irq_line = 1, 40 .irq_line = 1,
232}; 41};
233 42
43static struct twl4030_codec_audio_data zoom2_audio_data = {
44 .audio_mclk = 26000000,
45};
46
47static struct twl4030_codec_data zoom2_codec_data = {
48 .audio_mclk = 26000000,
49 .audio = &zoom2_audio_data,
50};
51
234static struct twl4030_platform_data zoom2_twldata = { 52static struct twl4030_platform_data zoom2_twldata = {
235 .irq_base = TWL4030_IRQ_BASE, 53 .irq_base = TWL4030_IRQ_BASE,
236 .irq_end = TWL4030_IRQ_END, 54 .irq_end = TWL4030_IRQ_END,
@@ -241,38 +59,19 @@ static struct twl4030_platform_data zoom2_twldata = {
241 .usb = &zoom2_usb_data, 59 .usb = &zoom2_usb_data,
242 .gpio = &zoom2_gpio_data, 60 .gpio = &zoom2_gpio_data,
243 .keypad = &zoom2_kp_twl4030_data, 61 .keypad = &zoom2_kp_twl4030_data,
62 .codec = &zoom2_codec_data,
244 .vmmc1 = &zoom2_vmmc1, 63 .vmmc1 = &zoom2_vmmc1,
245 .vmmc2 = &zoom2_vmmc2, 64 .vmmc2 = &zoom2_vmmc2,
246 .vsim = &zoom2_vsim, 65 .vsim = &zoom2_vsim,
247 66
248}; 67};
249 68
250static struct i2c_board_info __initdata zoom2_i2c_boardinfo[] = { 69#endif
251 {
252 I2C_BOARD_INFO("twl4030", 0x48),
253 .flags = I2C_CLIENT_WAKE,
254 .irq = INT_34XX_SYS_NIRQ,
255 .platform_data = &zoom2_twldata,
256 },
257};
258
259static int __init omap_i2c_init(void)
260{
261 omap_register_i2c_bus(1, 2600, zoom2_i2c_boardinfo,
262 ARRAY_SIZE(zoom2_i2c_boardinfo));
263 omap_register_i2c_bus(2, 400, NULL, 0);
264 omap_register_i2c_bus(3, 400, NULL, 0);
265 return 0;
266}
267
268extern int __init omap_zoom2_debugboard_init(void);
269 70
270static void __init omap_zoom2_init(void) 71static void __init omap_zoom2_init(void)
271{ 72{
272 omap_i2c_init(); 73 zoom_peripherals_init();
273 omap_serial_init(); 74 zoom_debugboard_init();
274 omap_zoom2_debugboard_init();
275 usb_musb_init();
276} 75}
277 76
278static void __init omap_zoom2_map_io(void) 77static void __init omap_zoom2_map_io(void)
@@ -283,7 +82,7 @@ static void __init omap_zoom2_map_io(void)
283 82
284MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board") 83MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
285 .phys_io = 0x48000000, 84 .phys_io = 0x48000000,
286 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 85 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
287 .boot_params = 0x80000100, 86 .boot_params = 0x80000100,
288 .map_io = omap_zoom2_map_io, 87 .map_io = omap_zoom2_map_io,
289 .init_irq = omap_zoom2_init_irq, 88 .init_irq = omap_zoom2_init_irq,
diff --git a/arch/arm/mach-omap2/board-zoom3.c b/arch/arm/mach-omap2/board-zoom3.c
new file mode 100644
index 000000000000..8d965a6516c8
--- /dev/null
+++ b/arch/arm/mach-omap2/board-zoom3.c
@@ -0,0 +1,59 @@
1/*
2 * Copyright (C) 2009 Texas Instruments Inc.
3 *
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/platform_device.h>
13#include <linux/input.h>
14#include <linux/gpio.h>
15
16#include <asm/mach-types.h>
17#include <asm/mach/arch.h>
18
19#include <mach/board-zoom.h>
20
21#include <plat/common.h>
22#include <plat/board.h>
23
24#include "sdram-hynix-h8mbx00u0mer-0em.h"
25
26static void __init omap_zoom_map_io(void)
27{
28 omap2_set_globals_343x();
29 omap2_map_common_io();
30}
31
32static struct omap_board_config_kernel zoom_config[] __initdata = {
33};
34
35static void __init omap_zoom_init_irq(void)
36{
37 omap_board_config = zoom_config;
38 omap_board_config_size = ARRAY_SIZE(zoom_config);
39 omap2_init_common_hw(h8mbx00u0mer0em_sdrc_params,
40 h8mbx00u0mer0em_sdrc_params);
41 omap_init_irq();
42 omap_gpio_init();
43}
44
45static void __init omap_zoom_init(void)
46{
47 zoom_peripherals_init();
48 zoom_debugboard_init();
49}
50
51MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
52 .phys_io = 0x48000000,
53 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
54 .boot_params = 0x80000100,
55 .map_io = omap_zoom_map_io,
56 .init_irq = omap_zoom_init_irq,
57 .init_machine = omap_zoom_init,
58 .timer = &omap_timer,
59MACHINE_END
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index f2a92d614f0f..4716206547ac 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -24,13 +24,13 @@
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/bitops.h> 25#include <linux/bitops.h>
26 26
27#include <mach/clock.h> 27#include <plat/clock.h>
28#include <mach/clockdomain.h> 28#include <plat/clockdomain.h>
29#include <mach/cpu.h> 29#include <plat/cpu.h>
30#include <mach/prcm.h> 30#include <plat/prcm.h>
31#include <asm/div64.h> 31#include <asm/div64.h>
32 32
33#include <mach/sdrc.h> 33#include <plat/sdrc.h>
34#include "sdrc.h" 34#include "sdrc.h"
35#include "clock.h" 35#include "clock.h"
36#include "prm.h" 36#include "prm.h"
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 9ae7540f8af2..43b6bedaafd6 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -16,7 +16,7 @@
16#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_H 16#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_H
17#define __ARCH_ARM_MACH_OMAP2_CLOCK_H 17#define __ARCH_ARM_MACH_OMAP2_CLOCK_H
18 18
19#include <mach/clock.h> 19#include <plat/clock.h>
20 20
21/* The maximum error between a target DPLL rate and the rounded rate in Hz */ 21/* The maximum error between a target DPLL rate and the rounded rate in Hz */
22#define DEFAULT_DPLL_RATE_TOLERANCE 50000 22#define DEFAULT_DPLL_RATE_TOLERANCE 50000
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
index e2dbedd581e8..e70e7e000eaa 100644
--- a/arch/arm/mach-omap2/clock24xx.c
+++ b/arch/arm/mach-omap2/clock24xx.c
@@ -28,13 +28,13 @@
28#include <linux/cpufreq.h> 28#include <linux/cpufreq.h>
29#include <linux/bitops.h> 29#include <linux/bitops.h>
30 30
31#include <mach/clock.h> 31#include <plat/clock.h>
32#include <mach/sram.h> 32#include <plat/sram.h>
33#include <mach/prcm.h> 33#include <plat/prcm.h>
34#include <asm/div64.h> 34#include <asm/div64.h>
35#include <asm/clkdev.h> 35#include <asm/clkdev.h>
36 36
37#include <mach/sdrc.h> 37#include <plat/sdrc.h>
38#include "clock.h" 38#include "clock.h"
39#include "prm.h" 39#include "prm.h"
40#include "prm-regbits-24xx.h" 40#include "prm-regbits-24xx.h"
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 489556eecbd1..9f2feaf79865 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -27,13 +27,13 @@
27#include <linux/limits.h> 27#include <linux/limits.h>
28#include <linux/bitops.h> 28#include <linux/bitops.h>
29 29
30#include <mach/cpu.h> 30#include <plat/cpu.h>
31#include <mach/clock.h> 31#include <plat/clock.h>
32#include <mach/sram.h> 32#include <plat/sram.h>
33#include <asm/div64.h> 33#include <asm/div64.h>
34#include <asm/clkdev.h> 34#include <asm/clkdev.h>
35 35
36#include <mach/sdrc.h> 36#include <plat/sdrc.h>
37#include "clock.h" 37#include "clock.h"
38#include "prm.h" 38#include "prm.h"
39#include "prm-regbits-34xx.h" 39#include "prm-regbits-34xx.h"
@@ -119,7 +119,7 @@ static struct omap_clk omap34xx_clks[] = {
119 CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck, CK_343X), 119 CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck, CK_343X),
120 CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck, CK_343X), 120 CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck, CK_343X),
121 CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck, CK_343X), 121 CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck, CK_343X),
122 CLK(NULL, "emu_core_alwon_ck", &emu_core_alwon_ck, CK_343X), 122 CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck, CK_343X),
123 CLK(NULL, "dpll4_ck", &dpll4_ck, CK_343X), 123 CLK(NULL, "dpll4_ck", &dpll4_ck, CK_343X),
124 CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck, CK_343X), 124 CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck, CK_343X),
125 CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck, CK_343X), 125 CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck, CK_343X),
@@ -138,7 +138,7 @@ static struct omap_clk omap34xx_clks[] = {
138 CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck, CK_343X), 138 CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck, CK_343X),
139 CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck, CK_343X), 139 CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck, CK_343X),
140 CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck, CK_343X), 140 CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck, CK_343X),
141 CLK(NULL, "emu_per_alwon_ck", &emu_per_alwon_ck, CK_343X), 141 CLK("etb", "emu_per_alwon_ck", &emu_per_alwon_ck, CK_343X),
142 CLK(NULL, "dpll5_ck", &dpll5_ck, CK_3430ES2), 142 CLK(NULL, "dpll5_ck", &dpll5_ck, CK_3430ES2),
143 CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck, CK_3430ES2), 143 CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck, CK_3430ES2),
144 CLK(NULL, "clkout2_src_ck", &clkout2_src_ck, CK_343X), 144 CLK(NULL, "clkout2_src_ck", &clkout2_src_ck, CK_343X),
@@ -147,7 +147,7 @@ static struct omap_clk omap34xx_clks[] = {
147 CLK(NULL, "dpll1_fck", &dpll1_fck, CK_343X), 147 CLK(NULL, "dpll1_fck", &dpll1_fck, CK_343X),
148 CLK(NULL, "mpu_ck", &mpu_ck, CK_343X), 148 CLK(NULL, "mpu_ck", &mpu_ck, CK_343X),
149 CLK(NULL, "arm_fck", &arm_fck, CK_343X), 149 CLK(NULL, "arm_fck", &arm_fck, CK_343X),
150 CLK(NULL, "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_343X), 150 CLK("etb", "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_343X),
151 CLK(NULL, "dpll2_fck", &dpll2_fck, CK_343X), 151 CLK(NULL, "dpll2_fck", &dpll2_fck, CK_343X),
152 CLK(NULL, "iva2_ck", &iva2_ck, CK_343X), 152 CLK(NULL, "iva2_ck", &iva2_ck, CK_343X),
153 CLK(NULL, "l3_ick", &l3_ick, CK_343X), 153 CLK(NULL, "l3_ick", &l3_ick, CK_343X),
@@ -302,7 +302,7 @@ static struct omap_clk omap34xx_clks[] = {
302 CLK("omap-mcbsp.2", "fck", &mcbsp2_fck, CK_343X), 302 CLK("omap-mcbsp.2", "fck", &mcbsp2_fck, CK_343X),
303 CLK("omap-mcbsp.3", "fck", &mcbsp3_fck, CK_343X), 303 CLK("omap-mcbsp.3", "fck", &mcbsp3_fck, CK_343X),
304 CLK("omap-mcbsp.4", "fck", &mcbsp4_fck, CK_343X), 304 CLK("omap-mcbsp.4", "fck", &mcbsp4_fck, CK_343X),
305 CLK(NULL, "emu_src_ck", &emu_src_ck, CK_343X), 305 CLK("etb", "emu_src_ck", &emu_src_ck, CK_343X),
306 CLK(NULL, "pclk_fck", &pclk_fck, CK_343X), 306 CLK(NULL, "pclk_fck", &pclk_fck, CK_343X),
307 CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_343X), 307 CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_343X),
308 CLK(NULL, "atclk_fck", &atclk_fck, CK_343X), 308 CLK(NULL, "atclk_fck", &atclk_fck, CK_343X),
@@ -473,7 +473,7 @@ static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n)
473 unsigned long fint; 473 unsigned long fint;
474 u16 f = 0; 474 u16 f = 0;
475 475
476 fint = clk->dpll_data->clk_ref->rate / (n + 1); 476 fint = clk->dpll_data->clk_ref->rate / n;
477 477
478 pr_debug("clock: fint is %lu\n", fint); 478 pr_debug("clock: fint is %lu\n", fint);
479 479
diff --git a/arch/arm/mach-omap2/clock34xx.h b/arch/arm/mach-omap2/clock34xx.h
index c8119781e00a..8fe1bcb23dd9 100644
--- a/arch/arm/mach-omap2/clock34xx.h
+++ b/arch/arm/mach-omap2/clock34xx.h
@@ -19,7 +19,7 @@
19#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H 19#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H
20#define __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H 20#define __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H
21 21
22#include <mach/control.h> 22#include <plat/control.h>
23 23
24#include "clock.h" 24#include "clock.h"
25#include "cm.h" 25#include "cm.h"
@@ -489,9 +489,9 @@ static struct clk core_ck = {
489static struct clk dpll3_m2x2_ck = { 489static struct clk dpll3_m2x2_ck = {
490 .name = "dpll3_m2x2_ck", 490 .name = "dpll3_m2x2_ck",
491 .ops = &clkops_null, 491 .ops = &clkops_null,
492 .parent = &dpll3_x2_ck, 492 .parent = &dpll3_m2_ck,
493 .clkdm_name = "dpll3_clkdm", 493 .clkdm_name = "dpll3_clkdm",
494 .recalc = &followparent_recalc, 494 .recalc = &omap3_clkoutx2_recalc,
495}; 495};
496 496
497/* The PWRDN bit is apparently only available on 3430ES2 and above */ 497/* The PWRDN bit is apparently only available on 3430ES2 and above */
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 58aff8485df9..fcd82320a6a3 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -28,14 +28,14 @@
28 28
29#include <linux/bitops.h> 29#include <linux/bitops.h>
30 30
31#include <mach/clock.h> 31#include <plat/clock.h>
32 32
33#include "prm.h" 33#include "prm.h"
34#include "prm-regbits-24xx.h" 34#include "prm-regbits-24xx.h"
35#include "cm.h" 35#include "cm.h"
36 36
37#include <mach/powerdomain.h> 37#include <plat/powerdomain.h>
38#include <mach/clockdomain.h> 38#include <plat/clockdomain.h>
39 39
40/* clkdm_list contains all registered struct clockdomains */ 40/* clkdm_list contains all registered struct clockdomains */
41static LIST_HEAD(clkdm_list); 41static LIST_HEAD(clkdm_list);
diff --git a/arch/arm/mach-omap2/clockdomains.h b/arch/arm/mach-omap2/clockdomains.h
index fe319ae4ca0a..c4ee0761d908 100644
--- a/arch/arm/mach-omap2/clockdomains.h
+++ b/arch/arm/mach-omap2/clockdomains.h
@@ -10,7 +10,7 @@
10#ifndef __ARCH_ARM_MACH_OMAP2_CLOCKDOMAINS_H 10#ifndef __ARCH_ARM_MACH_OMAP2_CLOCKDOMAINS_H
11#define __ARCH_ARM_MACH_OMAP2_CLOCKDOMAINS_H 11#define __ARCH_ARM_MACH_OMAP2_CLOCKDOMAINS_H
12 12
13#include <mach/clockdomain.h> 13#include <plat/clockdomain.h>
14 14
15/* 15/*
16 * OMAP2/3-common clockdomains 16 * OMAP2/3-common clockdomains
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index cfd0b726ba44..a2fcfcc253cc 100644
--- a/arch/arm/mach-omap2/cm.h
+++ b/arch/arm/mach-omap2/cm.h
@@ -17,11 +17,11 @@
17#include "prcm-common.h" 17#include "prcm-common.h"
18 18
19#define OMAP2420_CM_REGADDR(module, reg) \ 19#define OMAP2420_CM_REGADDR(module, reg) \
20 OMAP2_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg)) 20 OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
21#define OMAP2430_CM_REGADDR(module, reg) \ 21#define OMAP2430_CM_REGADDR(module, reg) \
22 OMAP2_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg)) 22 OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
23#define OMAP34XX_CM_REGADDR(module, reg) \ 23#define OMAP34XX_CM_REGADDR(module, reg) \
24 OMAP2_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg)) 24 OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
25 25
26/* 26/*
27 * Architecture-specific global CM registers 27 * Architecture-specific global CM registers
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 5f3aad977842..cdd1f35636dd 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -15,11 +15,127 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/io.h> 16#include <linux/io.h>
17 17
18#include <mach/common.h> 18#include <plat/common.h>
19#include <mach/control.h> 19#include <plat/control.h>
20#include <plat/sdrc.h>
21#include "cm-regbits-34xx.h"
22#include "prm-regbits-34xx.h"
23#include "cm.h"
24#include "prm.h"
25#include "sdrc.h"
20 26
21static void __iomem *omap2_ctrl_base; 27static void __iomem *omap2_ctrl_base;
22 28
29#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
30struct omap3_scratchpad {
31 u32 boot_config_ptr;
32 u32 public_restore_ptr;
33 u32 secure_ram_restore_ptr;
34 u32 sdrc_module_semaphore;
35 u32 prcm_block_offset;
36 u32 sdrc_block_offset;
37};
38
39struct omap3_scratchpad_prcm_block {
40 u32 prm_clksrc_ctrl;
41 u32 prm_clksel;
42 u32 cm_clksel_core;
43 u32 cm_clksel_wkup;
44 u32 cm_clken_pll;
45 u32 cm_autoidle_pll;
46 u32 cm_clksel1_pll;
47 u32 cm_clksel2_pll;
48 u32 cm_clksel3_pll;
49 u32 cm_clken_pll_mpu;
50 u32 cm_autoidle_pll_mpu;
51 u32 cm_clksel1_pll_mpu;
52 u32 cm_clksel2_pll_mpu;
53 u32 prcm_block_size;
54};
55
56struct omap3_scratchpad_sdrc_block {
57 u16 sysconfig;
58 u16 cs_cfg;
59 u16 sharing;
60 u16 err_type;
61 u32 dll_a_ctrl;
62 u32 dll_b_ctrl;
63 u32 power;
64 u32 cs_0;
65 u32 mcfg_0;
66 u16 mr_0;
67 u16 emr_1_0;
68 u16 emr_2_0;
69 u16 emr_3_0;
70 u32 actim_ctrla_0;
71 u32 actim_ctrlb_0;
72 u32 rfr_ctrl_0;
73 u32 cs_1;
74 u32 mcfg_1;
75 u16 mr_1;
76 u16 emr_1_1;
77 u16 emr_2_1;
78 u16 emr_3_1;
79 u32 actim_ctrla_1;
80 u32 actim_ctrlb_1;
81 u32 rfr_ctrl_1;
82 u16 dcdl_1_ctrl;
83 u16 dcdl_2_ctrl;
84 u32 flags;
85 u32 block_size;
86};
87
88void *omap3_secure_ram_storage;
89
90/*
91 * This is used to store ARM registers in SDRAM before attempting
92 * an MPU OFF. The save and restore happens from the SRAM sleep code.
93 * The address is stored in scratchpad, so that it can be used
94 * during the restore path.
95 */
96u32 omap3_arm_context[128];
97
98struct omap3_control_regs {
99 u32 sysconfig;
100 u32 devconf0;
101 u32 mem_dftrw0;
102 u32 mem_dftrw1;
103 u32 msuspendmux_0;
104 u32 msuspendmux_1;
105 u32 msuspendmux_2;
106 u32 msuspendmux_3;
107 u32 msuspendmux_4;
108 u32 msuspendmux_5;
109 u32 sec_ctrl;
110 u32 devconf1;
111 u32 csirxfe;
112 u32 iva2_bootaddr;
113 u32 iva2_bootmod;
114 u32 debobs_0;
115 u32 debobs_1;
116 u32 debobs_2;
117 u32 debobs_3;
118 u32 debobs_4;
119 u32 debobs_5;
120 u32 debobs_6;
121 u32 debobs_7;
122 u32 debobs_8;
123 u32 prog_io0;
124 u32 prog_io1;
125 u32 dss_dpll_spreading;
126 u32 core_dpll_spreading;
127 u32 per_dpll_spreading;
128 u32 usbhost_dpll_spreading;
129 u32 pbias_lite;
130 u32 temp_sensor;
131 u32 sramldo4;
132 u32 sramldo5;
133 u32 csi;
134};
135
136static struct omap3_control_regs control_context;
137#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */
138
23#define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg)) 139#define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg))
24 140
25void __init omap2_set_globals_control(struct omap_globals *omap2_globals) 141void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
@@ -62,3 +178,268 @@ void omap_ctrl_writel(u32 val, u16 offset)
62 __raw_writel(val, OMAP_CTRL_REGADDR(offset)); 178 __raw_writel(val, OMAP_CTRL_REGADDR(offset));
63} 179}
64 180
181#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
182/*
183 * Clears the scratchpad contents in case of cold boot-
184 * called during bootup
185 */
186void omap3_clear_scratchpad_contents(void)
187{
188 u32 max_offset = OMAP343X_SCRATCHPAD_ROM_OFFSET;
189 u32 *v_addr;
190 u32 offset = 0;
191 v_addr = OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD_ROM);
192 if (prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) &
193 OMAP3430_GLOBAL_COLD_RST) {
194 for ( ; offset <= max_offset; offset += 0x4)
195 __raw_writel(0x0, (v_addr + offset));
196 prm_set_mod_reg_bits(OMAP3430_GLOBAL_COLD_RST, OMAP3430_GR_MOD,
197 OMAP3_PRM_RSTST_OFFSET);
198 }
199}
200
201/* Populate the scratchpad structure with restore structure */
202void omap3_save_scratchpad_contents(void)
203{
204 void * __iomem scratchpad_address;
205 u32 arm_context_addr;
206 struct omap3_scratchpad scratchpad_contents;
207 struct omap3_scratchpad_prcm_block prcm_block_contents;
208 struct omap3_scratchpad_sdrc_block sdrc_block_contents;
209
210 /* Populate the Scratchpad contents */
211 scratchpad_contents.boot_config_ptr = 0x0;
212 if (omap_rev() != OMAP3430_REV_ES3_0 &&
213 omap_rev() != OMAP3430_REV_ES3_1)
214 scratchpad_contents.public_restore_ptr =
215 virt_to_phys(get_restore_pointer());
216 else
217 scratchpad_contents.public_restore_ptr =
218 virt_to_phys(get_es3_restore_pointer());
219 if (omap_type() == OMAP2_DEVICE_TYPE_GP)
220 scratchpad_contents.secure_ram_restore_ptr = 0x0;
221 else
222 scratchpad_contents.secure_ram_restore_ptr =
223 (u32) __pa(omap3_secure_ram_storage);
224 scratchpad_contents.sdrc_module_semaphore = 0x0;
225 scratchpad_contents.prcm_block_offset = 0x2C;
226 scratchpad_contents.sdrc_block_offset = 0x64;
227
228 /* Populate the PRCM block contents */
229 prcm_block_contents.prm_clksrc_ctrl = prm_read_mod_reg(OMAP3430_GR_MOD,
230 OMAP3_PRM_CLKSRC_CTRL_OFFSET);
231 prcm_block_contents.prm_clksel = prm_read_mod_reg(OMAP3430_CCR_MOD,
232 OMAP3_PRM_CLKSEL_OFFSET);
233 prcm_block_contents.cm_clksel_core =
234 cm_read_mod_reg(CORE_MOD, CM_CLKSEL);
235 prcm_block_contents.cm_clksel_wkup =
236 cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
237 prcm_block_contents.cm_clken_pll =
238 cm_read_mod_reg(PLL_MOD, CM_CLKEN);
239 prcm_block_contents.cm_autoidle_pll =
240 cm_read_mod_reg(PLL_MOD, OMAP3430_CM_AUTOIDLE_PLL);
241 prcm_block_contents.cm_clksel1_pll =
242 cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL1_PLL);
243 prcm_block_contents.cm_clksel2_pll =
244 cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL2_PLL);
245 prcm_block_contents.cm_clksel3_pll =
246 cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL3);
247 prcm_block_contents.cm_clken_pll_mpu =
248 cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKEN_PLL);
249 prcm_block_contents.cm_autoidle_pll_mpu =
250 cm_read_mod_reg(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL);
251 prcm_block_contents.cm_clksel1_pll_mpu =
252 cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL);
253 prcm_block_contents.cm_clksel2_pll_mpu =
254 cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL);
255 prcm_block_contents.prcm_block_size = 0x0;
256
257 /* Populate the SDRC block contents */
258 sdrc_block_contents.sysconfig =
259 (sdrc_read_reg(SDRC_SYSCONFIG) & 0xFFFF);
260 sdrc_block_contents.cs_cfg =
261 (sdrc_read_reg(SDRC_CS_CFG) & 0xFFFF);
262 sdrc_block_contents.sharing =
263 (sdrc_read_reg(SDRC_SHARING) & 0xFFFF);
264 sdrc_block_contents.err_type =
265 (sdrc_read_reg(SDRC_ERR_TYPE) & 0xFFFF);
266 sdrc_block_contents.dll_a_ctrl = sdrc_read_reg(SDRC_DLLA_CTRL);
267 sdrc_block_contents.dll_b_ctrl = 0x0;
268 /*
269 * Due to a OMAP3 errata (1.142), on EMU/HS devices SRDC should
270 * be programed to issue automatic self refresh on timeout
271 * of AUTO_CNT = 1 prior to any transition to OFF mode.
272 */
273 if ((omap_type() != OMAP2_DEVICE_TYPE_GP)
274 && (omap_rev() >= OMAP3430_REV_ES3_0))
275 sdrc_block_contents.power = (sdrc_read_reg(SDRC_POWER) &
276 ~(SDRC_POWER_AUTOCOUNT_MASK|
277 SDRC_POWER_CLKCTRL_MASK)) |
278 (1 << SDRC_POWER_AUTOCOUNT_SHIFT) |
279 SDRC_SELF_REFRESH_ON_AUTOCOUNT;
280 else
281 sdrc_block_contents.power = sdrc_read_reg(SDRC_POWER);
282
283 sdrc_block_contents.cs_0 = 0x0;
284 sdrc_block_contents.mcfg_0 = sdrc_read_reg(SDRC_MCFG_0);
285 sdrc_block_contents.mr_0 = (sdrc_read_reg(SDRC_MR_0) & 0xFFFF);
286 sdrc_block_contents.emr_1_0 = 0x0;
287 sdrc_block_contents.emr_2_0 = 0x0;
288 sdrc_block_contents.emr_3_0 = 0x0;
289 sdrc_block_contents.actim_ctrla_0 =
290 sdrc_read_reg(SDRC_ACTIM_CTRL_A_0);
291 sdrc_block_contents.actim_ctrlb_0 =
292 sdrc_read_reg(SDRC_ACTIM_CTRL_B_0);
293 sdrc_block_contents.rfr_ctrl_0 =
294 sdrc_read_reg(SDRC_RFR_CTRL_0);
295 sdrc_block_contents.cs_1 = 0x0;
296 sdrc_block_contents.mcfg_1 = sdrc_read_reg(SDRC_MCFG_1);
297 sdrc_block_contents.mr_1 = sdrc_read_reg(SDRC_MR_1) & 0xFFFF;
298 sdrc_block_contents.emr_1_1 = 0x0;
299 sdrc_block_contents.emr_2_1 = 0x0;
300 sdrc_block_contents.emr_3_1 = 0x0;
301 sdrc_block_contents.actim_ctrla_1 =
302 sdrc_read_reg(SDRC_ACTIM_CTRL_A_1);
303 sdrc_block_contents.actim_ctrlb_1 =
304 sdrc_read_reg(SDRC_ACTIM_CTRL_B_1);
305 sdrc_block_contents.rfr_ctrl_1 =
306 sdrc_read_reg(SDRC_RFR_CTRL_1);
307 sdrc_block_contents.dcdl_1_ctrl = 0x0;
308 sdrc_block_contents.dcdl_2_ctrl = 0x0;
309 sdrc_block_contents.flags = 0x0;
310 sdrc_block_contents.block_size = 0x0;
311
312 arm_context_addr = virt_to_phys(omap3_arm_context);
313
314 /* Copy all the contents to the scratchpad location */
315 scratchpad_address = OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD);
316 memcpy_toio(scratchpad_address, &scratchpad_contents,
317 sizeof(scratchpad_contents));
318 /* Scratchpad contents being 32 bits, a divide by 4 done here */
319 memcpy_toio(scratchpad_address +
320 scratchpad_contents.prcm_block_offset,
321 &prcm_block_contents, sizeof(prcm_block_contents));
322 memcpy_toio(scratchpad_address +
323 scratchpad_contents.sdrc_block_offset,
324 &sdrc_block_contents, sizeof(sdrc_block_contents));
325 /*
326 * Copies the address of the location in SDRAM where ARM
327 * registers get saved during a MPU OFF transition.
328 */
329 memcpy_toio(scratchpad_address +
330 scratchpad_contents.sdrc_block_offset +
331 sizeof(sdrc_block_contents), &arm_context_addr, 4);
332}
333
334void omap3_control_save_context(void)
335{
336 control_context.sysconfig = omap_ctrl_readl(OMAP2_CONTROL_SYSCONFIG);
337 control_context.devconf0 = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
338 control_context.mem_dftrw0 =
339 omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW0);
340 control_context.mem_dftrw1 =
341 omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW1);
342 control_context.msuspendmux_0 =
343 omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_0);
344 control_context.msuspendmux_1 =
345 omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_1);
346 control_context.msuspendmux_2 =
347 omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_2);
348 control_context.msuspendmux_3 =
349 omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_3);
350 control_context.msuspendmux_4 =
351 omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_4);
352 control_context.msuspendmux_5 =
353 omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_5);
354 control_context.sec_ctrl = omap_ctrl_readl(OMAP2_CONTROL_SEC_CTRL);
355 control_context.devconf1 = omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1);
356 control_context.csirxfe = omap_ctrl_readl(OMAP343X_CONTROL_CSIRXFE);
357 control_context.iva2_bootaddr =
358 omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTADDR);
359 control_context.iva2_bootmod =
360 omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTMOD);
361 control_context.debobs_0 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(0));
362 control_context.debobs_1 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(1));
363 control_context.debobs_2 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(2));
364 control_context.debobs_3 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(3));
365 control_context.debobs_4 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(4));
366 control_context.debobs_5 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(5));
367 control_context.debobs_6 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(6));
368 control_context.debobs_7 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(7));
369 control_context.debobs_8 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(8));
370 control_context.prog_io0 = omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO0);
371 control_context.prog_io1 = omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO1);
372 control_context.dss_dpll_spreading =
373 omap_ctrl_readl(OMAP343X_CONTROL_DSS_DPLL_SPREADING);
374 control_context.core_dpll_spreading =
375 omap_ctrl_readl(OMAP343X_CONTROL_CORE_DPLL_SPREADING);
376 control_context.per_dpll_spreading =
377 omap_ctrl_readl(OMAP343X_CONTROL_PER_DPLL_SPREADING);
378 control_context.usbhost_dpll_spreading =
379 omap_ctrl_readl(OMAP343X_CONTROL_USBHOST_DPLL_SPREADING);
380 control_context.pbias_lite =
381 omap_ctrl_readl(OMAP343X_CONTROL_PBIAS_LITE);
382 control_context.temp_sensor =
383 omap_ctrl_readl(OMAP343X_CONTROL_TEMP_SENSOR);
384 control_context.sramldo4 = omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO4);
385 control_context.sramldo5 = omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO5);
386 control_context.csi = omap_ctrl_readl(OMAP343X_CONTROL_CSI);
387 return;
388}
389
390void omap3_control_restore_context(void)
391{
392 omap_ctrl_writel(control_context.sysconfig, OMAP2_CONTROL_SYSCONFIG);
393 omap_ctrl_writel(control_context.devconf0, OMAP2_CONTROL_DEVCONF0);
394 omap_ctrl_writel(control_context.mem_dftrw0,
395 OMAP343X_CONTROL_MEM_DFTRW0);
396 omap_ctrl_writel(control_context.mem_dftrw1,
397 OMAP343X_CONTROL_MEM_DFTRW1);
398 omap_ctrl_writel(control_context.msuspendmux_0,
399 OMAP2_CONTROL_MSUSPENDMUX_0);
400 omap_ctrl_writel(control_context.msuspendmux_1,
401 OMAP2_CONTROL_MSUSPENDMUX_1);
402 omap_ctrl_writel(control_context.msuspendmux_2,
403 OMAP2_CONTROL_MSUSPENDMUX_2);
404 omap_ctrl_writel(control_context.msuspendmux_3,
405 OMAP2_CONTROL_MSUSPENDMUX_3);
406 omap_ctrl_writel(control_context.msuspendmux_4,
407 OMAP2_CONTROL_MSUSPENDMUX_4);
408 omap_ctrl_writel(control_context.msuspendmux_5,
409 OMAP2_CONTROL_MSUSPENDMUX_5);
410 omap_ctrl_writel(control_context.sec_ctrl, OMAP2_CONTROL_SEC_CTRL);
411 omap_ctrl_writel(control_context.devconf1, OMAP343X_CONTROL_DEVCONF1);
412 omap_ctrl_writel(control_context.csirxfe, OMAP343X_CONTROL_CSIRXFE);
413 omap_ctrl_writel(control_context.iva2_bootaddr,
414 OMAP343X_CONTROL_IVA2_BOOTADDR);
415 omap_ctrl_writel(control_context.iva2_bootmod,
416 OMAP343X_CONTROL_IVA2_BOOTMOD);
417 omap_ctrl_writel(control_context.debobs_0, OMAP343X_CONTROL_DEBOBS(0));
418 omap_ctrl_writel(control_context.debobs_1, OMAP343X_CONTROL_DEBOBS(1));
419 omap_ctrl_writel(control_context.debobs_2, OMAP343X_CONTROL_DEBOBS(2));
420 omap_ctrl_writel(control_context.debobs_3, OMAP343X_CONTROL_DEBOBS(3));
421 omap_ctrl_writel(control_context.debobs_4, OMAP343X_CONTROL_DEBOBS(4));
422 omap_ctrl_writel(control_context.debobs_5, OMAP343X_CONTROL_DEBOBS(5));
423 omap_ctrl_writel(control_context.debobs_6, OMAP343X_CONTROL_DEBOBS(6));
424 omap_ctrl_writel(control_context.debobs_7, OMAP343X_CONTROL_DEBOBS(7));
425 omap_ctrl_writel(control_context.debobs_8, OMAP343X_CONTROL_DEBOBS(8));
426 omap_ctrl_writel(control_context.prog_io0, OMAP343X_CONTROL_PROG_IO0);
427 omap_ctrl_writel(control_context.prog_io1, OMAP343X_CONTROL_PROG_IO1);
428 omap_ctrl_writel(control_context.dss_dpll_spreading,
429 OMAP343X_CONTROL_DSS_DPLL_SPREADING);
430 omap_ctrl_writel(control_context.core_dpll_spreading,
431 OMAP343X_CONTROL_CORE_DPLL_SPREADING);
432 omap_ctrl_writel(control_context.per_dpll_spreading,
433 OMAP343X_CONTROL_PER_DPLL_SPREADING);
434 omap_ctrl_writel(control_context.usbhost_dpll_spreading,
435 OMAP343X_CONTROL_USBHOST_DPLL_SPREADING);
436 omap_ctrl_writel(control_context.pbias_lite,
437 OMAP343X_CONTROL_PBIAS_LITE);
438 omap_ctrl_writel(control_context.temp_sensor,
439 OMAP343X_CONTROL_TEMP_SENSOR);
440 omap_ctrl_writel(control_context.sramldo4, OMAP343X_CONTROL_SRAMLDO4);
441 omap_ctrl_writel(control_context.sramldo5, OMAP343X_CONTROL_SRAMLDO5);
442 omap_ctrl_writel(control_context.csi, OMAP343X_CONTROL_CSI);
443 return;
444}
445#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
new file mode 100644
index 000000000000..a26d6a08ae3f
--- /dev/null
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -0,0 +1,318 @@
1/*
2 * linux/arch/arm/mach-omap2/cpuidle34xx.c
3 *
4 * OMAP3 CPU IDLE Routines
5 *
6 * Copyright (C) 2008 Texas Instruments, Inc.
7 * Rajendra Nayak <rnayak@ti.com>
8 *
9 * Copyright (C) 2007 Texas Instruments, Inc.
10 * Karthik Dasu <karthik-dp@ti.com>
11 *
12 * Copyright (C) 2006 Nokia Corporation
13 * Tony Lindgren <tony@atomide.com>
14 *
15 * Copyright (C) 2005 Texas Instruments, Inc.
16 * Richard Woodruff <r-woodruff2@ti.com>
17 *
18 * Based on pm.c for omap2
19 *
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License version 2 as
22 * published by the Free Software Foundation.
23 */
24
25#include <linux/sched.h>
26#include <linux/cpuidle.h>
27
28#include <plat/prcm.h>
29#include <plat/irqs.h>
30#include <plat/powerdomain.h>
31#include <plat/clockdomain.h>
32#include <plat/control.h>
33#include <plat/serial.h>
34
35#include "pm.h"
36
37#ifdef CONFIG_CPU_IDLE
38
39#define OMAP3_MAX_STATES 7
40#define OMAP3_STATE_C1 0 /* C1 - MPU WFI + Core active */
41#define OMAP3_STATE_C2 1 /* C2 - MPU WFI + Core inactive */
42#define OMAP3_STATE_C3 2 /* C3 - MPU CSWR + Core inactive */
43#define OMAP3_STATE_C4 3 /* C4 - MPU OFF + Core iactive */
44#define OMAP3_STATE_C5 4 /* C5 - MPU RET + Core RET */
45#define OMAP3_STATE_C6 5 /* C6 - MPU OFF + Core RET */
46#define OMAP3_STATE_C7 6 /* C7 - MPU OFF + Core OFF */
47
48struct omap3_processor_cx {
49 u8 valid;
50 u8 type;
51 u32 sleep_latency;
52 u32 wakeup_latency;
53 u32 mpu_state;
54 u32 core_state;
55 u32 threshold;
56 u32 flags;
57};
58
59struct omap3_processor_cx omap3_power_states[OMAP3_MAX_STATES];
60struct omap3_processor_cx current_cx_state;
61struct powerdomain *mpu_pd, *core_pd;
62
63static int omap3_idle_bm_check(void)
64{
65 if (!omap3_can_sleep())
66 return 1;
67 return 0;
68}
69
70static int _cpuidle_allow_idle(struct powerdomain *pwrdm,
71 struct clockdomain *clkdm)
72{
73 omap2_clkdm_allow_idle(clkdm);
74 return 0;
75}
76
77static int _cpuidle_deny_idle(struct powerdomain *pwrdm,
78 struct clockdomain *clkdm)
79{
80 omap2_clkdm_deny_idle(clkdm);
81 return 0;
82}
83
84/**
85 * omap3_enter_idle - Programs OMAP3 to enter the specified state
86 * @dev: cpuidle device
87 * @state: The target state to be programmed
88 *
89 * Called from the CPUidle framework to program the device to the
90 * specified target state selected by the governor.
91 */
92static int omap3_enter_idle(struct cpuidle_device *dev,
93 struct cpuidle_state *state)
94{
95 struct omap3_processor_cx *cx = cpuidle_get_statedata(state);
96 struct timespec ts_preidle, ts_postidle, ts_idle;
97 u32 mpu_state = cx->mpu_state, core_state = cx->core_state;
98
99 current_cx_state = *cx;
100
101 /* Used to keep track of the total time in idle */
102 getnstimeofday(&ts_preidle);
103
104 local_irq_disable();
105 local_fiq_disable();
106
107 if (!enable_off_mode) {
108 if (mpu_state < PWRDM_POWER_RET)
109 mpu_state = PWRDM_POWER_RET;
110 if (core_state < PWRDM_POWER_RET)
111 core_state = PWRDM_POWER_RET;
112 }
113
114 pwrdm_set_next_pwrst(mpu_pd, mpu_state);
115 pwrdm_set_next_pwrst(core_pd, core_state);
116
117 if (omap_irq_pending() || need_resched())
118 goto return_sleep_time;
119
120 if (cx->type == OMAP3_STATE_C1) {
121 pwrdm_for_each_clkdm(mpu_pd, _cpuidle_deny_idle);
122 pwrdm_for_each_clkdm(core_pd, _cpuidle_deny_idle);
123 }
124
125 /* Execute ARM wfi */
126 omap_sram_idle();
127
128 if (cx->type == OMAP3_STATE_C1) {
129 pwrdm_for_each_clkdm(mpu_pd, _cpuidle_allow_idle);
130 pwrdm_for_each_clkdm(core_pd, _cpuidle_allow_idle);
131 }
132
133return_sleep_time:
134 getnstimeofday(&ts_postidle);
135 ts_idle = timespec_sub(ts_postidle, ts_preidle);
136
137 local_irq_enable();
138 local_fiq_enable();
139
140 return (u32)timespec_to_ns(&ts_idle)/1000;
141}
142
143/**
144 * omap3_enter_idle_bm - Checks for any bus activity
145 * @dev: cpuidle device
146 * @state: The target state to be programmed
147 *
148 * Used for C states with CPUIDLE_FLAG_CHECK_BM flag set. This
149 * function checks for any pending activity and then programs the
150 * device to the specified or a safer state.
151 */
152static int omap3_enter_idle_bm(struct cpuidle_device *dev,
153 struct cpuidle_state *state)
154{
155 struct cpuidle_state *new_state = state;
156
157 if ((state->flags & CPUIDLE_FLAG_CHECK_BM) && omap3_idle_bm_check()) {
158 BUG_ON(!dev->safe_state);
159 new_state = dev->safe_state;
160 }
161
162 dev->last_state = new_state;
163 return omap3_enter_idle(dev, new_state);
164}
165
166DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev);
167
168/* omap3_init_power_states - Initialises the OMAP3 specific C states.
169 *
170 * Below is the desciption of each C state.
171 * C1 . MPU WFI + Core active
172 * C2 . MPU WFI + Core inactive
173 * C3 . MPU CSWR + Core inactive
174 * C4 . MPU OFF + Core inactive
175 * C5 . MPU CSWR + Core CSWR
176 * C6 . MPU OFF + Core CSWR
177 * C7 . MPU OFF + Core OFF
178 */
179void omap_init_power_states(void)
180{
181 /* C1 . MPU WFI + Core active */
182 omap3_power_states[OMAP3_STATE_C1].valid = 1;
183 omap3_power_states[OMAP3_STATE_C1].type = OMAP3_STATE_C1;
184 omap3_power_states[OMAP3_STATE_C1].sleep_latency = 2;
185 omap3_power_states[OMAP3_STATE_C1].wakeup_latency = 2;
186 omap3_power_states[OMAP3_STATE_C1].threshold = 5;
187 omap3_power_states[OMAP3_STATE_C1].mpu_state = PWRDM_POWER_ON;
188 omap3_power_states[OMAP3_STATE_C1].core_state = PWRDM_POWER_ON;
189 omap3_power_states[OMAP3_STATE_C1].flags = CPUIDLE_FLAG_TIME_VALID;
190
191 /* C2 . MPU WFI + Core inactive */
192 omap3_power_states[OMAP3_STATE_C2].valid = 1;
193 omap3_power_states[OMAP3_STATE_C2].type = OMAP3_STATE_C2;
194 omap3_power_states[OMAP3_STATE_C2].sleep_latency = 10;
195 omap3_power_states[OMAP3_STATE_C2].wakeup_latency = 10;
196 omap3_power_states[OMAP3_STATE_C2].threshold = 30;
197 omap3_power_states[OMAP3_STATE_C2].mpu_state = PWRDM_POWER_ON;
198 omap3_power_states[OMAP3_STATE_C2].core_state = PWRDM_POWER_ON;
199 omap3_power_states[OMAP3_STATE_C2].flags = CPUIDLE_FLAG_TIME_VALID;
200
201 /* C3 . MPU CSWR + Core inactive */
202 omap3_power_states[OMAP3_STATE_C3].valid = 1;
203 omap3_power_states[OMAP3_STATE_C3].type = OMAP3_STATE_C3;
204 omap3_power_states[OMAP3_STATE_C3].sleep_latency = 50;
205 omap3_power_states[OMAP3_STATE_C3].wakeup_latency = 50;
206 omap3_power_states[OMAP3_STATE_C3].threshold = 300;
207 omap3_power_states[OMAP3_STATE_C3].mpu_state = PWRDM_POWER_RET;
208 omap3_power_states[OMAP3_STATE_C3].core_state = PWRDM_POWER_ON;
209 omap3_power_states[OMAP3_STATE_C3].flags = CPUIDLE_FLAG_TIME_VALID |
210 CPUIDLE_FLAG_CHECK_BM;
211
212 /* C4 . MPU OFF + Core inactive */
213 omap3_power_states[OMAP3_STATE_C4].valid = 1;
214 omap3_power_states[OMAP3_STATE_C4].type = OMAP3_STATE_C4;
215 omap3_power_states[OMAP3_STATE_C4].sleep_latency = 1500;
216 omap3_power_states[OMAP3_STATE_C4].wakeup_latency = 1800;
217 omap3_power_states[OMAP3_STATE_C4].threshold = 4000;
218 omap3_power_states[OMAP3_STATE_C4].mpu_state = PWRDM_POWER_OFF;
219 omap3_power_states[OMAP3_STATE_C4].core_state = PWRDM_POWER_ON;
220 omap3_power_states[OMAP3_STATE_C4].flags = CPUIDLE_FLAG_TIME_VALID |
221 CPUIDLE_FLAG_CHECK_BM;
222
223 /* C5 . MPU CSWR + Core CSWR*/
224 omap3_power_states[OMAP3_STATE_C5].valid = 1;
225 omap3_power_states[OMAP3_STATE_C5].type = OMAP3_STATE_C5;
226 omap3_power_states[OMAP3_STATE_C5].sleep_latency = 2500;
227 omap3_power_states[OMAP3_STATE_C5].wakeup_latency = 7500;
228 omap3_power_states[OMAP3_STATE_C5].threshold = 12000;
229 omap3_power_states[OMAP3_STATE_C5].mpu_state = PWRDM_POWER_RET;
230 omap3_power_states[OMAP3_STATE_C5].core_state = PWRDM_POWER_RET;
231 omap3_power_states[OMAP3_STATE_C5].flags = CPUIDLE_FLAG_TIME_VALID |
232 CPUIDLE_FLAG_CHECK_BM;
233
234 /* C6 . MPU OFF + Core CSWR */
235 omap3_power_states[OMAP3_STATE_C6].valid = 1;
236 omap3_power_states[OMAP3_STATE_C6].type = OMAP3_STATE_C6;
237 omap3_power_states[OMAP3_STATE_C6].sleep_latency = 3000;
238 omap3_power_states[OMAP3_STATE_C6].wakeup_latency = 8500;
239 omap3_power_states[OMAP3_STATE_C6].threshold = 15000;
240 omap3_power_states[OMAP3_STATE_C6].mpu_state = PWRDM_POWER_OFF;
241 omap3_power_states[OMAP3_STATE_C6].core_state = PWRDM_POWER_RET;
242 omap3_power_states[OMAP3_STATE_C6].flags = CPUIDLE_FLAG_TIME_VALID |
243 CPUIDLE_FLAG_CHECK_BM;
244
245 /* C7 . MPU OFF + Core OFF */
246 omap3_power_states[OMAP3_STATE_C7].valid = 1;
247 omap3_power_states[OMAP3_STATE_C7].type = OMAP3_STATE_C7;
248 omap3_power_states[OMAP3_STATE_C7].sleep_latency = 10000;
249 omap3_power_states[OMAP3_STATE_C7].wakeup_latency = 30000;
250 omap3_power_states[OMAP3_STATE_C7].threshold = 300000;
251 omap3_power_states[OMAP3_STATE_C7].mpu_state = PWRDM_POWER_OFF;
252 omap3_power_states[OMAP3_STATE_C7].core_state = PWRDM_POWER_OFF;
253 omap3_power_states[OMAP3_STATE_C7].flags = CPUIDLE_FLAG_TIME_VALID |
254 CPUIDLE_FLAG_CHECK_BM;
255}
256
257struct cpuidle_driver omap3_idle_driver = {
258 .name = "omap3_idle",
259 .owner = THIS_MODULE,
260};
261
262/**
263 * omap3_idle_init - Init routine for OMAP3 idle
264 *
265 * Registers the OMAP3 specific cpuidle driver with the cpuidle
266 * framework with the valid set of states.
267 */
268int __init omap3_idle_init(void)
269{
270 int i, count = 0;
271 struct omap3_processor_cx *cx;
272 struct cpuidle_state *state;
273 struct cpuidle_device *dev;
274
275 mpu_pd = pwrdm_lookup("mpu_pwrdm");
276 core_pd = pwrdm_lookup("core_pwrdm");
277
278 omap_init_power_states();
279 cpuidle_register_driver(&omap3_idle_driver);
280
281 dev = &per_cpu(omap3_idle_dev, smp_processor_id());
282
283 for (i = OMAP3_STATE_C1; i < OMAP3_MAX_STATES; i++) {
284 cx = &omap3_power_states[i];
285 state = &dev->states[count];
286
287 if (!cx->valid)
288 continue;
289 cpuidle_set_statedata(state, cx);
290 state->exit_latency = cx->sleep_latency + cx->wakeup_latency;
291 state->target_residency = cx->threshold;
292 state->flags = cx->flags;
293 state->enter = (state->flags & CPUIDLE_FLAG_CHECK_BM) ?
294 omap3_enter_idle_bm : omap3_enter_idle;
295 if (cx->type == OMAP3_STATE_C1)
296 dev->safe_state = state;
297 sprintf(state->name, "C%d", count+1);
298 count++;
299 }
300
301 if (!count)
302 return -EINVAL;
303 dev->state_count = count;
304
305 if (cpuidle_register_device(dev)) {
306 printk(KERN_ERR "%s: CPUidle register device failed\n",
307 __func__);
308 return -EIO;
309 }
310
311 return 0;
312}
313#else
314int __init omap3_idle_init(void)
315{
316 return 0;
317}
318#endif /* CONFIG_CPU_IDLE */
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index faf7a1e0c525..733d3dcff98b 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -20,12 +20,12 @@
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21#include <asm/mach/map.h> 21#include <asm/mach/map.h>
22 22
23#include <mach/control.h> 23#include <plat/control.h>
24#include <mach/tc.h> 24#include <plat/tc.h>
25#include <mach/board.h> 25#include <plat/board.h>
26#include <mach/mux.h> 26#include <plat/mux.h>
27#include <mach/gpio.h> 27#include <mach/gpio.h>
28#include <mach/mmc.h> 28#include <plat/mmc.h>
29 29
30#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE) 30#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
31 31
@@ -136,9 +136,10 @@ static inline void omap_init_camera(void)
136 136
137#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE) 137#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
138 138
139#define MBOX_REG_SIZE 0x120 139#define MBOX_REG_SIZE 0x120
140 140
141static struct resource omap2_mbox_resources[] = { 141#ifdef CONFIG_ARCH_OMAP2
142static struct resource omap_mbox_resources[] = {
142 { 143 {
143 .start = OMAP24XX_MAILBOX_BASE, 144 .start = OMAP24XX_MAILBOX_BASE,
144 .end = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1, 145 .end = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
@@ -153,8 +154,10 @@ static struct resource omap2_mbox_resources[] = {
153 .flags = IORESOURCE_IRQ, 154 .flags = IORESOURCE_IRQ,
154 }, 155 },
155}; 156};
157#endif
156 158
157static struct resource omap3_mbox_resources[] = { 159#ifdef CONFIG_ARCH_OMAP3
160static struct resource omap_mbox_resources[] = {
158 { 161 {
159 .start = OMAP34XX_MAILBOX_BASE, 162 .start = OMAP34XX_MAILBOX_BASE,
160 .end = OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1, 163 .end = OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
@@ -165,6 +168,24 @@ static struct resource omap3_mbox_resources[] = {
165 .flags = IORESOURCE_IRQ, 168 .flags = IORESOURCE_IRQ,
166 }, 169 },
167}; 170};
171#endif
172
173#ifdef CONFIG_ARCH_OMAP4
174
175#define OMAP4_MBOX_REG_SIZE 0x130
176static struct resource omap_mbox_resources[] = {
177 {
178 .start = OMAP44XX_MAILBOX_BASE,
179 .end = OMAP44XX_MAILBOX_BASE +
180 OMAP4_MBOX_REG_SIZE - 1,
181 .flags = IORESOURCE_MEM,
182 },
183 {
184 .start = INT_44XX_MAIL_U0_MPU,
185 .flags = IORESOURCE_IRQ,
186 },
187};
188#endif
168 189
169static struct platform_device mbox_device = { 190static struct platform_device mbox_device = {
170 .name = "omap2-mailbox", 191 .name = "omap2-mailbox",
@@ -173,12 +194,9 @@ static struct platform_device mbox_device = {
173 194
174static inline void omap_init_mbox(void) 195static inline void omap_init_mbox(void)
175{ 196{
176 if (cpu_is_omap2420()) { 197 if (cpu_is_omap2420() || cpu_is_omap3430() || cpu_is_omap44xx()) {
177 mbox_device.num_resources = ARRAY_SIZE(omap2_mbox_resources); 198 mbox_device.num_resources = ARRAY_SIZE(omap_mbox_resources);
178 mbox_device.resource = omap2_mbox_resources; 199 mbox_device.resource = omap_mbox_resources;
179 } else if (cpu_is_omap3430()) {
180 mbox_device.num_resources = ARRAY_SIZE(omap3_mbox_resources);
181 mbox_device.resource = omap3_mbox_resources;
182 } else { 200 } else {
183 pr_err("%s: platform not supported\n", __func__); 201 pr_err("%s: platform not supported\n", __func__);
184 return; 202 return;
@@ -250,7 +268,7 @@ static inline void omap_init_sti(void) {}
250 268
251#if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE) 269#if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
252 270
253#include <mach/mcspi.h> 271#include <plat/mcspi.h>
254 272
255#define OMAP2_MCSPI1_BASE 0x48098000 273#define OMAP2_MCSPI1_BASE 0x48098000
256#define OMAP2_MCSPI2_BASE 0x4809a000 274#define OMAP2_MCSPI2_BASE 0x4809a000
@@ -575,7 +593,7 @@ static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
575 } 593 }
576 } 594 }
577 595
578 if (cpu_is_omap3430()) { 596 if (cpu_is_omap34xx()) {
579 if (controller_nr == 0) { 597 if (controller_nr == 0) {
580 omap_cfg_reg(N28_3430_MMC1_CLK); 598 omap_cfg_reg(N28_3430_MMC1_CLK);
581 omap_cfg_reg(M27_3430_MMC1_CMD); 599 omap_cfg_reg(M27_3430_MMC1_CMD);
@@ -609,6 +627,12 @@ static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
609 omap_cfg_reg(AG4_3430_MMC2_DAT2); 627 omap_cfg_reg(AG4_3430_MMC2_DAT2);
610 omap_cfg_reg(AF4_3430_MMC2_DAT3); 628 omap_cfg_reg(AF4_3430_MMC2_DAT3);
611 } 629 }
630 if (mmc_controller->slots[0].wires == 8) {
631 omap_cfg_reg(AE4_3430_MMC2_DAT4);
632 omap_cfg_reg(AH3_3430_MMC2_DAT5);
633 omap_cfg_reg(AF3_3430_MMC2_DAT6);
634 omap_cfg_reg(AE3_3430_MMC2_DAT7);
635 }
612 } 636 }
613 637
614 /* 638 /*
diff --git a/arch/arm/mach-omap2/emu.c b/arch/arm/mach-omap2/emu.c
new file mode 100644
index 000000000000..ec0d984a26fc
--- /dev/null
+++ b/arch/arm/mach-omap2/emu.c
@@ -0,0 +1,66 @@
1/*
2 * emu.c
3 *
4 * ETM and ETB CoreSight components' resources as found in OMAP3xxx.
5 *
6 * Copyright (C) 2009 Nokia Corporation.
7 * Alexander Shishkin
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/types.h>
17#include <linux/module.h>
18#include <linux/device.h>
19#include <linux/amba/bus.h>
20#include <linux/io.h>
21#include <linux/clk.h>
22#include <linux/err.h>
23
24MODULE_LICENSE("GPL");
25MODULE_AUTHOR("Alexander Shishkin");
26
27/* Cortex CoreSight components within omap3xxx EMU */
28#define ETM_BASE (L4_EMU_34XX_PHYS + 0x10000)
29#define DBG_BASE (L4_EMU_34XX_PHYS + 0x11000)
30#define ETB_BASE (L4_EMU_34XX_PHYS + 0x1b000)
31#define DAPCTL (L4_EMU_34XX_PHYS + 0x1d000)
32
33static struct amba_device omap3_etb_device = {
34 .dev = {
35 .init_name = "etb",
36 },
37 .res = {
38 .start = ETB_BASE,
39 .end = ETB_BASE + SZ_4K - 1,
40 .flags = IORESOURCE_MEM,
41 },
42 .periphid = 0x000bb907,
43};
44
45static struct amba_device omap3_etm_device = {
46 .dev = {
47 .init_name = "etm",
48 },
49 .res = {
50 .start = ETM_BASE,
51 .end = ETM_BASE + SZ_4K - 1,
52 .flags = IORESOURCE_MEM,
53 },
54 .periphid = 0x102bb921,
55};
56
57static int __init emu_init(void)
58{
59 amba_device_register(&omap3_etb_device, &iomem_resource);
60 amba_device_register(&omap3_etm_device, &iomem_resource);
61
62 return 0;
63}
64
65subsys_initcall(emu_init);
66
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c
index 54fec53a48e7..7bb69220adfa 100644
--- a/arch/arm/mach-omap2/gpmc-onenand.c
+++ b/arch/arm/mach-omap2/gpmc-onenand.c
@@ -17,9 +17,9 @@
17 17
18#include <asm/mach/flash.h> 18#include <asm/mach/flash.h>
19 19
20#include <mach/onenand.h> 20#include <plat/onenand.h>
21#include <mach/board.h> 21#include <plat/board.h>
22#include <mach/gpmc.h> 22#include <plat/gpmc.h>
23 23
24static struct omap_onenand_platform_data *gpmc_onenand_data; 24static struct omap_onenand_platform_data *gpmc_onenand_data;
25 25
diff --git a/arch/arm/mach-omap2/gpmc-smc91x.c b/arch/arm/mach-omap2/gpmc-smc91x.c
index df99d31d8b64..6083e21b3be6 100644
--- a/arch/arm/mach-omap2/gpmc-smc91x.c
+++ b/arch/arm/mach-omap2/gpmc-smc91x.c
@@ -17,9 +17,9 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/smc91x.h> 18#include <linux/smc91x.h>
19 19
20#include <mach/board.h> 20#include <plat/board.h>
21#include <mach/gpmc.h> 21#include <plat/gpmc.h>
22#include <mach/gpmc-smc91x.h> 22#include <plat/gpmc-smc91x.h>
23 23
24static struct omap_smc91x_platform_data *gpmc_cfg; 24static struct omap_smc91x_platform_data *gpmc_cfg;
25 25
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 15876828db23..e86f5ca180ea 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -24,9 +24,9 @@
24#include <linux/module.h> 24#include <linux/module.h>
25 25
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <mach/gpmc.h> 27#include <plat/gpmc.h>
28 28
29#include <mach/sdrc.h> 29#include <plat/sdrc.h>
30 30
31/* GPMC register offsets */ 31/* GPMC register offsets */
32#define GPMC_REVISION 0x00 32#define GPMC_REVISION 0x00
@@ -62,6 +62,33 @@
62#define ENABLE_PREFETCH (0x1 << 7) 62#define ENABLE_PREFETCH (0x1 << 7)
63#define DMA_MPU_MODE 2 63#define DMA_MPU_MODE 2
64 64
65/* Structure to save gpmc cs context */
66struct gpmc_cs_config {
67 u32 config1;
68 u32 config2;
69 u32 config3;
70 u32 config4;
71 u32 config5;
72 u32 config6;
73 u32 config7;
74 int is_valid;
75};
76
77/*
78 * Structure to save/restore gpmc context
79 * to support core off on OMAP3
80 */
81struct omap3_gpmc_regs {
82 u32 sysconfig;
83 u32 irqenable;
84 u32 timeout_ctrl;
85 u32 config;
86 u32 prefetch_config1;
87 u32 prefetch_config2;
88 u32 prefetch_control;
89 struct gpmc_cs_config cs_context[GPMC_CS_NUM];
90};
91
65static struct resource gpmc_mem_root; 92static struct resource gpmc_mem_root;
66static struct resource gpmc_cs_mem[GPMC_CS_NUM]; 93static struct resource gpmc_cs_mem[GPMC_CS_NUM];
67static DEFINE_SPINLOCK(gpmc_mem_lock); 94static DEFINE_SPINLOCK(gpmc_mem_lock);
@@ -261,7 +288,7 @@ static void gpmc_cs_enable_mem(int cs, u32 base, u32 size)
261 l = (base >> GPMC_CHUNK_SHIFT) & 0x3f; 288 l = (base >> GPMC_CHUNK_SHIFT) & 0x3f;
262 l &= ~(0x0f << 8); 289 l &= ~(0x0f << 8);
263 l |= ((mask >> GPMC_CHUNK_SHIFT) & 0x0f) << 8; 290 l |= ((mask >> GPMC_CHUNK_SHIFT) & 0x0f) << 8;
264 l |= 1 << 6; /* CSVALID */ 291 l |= GPMC_CONFIG7_CSVALID;
265 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG7, l); 292 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG7, l);
266} 293}
267 294
@@ -270,7 +297,7 @@ static void gpmc_cs_disable_mem(int cs)
270 u32 l; 297 u32 l;
271 298
272 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); 299 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
273 l &= ~(1 << 6); /* CSVALID */ 300 l &= ~GPMC_CONFIG7_CSVALID;
274 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG7, l); 301 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG7, l);
275} 302}
276 303
@@ -290,7 +317,7 @@ static int gpmc_cs_mem_enabled(int cs)
290 u32 l; 317 u32 l;
291 318
292 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); 319 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
293 return l & (1 << 6); 320 return l & GPMC_CONFIG7_CSVALID;
294} 321}
295 322
296int gpmc_cs_set_reserved(int cs, int reserved) 323int gpmc_cs_set_reserved(int cs, int reserved)
@@ -366,7 +393,7 @@ int gpmc_cs_request(int cs, unsigned long size, unsigned long *base)
366 if (r < 0) 393 if (r < 0)
367 goto out; 394 goto out;
368 395
369 gpmc_cs_enable_mem(cs, res->start, res->end - res->start + 1); 396 gpmc_cs_enable_mem(cs, res->start, resource_size(res));
370 *base = res->start; 397 *base = res->start;
371 gpmc_cs_set_reserved(cs, 1); 398 gpmc_cs_set_reserved(cs, 1);
372out: 399out:
@@ -378,7 +405,7 @@ EXPORT_SYMBOL(gpmc_cs_request);
378void gpmc_cs_free(int cs) 405void gpmc_cs_free(int cs)
379{ 406{
380 spin_lock(&gpmc_mem_lock); 407 spin_lock(&gpmc_mem_lock);
381 if (cs >= GPMC_CS_NUM || !gpmc_cs_reserved(cs)) { 408 if (cs >= GPMC_CS_NUM || cs < 0 || !gpmc_cs_reserved(cs)) {
382 printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs); 409 printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs);
383 BUG(); 410 BUG();
384 spin_unlock(&gpmc_mem_lock); 411 spin_unlock(&gpmc_mem_lock);
@@ -516,3 +543,68 @@ void __init gpmc_init(void)
516 gpmc_write_reg(GPMC_SYSCONFIG, l); 543 gpmc_write_reg(GPMC_SYSCONFIG, l);
517 gpmc_mem_init(); 544 gpmc_mem_init();
518} 545}
546
547#ifdef CONFIG_ARCH_OMAP3
548static struct omap3_gpmc_regs gpmc_context;
549
550void omap3_gpmc_save_context()
551{
552 int i;
553 gpmc_context.sysconfig = gpmc_read_reg(GPMC_SYSCONFIG);
554 gpmc_context.irqenable = gpmc_read_reg(GPMC_IRQENABLE);
555 gpmc_context.timeout_ctrl = gpmc_read_reg(GPMC_TIMEOUT_CONTROL);
556 gpmc_context.config = gpmc_read_reg(GPMC_CONFIG);
557 gpmc_context.prefetch_config1 = gpmc_read_reg(GPMC_PREFETCH_CONFIG1);
558 gpmc_context.prefetch_config2 = gpmc_read_reg(GPMC_PREFETCH_CONFIG2);
559 gpmc_context.prefetch_control = gpmc_read_reg(GPMC_PREFETCH_CONTROL);
560 for (i = 0; i < GPMC_CS_NUM; i++) {
561 gpmc_context.cs_context[i].is_valid = gpmc_cs_mem_enabled(i);
562 if (gpmc_context.cs_context[i].is_valid) {
563 gpmc_context.cs_context[i].config1 =
564 gpmc_cs_read_reg(i, GPMC_CS_CONFIG1);
565 gpmc_context.cs_context[i].config2 =
566 gpmc_cs_read_reg(i, GPMC_CS_CONFIG2);
567 gpmc_context.cs_context[i].config3 =
568 gpmc_cs_read_reg(i, GPMC_CS_CONFIG3);
569 gpmc_context.cs_context[i].config4 =
570 gpmc_cs_read_reg(i, GPMC_CS_CONFIG4);
571 gpmc_context.cs_context[i].config5 =
572 gpmc_cs_read_reg(i, GPMC_CS_CONFIG5);
573 gpmc_context.cs_context[i].config6 =
574 gpmc_cs_read_reg(i, GPMC_CS_CONFIG6);
575 gpmc_context.cs_context[i].config7 =
576 gpmc_cs_read_reg(i, GPMC_CS_CONFIG7);
577 }
578 }
579}
580
581void omap3_gpmc_restore_context()
582{
583 int i;
584 gpmc_write_reg(GPMC_SYSCONFIG, gpmc_context.sysconfig);
585 gpmc_write_reg(GPMC_IRQENABLE, gpmc_context.irqenable);
586 gpmc_write_reg(GPMC_TIMEOUT_CONTROL, gpmc_context.timeout_ctrl);
587 gpmc_write_reg(GPMC_CONFIG, gpmc_context.config);
588 gpmc_write_reg(GPMC_PREFETCH_CONFIG1, gpmc_context.prefetch_config1);
589 gpmc_write_reg(GPMC_PREFETCH_CONFIG2, gpmc_context.prefetch_config2);
590 gpmc_write_reg(GPMC_PREFETCH_CONTROL, gpmc_context.prefetch_control);
591 for (i = 0; i < GPMC_CS_NUM; i++) {
592 if (gpmc_context.cs_context[i].is_valid) {
593 gpmc_cs_write_reg(i, GPMC_CS_CONFIG1,
594 gpmc_context.cs_context[i].config1);
595 gpmc_cs_write_reg(i, GPMC_CS_CONFIG2,
596 gpmc_context.cs_context[i].config2);
597 gpmc_cs_write_reg(i, GPMC_CS_CONFIG3,
598 gpmc_context.cs_context[i].config3);
599 gpmc_cs_write_reg(i, GPMC_CS_CONFIG4,
600 gpmc_context.cs_context[i].config4);
601 gpmc_cs_write_reg(i, GPMC_CS_CONFIG5,
602 gpmc_context.cs_context[i].config5);
603 gpmc_cs_write_reg(i, GPMC_CS_CONFIG6,
604 gpmc_context.cs_context[i].config6);
605 gpmc_cs_write_reg(i, GPMC_CS_CONFIG7,
606 gpmc_context.cs_context[i].config7);
607 }
608 }
609}
610#endif /* CONFIG_ARCH_OMAP3 */
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index a98201cc265c..f48a4b2654dd 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -21,13 +21,14 @@
21 21
22#include <asm/cputype.h> 22#include <asm/cputype.h>
23 23
24#include <mach/common.h> 24#include <plat/common.h>
25#include <mach/control.h> 25#include <plat/control.h>
26#include <mach/cpu.h> 26#include <plat/cpu.h>
27 27
28static struct omap_chip_id omap_chip; 28static struct omap_chip_id omap_chip;
29static unsigned int omap_revision; 29static unsigned int omap_revision;
30 30
31u32 omap3_features;
31 32
32unsigned int omap_rev(void) 33unsigned int omap_rev(void)
33{ 34{
@@ -52,11 +53,11 @@ int omap_type(void)
52{ 53{
53 u32 val = 0; 54 u32 val = 0;
54 55
55 if (cpu_is_omap24xx()) 56 if (cpu_is_omap24xx()) {
56 val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS); 57 val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
57 else if (cpu_is_omap34xx()) 58 } else if (cpu_is_omap34xx()) {
58 val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS); 59 val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
59 else { 60 } else {
60 pr_err("Cannot detect omap type!\n"); 61 pr_err("Cannot detect omap type!\n");
61 goto out; 62 goto out;
62 } 63 }
@@ -155,12 +156,37 @@ void __init omap24xx_check_revision(void)
155 pr_info("\n"); 156 pr_info("\n");
156} 157}
157 158
158void __init omap34xx_check_revision(void) 159#define OMAP3_CHECK_FEATURE(status,feat) \
160 if (((status & OMAP3_ ##feat## _MASK) \
161 >> OMAP3_ ##feat## _SHIFT) != FEAT_ ##feat## _NONE) { \
162 omap3_features |= OMAP3_HAS_ ##feat; \
163 }
164
165void __init omap3_check_features(void)
166{
167 u32 status;
168
169 omap3_features = 0;
170
171 status = omap_ctrl_readl(OMAP3_CONTROL_OMAP_STATUS);
172
173 OMAP3_CHECK_FEATURE(status, L2CACHE);
174 OMAP3_CHECK_FEATURE(status, IVA);
175 OMAP3_CHECK_FEATURE(status, SGX);
176 OMAP3_CHECK_FEATURE(status, NEON);
177 OMAP3_CHECK_FEATURE(status, ISP);
178
179 /*
180 * TODO: Get additional info (where applicable)
181 * e.g. Size of L2 cache.
182 */
183}
184
185void __init omap3_check_revision(void)
159{ 186{
160 u32 cpuid, idcode; 187 u32 cpuid, idcode;
161 u16 hawkeye; 188 u16 hawkeye;
162 u8 rev; 189 u8 rev;
163 char *rev_name = "ES1.0";
164 190
165 /* 191 /*
166 * We cannot access revision registers on ES1.0. 192 * We cannot access revision registers on ES1.0.
@@ -170,7 +196,7 @@ void __init omap34xx_check_revision(void)
170 cpuid = read_cpuid(CPUID_ID); 196 cpuid = read_cpuid(CPUID_ID);
171 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) { 197 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) {
172 omap_revision = OMAP3430_REV_ES1_0; 198 omap_revision = OMAP3430_REV_ES1_0;
173 goto out; 199 return;
174 } 200 }
175 201
176 /* 202 /*
@@ -183,33 +209,115 @@ void __init omap34xx_check_revision(void)
183 hawkeye = (idcode >> 12) & 0xffff; 209 hawkeye = (idcode >> 12) & 0xffff;
184 rev = (idcode >> 28) & 0xff; 210 rev = (idcode >> 28) & 0xff;
185 211
186 if (hawkeye == 0xb7ae) { 212 switch (hawkeye) {
213 case 0xb7ae:
214 /* Handle 34xx/35xx devices */
187 switch (rev) { 215 switch (rev) {
188 case 0: 216 case 0: /* Take care of early samples */
217 case 1:
189 omap_revision = OMAP3430_REV_ES2_0; 218 omap_revision = OMAP3430_REV_ES2_0;
190 rev_name = "ES2.0";
191 break; 219 break;
192 case 2: 220 case 2:
193 omap_revision = OMAP3430_REV_ES2_1; 221 omap_revision = OMAP3430_REV_ES2_1;
194 rev_name = "ES2.1";
195 break; 222 break;
196 case 3: 223 case 3:
197 omap_revision = OMAP3430_REV_ES3_0; 224 omap_revision = OMAP3430_REV_ES3_0;
198 rev_name = "ES3.0";
199 break; 225 break;
200 case 4: 226 case 4:
201 omap_revision = OMAP3430_REV_ES3_1; 227 /* FALLTHROUGH */
202 rev_name = "ES3.1";
203 break;
204 default: 228 default:
205 /* Use the latest known revision as default */ 229 /* Use the latest known revision as default */
206 omap_revision = OMAP3430_REV_ES3_1; 230 omap_revision = OMAP3430_REV_ES3_1;
207 rev_name = "Unknown revision\n";
208 } 231 }
232 break;
233 case 0xb868:
234 /* Handle OMAP35xx/AM35xx devices
235 *
236 * Set the device to be OMAP3505 here. Actual device
237 * is identified later based on the features.
238 */
239 omap_revision = OMAP3505_REV(rev);
240 break;
241 case 0xb891:
242 /* FALLTHROUGH */
243 default:
244 /* Unknown default to latest silicon rev as default*/
245 omap_revision = OMAP3630_REV_ES1_0;
209 } 246 }
247}
210 248
211out: 249#define OMAP3_SHOW_FEATURE(feat) \
212 pr_info("OMAP%04x %s\n", omap_rev() >> 16, rev_name); 250 if (omap3_has_ ##feat()) \
251 printk(#feat" ");
252
253void __init omap3_cpuinfo(void)
254{
255 u8 rev = GET_OMAP_REVISION();
256 char cpu_name[16], cpu_rev[16];
257
258 /* OMAP3430 and OMAP3530 are assumed to be same.
259 *
260 * OMAP3525, OMAP3515 and OMAP3503 can be detected only based
261 * on available features. Upon detection, update the CPU id
262 * and CPU class bits.
263 */
264 if (cpu_is_omap3630()) {
265 strcpy(cpu_name, "OMAP3630");
266 } else if (cpu_is_omap3505()) {
267 /*
268 * AM35xx devices
269 */
270 if (omap3_has_sgx()) {
271 omap_revision = OMAP3517_REV(rev);
272 strcpy(cpu_name, "AM3517");
273 } else {
274 /* Already set in omap3_check_revision() */
275 strcpy(cpu_name, "AM3505");
276 }
277 } else if (omap3_has_iva() && omap3_has_sgx()) {
278 /* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices */
279 strcpy(cpu_name, "OMAP3430/3530");
280 } else if (omap3_has_sgx()) {
281 omap_revision = OMAP3525_REV(rev);
282 strcpy(cpu_name, "OMAP3525");
283 } else if (omap3_has_iva()) {
284 omap_revision = OMAP3515_REV(rev);
285 strcpy(cpu_name, "OMAP3515");
286 } else {
287 omap_revision = OMAP3503_REV(rev);
288 strcpy(cpu_name, "OMAP3503");
289 }
290
291 switch (rev) {
292 case OMAP_REVBITS_00:
293 strcpy(cpu_rev, "1.0");
294 break;
295 case OMAP_REVBITS_10:
296 strcpy(cpu_rev, "2.0");
297 break;
298 case OMAP_REVBITS_20:
299 strcpy(cpu_rev, "2.1");
300 break;
301 case OMAP_REVBITS_30:
302 strcpy(cpu_rev, "3.0");
303 break;
304 case OMAP_REVBITS_40:
305 /* FALLTHROUGH */
306 default:
307 /* Use the latest known revision as default */
308 strcpy(cpu_rev, "3.1");
309 }
310
311 /* Print verbose information */
312 pr_info("%s ES%s (", cpu_name, cpu_rev);
313
314 OMAP3_SHOW_FEATURE(l2cache);
315 OMAP3_SHOW_FEATURE(iva);
316 OMAP3_SHOW_FEATURE(sgx);
317 OMAP3_SHOW_FEATURE(neon);
318 OMAP3_SHOW_FEATURE(isp);
319
320 printk(")\n");
213} 321}
214 322
215/* 323/*
@@ -221,15 +329,18 @@ void __init omap2_check_revision(void)
221 * At this point we have an idea about the processor revision set 329 * At this point we have an idea about the processor revision set
222 * earlier with omap2_set_globals_tap(). 330 * earlier with omap2_set_globals_tap().
223 */ 331 */
224 if (cpu_is_omap24xx()) 332 if (cpu_is_omap24xx()) {
225 omap24xx_check_revision(); 333 omap24xx_check_revision();
226 else if (cpu_is_omap34xx()) 334 } else if (cpu_is_omap34xx()) {
227 omap34xx_check_revision(); 335 omap3_check_revision();
228 else if (cpu_is_omap44xx()) { 336 omap3_check_features();
337 omap3_cpuinfo();
338 } else if (cpu_is_omap44xx()) {
229 printk(KERN_INFO "FIXME: CPU revision = OMAP4430\n"); 339 printk(KERN_INFO "FIXME: CPU revision = OMAP4430\n");
230 return; 340 return;
231 } else 341 } else {
232 pr_err("OMAP revision unknown, please fix!\n"); 342 pr_err("OMAP revision unknown, please fix!\n");
343 }
233 344
234 /* 345 /*
235 * OK, now we know the exact revision. Initialize omap_chip bits 346 * OK, now we know the exact revision. Initialize omap_chip bits
@@ -241,6 +352,8 @@ void __init omap2_check_revision(void)
241 } else if (cpu_is_omap242x()) { 352 } else if (cpu_is_omap242x()) {
242 /* Currently only supports 2420ES2.1.1 and 2420-all */ 353 /* Currently only supports 2420ES2.1.1 and 2420-all */
243 omap_chip.oc |= CHIP_IS_OMAP2420; 354 omap_chip.oc |= CHIP_IS_OMAP2420;
355 } else if (cpu_is_omap3505() || cpu_is_omap3517()) {
356 omap_chip.oc = CHIP_IS_OMAP3430 | CHIP_IS_OMAP3430ES3_1;
244 } else if (cpu_is_omap343x()) { 357 } else if (cpu_is_omap343x()) {
245 omap_chip.oc = CHIP_IS_OMAP3430; 358 omap_chip.oc = CHIP_IS_OMAP3430;
246 if (omap_rev() == OMAP3430_REV_ES1_0) 359 if (omap_rev() == OMAP3430_REV_ES1_0)
@@ -252,6 +365,8 @@ void __init omap2_check_revision(void)
252 omap_chip.oc |= CHIP_IS_OMAP3430ES3_0; 365 omap_chip.oc |= CHIP_IS_OMAP3430ES3_0;
253 else if (omap_rev() == OMAP3430_REV_ES3_1) 366 else if (omap_rev() == OMAP3430_REV_ES3_1)
254 omap_chip.oc |= CHIP_IS_OMAP3430ES3_1; 367 omap_chip.oc |= CHIP_IS_OMAP3430ES3_1;
368 else if (omap_rev() == OMAP3630_REV_ES1_0)
369 omap_chip.oc |= CHIP_IS_OMAP3630ES1;
255 } else { 370 } else {
256 pr_err("Uninitialized omap_chip, please fix!\n"); 371 pr_err("Uninitialized omap_chip, please fix!\n");
257 } 372 }
diff --git a/arch/arm/mach-omap2/include/mach/board-zoom.h b/arch/arm/mach-omap2/include/mach/board-zoom.h
new file mode 100644
index 000000000000..c93b29e21b78
--- /dev/null
+++ b/arch/arm/mach-omap2/include/mach/board-zoom.h
@@ -0,0 +1,5 @@
1/*
2 * Defines for zoom boards
3 */
4extern int __init zoom_debugboard_init(void);
5extern void __init zoom_peripherals_init(void);
diff --git a/arch/arm/mach-omap2/include/mach/clkdev.h b/arch/arm/mach-omap2/include/mach/clkdev.h
new file mode 100644
index 000000000000..53b027441c56
--- /dev/null
+++ b/arch/arm/mach-omap2/include/mach/clkdev.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-omap2/include/mach/clkdev.h
3 */
4
5#include <plat/clkdev.h>
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
new file mode 100644
index 000000000000..e9f255df9163
--- /dev/null
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -0,0 +1,59 @@
1/* arch/arm/mach-omap2/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ MMU enabled?
17#ifdef CONFIG_ARCH_OMAP2
18 moveq \rx, #0x48000000 @ physical base address
19 movne \rx, #0xfa000000 @ virtual base
20 orr \rx, \rx, #0x0006a000
21#ifdef CONFIG_OMAP_LL_DEBUG_UART2
22 add \rx, \rx, #0x00002000 @ UART 2
23#endif
24#ifdef CONFIG_OMAP_LL_DEBUG_UART3
25 add \rx, \rx, #0x00004000 @ UART 3
26#endif
27
28#elif defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
29 moveq \rx, #0x48000000 @ physical base address
30 movne \rx, #0xfa000000 @ virtual base
31 orr \rx, \rx, #0x0006a000
32#ifdef CONFIG_OMAP_LL_DEBUG_UART2
33 add \rx, \rx, #0x00002000 @ UART 2
34#endif
35#ifdef CONFIG_OMAP_LL_DEBUG_UART3
36 add \rx, \rx, #0x00fb0000 @ UART 3
37 add \rx, \rx, #0x00006000
38#endif
39#endif
40 .endm
41
42 .macro senduart,rd,rx
43 strb \rd, [\rx]
44 .endm
45
46 .macro busyuart,rd,rx
471001: ldrb \rd, [\rx, #(0x5 << 2)] @ OMAP-1510 and friends
48 and \rd, \rd, #0x60
49 teq \rd, #0x60
50 beq 1002f
51 ldrb \rd, [\rx, #(0x5 << 0)] @ OMAP-730 only
52 and \rd, \rd, #0x60
53 teq \rd, #0x60
54 bne 1001b
551002:
56 .endm
57
58 .macro waituart,rd,rx
59 .endm
diff --git a/arch/arm/mach-omap2/include/mach/entry-macro.S b/arch/arm/mach-omap2/include/mach/entry-macro.S
new file mode 100644
index 000000000000..c7f1720bf282
--- /dev/null
+++ b/arch/arm/mach-omap2/include/mach/entry-macro.S
@@ -0,0 +1,124 @@
1/*
2 * arch/arm/plat-omap/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for OMAP-based platforms
5 *
6 * Copyright (C) 2009 Texas Instruments
7 * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13#include <mach/hardware.h>
14#include <mach/io.h>
15#include <mach/irqs.h>
16#include <asm/hardware/gic.h>
17
18#include <plat/omap24xx.h>
19#include <plat/omap34xx.h>
20
21/* REVISIT: This should be set dynamically if CONFIG_MULTI_OMAP2 is selected */
22#if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430)
23#define OMAP2_VA_IC_BASE OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE)
24#elif defined(CONFIG_ARCH_OMAP34XX)
25#define OMAP2_VA_IC_BASE OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE)
26#endif
27#if defined(CONFIG_ARCH_OMAP4)
28#include <plat/omap44xx.h>
29#endif
30#define INTCPS_SIR_IRQ_OFFSET 0x0040 /* Active interrupt offset */
31#define ACTIVEIRQ_MASK 0x7f /* Active interrupt bits */
32
33 .macro disable_fiq
34 .endm
35
36 .macro get_irqnr_preamble, base, tmp
37 .endm
38
39 .macro arch_ret_to_user, tmp1, tmp2
40 .endm
41
42#ifndef CONFIG_ARCH_OMAP4
43 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
44 ldr \base, =OMAP2_VA_IC_BASE
45 ldr \irqnr, [\base, #0x98] /* IRQ pending reg 1 */
46 cmp \irqnr, #0x0
47 bne 2222f
48 ldr \irqnr, [\base, #0xb8] /* IRQ pending reg 2 */
49 cmp \irqnr, #0x0
50 bne 2222f
51 ldr \irqnr, [\base, #0xd8] /* IRQ pending reg 3 */
52 cmp \irqnr, #0x0
532222:
54 ldrne \irqnr, [\base, #INTCPS_SIR_IRQ_OFFSET]
55 and \irqnr, \irqnr, #ACTIVEIRQ_MASK /* Clear spurious bits */
56
57 .endm
58#else
59#define OMAP44XX_VA_GIC_CPU_BASE OMAP2_L4_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE)
60
61 /*
62 * The interrupt numbering scheme is defined in the
63 * interrupt controller spec. To wit:
64 *
65 * Interrupts 0-15 are IPI
66 * 16-28 are reserved
67 * 29-31 are local. We allow 30 to be used for the watchdog.
68 * 32-1020 are global
69 * 1021-1022 are reserved
70 * 1023 is "spurious" (no interrupt)
71 *
72 * For now, we ignore all local interrupts so only return an
73 * interrupt if it's between 30 and 1020. The test_for_ipi
74 * routine below will pick up on IPIs.
75 * A simple read from the controller will tell us the number
76 * of the highest priority enabled interrupt.
77 * We then just need to check whether it is in the
78 * valid range for an IRQ (30-1020 inclusive).
79 */
80 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
81 ldr \base, =OMAP44XX_VA_GIC_CPU_BASE
82 ldr \irqstat, [\base, #GIC_CPU_INTACK]
83
84 ldr \tmp, =1021
85
86 bic \irqnr, \irqstat, #0x1c00
87
88 cmp \irqnr, #29
89 cmpcc \irqnr, \irqnr
90 cmpne \irqnr, \tmp
91 cmpcs \irqnr, \irqnr
92 .endm
93
94 /* We assume that irqstat (the raw value of the IRQ acknowledge
95 * register) is preserved from the macro above.
96 * If there is an IPI, we immediately signal end of interrupt
97 * on the controller, since this requires the original irqstat
98 * value which we won't easily be able to recreate later.
99 */
100
101 .macro test_for_ipi, irqnr, irqstat, base, tmp
102 bic \irqnr, \irqstat, #0x1c00
103 cmp \irqnr, #16
104 it cc
105 strcc \irqstat, [\base, #GIC_CPU_EOI]
106 it cs
107 cmpcs \irqnr, \irqnr
108 .endm
109
110 /* As above, this assumes that irqstat and base are preserved */
111
112 .macro test_for_ltirq, irqnr, irqstat, base, tmp
113 bic \irqnr, \irqstat, #0x1c00
114 mov \tmp, #0
115 cmp \irqnr, #29
116 itt eq
117 moveq \tmp, #1
118 streq \irqstat, [\base, #GIC_CPU_EOI]
119 cmp \tmp, #0
120 .endm
121#endif
122
123 .macro irq_prio_table
124 .endm
diff --git a/arch/arm/mach-omap2/include/mach/gpio.h b/arch/arm/mach-omap2/include/mach/gpio.h
new file mode 100644
index 000000000000..be4d290d57ee
--- /dev/null
+++ b/arch/arm/mach-omap2/include/mach/gpio.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-omap2/include/mach/gpio.h
3 */
4
5#include <plat/gpio.h>
diff --git a/arch/arm/mach-omap2/include/mach/hardware.h b/arch/arm/mach-omap2/include/mach/hardware.h
new file mode 100644
index 000000000000..78edf9d33f71
--- /dev/null
+++ b/arch/arm/mach-omap2/include/mach/hardware.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-omap2/include/mach/hardware.h
3 */
4
5#include <plat/hardware.h>
diff --git a/arch/arm/mach-omap2/include/mach/io.h b/arch/arm/mach-omap2/include/mach/io.h
new file mode 100644
index 000000000000..fd78f31aa1ad
--- /dev/null
+++ b/arch/arm/mach-omap2/include/mach/io.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-omap2/include/mach/io.h
3 */
4
5#include <plat/io.h>
diff --git a/arch/arm/mach-omap2/include/mach/irqs.h b/arch/arm/mach-omap2/include/mach/irqs.h
new file mode 100644
index 000000000000..44dab7725696
--- /dev/null
+++ b/arch/arm/mach-omap2/include/mach/irqs.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-omap2/include/mach/irqs.h
3 */
4
5#include <plat/irqs.h>
diff --git a/arch/arm/mach-omap2/include/mach/memory.h b/arch/arm/mach-omap2/include/mach/memory.h
new file mode 100644
index 000000000000..ca6d32a917dd
--- /dev/null
+++ b/arch/arm/mach-omap2/include/mach/memory.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-omap2/include/mach/memory.h
3 */
4
5#include <plat/memory.h>
diff --git a/arch/arm/mach-omap2/include/mach/smp.h b/arch/arm/mach-omap2/include/mach/smp.h
new file mode 100644
index 000000000000..323675f21b69
--- /dev/null
+++ b/arch/arm/mach-omap2/include/mach/smp.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-omap2/include/mach/smp.h
3 */
4
5#include <plat/smp.h>
diff --git a/arch/arm/mach-omap2/include/mach/system.h b/arch/arm/mach-omap2/include/mach/system.h
new file mode 100644
index 000000000000..d488721ab90b
--- /dev/null
+++ b/arch/arm/mach-omap2/include/mach/system.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-omap2/include/mach/system.h
3 */
4
5#include <plat/system.h>
diff --git a/arch/arm/mach-omap2/include/mach/timex.h b/arch/arm/mach-omap2/include/mach/timex.h
new file mode 100644
index 000000000000..de9f8fc40e7c
--- /dev/null
+++ b/arch/arm/mach-omap2/include/mach/timex.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-omap2/include/mach/timex.h
3 */
4
5#include <plat/timex.h>
diff --git a/arch/arm/mach-omap2/include/mach/uncompress.h b/arch/arm/mach-omap2/include/mach/uncompress.h
new file mode 100644
index 000000000000..78e0557bfd4e
--- /dev/null
+++ b/arch/arm/mach-omap2/include/mach/uncompress.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-omap2/include/mach/uncompress.h
3 */
4
5#include <plat/uncompress.h>
diff --git a/arch/arm/mach-omap2/include/mach/vmalloc.h b/arch/arm/mach-omap2/include/mach/vmalloc.h
new file mode 100644
index 000000000000..9ce9b6e8ad23
--- /dev/null
+++ b/arch/arm/mach-omap2/include/mach/vmalloc.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/plat-omap/include/mach/vmalloc.h
3 *
4 * Copyright (C) 2000 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#define VMALLOC_END (PAGE_OFFSET + 0x38000000)
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index e3a3bad1d84f..59d28b2fd8c5 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -27,24 +27,24 @@
27 27
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29 29
30#include <mach/mux.h> 30#include <plat/mux.h>
31#include <mach/omapfb.h> 31#include <plat/omapfb.h>
32#include <mach/sram.h> 32#include <plat/sram.h>
33#include <mach/sdrc.h> 33#include <plat/sdrc.h>
34#include <mach/gpmc.h> 34#include <plat/gpmc.h>
35#include <mach/serial.h> 35#include <plat/serial.h>
36 36
37#ifndef CONFIG_ARCH_OMAP4 /* FIXME: Remove this once clkdev is ready */ 37#ifndef CONFIG_ARCH_OMAP4 /* FIXME: Remove this once clkdev is ready */
38#include "clock.h" 38#include "clock.h"
39 39
40#include <mach/omap-pm.h> 40#include <plat/omap-pm.h>
41#include <mach/powerdomain.h> 41#include <plat/powerdomain.h>
42#include "powerdomains.h" 42#include "powerdomains.h"
43 43
44#include <mach/clockdomain.h> 44#include <plat/clockdomain.h>
45#include "clockdomains.h" 45#include "clockdomains.h"
46#endif 46#endif
47#include <mach/omap_hwmod.h> 47#include <plat/omap_hwmod.h>
48#include "omap_hwmod_2420.h" 48#include "omap_hwmod_2420.h"
49#include "omap_hwmod_2430.h" 49#include "omap_hwmod_2430.h"
50#include "omap_hwmod_34xx.h" 50#include "omap_hwmod_34xx.h"
@@ -203,6 +203,24 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
203 .type = MT_DEVICE, 203 .type = MT_DEVICE,
204 }, 204 },
205 { 205 {
206 .virtual = OMAP44XX_EMIF1_VIRT,
207 .pfn = __phys_to_pfn(OMAP44XX_EMIF1_PHYS),
208 .length = OMAP44XX_EMIF1_SIZE,
209 .type = MT_DEVICE,
210 },
211 {
212 .virtual = OMAP44XX_EMIF2_VIRT,
213 .pfn = __phys_to_pfn(OMAP44XX_EMIF2_PHYS),
214 .length = OMAP44XX_EMIF2_SIZE,
215 .type = MT_DEVICE,
216 },
217 {
218 .virtual = OMAP44XX_DMM_VIRT,
219 .pfn = __phys_to_pfn(OMAP44XX_DMM_PHYS),
220 .length = OMAP44XX_DMM_SIZE,
221 .type = MT_DEVICE,
222 },
223 {
206 .virtual = L4_PER_44XX_VIRT, 224 .virtual = L4_PER_44XX_VIRT,
207 .pfn = __phys_to_pfn(L4_PER_44XX_PHYS), 225 .pfn = __phys_to_pfn(L4_PER_44XX_PHYS),
208 .length = L4_PER_44XX_SIZE, 226 .length = L4_PER_44XX_SIZE,
@@ -302,7 +320,9 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
302 pwrdm_init(powerdomains_omap); 320 pwrdm_init(powerdomains_omap);
303 clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps); 321 clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
304 omap2_clk_init(); 322 omap2_clk_init();
323#endif
305 omap_serial_early_init(); 324 omap_serial_early_init();
325#ifndef CONFIG_ARCH_OMAP4
306 omap_hwmod_late_init(); 326 omap_hwmod_late_init();
307 omap_pm_if_init(); 327 omap_pm_if_init();
308 omap2_sdrc_init(sdrc_cs0, sdrc_cs1); 328 omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
diff --git a/arch/arm/mach-omap2/iommu2.c b/arch/arm/mach-omap2/iommu2.c
index 4a0e1cd5c1f4..6f4b7cc8f4d1 100644
--- a/arch/arm/mach-omap2/iommu2.c
+++ b/arch/arm/mach-omap2/iommu2.c
@@ -17,7 +17,7 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/stringify.h> 18#include <linux/stringify.h>
19 19
20#include <mach/iommu.h> 20#include <plat/iommu.h>
21 21
22/* 22/*
23 * omap2 architecture specific register bit definitions 23 * omap2 architecture specific register bit definitions
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index b82863887f10..e9bc782fa414 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -25,6 +25,10 @@
25#define INTC_SYSSTATUS 0x0014 25#define INTC_SYSSTATUS 0x0014
26#define INTC_SIR 0x0040 26#define INTC_SIR 0x0040
27#define INTC_CONTROL 0x0048 27#define INTC_CONTROL 0x0048
28#define INTC_PROTECTION 0x004C
29#define INTC_IDLE 0x0050
30#define INTC_THRESHOLD 0x0068
31#define INTC_MIR0 0x0084
28#define INTC_MIR_CLEAR0 0x0088 32#define INTC_MIR_CLEAR0 0x0088
29#define INTC_MIR_SET0 0x008c 33#define INTC_MIR_SET0 0x008c
30#define INTC_PENDING_IRQ0 0x0098 34#define INTC_PENDING_IRQ0 0x0098
@@ -48,6 +52,18 @@ static struct omap_irq_bank {
48 }, 52 },
49}; 53};
50 54
55/* Structure to save interrupt controller context */
56struct omap3_intc_regs {
57 u32 sysconfig;
58 u32 protection;
59 u32 idle;
60 u32 threshold;
61 u32 ilr[INTCPS_NR_IRQS];
62 u32 mir[INTCPS_NR_MIR_REGS];
63};
64
65static struct omap3_intc_regs intc_context[ARRAY_SIZE(irq_banks)];
66
51/* INTC bank register get/set */ 67/* INTC bank register get/set */
52 68
53static void intc_bank_write_reg(u32 val, struct omap_irq_bank *bank, u16 reg) 69static void intc_bank_write_reg(u32 val, struct omap_irq_bank *bank, u16 reg)
@@ -178,12 +194,20 @@ void __init omap_init_irq(void)
178 int i; 194 int i;
179 195
180 for (i = 0; i < ARRAY_SIZE(irq_banks); i++) { 196 for (i = 0; i < ARRAY_SIZE(irq_banks); i++) {
197 unsigned long base;
181 struct omap_irq_bank *bank = irq_banks + i; 198 struct omap_irq_bank *bank = irq_banks + i;
182 199
183 if (cpu_is_omap24xx()) 200 if (cpu_is_omap24xx())
184 bank->base_reg = OMAP2_IO_ADDRESS(OMAP24XX_IC_BASE); 201 base = OMAP24XX_IC_BASE;
185 else if (cpu_is_omap34xx()) 202 else if (cpu_is_omap34xx())
186 bank->base_reg = OMAP2_IO_ADDRESS(OMAP34XX_IC_BASE); 203 base = OMAP34XX_IC_BASE;
204
205 /* Static mapping, never released */
206 bank->base_reg = ioremap(base, SZ_4K);
207 if (!bank->base_reg) {
208 printk(KERN_ERR "Could not ioremap irq bank%i\n", i);
209 continue;
210 }
187 211
188 omap_irq_bank_init_one(bank); 212 omap_irq_bank_init_one(bank);
189 213
@@ -201,3 +225,53 @@ void __init omap_init_irq(void)
201 } 225 }
202} 226}
203 227
228#ifdef CONFIG_ARCH_OMAP3
229void omap_intc_save_context(void)
230{
231 int ind = 0, i = 0;
232 for (ind = 0; ind < ARRAY_SIZE(irq_banks); ind++) {
233 struct omap_irq_bank *bank = irq_banks + ind;
234 intc_context[ind].sysconfig =
235 intc_bank_read_reg(bank, INTC_SYSCONFIG);
236 intc_context[ind].protection =
237 intc_bank_read_reg(bank, INTC_PROTECTION);
238 intc_context[ind].idle =
239 intc_bank_read_reg(bank, INTC_IDLE);
240 intc_context[ind].threshold =
241 intc_bank_read_reg(bank, INTC_THRESHOLD);
242 for (i = 0; i < INTCPS_NR_IRQS; i++)
243 intc_context[ind].ilr[i] =
244 intc_bank_read_reg(bank, (0x100 + 0x4*i));
245 for (i = 0; i < INTCPS_NR_MIR_REGS; i++)
246 intc_context[ind].mir[i] =
247 intc_bank_read_reg(&irq_banks[0], INTC_MIR0 +
248 (0x20 * i));
249 }
250}
251
252void omap_intc_restore_context(void)
253{
254 int ind = 0, i = 0;
255
256 for (ind = 0; ind < ARRAY_SIZE(irq_banks); ind++) {
257 struct omap_irq_bank *bank = irq_banks + ind;
258 intc_bank_write_reg(intc_context[ind].sysconfig,
259 bank, INTC_SYSCONFIG);
260 intc_bank_write_reg(intc_context[ind].sysconfig,
261 bank, INTC_SYSCONFIG);
262 intc_bank_write_reg(intc_context[ind].protection,
263 bank, INTC_PROTECTION);
264 intc_bank_write_reg(intc_context[ind].idle,
265 bank, INTC_IDLE);
266 intc_bank_write_reg(intc_context[ind].threshold,
267 bank, INTC_THRESHOLD);
268 for (i = 0; i < INTCPS_NR_IRQS; i++)
269 intc_bank_write_reg(intc_context[ind].ilr[i],
270 bank, (0x100 + 0x4*i));
271 for (i = 0; i < INTCPS_NR_MIR_REGS; i++)
272 intc_bank_write_reg(intc_context[ind].mir[i],
273 &irq_banks[0], INTC_MIR0 + (0x20 * i));
274 }
275 /* MIRs are saved and restore with other PRCM registers */
276}
277#endif /* CONFIG_ARCH_OMAP3 */
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index c035ad3426d0..281ab6342448 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -15,9 +15,11 @@
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <mach/mailbox.h> 18#include <plat/mailbox.h>
19#include <mach/irqs.h> 19#include <mach/irqs.h>
20 20
21#define DRV_NAME "omap2-mailbox"
22
21#define MAILBOX_REVISION 0x000 23#define MAILBOX_REVISION 0x000
22#define MAILBOX_SYSCONFIG 0x010 24#define MAILBOX_SYSCONFIG 0x010
23#define MAILBOX_SYSSTATUS 0x014 25#define MAILBOX_SYSSTATUS 0x014
@@ -27,8 +29,12 @@
27#define MAILBOX_IRQSTATUS(u) (0x100 + 8 * (u)) 29#define MAILBOX_IRQSTATUS(u) (0x100 + 8 * (u))
28#define MAILBOX_IRQENABLE(u) (0x104 + 8 * (u)) 30#define MAILBOX_IRQENABLE(u) (0x104 + 8 * (u))
29 31
30#define MAILBOX_IRQ_NEWMSG(u) (1 << (2 * (u))) 32#define OMAP4_MAILBOX_IRQSTATUS(u) (0x104 + 10 * (u))
31#define MAILBOX_IRQ_NOTFULL(u) (1 << (2 * (u) + 1)) 33#define OMAP4_MAILBOX_IRQENABLE(u) (0x108 + 10 * (u))
34#define OMAP4_MAILBOX_IRQENABLE_CLR(u) (0x10c + 10 * (u))
35
36#define MAILBOX_IRQ_NEWMSG(m) (1 << (2 * (m)))
37#define MAILBOX_IRQ_NOTFULL(m) (1 << (2 * (m) + 1))
32 38
33/* SYSCONFIG: register bit definition */ 39/* SYSCONFIG: register bit definition */
34#define AUTOIDLE (1 << 0) 40#define AUTOIDLE (1 << 0)
@@ -39,7 +45,11 @@
39#define RESETDONE (1 << 0) 45#define RESETDONE (1 << 0)
40 46
41#define MBOX_REG_SIZE 0x120 47#define MBOX_REG_SIZE 0x120
48
49#define OMAP4_MBOX_REG_SIZE 0x130
50
42#define MBOX_NR_REGS (MBOX_REG_SIZE / sizeof(u32)) 51#define MBOX_NR_REGS (MBOX_REG_SIZE / sizeof(u32))
52#define OMAP4_MBOX_NR_REGS (OMAP4_MBOX_REG_SIZE / sizeof(u32))
43 53
44static void __iomem *mbox_base; 54static void __iomem *mbox_base;
45 55
@@ -56,7 +66,8 @@ struct omap_mbox2_priv {
56 unsigned long irqstatus; 66 unsigned long irqstatus;
57 u32 newmsg_bit; 67 u32 newmsg_bit;
58 u32 notfull_bit; 68 u32 notfull_bit;
59 u32 ctx[MBOX_NR_REGS]; 69 u32 ctx[OMAP4_MBOX_NR_REGS];
70 unsigned long irqdisable;
60}; 71};
61 72
62static struct clk *mbox_ick_handle; 73static struct clk *mbox_ick_handle;
@@ -82,8 +93,9 @@ static int omap2_mbox_startup(struct omap_mbox *mbox)
82 93
83 mbox_ick_handle = clk_get(NULL, "mailboxes_ick"); 94 mbox_ick_handle = clk_get(NULL, "mailboxes_ick");
84 if (IS_ERR(mbox_ick_handle)) { 95 if (IS_ERR(mbox_ick_handle)) {
85 pr_err("Can't get mailboxes_ick\n"); 96 printk(KERN_ERR "Could not get mailboxes_ick: %d\n",
86 return -ENODEV; 97 PTR_ERR(mbox_ick_handle));
98 return PTR_ERR(mbox_ick_handle);
87 } 99 }
88 clk_enable(mbox_ick_handle); 100 clk_enable(mbox_ick_handle);
89 101
@@ -115,6 +127,7 @@ static void omap2_mbox_shutdown(struct omap_mbox *mbox)
115{ 127{
116 clk_disable(mbox_ick_handle); 128 clk_disable(mbox_ick_handle);
117 clk_put(mbox_ick_handle); 129 clk_put(mbox_ick_handle);
130 mbox_ick_handle = NULL;
118} 131}
119 132
120/* Mailbox FIFO handle functions */ 133/* Mailbox FIFO handle functions */
@@ -143,7 +156,7 @@ static int omap2_mbox_fifo_full(struct omap_mbox *mbox)
143{ 156{
144 struct omap_mbox2_fifo *fifo = 157 struct omap_mbox2_fifo *fifo =
145 &((struct omap_mbox2_priv *)mbox->priv)->tx_fifo; 158 &((struct omap_mbox2_priv *)mbox->priv)->tx_fifo;
146 return (mbox_read_reg(fifo->fifo_stat)); 159 return mbox_read_reg(fifo->fifo_stat);
147} 160}
148 161
149/* Mailbox IRQ handle functions */ 162/* Mailbox IRQ handle functions */
@@ -163,10 +176,9 @@ static void omap2_mbox_disable_irq(struct omap_mbox *mbox,
163{ 176{
164 struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv; 177 struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv;
165 u32 l, bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit; 178 u32 l, bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit;
166 179 l = mbox_read_reg(p->irqdisable);
167 l = mbox_read_reg(p->irqenable);
168 l &= ~bit; 180 l &= ~bit;
169 mbox_write_reg(l, p->irqenable); 181 mbox_write_reg(l, p->irqdisable);
170} 182}
171 183
172static void omap2_mbox_ack_irq(struct omap_mbox *mbox, 184static void omap2_mbox_ack_irq(struct omap_mbox *mbox,
@@ -189,15 +201,19 @@ static int omap2_mbox_is_irq(struct omap_mbox *mbox,
189 u32 enable = mbox_read_reg(p->irqenable); 201 u32 enable = mbox_read_reg(p->irqenable);
190 u32 status = mbox_read_reg(p->irqstatus); 202 u32 status = mbox_read_reg(p->irqstatus);
191 203
192 return (enable & status & bit); 204 return (int)(enable & status & bit);
193} 205}
194 206
195static void omap2_mbox_save_ctx(struct omap_mbox *mbox) 207static void omap2_mbox_save_ctx(struct omap_mbox *mbox)
196{ 208{
197 int i; 209 int i;
198 struct omap_mbox2_priv *p = mbox->priv; 210 struct omap_mbox2_priv *p = mbox->priv;
199 211 int nr_regs;
200 for (i = 0; i < MBOX_NR_REGS; i++) { 212 if (cpu_is_omap44xx())
213 nr_regs = OMAP4_MBOX_NR_REGS;
214 else
215 nr_regs = MBOX_NR_REGS;
216 for (i = 0; i < nr_regs; i++) {
201 p->ctx[i] = mbox_read_reg(i * sizeof(u32)); 217 p->ctx[i] = mbox_read_reg(i * sizeof(u32));
202 218
203 dev_dbg(mbox->dev, "%s: [%02x] %08x\n", __func__, 219 dev_dbg(mbox->dev, "%s: [%02x] %08x\n", __func__,
@@ -209,8 +225,12 @@ static void omap2_mbox_restore_ctx(struct omap_mbox *mbox)
209{ 225{
210 int i; 226 int i;
211 struct omap_mbox2_priv *p = mbox->priv; 227 struct omap_mbox2_priv *p = mbox->priv;
212 228 int nr_regs;
213 for (i = 0; i < MBOX_NR_REGS; i++) { 229 if (cpu_is_omap44xx())
230 nr_regs = OMAP4_MBOX_NR_REGS;
231 else
232 nr_regs = MBOX_NR_REGS;
233 for (i = 0; i < nr_regs; i++) {
214 mbox_write_reg(p->ctx[i], i * sizeof(u32)); 234 mbox_write_reg(p->ctx[i], i * sizeof(u32));
215 235
216 dev_dbg(mbox->dev, "%s: [%02x] %08x\n", __func__, 236 dev_dbg(mbox->dev, "%s: [%02x] %08x\n", __func__,
@@ -242,7 +262,6 @@ static struct omap_mbox_ops omap2_mbox_ops = {
242 */ 262 */
243 263
244/* FIXME: the following structs should be filled automatically by the user id */ 264/* FIXME: the following structs should be filled automatically by the user id */
245
246/* DSP */ 265/* DSP */
247static struct omap_mbox2_priv omap2_mbox_dsp_priv = { 266static struct omap_mbox2_priv omap2_mbox_dsp_priv = {
248 .tx_fifo = { 267 .tx_fifo = {
@@ -257,8 +276,36 @@ static struct omap_mbox2_priv omap2_mbox_dsp_priv = {
257 .irqstatus = MAILBOX_IRQSTATUS(0), 276 .irqstatus = MAILBOX_IRQSTATUS(0),
258 .notfull_bit = MAILBOX_IRQ_NOTFULL(0), 277 .notfull_bit = MAILBOX_IRQ_NOTFULL(0),
259 .newmsg_bit = MAILBOX_IRQ_NEWMSG(1), 278 .newmsg_bit = MAILBOX_IRQ_NEWMSG(1),
279 .irqdisable = MAILBOX_IRQENABLE(0),
280};
281
282
283
284/* OMAP4 specific data structure. Use the cpu_is_omap4xxx()
285to use this*/
286static struct omap_mbox2_priv omap2_mbox_1_priv = {
287 .tx_fifo = {
288 .msg = MAILBOX_MESSAGE(0),
289 .fifo_stat = MAILBOX_FIFOSTATUS(0),
290 },
291 .rx_fifo = {
292 .msg = MAILBOX_MESSAGE(1),
293 .msg_stat = MAILBOX_MSGSTATUS(1),
294 },
295 .irqenable = OMAP4_MAILBOX_IRQENABLE(0),
296 .irqstatus = OMAP4_MAILBOX_IRQSTATUS(0),
297 .notfull_bit = MAILBOX_IRQ_NOTFULL(0),
298 .newmsg_bit = MAILBOX_IRQ_NEWMSG(1),
299 .irqdisable = OMAP4_MAILBOX_IRQENABLE_CLR(0),
260}; 300};
261 301
302struct omap_mbox mbox_1_info = {
303 .name = "mailbox-1",
304 .ops = &omap2_mbox_ops,
305 .priv = &omap2_mbox_1_priv,
306};
307EXPORT_SYMBOL(mbox_1_info);
308
262struct omap_mbox mbox_dsp_info = { 309struct omap_mbox mbox_dsp_info = {
263 .name = "dsp", 310 .name = "dsp",
264 .ops = &omap2_mbox_ops, 311 .ops = &omap2_mbox_ops,
@@ -266,6 +313,30 @@ struct omap_mbox mbox_dsp_info = {
266}; 313};
267EXPORT_SYMBOL(mbox_dsp_info); 314EXPORT_SYMBOL(mbox_dsp_info);
268 315
316static struct omap_mbox2_priv omap2_mbox_2_priv = {
317 .tx_fifo = {
318 .msg = MAILBOX_MESSAGE(3),
319 .fifo_stat = MAILBOX_FIFOSTATUS(3),
320 },
321 .rx_fifo = {
322 .msg = MAILBOX_MESSAGE(2),
323 .msg_stat = MAILBOX_MSGSTATUS(2),
324 },
325 .irqenable = OMAP4_MAILBOX_IRQENABLE(0),
326 .irqstatus = OMAP4_MAILBOX_IRQSTATUS(0),
327 .notfull_bit = MAILBOX_IRQ_NOTFULL(3),
328 .newmsg_bit = MAILBOX_IRQ_NEWMSG(2),
329 .irqdisable = OMAP4_MAILBOX_IRQENABLE_CLR(0),
330};
331
332struct omap_mbox mbox_2_info = {
333 .name = "mailbox-2",
334 .ops = &omap2_mbox_ops,
335 .priv = &omap2_mbox_2_priv,
336};
337EXPORT_SYMBOL(mbox_2_info);
338
339
269#if defined(CONFIG_ARCH_OMAP2420) /* IVA */ 340#if defined(CONFIG_ARCH_OMAP2420) /* IVA */
270static struct omap_mbox2_priv omap2_mbox_iva_priv = { 341static struct omap_mbox2_priv omap2_mbox_iva_priv = {
271 .tx_fifo = { 342 .tx_fifo = {
@@ -280,6 +351,7 @@ static struct omap_mbox2_priv omap2_mbox_iva_priv = {
280 .irqstatus = MAILBOX_IRQSTATUS(3), 351 .irqstatus = MAILBOX_IRQSTATUS(3),
281 .notfull_bit = MAILBOX_IRQ_NOTFULL(2), 352 .notfull_bit = MAILBOX_IRQ_NOTFULL(2),
282 .newmsg_bit = MAILBOX_IRQ_NEWMSG(3), 353 .newmsg_bit = MAILBOX_IRQ_NEWMSG(3),
354 .irqdisable = MAILBOX_IRQENABLE(3),
283}; 355};
284 356
285static struct omap_mbox mbox_iva_info = { 357static struct omap_mbox mbox_iva_info = {
@@ -300,22 +372,36 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
300 dev_err(&pdev->dev, "invalid mem resource\n"); 372 dev_err(&pdev->dev, "invalid mem resource\n");
301 return -ENODEV; 373 return -ENODEV;
302 } 374 }
303 mbox_base = ioremap(res->start, res->end - res->start); 375 mbox_base = ioremap(res->start, resource_size(res));
304 if (!mbox_base) 376 if (!mbox_base)
305 return -ENOMEM; 377 return -ENOMEM;
306 378
307 /* DSP or IVA2 IRQ */ 379 /* DSP or IVA2 IRQ */
308 ret = platform_get_irq(pdev, 0); 380 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
309 if (ret < 0) { 381
382 if (unlikely(!res)) {
310 dev_err(&pdev->dev, "invalid irq resource\n"); 383 dev_err(&pdev->dev, "invalid irq resource\n");
384 ret = -ENODEV;
311 goto err_dsp; 385 goto err_dsp;
312 } 386 }
313 mbox_dsp_info.irq = ret; 387 if (cpu_is_omap44xx()) {
314 388 mbox_1_info.irq = res->start;
315 ret = omap_mbox_register(&pdev->dev, &mbox_dsp_info); 389 ret = omap_mbox_register(&pdev->dev, &mbox_1_info);
390 } else {
391 mbox_dsp_info.irq = res->start;
392 ret = omap_mbox_register(&pdev->dev, &mbox_dsp_info);
393 }
316 if (ret) 394 if (ret)
317 goto err_dsp; 395 goto err_dsp;
318 396
397 if (cpu_is_omap44xx()) {
398 mbox_2_info.irq = res->start;
399 ret = omap_mbox_register(&pdev->dev, &mbox_2_info);
400 if (ret) {
401 omap_mbox_unregister(&mbox_1_info);
402 goto err_dsp;
403 }
404 }
319#if defined(CONFIG_ARCH_OMAP2420) /* IVA */ 405#if defined(CONFIG_ARCH_OMAP2420) /* IVA */
320 if (cpu_is_omap2420()) { 406 if (cpu_is_omap2420()) {
321 /* IVA IRQ */ 407 /* IVA IRQ */
@@ -335,6 +421,7 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
335 421
336err_iva1: 422err_iva1:
337 omap_mbox_unregister(&mbox_dsp_info); 423 omap_mbox_unregister(&mbox_dsp_info);
424
338err_dsp: 425err_dsp:
339 iounmap(mbox_base); 426 iounmap(mbox_base);
340 return ret; 427 return ret;
@@ -345,7 +432,12 @@ static int __devexit omap2_mbox_remove(struct platform_device *pdev)
345#if defined(CONFIG_ARCH_OMAP2420) 432#if defined(CONFIG_ARCH_OMAP2420)
346 omap_mbox_unregister(&mbox_iva_info); 433 omap_mbox_unregister(&mbox_iva_info);
347#endif 434#endif
348 omap_mbox_unregister(&mbox_dsp_info); 435
436 if (cpu_is_omap44xx()) {
437 omap_mbox_unregister(&mbox_2_info);
438 omap_mbox_unregister(&mbox_1_info);
439 } else
440 omap_mbox_unregister(&mbox_dsp_info);
349 iounmap(mbox_base); 441 iounmap(mbox_base);
350 return 0; 442 return 0;
351} 443}
@@ -354,7 +446,7 @@ static struct platform_driver omap2_mbox_driver = {
354 .probe = omap2_mbox_probe, 446 .probe = omap2_mbox_probe,
355 .remove = __devexit_p(omap2_mbox_remove), 447 .remove = __devexit_p(omap2_mbox_remove),
356 .driver = { 448 .driver = {
357 .name = "omap2-mailbox", 449 .name = DRV_NAME,
358 }, 450 },
359}; 451};
360 452
@@ -372,6 +464,6 @@ module_init(omap2_mbox_init);
372module_exit(omap2_mbox_exit); 464module_exit(omap2_mbox_exit);
373 465
374MODULE_LICENSE("GPL v2"); 466MODULE_LICENSE("GPL v2");
375MODULE_DESCRIPTION("omap mailbox: omap2/3 architecture specific functions"); 467MODULE_DESCRIPTION("omap mailbox: omap2/3/4 architecture specific functions");
376MODULE_AUTHOR("Hiroshi DOYU <Hiroshi.DOYU@nokia.com>, Paul Mundt"); 468MODULE_AUTHOR("Hiroshi DOYU <Hiroshi.DOYU@nokia.com>, Paul Mundt");
377MODULE_ALIAS("platform:omap2-mailbox"); 469MODULE_ALIAS("platform:"DRV_NAME);
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index a846aa1ebb4d..baa451733850 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -18,10 +18,10 @@
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20#include <mach/irqs.h> 20#include <mach/irqs.h>
21#include <mach/dma.h> 21#include <plat/dma.h>
22#include <mach/mux.h> 22#include <plat/mux.h>
23#include <mach/cpu.h> 23#include <plat/cpu.h>
24#include <mach/mcbsp.h> 24#include <plat/mcbsp.h>
25 25
26static void omap2_mcbsp2_mux_setup(void) 26static void omap2_mcbsp2_mux_setup(void)
27{ 27{
diff --git a/arch/arm/mach-omap2/mmc-twl4030.c b/arch/arm/mach-omap2/mmc-twl4030.c
index c9c59a2db4e2..0c3c72d934bf 100644
--- a/arch/arm/mach-omap2/mmc-twl4030.c
+++ b/arch/arm/mach-omap2/mmc-twl4030.c
@@ -20,9 +20,9 @@
20#include <linux/regulator/consumer.h> 20#include <linux/regulator/consumer.h>
21 21
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23#include <mach/control.h> 23#include <plat/control.h>
24#include <mach/mmc.h> 24#include <plat/mmc.h>
25#include <mach/board.h> 25#include <plat/board.h>
26 26
27#include "mmc-twl4030.h" 27#include "mmc-twl4030.h"
28 28
@@ -213,7 +213,7 @@ static int twl4030_mmc_get_context_loss(struct device *dev)
213static int twl_mmc1_set_power(struct device *dev, int slot, int power_on, 213static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,
214 int vdd) 214 int vdd)
215{ 215{
216 u32 reg; 216 u32 reg, prog_io;
217 int ret = 0; 217 int ret = 0;
218 struct twl_mmc_controller *c = &hsmmc[0]; 218 struct twl_mmc_controller *c = &hsmmc[0];
219 struct omap_mmc_platform_data *mmc = dev->platform_data; 219 struct omap_mmc_platform_data *mmc = dev->platform_data;
@@ -245,7 +245,14 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,
245 } 245 }
246 246
247 reg = omap_ctrl_readl(control_pbias_offset); 247 reg = omap_ctrl_readl(control_pbias_offset);
248 reg |= OMAP2_PBIASSPEEDCTRL0; 248 if (cpu_is_omap3630()) {
249 /* Set MMC I/O to 52Mhz */
250 prog_io = omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO1);
251 prog_io |= OMAP3630_PRG_SDMMC1_SPEEDCTRL;
252 omap_ctrl_writel(prog_io, OMAP343X_CONTROL_PROG_IO1);
253 } else {
254 reg |= OMAP2_PBIASSPEEDCTRL0;
255 }
249 reg &= ~OMAP2_PBIASLITEPWRDNZ0; 256 reg &= ~OMAP2_PBIASLITEPWRDNZ0;
250 omap_ctrl_writel(reg, control_pbias_offset); 257 omap_ctrl_writel(reg, control_pbias_offset);
251 258
@@ -489,6 +496,12 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
489 /* on-chip level shifting via PBIAS0/PBIAS1 */ 496 /* on-chip level shifting via PBIAS0/PBIAS1 */
490 mmc->slots[0].set_power = twl_mmc1_set_power; 497 mmc->slots[0].set_power = twl_mmc1_set_power;
491 mmc->slots[0].set_sleep = twl_mmc1_set_sleep; 498 mmc->slots[0].set_sleep = twl_mmc1_set_sleep;
499
500 /* Omap3630 HSMMC1 supports only 4-bit */
501 if (cpu_is_omap3630() && c->wires > 4) {
502 c->wires = 4;
503 mmc->slots[0].wires = c->wires;
504 }
492 break; 505 break;
493 case 2: 506 case 2:
494 if (c->ext_clock) 507 if (c->ext_clock)
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index b5fac32aae70..c18a94eca641 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -30,8 +30,8 @@
30 30
31#include <asm/system.h> 31#include <asm/system.h>
32 32
33#include <mach/control.h> 33#include <plat/control.h>
34#include <mach/mux.h> 34#include <plat/mux.h>
35 35
36#ifdef CONFIG_OMAP_MUX 36#ifdef CONFIG_OMAP_MUX
37 37
@@ -532,6 +532,14 @@ MUX_CFG_34XX("AG4_3430_MMC2_DAT2", 0x160,
532 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP) 532 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
533MUX_CFG_34XX("AF4_3430_MMC2_DAT3", 0x162, 533MUX_CFG_34XX("AF4_3430_MMC2_DAT3", 0x162,
534 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP) 534 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
535MUX_CFG_34XX("AE4_3430_MMC2_DAT4", 0x164,
536 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
537MUX_CFG_34XX("AH3_3430_MMC2_DAT5", 0x166,
538 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
539MUX_CFG_34XX("AF3_3430_MMC2_DAT6", 0x168,
540 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
541MUX_CFG_34XX("AE3_3430_MMC2_DAT7", 0x16A,
542 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
535 543
536/* MMC3 */ 544/* MMC3 */
537MUX_CFG_34XX("AF10_3430_MMC3_CLK", 0x5d8, 545MUX_CFG_34XX("AF10_3430_MMC3_CLK", 0x5d8,
@@ -551,6 +559,13 @@ MUX_CFG_34XX("AF13_3430_MMC3_DAT3", 0x5e2,
551MUX_CFG_34XX("AF26_34XX_SYS_NIRQ", 0x1E0, 559MUX_CFG_34XX("AF26_34XX_SYS_NIRQ", 0x1E0,
552 OMAP3_WAKEUP_EN | OMAP34XX_PIN_INPUT_PULLUP | 560 OMAP3_WAKEUP_EN | OMAP34XX_PIN_INPUT_PULLUP |
553 OMAP34XX_MUX_MODE0) 561 OMAP34XX_MUX_MODE0)
562/* EHCI GPIO's on OMAP3EVM (Rev >= E) */
563MUX_CFG_34XX("AH14_34XX_GPIO21", 0x5ea,
564 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT_PULLUP)
565MUX_CFG_34XX("AF9_34XX_GPIO22", 0x5ec,
566 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT_PULLUP)
567MUX_CFG_34XX("U3_34XX_GPIO61", 0x0c8,
568 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT_PULLUP)
554}; 569};
555 570
556#define OMAP34XX_PINS_SZ ARRAY_SIZE(omap34xx_pins) 571#define OMAP34XX_PINS_SZ ARRAY_SIZE(omap34xx_pins)
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 48ee295db275..4890bcf4dadd 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -24,13 +24,14 @@
24#include <asm/localtimer.h> 24#include <asm/localtimer.h>
25#include <asm/smp_scu.h> 25#include <asm/smp_scu.h>
26#include <mach/hardware.h> 26#include <mach/hardware.h>
27#include <plat/common.h>
27 28
28/* Registers used for communicating startup information */ 29/* Registers used for communicating startup information */
29#define OMAP4_AUXCOREBOOT_REG0 (OMAP44XX_VA_WKUPGEN_BASE + 0x800) 30static void __iomem *omap4_auxcoreboot_reg0;
30#define OMAP4_AUXCOREBOOT_REG1 (OMAP44XX_VA_WKUPGEN_BASE + 0x804) 31static void __iomem *omap4_auxcoreboot_reg1;
31 32
32/* SCU base address */ 33/* SCU base address */
33static void __iomem *scu_base = OMAP44XX_VA_SCU_BASE; 34static void __iomem *scu_base;
34 35
35/* 36/*
36 * Use SCU config register to count number of cores 37 * Use SCU config register to count number of cores
@@ -53,8 +54,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
53 * core (e.g. timer irq), then they will not have been enabled 54 * core (e.g. timer irq), then they will not have been enabled
54 * for us: do so 55 * for us: do so
55 */ 56 */
56 57 gic_cpu_init(0, gic_cpu_base_addr);
57 gic_cpu_init(0, OMAP2_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE));
58 58
59 /* 59 /*
60 * Synchronise with the boot thread. 60 * Synchronise with the boot thread.
@@ -79,7 +79,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
79 * the AuxCoreBoot1 register is updated with cpu state 79 * the AuxCoreBoot1 register is updated with cpu state
80 * A barrier is added to ensure that write buffer is drained 80 * A barrier is added to ensure that write buffer is drained
81 */ 81 */
82 __raw_writel(cpu, OMAP4_AUXCOREBOOT_REG1); 82 __raw_writel(cpu, omap4_auxcoreboot_reg1);
83 smp_wmb(); 83 smp_wmb();
84 84
85 timeout = jiffies + (1 * HZ); 85 timeout = jiffies + (1 * HZ);
@@ -104,7 +104,7 @@ static void __init wakeup_secondary(void)
104 * A barrier is added to ensure that write buffer is drained 104 * A barrier is added to ensure that write buffer is drained
105 */ 105 */
106 __raw_writel(virt_to_phys(omap_secondary_startup), \ 106 __raw_writel(virt_to_phys(omap_secondary_startup), \
107 OMAP4_AUXCOREBOOT_REG0); 107 omap4_auxcoreboot_reg0);
108 smp_wmb(); 108 smp_wmb();
109 109
110 /* 110 /*
@@ -120,7 +120,13 @@ static void __init wakeup_secondary(void)
120 */ 120 */
121void __init smp_init_cpus(void) 121void __init smp_init_cpus(void)
122{ 122{
123 unsigned int i, ncores = get_core_count(); 123 unsigned int i, ncores;
124
125 /* Never released */
126 scu_base = ioremap(OMAP44XX_SCU_BASE, SZ_256);
127 BUG_ON(!scu_base);
128
129 ncores = get_core_count();
124 130
125 for (i = 0; i < ncores; i++) 131 for (i = 0; i < ncores; i++)
126 set_cpu_possible(i, true); 132 set_cpu_possible(i, true);
@@ -130,6 +136,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
130{ 136{
131 unsigned int ncores = get_core_count(); 137 unsigned int ncores = get_core_count();
132 unsigned int cpu = smp_processor_id(); 138 unsigned int cpu = smp_processor_id();
139 void __iomem *omap4_wkupgen_base;
133 int i; 140 int i;
134 141
135 /* sanity check */ 142 /* sanity check */
@@ -161,6 +168,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
161 for (i = 0; i < max_cpus; i++) 168 for (i = 0; i < max_cpus; i++)
162 set_cpu_present(i, true); 169 set_cpu_present(i, true);
163 170
171 /* Never released */
172 omap4_wkupgen_base = ioremap(OMAP44XX_WKUPGEN_BASE, SZ_4K);
173 BUG_ON(!omap4_wkupgen_base);
174 omap4_auxcoreboot_reg0 = omap4_wkupgen_base + 0x800;
175 omap4_auxcoreboot_reg1 = omap4_wkupgen_base + 0x804;
176
164 if (max_cpus > 1) { 177 if (max_cpus > 1) {
165 /* 178 /*
166 * Enable the local timer or broadcast device for the 179 * Enable the local timer or broadcast device for the
diff --git a/arch/arm/mach-omap2/omap3-iommu.c b/arch/arm/mach-omap2/omap3-iommu.c
index 194189c746c2..fbbcb5c83367 100644
--- a/arch/arm/mach-omap2/omap3-iommu.c
+++ b/arch/arm/mach-omap2/omap3-iommu.c
@@ -12,49 +12,52 @@
12 12
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14 14
15#include <mach/iommu.h> 15#include <plat/iommu.h>
16 16
17#define OMAP3_MMU1_BASE 0x480bd400 17struct iommu_device {
18#define OMAP3_MMU2_BASE 0x5d000000 18 resource_size_t base;
19#define OMAP3_MMU1_IRQ 24 19 int irq;
20#define OMAP3_MMU2_IRQ 28 20 struct iommu_platform_data pdata;
21 21 struct resource res[2];
22
23static unsigned long iommu_base[] __initdata = {
24 OMAP3_MMU1_BASE,
25 OMAP3_MMU2_BASE,
26};
27
28static int iommu_irq[] __initdata = {
29 OMAP3_MMU1_IRQ,
30 OMAP3_MMU2_IRQ,
31}; 22};
32 23
33static const struct iommu_platform_data omap3_iommu_pdata[] __initconst = { 24static struct iommu_device devices[] = {
34 { 25 {
35 .name = "isp", 26 .base = 0x480bd400,
36 .nr_tlb_entries = 8, 27 .irq = 24,
37 .clk_name = "cam_ick", 28 .pdata = {
29 .name = "isp",
30 .nr_tlb_entries = 8,
31 .clk_name = "cam_ick",
32 },
38 }, 33 },
39#if defined(CONFIG_MPU_BRIDGE_IOMMU) 34#if defined(CONFIG_MPU_BRIDGE_IOMMU)
40 { 35 {
41 .name = "iva2", 36 .base = 0x5d000000,
42 .nr_tlb_entries = 32, 37 .irq = 28,
43 .clk_name = "iva2_ck", 38 .pdata = {
39 .name = "iva2",
40 .nr_tlb_entries = 32,
41 .clk_name = "iva2_ck",
42 },
44 }, 43 },
45#endif 44#endif
46}; 45};
47#define NR_IOMMU_DEVICES ARRAY_SIZE(omap3_iommu_pdata) 46#define NR_IOMMU_DEVICES ARRAY_SIZE(devices)
48 47
49static struct platform_device *omap3_iommu_pdev[NR_IOMMU_DEVICES]; 48static struct platform_device *omap3_iommu_pdev[NR_IOMMU_DEVICES];
50 49
51static int __init omap3_iommu_init(void) 50static int __init omap3_iommu_init(void)
52{ 51{
53 int i, err; 52 int i, err;
53 struct resource res[] = {
54 { .flags = IORESOURCE_MEM },
55 { .flags = IORESOURCE_IRQ },
56 };
54 57
55 for (i = 0; i < NR_IOMMU_DEVICES; i++) { 58 for (i = 0; i < NR_IOMMU_DEVICES; i++) {
56 struct platform_device *pdev; 59 struct platform_device *pdev;
57 struct resource res[2]; 60 const struct iommu_device *d = &devices[i];
58 61
59 pdev = platform_device_alloc("omap-iommu", i); 62 pdev = platform_device_alloc("omap-iommu", i);
60 if (!pdev) { 63 if (!pdev) {
@@ -62,19 +65,16 @@ static int __init omap3_iommu_init(void)
62 goto err_out; 65 goto err_out;
63 } 66 }
64 67
65 memset(res, 0, sizeof(res)); 68 res[0].start = d->base;
66 res[0].start = iommu_base[i]; 69 res[0].end = d->base + MMU_REG_SIZE - 1;
67 res[0].end = iommu_base[i] + MMU_REG_SIZE - 1; 70 res[1].start = res[1].end = d->irq;
68 res[0].flags = IORESOURCE_MEM;
69 res[1].start = res[1].end = iommu_irq[i];
70 res[1].flags = IORESOURCE_IRQ;
71 71
72 err = platform_device_add_resources(pdev, res, 72 err = platform_device_add_resources(pdev, res,
73 ARRAY_SIZE(res)); 73 ARRAY_SIZE(res));
74 if (err) 74 if (err)
75 goto err_out; 75 goto err_out;
76 err = platform_device_add_data(pdev, &omap3_iommu_pdata[i], 76 err = platform_device_add_data(pdev, &d->pdata,
77 sizeof(omap3_iommu_pdata[0])); 77 sizeof(d->pdata));
78 if (err) 78 if (err)
79 goto err_out; 79 goto err_out;
80 err = platform_device_add(pdev); 80 err = platform_device_add(pdev);
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index d2e0f1c95961..633b216a8b26 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -45,11 +45,11 @@
45#include <linux/mutex.h> 45#include <linux/mutex.h>
46#include <linux/bootmem.h> 46#include <linux/bootmem.h>
47 47
48#include <mach/cpu.h> 48#include <plat/cpu.h>
49#include <mach/clockdomain.h> 49#include <plat/clockdomain.h>
50#include <mach/powerdomain.h> 50#include <plat/powerdomain.h>
51#include <mach/clock.h> 51#include <plat/clock.h>
52#include <mach/omap_hwmod.h> 52#include <plat/omap_hwmod.h>
53 53
54#include "cm.h" 54#include "cm.h"
55 55
@@ -496,6 +496,7 @@ static void __iomem *_find_mpu_rt_base(struct omap_hwmod *oh, u8 index)
496 struct omap_hwmod_addr_space *mem; 496 struct omap_hwmod_addr_space *mem;
497 int i; 497 int i;
498 int found = 0; 498 int found = 0;
499 void __iomem *va_start;
499 500
500 if (!oh || oh->slaves_cnt == 0) 501 if (!oh || oh->slaves_cnt == 0)
501 return NULL; 502 return NULL;
@@ -509,16 +510,20 @@ static void __iomem *_find_mpu_rt_base(struct omap_hwmod *oh, u8 index)
509 } 510 }
510 } 511 }
511 512
512 /* XXX use ioremap() instead? */ 513 if (found) {
513 514 va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
514 if (found) 515 if (!va_start) {
516 pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name);
517 return NULL;
518 }
515 pr_debug("omap_hwmod: %s: MPU register target at va %p\n", 519 pr_debug("omap_hwmod: %s: MPU register target at va %p\n",
516 oh->name, OMAP2_IO_ADDRESS(mem->pa_start)); 520 oh->name, va_start);
517 else 521 } else {
518 pr_debug("omap_hwmod: %s: no MPU register target found\n", 522 pr_debug("omap_hwmod: %s: no MPU register target found\n",
519 oh->name); 523 oh->name);
524 }
520 525
521 return (found) ? OMAP2_IO_ADDRESS(mem->pa_start) : NULL; 526 return (found) ? va_start : NULL;
522} 527}
523 528
524/** 529/**
@@ -1148,6 +1153,7 @@ int omap_hwmod_unregister(struct omap_hwmod *oh)
1148 pr_debug("omap_hwmod: %s: unregistering\n", oh->name); 1153 pr_debug("omap_hwmod: %s: unregistering\n", oh->name);
1149 1154
1150 mutex_lock(&omap_hwmod_mutex); 1155 mutex_lock(&omap_hwmod_mutex);
1156 iounmap(oh->_rt_va);
1151 list_del(&oh->node); 1157 list_del(&oh->node);
1152 mutex_unlock(&omap_hwmod_mutex); 1158 mutex_unlock(&omap_hwmod_mutex);
1153 1159
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420.h b/arch/arm/mach-omap2/omap_hwmod_2420.h
index 767e4965ac4e..a9ca1b99a301 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420.h
+++ b/arch/arm/mach-omap2/omap_hwmod_2420.h
@@ -16,10 +16,10 @@
16 16
17#ifdef CONFIG_ARCH_OMAP2420 17#ifdef CONFIG_ARCH_OMAP2420
18 18
19#include <mach/omap_hwmod.h> 19#include <plat/omap_hwmod.h>
20#include <mach/irqs.h> 20#include <mach/irqs.h>
21#include <mach/cpu.h> 21#include <plat/cpu.h>
22#include <mach/dma.h> 22#include <plat/dma.h>
23 23
24#include "prm-regbits-24xx.h" 24#include "prm-regbits-24xx.h"
25 25
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430.h b/arch/arm/mach-omap2/omap_hwmod_2430.h
index a412be6420ec..59a208bea6c2 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430.h
+++ b/arch/arm/mach-omap2/omap_hwmod_2430.h
@@ -16,10 +16,10 @@
16 16
17#ifdef CONFIG_ARCH_OMAP2430 17#ifdef CONFIG_ARCH_OMAP2430
18 18
19#include <mach/omap_hwmod.h> 19#include <plat/omap_hwmod.h>
20#include <mach/irqs.h> 20#include <mach/irqs.h>
21#include <mach/cpu.h> 21#include <plat/cpu.h>
22#include <mach/dma.h> 22#include <plat/dma.h>
23 23
24#include "prm-regbits-24xx.h" 24#include "prm-regbits-24xx.h"
25 25
diff --git a/arch/arm/mach-omap2/omap_hwmod_34xx.h b/arch/arm/mach-omap2/omap_hwmod_34xx.h
index 1e069f831575..b6076b9c364e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_34xx.h
+++ b/arch/arm/mach-omap2/omap_hwmod_34xx.h
@@ -14,10 +14,10 @@
14 14
15#ifdef CONFIG_ARCH_OMAP34XX 15#ifdef CONFIG_ARCH_OMAP34XX
16 16
17#include <mach/omap_hwmod.h> 17#include <plat/omap_hwmod.h>
18#include <mach/irqs.h> 18#include <mach/irqs.h>
19#include <mach/cpu.h> 19#include <plat/cpu.h>
20#include <mach/dma.h> 20#include <plat/dma.h>
21 21
22#include "prm-regbits-34xx.h" 22#include "prm-regbits-34xx.h"
23 23
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 2fc4d6abbd0a..8baa30d2acfb 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -26,10 +26,10 @@
26#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/module.h> 27#include <linux/module.h>
28 28
29#include <mach/clock.h> 29#include <plat/clock.h>
30#include <mach/board.h> 30#include <plat/board.h>
31#include <mach/powerdomain.h> 31#include <plat/powerdomain.h>
32#include <mach/clockdomain.h> 32#include <plat/clockdomain.h>
33 33
34#include "prm.h" 34#include "prm.h"
35#include "cm.h" 35#include "cm.h"
@@ -51,7 +51,8 @@ int omap2_pm_debug;
51 regs[reg_count++].val = __raw_readl(reg) 51 regs[reg_count++].val = __raw_readl(reg)
52#define DUMP_INTC_REG(reg, off) \ 52#define DUMP_INTC_REG(reg, off) \
53 regs[reg_count].name = #reg; \ 53 regs[reg_count].name = #reg; \
54 regs[reg_count++].val = __raw_readl(OMAP2_IO_ADDRESS(0x480fe000 + (off))) 54 regs[reg_count++].val = \
55 __raw_readl(OMAP2_L4_IO_ADDRESS(0x480fe000 + (off)))
55 56
56static int __init pm_dbg_init(void); 57static int __init pm_dbg_init(void);
57 58
@@ -526,6 +527,29 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir)
526 return 0; 527 return 0;
527} 528}
528 529
530static int option_get(void *data, u64 *val)
531{
532 u32 *option = data;
533
534 *val = *option;
535
536 return 0;
537}
538
539static int option_set(void *data, u64 val)
540{
541 u32 *option = data;
542
543 *option = val;
544
545 if (option == &enable_off_mode)
546 omap3_pm_off_mode_enable(val);
547
548 return 0;
549}
550
551DEFINE_SIMPLE_ATTRIBUTE(pm_dbg_option_fops, option_get, option_set, "%llu\n");
552
529static int __init pm_dbg_init(void) 553static int __init pm_dbg_init(void)
530{ 554{
531 int i; 555 int i;
@@ -568,6 +592,12 @@ static int __init pm_dbg_init(void)
568 592
569 } 593 }
570 594
595 (void) debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUGO, d,
596 &enable_off_mode, &pm_dbg_option_fops);
597 (void) debugfs_create_file("sleep_while_idle", S_IRUGO | S_IWUGO, d,
598 &sleep_while_idle, &pm_dbg_option_fops);
599 (void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUGO, d,
600 &wakeup_timer_seconds, &pm_dbg_option_fops);
571 pm_dbg_init_done = 1; 601 pm_dbg_init_done = 1;
572 602
573 return 0; 603 return 0;
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 8400f5768923..0bf345db7147 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -11,11 +11,24 @@
11#ifndef __ARCH_ARM_MACH_OMAP2_PM_H 11#ifndef __ARCH_ARM_MACH_OMAP2_PM_H
12#define __ARCH_ARM_MACH_OMAP2_PM_H 12#define __ARCH_ARM_MACH_OMAP2_PM_H
13 13
14#include <mach/powerdomain.h> 14#include <plat/powerdomain.h>
15
16extern u32 enable_off_mode;
17extern u32 sleep_while_idle;
18
19extern void *omap3_secure_ram_storage;
20extern void omap3_pm_off_mode_enable(int);
21extern void omap_sram_idle(void);
22extern int omap3_can_sleep(void);
23extern int set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
24extern int omap3_idle_init(void);
15 25
16extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm); 26extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm);
17extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state); 27extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
18 28
29extern u32 wakeup_timer_seconds;
30extern struct omap_dm_timer *gptimer_wakeup;
31
19#ifdef CONFIG_PM_DEBUG 32#ifdef CONFIG_PM_DEBUG
20extern void omap2_pm_dump(int mode, int resume, unsigned int us); 33extern void omap2_pm_dump(int mode, int resume, unsigned int us);
21extern int omap2_pm_debug; 34extern int omap2_pm_debug;
@@ -36,6 +49,7 @@ extern void omap24xx_cpu_suspend(u32 dll_ctrl, void __iomem *sdrc_dlla_ctrl,
36 void __iomem *sdrc_power); 49 void __iomem *sdrc_power);
37extern void omap34xx_cpu_suspend(u32 *addr, int save_state); 50extern void omap34xx_cpu_suspend(u32 *addr, int save_state);
38extern void save_secure_ram_context(u32 *addr); 51extern void save_secure_ram_context(u32 *addr);
52extern void omap3_save_scratchpad_contents(void);
39 53
40extern unsigned int omap24xx_idle_loop_suspend_sz; 54extern unsigned int omap24xx_idle_loop_suspend_sz;
41extern unsigned int omap34xx_suspend_sz; 55extern unsigned int omap34xx_suspend_sz;
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index bff5c4e89742..cba05b9f041f 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -36,12 +36,12 @@
36#include <asm/mach-types.h> 36#include <asm/mach-types.h>
37 37
38#include <mach/irqs.h> 38#include <mach/irqs.h>
39#include <mach/clock.h> 39#include <plat/clock.h>
40#include <mach/sram.h> 40#include <plat/sram.h>
41#include <mach/control.h> 41#include <plat/control.h>
42#include <mach/mux.h> 42#include <plat/mux.h>
43#include <mach/dma.h> 43#include <plat/dma.h>
44#include <mach/board.h> 44#include <plat/board.h>
45 45
46#include "prm.h" 46#include "prm.h"
47#include "prm-regbits-24xx.h" 47#include "prm-regbits-24xx.h"
@@ -50,8 +50,8 @@
50#include "sdrc.h" 50#include "sdrc.h"
51#include "pm.h" 51#include "pm.h"
52 52
53#include <mach/powerdomain.h> 53#include <plat/powerdomain.h>
54#include <mach/clockdomain.h> 54#include <plat/clockdomain.h>
55 55
56static void (*omap2_sram_idle)(void); 56static void (*omap2_sram_idle)(void);
57static void (*omap2_sram_suspend)(u32 dllctrl, void __iomem *sdrc_dlla_ctrl, 57static void (*omap2_sram_suspend)(u32 dllctrl, void __iomem *sdrc_dlla_ctrl,
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 378c2f618358..81ed252a0f8a 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -5,6 +5,9 @@
5 * Tony Lindgren <tony@atomide.com> 5 * Tony Lindgren <tony@atomide.com>
6 * Jouni Hogander 6 * Jouni Hogander
7 * 7 *
8 * Copyright (C) 2007 Texas Instruments, Inc.
9 * Rajendra Nayak <rnayak@ti.com>
10 *
8 * Copyright (C) 2005 Texas Instruments, Inc. 11 * Copyright (C) 2005 Texas Instruments, Inc.
9 * Richard Woodruff <r-woodruff2@ti.com> 12 * Richard Woodruff <r-woodruff2@ti.com>
10 * 13 *
@@ -22,12 +25,20 @@
22#include <linux/list.h> 25#include <linux/list.h>
23#include <linux/err.h> 26#include <linux/err.h>
24#include <linux/gpio.h> 27#include <linux/gpio.h>
28#include <linux/clk.h>
29
30#include <plat/sram.h>
31#include <plat/clockdomain.h>
32#include <plat/powerdomain.h>
33#include <plat/control.h>
34#include <plat/serial.h>
35#include <plat/sdrc.h>
36#include <plat/prcm.h>
37#include <plat/gpmc.h>
38#include <plat/dma.h>
39#include <plat/dmtimer.h>
25 40
26#include <mach/sram.h> 41#include <asm/tlbflush.h>
27#include <mach/clockdomain.h>
28#include <mach/powerdomain.h>
29#include <mach/control.h>
30#include <mach/serial.h>
31 42
32#include "cm.h" 43#include "cm.h"
33#include "cm-regbits-34xx.h" 44#include "cm-regbits-34xx.h"
@@ -35,6 +46,16 @@
35 46
36#include "prm.h" 47#include "prm.h"
37#include "pm.h" 48#include "pm.h"
49#include "sdrc.h"
50
51/* Scratchpad offsets */
52#define OMAP343X_TABLE_ADDRESS_OFFSET 0x31
53#define OMAP343X_TABLE_VALUE_OFFSET 0x30
54#define OMAP343X_CONTROL_REG_VALUE_OFFSET 0x32
55
56u32 enable_off_mode;
57u32 sleep_while_idle;
58u32 wakeup_timer_seconds;
38 59
39struct power_state { 60struct power_state {
40 struct powerdomain *pwrdm; 61 struct powerdomain *pwrdm;
@@ -49,7 +70,112 @@ static LIST_HEAD(pwrst_list);
49 70
50static void (*_omap_sram_idle)(u32 *addr, int save_state); 71static void (*_omap_sram_idle)(u32 *addr, int save_state);
51 72
52static struct powerdomain *mpu_pwrdm; 73static int (*_omap_save_secure_sram)(u32 *addr);
74
75static struct powerdomain *mpu_pwrdm, *neon_pwrdm;
76static struct powerdomain *core_pwrdm, *per_pwrdm;
77static struct powerdomain *cam_pwrdm;
78
79static inline void omap3_per_save_context(void)
80{
81 omap_gpio_save_context();
82}
83
84static inline void omap3_per_restore_context(void)
85{
86 omap_gpio_restore_context();
87}
88
89static void omap3_enable_io_chain(void)
90{
91 int timeout = 0;
92
93 if (omap_rev() >= OMAP3430_REV_ES3_1) {
94 prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN, WKUP_MOD, PM_WKEN);
95 /* Do a readback to assure write has been done */
96 prm_read_mod_reg(WKUP_MOD, PM_WKEN);
97
98 while (!(prm_read_mod_reg(WKUP_MOD, PM_WKST) &
99 OMAP3430_ST_IO_CHAIN)) {
100 timeout++;
101 if (timeout > 1000) {
102 printk(KERN_ERR "Wake up daisy chain "
103 "activation failed.\n");
104 return;
105 }
106 prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN,
107 WKUP_MOD, PM_WKST);
108 }
109 }
110}
111
112static void omap3_disable_io_chain(void)
113{
114 if (omap_rev() >= OMAP3430_REV_ES3_1)
115 prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN, WKUP_MOD, PM_WKEN);
116}
117
118static void omap3_core_save_context(void)
119{
120 u32 control_padconf_off;
121
122 /* Save the padconf registers */
123 control_padconf_off = omap_ctrl_readl(OMAP343X_CONTROL_PADCONF_OFF);
124 control_padconf_off |= START_PADCONF_SAVE;
125 omap_ctrl_writel(control_padconf_off, OMAP343X_CONTROL_PADCONF_OFF);
126 /* wait for the save to complete */
127 while (!omap_ctrl_readl(OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS)
128 & PADCONF_SAVE_DONE)
129 ;
130 /* Save the Interrupt controller context */
131 omap_intc_save_context();
132 /* Save the GPMC context */
133 omap3_gpmc_save_context();
134 /* Save the system control module context, padconf already save above*/
135 omap3_control_save_context();
136 omap_dma_global_context_save();
137}
138
139static void omap3_core_restore_context(void)
140{
141 /* Restore the control module context, padconf restored by h/w */
142 omap3_control_restore_context();
143 /* Restore the GPMC context */
144 omap3_gpmc_restore_context();
145 /* Restore the interrupt controller context */
146 omap_intc_restore_context();
147 omap_dma_global_context_restore();
148}
149
150/*
151 * FIXME: This function should be called before entering off-mode after
152 * OMAP3 secure services have been accessed. Currently it is only called
153 * once during boot sequence, but this works as we are not using secure
154 * services.
155 */
156static void omap3_save_secure_ram_context(u32 target_mpu_state)
157{
158 u32 ret;
159
160 if (omap_type() != OMAP2_DEVICE_TYPE_GP) {
161 /*
162 * MPU next state must be set to POWER_ON temporarily,
163 * otherwise the WFI executed inside the ROM code
164 * will hang the system.
165 */
166 pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_ON);
167 ret = _omap_save_secure_sram((u32 *)
168 __pa(omap3_secure_ram_storage));
169 pwrdm_set_next_pwrst(mpu_pwrdm, target_mpu_state);
170 /* Following is for error tracking, it should not happen */
171 if (ret) {
172 printk(KERN_ERR "save_secure_sram() returns %08x\n",
173 ret);
174 while (1)
175 ;
176 }
177 }
178}
53 179
54/* 180/*
55 * PRCM Interrupt Handler Helper Function 181 * PRCM Interrupt Handler Helper Function
@@ -161,7 +287,36 @@ static irqreturn_t prcm_interrupt_handler (int irq, void *dev_id)
161 return IRQ_HANDLED; 287 return IRQ_HANDLED;
162} 288}
163 289
164static void omap_sram_idle(void) 290static void restore_control_register(u32 val)
291{
292 __asm__ __volatile__ ("mcr p15, 0, %0, c1, c0, 0" : : "r" (val));
293}
294
295/* Function to restore the table entry that was modified for enabling MMU */
296static void restore_table_entry(void)
297{
298 u32 *scratchpad_address;
299 u32 previous_value, control_reg_value;
300 u32 *address;
301
302 scratchpad_address = OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD);
303
304 /* Get address of entry that was modified */
305 address = (u32 *)__raw_readl(scratchpad_address +
306 OMAP343X_TABLE_ADDRESS_OFFSET);
307 /* Get the previous value which needs to be restored */
308 previous_value = __raw_readl(scratchpad_address +
309 OMAP343X_TABLE_VALUE_OFFSET);
310 address = __va(address);
311 *address = previous_value;
312 flush_tlb_all();
313 control_reg_value = __raw_readl(scratchpad_address
314 + OMAP343X_CONTROL_REG_VALUE_OFFSET);
315 /* This will enable caches and prediction */
316 restore_control_register(control_reg_value);
317}
318
319void omap_sram_idle(void)
165{ 320{
166 /* Variable to tell what needs to be saved and restored 321 /* Variable to tell what needs to be saved and restored
167 * in omap_sram_idle*/ 322 * in omap_sram_idle*/
@@ -169,17 +324,32 @@ static void omap_sram_idle(void)
169 /* save_state = 1 => Only L1 and logic lost */ 324 /* save_state = 1 => Only L1 and logic lost */
170 /* save_state = 2 => Only L2 lost */ 325 /* save_state = 2 => Only L2 lost */
171 /* save_state = 3 => L1, L2 and logic lost */ 326 /* save_state = 3 => L1, L2 and logic lost */
172 int save_state = 0, mpu_next_state; 327 int save_state = 0;
328 int mpu_next_state = PWRDM_POWER_ON;
329 int per_next_state = PWRDM_POWER_ON;
330 int core_next_state = PWRDM_POWER_ON;
331 int core_prev_state, per_prev_state;
332 u32 sdrc_pwr = 0;
333 int per_state_modified = 0;
173 334
174 if (!_omap_sram_idle) 335 if (!_omap_sram_idle)
175 return; 336 return;
176 337
338 pwrdm_clear_all_prev_pwrst(mpu_pwrdm);
339 pwrdm_clear_all_prev_pwrst(neon_pwrdm);
340 pwrdm_clear_all_prev_pwrst(core_pwrdm);
341 pwrdm_clear_all_prev_pwrst(per_pwrdm);
342
177 mpu_next_state = pwrdm_read_next_pwrst(mpu_pwrdm); 343 mpu_next_state = pwrdm_read_next_pwrst(mpu_pwrdm);
178 switch (mpu_next_state) { 344 switch (mpu_next_state) {
345 case PWRDM_POWER_ON:
179 case PWRDM_POWER_RET: 346 case PWRDM_POWER_RET:
180 /* No need to save context */ 347 /* No need to save context */
181 save_state = 0; 348 save_state = 0;
182 break; 349 break;
350 case PWRDM_POWER_OFF:
351 save_state = 3;
352 break;
183 default: 353 default:
184 /* Invalid state */ 354 /* Invalid state */
185 printk(KERN_ERR "Invalid mpu state in sram_idle\n"); 355 printk(KERN_ERR "Invalid mpu state in sram_idle\n");
@@ -187,68 +357,115 @@ static void omap_sram_idle(void)
187 } 357 }
188 pwrdm_pre_transition(); 358 pwrdm_pre_transition();
189 359
190 omap2_gpio_prepare_for_retention(); 360 /* NEON control */
191 omap_uart_prepare_idle(0); 361 if (pwrdm_read_pwrst(neon_pwrdm) == PWRDM_POWER_ON)
192 omap_uart_prepare_idle(1); 362 pwrdm_set_next_pwrst(neon_pwrdm, mpu_next_state);
193 omap_uart_prepare_idle(2); 363
364 /* PER */
365 per_next_state = pwrdm_read_next_pwrst(per_pwrdm);
366 core_next_state = pwrdm_read_next_pwrst(core_pwrdm);
367 if (per_next_state < PWRDM_POWER_ON) {
368 omap_uart_prepare_idle(2);
369 omap2_gpio_prepare_for_retention();
370 if (per_next_state == PWRDM_POWER_OFF) {
371 if (core_next_state == PWRDM_POWER_ON) {
372 per_next_state = PWRDM_POWER_RET;
373 pwrdm_set_next_pwrst(per_pwrdm, per_next_state);
374 per_state_modified = 1;
375 } else
376 omap3_per_save_context();
377 }
378 }
379
380 if (pwrdm_read_pwrst(cam_pwrdm) == PWRDM_POWER_ON)
381 omap2_clkdm_deny_idle(mpu_pwrdm->pwrdm_clkdms[0]);
382
383 /* CORE */
384 if (core_next_state < PWRDM_POWER_ON) {
385 omap_uart_prepare_idle(0);
386 omap_uart_prepare_idle(1);
387 if (core_next_state == PWRDM_POWER_OFF) {
388 omap3_core_save_context();
389 omap3_prcm_save_context();
390 }
391 /* Enable IO-PAD and IO-CHAIN wakeups */
392 prm_set_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN);
393 omap3_enable_io_chain();
394 }
395
396 /*
397 * On EMU/HS devices ROM code restores a SRDC value
398 * from scratchpad which has automatic self refresh on timeout
399 * of AUTO_CNT = 1 enabled. This takes care of errata 1.142.
400 * Hence store/restore the SDRC_POWER register here.
401 */
402 if (omap_rev() >= OMAP3430_REV_ES3_0 &&
403 omap_type() != OMAP2_DEVICE_TYPE_GP &&
404 core_next_state == PWRDM_POWER_OFF)
405 sdrc_pwr = sdrc_read_reg(SDRC_POWER);
194 406
195 _omap_sram_idle(NULL, save_state); 407 /*
408 * omap3_arm_context is the location where ARM registers
409 * get saved. The restore path then reads from this
410 * location and restores them back.
411 */
412 _omap_sram_idle(omap3_arm_context, save_state);
196 cpu_init(); 413 cpu_init();
197 414
198 omap_uart_resume_idle(2); 415 /* Restore normal SDRC POWER settings */
199 omap_uart_resume_idle(1); 416 if (omap_rev() >= OMAP3430_REV_ES3_0 &&
200 omap_uart_resume_idle(0); 417 omap_type() != OMAP2_DEVICE_TYPE_GP &&
201 omap2_gpio_resume_after_retention(); 418 core_next_state == PWRDM_POWER_OFF)
419 sdrc_write_reg(sdrc_pwr, SDRC_POWER);
420
421 /* Restore table entry modified during MMU restoration */
422 if (pwrdm_read_prev_pwrst(mpu_pwrdm) == PWRDM_POWER_OFF)
423 restore_table_entry();
424
425 /* CORE */
426 if (core_next_state < PWRDM_POWER_ON) {
427 core_prev_state = pwrdm_read_prev_pwrst(core_pwrdm);
428 if (core_prev_state == PWRDM_POWER_OFF) {
429 omap3_core_restore_context();
430 omap3_prcm_restore_context();
431 omap3_sram_restore_context();
432 omap2_sms_restore_context();
433 }
434 omap_uart_resume_idle(0);
435 omap_uart_resume_idle(1);
436 if (core_next_state == PWRDM_POWER_OFF)
437 prm_clear_mod_reg_bits(OMAP3430_AUTO_OFF,
438 OMAP3430_GR_MOD,
439 OMAP3_PRM_VOLTCTRL_OFFSET);
440 }
202 441
203 pwrdm_post_transition(); 442 /* PER */
443 if (per_next_state < PWRDM_POWER_ON) {
444 per_prev_state = pwrdm_read_prev_pwrst(per_pwrdm);
445 if (per_prev_state == PWRDM_POWER_OFF)
446 omap3_per_restore_context();
447 omap2_gpio_resume_after_retention();
448 omap_uart_resume_idle(2);
449 if (per_state_modified)
450 pwrdm_set_next_pwrst(per_pwrdm, PWRDM_POWER_OFF);
451 }
204 452
205} 453 /* Disable IO-PAD and IO-CHAIN wakeup */
454 if (core_next_state < PWRDM_POWER_ON) {
455 prm_clear_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN);
456 omap3_disable_io_chain();
457 }
206 458
207/* 459 pwrdm_post_transition();
208 * Check if functional clocks are enabled before entering
209 * sleep. This function could be behind CONFIG_PM_DEBUG
210 * when all drivers are configuring their sysconfig registers
211 * properly and using their clocks properly.
212 */
213static int omap3_fclks_active(void)
214{
215 u32 fck_core1 = 0, fck_core3 = 0, fck_sgx = 0, fck_dss = 0,
216 fck_cam = 0, fck_per = 0, fck_usbhost = 0;
217 460
218 fck_core1 = cm_read_mod_reg(CORE_MOD, 461 omap2_clkdm_allow_idle(mpu_pwrdm->pwrdm_clkdms[0]);
219 CM_FCLKEN1);
220 if (omap_rev() > OMAP3430_REV_ES1_0) {
221 fck_core3 = cm_read_mod_reg(CORE_MOD,
222 OMAP3430ES2_CM_FCLKEN3);
223 fck_sgx = cm_read_mod_reg(OMAP3430ES2_SGX_MOD,
224 CM_FCLKEN);
225 fck_usbhost = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
226 CM_FCLKEN);
227 } else
228 fck_sgx = cm_read_mod_reg(GFX_MOD,
229 OMAP3430ES2_CM_FCLKEN3);
230 fck_dss = cm_read_mod_reg(OMAP3430_DSS_MOD,
231 CM_FCLKEN);
232 fck_cam = cm_read_mod_reg(OMAP3430_CAM_MOD,
233 CM_FCLKEN);
234 fck_per = cm_read_mod_reg(OMAP3430_PER_MOD,
235 CM_FCLKEN);
236
237 /* Ignore UART clocks. These are handled by UART core (serial.c) */
238 fck_core1 &= ~(OMAP3430_EN_UART1 | OMAP3430_EN_UART2);
239 fck_per &= ~OMAP3430_EN_UART3;
240
241 if (fck_core1 | fck_core3 | fck_sgx | fck_dss |
242 fck_cam | fck_per | fck_usbhost)
243 return 1;
244 return 0;
245} 462}
246 463
247static int omap3_can_sleep(void) 464int omap3_can_sleep(void)
248{ 465{
249 if (!omap_uart_can_sleep()) 466 if (!sleep_while_idle)
250 return 0; 467 return 0;
251 if (omap3_fclks_active()) 468 if (!omap_uart_can_sleep())
252 return 0; 469 return 0;
253 return 1; 470 return 1;
254} 471}
@@ -256,7 +473,7 @@ static int omap3_can_sleep(void)
256/* This sets pwrdm state (other than mpu & core. Currently only ON & 473/* This sets pwrdm state (other than mpu & core. Currently only ON &
257 * RET are supported. Function is assuming that clkdm doesn't have 474 * RET are supported. Function is assuming that clkdm doesn't have
258 * hw_sup mode enabled. */ 475 * hw_sup mode enabled. */
259static int set_pwrdm_state(struct powerdomain *pwrdm, u32 state) 476int set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
260{ 477{
261 u32 cur_state; 478 u32 cur_state;
262 int sleep_switch = 0; 479 int sleep_switch = 0;
@@ -306,7 +523,7 @@ static void omap3_pm_idle(void)
306 if (!omap3_can_sleep()) 523 if (!omap3_can_sleep())
307 goto out; 524 goto out;
308 525
309 if (omap_irq_pending()) 526 if (omap_irq_pending() || need_resched())
310 goto out; 527 goto out;
311 528
312 omap_sram_idle(); 529 omap_sram_idle();
@@ -319,6 +536,22 @@ out:
319#ifdef CONFIG_SUSPEND 536#ifdef CONFIG_SUSPEND
320static suspend_state_t suspend_state; 537static suspend_state_t suspend_state;
321 538
539static void omap2_pm_wakeup_on_timer(u32 seconds)
540{
541 u32 tick_rate, cycles;
542
543 if (!seconds)
544 return;
545
546 tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup));
547 cycles = tick_rate * seconds;
548 omap_dm_timer_stop(gptimer_wakeup);
549 omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0xffffffff - cycles);
550
551 pr_info("PM: Resume timer in %d secs (%d ticks at %d ticks/sec.)\n",
552 seconds, cycles, tick_rate);
553}
554
322static int omap3_pm_prepare(void) 555static int omap3_pm_prepare(void)
323{ 556{
324 disable_hlt(); 557 disable_hlt();
@@ -330,6 +563,9 @@ static int omap3_pm_suspend(void)
330 struct power_state *pwrst; 563 struct power_state *pwrst;
331 int state, ret = 0; 564 int state, ret = 0;
332 565
566 if (wakeup_timer_seconds)
567 omap2_pm_wakeup_on_timer(wakeup_timer_seconds);
568
333 /* Read current next_pwrsts */ 569 /* Read current next_pwrsts */
334 list_for_each_entry(pwrst, &pwrst_list, node) 570 list_for_each_entry(pwrst, &pwrst_list, node)
335 pwrst->saved_state = pwrdm_read_next_pwrst(pwrst->pwrdm); 571 pwrst->saved_state = pwrdm_read_next_pwrst(pwrst->pwrdm);
@@ -639,14 +875,15 @@ static void __init prcm_setup_regs(void)
639 prm_write_mod_reg(OMAP3430_IO_EN | OMAP3430_WKUP_EN, 875 prm_write_mod_reg(OMAP3430_IO_EN | OMAP3430_WKUP_EN,
640 OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET); 876 OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET);
641 877
642 /* Enable GPIO wakeups in PER */ 878 /* Enable wakeups in PER */
643 prm_write_mod_reg(OMAP3430_EN_GPIO2 | OMAP3430_EN_GPIO3 | 879 prm_write_mod_reg(OMAP3430_EN_GPIO2 | OMAP3430_EN_GPIO3 |
644 OMAP3430_EN_GPIO4 | OMAP3430_EN_GPIO5 | 880 OMAP3430_EN_GPIO4 | OMAP3430_EN_GPIO5 |
645 OMAP3430_EN_GPIO6, OMAP3430_PER_MOD, PM_WKEN); 881 OMAP3430_EN_GPIO6 | OMAP3430_EN_UART3,
882 OMAP3430_PER_MOD, PM_WKEN);
646 /* and allow them to wake up MPU */ 883 /* and allow them to wake up MPU */
647 prm_write_mod_reg(OMAP3430_GRPSEL_GPIO2 | OMAP3430_EN_GPIO3 | 884 prm_write_mod_reg(OMAP3430_GRPSEL_GPIO2 | OMAP3430_EN_GPIO3 |
648 OMAP3430_GRPSEL_GPIO4 | OMAP3430_EN_GPIO5 | 885 OMAP3430_GRPSEL_GPIO4 | OMAP3430_EN_GPIO5 |
649 OMAP3430_GRPSEL_GPIO6, 886 OMAP3430_GRPSEL_GPIO6 | OMAP3430_EN_UART3,
650 OMAP3430_PER_MOD, OMAP3430_PM_MPUGRPSEL); 887 OMAP3430_PER_MOD, OMAP3430_PM_MPUGRPSEL);
651 888
652 /* Don't attach IVA interrupts */ 889 /* Don't attach IVA interrupts */
@@ -689,6 +926,22 @@ static void __init prcm_setup_regs(void)
689 omap3_d2d_idle(); 926 omap3_d2d_idle();
690} 927}
691 928
929void omap3_pm_off_mode_enable(int enable)
930{
931 struct power_state *pwrst;
932 u32 state;
933
934 if (enable)
935 state = PWRDM_POWER_OFF;
936 else
937 state = PWRDM_POWER_RET;
938
939 list_for_each_entry(pwrst, &pwrst_list, node) {
940 pwrst->next_state = state;
941 set_pwrdm_state(pwrst->pwrdm, state);
942 }
943}
944
692int omap3_pm_get_suspend_state(struct powerdomain *pwrdm) 945int omap3_pm_get_suspend_state(struct powerdomain *pwrdm)
693{ 946{
694 struct power_state *pwrst; 947 struct power_state *pwrst;
@@ -748,6 +1001,15 @@ static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
748 return 0; 1001 return 0;
749} 1002}
750 1003
1004void omap_push_sram_idle(void)
1005{
1006 _omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
1007 omap34xx_cpu_suspend_sz);
1008 if (omap_type() != OMAP2_DEVICE_TYPE_GP)
1009 _omap_save_secure_sram = omap_sram_push(save_secure_ram_context,
1010 save_secure_ram_context_sz);
1011}
1012
751static int __init omap3_pm_init(void) 1013static int __init omap3_pm_init(void)
752{ 1014{
753 struct power_state *pwrst, *tmp; 1015 struct power_state *pwrst, *tmp;
@@ -785,15 +1047,47 @@ static int __init omap3_pm_init(void)
785 goto err2; 1047 goto err2;
786 } 1048 }
787 1049
788 _omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend, 1050 neon_pwrdm = pwrdm_lookup("neon_pwrdm");
789 omap34xx_cpu_suspend_sz); 1051 per_pwrdm = pwrdm_lookup("per_pwrdm");
1052 core_pwrdm = pwrdm_lookup("core_pwrdm");
1053 cam_pwrdm = pwrdm_lookup("cam_pwrdm");
790 1054
1055 omap_push_sram_idle();
791#ifdef CONFIG_SUSPEND 1056#ifdef CONFIG_SUSPEND
792 suspend_set_ops(&omap_pm_ops); 1057 suspend_set_ops(&omap_pm_ops);
793#endif /* CONFIG_SUSPEND */ 1058#endif /* CONFIG_SUSPEND */
794 1059
795 pm_idle = omap3_pm_idle; 1060 pm_idle = omap3_pm_idle;
1061 omap3_idle_init();
1062
1063 pwrdm_add_wkdep(neon_pwrdm, mpu_pwrdm);
1064 /*
1065 * REVISIT: This wkdep is only necessary when GPIO2-6 are enabled for
1066 * IO-pad wakeup. Otherwise it will unnecessarily waste power
1067 * waking up PER with every CORE wakeup - see
1068 * http://marc.info/?l=linux-omap&m=121852150710062&w=2
1069 */
1070 pwrdm_add_wkdep(per_pwrdm, core_pwrdm);
1071
1072 if (omap_type() != OMAP2_DEVICE_TYPE_GP) {
1073 omap3_secure_ram_storage =
1074 kmalloc(0x803F, GFP_KERNEL);
1075 if (!omap3_secure_ram_storage)
1076 printk(KERN_ERR "Memory allocation failed when"
1077 "allocating for secure sram context\n");
1078
1079 local_irq_disable();
1080 local_fiq_disable();
1081
1082 omap_dma_global_context_save();
1083 omap3_save_secure_ram_context(PWRDM_POWER_ON);
1084 omap_dma_global_context_restore();
1085
1086 local_irq_enable();
1087 local_fiq_enable();
1088 }
796 1089
1090 omap3_save_scratchpad_contents();
797err1: 1091err1:
798 return ret; 1092 return ret;
799err2: 1093err2:
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index f00289abd30f..b6990e377783 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -31,9 +31,9 @@
31#include "prm.h" 31#include "prm.h"
32#include "prm-regbits-34xx.h" 32#include "prm-regbits-34xx.h"
33 33
34#include <mach/cpu.h> 34#include <plat/cpu.h>
35#include <mach/powerdomain.h> 35#include <plat/powerdomain.h>
36#include <mach/clockdomain.h> 36#include <plat/clockdomain.h>
37 37
38#include "pm.h" 38#include "pm.h"
39 39
diff --git a/arch/arm/mach-omap2/powerdomains.h b/arch/arm/mach-omap2/powerdomains.h
index 691470ea4c6a..057b2e3e2c35 100644
--- a/arch/arm/mach-omap2/powerdomains.h
+++ b/arch/arm/mach-omap2/powerdomains.h
@@ -63,7 +63,7 @@
63 * XXX encode hardware fixed wakeup dependencies -- esp. for 3430 CORE 63 * XXX encode hardware fixed wakeup dependencies -- esp. for 3430 CORE
64 */ 64 */
65 65
66#include <mach/powerdomain.h> 66#include <plat/powerdomain.h>
67 67
68#include "prcm-common.h" 68#include "prcm-common.h"
69#include "prm.h" 69#include "prm.h"
diff --git a/arch/arm/mach-omap2/powerdomains24xx.h b/arch/arm/mach-omap2/powerdomains24xx.h
index 9f08dc3f7fd2..bd249a495aa9 100644
--- a/arch/arm/mach-omap2/powerdomains24xx.h
+++ b/arch/arm/mach-omap2/powerdomains24xx.h
@@ -20,7 +20,7 @@
20 * the array in mach-omap2/powerdomains.h. 20 * the array in mach-omap2/powerdomains.h.
21 */ 21 */
22 22
23#include <mach/powerdomain.h> 23#include <plat/powerdomain.h>
24 24
25#include "prcm-common.h" 25#include "prcm-common.h"
26#include "prm.h" 26#include "prm.h"
diff --git a/arch/arm/mach-omap2/powerdomains34xx.h b/arch/arm/mach-omap2/powerdomains34xx.h
index 4dcf94b800ab..fd09b0827df0 100644
--- a/arch/arm/mach-omap2/powerdomains34xx.h
+++ b/arch/arm/mach-omap2/powerdomains34xx.h
@@ -20,7 +20,7 @@
20 * the array in mach-omap2/powerdomains.h. 20 * the array in mach-omap2/powerdomains.h.
21 */ 21 */
22 22
23#include <mach/powerdomain.h> 23#include <plat/powerdomain.h>
24 24
25#include "prcm-common.h" 25#include "prcm-common.h"
26#include "prm.h" 26#include "prm.h"
@@ -338,7 +338,13 @@ static struct powerdomain usbhost_pwrdm = {
338 .sleepdep_srcs = dss_per_usbhost_sleepdeps, 338 .sleepdep_srcs = dss_per_usbhost_sleepdeps,
339 .pwrsts = PWRSTS_OFF_RET_ON, 339 .pwrsts = PWRSTS_OFF_RET_ON,
340 .pwrsts_logic_ret = PWRDM_POWER_RET, 340 .pwrsts_logic_ret = PWRDM_POWER_RET,
341 .flags = PWRDM_HAS_HDWR_SAR, /* for USBHOST ctrlr only */ 341 /*
342 * REVISIT: Enabling usb host save and restore mechanism seems to
343 * leave the usb host domain permanently in ACTIVE mode after
344 * changing the usb host power domain state from OFF to active once.
345 * Disabling for now.
346 */
347 /*.flags = PWRDM_HAS_HDWR_SAR,*/ /* for USBHOST ctrlr only */
342 .banks = 1, 348 .banks = 1,
343 .pwrsts_mem_ret = { 349 .pwrsts_mem_ret = {
344 [0] = PWRDM_POWER_RET, /* MEMRETSTATE */ 350 [0] = PWRDM_POWER_RET, /* MEMRETSTATE */
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index ced555a4cd1a..029d376198d4 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -7,6 +7,9 @@
7 * 7 *
8 * Written by Tony Lindgren <tony.lindgren@nokia.com> 8 * Written by Tony Lindgren <tony.lindgren@nokia.com>
9 * 9 *
10 * Copyright (C) 2007 Texas Instruments, Inc.
11 * Rajendra Nayak <rnayak@ti.com>
12 *
10 * Some pieces of code Copyright (C) 2005 Texas Instruments, Inc. 13 * Some pieces of code Copyright (C) 2005 Texas Instruments, Inc.
11 * 14 *
12 * This program is free software; you can redistribute it and/or modify 15 * This program is free software; you can redistribute it and/or modify
@@ -19,10 +22,13 @@
19#include <linux/io.h> 22#include <linux/io.h>
20#include <linux/delay.h> 23#include <linux/delay.h>
21 24
22#include <mach/common.h> 25#include <plat/common.h>
23#include <mach/prcm.h> 26#include <plat/prcm.h>
27#include <plat/irqs.h>
28#include <plat/control.h>
24 29
25#include "clock.h" 30#include "clock.h"
31#include "cm.h"
26#include "prm.h" 32#include "prm.h"
27#include "prm-regbits-24xx.h" 33#include "prm-regbits-24xx.h"
28 34
@@ -31,6 +37,89 @@ static void __iomem *cm_base;
31 37
32#define MAX_MODULE_ENABLE_WAIT 100000 38#define MAX_MODULE_ENABLE_WAIT 100000
33 39
40struct omap3_prcm_regs {
41 u32 control_padconf_sys_nirq;
42 u32 iva2_cm_clksel1;
43 u32 iva2_cm_clksel2;
44 u32 cm_sysconfig;
45 u32 sgx_cm_clksel;
46 u32 wkup_cm_clksel;
47 u32 dss_cm_clksel;
48 u32 cam_cm_clksel;
49 u32 per_cm_clksel;
50 u32 emu_cm_clksel;
51 u32 emu_cm_clkstctrl;
52 u32 pll_cm_autoidle2;
53 u32 pll_cm_clksel4;
54 u32 pll_cm_clksel5;
55 u32 pll_cm_clken;
56 u32 pll_cm_clken2;
57 u32 cm_polctrl;
58 u32 iva2_cm_fclken;
59 u32 iva2_cm_clken_pll;
60 u32 core_cm_fclken1;
61 u32 core_cm_fclken3;
62 u32 sgx_cm_fclken;
63 u32 wkup_cm_fclken;
64 u32 dss_cm_fclken;
65 u32 cam_cm_fclken;
66 u32 per_cm_fclken;
67 u32 usbhost_cm_fclken;
68 u32 core_cm_iclken1;
69 u32 core_cm_iclken2;
70 u32 core_cm_iclken3;
71 u32 sgx_cm_iclken;
72 u32 wkup_cm_iclken;
73 u32 dss_cm_iclken;
74 u32 cam_cm_iclken;
75 u32 per_cm_iclken;
76 u32 usbhost_cm_iclken;
77 u32 iva2_cm_autiidle2;
78 u32 mpu_cm_autoidle2;
79 u32 pll_cm_autoidle;
80 u32 iva2_cm_clkstctrl;
81 u32 mpu_cm_clkstctrl;
82 u32 core_cm_clkstctrl;
83 u32 sgx_cm_clkstctrl;
84 u32 dss_cm_clkstctrl;
85 u32 cam_cm_clkstctrl;
86 u32 per_cm_clkstctrl;
87 u32 neon_cm_clkstctrl;
88 u32 usbhost_cm_clkstctrl;
89 u32 core_cm_autoidle1;
90 u32 core_cm_autoidle2;
91 u32 core_cm_autoidle3;
92 u32 wkup_cm_autoidle;
93 u32 dss_cm_autoidle;
94 u32 cam_cm_autoidle;
95 u32 per_cm_autoidle;
96 u32 usbhost_cm_autoidle;
97 u32 sgx_cm_sleepdep;
98 u32 dss_cm_sleepdep;
99 u32 cam_cm_sleepdep;
100 u32 per_cm_sleepdep;
101 u32 usbhost_cm_sleepdep;
102 u32 cm_clkout_ctrl;
103 u32 prm_clkout_ctrl;
104 u32 sgx_pm_wkdep;
105 u32 dss_pm_wkdep;
106 u32 cam_pm_wkdep;
107 u32 per_pm_wkdep;
108 u32 neon_pm_wkdep;
109 u32 usbhost_pm_wkdep;
110 u32 core_pm_mpugrpsel1;
111 u32 iva2_pm_ivagrpsel1;
112 u32 core_pm_mpugrpsel3;
113 u32 core_pm_ivagrpsel3;
114 u32 wkup_pm_mpugrpsel;
115 u32 wkup_pm_ivagrpsel;
116 u32 per_pm_mpugrpsel;
117 u32 per_pm_ivagrpsel;
118 u32 wkup_pm_wken;
119};
120
121struct omap3_prcm_regs prcm_context;
122
34u32 omap_prcm_get_reset_sources(void) 123u32 omap_prcm_get_reset_sources(void)
35{ 124{
36 /* XXX This presumably needs modification for 34XX */ 125 /* XXX This presumably needs modification for 34XX */
@@ -46,9 +135,18 @@ void omap_prcm_arch_reset(char mode)
46 135
47 if (cpu_is_omap24xx()) 136 if (cpu_is_omap24xx())
48 prcm_offs = WKUP_MOD; 137 prcm_offs = WKUP_MOD;
49 else if (cpu_is_omap34xx()) 138 else if (cpu_is_omap34xx()) {
139 u32 l;
140
50 prcm_offs = OMAP3430_GR_MOD; 141 prcm_offs = OMAP3430_GR_MOD;
51 else 142 l = ('B' << 24) | ('M' << 16) | mode;
143 /* Reserve the first word in scratchpad for communicating
144 * with the boot ROM. A pointer to a data structure
145 * describing the boot process can be stored there,
146 * cf. OMAP34xx TRM, Initialization / Software Booting
147 * Configuration. */
148 omap_writel(l, OMAP343X_SCRATCHPAD + 4);
149 } else
52 WARN_ON(1); 150 WARN_ON(1);
53 151
54 prm_set_mod_reg_bits(OMAP_RST_DPLL3, prcm_offs, RM_RSTCTRL); 152 prm_set_mod_reg_bits(OMAP_RST_DPLL3, prcm_offs, RM_RSTCTRL);
@@ -168,3 +266,308 @@ void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
168 prm_base = omap2_globals->prm; 266 prm_base = omap2_globals->prm;
169 cm_base = omap2_globals->cm; 267 cm_base = omap2_globals->cm;
170} 268}
269
270#ifdef CONFIG_ARCH_OMAP3
271void omap3_prcm_save_context(void)
272{
273 prcm_context.control_padconf_sys_nirq =
274 omap_ctrl_readl(OMAP343X_CONTROL_PADCONF_SYSNIRQ);
275 prcm_context.iva2_cm_clksel1 =
276 cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSEL1);
277 prcm_context.iva2_cm_clksel2 =
278 cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSEL2);
279 prcm_context.cm_sysconfig = __raw_readl(OMAP3430_CM_SYSCONFIG);
280 prcm_context.sgx_cm_clksel =
281 cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_CLKSEL);
282 prcm_context.wkup_cm_clksel = cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
283 prcm_context.dss_cm_clksel =
284 cm_read_mod_reg(OMAP3430_DSS_MOD, CM_CLKSEL);
285 prcm_context.cam_cm_clksel =
286 cm_read_mod_reg(OMAP3430_CAM_MOD, CM_CLKSEL);
287 prcm_context.per_cm_clksel =
288 cm_read_mod_reg(OMAP3430_PER_MOD, CM_CLKSEL);
289 prcm_context.emu_cm_clksel =
290 cm_read_mod_reg(OMAP3430_EMU_MOD, CM_CLKSEL1);
291 prcm_context.emu_cm_clkstctrl =
292 cm_read_mod_reg(OMAP3430_EMU_MOD, CM_CLKSTCTRL);
293 prcm_context.pll_cm_autoidle2 =
294 cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE2);
295 prcm_context.pll_cm_clksel4 =
296 cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKSEL4);
297 prcm_context.pll_cm_clksel5 =
298 cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKSEL5);
299 prcm_context.pll_cm_clken =
300 cm_read_mod_reg(PLL_MOD, CM_CLKEN);
301 prcm_context.pll_cm_clken2 =
302 cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKEN2);
303 prcm_context.cm_polctrl = __raw_readl(OMAP3430_CM_POLCTRL);
304 prcm_context.iva2_cm_fclken =
305 cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_FCLKEN);
306 prcm_context.iva2_cm_clken_pll = cm_read_mod_reg(OMAP3430_IVA2_MOD,
307 OMAP3430_CM_CLKEN_PLL);
308 prcm_context.core_cm_fclken1 =
309 cm_read_mod_reg(CORE_MOD, CM_FCLKEN1);
310 prcm_context.core_cm_fclken3 =
311 cm_read_mod_reg(CORE_MOD, OMAP3430ES2_CM_FCLKEN3);
312 prcm_context.sgx_cm_fclken =
313 cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_FCLKEN);
314 prcm_context.wkup_cm_fclken =
315 cm_read_mod_reg(WKUP_MOD, CM_FCLKEN);
316 prcm_context.dss_cm_fclken =
317 cm_read_mod_reg(OMAP3430_DSS_MOD, CM_FCLKEN);
318 prcm_context.cam_cm_fclken =
319 cm_read_mod_reg(OMAP3430_CAM_MOD, CM_FCLKEN);
320 prcm_context.per_cm_fclken =
321 cm_read_mod_reg(OMAP3430_PER_MOD, CM_FCLKEN);
322 prcm_context.usbhost_cm_fclken =
323 cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN);
324 prcm_context.core_cm_iclken1 =
325 cm_read_mod_reg(CORE_MOD, CM_ICLKEN1);
326 prcm_context.core_cm_iclken2 =
327 cm_read_mod_reg(CORE_MOD, CM_ICLKEN2);
328 prcm_context.core_cm_iclken3 =
329 cm_read_mod_reg(CORE_MOD, CM_ICLKEN3);
330 prcm_context.sgx_cm_iclken =
331 cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_ICLKEN);
332 prcm_context.wkup_cm_iclken =
333 cm_read_mod_reg(WKUP_MOD, CM_ICLKEN);
334 prcm_context.dss_cm_iclken =
335 cm_read_mod_reg(OMAP3430_DSS_MOD, CM_ICLKEN);
336 prcm_context.cam_cm_iclken =
337 cm_read_mod_reg(OMAP3430_CAM_MOD, CM_ICLKEN);
338 prcm_context.per_cm_iclken =
339 cm_read_mod_reg(OMAP3430_PER_MOD, CM_ICLKEN);
340 prcm_context.usbhost_cm_iclken =
341 cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN);
342 prcm_context.iva2_cm_autiidle2 =
343 cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_AUTOIDLE2);
344 prcm_context.mpu_cm_autoidle2 =
345 cm_read_mod_reg(MPU_MOD, CM_AUTOIDLE2);
346 prcm_context.pll_cm_autoidle =
347 cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
348 prcm_context.iva2_cm_clkstctrl =
349 cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSTCTRL);
350 prcm_context.mpu_cm_clkstctrl =
351 cm_read_mod_reg(MPU_MOD, CM_CLKSTCTRL);
352 prcm_context.core_cm_clkstctrl =
353 cm_read_mod_reg(CORE_MOD, CM_CLKSTCTRL);
354 prcm_context.sgx_cm_clkstctrl =
355 cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_CLKSTCTRL);
356 prcm_context.dss_cm_clkstctrl =
357 cm_read_mod_reg(OMAP3430_DSS_MOD, CM_CLKSTCTRL);
358 prcm_context.cam_cm_clkstctrl =
359 cm_read_mod_reg(OMAP3430_CAM_MOD, CM_CLKSTCTRL);
360 prcm_context.per_cm_clkstctrl =
361 cm_read_mod_reg(OMAP3430_PER_MOD, CM_CLKSTCTRL);
362 prcm_context.neon_cm_clkstctrl =
363 cm_read_mod_reg(OMAP3430_NEON_MOD, CM_CLKSTCTRL);
364 prcm_context.usbhost_cm_clkstctrl =
365 cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD, CM_CLKSTCTRL);
366 prcm_context.core_cm_autoidle1 =
367 cm_read_mod_reg(CORE_MOD, CM_AUTOIDLE1);
368 prcm_context.core_cm_autoidle2 =
369 cm_read_mod_reg(CORE_MOD, CM_AUTOIDLE2);
370 prcm_context.core_cm_autoidle3 =
371 cm_read_mod_reg(CORE_MOD, CM_AUTOIDLE3);
372 prcm_context.wkup_cm_autoidle =
373 cm_read_mod_reg(WKUP_MOD, CM_AUTOIDLE);
374 prcm_context.dss_cm_autoidle =
375 cm_read_mod_reg(OMAP3430_DSS_MOD, CM_AUTOIDLE);
376 prcm_context.cam_cm_autoidle =
377 cm_read_mod_reg(OMAP3430_CAM_MOD, CM_AUTOIDLE);
378 prcm_context.per_cm_autoidle =
379 cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
380 prcm_context.usbhost_cm_autoidle =
381 cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD, CM_AUTOIDLE);
382 prcm_context.sgx_cm_sleepdep =
383 cm_read_mod_reg(OMAP3430ES2_SGX_MOD, OMAP3430_CM_SLEEPDEP);
384 prcm_context.dss_cm_sleepdep =
385 cm_read_mod_reg(OMAP3430_DSS_MOD, OMAP3430_CM_SLEEPDEP);
386 prcm_context.cam_cm_sleepdep =
387 cm_read_mod_reg(OMAP3430_CAM_MOD, OMAP3430_CM_SLEEPDEP);
388 prcm_context.per_cm_sleepdep =
389 cm_read_mod_reg(OMAP3430_PER_MOD, OMAP3430_CM_SLEEPDEP);
390 prcm_context.usbhost_cm_sleepdep =
391 cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD, OMAP3430_CM_SLEEPDEP);
392 prcm_context.cm_clkout_ctrl = cm_read_mod_reg(OMAP3430_CCR_MOD,
393 OMAP3_CM_CLKOUT_CTRL_OFFSET);
394 prcm_context.prm_clkout_ctrl = prm_read_mod_reg(OMAP3430_CCR_MOD,
395 OMAP3_PRM_CLKOUT_CTRL_OFFSET);
396 prcm_context.sgx_pm_wkdep =
397 prm_read_mod_reg(OMAP3430ES2_SGX_MOD, PM_WKDEP);
398 prcm_context.dss_pm_wkdep =
399 prm_read_mod_reg(OMAP3430_DSS_MOD, PM_WKDEP);
400 prcm_context.cam_pm_wkdep =
401 prm_read_mod_reg(OMAP3430_CAM_MOD, PM_WKDEP);
402 prcm_context.per_pm_wkdep =
403 prm_read_mod_reg(OMAP3430_PER_MOD, PM_WKDEP);
404 prcm_context.neon_pm_wkdep =
405 prm_read_mod_reg(OMAP3430_NEON_MOD, PM_WKDEP);
406 prcm_context.usbhost_pm_wkdep =
407 prm_read_mod_reg(OMAP3430ES2_USBHOST_MOD, PM_WKDEP);
408 prcm_context.core_pm_mpugrpsel1 =
409 prm_read_mod_reg(CORE_MOD, OMAP3430_PM_MPUGRPSEL1);
410 prcm_context.iva2_pm_ivagrpsel1 =
411 prm_read_mod_reg(OMAP3430_IVA2_MOD, OMAP3430_PM_IVAGRPSEL1);
412 prcm_context.core_pm_mpugrpsel3 =
413 prm_read_mod_reg(CORE_MOD, OMAP3430ES2_PM_MPUGRPSEL3);
414 prcm_context.core_pm_ivagrpsel3 =
415 prm_read_mod_reg(CORE_MOD, OMAP3430ES2_PM_IVAGRPSEL3);
416 prcm_context.wkup_pm_mpugrpsel =
417 prm_read_mod_reg(WKUP_MOD, OMAP3430_PM_MPUGRPSEL);
418 prcm_context.wkup_pm_ivagrpsel =
419 prm_read_mod_reg(WKUP_MOD, OMAP3430_PM_IVAGRPSEL);
420 prcm_context.per_pm_mpugrpsel =
421 prm_read_mod_reg(OMAP3430_PER_MOD, OMAP3430_PM_MPUGRPSEL);
422 prcm_context.per_pm_ivagrpsel =
423 prm_read_mod_reg(OMAP3430_PER_MOD, OMAP3430_PM_IVAGRPSEL);
424 prcm_context.wkup_pm_wken = prm_read_mod_reg(WKUP_MOD, PM_WKEN);
425 return;
426}
427
428void omap3_prcm_restore_context(void)
429{
430 omap_ctrl_writel(prcm_context.control_padconf_sys_nirq,
431 OMAP343X_CONTROL_PADCONF_SYSNIRQ);
432 cm_write_mod_reg(prcm_context.iva2_cm_clksel1, OMAP3430_IVA2_MOD,
433 CM_CLKSEL1);
434 cm_write_mod_reg(prcm_context.iva2_cm_clksel2, OMAP3430_IVA2_MOD,
435 CM_CLKSEL2);
436 __raw_writel(prcm_context.cm_sysconfig, OMAP3430_CM_SYSCONFIG);
437 cm_write_mod_reg(prcm_context.sgx_cm_clksel, OMAP3430ES2_SGX_MOD,
438 CM_CLKSEL);
439 cm_write_mod_reg(prcm_context.wkup_cm_clksel, WKUP_MOD, CM_CLKSEL);
440 cm_write_mod_reg(prcm_context.dss_cm_clksel, OMAP3430_DSS_MOD,
441 CM_CLKSEL);
442 cm_write_mod_reg(prcm_context.cam_cm_clksel, OMAP3430_CAM_MOD,
443 CM_CLKSEL);
444 cm_write_mod_reg(prcm_context.per_cm_clksel, OMAP3430_PER_MOD,
445 CM_CLKSEL);
446 cm_write_mod_reg(prcm_context.emu_cm_clksel, OMAP3430_EMU_MOD,
447 CM_CLKSEL1);
448 cm_write_mod_reg(prcm_context.emu_cm_clkstctrl, OMAP3430_EMU_MOD,
449 CM_CLKSTCTRL);
450 cm_write_mod_reg(prcm_context.pll_cm_autoidle2, PLL_MOD,
451 CM_AUTOIDLE2);
452 cm_write_mod_reg(prcm_context.pll_cm_clksel4, PLL_MOD,
453 OMAP3430ES2_CM_CLKSEL4);
454 cm_write_mod_reg(prcm_context.pll_cm_clksel5, PLL_MOD,
455 OMAP3430ES2_CM_CLKSEL5);
456 cm_write_mod_reg(prcm_context.pll_cm_clken, PLL_MOD, CM_CLKEN);
457 cm_write_mod_reg(prcm_context.pll_cm_clken2, PLL_MOD,
458 OMAP3430ES2_CM_CLKEN2);
459 __raw_writel(prcm_context.cm_polctrl, OMAP3430_CM_POLCTRL);
460 cm_write_mod_reg(prcm_context.iva2_cm_fclken, OMAP3430_IVA2_MOD,
461 CM_FCLKEN);
462 cm_write_mod_reg(prcm_context.iva2_cm_clken_pll, OMAP3430_IVA2_MOD,
463 OMAP3430_CM_CLKEN_PLL);
464 cm_write_mod_reg(prcm_context.core_cm_fclken1, CORE_MOD, CM_FCLKEN1);
465 cm_write_mod_reg(prcm_context.core_cm_fclken3, CORE_MOD,
466 OMAP3430ES2_CM_FCLKEN3);
467 cm_write_mod_reg(prcm_context.sgx_cm_fclken, OMAP3430ES2_SGX_MOD,
468 CM_FCLKEN);
469 cm_write_mod_reg(prcm_context.wkup_cm_fclken, WKUP_MOD, CM_FCLKEN);
470 cm_write_mod_reg(prcm_context.dss_cm_fclken, OMAP3430_DSS_MOD,
471 CM_FCLKEN);
472 cm_write_mod_reg(prcm_context.cam_cm_fclken, OMAP3430_CAM_MOD,
473 CM_FCLKEN);
474 cm_write_mod_reg(prcm_context.per_cm_fclken, OMAP3430_PER_MOD,
475 CM_FCLKEN);
476 cm_write_mod_reg(prcm_context.usbhost_cm_fclken,
477 OMAP3430ES2_USBHOST_MOD, CM_FCLKEN);
478 cm_write_mod_reg(prcm_context.core_cm_iclken1, CORE_MOD, CM_ICLKEN1);
479 cm_write_mod_reg(prcm_context.core_cm_iclken2, CORE_MOD, CM_ICLKEN2);
480 cm_write_mod_reg(prcm_context.core_cm_iclken3, CORE_MOD, CM_ICLKEN3);
481 cm_write_mod_reg(prcm_context.sgx_cm_iclken, OMAP3430ES2_SGX_MOD,
482 CM_ICLKEN);
483 cm_write_mod_reg(prcm_context.wkup_cm_iclken, WKUP_MOD, CM_ICLKEN);
484 cm_write_mod_reg(prcm_context.dss_cm_iclken, OMAP3430_DSS_MOD,
485 CM_ICLKEN);
486 cm_write_mod_reg(prcm_context.cam_cm_iclken, OMAP3430_CAM_MOD,
487 CM_ICLKEN);
488 cm_write_mod_reg(prcm_context.per_cm_iclken, OMAP3430_PER_MOD,
489 CM_ICLKEN);
490 cm_write_mod_reg(prcm_context.usbhost_cm_iclken,
491 OMAP3430ES2_USBHOST_MOD, CM_ICLKEN);
492 cm_write_mod_reg(prcm_context.iva2_cm_autiidle2, OMAP3430_IVA2_MOD,
493 CM_AUTOIDLE2);
494 cm_write_mod_reg(prcm_context.mpu_cm_autoidle2, MPU_MOD, CM_AUTOIDLE2);
495 cm_write_mod_reg(prcm_context.pll_cm_autoidle, PLL_MOD, CM_AUTOIDLE);
496 cm_write_mod_reg(prcm_context.iva2_cm_clkstctrl, OMAP3430_IVA2_MOD,
497 CM_CLKSTCTRL);
498 cm_write_mod_reg(prcm_context.mpu_cm_clkstctrl, MPU_MOD, CM_CLKSTCTRL);
499 cm_write_mod_reg(prcm_context.core_cm_clkstctrl, CORE_MOD,
500 CM_CLKSTCTRL);
501 cm_write_mod_reg(prcm_context.sgx_cm_clkstctrl, OMAP3430ES2_SGX_MOD,
502 CM_CLKSTCTRL);
503 cm_write_mod_reg(prcm_context.dss_cm_clkstctrl, OMAP3430_DSS_MOD,
504 CM_CLKSTCTRL);
505 cm_write_mod_reg(prcm_context.cam_cm_clkstctrl, OMAP3430_CAM_MOD,
506 CM_CLKSTCTRL);
507 cm_write_mod_reg(prcm_context.per_cm_clkstctrl, OMAP3430_PER_MOD,
508 CM_CLKSTCTRL);
509 cm_write_mod_reg(prcm_context.neon_cm_clkstctrl, OMAP3430_NEON_MOD,
510 CM_CLKSTCTRL);
511 cm_write_mod_reg(prcm_context.usbhost_cm_clkstctrl,
512 OMAP3430ES2_USBHOST_MOD, CM_CLKSTCTRL);
513 cm_write_mod_reg(prcm_context.core_cm_autoidle1, CORE_MOD,
514 CM_AUTOIDLE1);
515 cm_write_mod_reg(prcm_context.core_cm_autoidle2, CORE_MOD,
516 CM_AUTOIDLE2);
517 cm_write_mod_reg(prcm_context.core_cm_autoidle3, CORE_MOD,
518 CM_AUTOIDLE3);
519 cm_write_mod_reg(prcm_context.wkup_cm_autoidle, WKUP_MOD, CM_AUTOIDLE);
520 cm_write_mod_reg(prcm_context.dss_cm_autoidle, OMAP3430_DSS_MOD,
521 CM_AUTOIDLE);
522 cm_write_mod_reg(prcm_context.cam_cm_autoidle, OMAP3430_CAM_MOD,
523 CM_AUTOIDLE);
524 cm_write_mod_reg(prcm_context.per_cm_autoidle, OMAP3430_PER_MOD,
525 CM_AUTOIDLE);
526 cm_write_mod_reg(prcm_context.usbhost_cm_autoidle,
527 OMAP3430ES2_USBHOST_MOD, CM_AUTOIDLE);
528 cm_write_mod_reg(prcm_context.sgx_cm_sleepdep, OMAP3430ES2_SGX_MOD,
529 OMAP3430_CM_SLEEPDEP);
530 cm_write_mod_reg(prcm_context.dss_cm_sleepdep, OMAP3430_DSS_MOD,
531 OMAP3430_CM_SLEEPDEP);
532 cm_write_mod_reg(prcm_context.cam_cm_sleepdep, OMAP3430_CAM_MOD,
533 OMAP3430_CM_SLEEPDEP);
534 cm_write_mod_reg(prcm_context.per_cm_sleepdep, OMAP3430_PER_MOD,
535 OMAP3430_CM_SLEEPDEP);
536 cm_write_mod_reg(prcm_context.usbhost_cm_sleepdep,
537 OMAP3430ES2_USBHOST_MOD, OMAP3430_CM_SLEEPDEP);
538 cm_write_mod_reg(prcm_context.cm_clkout_ctrl, OMAP3430_CCR_MOD,
539 OMAP3_CM_CLKOUT_CTRL_OFFSET);
540 prm_write_mod_reg(prcm_context.prm_clkout_ctrl, OMAP3430_CCR_MOD,
541 OMAP3_PRM_CLKOUT_CTRL_OFFSET);
542 prm_write_mod_reg(prcm_context.sgx_pm_wkdep, OMAP3430ES2_SGX_MOD,
543 PM_WKDEP);
544 prm_write_mod_reg(prcm_context.dss_pm_wkdep, OMAP3430_DSS_MOD,
545 PM_WKDEP);
546 prm_write_mod_reg(prcm_context.cam_pm_wkdep, OMAP3430_CAM_MOD,
547 PM_WKDEP);
548 prm_write_mod_reg(prcm_context.per_pm_wkdep, OMAP3430_PER_MOD,
549 PM_WKDEP);
550 prm_write_mod_reg(prcm_context.neon_pm_wkdep, OMAP3430_NEON_MOD,
551 PM_WKDEP);
552 prm_write_mod_reg(prcm_context.usbhost_pm_wkdep,
553 OMAP3430ES2_USBHOST_MOD, PM_WKDEP);
554 prm_write_mod_reg(prcm_context.core_pm_mpugrpsel1, CORE_MOD,
555 OMAP3430_PM_MPUGRPSEL1);
556 prm_write_mod_reg(prcm_context.iva2_pm_ivagrpsel1, OMAP3430_IVA2_MOD,
557 OMAP3430_PM_IVAGRPSEL1);
558 prm_write_mod_reg(prcm_context.core_pm_mpugrpsel3, CORE_MOD,
559 OMAP3430ES2_PM_MPUGRPSEL3);
560 prm_write_mod_reg(prcm_context.core_pm_ivagrpsel3, CORE_MOD,
561 OMAP3430ES2_PM_IVAGRPSEL3);
562 prm_write_mod_reg(prcm_context.wkup_pm_mpugrpsel, WKUP_MOD,
563 OMAP3430_PM_MPUGRPSEL);
564 prm_write_mod_reg(prcm_context.wkup_pm_ivagrpsel, WKUP_MOD,
565 OMAP3430_PM_IVAGRPSEL);
566 prm_write_mod_reg(prcm_context.per_pm_mpugrpsel, OMAP3430_PER_MOD,
567 OMAP3430_PM_MPUGRPSEL);
568 prm_write_mod_reg(prcm_context.per_pm_ivagrpsel, OMAP3430_PER_MOD,
569 OMAP3430_PM_IVAGRPSEL);
570 prm_write_mod_reg(prcm_context.wkup_pm_wken, WKUP_MOD, PM_WKEN);
571 return;
572}
573#endif
diff --git a/arch/arm/mach-omap2/prm-regbits-34xx.h b/arch/arm/mach-omap2/prm-regbits-34xx.h
index 9fd03a2ec95c..8f21bae6dc1c 100644
--- a/arch/arm/mach-omap2/prm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/prm-regbits-34xx.h
@@ -365,6 +365,7 @@
365/* PM_PREPWSTST_GFX specific bits */ 365/* PM_PREPWSTST_GFX specific bits */
366 366
367/* PM_WKEN_WKUP specific bits */ 367/* PM_WKEN_WKUP specific bits */
368#define OMAP3430_EN_IO_CHAIN (1 << 16)
368#define OMAP3430_EN_IO (1 << 8) 369#define OMAP3430_EN_IO (1 << 8)
369#define OMAP3430_EN_GPIO1 (1 << 3) 370#define OMAP3430_EN_GPIO1 (1 << 3)
370 371
@@ -373,6 +374,7 @@
373/* PM_IVA2GRPSEL_WKUP specific bits */ 374/* PM_IVA2GRPSEL_WKUP specific bits */
374 375
375/* PM_WKST_WKUP specific bits */ 376/* PM_WKST_WKUP specific bits */
377#define OMAP3430_ST_IO_CHAIN (1 << 16)
376#define OMAP3430_ST_IO (1 << 8) 378#define OMAP3430_ST_IO (1 << 8)
377 379
378/* PRM_CLKSEL */ 380/* PRM_CLKSEL */
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index 03c467c35f54..a117f853ea39 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -17,11 +17,11 @@
17#include "prcm-common.h" 17#include "prcm-common.h"
18 18
19#define OMAP2420_PRM_REGADDR(module, reg) \ 19#define OMAP2420_PRM_REGADDR(module, reg) \
20 OMAP2_IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg)) 20 OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg))
21#define OMAP2430_PRM_REGADDR(module, reg) \ 21#define OMAP2430_PRM_REGADDR(module, reg) \
22 OMAP2_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg)) 22 OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg))
23#define OMAP34XX_PRM_REGADDR(module, reg) \ 23#define OMAP34XX_PRM_REGADDR(module, reg) \
24 OMAP2_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg)) 24 OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
25 25
26/* 26/*
27 * Architecture-specific global PRM registers 27 * Architecture-specific global PRM registers
diff --git a/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h b/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h
new file mode 100644
index 000000000000..8bfaf342a028
--- /dev/null
+++ b/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h
@@ -0,0 +1,51 @@
1/*
2 * SDRC register values for the Hynix H8MBX00U0MER-0EM
3 *
4 * Copyright (C) 2009 Texas Instruments, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM
12#define __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM
13
14#include <plat/sdrc.h>
15
16/* Hynix H8MBX00U0MER-0EM */
17static struct omap_sdrc_params h8mbx00u0mer0em_sdrc_params[] = {
18 [0] = {
19 .rate = 200000000,
20 .actim_ctrla = 0xa2e1b4c6,
21 .actim_ctrlb = 0x0002131c,
22 .rfr_ctrl = 0x0005e601,
23 .mr = 0x00000032,
24 },
25 [1] = {
26 .rate = 166000000,
27 .actim_ctrla = 0x629db4c6,
28 .actim_ctrlb = 0x00012214,
29 .rfr_ctrl = 0x0004dc01,
30 .mr = 0x00000032,
31 },
32 [2] = {
33 .rate = 100000000,
34 .actim_ctrla = 0x51912284,
35 .actim_ctrlb = 0x0002120e,
36 .rfr_ctrl = 0x0002d101,
37 .mr = 0x00000022,
38 },
39 [3] = {
40 .rate = 83000000,
41 .actim_ctrla = 0x31512283,
42 .actim_ctrlb = 0x0001220a,
43 .rfr_ctrl = 0x00025501,
44 .mr = 0x00000022,
45 },
46 [4] = {
47 .rate = 0
48 },
49};
50
51#endif
diff --git a/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h b/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h
index 02e1c2d4705f..a391b4939f74 100644
--- a/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h
+++ b/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h
@@ -14,7 +14,7 @@
14#ifndef ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF 14#ifndef ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF
15#define ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF 15#define ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF
16 16
17#include <mach/sdrc.h> 17#include <plat/sdrc.h>
18 18
19/* Micron MT46H32M32LF-6 */ 19/* Micron MT46H32M32LF-6 */
20/* XXX Using ARE = 0x1 (no autorefresh burst) -- can this be changed? */ 20/* XXX Using ARE = 0x1 (no autorefresh burst) -- can this be changed? */
diff --git a/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h b/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h
index 3751d293cb1f..0e518a72831f 100644
--- a/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h
+++ b/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h
@@ -14,7 +14,7 @@
14#ifndef ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6 14#ifndef ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6
15#define ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6 15#define ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6
16 16
17#include <mach/sdrc.h> 17#include <plat/sdrc.h>
18 18
19/* Qimonda HYB18M512160AF-6 */ 19/* Qimonda HYB18M512160AF-6 */
20static struct omap_sdrc_params hyb18m512160af6_sdrc_params[] = { 20static struct omap_sdrc_params hyb18m512160af6_sdrc_params[] = {
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c
index 9e3bd4fa7810..9a592199321c 100644
--- a/arch/arm/mach-omap2/sdrc.c
+++ b/arch/arm/mach-omap2/sdrc.c
@@ -23,13 +23,13 @@
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/io.h> 24#include <linux/io.h>
25 25
26#include <mach/common.h> 26#include <plat/common.h>
27#include <mach/clock.h> 27#include <plat/clock.h>
28#include <mach/sram.h> 28#include <plat/sram.h>
29 29
30#include "prm.h" 30#include "prm.h"
31 31
32#include <mach/sdrc.h> 32#include <plat/sdrc.h>
33#include "sdrc.h" 33#include "sdrc.h"
34 34
35static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1; 35static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1;
@@ -37,12 +37,38 @@ static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1;
37void __iomem *omap2_sdrc_base; 37void __iomem *omap2_sdrc_base;
38void __iomem *omap2_sms_base; 38void __iomem *omap2_sms_base;
39 39
40struct omap2_sms_regs {
41 u32 sms_sysconfig;
42};
43
44static struct omap2_sms_regs sms_context;
45
40/* SDRC_POWER register bits */ 46/* SDRC_POWER register bits */
41#define SDRC_POWER_EXTCLKDIS_SHIFT 3 47#define SDRC_POWER_EXTCLKDIS_SHIFT 3
42#define SDRC_POWER_PWDENA_SHIFT 2 48#define SDRC_POWER_PWDENA_SHIFT 2
43#define SDRC_POWER_PAGEPOLICY_SHIFT 0 49#define SDRC_POWER_PAGEPOLICY_SHIFT 0
44 50
45/** 51/**
52 * omap2_sms_save_context - Save SMS registers
53 *
54 * Save SMS registers that need to be restored after off mode.
55 */
56void omap2_sms_save_context(void)
57{
58 sms_context.sms_sysconfig = sms_read_reg(SMS_SYSCONFIG);
59}
60
61/**
62 * omap2_sms_restore_context - Restore SMS registers
63 *
64 * Restore SMS registers that need to be Restored after off mode.
65 */
66void omap2_sms_restore_context(void)
67{
68 sms_write_reg(sms_context.sms_sysconfig, SMS_SYSCONFIG);
69}
70
71/**
46 * omap2_sdrc_get_params - return SDRC register values for a given clock rate 72 * omap2_sdrc_get_params - return SDRC register values for a given clock rate
47 * @r: SDRC clock rate (in Hz) 73 * @r: SDRC clock rate (in Hz)
48 * @sdrc_cs0: chip select 0 ram timings ** 74 * @sdrc_cs0: chip select 0 ram timings **
@@ -132,4 +158,5 @@ void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
132 l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) | 158 l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) |
133 (1 << SDRC_POWER_PAGEPOLICY_SHIFT); 159 (1 << SDRC_POWER_PAGEPOLICY_SHIFT);
134 sdrc_write_reg(l, SDRC_POWER); 160 sdrc_write_reg(l, SDRC_POWER);
161 omap2_sms_save_context();
135} 162}
diff --git a/arch/arm/mach-omap2/sdrc.h b/arch/arm/mach-omap2/sdrc.h
index 0837eda5f2b6..48207b018989 100644
--- a/arch/arm/mach-omap2/sdrc.h
+++ b/arch/arm/mach-omap2/sdrc.h
@@ -15,7 +15,7 @@
15 */ 15 */
16#undef DEBUG 16#undef DEBUG
17 17
18#include <mach/sdrc.h> 18#include <plat/sdrc.h>
19 19
20#ifndef __ASSEMBLER__ 20#ifndef __ASSEMBLER__
21extern void __iomem *omap2_sdrc_base; 21extern void __iomem *omap2_sdrc_base;
@@ -48,9 +48,12 @@ static inline u32 sms_read_reg(u16 reg)
48 return __raw_readl(OMAP_SMS_REGADDR(reg)); 48 return __raw_readl(OMAP_SMS_REGADDR(reg));
49} 49}
50#else 50#else
51#define OMAP242X_SDRC_REGADDR(reg) OMAP2_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg)) 51#define OMAP242X_SDRC_REGADDR(reg) \
52#define OMAP243X_SDRC_REGADDR(reg) OMAP2_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg)) 52 OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg))
53#define OMAP34XX_SDRC_REGADDR(reg) OMAP2_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg)) 53#define OMAP243X_SDRC_REGADDR(reg) \
54 OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg))
55#define OMAP34XX_SDRC_REGADDR(reg) \
56 OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg))
54#endif /* __ASSEMBLER__ */ 57#endif /* __ASSEMBLER__ */
55 58
56#endif 59#endif
diff --git a/arch/arm/mach-omap2/sdrc2xxx.c b/arch/arm/mach-omap2/sdrc2xxx.c
index feaec7eaf6bd..0f4d27aef44d 100644
--- a/arch/arm/mach-omap2/sdrc2xxx.c
+++ b/arch/arm/mach-omap2/sdrc2xxx.c
@@ -24,13 +24,13 @@
24#include <linux/clk.h> 24#include <linux/clk.h>
25#include <linux/io.h> 25#include <linux/io.h>
26 26
27#include <mach/common.h> 27#include <plat/common.h>
28#include <mach/clock.h> 28#include <plat/clock.h>
29#include <mach/sram.h> 29#include <plat/sram.h>
30 30
31#include "prm.h" 31#include "prm.h"
32#include "clock.h" 32#include "clock.h"
33#include <mach/sdrc.h> 33#include <plat/sdrc.h>
34#include "sdrc.h" 34#include "sdrc.h"
35 35
36/* Memory timing, DLL mode flags */ 36/* Memory timing, DLL mode flags */
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index ae2186892c85..2e17b57f5b23 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -24,10 +24,10 @@
24#include <linux/clk.h> 24#include <linux/clk.h>
25#include <linux/io.h> 25#include <linux/io.h>
26 26
27#include <mach/common.h> 27#include <plat/common.h>
28#include <mach/board.h> 28#include <plat/board.h>
29#include <mach/clock.h> 29#include <plat/clock.h>
30#include <mach/control.h> 30#include <plat/control.h>
31 31
32#include "prm.h" 32#include "prm.h"
33#include "pm.h" 33#include "pm.h"
@@ -73,7 +73,6 @@ static LIST_HEAD(uart_list);
73 73
74static struct plat_serial8250_port serial_platform_data0[] = { 74static struct plat_serial8250_port serial_platform_data0[] = {
75 { 75 {
76 .membase = OMAP2_IO_ADDRESS(OMAP_UART1_BASE),
77 .mapbase = OMAP_UART1_BASE, 76 .mapbase = OMAP_UART1_BASE,
78 .irq = 72, 77 .irq = 72,
79 .flags = UPF_BOOT_AUTOCONF, 78 .flags = UPF_BOOT_AUTOCONF,
@@ -87,7 +86,6 @@ static struct plat_serial8250_port serial_platform_data0[] = {
87 86
88static struct plat_serial8250_port serial_platform_data1[] = { 87static struct plat_serial8250_port serial_platform_data1[] = {
89 { 88 {
90 .membase = OMAP2_IO_ADDRESS(OMAP_UART2_BASE),
91 .mapbase = OMAP_UART2_BASE, 89 .mapbase = OMAP_UART2_BASE,
92 .irq = 73, 90 .irq = 73,
93 .flags = UPF_BOOT_AUTOCONF, 91 .flags = UPF_BOOT_AUTOCONF,
@@ -101,7 +99,6 @@ static struct plat_serial8250_port serial_platform_data1[] = {
101 99
102static struct plat_serial8250_port serial_platform_data2[] = { 100static struct plat_serial8250_port serial_platform_data2[] = {
103 { 101 {
104 .membase = OMAP2_IO_ADDRESS(OMAP_UART3_BASE),
105 .mapbase = OMAP_UART3_BASE, 102 .mapbase = OMAP_UART3_BASE,
106 .irq = 74, 103 .irq = 74,
107 .flags = UPF_BOOT_AUTOCONF, 104 .flags = UPF_BOOT_AUTOCONF,
@@ -109,16 +106,6 @@ static struct plat_serial8250_port serial_platform_data2[] = {
109 .regshift = 2, 106 .regshift = 2,
110 .uartclk = OMAP24XX_BASE_BAUD * 16, 107 .uartclk = OMAP24XX_BASE_BAUD * 16,
111 }, { 108 }, {
112#ifdef CONFIG_ARCH_OMAP4
113 .membase = OMAP2_IO_ADDRESS(OMAP_UART4_BASE),
114 .mapbase = OMAP_UART4_BASE,
115 .irq = 70,
116 .flags = UPF_BOOT_AUTOCONF,
117 .iotype = UPIO_MEM,
118 .regshift = 2,
119 .uartclk = OMAP24XX_BASE_BAUD * 16,
120 }, {
121#endif
122 .flags = 0 109 .flags = 0
123 } 110 }
124}; 111};
@@ -126,7 +113,6 @@ static struct plat_serial8250_port serial_platform_data2[] = {
126#ifdef CONFIG_ARCH_OMAP4 113#ifdef CONFIG_ARCH_OMAP4
127static struct plat_serial8250_port serial_platform_data3[] = { 114static struct plat_serial8250_port serial_platform_data3[] = {
128 { 115 {
129 .membase = OMAP2_IO_ADDRESS(OMAP_UART4_BASE),
130 .mapbase = OMAP_UART4_BASE, 116 .mapbase = OMAP_UART4_BASE,
131 .irq = 70, 117 .irq = 70,
132 .flags = UPF_BOOT_AUTOCONF, 118 .flags = UPF_BOOT_AUTOCONF,
@@ -169,8 +155,6 @@ static inline void __init omap_uart_reset(struct omap_uart_state *uart)
169 155
170#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) 156#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3)
171 157
172static int enable_off_mode; /* to be removed by full off-mode patches */
173
174static void omap_uart_save_context(struct omap_uart_state *uart) 158static void omap_uart_save_context(struct omap_uart_state *uart)
175{ 159{
176 u16 lcr = 0; 160 u16 lcr = 0;
@@ -549,7 +533,7 @@ static inline void omap_uart_idle_init(struct omap_uart_state *uart) {}
549#define DEV_CREATE_FILE(dev, attr) 533#define DEV_CREATE_FILE(dev, attr)
550#endif /* CONFIG_PM */ 534#endif /* CONFIG_PM */
551 535
552static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS] = { 536static struct omap_uart_state omap_uart[] = {
553 { 537 {
554 .pdev = { 538 .pdev = {
555 .name = "serial8250", 539 .name = "serial8250",
@@ -599,12 +583,22 @@ void __init omap_serial_early_init(void)
599 * if not needed. 583 * if not needed.
600 */ 584 */
601 585
602 for (i = 0; i < OMAP_MAX_NR_PORTS; i++) { 586 for (i = 0; i < ARRAY_SIZE(omap_uart); i++) {
603 struct omap_uart_state *uart = &omap_uart[i]; 587 struct omap_uart_state *uart = &omap_uart[i];
604 struct platform_device *pdev = &uart->pdev; 588 struct platform_device *pdev = &uart->pdev;
605 struct device *dev = &pdev->dev; 589 struct device *dev = &pdev->dev;
606 struct plat_serial8250_port *p = dev->platform_data; 590 struct plat_serial8250_port *p = dev->platform_data;
607 591
592 /*
593 * Module 4KB + L4 interconnect 4KB
594 * Static mapping, never released
595 */
596 p->membase = ioremap(p->mapbase, SZ_8K);
597 if (!p->membase) {
598 printk(KERN_ERR "ioremap failed for uart%i\n", i + 1);
599 continue;
600 }
601
608 sprintf(name, "uart%d_ick", i+1); 602 sprintf(name, "uart%d_ick", i+1);
609 uart->ick = clk_get(NULL, name); 603 uart->ick = clk_get(NULL, name);
610 if (IS_ERR(uart->ick)) { 604 if (IS_ERR(uart->ick)) {
@@ -641,7 +635,7 @@ void __init omap_serial_init(void)
641{ 635{
642 int i; 636 int i;
643 637
644 for (i = 0; i < OMAP_MAX_NR_PORTS; i++) { 638 for (i = 0; i < ARRAY_SIZE(omap_uart); i++) {
645 struct omap_uart_state *uart = &omap_uart[i]; 639 struct omap_uart_state *uart = &omap_uart[i];
646 struct platform_device *pdev = &uart->pdev; 640 struct platform_device *pdev = &uart->pdev;
647 struct device *dev = &pdev->dev; 641 struct device *dev = &pdev->dev;
diff --git a/arch/arm/mach-omap2/sleep24xx.S b/arch/arm/mach-omap2/sleep24xx.S
index 130aadbfa083..c7780cc8d919 100644
--- a/arch/arm/mach-omap2/sleep24xx.S
+++ b/arch/arm/mach-omap2/sleep24xx.S
@@ -29,7 +29,7 @@
29#include <asm/assembler.h> 29#include <asm/assembler.h>
30#include <mach/io.h> 30#include <mach/io.h>
31 31
32#include <mach/omap24xx.h> 32#include <plat/omap24xx.h>
33 33
34#include "sdrc.h" 34#include "sdrc.h"
35 35
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
index e5e2553e79a6..15268f8b61de 100644
--- a/arch/arm/mach-omap2/sleep34xx.S
+++ b/arch/arm/mach-omap2/sleep34xx.S
@@ -27,22 +27,35 @@
27#include <linux/linkage.h> 27#include <linux/linkage.h>
28#include <asm/assembler.h> 28#include <asm/assembler.h>
29#include <mach/io.h> 29#include <mach/io.h>
30#include <mach/control.h> 30#include <plat/control.h>
31 31
32#include "cm.h"
32#include "prm.h" 33#include "prm.h"
33#include "sdrc.h" 34#include "sdrc.h"
34 35
35#define PM_PREPWSTST_CORE_V OMAP34XX_PRM_REGADDR(CORE_MOD, \ 36#define PM_PREPWSTST_CORE_V OMAP34XX_PRM_REGADDR(CORE_MOD, \
36 OMAP3430_PM_PREPWSTST) 37 OMAP3430_PM_PREPWSTST)
38#define PM_PREPWSTST_CORE_P 0x48306AE8
37#define PM_PREPWSTST_MPU_V OMAP34XX_PRM_REGADDR(MPU_MOD, \ 39#define PM_PREPWSTST_MPU_V OMAP34XX_PRM_REGADDR(MPU_MOD, \
38 OMAP3430_PM_PREPWSTST) 40 OMAP3430_PM_PREPWSTST)
39#define PM_PWSTCTRL_MPU_P OMAP34XX_PRM_REGADDR(MPU_MOD, PM_PWSTCTRL) 41#define PM_PWSTCTRL_MPU_P OMAP3430_PRM_BASE + MPU_MOD + PM_PWSTCTRL
42#define CM_IDLEST1_CORE_V OMAP34XX_CM_REGADDR(CORE_MOD, CM_IDLEST1)
43#define SRAM_BASE_P 0x40200000
44#define CONTROL_STAT 0x480022F0
40#define SCRATCHPAD_MEM_OFFS 0x310 /* Move this as correct place is 45#define SCRATCHPAD_MEM_OFFS 0x310 /* Move this as correct place is
41 * available */ 46 * available */
42#define SCRATCHPAD_BASE_P OMAP343X_CTRL_REGADDR(\ 47#define SCRATCHPAD_BASE_P (OMAP343X_CTRL_BASE + OMAP343X_CONTROL_MEM_WKUP\
43 OMAP343X_CONTROL_MEM_WKUP +\ 48 + SCRATCHPAD_MEM_OFFS)
44 SCRATCHPAD_MEM_OFFS)
45#define SDRC_POWER_V OMAP34XX_SDRC_REGADDR(SDRC_POWER) 49#define SDRC_POWER_V OMAP34XX_SDRC_REGADDR(SDRC_POWER)
50#define SDRC_SYSCONFIG_P (OMAP343X_SDRC_BASE + SDRC_SYSCONFIG)
51#define SDRC_MR_0_P (OMAP343X_SDRC_BASE + SDRC_MR_0)
52#define SDRC_EMR2_0_P (OMAP343X_SDRC_BASE + SDRC_EMR2_0)
53#define SDRC_MANUAL_0_P (OMAP343X_SDRC_BASE + SDRC_MANUAL_0)
54#define SDRC_MR_1_P (OMAP343X_SDRC_BASE + SDRC_MR_1)
55#define SDRC_EMR2_1_P (OMAP343X_SDRC_BASE + SDRC_EMR2_1)
56#define SDRC_MANUAL_1_P (OMAP343X_SDRC_BASE + SDRC_MANUAL_1)
57#define SDRC_DLLA_STATUS_V OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS)
58#define SDRC_DLLA_CTRL_V OMAP34XX_SDRC_REGADDR(SDRC_DLLA_CTRL)
46 59
47 .text 60 .text
48/* Function call to get the restore pointer for resume from OFF */ 61/* Function call to get the restore pointer for resume from OFF */
@@ -51,7 +64,93 @@ ENTRY(get_restore_pointer)
51 adr r0, restore 64 adr r0, restore
52 ldmfd sp!, {pc} @ restore regs and return 65 ldmfd sp!, {pc} @ restore regs and return
53ENTRY(get_restore_pointer_sz) 66ENTRY(get_restore_pointer_sz)
54 .word . - get_restore_pointer_sz 67 .word . - get_restore_pointer
68
69 .text
70/* Function call to get the restore pointer for for ES3 to resume from OFF */
71ENTRY(get_es3_restore_pointer)
72 stmfd sp!, {lr} @ save registers on stack
73 adr r0, restore_es3
74 ldmfd sp!, {pc} @ restore regs and return
75ENTRY(get_es3_restore_pointer_sz)
76 .word . - get_es3_restore_pointer
77
78ENTRY(es3_sdrc_fix)
79 ldr r4, sdrc_syscfg @ get config addr
80 ldr r5, [r4] @ get value
81 tst r5, #0x100 @ is part access blocked
82 it eq
83 biceq r5, r5, #0x100 @ clear bit if set
84 str r5, [r4] @ write back change
85 ldr r4, sdrc_mr_0 @ get config addr
86 ldr r5, [r4] @ get value
87 str r5, [r4] @ write back change
88 ldr r4, sdrc_emr2_0 @ get config addr
89 ldr r5, [r4] @ get value
90 str r5, [r4] @ write back change
91 ldr r4, sdrc_manual_0 @ get config addr
92 mov r5, #0x2 @ autorefresh command
93 str r5, [r4] @ kick off refreshes
94 ldr r4, sdrc_mr_1 @ get config addr
95 ldr r5, [r4] @ get value
96 str r5, [r4] @ write back change
97 ldr r4, sdrc_emr2_1 @ get config addr
98 ldr r5, [r4] @ get value
99 str r5, [r4] @ write back change
100 ldr r4, sdrc_manual_1 @ get config addr
101 mov r5, #0x2 @ autorefresh command
102 str r5, [r4] @ kick off refreshes
103 bx lr
104sdrc_syscfg:
105 .word SDRC_SYSCONFIG_P
106sdrc_mr_0:
107 .word SDRC_MR_0_P
108sdrc_emr2_0:
109 .word SDRC_EMR2_0_P
110sdrc_manual_0:
111 .word SDRC_MANUAL_0_P
112sdrc_mr_1:
113 .word SDRC_MR_1_P
114sdrc_emr2_1:
115 .word SDRC_EMR2_1_P
116sdrc_manual_1:
117 .word SDRC_MANUAL_1_P
118ENTRY(es3_sdrc_fix_sz)
119 .word . - es3_sdrc_fix
120
121/* Function to call rom code to save secure ram context */
122ENTRY(save_secure_ram_context)
123 stmfd sp!, {r1-r12, lr} @ save registers on stack
124save_secure_ram_debug:
125 /* b save_secure_ram_debug */ @ enable to debug save code
126 adr r3, api_params @ r3 points to parameters
127 str r0, [r3,#0x4] @ r0 has sdram address
128 ldr r12, high_mask
129 and r3, r3, r12
130 ldr r12, sram_phy_addr_mask
131 orr r3, r3, r12
132 mov r0, #25 @ set service ID for PPA
133 mov r12, r0 @ copy secure service ID in r12
134 mov r1, #0 @ set task id for ROM code in r1
135 mov r2, #4 @ set some flags in r2, r6
136 mov r6, #0xff
137 mcr p15, 0, r0, c7, c10, 4 @ data write barrier
138 mcr p15, 0, r0, c7, c10, 5 @ data memory barrier
139 .word 0xE1600071 @ call SMI monitor (smi #1)
140 nop
141 nop
142 nop
143 nop
144 ldmfd sp!, {r1-r12, pc}
145sram_phy_addr_mask:
146 .word SRAM_BASE_P
147high_mask:
148 .word 0xffff
149api_params:
150 .word 0x4, 0x0, 0x0, 0x1, 0x1
151ENTRY(save_secure_ram_context_sz)
152 .word . - save_secure_ram_context
153
55/* 154/*
56 * Forces OMAP into idle state 155 * Forces OMAP into idle state
57 * 156 *
@@ -92,11 +191,29 @@ loop:
92 nop 191 nop
93 nop 192 nop
94 nop 193 nop
95 bl i_dll_wait 194 bl wait_sdrc_ok
96 195
97 ldmfd sp!, {r0-r12, pc} @ restore regs and return 196 ldmfd sp!, {r0-r12, pc} @ restore regs and return
197restore_es3:
198 /*b restore_es3*/ @ Enable to debug restore code
199 ldr r5, pm_prepwstst_core_p
200 ldr r4, [r5]
201 and r4, r4, #0x3
202 cmp r4, #0x0 @ Check if previous power state of CORE is OFF
203 bne restore
204 adr r0, es3_sdrc_fix
205 ldr r1, sram_base
206 ldr r2, es3_sdrc_fix_sz
207 mov r2, r2, ror #2
208copy_to_sram:
209 ldmia r0!, {r3} @ val = *src
210 stmia r1!, {r3} @ *dst = val
211 subs r2, r2, #0x1 @ num_words--
212 bne copy_to_sram
213 ldr r1, sram_base
214 blx r1
98restore: 215restore:
99 /* b restore*/ @ Enable to debug restore code 216 /* b restore*/ @ Enable to debug restore code
100 /* Check what was the reason for mpu reset and store the reason in r9*/ 217 /* Check what was the reason for mpu reset and store the reason in r9*/
101 /* 1 - Only L1 and logic lost */ 218 /* 1 - Only L1 and logic lost */
102 /* 2 - Only L2 lost - In this case, we wont be here */ 219 /* 2 - Only L2 lost - In this case, we wont be here */
@@ -108,9 +225,44 @@ restore:
108 moveq r9, #0x3 @ MPU OFF => L1 and L2 lost 225 moveq r9, #0x3 @ MPU OFF => L1 and L2 lost
109 movne r9, #0x1 @ Only L1 and L2 lost => avoid L2 invalidation 226 movne r9, #0x1 @ Only L1 and L2 lost => avoid L2 invalidation
110 bne logic_l1_restore 227 bne logic_l1_restore
228 ldr r0, control_stat
229 ldr r1, [r0]
230 and r1, #0x700
231 cmp r1, #0x300
232 beq l2_inv_gp
233 mov r0, #40 @ set service ID for PPA
234 mov r12, r0 @ copy secure Service ID in r12
235 mov r1, #0 @ set task id for ROM code in r1
236 mov r2, #4 @ set some flags in r2, r6
237 mov r6, #0xff
238 adr r3, l2_inv_api_params @ r3 points to dummy parameters
239 mcr p15, 0, r0, c7, c10, 4 @ data write barrier
240 mcr p15, 0, r0, c7, c10, 5 @ data memory barrier
241 .word 0xE1600071 @ call SMI monitor (smi #1)
242 /* Write to Aux control register to set some bits */
243 mov r0, #42 @ set service ID for PPA
244 mov r12, r0 @ copy secure Service ID in r12
245 mov r1, #0 @ set task id for ROM code in r1
246 mov r2, #4 @ set some flags in r2, r6
247 mov r6, #0xff
248 adr r3, write_aux_control_params @ r3 points to parameters
249 mcr p15, 0, r0, c7, c10, 4 @ data write barrier
250 mcr p15, 0, r0, c7, c10, 5 @ data memory barrier
251 .word 0xE1600071 @ call SMI monitor (smi #1)
252
253 b logic_l1_restore
254l2_inv_api_params:
255 .word 0x1, 0x00
256write_aux_control_params:
257 .word 0x1, 0x72
258l2_inv_gp:
111 /* Execute smi to invalidate L2 cache */ 259 /* Execute smi to invalidate L2 cache */
112 mov r12, #0x1 @ set up to invalide L2 260 mov r12, #0x1 @ set up to invalide L2
113smi: .word 0xE1600070 @ Call SMI monitor (smieq) 261smi: .word 0xE1600070 @ Call SMI monitor (smieq)
262 /* Write to Aux control register to set some bits */
263 mov r0, #0x72
264 mov r12, #0x3
265 .word 0xE1600070 @ Call SMI monitor (smieq)
114logic_l1_restore: 266logic_l1_restore:
115 mov r1, #0 267 mov r1, #0
116 /* Invalidate all instruction caches to PoU 268 /* Invalidate all instruction caches to PoU
@@ -391,33 +543,55 @@ skip_l2_inval:
391 nop 543 nop
392 nop 544 nop
393 nop 545 nop
394 bl i_dll_wait 546 bl wait_sdrc_ok
395 /* restore regs and return */ 547 /* restore regs and return */
396 ldmfd sp!, {r0-r12, pc} 548 ldmfd sp!, {r0-r12, pc}
397 549
398i_dll_wait: 550/* Make sure SDRC accesses are ok */
399 ldr r4, clk_stabilize_delay 551wait_sdrc_ok:
552 ldr r4, cm_idlest1_core
553 ldr r5, [r4]
554 and r5, r5, #0x2
555 cmp r5, #0
556 bne wait_sdrc_ok
557 ldr r4, sdrc_power
558 ldr r5, [r4]
559 bic r5, r5, #0x40
560 str r5, [r4]
561wait_dll_lock:
562 /* Is dll in lock mode? */
563 ldr r4, sdrc_dlla_ctrl
564 ldr r5, [r4]
565 tst r5, #0x4
566 bxne lr
567 /* wait till dll locks */
568 ldr r4, sdrc_dlla_status
569 ldr r5, [r4]
570 and r5, r5, #0x4
571 cmp r5, #0x4
572 bne wait_dll_lock
573 bx lr
400 574
401i_dll_delay: 575cm_idlest1_core:
402 subs r4, r4, #0x1 576 .word CM_IDLEST1_CORE_V
403 bne i_dll_delay 577sdrc_dlla_status:
404 ldr r4, sdrc_power 578 .word SDRC_DLLA_STATUS_V
405 ldr r5, [r4] 579sdrc_dlla_ctrl:
406 bic r5, r5, #0x40 580 .word SDRC_DLLA_CTRL_V
407 str r5, [r4]
408 bx lr
409pm_prepwstst_core: 581pm_prepwstst_core:
410 .word PM_PREPWSTST_CORE_V 582 .word PM_PREPWSTST_CORE_V
583pm_prepwstst_core_p:
584 .word PM_PREPWSTST_CORE_P
411pm_prepwstst_mpu: 585pm_prepwstst_mpu:
412 .word PM_PREPWSTST_MPU_V 586 .word PM_PREPWSTST_MPU_V
413pm_pwstctrl_mpu: 587pm_pwstctrl_mpu:
414 .word PM_PWSTCTRL_MPU_P 588 .word PM_PWSTCTRL_MPU_P
415scratchpad_base: 589scratchpad_base:
416 .word SCRATCHPAD_BASE_P 590 .word SCRATCHPAD_BASE_P
591sram_base:
592 .word SRAM_BASE_P + 0x8000
417sdrc_power: 593sdrc_power:
418 .word SDRC_POWER_V 594 .word SDRC_POWER_V
419context_mem:
420 .word 0x803E3E14
421clk_stabilize_delay: 595clk_stabilize_delay:
422 .word 0x000001FF 596 .word 0x000001FF
423assoc_mask: 597assoc_mask:
@@ -432,5 +606,7 @@ table_entry:
432 .word 0x00000C02 606 .word 0x00000C02
433cache_pred_disable_mask: 607cache_pred_disable_mask:
434 .word 0xFFFFE7FB 608 .word 0xFFFFE7FB
609control_stat:
610 .word CONTROL_STAT
435ENTRY(omap34xx_cpu_suspend_sz) 611ENTRY(omap34xx_cpu_suspend_sz)
436 .word . - omap34xx_cpu_suspend 612 .word . - omap34xx_cpu_suspend
diff --git a/arch/arm/mach-omap2/sram242x.S b/arch/arm/mach-omap2/sram242x.S
index 9b62208658bc..92e6e1a12af8 100644
--- a/arch/arm/mach-omap2/sram242x.S
+++ b/arch/arm/mach-omap2/sram242x.S
@@ -128,7 +128,7 @@ omap242x_sdi_prcm_voltctrl:
128prcm_mask_val: 128prcm_mask_val:
129 .word 0xFFFF3FFC 129 .word 0xFFFF3FFC
130omap242x_sdi_timer_32ksynct_cr: 130omap242x_sdi_timer_32ksynct_cr:
131 .word OMAP2_IO_ADDRESS(OMAP2420_32KSYNCT_BASE + 0x010) 131 .word OMAP2_L4_IO_ADDRESS(OMAP2420_32KSYNCT_BASE + 0x010)
132ENTRY(omap242x_sram_ddr_init_sz) 132ENTRY(omap242x_sram_ddr_init_sz)
133 .word . - omap242x_sram_ddr_init 133 .word . - omap242x_sram_ddr_init
134 134
@@ -224,7 +224,7 @@ omap242x_srs_prcm_voltctrl:
224ddr_prcm_mask_val: 224ddr_prcm_mask_val:
225 .word 0xFFFF3FFC 225 .word 0xFFFF3FFC
226omap242x_srs_timer_32ksynct: 226omap242x_srs_timer_32ksynct:
227 .word OMAP2_IO_ADDRESS(OMAP2420_32KSYNCT_BASE + 0x010) 227 .word OMAP2_L4_IO_ADDRESS(OMAP2420_32KSYNCT_BASE + 0x010)
228 228
229ENTRY(omap242x_sram_reprogram_sdrc_sz) 229ENTRY(omap242x_sram_reprogram_sdrc_sz)
230 .word . - omap242x_sram_reprogram_sdrc 230 .word . - omap242x_sram_reprogram_sdrc
diff --git a/arch/arm/mach-omap2/sram243x.S b/arch/arm/mach-omap2/sram243x.S
index df2cd9277c00..ab4973695c71 100644
--- a/arch/arm/mach-omap2/sram243x.S
+++ b/arch/arm/mach-omap2/sram243x.S
@@ -128,7 +128,7 @@ omap243x_sdi_prcm_voltctrl:
128prcm_mask_val: 128prcm_mask_val:
129 .word 0xFFFF3FFC 129 .word 0xFFFF3FFC
130omap243x_sdi_timer_32ksynct_cr: 130omap243x_sdi_timer_32ksynct_cr:
131 .word OMAP2_IO_ADDRESS(OMAP2430_32KSYNCT_BASE + 0x010) 131 .word OMAP2_L4_IO_ADDRESS(OMAP2430_32KSYNCT_BASE + 0x010)
132ENTRY(omap243x_sram_ddr_init_sz) 132ENTRY(omap243x_sram_ddr_init_sz)
133 .word . - omap243x_sram_ddr_init 133 .word . - omap243x_sram_ddr_init
134 134
@@ -224,7 +224,7 @@ omap243x_srs_prcm_voltctrl:
224ddr_prcm_mask_val: 224ddr_prcm_mask_val:
225 .word 0xFFFF3FFC 225 .word 0xFFFF3FFC
226omap243x_srs_timer_32ksynct: 226omap243x_srs_timer_32ksynct:
227 .word OMAP2_IO_ADDRESS(OMAP2430_32KSYNCT_BASE + 0x010) 227 .word OMAP2_L4_IO_ADDRESS(OMAP2430_32KSYNCT_BASE + 0x010)
228 228
229ENTRY(omap243x_sram_reprogram_sdrc_sz) 229ENTRY(omap243x_sram_reprogram_sdrc_sz)
230 .word . - omap243x_sram_reprogram_sdrc 230 .word . - omap243x_sram_reprogram_sdrc
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index e2338c0aebcf..cd04deaa88c5 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -37,7 +37,7 @@
37#include <linux/clockchips.h> 37#include <linux/clockchips.h>
38 38
39#include <asm/mach/time.h> 39#include <asm/mach/time.h>
40#include <mach/dmtimer.h> 40#include <plat/dmtimer.h>
41#include <asm/localtimer.h> 41#include <asm/localtimer.h>
42 42
43/* MAX_GPTIMER_ID: number of GPTIMERs on the chip */ 43/* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
@@ -47,6 +47,7 @@ static struct omap_dm_timer *gptimer;
47static struct clock_event_device clockevent_gpt; 47static struct clock_event_device clockevent_gpt;
48static u8 __initdata gptimer_id = 1; 48static u8 __initdata gptimer_id = 1;
49static u8 __initdata inited; 49static u8 __initdata inited;
50struct omap_dm_timer *gptimer_wakeup;
50 51
51static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id) 52static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id)
52{ 53{
@@ -134,6 +135,7 @@ static void __init omap2_gp_clockevent_init(void)
134 135
135 gptimer = omap_dm_timer_request_specific(gptimer_id); 136 gptimer = omap_dm_timer_request_specific(gptimer_id);
136 BUG_ON(gptimer == NULL); 137 BUG_ON(gptimer == NULL);
138 gptimer_wakeup = gptimer;
137 139
138#if defined(CONFIG_OMAP_32K_TIMER) 140#if defined(CONFIG_OMAP_32K_TIMER)
139 src = OMAP_TIMER_SRC_32_KHZ; 141 src = OMAP_TIMER_SRC_32_KHZ;
@@ -231,7 +233,8 @@ static void __init omap2_gp_clocksource_init(void)
231static void __init omap2_gp_timer_init(void) 233static void __init omap2_gp_timer_init(void)
232{ 234{
233#ifdef CONFIG_LOCAL_TIMERS 235#ifdef CONFIG_LOCAL_TIMERS
234 twd_base = OMAP2_IO_ADDRESS(OMAP44XX_LOCAL_TWD_BASE); 236 twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_256);
237 BUG_ON(!twd_base);
235#endif 238#endif
236 omap_dm_timer_init(); 239 omap_dm_timer_init();
237 240
diff --git a/arch/arm/mach-omap2/usb-ehci.c b/arch/arm/mach-omap2/usb-ehci.c
new file mode 100644
index 000000000000..e448abd5ec5d
--- /dev/null
+++ b/arch/arm/mach-omap2/usb-ehci.c
@@ -0,0 +1,192 @@
1/*
2 * linux/arch/arm/mach-omap2/usb-ehci.c
3 *
4 * This file will contain the board specific details for the
5 * Synopsys EHCI host controller on OMAP3430
6 *
7 * Copyright (C) 2007 Texas Instruments
8 * Author: Vikram Pandita <vikram.pandita@ti.com>
9 *
10 * Generalization by:
11 * Felipe Balbi <felipe.balbi@nokia.com>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17
18#include <linux/types.h>
19#include <linux/errno.h>
20#include <linux/delay.h>
21#include <linux/platform_device.h>
22#include <linux/clk.h>
23#include <asm/io.h>
24#include <plat/mux.h>
25
26#include <mach/hardware.h>
27#include <mach/irqs.h>
28#include <plat/usb.h>
29
30#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
31
32static struct resource ehci_resources[] = {
33 {
34 .start = OMAP34XX_EHCI_BASE,
35 .end = OMAP34XX_EHCI_BASE + SZ_1K - 1,
36 .flags = IORESOURCE_MEM,
37 },
38 {
39 .start = OMAP34XX_UHH_CONFIG_BASE,
40 .end = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1,
41 .flags = IORESOURCE_MEM,
42 },
43 {
44 .start = OMAP34XX_USBTLL_BASE,
45 .end = OMAP34XX_USBTLL_BASE + SZ_4K - 1,
46 .flags = IORESOURCE_MEM,
47 },
48 { /* general IRQ */
49 .start = INT_34XX_EHCI_IRQ,
50 .flags = IORESOURCE_IRQ,
51 }
52};
53
54static u64 ehci_dmamask = ~(u32)0;
55static struct platform_device ehci_device = {
56 .name = "ehci-omap",
57 .id = 0,
58 .dev = {
59 .dma_mask = &ehci_dmamask,
60 .coherent_dma_mask = 0xffffffff,
61 .platform_data = NULL,
62 },
63 .num_resources = ARRAY_SIZE(ehci_resources),
64 .resource = ehci_resources,
65};
66
67/* MUX settings for EHCI pins */
68/*
69 * setup_ehci_io_mux - initialize IO pad mux for USBHOST
70 */
71static void setup_ehci_io_mux(enum ehci_hcd_omap_mode *port_mode)
72{
73 switch (port_mode[0]) {
74 case EHCI_HCD_OMAP_MODE_PHY:
75 omap_cfg_reg(Y9_3430_USB1HS_PHY_STP);
76 omap_cfg_reg(Y8_3430_USB1HS_PHY_CLK);
77 omap_cfg_reg(AA14_3430_USB1HS_PHY_DIR);
78 omap_cfg_reg(AA11_3430_USB1HS_PHY_NXT);
79 omap_cfg_reg(W13_3430_USB1HS_PHY_DATA0);
80 omap_cfg_reg(W12_3430_USB1HS_PHY_DATA1);
81 omap_cfg_reg(W11_3430_USB1HS_PHY_DATA2);
82 omap_cfg_reg(Y11_3430_USB1HS_PHY_DATA3);
83 omap_cfg_reg(W9_3430_USB1HS_PHY_DATA4);
84 omap_cfg_reg(Y12_3430_USB1HS_PHY_DATA5);
85 omap_cfg_reg(W8_3430_USB1HS_PHY_DATA6);
86 omap_cfg_reg(Y13_3430_USB1HS_PHY_DATA7);
87 break;
88 case EHCI_HCD_OMAP_MODE_TLL:
89 omap_cfg_reg(Y9_3430_USB1HS_TLL_STP);
90 omap_cfg_reg(Y8_3430_USB1HS_TLL_CLK);
91 omap_cfg_reg(AA14_3430_USB1HS_TLL_DIR);
92 omap_cfg_reg(AA11_3430_USB1HS_TLL_NXT);
93 omap_cfg_reg(W13_3430_USB1HS_TLL_DATA0);
94 omap_cfg_reg(W12_3430_USB1HS_TLL_DATA1);
95 omap_cfg_reg(W11_3430_USB1HS_TLL_DATA2);
96 omap_cfg_reg(Y11_3430_USB1HS_TLL_DATA3);
97 omap_cfg_reg(W9_3430_USB1HS_TLL_DATA4);
98 omap_cfg_reg(Y12_3430_USB1HS_TLL_DATA5);
99 omap_cfg_reg(W8_3430_USB1HS_TLL_DATA6);
100 omap_cfg_reg(Y13_3430_USB1HS_TLL_DATA7);
101 break;
102 case EHCI_HCD_OMAP_MODE_UNKNOWN:
103 /* FALLTHROUGH */
104 default:
105 break;
106 }
107
108 switch (port_mode[1]) {
109 case EHCI_HCD_OMAP_MODE_PHY:
110 omap_cfg_reg(AA10_3430_USB2HS_PHY_STP);
111 omap_cfg_reg(AA8_3430_USB2HS_PHY_CLK);
112 omap_cfg_reg(AA9_3430_USB2HS_PHY_DIR);
113 omap_cfg_reg(AB11_3430_USB2HS_PHY_NXT);
114 omap_cfg_reg(AB10_3430_USB2HS_PHY_DATA0);
115 omap_cfg_reg(AB9_3430_USB2HS_PHY_DATA1);
116 omap_cfg_reg(W3_3430_USB2HS_PHY_DATA2);
117 omap_cfg_reg(T4_3430_USB2HS_PHY_DATA3);
118 omap_cfg_reg(T3_3430_USB2HS_PHY_DATA4);
119 omap_cfg_reg(R3_3430_USB2HS_PHY_DATA5);
120 omap_cfg_reg(R4_3430_USB2HS_PHY_DATA6);
121 omap_cfg_reg(T2_3430_USB2HS_PHY_DATA7);
122 break;
123 case EHCI_HCD_OMAP_MODE_TLL:
124 omap_cfg_reg(AA10_3430_USB2HS_TLL_STP);
125 omap_cfg_reg(AA8_3430_USB2HS_TLL_CLK);
126 omap_cfg_reg(AA9_3430_USB2HS_TLL_DIR);
127 omap_cfg_reg(AB11_3430_USB2HS_TLL_NXT);
128 omap_cfg_reg(AB10_3430_USB2HS_TLL_DATA0);
129 omap_cfg_reg(AB9_3430_USB2HS_TLL_DATA1);
130 omap_cfg_reg(W3_3430_USB2HS_TLL_DATA2);
131 omap_cfg_reg(T4_3430_USB2HS_TLL_DATA3);
132 omap_cfg_reg(T3_3430_USB2HS_TLL_DATA4);
133 omap_cfg_reg(R3_3430_USB2HS_TLL_DATA5);
134 omap_cfg_reg(R4_3430_USB2HS_TLL_DATA6);
135 omap_cfg_reg(T2_3430_USB2HS_TLL_DATA7);
136 break;
137 case EHCI_HCD_OMAP_MODE_UNKNOWN:
138 /* FALLTHROUGH */
139 default:
140 break;
141 }
142
143 switch (port_mode[2]) {
144 case EHCI_HCD_OMAP_MODE_PHY:
145 printk(KERN_WARNING "Port3 can't be used in PHY mode\n");
146 break;
147 case EHCI_HCD_OMAP_MODE_TLL:
148 omap_cfg_reg(AB3_3430_USB3HS_TLL_STP);
149 omap_cfg_reg(AA6_3430_USB3HS_TLL_CLK);
150 omap_cfg_reg(AA3_3430_USB3HS_TLL_DIR);
151 omap_cfg_reg(Y3_3430_USB3HS_TLL_NXT);
152 omap_cfg_reg(AA5_3430_USB3HS_TLL_DATA0);
153 omap_cfg_reg(Y4_3430_USB3HS_TLL_DATA1);
154 omap_cfg_reg(Y5_3430_USB3HS_TLL_DATA2);
155 omap_cfg_reg(W5_3430_USB3HS_TLL_DATA3);
156 omap_cfg_reg(AB12_3430_USB3HS_TLL_DATA4);
157 omap_cfg_reg(AB13_3430_USB3HS_TLL_DATA5);
158 omap_cfg_reg(AA13_3430_USB3HS_TLL_DATA6);
159 omap_cfg_reg(AA12_3430_USB3HS_TLL_DATA7);
160 break;
161 case EHCI_HCD_OMAP_MODE_UNKNOWN:
162 /* FALLTHROUGH */
163 default:
164 break;
165 }
166
167 return;
168}
169
170void __init usb_ehci_init(struct ehci_hcd_omap_platform_data *pdata)
171{
172 platform_device_add_data(&ehci_device, pdata, sizeof(*pdata));
173
174 /* Setup Pin IO MUX for EHCI */
175 if (cpu_is_omap34xx())
176 setup_ehci_io_mux(pdata->port_mode);
177
178 if (platform_device_register(&ehci_device) < 0) {
179 printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n");
180 return;
181 }
182}
183
184#else
185
186void __init usb_ehci_init(struct ehci_hcd_omap_platform_data *pdata)
187
188{
189}
190
191#endif /* CONFIG_USB_EHCI_HCD */
192
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index 1145a2562b0f..a80441dd19b8 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -28,8 +28,8 @@
28 28
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/irqs.h> 30#include <mach/irqs.h>
31#include <mach/mux.h> 31#include <plat/mux.h>
32#include <mach/usb.h> 32#include <plat/usb.h>
33 33
34#ifdef CONFIG_USB_MUSB_SOC 34#ifdef CONFIG_USB_MUSB_SOC
35 35
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
index 8622c24cd270..10a2013c1104 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -16,8 +16,8 @@
16 16
17#include <linux/usb/musb.h> 17#include <linux/usb/musb.h>
18 18
19#include <mach/gpmc.h> 19#include <plat/gpmc.h>
20#include <mach/mux.h> 20#include <plat/mux.h>
21 21
22 22
23static u8 async_cs, sync_cs; 23static u8 async_cs, sync_cs;