aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/boot/compressed/Makefile2
-rw-r--r--arch/arm/boot/compressed/head.S35
-rw-r--r--arch/arm/boot/compressed/vmlinux.lds.in1
-rw-r--r--arch/arm/configs/omap2plus_defconfig83
-rw-r--r--arch/arm/include/asm/system.h2
-rw-r--r--arch/arm/kernel/signal.c90
-rw-r--r--arch/arm/mach-omap2/Kconfig1
-rw-r--r--arch/arm/mach-omap2/Makefile4
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c27
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c132
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c114
-rw-r--r--arch/arm/mach-omap2/board-am3517crane.c10
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c54
-rw-r--r--arch/arm/mach-omap2/board-apollon.c29
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c236
-rw-r--r--arch/arm/mach-omap2/board-cm-t3517.c9
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c131
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c449
-rw-r--r--arch/arm/mach-omap2/board-igep0030.c458
-rw-r--r--arch/arm/mach-omap2/board-ldp.c138
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c28
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c194
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c242
-rw-r--r--arch/arm/mach-omap2/board-omap3logic.c14
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c90
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c133
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c121
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c79
-rw-r--r--arch/arm/mach-omap2/board-overo.c265
-rw-r--r--arch/arm/mach-omap2/board-rm680.c21
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c42
-rw-r--r--arch/arm/mach-omap2/board-rx51-video.c5
-rw-r--r--arch/arm/mach-omap2/board-zoom-debugboard.c65
-rw-r--r--arch/arm/mach-omap2/board-zoom-display.c31
-rw-r--r--arch/arm/mach-omap2/board-zoom-peripherals.c29
-rw-r--r--arch/arm/mach-omap2/clkt34xx_dpll3m2.c1
-rw-r--r--arch/arm/mach-omap2/common-board-devices.c163
-rw-r--r--arch/arm/mach-omap2/common-board-devices.h35
-rw-r--r--arch/arm/mach-omap2/gpmc-smc91x.c11
-rw-r--r--arch/arm/mach-omap2/gpmc-smsc911x.c44
-rw-r--r--arch/arm/mach-omap2/irq.c97
-rw-r--r--arch/arm/mach-omap2/omap_l3_noc.c51
-rw-r--r--arch/arm/mach-omap2/omap_l3_smx.c42
-rw-r--r--arch/arm/mach-omap2/pm44xx.c2
-rw-r--r--arch/arm/mach-omap2/smartreflex.c23
-rw-r--r--arch/arm/mach-omap2/usb-musb.c14
-rw-r--r--arch/arm/mach-omap2/usb-tusb6010.c3
-rw-r--r--arch/arm/mach-omap2/voltage.c1
-rw-r--r--arch/arm/mach-realview/include/mach/barriers.h2
-rw-r--r--arch/arm/mach-tegra/include/mach/barriers.h2
-rw-r--r--arch/arm/mm/init.c16
-rw-r--r--arch/arm/plat-omap/include/plat/gpmc-smsc911x.h4
-rw-r--r--arch/arm/plat-omap/include/plat/uncompress.h1
-rw-r--r--arch/arm/plat-omap/iommu.c2
-rw-r--r--arch/mips/Kconfig5
-rw-r--r--arch/mips/alchemy/devboards/db1x00/board_setup.c61
-rw-r--r--arch/mips/alchemy/xxs1500/init.c5
-rw-r--r--arch/mips/boot/compressed/calc_vmlinuz_load_addr.c2
-rw-r--r--arch/mips/cavium-octeon/Kconfig15
-rw-r--r--arch/mips/include/asm/cache.h2
-rw-r--r--arch/mips/include/asm/cevt-r4k.h3
-rw-r--r--arch/mips/include/asm/hugetlb.h1
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h2
-rw-r--r--arch/mips/jazz/jazzdma.c5
-rw-r--r--arch/mips/jz4740/dma.c4
-rw-r--r--arch/mips/jz4740/time.c2
-rw-r--r--arch/mips/jz4740/timer.c2
-rw-r--r--arch/mips/kernel/ftrace.c5
-rw-r--r--arch/mips/kernel/ptrace.c4
-rw-r--r--arch/mips/kernel/scall32-o32.S2
-rw-r--r--arch/mips/kernel/scall64-64.S2
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S2
-rw-r--r--arch/mips/kernel/vmlinux.lds.S1
-rw-r--r--arch/mips/loongson/common/env.c5
-rw-r--r--arch/mips/mm/c-r4k.c2
-rw-r--r--arch/mips/mm/tlbex.c4
-rw-r--r--arch/mips/mti-malta/malta-init.c14
-rw-r--r--arch/mips/mti-malta/malta-int.c3
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_irq_per.c2
-rw-r--r--arch/mips/power/hibernate.S2
-rw-r--r--arch/mips/sgi-ip22/ip22-platform.c4
-rw-r--r--arch/mips/sgi-ip22/ip22-time.c4
-rw-r--r--arch/mips/sgi-ip27/ip27-hubio.c3
-rw-r--r--arch/mips/sgi-ip27/ip27-klnuma.c3
-rw-r--r--arch/mips/sni/time.c4
-rw-r--r--arch/s390/include/asm/diag.h17
-rw-r--r--arch/s390/include/asm/mmu_context.h2
-rw-r--r--arch/s390/kernel/diag.c21
-rw-r--r--arch/s390/kernel/dis.c1
-rw-r--r--arch/s390/kernel/entry.S2
-rw-r--r--arch/s390/kernel/entry64.S2
-rw-r--r--arch/s390/mm/cmm.c2
-rw-r--r--arch/s390/oprofile/hwsampler.c14
-rw-r--r--arch/s390/oprofile/hwsampler.h4
-rw-r--r--arch/s390/oprofile/init.c8
96 files changed, 1165 insertions, 2963 deletions
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 8ebbb511c783..0c6852d93506 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -74,7 +74,7 @@ ZTEXTADDR := $(CONFIG_ZBOOT_ROM_TEXT)
74ZBSSADDR := $(CONFIG_ZBOOT_ROM_BSS) 74ZBSSADDR := $(CONFIG_ZBOOT_ROM_BSS)
75else 75else
76ZTEXTADDR := 0 76ZTEXTADDR := 0
77ZBSSADDR := ALIGN(4) 77ZBSSADDR := ALIGN(8)
78endif 78endif
79 79
80SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ 80SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index adf583cd0c35..49f5b2eaaa87 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -179,15 +179,14 @@ not_angel:
179 bl cache_on 179 bl cache_on
180 180
181restart: adr r0, LC0 181restart: adr r0, LC0
182 ldmia r0, {r1, r2, r3, r5, r6, r9, r11, r12} 182 ldmia r0, {r1, r2, r3, r6, r9, r11, r12}
183 ldr sp, [r0, #32] 183 ldr sp, [r0, #28]
184 184
185 /* 185 /*
186 * We might be running at a different address. We need 186 * We might be running at a different address. We need
187 * to fix up various pointers. 187 * to fix up various pointers.
188 */ 188 */
189 sub r0, r0, r1 @ calculate the delta offset 189 sub r0, r0, r1 @ calculate the delta offset
190 add r5, r5, r0 @ _start
191 add r6, r6, r0 @ _edata 190 add r6, r6, r0 @ _edata
192 191
193#ifndef CONFIG_ZBOOT_ROM 192#ifndef CONFIG_ZBOOT_ROM
@@ -206,31 +205,40 @@ restart: adr r0, LC0
206/* 205/*
207 * Check to see if we will overwrite ourselves. 206 * Check to see if we will overwrite ourselves.
208 * r4 = final kernel address 207 * r4 = final kernel address
209 * r5 = start of this image
210 * r9 = size of decompressed image 208 * r9 = size of decompressed image
211 * r10 = end of this image, including bss/stack/malloc space if non XIP 209 * r10 = end of this image, including bss/stack/malloc space if non XIP
212 * We basically want: 210 * We basically want:
213 * r4 >= r10 -> OK 211 * r4 - 16k page directory >= r10 -> OK
214 * r4 + image length <= r5 -> OK 212 * r4 + image length <= current position (pc) -> OK
215 */ 213 */
214 add r10, r10, #16384
216 cmp r4, r10 215 cmp r4, r10
217 bhs wont_overwrite 216 bhs wont_overwrite
218 add r10, r4, r9 217 add r10, r4, r9
219 cmp r10, r5 218 ARM( cmp r10, pc )
219 THUMB( mov lr, pc )
220 THUMB( cmp r10, lr )
220 bls wont_overwrite 221 bls wont_overwrite
221 222
222/* 223/*
223 * Relocate ourselves past the end of the decompressed kernel. 224 * Relocate ourselves past the end of the decompressed kernel.
224 * r5 = start of this image
225 * r6 = _edata 225 * r6 = _edata
226 * r10 = end of the decompressed kernel 226 * r10 = end of the decompressed kernel
227 * Because we always copy ahead, we need to do it from the end and go 227 * Because we always copy ahead, we need to do it from the end and go
228 * backward in case the source and destination overlap. 228 * backward in case the source and destination overlap.
229 */ 229 */
230 /* Round up to next 256-byte boundary. */ 230 /*
231 add r10, r10, #256 231 * Bump to the next 256-byte boundary with the size of
232 * the relocation code added. This avoids overwriting
233 * ourself when the offset is small.
234 */
235 add r10, r10, #((reloc_code_end - restart + 256) & ~255)
232 bic r10, r10, #255 236 bic r10, r10, #255
233 237
238 /* Get start of code we want to copy and align it down. */
239 adr r5, restart
240 bic r5, r5, #31
241
234 sub r9, r6, r5 @ size to copy 242 sub r9, r6, r5 @ size to copy
235 add r9, r9, #31 @ rounded up to a multiple 243 add r9, r9, #31 @ rounded up to a multiple
236 bic r9, r9, #31 @ ... of 32 bytes 244 bic r9, r9, #31 @ ... of 32 bytes
@@ -245,6 +253,11 @@ restart: adr r0, LC0
245 /* Preserve offset to relocated code. */ 253 /* Preserve offset to relocated code. */
246 sub r6, r9, r6 254 sub r6, r9, r6
247 255
256#ifndef CONFIG_ZBOOT_ROM
257 /* cache_clean_flush may use the stack, so relocate it */
258 add sp, sp, r6
259#endif
260
248 bl cache_clean_flush 261 bl cache_clean_flush
249 262
250 adr r0, BSYM(restart) 263 adr r0, BSYM(restart)
@@ -333,7 +346,6 @@ not_relocated: mov r0, #0
333LC0: .word LC0 @ r1 346LC0: .word LC0 @ r1
334 .word __bss_start @ r2 347 .word __bss_start @ r2
335 .word _end @ r3 348 .word _end @ r3
336 .word _start @ r5
337 .word _edata @ r6 349 .word _edata @ r6
338 .word _image_size @ r9 350 .word _image_size @ r9
339 .word _got_start @ r11 351 .word _got_start @ r11
@@ -1062,6 +1074,7 @@ memdump: mov r12, r0
1062#endif 1074#endif
1063 1075
1064 .ltorg 1076 .ltorg
1077reloc_code_end:
1065 1078
1066 .align 1079 .align
1067 .section ".stack", "aw", %nobits 1080 .section ".stack", "aw", %nobits
diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in
index 5309909d7282..ea80abe78844 100644
--- a/arch/arm/boot/compressed/vmlinux.lds.in
+++ b/arch/arm/boot/compressed/vmlinux.lds.in
@@ -54,6 +54,7 @@ SECTIONS
54 .bss : { *(.bss) } 54 .bss : { *(.bss) }
55 _end = .; 55 _end = .;
56 56
57 . = ALIGN(8); /* the stack must be 64-bit aligned */
57 .stack : { *(.stack) } 58 .stack : { *(.stack) }
58 59
59 .stab 0 : { *(.stab) } 60 .stab 0 : { *(.stab) }
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 076db52ff672..d5f00d7eb075 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -21,58 +21,22 @@ CONFIG_MODVERSIONS=y
21CONFIG_MODULE_SRCVERSION_ALL=y 21CONFIG_MODULE_SRCVERSION_ALL=y
22# CONFIG_BLK_DEV_BSG is not set 22# CONFIG_BLK_DEV_BSG is not set
23CONFIG_ARCH_OMAP=y 23CONFIG_ARCH_OMAP=y
24CONFIG_ARCH_OMAP2=y
25CONFIG_ARCH_OMAP3=y
26CONFIG_ARCH_OMAP4=y
27CONFIG_OMAP_RESET_CLOCKS=y 24CONFIG_OMAP_RESET_CLOCKS=y
28CONFIG_OMAP_MUX_DEBUG=y 25CONFIG_OMAP_MUX_DEBUG=y
29CONFIG_OMAP_32K_TIMER=y
30CONFIG_MACH_OMAP_GENERIC=y
31CONFIG_ARCH_OMAP2420=y
32CONFIG_ARCH_OMAP2430=y
33CONFIG_ARCH_OMAP3430=y
34CONFIG_MACH_OMAP_H4=y
35CONFIG_MACH_OMAP_APOLLON=y
36CONFIG_MACH_OMAP_2430SDP=y
37CONFIG_MACH_OMAP3_BEAGLE=y
38CONFIG_MACH_DEVKIT8000=y
39CONFIG_MACH_OMAP_LDP=y
40CONFIG_MACH_OVERO=y
41CONFIG_MACH_OMAP3EVM=y
42CONFIG_MACH_OMAP3517EVM=y
43CONFIG_MACH_OMAP3_PANDORA=y
44CONFIG_MACH_OMAP3_TOUCHBOOK=y
45CONFIG_MACH_OMAP_3430SDP=y
46CONFIG_MACH_NOKIA_N8X0=y
47CONFIG_MACH_NOKIA_RX51=y
48CONFIG_MACH_OMAP_ZOOM2=y
49CONFIG_MACH_OMAP_ZOOM3=y
50CONFIG_MACH_CM_T35=y
51CONFIG_MACH_IGEP0020=y
52CONFIG_MACH_SBC3530=y
53CONFIG_MACH_OMAP_3630SDP=y
54CONFIG_MACH_OMAP_4430SDP=y
55CONFIG_ARM_THUMBEE=y 26CONFIG_ARM_THUMBEE=y
56CONFIG_ARM_L1_CACHE_SHIFT=5
57CONFIG_ARM_ERRATA_411920=y 27CONFIG_ARM_ERRATA_411920=y
58CONFIG_NO_HZ=y 28CONFIG_NO_HZ=y
59CONFIG_HIGH_RES_TIMERS=y 29CONFIG_HIGH_RES_TIMERS=y
60CONFIG_SMP=y 30CONFIG_SMP=y
61CONFIG_NR_CPUS=2 31CONFIG_NR_CPUS=2
62# CONFIG_LOCAL_TIMERS is not set
63CONFIG_AEABI=y
64CONFIG_LEDS=y 32CONFIG_LEDS=y
65CONFIG_ZBOOT_ROM_TEXT=0x0 33CONFIG_ZBOOT_ROM_TEXT=0x0
66CONFIG_ZBOOT_ROM_BSS=0x0 34CONFIG_ZBOOT_ROM_BSS=0x0
67CONFIG_CMDLINE="root=/dev/mmcblk0p2 rootwait console=ttyO2,115200" 35CONFIG_CMDLINE="root=/dev/mmcblk0p2 rootwait console=ttyO2,115200"
68CONFIG_KEXEC=y 36CONFIG_KEXEC=y
69CONFIG_FPE_NWFPE=y 37CONFIG_FPE_NWFPE=y
70CONFIG_VFP=y
71CONFIG_NEON=y
72CONFIG_BINFMT_MISC=y 38CONFIG_BINFMT_MISC=y
73CONFIG_PM=y
74CONFIG_PM_DEBUG=y 39CONFIG_PM_DEBUG=y
75CONFIG_PM_RUNTIME=y
76CONFIG_NET=y 40CONFIG_NET=y
77CONFIG_PACKET=y 41CONFIG_PACKET=y
78CONFIG_UNIX=y 42CONFIG_UNIX=y
@@ -89,14 +53,6 @@ CONFIG_IP_PNP_RARP=y
89# CONFIG_IPV6 is not set 53# CONFIG_IPV6 is not set
90CONFIG_NETFILTER=y 54CONFIG_NETFILTER=y
91CONFIG_BT=m 55CONFIG_BT=m
92CONFIG_BT_L2CAP=m
93CONFIG_BT_SCO=m
94CONFIG_BT_RFCOMM=y
95CONFIG_BT_RFCOMM_TTY=y
96CONFIG_BT_BNEP=m
97CONFIG_BT_BNEP_MC_FILTER=y
98CONFIG_BT_BNEP_PROTO_FILTER=y
99CONFIG_BT_HIDP=m
100CONFIG_BT_HCIUART=m 56CONFIG_BT_HCIUART=m
101CONFIG_BT_HCIUART_H4=y 57CONFIG_BT_HCIUART_H4=y
102CONFIG_BT_HCIUART_BCSP=y 58CONFIG_BT_HCIUART_BCSP=y
@@ -107,11 +63,9 @@ CONFIG_CFG80211=m
107CONFIG_MAC80211=m 63CONFIG_MAC80211=m
108CONFIG_MAC80211_RC_PID=y 64CONFIG_MAC80211_RC_PID=y
109CONFIG_MAC80211_RC_DEFAULT_PID=y 65CONFIG_MAC80211_RC_DEFAULT_PID=y
110CONFIG_MAC80211_LEDS=y
111CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 66CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
112CONFIG_CONNECTOR=y 67CONFIG_CONNECTOR=y
113CONFIG_MTD=y 68CONFIG_MTD=y
114CONFIG_MTD_CONCAT=y
115CONFIG_MTD_CMDLINE_PARTS=y 69CONFIG_MTD_CMDLINE_PARTS=y
116CONFIG_MTD_CHAR=y 70CONFIG_MTD_CHAR=y
117CONFIG_MTD_BLOCK=y 71CONFIG_MTD_BLOCK=y
@@ -127,7 +81,6 @@ CONFIG_MTD_UBI=y
127CONFIG_BLK_DEV_LOOP=y 81CONFIG_BLK_DEV_LOOP=y
128CONFIG_BLK_DEV_RAM=y 82CONFIG_BLK_DEV_RAM=y
129CONFIG_BLK_DEV_RAM_SIZE=16384 83CONFIG_BLK_DEV_RAM_SIZE=16384
130CONFIG_EEPROM_LEGACY=y
131CONFIG_SCSI=y 84CONFIG_SCSI=y
132CONFIG_BLK_DEV_SD=y 85CONFIG_BLK_DEV_SD=y
133CONFIG_SCSI_MULTI_LUN=y 86CONFIG_SCSI_MULTI_LUN=y
@@ -158,19 +111,15 @@ CONFIG_TOUCHSCREEN_ADS7846=y
158CONFIG_INPUT_MISC=y 111CONFIG_INPUT_MISC=y
159CONFIG_INPUT_TWL4030_PWRBUTTON=y 112CONFIG_INPUT_TWL4030_PWRBUTTON=y
160CONFIG_VT_HW_CONSOLE_BINDING=y 113CONFIG_VT_HW_CONSOLE_BINDING=y
161CONFIG_SERIAL_8250=y 114# CONFIG_LEGACY_PTYS is not set
162CONFIG_SERIAL_8250_CONSOLE=y
163CONFIG_SERIAL_8250_NR_UARTS=32 115CONFIG_SERIAL_8250_NR_UARTS=32
164CONFIG_SERIAL_8250_EXTENDED=y 116CONFIG_SERIAL_8250_EXTENDED=y
165CONFIG_SERIAL_8250_MANY_PORTS=y 117CONFIG_SERIAL_8250_MANY_PORTS=y
166CONFIG_SERIAL_8250_SHARE_IRQ=y 118CONFIG_SERIAL_8250_SHARE_IRQ=y
167CONFIG_SERIAL_8250_DETECT_IRQ=y 119CONFIG_SERIAL_8250_DETECT_IRQ=y
168CONFIG_SERIAL_8250_RSA=y 120CONFIG_SERIAL_8250_RSA=y
169# CONFIG_LEGACY_PTYS is not set
170CONFIG_HW_RANDOM=y 121CONFIG_HW_RANDOM=y
171CONFIG_I2C=y
172CONFIG_I2C_CHARDEV=y 122CONFIG_I2C_CHARDEV=y
173CONFIG_I2C_OMAP=y
174CONFIG_SPI=y 123CONFIG_SPI=y
175CONFIG_SPI_OMAP24XX=y 124CONFIG_SPI_OMAP24XX=y
176CONFIG_DEBUG_GPIO=y 125CONFIG_DEBUG_GPIO=y
@@ -181,10 +130,6 @@ CONFIG_POWER_SUPPLY=y
181CONFIG_WATCHDOG=y 130CONFIG_WATCHDOG=y
182CONFIG_OMAP_WATCHDOG=y 131CONFIG_OMAP_WATCHDOG=y
183CONFIG_TWL4030_WATCHDOG=y 132CONFIG_TWL4030_WATCHDOG=y
184CONFIG_MENELAUS=y
185CONFIG_TWL4030_CORE=y
186CONFIG_TWL4030_POWER=y
187CONFIG_REGULATOR=y
188CONFIG_REGULATOR_TWL4030=y 133CONFIG_REGULATOR_TWL4030=y
189CONFIG_REGULATOR_TPS65023=y 134CONFIG_REGULATOR_TPS65023=y
190CONFIG_REGULATOR_TPS6507X=y 135CONFIG_REGULATOR_TPS6507X=y
@@ -208,7 +153,6 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y
208CONFIG_LCD_CLASS_DEVICE=y 153CONFIG_LCD_CLASS_DEVICE=y
209CONFIG_LCD_PLATFORM=y 154CONFIG_LCD_PLATFORM=y
210CONFIG_DISPLAY_SUPPORT=y 155CONFIG_DISPLAY_SUPPORT=y
211# CONFIG_VGA_CONSOLE is not set
212CONFIG_FRAMEBUFFER_CONSOLE=y 156CONFIG_FRAMEBUFFER_CONSOLE=y
213CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y 157CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
214CONFIG_FONTS=y 158CONFIG_FONTS=y
@@ -217,25 +161,20 @@ CONFIG_FONT_8x16=y
217CONFIG_LOGO=y 161CONFIG_LOGO=y
218CONFIG_SOUND=m 162CONFIG_SOUND=m
219CONFIG_SND=m 163CONFIG_SND=m
220CONFIG_SND_MIXER_OSS=y 164CONFIG_SND_MIXER_OSS=m
221CONFIG_SND_PCM_OSS=y 165CONFIG_SND_PCM_OSS=m
222CONFIG_SND_VERBOSE_PRINTK=y 166CONFIG_SND_VERBOSE_PRINTK=y
223CONFIG_SND_DEBUG=y 167CONFIG_SND_DEBUG=y
224CONFIG_SND_USB_AUDIO=y 168CONFIG_SND_USB_AUDIO=m
225CONFIG_SND_SOC=y 169CONFIG_SND_SOC=m
226CONFIG_SND_OMAP_SOC=y 170CONFIG_SND_OMAP_SOC=m
227CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=y 171CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m
228CONFIG_USB=y 172CONFIG_USB=y
229CONFIG_USB_DEBUG=y 173CONFIG_USB_DEBUG=y
230CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 174CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
231CONFIG_USB_DEVICEFS=y 175CONFIG_USB_DEVICEFS=y
232CONFIG_USB_SUSPEND=y 176CONFIG_USB_SUSPEND=y
233# CONFIG_USB_OTG_WHITELIST is not set
234CONFIG_USB_MON=y 177CONFIG_USB_MON=y
235# CONFIG_USB_MUSB_HDRC is not set
236# CONFIG_USB_MUSB_OTG is not set
237# CONFIG_USB_GADGET_MUSB_HDRC is not set
238CONFIG_USB_MUSB_DEBUG=y
239CONFIG_USB_WDM=y 178CONFIG_USB_WDM=y
240CONFIG_USB_STORAGE=y 179CONFIG_USB_STORAGE=y
241CONFIG_USB_LIBUSUAL=y 180CONFIG_USB_LIBUSUAL=y
@@ -250,18 +189,12 @@ CONFIG_MMC_UNSAFE_RESUME=y
250CONFIG_SDIO_UART=y 189CONFIG_SDIO_UART=y
251CONFIG_MMC_OMAP=y 190CONFIG_MMC_OMAP=y
252CONFIG_MMC_OMAP_HS=y 191CONFIG_MMC_OMAP_HS=y
253CONFIG_LEDS_CLASS=y
254CONFIG_LEDS_GPIO=y
255CONFIG_LEDS_TRIGGER_TIMER=y
256CONFIG_LEDS_TRIGGER_HEARTBEAT=y
257CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
258CONFIG_RTC_CLASS=y 192CONFIG_RTC_CLASS=y
259CONFIG_RTC_DRV_TWL92330=y 193CONFIG_RTC_DRV_TWL92330=y
260CONFIG_RTC_DRV_TWL4030=y 194CONFIG_RTC_DRV_TWL4030=y
261CONFIG_EXT2_FS=y 195CONFIG_EXT2_FS=y
262CONFIG_EXT3_FS=y 196CONFIG_EXT3_FS=y
263# CONFIG_EXT3_FS_XATTR is not set 197# CONFIG_EXT3_FS_XATTR is not set
264CONFIG_INOTIFY=y
265CONFIG_QUOTA=y 198CONFIG_QUOTA=y
266CONFIG_QFMT_V2=y 199CONFIG_QFMT_V2=y
267CONFIG_MSDOS_FS=y 200CONFIG_MSDOS_FS=y
@@ -285,12 +218,10 @@ CONFIG_NLS_CODEPAGE_437=y
285CONFIG_NLS_ISO8859_1=y 218CONFIG_NLS_ISO8859_1=y
286CONFIG_PRINTK_TIME=y 219CONFIG_PRINTK_TIME=y
287CONFIG_MAGIC_SYSRQ=y 220CONFIG_MAGIC_SYSRQ=y
288CONFIG_DEBUG_FS=y
289CONFIG_DEBUG_KERNEL=y 221CONFIG_DEBUG_KERNEL=y
290CONFIG_SCHEDSTATS=y 222CONFIG_SCHEDSTATS=y
291CONFIG_TIMER_STATS=y 223CONFIG_TIMER_STATS=y
292CONFIG_PROVE_LOCKING=y 224CONFIG_PROVE_LOCKING=y
293# CONFIG_LOCK_STAT is not set
294CONFIG_DEBUG_SPINLOCK_SLEEP=y 225CONFIG_DEBUG_SPINLOCK_SLEEP=y
295# CONFIG_DEBUG_BUGVERBOSE is not set 226# CONFIG_DEBUG_BUGVERBOSE is not set
296CONFIG_DEBUG_INFO=y 227CONFIG_DEBUG_INFO=y
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 885be097769d..832888d0c20c 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -159,7 +159,7 @@ extern unsigned int user_debug;
159#include <mach/barriers.h> 159#include <mach/barriers.h>
160#elif defined(CONFIG_ARM_DMA_MEM_BUFFERABLE) || defined(CONFIG_SMP) 160#elif defined(CONFIG_ARM_DMA_MEM_BUFFERABLE) || defined(CONFIG_SMP)
161#define mb() do { dsb(); outer_sync(); } while (0) 161#define mb() do { dsb(); outer_sync(); } while (0)
162#define rmb() dmb() 162#define rmb() dsb()
163#define wmb() mb() 163#define wmb() mb()
164#else 164#else
165#include <asm/memory.h> 165#include <asm/memory.h>
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index cb8398317644..0340224cf73c 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -597,19 +597,13 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
597 return err; 597 return err;
598} 598}
599 599
600static inline void setup_syscall_restart(struct pt_regs *regs)
601{
602 regs->ARM_r0 = regs->ARM_ORIG_r0;
603 regs->ARM_pc -= thumb_mode(regs) ? 2 : 4;
604}
605
606/* 600/*
607 * OK, we're invoking a handler 601 * OK, we're invoking a handler
608 */ 602 */
609static int 603static int
610handle_signal(unsigned long sig, struct k_sigaction *ka, 604handle_signal(unsigned long sig, struct k_sigaction *ka,
611 siginfo_t *info, sigset_t *oldset, 605 siginfo_t *info, sigset_t *oldset,
612 struct pt_regs * regs, int syscall) 606 struct pt_regs * regs)
613{ 607{
614 struct thread_info *thread = current_thread_info(); 608 struct thread_info *thread = current_thread_info();
615 struct task_struct *tsk = current; 609 struct task_struct *tsk = current;
@@ -617,26 +611,6 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
617 int ret; 611 int ret;
618 612
619 /* 613 /*
620 * If we were from a system call, check for system call restarting...
621 */
622 if (syscall) {
623 switch (regs->ARM_r0) {
624 case -ERESTART_RESTARTBLOCK:
625 case -ERESTARTNOHAND:
626 regs->ARM_r0 = -EINTR;
627 break;
628 case -ERESTARTSYS:
629 if (!(ka->sa.sa_flags & SA_RESTART)) {
630 regs->ARM_r0 = -EINTR;
631 break;
632 }
633 /* fallthrough */
634 case -ERESTARTNOINTR:
635 setup_syscall_restart(regs);
636 }
637 }
638
639 /*
640 * translate the signal 614 * translate the signal
641 */ 615 */
642 if (usig < 32 && thread->exec_domain && thread->exec_domain->signal_invmap) 616 if (usig < 32 && thread->exec_domain && thread->exec_domain->signal_invmap)
@@ -685,6 +659,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
685 */ 659 */
686static void do_signal(struct pt_regs *regs, int syscall) 660static void do_signal(struct pt_regs *regs, int syscall)
687{ 661{
662 unsigned int retval = 0, continue_addr = 0, restart_addr = 0;
688 struct k_sigaction ka; 663 struct k_sigaction ka;
689 siginfo_t info; 664 siginfo_t info;
690 int signr; 665 int signr;
@@ -698,18 +673,61 @@ static void do_signal(struct pt_regs *regs, int syscall)
698 if (!user_mode(regs)) 673 if (!user_mode(regs))
699 return; 674 return;
700 675
676 /*
677 * If we were from a system call, check for system call restarting...
678 */
679 if (syscall) {
680 continue_addr = regs->ARM_pc;
681 restart_addr = continue_addr - (thumb_mode(regs) ? 2 : 4);
682 retval = regs->ARM_r0;
683
684 /*
685 * Prepare for system call restart. We do this here so that a
686 * debugger will see the already changed PSW.
687 */
688 switch (retval) {
689 case -ERESTARTNOHAND:
690 case -ERESTARTSYS:
691 case -ERESTARTNOINTR:
692 regs->ARM_r0 = regs->ARM_ORIG_r0;
693 regs->ARM_pc = restart_addr;
694 break;
695 case -ERESTART_RESTARTBLOCK:
696 regs->ARM_r0 = -EINTR;
697 break;
698 }
699 }
700
701 if (try_to_freeze()) 701 if (try_to_freeze())
702 goto no_signal; 702 goto no_signal;
703 703
704 /*
705 * Get the signal to deliver. When running under ptrace, at this
706 * point the debugger may change all our registers ...
707 */
704 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 708 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
705 if (signr > 0) { 709 if (signr > 0) {
706 sigset_t *oldset; 710 sigset_t *oldset;
707 711
712 /*
713 * Depending on the signal settings we may need to revert the
714 * decision to restart the system call. But skip this if a
715 * debugger has chosen to restart at a different PC.
716 */
717 if (regs->ARM_pc == restart_addr) {
718 if (retval == -ERESTARTNOHAND
719 || (retval == -ERESTARTSYS
720 && !(ka.sa.sa_flags & SA_RESTART))) {
721 regs->ARM_r0 = -EINTR;
722 regs->ARM_pc = continue_addr;
723 }
724 }
725
708 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 726 if (test_thread_flag(TIF_RESTORE_SIGMASK))
709 oldset = &current->saved_sigmask; 727 oldset = &current->saved_sigmask;
710 else 728 else
711 oldset = &current->blocked; 729 oldset = &current->blocked;
712 if (handle_signal(signr, &ka, &info, oldset, regs, syscall) == 0) { 730 if (handle_signal(signr, &ka, &info, oldset, regs) == 0) {
713 /* 731 /*
714 * A signal was successfully delivered; the saved 732 * A signal was successfully delivered; the saved
715 * sigmask will have been stored in the signal frame, 733 * sigmask will have been stored in the signal frame,
@@ -723,11 +741,14 @@ static void do_signal(struct pt_regs *regs, int syscall)
723 } 741 }
724 742
725 no_signal: 743 no_signal:
726 /*
727 * No signal to deliver to the process - restart the syscall.
728 */
729 if (syscall) { 744 if (syscall) {
730 if (regs->ARM_r0 == -ERESTART_RESTARTBLOCK) { 745 /*
746 * Handle restarting a different system call. As above,
747 * if a debugger has chosen to restart at a different PC,
748 * ignore the restart.
749 */
750 if (retval == -ERESTART_RESTARTBLOCK
751 && regs->ARM_pc == continue_addr) {
731 if (thumb_mode(regs)) { 752 if (thumb_mode(regs)) {
732 regs->ARM_r7 = __NR_restart_syscall - __NR_SYSCALL_BASE; 753 regs->ARM_r7 = __NR_restart_syscall - __NR_SYSCALL_BASE;
733 regs->ARM_pc -= 2; 754 regs->ARM_pc -= 2;
@@ -750,11 +771,6 @@ static void do_signal(struct pt_regs *regs, int syscall)
750#endif 771#endif
751 } 772 }
752 } 773 }
753 if (regs->ARM_r0 == -ERESTARTNOHAND ||
754 regs->ARM_r0 == -ERESTARTSYS ||
755 regs->ARM_r0 == -ERESTARTNOINTR) {
756 setup_syscall_restart(regs);
757 }
758 774
759 /* If there's no signal to deliver, we just put the saved sigmask 775 /* If there's no signal to deliver, we just put the saved sigmask
760 * back. 776 * back.
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index b997a35830fc..19d5891c48e3 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -288,6 +288,7 @@ config MACH_IGEP0030
288 depends on ARCH_OMAP3 288 depends on ARCH_OMAP3
289 default y 289 default y
290 select OMAP_PACKAGE_CBB 290 select OMAP_PACKAGE_CBB
291 select MACH_IGEP0020
291 292
292config MACH_SBC3530 293config MACH_SBC3530
293 bool "OMAP3 SBC STALKER board" 294 bool "OMAP3 SBC STALKER board"
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 512b15204450..f082f7d65760 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -229,8 +229,6 @@ obj-$(CONFIG_MACH_CM_T35) += board-cm-t35.o \
229obj-$(CONFIG_MACH_CM_T3517) += board-cm-t3517.o 229obj-$(CONFIG_MACH_CM_T3517) += board-cm-t3517.o
230obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o \ 230obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o \
231 hsmmc.o 231 hsmmc.o
232obj-$(CONFIG_MACH_IGEP0030) += board-igep0030.o \
233 hsmmc.o
234obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \ 232obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \
235 hsmmc.o 233 hsmmc.o
236obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o \ 234obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o \
@@ -270,3 +268,5 @@ obj-$(CONFIG_ARCH_OMAP4) += hwspinlock.o
270 268
271disp-$(CONFIG_OMAP2_DSS) := display.o 269disp-$(CONFIG_OMAP2_DSS) := display.o
272obj-y += $(disp-m) $(disp-y) 270obj-y += $(disp-m) $(disp-y)
271
272obj-y += common-board-devices.o
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index 1fa6bb896f41..d54969be0a54 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -41,6 +41,7 @@
41 41
42#include "mux.h" 42#include "mux.h"
43#include "hsmmc.h" 43#include "hsmmc.h"
44#include "common-board-devices.h"
44 45
45#define SDP2430_CS0_BASE 0x04000000 46#define SDP2430_CS0_BASE 0x04000000
46#define SECONDARY_LCD_GPIO 147 47#define SECONDARY_LCD_GPIO 147
@@ -180,15 +181,6 @@ static struct twl4030_platform_data sdp2430_twldata = {
180 .vmmc1 = &sdp2430_vmmc1, 181 .vmmc1 = &sdp2430_vmmc1,
181}; 182};
182 183
183static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = {
184 {
185 I2C_BOARD_INFO("twl4030", 0x48),
186 .flags = I2C_CLIENT_WAKE,
187 .irq = INT_24XX_SYS_NIRQ,
188 .platform_data = &sdp2430_twldata,
189 },
190};
191
192static struct i2c_board_info __initdata sdp2430_i2c1_boardinfo[] = { 184static struct i2c_board_info __initdata sdp2430_i2c1_boardinfo[] = {
193 { 185 {
194 I2C_BOARD_INFO("isp1301_omap", 0x2D), 186 I2C_BOARD_INFO("isp1301_omap", 0x2D),
@@ -201,8 +193,7 @@ static int __init omap2430_i2c_init(void)
201{ 193{
202 omap_register_i2c_bus(1, 100, sdp2430_i2c1_boardinfo, 194 omap_register_i2c_bus(1, 100, sdp2430_i2c1_boardinfo,
203 ARRAY_SIZE(sdp2430_i2c1_boardinfo)); 195 ARRAY_SIZE(sdp2430_i2c1_boardinfo));
204 omap_register_i2c_bus(2, 2600, sdp2430_i2c_boardinfo, 196 omap2_pmic_init("twl4030", &sdp2430_twldata);
205 ARRAY_SIZE(sdp2430_i2c_boardinfo));
206 return 0; 197 return 0;
207} 198}
208 199
@@ -217,11 +208,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = {
217 {} /* Terminator */ 208 {} /* Terminator */
218}; 209};
219 210
220static struct omap_musb_board_data musb_board_data = {
221 .interface_type = MUSB_INTERFACE_ULPI,
222 .mode = MUSB_OTG,
223 .power = 100,
224};
225static struct omap_usb_config sdp2430_usb_config __initdata = { 211static struct omap_usb_config sdp2430_usb_config __initdata = {
226 .otg = 1, 212 .otg = 1,
227#ifdef CONFIG_USB_GADGET_OMAP 213#ifdef CONFIG_USB_GADGET_OMAP
@@ -240,8 +226,6 @@ static struct omap_board_mux board_mux[] __initdata = {
240 226
241static void __init omap_2430sdp_init(void) 227static void __init omap_2430sdp_init(void)
242{ 228{
243 int ret;
244
245 omap2430_mux_init(board_mux, OMAP_PACKAGE_ZAC); 229 omap2430_mux_init(board_mux, OMAP_PACKAGE_ZAC);
246 230
247 omap_board_config = sdp2430_config; 231 omap_board_config = sdp2430_config;
@@ -255,14 +239,13 @@ static void __init omap_2430sdp_init(void)
255 omap2_usbfs_init(&sdp2430_usb_config); 239 omap2_usbfs_init(&sdp2430_usb_config);
256 240
257 omap_mux_init_signal("usb0hs_stp", OMAP_PULL_ENA | OMAP_PULL_UP); 241 omap_mux_init_signal("usb0hs_stp", OMAP_PULL_ENA | OMAP_PULL_UP);
258 usb_musb_init(&musb_board_data); 242 usb_musb_init(NULL);
259 243
260 board_smc91x_init(); 244 board_smc91x_init();
261 245
262 /* Turn off secondary LCD backlight */ 246 /* Turn off secondary LCD backlight */
263 ret = gpio_request(SECONDARY_LCD_GPIO, "Secondary LCD backlight"); 247 gpio_request_one(SECONDARY_LCD_GPIO, GPIOF_OUT_INIT_LOW,
264 if (ret == 0) 248 "Secondary LCD backlight");
265 gpio_direction_output(SECONDARY_LCD_GPIO, 0);
266} 249}
267 250
268static void __init omap_2430sdp_map_io(void) 251static void __init omap_2430sdp_map_io(void)
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 9afd087cc29c..99218a5299ca 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -19,7 +19,6 @@
19#include <linux/input.h> 19#include <linux/input.h>
20#include <linux/input/matrix_keypad.h> 20#include <linux/input/matrix_keypad.h>
21#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
22#include <linux/spi/ads7846.h>
23#include <linux/i2c/twl.h> 22#include <linux/i2c/twl.h>
24#include <linux/regulator/machine.h> 23#include <linux/regulator/machine.h>
25#include <linux/io.h> 24#include <linux/io.h>
@@ -48,6 +47,7 @@
48#include "hsmmc.h" 47#include "hsmmc.h"
49#include "pm.h" 48#include "pm.h"
50#include "control.h" 49#include "control.h"
50#include "common-board-devices.h"
51 51
52#define CONFIG_DISABLE_HFCLK 1 52#define CONFIG_DISABLE_HFCLK 1
53 53
@@ -123,63 +123,14 @@ static struct twl4030_keypad_data sdp3430_kp_data = {
123 .rep = 1, 123 .rep = 1,
124}; 124};
125 125
126static int ts_gpio; /* Needed for ads7846_get_pendown_state */
127
128/**
129 * @brief ads7846_dev_init : Requests & sets GPIO line for pen-irq
130 *
131 * @return - void. If request gpio fails then Flag KERN_ERR.
132 */
133static void ads7846_dev_init(void)
134{
135 if (gpio_request(ts_gpio, "ADS7846 pendown") < 0) {
136 printk(KERN_ERR "can't get ads746 pen down GPIO\n");
137 return;
138 }
139
140 gpio_direction_input(ts_gpio);
141 gpio_set_debounce(ts_gpio, 310);
142}
143
144static int ads7846_get_pendown_state(void)
145{
146 return !gpio_get_value(ts_gpio);
147}
148
149static struct ads7846_platform_data tsc2046_config __initdata = {
150 .get_pendown_state = ads7846_get_pendown_state,
151 .keep_vref_on = 1,
152 .wakeup = true,
153};
154
155
156static struct omap2_mcspi_device_config tsc2046_mcspi_config = {
157 .turbo_mode = 0,
158 .single_channel = 1, /* 0: slave, 1: master */
159};
160
161static struct spi_board_info sdp3430_spi_board_info[] __initdata = {
162 [0] = {
163 /*
164 * TSC2046 operates at a max freqency of 2MHz, so
165 * operate slightly below at 1.5MHz
166 */
167 .modalias = "ads7846",
168 .bus_num = 1,
169 .chip_select = 0,
170 .max_speed_hz = 1500000,
171 .controller_data = &tsc2046_mcspi_config,
172 .irq = 0,
173 .platform_data = &tsc2046_config,
174 },
175};
176
177
178#define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8 126#define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8
179#define SDP3430_LCD_PANEL_ENABLE_GPIO 5 127#define SDP3430_LCD_PANEL_ENABLE_GPIO 5
180 128
181static unsigned backlight_gpio; 129static struct gpio sdp3430_dss_gpios[] __initdata = {
182static unsigned enable_gpio; 130 {SDP3430_LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, "LCD reset" },
131 {SDP3430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "LCD Backlight"},
132};
133
183static int lcd_enabled; 134static int lcd_enabled;
184static int dvi_enabled; 135static int dvi_enabled;
185 136
@@ -187,29 +138,11 @@ static void __init sdp3430_display_init(void)
187{ 138{
188 int r; 139 int r;
189 140
190 enable_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO; 141 r = gpio_request_array(sdp3430_dss_gpios,
191 backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO; 142 ARRAY_SIZE(sdp3430_dss_gpios));
192 143 if (r)
193 r = gpio_request(enable_gpio, "LCD reset"); 144 printk(KERN_ERR "failed to get LCD control GPIOs\n");
194 if (r) {
195 printk(KERN_ERR "failed to get LCD reset GPIO\n");
196 goto err0;
197 }
198
199 r = gpio_request(backlight_gpio, "LCD Backlight");
200 if (r) {
201 printk(KERN_ERR "failed to get LCD backlight GPIO\n");
202 goto err1;
203 }
204 145
205 gpio_direction_output(enable_gpio, 0);
206 gpio_direction_output(backlight_gpio, 0);
207
208 return;
209err1:
210 gpio_free(enable_gpio);
211err0:
212 return;
213} 146}
214 147
215static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) 148static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev)
@@ -219,8 +152,8 @@ static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev)
219 return -EINVAL; 152 return -EINVAL;
220 } 153 }
221 154
222 gpio_direction_output(enable_gpio, 1); 155 gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 1);
223 gpio_direction_output(backlight_gpio, 1); 156 gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 1);
224 157
225 lcd_enabled = 1; 158 lcd_enabled = 1;
226 159
@@ -231,8 +164,8 @@ static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev)
231{ 164{
232 lcd_enabled = 0; 165 lcd_enabled = 0;
233 166
234 gpio_direction_output(enable_gpio, 0); 167 gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 0);
235 gpio_direction_output(backlight_gpio, 0); 168 gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 0);
236} 169}
237 170
238static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev) 171static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev)
@@ -360,12 +293,10 @@ static int sdp3430_twl_gpio_setup(struct device *dev,
360 omap2_hsmmc_init(mmc); 293 omap2_hsmmc_init(mmc);
361 294
362 /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */ 295 /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
363 gpio_request(gpio + 7, "sub_lcd_en_bkl"); 296 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "sub_lcd_en_bkl");
364 gpio_direction_output(gpio + 7, 0);
365 297
366 /* gpio + 15 is "sub_lcd_nRST" (output) */ 298 /* gpio + 15 is "sub_lcd_nRST" (output) */
367 gpio_request(gpio + 15, "sub_lcd_nRST"); 299 gpio_request_one(gpio + 15, GPIOF_OUT_INIT_LOW, "sub_lcd_nRST");
368 gpio_direction_output(gpio + 15, 0);
369 300
370 return 0; 301 return 0;
371} 302}
@@ -580,20 +511,10 @@ static struct twl4030_platform_data sdp3430_twldata = {
580 .vpll2 = &sdp3430_vpll2, 511 .vpll2 = &sdp3430_vpll2,
581}; 512};
582 513
583static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = {
584 {
585 I2C_BOARD_INFO("twl4030", 0x48),
586 .flags = I2C_CLIENT_WAKE,
587 .irq = INT_34XX_SYS_NIRQ,
588 .platform_data = &sdp3430_twldata,
589 },
590};
591
592static int __init omap3430_i2c_init(void) 514static int __init omap3430_i2c_init(void)
593{ 515{
594 /* i2c1 for PMIC only */ 516 /* i2c1 for PMIC only */
595 omap_register_i2c_bus(1, 2600, sdp3430_i2c_boardinfo, 517 omap3_pmic_init("twl4030", &sdp3430_twldata);
596 ARRAY_SIZE(sdp3430_i2c_boardinfo));
597 /* i2c2 on camera connector (for sensor control) and optional isp1301 */ 518 /* i2c2 on camera connector (for sensor control) and optional isp1301 */
598 omap_register_i2c_bus(2, 400, NULL, 0); 519 omap_register_i2c_bus(2, 400, NULL, 0);
599 /* i2c3 on display connector (for DVI, tfp410) */ 520 /* i2c3 on display connector (for DVI, tfp410) */
@@ -872,14 +793,10 @@ static struct flash_partitions sdp_flash_partitions[] = {
872 }, 793 },
873}; 794};
874 795
875static struct omap_musb_board_data musb_board_data = {
876 .interface_type = MUSB_INTERFACE_ULPI,
877 .mode = MUSB_OTG,
878 .power = 100,
879};
880
881static void __init omap_3430sdp_init(void) 796static void __init omap_3430sdp_init(void)
882{ 797{
798 int gpio_pendown;
799
883 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 800 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
884 omap_board_config = sdp3430_config; 801 omap_board_config = sdp3430_config;
885 omap_board_config_size = ARRAY_SIZE(sdp3430_config); 802 omap_board_config_size = ARRAY_SIZE(sdp3430_config);
@@ -887,15 +804,12 @@ static void __init omap_3430sdp_init(void)
887 omap3430_i2c_init(); 804 omap3430_i2c_init();
888 omap_display_init(&sdp3430_dss_data); 805 omap_display_init(&sdp3430_dss_data);
889 if (omap_rev() > OMAP3430_REV_ES1_0) 806 if (omap_rev() > OMAP3430_REV_ES1_0)
890 ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV2; 807 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV2;
891 else 808 else
892 ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV1; 809 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV1;
893 sdp3430_spi_board_info[0].irq = gpio_to_irq(ts_gpio); 810 omap_ads7846_init(1, gpio_pendown, 310, NULL);
894 spi_register_board_info(sdp3430_spi_board_info,
895 ARRAY_SIZE(sdp3430_spi_board_info));
896 ads7846_dev_init();
897 board_serial_init(); 811 board_serial_init();
898 usb_musb_init(&musb_board_data); 812 usb_musb_init(NULL);
899 board_smc91x_init(); 813 board_smc91x_init();
900 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0); 814 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
901 sdp3430_display_init(); 815 sdp3430_display_init();
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 56702c5e577f..ae3153c5396d 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -42,6 +42,7 @@
42#include "hsmmc.h" 42#include "hsmmc.h"
43#include "timer-gp.h" 43#include "timer-gp.h"
44#include "control.h" 44#include "control.h"
45#include "common-board-devices.h"
45 46
46#define ETH_KS8851_IRQ 34 47#define ETH_KS8851_IRQ 34
47#define ETH_KS8851_POWER_ON 48 48#define ETH_KS8851_POWER_ON 48
@@ -251,58 +252,22 @@ static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
251 }, 252 },
252}; 253};
253 254
255static struct gpio sdp4430_eth_gpios[] __initdata = {
256 { ETH_KS8851_POWER_ON, GPIOF_OUT_INIT_HIGH, "eth_power" },
257 { ETH_KS8851_QUART, GPIOF_OUT_INIT_HIGH, "quart" },
258 { ETH_KS8851_IRQ, GPIOF_IN, "eth_irq" },
259};
260
254static int omap_ethernet_init(void) 261static int omap_ethernet_init(void)
255{ 262{
256 int status; 263 int status;
257 264
258 /* Request of GPIO lines */ 265 /* Request of GPIO lines */
266 status = gpio_request_array(sdp4430_eth_gpios,
267 ARRAY_SIZE(sdp4430_eth_gpios));
268 if (status)
269 pr_err("Cannot request ETH GPIOs\n");
259 270
260 status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
261 if (status) {
262 pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
263 return status;
264 }
265
266 status = gpio_request(ETH_KS8851_QUART, "quart");
267 if (status) {
268 pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
269 goto error1;
270 }
271
272 status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
273 if (status) {
274 pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
275 goto error2;
276 }
277
278 /* Configuration of requested GPIO lines */
279
280 status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
281 if (status) {
282 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
283 goto error3;
284 }
285
286 status = gpio_direction_output(ETH_KS8851_QUART, 1);
287 if (status) {
288 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
289 goto error3;
290 }
291
292 status = gpio_direction_input(ETH_KS8851_IRQ);
293 if (status) {
294 pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
295 goto error3;
296 }
297
298 return 0;
299
300error3:
301 gpio_free(ETH_KS8851_IRQ);
302error2:
303 gpio_free(ETH_KS8851_QUART);
304error1:
305 gpio_free(ETH_KS8851_POWER_ON);
306 return status; 271 return status;
307} 272}
308 273
@@ -575,14 +540,6 @@ static struct twl4030_platform_data sdp4430_twldata = {
575 .usb = &omap4_usbphy_data 540 .usb = &omap4_usbphy_data
576}; 541};
577 542
578static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
579 {
580 I2C_BOARD_INFO("twl6030", 0x48),
581 .flags = I2C_CLIENT_WAKE,
582 .irq = OMAP44XX_IRQ_SYS_1N,
583 .platform_data = &sdp4430_twldata,
584 },
585};
586static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = { 543static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
587 { 544 {
588 I2C_BOARD_INFO("tmp105", 0x48), 545 I2C_BOARD_INFO("tmp105", 0x48),
@@ -598,12 +555,7 @@ static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
598}; 555};
599static int __init omap4_i2c_init(void) 556static int __init omap4_i2c_init(void)
600{ 557{
601 /* 558 omap4_pmic_init("twl6030", &sdp4430_twldata);
602 * Phoenix Audio IC needs I2C1 to
603 * start with 400 KHz or less
604 */
605 omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
606 ARRAY_SIZE(sdp4430_i2c_boardinfo));
607 omap_register_i2c_bus(2, 400, NULL, 0); 559 omap_register_i2c_bus(2, 400, NULL, 0);
608 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, 560 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
609 ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); 561 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
@@ -614,21 +566,13 @@ static int __init omap4_i2c_init(void)
614 566
615static void __init omap_sfh7741prox_init(void) 567static void __init omap_sfh7741prox_init(void)
616{ 568{
617 int error; 569 int error;
618 570
619 error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741"); 571 error = gpio_request_one(OMAP4_SFH7741_ENABLE_GPIO,
620 if (error < 0) { 572 GPIOF_OUT_INIT_LOW, "sfh7741");
573 if (error < 0)
621 pr_err("%s:failed to request GPIO %d, error %d\n", 574 pr_err("%s:failed to request GPIO %d, error %d\n",
622 __func__, OMAP4_SFH7741_ENABLE_GPIO, error); 575 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
623 return;
624 }
625
626 error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0);
627 if (error < 0) {
628 pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
629 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
630 gpio_free(OMAP4_SFH7741_ENABLE_GPIO);
631 }
632} 576}
633 577
634static void sdp4430_hdmi_mux_init(void) 578static void sdp4430_hdmi_mux_init(void)
@@ -645,27 +589,19 @@ static void sdp4430_hdmi_mux_init(void)
645 OMAP_PIN_INPUT_PULLUP); 589 OMAP_PIN_INPUT_PULLUP);
646} 590}
647 591
592static struct gpio sdp4430_hdmi_gpios[] = {
593 { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" },
594 { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" },
595};
596
648static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev) 597static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
649{ 598{
650 int status; 599 int status;
651 600
652 status = gpio_request_one(HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, 601 status = gpio_request_array(sdp4430_hdmi_gpios,
653 "hdmi_gpio_hpd"); 602 ARRAY_SIZE(sdp4430_hdmi_gpios));
654 if (status) { 603 if (status)
655 pr_err("Cannot request GPIO %d\n", HDMI_GPIO_HPD); 604 pr_err("%s: Cannot request HDMI GPIOs\n", __func__);
656 return status;
657 }
658 status = gpio_request_one(HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH,
659 "hdmi_gpio_ls_oe");
660 if (status) {
661 pr_err("Cannot request GPIO %d\n", HDMI_GPIO_LS_OE);
662 goto error1;
663 }
664
665 return 0;
666
667error1:
668 gpio_free(HDMI_GPIO_HPD);
669 605
670 return status; 606 return status;
671} 607}
diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c
index a890d244fec6..5e438a77cd72 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -89,19 +89,13 @@ static void __init am3517_crane_init(void)
89 return; 89 return;
90 } 90 }
91 91
92 ret = gpio_request(GPIO_USB_POWER, "usb_ehci_enable"); 92 ret = gpio_request_one(GPIO_USB_POWER, GPIOF_OUT_INIT_HIGH,
93 "usb_ehci_enable");
93 if (ret < 0) { 94 if (ret < 0) {
94 pr_err("Can not request GPIO %d\n", GPIO_USB_POWER); 95 pr_err("Can not request GPIO %d\n", GPIO_USB_POWER);
95 return; 96 return;
96 } 97 }
97 98
98 ret = gpio_direction_output(GPIO_USB_POWER, 1);
99 if (ret < 0) {
100 gpio_free(GPIO_USB_POWER);
101 pr_err("Unable to initialize EHCI power\n");
102 return;
103 }
104
105 usbhs_init(&usbhs_bdata); 99 usbhs_init(&usbhs_bdata);
106} 100}
107 101
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index d8a04848f3c4..be44147d911a 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -174,19 +174,14 @@ static void __init am3517_evm_rtc_init(void)
174 int r; 174 int r;
175 175
176 omap_mux_init_gpio(GPIO_RTCS35390A_IRQ, OMAP_PIN_INPUT_PULLUP); 176 omap_mux_init_gpio(GPIO_RTCS35390A_IRQ, OMAP_PIN_INPUT_PULLUP);
177 r = gpio_request(GPIO_RTCS35390A_IRQ, "rtcs35390a-irq"); 177
178 r = gpio_request_one(GPIO_RTCS35390A_IRQ, GPIOF_IN, "rtcs35390a-irq");
178 if (r < 0) { 179 if (r < 0) {
179 printk(KERN_WARNING "failed to request GPIO#%d\n", 180 printk(KERN_WARNING "failed to request GPIO#%d\n",
180 GPIO_RTCS35390A_IRQ); 181 GPIO_RTCS35390A_IRQ);
181 return; 182 return;
182 } 183 }
183 r = gpio_direction_input(GPIO_RTCS35390A_IRQ); 184
184 if (r < 0) {
185 printk(KERN_WARNING "GPIO#%d cannot be configured as input\n",
186 GPIO_RTCS35390A_IRQ);
187 gpio_free(GPIO_RTCS35390A_IRQ);
188 return;
189 }
190 am3517evm_i2c1_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ); 185 am3517evm_i2c1_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ);
191} 186}
192 187
@@ -242,6 +237,15 @@ static int dvi_enabled;
242 237
243#if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ 238#if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \
244 defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE) 239 defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE)
240static struct gpio am3517_evm_dss_gpios[] __initdata = {
241 /* GPIO 182 = LCD Backlight Power */
242 { LCD_PANEL_BKLIGHT_PWR, GPIOF_OUT_INIT_HIGH, "lcd_backlight_pwr" },
243 /* GPIO 181 = LCD Panel PWM */
244 { LCD_PANEL_PWM, GPIOF_OUT_INIT_HIGH, "lcd bl enable" },
245 /* GPIO 176 = LCD Panel Power enable pin */
246 { LCD_PANEL_PWR, GPIOF_OUT_INIT_HIGH, "dvi enable" },
247};
248
245static void __init am3517_evm_display_init(void) 249static void __init am3517_evm_display_init(void)
246{ 250{
247 int r; 251 int r;
@@ -249,41 +253,15 @@ static void __init am3517_evm_display_init(void)
249 omap_mux_init_gpio(LCD_PANEL_PWR, OMAP_PIN_INPUT_PULLUP); 253 omap_mux_init_gpio(LCD_PANEL_PWR, OMAP_PIN_INPUT_PULLUP);
250 omap_mux_init_gpio(LCD_PANEL_BKLIGHT_PWR, OMAP_PIN_INPUT_PULLDOWN); 254 omap_mux_init_gpio(LCD_PANEL_BKLIGHT_PWR, OMAP_PIN_INPUT_PULLDOWN);
251 omap_mux_init_gpio(LCD_PANEL_PWM, OMAP_PIN_INPUT_PULLDOWN); 255 omap_mux_init_gpio(LCD_PANEL_PWM, OMAP_PIN_INPUT_PULLDOWN);
252 /* 256
253 * Enable GPIO 182 = LCD Backlight Power 257 r = gpio_request_array(am3517_evm_dss_gpios,
254 */ 258 ARRAY_SIZE(am3517_evm_dss_gpios));
255 r = gpio_request(LCD_PANEL_BKLIGHT_PWR, "lcd_backlight_pwr");
256 if (r) { 259 if (r) {
257 printk(KERN_ERR "failed to get lcd_backlight_pwr\n"); 260 printk(KERN_ERR "failed to get DSS panel control GPIOs\n");
258 return; 261 return;
259 } 262 }
260 gpio_direction_output(LCD_PANEL_BKLIGHT_PWR, 1);
261 /*
262 * Enable GPIO 181 = LCD Panel PWM
263 */
264 r = gpio_request(LCD_PANEL_PWM, "lcd_pwm");
265 if (r) {
266 printk(KERN_ERR "failed to get lcd_pwm\n");
267 goto err_1;
268 }
269 gpio_direction_output(LCD_PANEL_PWM, 1);
270 /*
271 * Enable GPIO 176 = LCD Panel Power enable pin
272 */
273 r = gpio_request(LCD_PANEL_PWR, "lcd_panel_pwr");
274 if (r) {
275 printk(KERN_ERR "failed to get lcd_panel_pwr\n");
276 goto err_2;
277 }
278 gpio_direction_output(LCD_PANEL_PWR, 1);
279 263
280 printk(KERN_INFO "Display initialized successfully\n"); 264 printk(KERN_INFO "Display initialized successfully\n");
281 return;
282
283err_2:
284 gpio_free(LCD_PANEL_PWM);
285err_1:
286 gpio_free(LCD_PANEL_BKLIGHT_PWR);
287} 265}
288#else 266#else
289static void __init am3517_evm_display_init(void) {} 267static void __init am3517_evm_display_init(void) {}
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index f4f8374a0298..f3beb8eeef77 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -202,6 +202,7 @@ static inline void __init apollon_init_smc91x(void)
202 unsigned int rate; 202 unsigned int rate;
203 struct clk *gpmc_fck; 203 struct clk *gpmc_fck;
204 int eth_cs; 204 int eth_cs;
205 int err;
205 206
206 gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */ 207 gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */
207 if (IS_ERR(gpmc_fck)) { 208 if (IS_ERR(gpmc_fck)) {
@@ -245,15 +246,13 @@ static inline void __init apollon_init_smc91x(void)
245 apollon_smc91x_resources[0].end = base + 0x30f; 246 apollon_smc91x_resources[0].end = base + 0x30f;
246 udelay(100); 247 udelay(100);
247 248
248 omap_mux_init_gpio(74, 0); 249 omap_mux_init_gpio(APOLLON_ETHR_GPIO_IRQ, 0);
249 if (gpio_request(APOLLON_ETHR_GPIO_IRQ, "SMC91x irq") < 0) { 250 err = gpio_request_one(APOLLON_ETHR_GPIO_IRQ, GPIOF_IN, "SMC91x irq");
251 if (err) {
250 printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", 252 printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
251 APOLLON_ETHR_GPIO_IRQ); 253 APOLLON_ETHR_GPIO_IRQ);
252 gpmc_cs_free(APOLLON_ETH_CS); 254 gpmc_cs_free(APOLLON_ETH_CS);
253 goto out;
254 } 255 }
255 gpio_direction_input(APOLLON_ETHR_GPIO_IRQ);
256
257out: 256out:
258 clk_disable(gpmc_fck); 257 clk_disable(gpmc_fck);
259 clk_put(gpmc_fck); 258 clk_put(gpmc_fck);
@@ -280,20 +279,19 @@ static void __init omap_apollon_init_early(void)
280 omap2_init_common_devices(NULL, NULL); 279 omap2_init_common_devices(NULL, NULL);
281} 280}
282 281
282static struct gpio apollon_gpio_leds[] __initdata = {
283 { LED0_GPIO13, GPIOF_OUT_INIT_LOW, "LED0" }, /* LED0 - AA10 */
284 { LED1_GPIO14, GPIOF_OUT_INIT_LOW, "LED1" }, /* LED1 - AA6 */
285 { LED2_GPIO15, GPIOF_OUT_INIT_LOW, "LED2" }, /* LED2 - AA4 */
286};
287
283static void __init apollon_led_init(void) 288static void __init apollon_led_init(void)
284{ 289{
285 /* LED0 - AA10 */
286 omap_mux_init_signal("vlynq_clk.gpio_13", 0); 290 omap_mux_init_signal("vlynq_clk.gpio_13", 0);
287 gpio_request(LED0_GPIO13, "LED0");
288 gpio_direction_output(LED0_GPIO13, 0);
289 /* LED1 - AA6 */
290 omap_mux_init_signal("vlynq_rx1.gpio_14", 0); 291 omap_mux_init_signal("vlynq_rx1.gpio_14", 0);
291 gpio_request(LED1_GPIO14, "LED1");
292 gpio_direction_output(LED1_GPIO14, 0);
293 /* LED2 - AA4 */
294 omap_mux_init_signal("vlynq_rx0.gpio_15", 0); 292 omap_mux_init_signal("vlynq_rx0.gpio_15", 0);
295 gpio_request(LED2_GPIO15, "LED2"); 293
296 gpio_direction_output(LED2_GPIO15, 0); 294 gpio_request_array(apollon_gpio_leds, ARRAY_SIZE(apollon_gpio_leds));
297} 295}
298 296
299static void __init apollon_usb_init(void) 297static void __init apollon_usb_init(void)
@@ -301,8 +299,7 @@ static void __init apollon_usb_init(void)
301 /* USB device */ 299 /* USB device */
302 /* DEVICE_SUSPEND */ 300 /* DEVICE_SUSPEND */
303 omap_mux_init_signal("mcbsp2_clkx.gpio_12", 0); 301 omap_mux_init_signal("mcbsp2_clkx.gpio_12", 0);
304 gpio_request(12, "USB suspend"); 302 gpio_request_one(12, GPIOF_OUT_INIT_LOW, "USB suspend");
305 gpio_direction_output(12, 0);
306 omap2_usbfs_init(&apollon_usb_config); 303 omap2_usbfs_init(&apollon_usb_config);
307} 304}
308 305
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 02a12b41c0ff..6063be82b563 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -54,6 +54,7 @@
54#include "mux.h" 54#include "mux.h"
55#include "sdram-micron-mt46h32m32lf-6.h" 55#include "sdram-micron-mt46h32m32lf-6.h"
56#include "hsmmc.h" 56#include "hsmmc.h"
57#include "common-board-devices.h"
57 58
58#define CM_T35_GPIO_PENDOWN 57 59#define CM_T35_GPIO_PENDOWN 57
59 60
@@ -66,86 +67,28 @@
66 67
67#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 68#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
68#include <linux/smsc911x.h> 69#include <linux/smsc911x.h>
70#include <plat/gpmc-smsc911x.h>
69 71
70static struct smsc911x_platform_config cm_t35_smsc911x_config = { 72static struct omap_smsc911x_platform_data cm_t35_smsc911x_cfg = {
71 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
72 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
73 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
74 .phy_interface = PHY_INTERFACE_MODE_MII,
75};
76
77static struct resource cm_t35_smsc911x_resources[] = {
78 {
79 .flags = IORESOURCE_MEM,
80 },
81 {
82 .start = OMAP_GPIO_IRQ(CM_T35_SMSC911X_GPIO),
83 .end = OMAP_GPIO_IRQ(CM_T35_SMSC911X_GPIO),
84 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
85 },
86};
87
88static struct platform_device cm_t35_smsc911x_device = {
89 .name = "smsc911x",
90 .id = 0, 73 .id = 0,
91 .num_resources = ARRAY_SIZE(cm_t35_smsc911x_resources), 74 .cs = CM_T35_SMSC911X_CS,
92 .resource = cm_t35_smsc911x_resources, 75 .gpio_irq = CM_T35_SMSC911X_GPIO,
93 .dev = { 76 .gpio_reset = -EINVAL,
94 .platform_data = &cm_t35_smsc911x_config, 77 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
95 },
96};
97
98static struct resource sb_t35_smsc911x_resources[] = {
99 {
100 .flags = IORESOURCE_MEM,
101 },
102 {
103 .start = OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO),
104 .end = OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO),
105 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
106 },
107}; 78};
108 79
109static struct platform_device sb_t35_smsc911x_device = { 80static struct omap_smsc911x_platform_data sb_t35_smsc911x_cfg = {
110 .name = "smsc911x",
111 .id = 1, 81 .id = 1,
112 .num_resources = ARRAY_SIZE(sb_t35_smsc911x_resources), 82 .cs = SB_T35_SMSC911X_CS,
113 .resource = sb_t35_smsc911x_resources, 83 .gpio_irq = SB_T35_SMSC911X_GPIO,
114 .dev = { 84 .gpio_reset = -EINVAL,
115 .platform_data = &cm_t35_smsc911x_config, 85 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
116 },
117}; 86};
118 87
119static void __init cm_t35_init_smsc911x(struct platform_device *dev,
120 int cs, int irq_gpio)
121{
122 unsigned long cs_mem_base;
123
124 if (gpmc_cs_request(cs, SZ_16M, &cs_mem_base) < 0) {
125 pr_err("CM-T35: Failed request for GPMC mem for smsc911x\n");
126 return;
127 }
128
129 dev->resource[0].start = cs_mem_base + 0x0;
130 dev->resource[0].end = cs_mem_base + 0xff;
131
132 if ((gpio_request(irq_gpio, "ETH IRQ") == 0) &&
133 (gpio_direction_input(irq_gpio) == 0)) {
134 gpio_export(irq_gpio, 0);
135 } else {
136 pr_err("CM-T35: could not obtain gpio for SMSC911X IRQ\n");
137 return;
138 }
139
140 platform_device_register(dev);
141}
142
143static void __init cm_t35_init_ethernet(void) 88static void __init cm_t35_init_ethernet(void)
144{ 89{
145 cm_t35_init_smsc911x(&cm_t35_smsc911x_device, 90 gpmc_smsc911x_init(&cm_t35_smsc911x_cfg);
146 CM_T35_SMSC911X_CS, CM_T35_SMSC911X_GPIO); 91 gpmc_smsc911x_init(&sb_t35_smsc911x_cfg);
147 cm_t35_init_smsc911x(&sb_t35_smsc911x_device,
148 SB_T35_SMSC911X_CS, SB_T35_SMSC911X_GPIO);
149} 92}
150#else 93#else
151static inline void __init cm_t35_init_ethernet(void) { return; } 94static inline void __init cm_t35_init_ethernet(void) { return; }
@@ -235,69 +178,10 @@ static void __init cm_t35_init_nand(void)
235static inline void cm_t35_init_nand(void) {} 178static inline void cm_t35_init_nand(void) {}
236#endif 179#endif
237 180
238#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
239 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
240#include <linux/spi/ads7846.h>
241
242static struct omap2_mcspi_device_config ads7846_mcspi_config = {
243 .turbo_mode = 0,
244 .single_channel = 1, /* 0: slave, 1: master */
245};
246
247static int ads7846_get_pendown_state(void)
248{
249 return !gpio_get_value(CM_T35_GPIO_PENDOWN);
250}
251
252static struct ads7846_platform_data ads7846_config = {
253 .x_max = 0x0fff,
254 .y_max = 0x0fff,
255 .x_plate_ohms = 180,
256 .pressure_max = 255,
257 .debounce_max = 10,
258 .debounce_tol = 3,
259 .debounce_rep = 1,
260 .get_pendown_state = ads7846_get_pendown_state,
261 .keep_vref_on = 1,
262};
263
264static struct spi_board_info cm_t35_spi_board_info[] __initdata = {
265 {
266 .modalias = "ads7846",
267 .bus_num = 1,
268 .chip_select = 0,
269 .max_speed_hz = 1500000,
270 .controller_data = &ads7846_mcspi_config,
271 .irq = OMAP_GPIO_IRQ(CM_T35_GPIO_PENDOWN),
272 .platform_data = &ads7846_config,
273 },
274};
275
276static void __init cm_t35_init_ads7846(void)
277{
278 if ((gpio_request(CM_T35_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) &&
279 (gpio_direction_input(CM_T35_GPIO_PENDOWN) == 0)) {
280 gpio_export(CM_T35_GPIO_PENDOWN, 0);
281 } else {
282 pr_err("CM-T35: could not obtain gpio for ADS7846_PENDOWN\n");
283 return;
284 }
285
286 spi_register_board_info(cm_t35_spi_board_info,
287 ARRAY_SIZE(cm_t35_spi_board_info));
288}
289#else
290static inline void cm_t35_init_ads7846(void) {}
291#endif
292
293#define CM_T35_LCD_EN_GPIO 157 181#define CM_T35_LCD_EN_GPIO 157
294#define CM_T35_LCD_BL_GPIO 58 182#define CM_T35_LCD_BL_GPIO 58
295#define CM_T35_DVI_EN_GPIO 54 183#define CM_T35_DVI_EN_GPIO 54
296 184
297static int lcd_bl_gpio;
298static int lcd_en_gpio;
299static int dvi_en_gpio;
300
301static int lcd_enabled; 185static int lcd_enabled;
302static int dvi_enabled; 186static int dvi_enabled;
303 187
@@ -308,8 +192,8 @@ static int cm_t35_panel_enable_lcd(struct omap_dss_device *dssdev)
308 return -EINVAL; 192 return -EINVAL;
309 } 193 }
310 194
311 gpio_set_value(lcd_en_gpio, 1); 195 gpio_set_value(CM_T35_LCD_EN_GPIO, 1);
312 gpio_set_value(lcd_bl_gpio, 1); 196 gpio_set_value(CM_T35_LCD_BL_GPIO, 1);
313 197
314 lcd_enabled = 1; 198 lcd_enabled = 1;
315 199
@@ -320,8 +204,8 @@ static void cm_t35_panel_disable_lcd(struct omap_dss_device *dssdev)
320{ 204{
321 lcd_enabled = 0; 205 lcd_enabled = 0;
322 206
323 gpio_set_value(lcd_bl_gpio, 0); 207 gpio_set_value(CM_T35_LCD_BL_GPIO, 0);
324 gpio_set_value(lcd_en_gpio, 0); 208 gpio_set_value(CM_T35_LCD_EN_GPIO, 0);
325} 209}
326 210
327static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev) 211static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev)
@@ -331,7 +215,7 @@ static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev)
331 return -EINVAL; 215 return -EINVAL;
332 } 216 }
333 217
334 gpio_set_value(dvi_en_gpio, 0); 218 gpio_set_value(CM_T35_DVI_EN_GPIO, 0);
335 dvi_enabled = 1; 219 dvi_enabled = 1;
336 220
337 return 0; 221 return 0;
@@ -339,7 +223,7 @@ static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev)
339 223
340static void cm_t35_panel_disable_dvi(struct omap_dss_device *dssdev) 224static void cm_t35_panel_disable_dvi(struct omap_dss_device *dssdev)
341{ 225{
342 gpio_set_value(dvi_en_gpio, 1); 226 gpio_set_value(CM_T35_DVI_EN_GPIO, 1);
343 dvi_enabled = 0; 227 dvi_enabled = 0;
344} 228}
345 229
@@ -421,62 +305,38 @@ static struct spi_board_info cm_t35_lcd_spi_board_info[] __initdata = {
421 }, 305 },
422}; 306};
423 307
308static struct gpio cm_t35_dss_gpios[] __initdata = {
309 { CM_T35_LCD_EN_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable" },
310 { CM_T35_LCD_BL_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable" },
311 { CM_T35_DVI_EN_GPIO, GPIOF_OUT_INIT_HIGH, "dvi enable" },
312};
313
424static void __init cm_t35_init_display(void) 314static void __init cm_t35_init_display(void)
425{ 315{
426 int err; 316 int err;
427 317
428 lcd_en_gpio = CM_T35_LCD_EN_GPIO;
429 lcd_bl_gpio = CM_T35_LCD_BL_GPIO;
430 dvi_en_gpio = CM_T35_DVI_EN_GPIO;
431
432 spi_register_board_info(cm_t35_lcd_spi_board_info, 318 spi_register_board_info(cm_t35_lcd_spi_board_info,
433 ARRAY_SIZE(cm_t35_lcd_spi_board_info)); 319 ARRAY_SIZE(cm_t35_lcd_spi_board_info));
434 320
435 err = gpio_request(lcd_en_gpio, "LCD RST"); 321 err = gpio_request_array(cm_t35_dss_gpios,
436 if (err) { 322 ARRAY_SIZE(cm_t35_dss_gpios));
437 pr_err("CM-T35: failed to get LCD reset GPIO\n");
438 goto out;
439 }
440
441 err = gpio_request(lcd_bl_gpio, "LCD BL");
442 if (err) { 323 if (err) {
443 pr_err("CM-T35: failed to get LCD backlight control GPIO\n"); 324 pr_err("CM-T35: failed to request DSS control GPIOs\n");
444 goto err_lcd_bl; 325 return;
445 }
446
447 err = gpio_request(dvi_en_gpio, "DVI EN");
448 if (err) {
449 pr_err("CM-T35: failed to get DVI reset GPIO\n");
450 goto err_dvi_en;
451 } 326 }
452 327
453 gpio_export(lcd_en_gpio, 0); 328 gpio_export(CM_T35_LCD_EN_GPIO, 0);
454 gpio_export(lcd_bl_gpio, 0); 329 gpio_export(CM_T35_LCD_BL_GPIO, 0);
455 gpio_export(dvi_en_gpio, 0); 330 gpio_export(CM_T35_DVI_EN_GPIO, 0);
456 gpio_direction_output(lcd_en_gpio, 0);
457 gpio_direction_output(lcd_bl_gpio, 0);
458 gpio_direction_output(dvi_en_gpio, 1);
459 331
460 msleep(50); 332 msleep(50);
461 gpio_set_value(lcd_en_gpio, 1); 333 gpio_set_value(CM_T35_LCD_EN_GPIO, 1);
462 334
463 err = omap_display_init(&cm_t35_dss_data); 335 err = omap_display_init(&cm_t35_dss_data);
464 if (err) { 336 if (err) {
465 pr_err("CM-T35: failed to register DSS device\n"); 337 pr_err("CM-T35: failed to register DSS device\n");
466 goto err_dev_reg; 338 gpio_free_array(cm_t35_dss_gpios, ARRAY_SIZE(cm_t35_dss_gpios));
467 } 339 }
468
469 return;
470
471err_dev_reg:
472 gpio_free(dvi_en_gpio);
473err_dvi_en:
474 gpio_free(lcd_bl_gpio);
475err_lcd_bl:
476 gpio_free(lcd_en_gpio);
477out:
478
479 return;
480} 340}
481 341
482static struct regulator_consumer_supply cm_t35_vmmc1_supply = { 342static struct regulator_consumer_supply cm_t35_vmmc1_supply = {
@@ -609,10 +469,8 @@ static int cm_t35_twl_gpio_setup(struct device *dev, unsigned gpio,
609{ 469{
610 int wlan_rst = gpio + 2; 470 int wlan_rst = gpio + 2;
611 471
612 if ((gpio_request(wlan_rst, "WLAN RST") == 0) && 472 if (gpio_request_one(wlan_rst, GPIOF_OUT_INIT_HIGH, "WLAN RST") == 0) {
613 (gpio_direction_output(wlan_rst, 1) == 0)) {
614 gpio_export(wlan_rst, 0); 473 gpio_export(wlan_rst, 0);
615
616 udelay(10); 474 udelay(10);
617 gpio_set_value(wlan_rst, 0); 475 gpio_set_value(wlan_rst, 0);
618 udelay(10); 476 udelay(10);
@@ -653,19 +511,9 @@ static struct twl4030_platform_data cm_t35_twldata = {
653 .vpll2 = &cm_t35_vpll2, 511 .vpll2 = &cm_t35_vpll2,
654}; 512};
655 513
656static struct i2c_board_info __initdata cm_t35_i2c_boardinfo[] = {
657 {
658 I2C_BOARD_INFO("tps65930", 0x48),
659 .flags = I2C_CLIENT_WAKE,
660 .irq = INT_34XX_SYS_NIRQ,
661 .platform_data = &cm_t35_twldata,
662 },
663};
664
665static void __init cm_t35_init_i2c(void) 514static void __init cm_t35_init_i2c(void)
666{ 515{
667 omap_register_i2c_bus(1, 2600, cm_t35_i2c_boardinfo, 516 omap3_pmic_init("tps65930", &cm_t35_twldata);
668 ARRAY_SIZE(cm_t35_i2c_boardinfo));
669} 517}
670 518
671static void __init cm_t35_init_early(void) 519static void __init cm_t35_init_early(void)
@@ -775,12 +623,6 @@ static struct omap_board_mux board_mux[] __initdata = {
775}; 623};
776#endif 624#endif
777 625
778static struct omap_musb_board_data musb_board_data = {
779 .interface_type = MUSB_INTERFACE_ULPI,
780 .mode = MUSB_OTG,
781 .power = 100,
782};
783
784static struct omap_board_config_kernel cm_t35_config[] __initdata = { 626static struct omap_board_config_kernel cm_t35_config[] __initdata = {
785}; 627};
786 628
@@ -792,12 +634,12 @@ static void __init cm_t35_init(void)
792 omap_serial_init(); 634 omap_serial_init();
793 cm_t35_init_i2c(); 635 cm_t35_init_i2c();
794 cm_t35_init_nand(); 636 cm_t35_init_nand();
795 cm_t35_init_ads7846(); 637 omap_ads7846_init(1, CM_T35_GPIO_PENDOWN, 0, NULL);
796 cm_t35_init_ethernet(); 638 cm_t35_init_ethernet();
797 cm_t35_init_led(); 639 cm_t35_init_led();
798 cm_t35_init_display(); 640 cm_t35_init_display();
799 641
800 usb_musb_init(&musb_board_data); 642 usb_musb_init(NULL);
801 usbhs_init(&usbhs_bdata); 643 usbhs_init(&usbhs_bdata);
802} 644}
803 645
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
index a27e3eee8292..08f08e812492 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -148,14 +148,13 @@ static void __init cm_t3517_init_rtc(void)
148{ 148{
149 int err; 149 int err;
150 150
151 err = gpio_request(RTC_CS_EN_GPIO, "rtc cs en"); 151 err = gpio_request_one(RTC_CS_EN_GPIO, GPIOF_OUT_INIT_HIGH,
152 "rtc cs en");
152 if (err) { 153 if (err) {
153 pr_err("CM-T3517: rtc cs en gpio request failed: %d\n", err); 154 pr_err("CM-T3517: rtc cs en gpio request failed: %d\n", err);
154 return; 155 return;
155 } 156 }
156 157
157 gpio_direction_output(RTC_CS_EN_GPIO, 1);
158
159 platform_device_register(&cm_t3517_rtc_device); 158 platform_device_register(&cm_t3517_rtc_device);
160} 159}
161#else 160#else
@@ -182,11 +181,11 @@ static int cm_t3517_init_usbh(void)
182{ 181{
183 int err; 182 int err;
184 183
185 err = gpio_request(USB_HUB_RESET_GPIO, "usb hub rst"); 184 err = gpio_request_one(USB_HUB_RESET_GPIO, GPIOF_OUT_INIT_LOW,
185 "usb hub rst");
186 if (err) { 186 if (err) {
187 pr_err("CM-T3517: usb hub rst gpio request failed: %d\n", err); 187 pr_err("CM-T3517: usb hub rst gpio request failed: %d\n", err);
188 } else { 188 } else {
189 gpio_direction_output(USB_HUB_RESET_GPIO, 0);
190 udelay(10); 189 udelay(10);
191 gpio_set_value(USB_HUB_RESET_GPIO, 1); 190 gpio_set_value(USB_HUB_RESET_GPIO, 1);
192 msleep(1); 191 msleep(1);
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 65f9fde2c567..3bd344a527e2 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -51,7 +51,6 @@
51#include <plat/mcspi.h> 51#include <plat/mcspi.h>
52#include <linux/input/matrix_keypad.h> 52#include <linux/input/matrix_keypad.h>
53#include <linux/spi/spi.h> 53#include <linux/spi/spi.h>
54#include <linux/spi/ads7846.h>
55#include <linux/dm9000.h> 54#include <linux/dm9000.h>
56#include <linux/interrupt.h> 55#include <linux/interrupt.h>
57 56
@@ -60,6 +59,7 @@
60#include "mux.h" 59#include "mux.h"
61#include "hsmmc.h" 60#include "hsmmc.h"
62#include "timer-gp.h" 61#include "timer-gp.h"
62#include "common-board-devices.h"
63 63
64#define NAND_BLOCK_SIZE SZ_128K 64#define NAND_BLOCK_SIZE SZ_128K
65 65
@@ -97,13 +97,6 @@ static struct mtd_partition devkit8000_nand_partitions[] = {
97 }, 97 },
98}; 98};
99 99
100static struct omap_nand_platform_data devkit8000_nand_data = {
101 .options = NAND_BUSWIDTH_16,
102 .parts = devkit8000_nand_partitions,
103 .nr_parts = ARRAY_SIZE(devkit8000_nand_partitions),
104 .dma_channel = -1, /* disable DMA in OMAP NAND driver */
105};
106
107static struct omap2_hsmmc_info mmc[] = { 100static struct omap2_hsmmc_info mmc[] = {
108 { 101 {
109 .mmc = 1, 102 .mmc = 1,
@@ -249,7 +242,7 @@ static int devkit8000_twl_gpio_setup(struct device *dev,
249 /* TWL4030_GPIO_MAX + 0 is "LCD_PWREN" (out, active high) */ 242 /* TWL4030_GPIO_MAX + 0 is "LCD_PWREN" (out, active high) */
250 devkit8000_lcd_device.reset_gpio = gpio + TWL4030_GPIO_MAX + 0; 243 devkit8000_lcd_device.reset_gpio = gpio + TWL4030_GPIO_MAX + 0;
251 ret = gpio_request_one(devkit8000_lcd_device.reset_gpio, 244 ret = gpio_request_one(devkit8000_lcd_device.reset_gpio,
252 GPIOF_DIR_OUT | GPIOF_INIT_LOW, "LCD_PWREN"); 245 GPIOF_OUT_INIT_LOW, "LCD_PWREN");
253 if (ret < 0) { 246 if (ret < 0) {
254 devkit8000_lcd_device.reset_gpio = -EINVAL; 247 devkit8000_lcd_device.reset_gpio = -EINVAL;
255 printk(KERN_ERR "Failed to request GPIO for LCD_PWRN\n"); 248 printk(KERN_ERR "Failed to request GPIO for LCD_PWRN\n");
@@ -258,7 +251,7 @@ static int devkit8000_twl_gpio_setup(struct device *dev,
258 /* gpio + 7 is "DVI_PD" (out, active low) */ 251 /* gpio + 7 is "DVI_PD" (out, active low) */
259 devkit8000_dvi_device.reset_gpio = gpio + 7; 252 devkit8000_dvi_device.reset_gpio = gpio + 7;
260 ret = gpio_request_one(devkit8000_dvi_device.reset_gpio, 253 ret = gpio_request_one(devkit8000_dvi_device.reset_gpio,
261 GPIOF_DIR_OUT | GPIOF_INIT_LOW, "DVI PowerDown"); 254 GPIOF_OUT_INIT_LOW, "DVI PowerDown");
262 if (ret < 0) { 255 if (ret < 0) {
263 devkit8000_dvi_device.reset_gpio = -EINVAL; 256 devkit8000_dvi_device.reset_gpio = -EINVAL;
264 printk(KERN_ERR "Failed to request GPIO for DVI PowerDown\n"); 257 printk(KERN_ERR "Failed to request GPIO for DVI PowerDown\n");
@@ -366,19 +359,9 @@ static struct twl4030_platform_data devkit8000_twldata = {
366 .keypad = &devkit8000_kp_data, 359 .keypad = &devkit8000_kp_data,
367}; 360};
368 361
369static struct i2c_board_info __initdata devkit8000_i2c_boardinfo[] = {
370 {
371 I2C_BOARD_INFO("tps65930", 0x48),
372 .flags = I2C_CLIENT_WAKE,
373 .irq = INT_34XX_SYS_NIRQ,
374 .platform_data = &devkit8000_twldata,
375 },
376};
377
378static int __init devkit8000_i2c_init(void) 362static int __init devkit8000_i2c_init(void)
379{ 363{
380 omap_register_i2c_bus(1, 2600, devkit8000_i2c_boardinfo, 364 omap3_pmic_init("tps65930", &devkit8000_twldata);
381 ARRAY_SIZE(devkit8000_i2c_boardinfo));
382 /* Bus 3 is attached to the DVI port where devices like the pico DLP 365 /* Bus 3 is attached to the DVI port where devices like the pico DLP
383 * projector don't work reliably with 400kHz */ 366 * projector don't work reliably with 400kHz */
384 omap_register_i2c_bus(3, 400, NULL, 0); 367 omap_register_i2c_bus(3, 400, NULL, 0);
@@ -463,56 +446,6 @@ static void __init devkit8000_init_irq(void)
463#endif 446#endif
464} 447}
465 448
466static void __init devkit8000_ads7846_init(void)
467{
468 int gpio = OMAP3_DEVKIT_TS_GPIO;
469 int ret;
470
471 ret = gpio_request(gpio, "ads7846_pen_down");
472 if (ret < 0) {
473 printk(KERN_ERR "Failed to request GPIO %d for "
474 "ads7846 pen down IRQ\n", gpio);
475 return;
476 }
477
478 gpio_direction_input(gpio);
479}
480
481static int ads7846_get_pendown_state(void)
482{
483 return !gpio_get_value(OMAP3_DEVKIT_TS_GPIO);
484}
485
486static struct ads7846_platform_data ads7846_config = {
487 .x_max = 0x0fff,
488 .y_max = 0x0fff,
489 .x_plate_ohms = 180,
490 .pressure_max = 255,
491 .debounce_max = 10,
492 .debounce_tol = 5,
493 .debounce_rep = 1,
494 .get_pendown_state = ads7846_get_pendown_state,
495 .keep_vref_on = 1,
496 .settle_delay_usecs = 150,
497};
498
499static struct omap2_mcspi_device_config ads7846_mcspi_config = {
500 .turbo_mode = 0,
501 .single_channel = 1, /* 0: slave, 1: master */
502};
503
504static struct spi_board_info devkit8000_spi_board_info[] __initdata = {
505 {
506 .modalias = "ads7846",
507 .bus_num = 2,
508 .chip_select = 0,
509 .max_speed_hz = 1500000,
510 .controller_data = &ads7846_mcspi_config,
511 .irq = OMAP_GPIO_IRQ(OMAP3_DEVKIT_TS_GPIO),
512 .platform_data = &ads7846_config,
513 }
514};
515
516#define OMAP_DM9000_BASE 0x2c000000 449#define OMAP_DM9000_BASE 0x2c000000
517 450
518static struct resource omap_dm9000_resources[] = { 451static struct resource omap_dm9000_resources[] = {
@@ -550,14 +483,14 @@ static void __init omap_dm9000_init(void)
550{ 483{
551 unsigned char *eth_addr = omap_dm9000_platdata.dev_addr; 484 unsigned char *eth_addr = omap_dm9000_platdata.dev_addr;
552 struct omap_die_id odi; 485 struct omap_die_id odi;
486 int ret;
553 487
554 if (gpio_request(OMAP_DM9000_GPIO_IRQ, "dm9000 irq") < 0) { 488 ret = gpio_request_one(OMAP_DM9000_GPIO_IRQ, GPIOF_IN, "dm9000 irq");
489 if (ret < 0) {
555 printk(KERN_ERR "Failed to request GPIO%d for dm9000 IRQ\n", 490 printk(KERN_ERR "Failed to request GPIO%d for dm9000 IRQ\n",
556 OMAP_DM9000_GPIO_IRQ); 491 OMAP_DM9000_GPIO_IRQ);
557 return; 492 return;
558 } 493 }
559
560 gpio_direction_input(OMAP_DM9000_GPIO_IRQ);
561 494
562 /* init the mac address using DIE id */ 495 /* init the mac address using DIE id */
563 omap_get_die_id(&odi); 496 omap_get_die_id(&odi);
@@ -576,45 +509,6 @@ static struct platform_device *devkit8000_devices[] __initdata = {
576 &omap_dm9000_dev, 509 &omap_dm9000_dev,
577}; 510};
578 511
579static void __init devkit8000_flash_init(void)
580{
581 u8 cs = 0;
582 u8 nandcs = GPMC_CS_NUM + 1;
583
584 /* find out the chip-select on which NAND exists */
585 while (cs < GPMC_CS_NUM) {
586 u32 ret = 0;
587 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
588
589 if ((ret & 0xC00) == 0x800) {
590 printk(KERN_INFO "Found NAND on CS%d\n", cs);
591 if (nandcs > GPMC_CS_NUM)
592 nandcs = cs;
593 }
594 cs++;
595 }
596
597 if (nandcs > GPMC_CS_NUM) {
598 printk(KERN_INFO "NAND: Unable to find configuration "
599 "in GPMC\n ");
600 return;
601 }
602
603 if (nandcs < GPMC_CS_NUM) {
604 devkit8000_nand_data.cs = nandcs;
605
606 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
607 if (gpmc_nand_init(&devkit8000_nand_data) < 0)
608 printk(KERN_ERR "Unable to register NAND device\n");
609 }
610}
611
612static struct omap_musb_board_data musb_board_data = {
613 .interface_type = MUSB_INTERFACE_ULPI,
614 .mode = MUSB_OTG,
615 .power = 100,
616};
617
618static const struct usbhs_omap_board_data usbhs_bdata __initconst = { 512static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
619 513
620 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 514 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
@@ -795,14 +689,13 @@ static void __init devkit8000_init(void)
795 ARRAY_SIZE(devkit8000_devices)); 689 ARRAY_SIZE(devkit8000_devices));
796 690
797 omap_display_init(&devkit8000_dss_data); 691 omap_display_init(&devkit8000_dss_data);
798 spi_register_board_info(devkit8000_spi_board_info,
799 ARRAY_SIZE(devkit8000_spi_board_info));
800 692
801 devkit8000_ads7846_init(); 693 omap_ads7846_init(2, OMAP3_DEVKIT_TS_GPIO, 0, NULL);
802 694
803 usb_musb_init(&musb_board_data); 695 usb_musb_init(NULL);
804 usbhs_init(&usbhs_bdata); 696 usbhs_init(&usbhs_bdata);
805 devkit8000_flash_init(); 697 omap_nand_flash_init(NAND_BUSWIDTH_16, devkit8000_nand_partitions,
698 ARRAY_SIZE(devkit8000_nand_partitions));
806 699
807 /* Ensure SDRC pins are mux'd for self-refresh */ 700 /* Ensure SDRC pins are mux'd for self-refresh */
808 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 701 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 34cf982b9679..0d6d583e8b3c 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -38,6 +38,7 @@
38#include "mux.h" 38#include "mux.h"
39#include "hsmmc.h" 39#include "hsmmc.h"
40#include "sdram-numonyx-m65kxxxxam.h" 40#include "sdram-numonyx-m65kxxxxam.h"
41#include "common-board-devices.h"
41 42
42#define IGEP2_SMSC911X_CS 5 43#define IGEP2_SMSC911X_CS 5
43#define IGEP2_SMSC911X_GPIO 176 44#define IGEP2_SMSC911X_GPIO 176
@@ -54,6 +55,11 @@
54#define IGEP2_RC_GPIO_WIFI_NRESET 139 55#define IGEP2_RC_GPIO_WIFI_NRESET 139
55#define IGEP2_RC_GPIO_BT_NRESET 137 56#define IGEP2_RC_GPIO_BT_NRESET 137
56 57
58#define IGEP3_GPIO_LED0_GREEN 54
59#define IGEP3_GPIO_LED0_RED 53
60#define IGEP3_GPIO_LED1_RED 16
61#define IGEP3_GPIO_USBH_NRESET 183
62
57/* 63/*
58 * IGEP2 Hardware Revision Table 64 * IGEP2 Hardware Revision Table
59 * 65 *
@@ -68,6 +74,7 @@
68 74
69#define IGEP2_BOARD_HWREV_B 0 75#define IGEP2_BOARD_HWREV_B 0
70#define IGEP2_BOARD_HWREV_C 1 76#define IGEP2_BOARD_HWREV_C 1
77#define IGEP3_BOARD_HWREV 2
71 78
72static u8 hwrev; 79static u8 hwrev;
73 80
@@ -75,24 +82,29 @@ static void __init igep2_get_revision(void)
75{ 82{
76 u8 ret; 83 u8 ret;
77 84
85 if (machine_is_igep0030()) {
86 hwrev = IGEP3_BOARD_HWREV;
87 return;
88 }
89
78 omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT); 90 omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT);
79 91
80 if ((gpio_request(IGEP2_GPIO_LED1_RED, "GPIO_HW0_REV") == 0) && 92 if (gpio_request_one(IGEP2_GPIO_LED1_RED, GPIOF_IN, "GPIO_HW0_REV")) {
81 (gpio_direction_input(IGEP2_GPIO_LED1_RED) == 0)) {
82 ret = gpio_get_value(IGEP2_GPIO_LED1_RED);
83 if (ret == 0) {
84 pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n");
85 hwrev = IGEP2_BOARD_HWREV_C;
86 } else if (ret == 1) {
87 pr_info("IGEP2: Hardware Revision B/C (B compatible)\n");
88 hwrev = IGEP2_BOARD_HWREV_B;
89 } else {
90 pr_err("IGEP2: Unknown Hardware Revision\n");
91 hwrev = -1;
92 }
93 } else {
94 pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n"); 93 pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n");
95 pr_err("IGEP2: Unknown Hardware Revision\n"); 94 pr_err("IGEP2: Unknown Hardware Revision\n");
95 return;
96 }
97
98 ret = gpio_get_value(IGEP2_GPIO_LED1_RED);
99 if (ret == 0) {
100 pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n");
101 hwrev = IGEP2_BOARD_HWREV_C;
102 } else if (ret == 1) {
103 pr_info("IGEP2: Hardware Revision B/C (B compatible)\n");
104 hwrev = IGEP2_BOARD_HWREV_B;
105 } else {
106 pr_err("IGEP2: Unknown Hardware Revision\n");
107 hwrev = -1;
96 } 108 }
97 109
98 gpio_free(IGEP2_GPIO_LED1_RED); 110 gpio_free(IGEP2_GPIO_LED1_RED);
@@ -111,7 +123,7 @@ static void __init igep2_get_revision(void)
111 * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048) 123 * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048)
112 */ 124 */
113 125
114static struct mtd_partition igep2_onenand_partitions[] = { 126static struct mtd_partition igep_onenand_partitions[] = {
115 { 127 {
116 .name = "X-Loader", 128 .name = "X-Loader",
117 .offset = 0, 129 .offset = 0,
@@ -139,21 +151,21 @@ static struct mtd_partition igep2_onenand_partitions[] = {
139 }, 151 },
140}; 152};
141 153
142static struct omap_onenand_platform_data igep2_onenand_data = { 154static struct omap_onenand_platform_data igep_onenand_data = {
143 .parts = igep2_onenand_partitions, 155 .parts = igep_onenand_partitions,
144 .nr_parts = ARRAY_SIZE(igep2_onenand_partitions), 156 .nr_parts = ARRAY_SIZE(igep_onenand_partitions),
145 .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */ 157 .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */
146}; 158};
147 159
148static struct platform_device igep2_onenand_device = { 160static struct platform_device igep_onenand_device = {
149 .name = "omap2-onenand", 161 .name = "omap2-onenand",
150 .id = -1, 162 .id = -1,
151 .dev = { 163 .dev = {
152 .platform_data = &igep2_onenand_data, 164 .platform_data = &igep_onenand_data,
153 }, 165 },
154}; 166};
155 167
156static void __init igep2_flash_init(void) 168static void __init igep_flash_init(void)
157{ 169{
158 u8 cs = 0; 170 u8 cs = 0;
159 u8 onenandcs = GPMC_CS_NUM + 1; 171 u8 onenandcs = GPMC_CS_NUM + 1;
@@ -165,7 +177,7 @@ static void __init igep2_flash_init(void)
165 /* Check if NAND/oneNAND is configured */ 177 /* Check if NAND/oneNAND is configured */
166 if ((ret & 0xC00) == 0x800) 178 if ((ret & 0xC00) == 0x800)
167 /* NAND found */ 179 /* NAND found */
168 pr_err("IGEP2: Unsupported NAND found\n"); 180 pr_err("IGEP: Unsupported NAND found\n");
169 else { 181 else {
170 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); 182 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
171 if ((ret & 0x3F) == (ONENAND_MAP >> 24)) 183 if ((ret & 0x3F) == (ONENAND_MAP >> 24))
@@ -175,85 +187,46 @@ static void __init igep2_flash_init(void)
175 } 187 }
176 188
177 if (onenandcs > GPMC_CS_NUM) { 189 if (onenandcs > GPMC_CS_NUM) {
178 pr_err("IGEP2: Unable to find configuration in GPMC\n"); 190 pr_err("IGEP: Unable to find configuration in GPMC\n");
179 return; 191 return;
180 } 192 }
181 193
182 igep2_onenand_data.cs = onenandcs; 194 igep_onenand_data.cs = onenandcs;
183 195
184 if (platform_device_register(&igep2_onenand_device) < 0) 196 if (platform_device_register(&igep_onenand_device) < 0)
185 pr_err("IGEP2: Unable to register OneNAND device\n"); 197 pr_err("IGEP: Unable to register OneNAND device\n");
186} 198}
187 199
188#else 200#else
189static void __init igep2_flash_init(void) {} 201static void __init igep_flash_init(void) {}
190#endif 202#endif
191 203
192#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 204#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
193 205
194#include <linux/smsc911x.h> 206#include <linux/smsc911x.h>
207#include <plat/gpmc-smsc911x.h>
195 208
196static struct smsc911x_platform_config igep2_smsc911x_config = { 209static struct omap_smsc911x_platform_data smsc911x_cfg = {
197 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 210 .cs = IGEP2_SMSC911X_CS,
198 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, 211 .gpio_irq = IGEP2_SMSC911X_GPIO,
199 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS , 212 .gpio_reset = -EINVAL,
200 .phy_interface = PHY_INTERFACE_MODE_MII, 213 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
201};
202
203static struct resource igep2_smsc911x_resources[] = {
204 {
205 .flags = IORESOURCE_MEM,
206 },
207 {
208 .start = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
209 .end = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
210 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
211 },
212};
213
214static struct platform_device igep2_smsc911x_device = {
215 .name = "smsc911x",
216 .id = 0,
217 .num_resources = ARRAY_SIZE(igep2_smsc911x_resources),
218 .resource = igep2_smsc911x_resources,
219 .dev = {
220 .platform_data = &igep2_smsc911x_config,
221 },
222}; 214};
223 215
224static inline void __init igep2_init_smsc911x(void) 216static inline void __init igep2_init_smsc911x(void)
225{ 217{
226 unsigned long cs_mem_base; 218 gpmc_smsc911x_init(&smsc911x_cfg);
227
228 if (gpmc_cs_request(IGEP2_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
229 pr_err("IGEP v2: Failed request for GPMC mem for smsc911x\n");
230 gpmc_cs_free(IGEP2_SMSC911X_CS);
231 return;
232 }
233
234 igep2_smsc911x_resources[0].start = cs_mem_base + 0x0;
235 igep2_smsc911x_resources[0].end = cs_mem_base + 0xff;
236
237 if ((gpio_request(IGEP2_SMSC911X_GPIO, "SMSC911X IRQ") == 0) &&
238 (gpio_direction_input(IGEP2_SMSC911X_GPIO) == 0)) {
239 gpio_export(IGEP2_SMSC911X_GPIO, 0);
240 } else {
241 pr_err("IGEP v2: Could not obtain gpio for for SMSC911X IRQ\n");
242 return;
243 }
244
245 platform_device_register(&igep2_smsc911x_device);
246} 219}
247 220
248#else 221#else
249static inline void __init igep2_init_smsc911x(void) { } 222static inline void __init igep2_init_smsc911x(void) { }
250#endif 223#endif
251 224
252static struct regulator_consumer_supply igep2_vmmc1_supply = 225static struct regulator_consumer_supply igep_vmmc1_supply =
253 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"); 226 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0");
254 227
255/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ 228/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
256static struct regulator_init_data igep2_vmmc1 = { 229static struct regulator_init_data igep_vmmc1 = {
257 .constraints = { 230 .constraints = {
258 .min_uV = 1850000, 231 .min_uV = 1850000,
259 .max_uV = 3150000, 232 .max_uV = 3150000,
@@ -264,13 +237,13 @@ static struct regulator_init_data igep2_vmmc1 = {
264 | REGULATOR_CHANGE_STATUS, 237 | REGULATOR_CHANGE_STATUS,
265 }, 238 },
266 .num_consumer_supplies = 1, 239 .num_consumer_supplies = 1,
267 .consumer_supplies = &igep2_vmmc1_supply, 240 .consumer_supplies = &igep_vmmc1_supply,
268}; 241};
269 242
270static struct regulator_consumer_supply igep2_vio_supply = 243static struct regulator_consumer_supply igep_vio_supply =
271 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1"); 244 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1");
272 245
273static struct regulator_init_data igep2_vio = { 246static struct regulator_init_data igep_vio = {
274 .constraints = { 247 .constraints = {
275 .min_uV = 1800000, 248 .min_uV = 1800000,
276 .max_uV = 1800000, 249 .max_uV = 1800000,
@@ -282,34 +255,34 @@ static struct regulator_init_data igep2_vio = {
282 | REGULATOR_CHANGE_STATUS, 255 | REGULATOR_CHANGE_STATUS,
283 }, 256 },
284 .num_consumer_supplies = 1, 257 .num_consumer_supplies = 1,
285 .consumer_supplies = &igep2_vio_supply, 258 .consumer_supplies = &igep_vio_supply,
286}; 259};
287 260
288static struct regulator_consumer_supply igep2_vmmc2_supply = 261static struct regulator_consumer_supply igep_vmmc2_supply =
289 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"); 262 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1");
290 263
291static struct regulator_init_data igep2_vmmc2 = { 264static struct regulator_init_data igep_vmmc2 = {
292 .constraints = { 265 .constraints = {
293 .valid_modes_mask = REGULATOR_MODE_NORMAL, 266 .valid_modes_mask = REGULATOR_MODE_NORMAL,
294 .always_on = 1, 267 .always_on = 1,
295 }, 268 },
296 .num_consumer_supplies = 1, 269 .num_consumer_supplies = 1,
297 .consumer_supplies = &igep2_vmmc2_supply, 270 .consumer_supplies = &igep_vmmc2_supply,
298}; 271};
299 272
300static struct fixed_voltage_config igep2_vwlan = { 273static struct fixed_voltage_config igep_vwlan = {
301 .supply_name = "vwlan", 274 .supply_name = "vwlan",
302 .microvolts = 3300000, 275 .microvolts = 3300000,
303 .gpio = -EINVAL, 276 .gpio = -EINVAL,
304 .enabled_at_boot = 1, 277 .enabled_at_boot = 1,
305 .init_data = &igep2_vmmc2, 278 .init_data = &igep_vmmc2,
306}; 279};
307 280
308static struct platform_device igep2_vwlan_device = { 281static struct platform_device igep_vwlan_device = {
309 .name = "reg-fixed-voltage", 282 .name = "reg-fixed-voltage",
310 .id = 0, 283 .id = 0,
311 .dev = { 284 .dev = {
312 .platform_data = &igep2_vwlan, 285 .platform_data = &igep_vwlan,
313 }, 286 },
314}; 287};
315 288
@@ -334,20 +307,17 @@ static struct omap2_hsmmc_info mmc[] = {
334#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) 307#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
335#include <linux/leds.h> 308#include <linux/leds.h>
336 309
337static struct gpio_led igep2_gpio_leds[] = { 310static struct gpio_led igep_gpio_leds[] = {
338 [0] = { 311 [0] = {
339 .name = "gpio-led:red:d0", 312 .name = "gpio-led:red:d0",
340 .gpio = IGEP2_GPIO_LED0_RED,
341 .default_trigger = "default-off" 313 .default_trigger = "default-off"
342 }, 314 },
343 [1] = { 315 [1] = {
344 .name = "gpio-led:green:d0", 316 .name = "gpio-led:green:d0",
345 .gpio = IGEP2_GPIO_LED0_GREEN,
346 .default_trigger = "default-off", 317 .default_trigger = "default-off",
347 }, 318 },
348 [2] = { 319 [2] = {
349 .name = "gpio-led:red:d1", 320 .name = "gpio-led:red:d1",
350 .gpio = IGEP2_GPIO_LED1_RED,
351 .default_trigger = "default-off", 321 .default_trigger = "default-off",
352 }, 322 },
353 [3] = { 323 [3] = {
@@ -358,94 +328,119 @@ static struct gpio_led igep2_gpio_leds[] = {
358 }, 328 },
359}; 329};
360 330
361static struct gpio_led_platform_data igep2_led_pdata = { 331static struct gpio_led_platform_data igep_led_pdata = {
362 .leds = igep2_gpio_leds, 332 .leds = igep_gpio_leds,
363 .num_leds = ARRAY_SIZE(igep2_gpio_leds), 333 .num_leds = ARRAY_SIZE(igep_gpio_leds),
364}; 334};
365 335
366static struct platform_device igep2_led_device = { 336static struct platform_device igep_led_device = {
367 .name = "leds-gpio", 337 .name = "leds-gpio",
368 .id = -1, 338 .id = -1,
369 .dev = { 339 .dev = {
370 .platform_data = &igep2_led_pdata, 340 .platform_data = &igep_led_pdata,
371 }, 341 },
372}; 342};
373 343
374static void __init igep2_leds_init(void) 344static void __init igep_leds_init(void)
375{ 345{
376 platform_device_register(&igep2_led_device); 346 if (machine_is_igep0020()) {
347 igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED;
348 igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN;
349 igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED;
350 } else {
351 igep_gpio_leds[0].gpio = IGEP3_GPIO_LED0_RED;
352 igep_gpio_leds[1].gpio = IGEP3_GPIO_LED0_GREEN;
353 igep_gpio_leds[2].gpio = IGEP3_GPIO_LED1_RED;
354 }
355
356 platform_device_register(&igep_led_device);
377} 357}
378 358
379#else 359#else
380static inline void igep2_leds_init(void) 360static struct gpio igep_gpio_leds[] __initdata = {
361 { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:red:d0" },
362 { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:green:d0" },
363 { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:red:d1" },
364};
365
366static inline void igep_leds_init(void)
381{ 367{
382 if ((gpio_request(IGEP2_GPIO_LED0_RED, "gpio-led:red:d0") == 0) && 368 int i;
383 (gpio_direction_output(IGEP2_GPIO_LED0_RED, 0) == 0))
384 gpio_export(IGEP2_GPIO_LED0_RED, 0);
385 else
386 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_RED\n");
387 369
388 if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "gpio-led:green:d0") == 0) && 370 if (machine_is_igep0020()) {
389 (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 0) == 0)) 371 igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED;
390 gpio_export(IGEP2_GPIO_LED0_GREEN, 0); 372 igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN;
391 else 373 igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED;
392 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n"); 374 } else {
375 igep_gpio_leds[0].gpio = IGEP3_GPIO_LED0_RED;
376 igep_gpio_leds[1].gpio = IGEP3_GPIO_LED0_GREEN;
377 igep_gpio_leds[2].gpio = IGEP3_GPIO_LED1_RED;
378 }
393 379
394 if ((gpio_request(IGEP2_GPIO_LED1_RED, "gpio-led:red:d1") == 0) && 380 if (gpio_request_array(igep_gpio_leds, ARRAY_SIZE(igep_gpio_leds))) {
395 (gpio_direction_output(IGEP2_GPIO_LED1_RED, 0) == 0)) 381 pr_warning("IGEP v2: Could not obtain leds gpios\n");
396 gpio_export(IGEP2_GPIO_LED1_RED, 0); 382 return;
397 else 383 }
398 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n");
399 384
385 for (i = 0; i < ARRAY_SIZE(igep_gpio_leds); i++)
386 gpio_export(igep_gpio_leds[i].gpio, 0);
400} 387}
401#endif 388#endif
402 389
403static int igep2_twl_gpio_setup(struct device *dev, 390static struct gpio igep2_twl_gpios[] = {
391 { -EINVAL, GPIOF_IN, "GPIO_EHCI_NOC" },
392 { -EINVAL, GPIOF_OUT_INIT_LOW, "GPIO_USBH_CPEN" },
393};
394
395static int igep_twl_gpio_setup(struct device *dev,
404 unsigned gpio, unsigned ngpio) 396 unsigned gpio, unsigned ngpio)
405{ 397{
398 int ret;
399
406 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 400 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
407 mmc[0].gpio_cd = gpio + 0; 401 mmc[0].gpio_cd = gpio + 0;
408 omap2_hsmmc_init(mmc); 402 omap2_hsmmc_init(mmc);
409 403
410 /*
411 * REVISIT: need ehci-omap hooks for external VBUS
412 * power switch and overcurrent detect
413 */
414 if ((gpio_request(gpio + 1, "GPIO_EHCI_NOC") < 0) ||
415 (gpio_direction_input(gpio + 1) < 0))
416 pr_err("IGEP2: Could not obtain gpio for EHCI NOC");
417
418 /*
419 * TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN
420 * (out, active low)
421 */
422 if ((gpio_request(gpio + TWL4030_GPIO_MAX, "GPIO_USBH_CPEN") < 0) ||
423 (gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0) < 0))
424 pr_err("IGEP2: Could not obtain gpio for USBH_CPEN");
425
426 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ 404 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
427#if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) 405#if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
428 if ((gpio_request(gpio+TWL4030_GPIO_MAX+1, "gpio-led:green:d1") == 0) 406 ret = gpio_request_one(gpio + TWL4030_GPIO_MAX + 1, GPIOF_OUT_INIT_HIGH,
429 && (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0)) 407 "gpio-led:green:d1");
408 if (ret == 0)
430 gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0); 409 gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0);
431 else 410 else
432 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_GREEN\n"); 411 pr_warning("IGEP: Could not obtain gpio GPIO_LED1_GREEN\n");
433#else 412#else
434 igep2_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1; 413 igep_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1;
435#endif 414#endif
436 415
416 if (machine_is_igep0030())
417 return 0;
418
419 /*
420 * REVISIT: need ehci-omap hooks for external VBUS
421 * power switch and overcurrent detect
422 */
423 igep2_twl_gpios[0].gpio = gpio + 1;
424
425 /* TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN (out, active low) */
426 igep2_twl_gpios[1].gpio = gpio + TWL4030_GPIO_MAX;
427
428 ret = gpio_request_array(igep2_twl_gpios, ARRAY_SIZE(igep2_twl_gpios));
429 if (ret < 0)
430 pr_err("IGEP2: Could not obtain gpio for USBH_CPEN");
431
437 return 0; 432 return 0;
438}; 433};
439 434
440static struct twl4030_gpio_platform_data igep2_twl4030_gpio_pdata = { 435static struct twl4030_gpio_platform_data igep_twl4030_gpio_pdata = {
441 .gpio_base = OMAP_MAX_GPIO_LINES, 436 .gpio_base = OMAP_MAX_GPIO_LINES,
442 .irq_base = TWL4030_GPIO_IRQ_BASE, 437 .irq_base = TWL4030_GPIO_IRQ_BASE,
443 .irq_end = TWL4030_GPIO_IRQ_END, 438 .irq_end = TWL4030_GPIO_IRQ_END,
444 .use_leds = true, 439 .use_leds = true,
445 .setup = igep2_twl_gpio_setup, 440 .setup = igep_twl_gpio_setup,
446}; 441};
447 442
448static struct twl4030_usb_data igep2_usb_data = { 443static struct twl4030_usb_data igep_usb_data = {
449 .usb_mode = T2_USB_MODE_ULPI, 444 .usb_mode = T2_USB_MODE_ULPI,
450}; 445};
451 446
@@ -507,16 +502,17 @@ static struct regulator_init_data igep2_vpll2 = {
507 502
508static void __init igep2_display_init(void) 503static void __init igep2_display_init(void)
509{ 504{
510 if (gpio_request(IGEP2_GPIO_DVI_PUP, "GPIO_DVI_PUP") && 505 int err = gpio_request_one(IGEP2_GPIO_DVI_PUP, GPIOF_OUT_INIT_HIGH,
511 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1)) 506 "GPIO_DVI_PUP");
507 if (err)
512 pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n"); 508 pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n");
513} 509}
514 510
515static struct platform_device *igep2_devices[] __initdata = { 511static struct platform_device *igep_devices[] __initdata = {
516 &igep2_vwlan_device, 512 &igep_vwlan_device,
517}; 513};
518 514
519static void __init igep2_init_early(void) 515static void __init igep_init_early(void)
520{ 516{
521 omap2_init_common_infrastructure(); 517 omap2_init_common_infrastructure();
522 omap2_init_common_devices(m65kxxxxam_sdrc_params, 518 omap2_init_common_devices(m65kxxxxam_sdrc_params,
@@ -561,27 +557,15 @@ static struct twl4030_keypad_data igep2_keypad_pdata = {
561 .rep = 1, 557 .rep = 1,
562}; 558};
563 559
564static struct twl4030_platform_data igep2_twldata = { 560static struct twl4030_platform_data igep_twldata = {
565 .irq_base = TWL4030_IRQ_BASE, 561 .irq_base = TWL4030_IRQ_BASE,
566 .irq_end = TWL4030_IRQ_END, 562 .irq_end = TWL4030_IRQ_END,
567 563
568 /* platform_data for children goes here */ 564 /* platform_data for children goes here */
569 .usb = &igep2_usb_data, 565 .usb = &igep_usb_data,
570 .codec = &igep2_codec_data, 566 .gpio = &igep_twl4030_gpio_pdata,
571 .gpio = &igep2_twl4030_gpio_pdata, 567 .vmmc1 = &igep_vmmc1,
572 .keypad = &igep2_keypad_pdata, 568 .vio = &igep_vio,
573 .vmmc1 = &igep2_vmmc1,
574 .vpll2 = &igep2_vpll2,
575 .vio = &igep2_vio,
576};
577
578static struct i2c_board_info __initdata igep2_i2c1_boardinfo[] = {
579 {
580 I2C_BOARD_INFO("twl4030", 0x48),
581 .flags = I2C_CLIENT_WAKE,
582 .irq = INT_34XX_SYS_NIRQ,
583 .platform_data = &igep2_twldata,
584 },
585}; 569};
586 570
587static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = { 571static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = {
@@ -590,32 +574,29 @@ static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = {
590 }, 574 },
591}; 575};
592 576
593static void __init igep2_i2c_init(void) 577static void __init igep_i2c_init(void)
594{ 578{
595 int ret; 579 int ret;
596 580
597 ret = omap_register_i2c_bus(1, 2600, igep2_i2c1_boardinfo, 581 if (machine_is_igep0020()) {
598 ARRAY_SIZE(igep2_i2c1_boardinfo)); 582 /*
599 if (ret) 583 * Bus 3 is attached to the DVI port where devices like the
600 pr_warning("IGEP2: Could not register I2C1 bus (%d)\n", ret); 584 * pico DLP projector don't work reliably with 400kHz
585 */
586 ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo,
587 ARRAY_SIZE(igep2_i2c3_boardinfo));
588 if (ret)
589 pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret);
590
591 igep_twldata.codec = &igep2_codec_data;
592 igep_twldata.keypad = &igep2_keypad_pdata;
593 igep_twldata.vpll2 = &igep2_vpll2;
594 }
601 595
602 /* 596 omap3_pmic_init("twl4030", &igep_twldata);
603 * Bus 3 is attached to the DVI port where devices like the pico DLP
604 * projector don't work reliably with 400kHz
605 */
606 ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo,
607 ARRAY_SIZE(igep2_i2c3_boardinfo));
608 if (ret)
609 pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret);
610} 597}
611 598
612static struct omap_musb_board_data musb_board_data = { 599static const struct usbhs_omap_board_data igep2_usbhs_bdata __initconst = {
613 .interface_type = MUSB_INTERFACE_ULPI,
614 .mode = MUSB_OTG,
615 .power = 100,
616};
617
618static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
619 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 600 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
620 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, 601 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
621 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 602 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
@@ -626,6 +607,17 @@ static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
626 .reset_gpio_port[2] = -EINVAL, 607 .reset_gpio_port[2] = -EINVAL,
627}; 608};
628 609
610static const struct usbhs_omap_board_data igep3_usbhs_bdata __initconst = {
611 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
612 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
613 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
614
615 .phy_reset = true,
616 .reset_gpio_port[0] = -EINVAL,
617 .reset_gpio_port[1] = IGEP3_GPIO_USBH_NRESET,
618 .reset_gpio_port[2] = -EINVAL,
619};
620
629#ifdef CONFIG_OMAP_MUX 621#ifdef CONFIG_OMAP_MUX
630static struct omap_board_mux board_mux[] __initdata = { 622static struct omap_board_mux board_mux[] __initdata = {
631 { .reg_offset = OMAP_MUX_TERMINATOR }, 623 { .reg_offset = OMAP_MUX_TERMINATOR },
@@ -633,82 +625,95 @@ static struct omap_board_mux board_mux[] __initdata = {
633#endif 625#endif
634 626
635#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE) 627#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
628static struct gpio igep_wlan_bt_gpios[] __initdata = {
629 { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NPD" },
630 { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NRESET" },
631 { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_BT_NRESET" },
632};
636 633
637static void __init igep2_wlan_bt_init(void) 634static void __init igep_wlan_bt_init(void)
638{ 635{
639 unsigned npd, wreset, btreset; 636 int err;
640 637
641 /* GPIO's for WLAN-BT combo depends on hardware revision */ 638 /* GPIO's for WLAN-BT combo depends on hardware revision */
642 if (hwrev == IGEP2_BOARD_HWREV_B) { 639 if (hwrev == IGEP2_BOARD_HWREV_B) {
643 npd = IGEP2_RB_GPIO_WIFI_NPD; 640 igep_wlan_bt_gpios[0].gpio = IGEP2_RB_GPIO_WIFI_NPD;
644 wreset = IGEP2_RB_GPIO_WIFI_NRESET; 641 igep_wlan_bt_gpios[1].gpio = IGEP2_RB_GPIO_WIFI_NRESET;
645 btreset = IGEP2_RB_GPIO_BT_NRESET; 642 igep_wlan_bt_gpios[2].gpio = IGEP2_RB_GPIO_BT_NRESET;
646 } else if (hwrev == IGEP2_BOARD_HWREV_C) { 643 } else if (hwrev == IGEP2_BOARD_HWREV_C || machine_is_igep0030()) {
647 npd = IGEP2_RC_GPIO_WIFI_NPD; 644 igep_wlan_bt_gpios[0].gpio = IGEP2_RC_GPIO_WIFI_NPD;
648 wreset = IGEP2_RC_GPIO_WIFI_NRESET; 645 igep_wlan_bt_gpios[1].gpio = IGEP2_RC_GPIO_WIFI_NRESET;
649 btreset = IGEP2_RC_GPIO_BT_NRESET; 646 igep_wlan_bt_gpios[2].gpio = IGEP2_RC_GPIO_BT_NRESET;
650 } else 647 } else
651 return; 648 return;
652 649
653 /* Set GPIO's for WLAN-BT combo module */ 650 err = gpio_request_array(igep_wlan_bt_gpios,
654 if ((gpio_request(npd, "GPIO_WIFI_NPD") == 0) && 651 ARRAY_SIZE(igep_wlan_bt_gpios));
655 (gpio_direction_output(npd, 1) == 0)) { 652 if (err) {
656 gpio_export(npd, 0); 653 pr_warning("IGEP2: Could not obtain WIFI/BT gpios\n");
657 } else 654 return;
658 pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NPD\n"); 655 }
659 656
660 if ((gpio_request(wreset, "GPIO_WIFI_NRESET") == 0) && 657 gpio_export(igep_wlan_bt_gpios[0].gpio, 0);
661 (gpio_direction_output(wreset, 1) == 0)) { 658 gpio_export(igep_wlan_bt_gpios[1].gpio, 0);
662 gpio_export(wreset, 0); 659 gpio_export(igep_wlan_bt_gpios[2].gpio, 0);
663 gpio_set_value(wreset, 0); 660
664 udelay(10); 661 gpio_set_value(igep_wlan_bt_gpios[1].gpio, 0);
665 gpio_set_value(wreset, 1); 662 udelay(10);
666 } else 663 gpio_set_value(igep_wlan_bt_gpios[1].gpio, 1);
667 pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NRESET\n");
668 664
669 if ((gpio_request(btreset, "GPIO_BT_NRESET") == 0) &&
670 (gpio_direction_output(btreset, 1) == 0)) {
671 gpio_export(btreset, 0);
672 } else
673 pr_warning("IGEP2: Could not obtain gpio GPIO_BT_NRESET\n");
674} 665}
675#else 666#else
676static inline void __init igep2_wlan_bt_init(void) { } 667static inline void __init igep_wlan_bt_init(void) { }
677#endif 668#endif
678 669
679static void __init igep2_init(void) 670static void __init igep_init(void)
680{ 671{
681 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 672 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
682 673
683 /* Get IGEP2 hardware revision */ 674 /* Get IGEP2 hardware revision */
684 igep2_get_revision(); 675 igep2_get_revision();
685 /* Register I2C busses and drivers */ 676 /* Register I2C busses and drivers */
686 igep2_i2c_init(); 677 igep_i2c_init();
687 platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices)); 678 platform_add_devices(igep_devices, ARRAY_SIZE(igep_devices));
688 omap_display_init(&igep2_dss_data);
689 omap_serial_init(); 679 omap_serial_init();
690 usb_musb_init(&musb_board_data); 680 usb_musb_init(NULL);
691 usbhs_init(&usbhs_bdata);
692 681
693 igep2_flash_init(); 682 igep_flash_init();
694 igep2_leds_init(); 683 igep_leds_init();
695 igep2_display_init();
696 igep2_init_smsc911x();
697 684
698 /* 685 /*
699 * WLAN-BT combo module from MuRata which has a Marvell WLAN 686 * WLAN-BT combo module from MuRata which has a Marvell WLAN
700 * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface. 687 * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
701 */ 688 */
702 igep2_wlan_bt_init(); 689 igep_wlan_bt_init();
703 690
691 if (machine_is_igep0020()) {
692 omap_display_init(&igep2_dss_data);
693 igep2_display_init();
694 igep2_init_smsc911x();
695 usbhs_init(&igep2_usbhs_bdata);
696 } else {
697 usbhs_init(&igep3_usbhs_bdata);
698 }
704} 699}
705 700
706MACHINE_START(IGEP0020, "IGEP v2 board") 701MACHINE_START(IGEP0020, "IGEP v2 board")
707 .boot_params = 0x80000100, 702 .boot_params = 0x80000100,
708 .reserve = omap_reserve, 703 .reserve = omap_reserve,
709 .map_io = omap3_map_io, 704 .map_io = omap3_map_io,
710 .init_early = igep2_init_early, 705 .init_early = igep_init_early,
706 .init_irq = omap_init_irq,
707 .init_machine = igep_init,
708 .timer = &omap_timer,
709MACHINE_END
710
711MACHINE_START(IGEP0030, "IGEP OMAP3 module")
712 .boot_params = 0x80000100,
713 .reserve = omap_reserve,
714 .map_io = omap3_map_io,
715 .init_early = igep_init_early,
711 .init_irq = omap_init_irq, 716 .init_irq = omap_init_irq,
712 .init_machine = igep2_init, 717 .init_machine = igep_init,
713 .timer = &omap_timer, 718 .timer = &omap_timer,
714MACHINE_END 719MACHINE_END
diff --git a/arch/arm/mach-omap2/board-igep0030.c b/arch/arm/mach-omap2/board-igep0030.c
deleted file mode 100644
index 2cf86c3cb1a3..000000000000
--- a/arch/arm/mach-omap2/board-igep0030.c
+++ /dev/null
@@ -1,458 +0,0 @@
1/*
2 * Copyright (C) 2010 - ISEE 2007 SL
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/regulator/fixed.h>
23#include <linux/i2c/twl.h>
24#include <linux/mmc/host.h>
25
26#include <asm/mach-types.h>
27#include <asm/mach/arch.h>
28
29#include <plat/board.h>
30#include <plat/common.h>
31#include <plat/gpmc.h>
32#include <plat/usb.h>
33#include <plat/onenand.h>
34
35#include "mux.h"
36#include "hsmmc.h"
37#include "sdram-numonyx-m65kxxxxam.h"
38
39#define IGEP3_GPIO_LED0_GREEN 54
40#define IGEP3_GPIO_LED0_RED 53
41#define IGEP3_GPIO_LED1_RED 16
42
43#define IGEP3_GPIO_WIFI_NPD 138
44#define IGEP3_GPIO_WIFI_NRESET 139
45#define IGEP3_GPIO_BT_NRESET 137
46
47#define IGEP3_GPIO_USBH_NRESET 183
48
49
50#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
51 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
52
53#define ONENAND_MAP 0x20000000
54
55/*
56 * x2 Flash built-in COMBO POP MEMORY
57 * Since the device is equipped with two DataRAMs, and two-plane NAND
58 * Flash memory array, these two component enables simultaneous program
59 * of 4KiB. Plane1 has only even blocks such as block0, block2, block4
60 * while Plane2 has only odd blocks such as block1, block3, block5.
61 * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048)
62 */
63
64static struct mtd_partition igep3_onenand_partitions[] = {
65 {
66 .name = "X-Loader",
67 .offset = 0,
68 .size = 2 * (64*(2*2048))
69 },
70 {
71 .name = "U-Boot",
72 .offset = MTDPART_OFS_APPEND,
73 .size = 6 * (64*(2*2048)),
74 },
75 {
76 .name = "Environment",
77 .offset = MTDPART_OFS_APPEND,
78 .size = 2 * (64*(2*2048)),
79 },
80 {
81 .name = "Kernel",
82 .offset = MTDPART_OFS_APPEND,
83 .size = 12 * (64*(2*2048)),
84 },
85 {
86 .name = "File System",
87 .offset = MTDPART_OFS_APPEND,
88 .size = MTDPART_SIZ_FULL,
89 },
90};
91
92static struct omap_onenand_platform_data igep3_onenand_pdata = {
93 .parts = igep3_onenand_partitions,
94 .nr_parts = ARRAY_SIZE(igep3_onenand_partitions),
95 .onenand_setup = NULL,
96 .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */
97};
98
99static struct platform_device igep3_onenand_device = {
100 .name = "omap2-onenand",
101 .id = -1,
102 .dev = {
103 .platform_data = &igep3_onenand_pdata,
104 },
105};
106
107static void __init igep3_flash_init(void)
108{
109 u8 cs = 0;
110 u8 onenandcs = GPMC_CS_NUM + 1;
111
112 for (cs = 0; cs < GPMC_CS_NUM; cs++) {
113 u32 ret;
114 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
115
116 /* Check if NAND/oneNAND is configured */
117 if ((ret & 0xC00) == 0x800)
118 /* NAND found */
119 pr_err("IGEP3: Unsupported NAND found\n");
120 else {
121 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
122
123 if ((ret & 0x3F) == (ONENAND_MAP >> 24))
124 /* OneNAND found */
125 onenandcs = cs;
126 }
127 }
128
129 if (onenandcs > GPMC_CS_NUM) {
130 pr_err("IGEP3: Unable to find configuration in GPMC\n");
131 return;
132 }
133
134 igep3_onenand_pdata.cs = onenandcs;
135
136 if (platform_device_register(&igep3_onenand_device) < 0)
137 pr_err("IGEP3: Unable to register OneNAND device\n");
138}
139
140#else
141static void __init igep3_flash_init(void) {}
142#endif
143
144static struct regulator_consumer_supply igep3_vmmc1_supply =
145 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0");
146
147/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
148static struct regulator_init_data igep3_vmmc1 = {
149 .constraints = {
150 .min_uV = 1850000,
151 .max_uV = 3150000,
152 .valid_modes_mask = REGULATOR_MODE_NORMAL
153 | REGULATOR_MODE_STANDBY,
154 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
155 | REGULATOR_CHANGE_MODE
156 | REGULATOR_CHANGE_STATUS,
157 },
158 .num_consumer_supplies = 1,
159 .consumer_supplies = &igep3_vmmc1_supply,
160};
161
162static struct regulator_consumer_supply igep3_vio_supply =
163 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1");
164
165static struct regulator_init_data igep3_vio = {
166 .constraints = {
167 .min_uV = 1800000,
168 .max_uV = 1800000,
169 .apply_uV = 1,
170 .valid_modes_mask = REGULATOR_MODE_NORMAL
171 | REGULATOR_MODE_STANDBY,
172 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
173 | REGULATOR_CHANGE_MODE
174 | REGULATOR_CHANGE_STATUS,
175 },
176 .num_consumer_supplies = 1,
177 .consumer_supplies = &igep3_vio_supply,
178};
179
180static struct regulator_consumer_supply igep3_vmmc2_supply =
181 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1");
182
183static struct regulator_init_data igep3_vmmc2 = {
184 .constraints = {
185 .valid_modes_mask = REGULATOR_MODE_NORMAL,
186 .always_on = 1,
187 },
188 .num_consumer_supplies = 1,
189 .consumer_supplies = &igep3_vmmc2_supply,
190};
191
192static struct fixed_voltage_config igep3_vwlan = {
193 .supply_name = "vwlan",
194 .microvolts = 3300000,
195 .gpio = -EINVAL,
196 .enabled_at_boot = 1,
197 .init_data = &igep3_vmmc2,
198};
199
200static struct platform_device igep3_vwlan_device = {
201 .name = "reg-fixed-voltage",
202 .id = 0,
203 .dev = {
204 .platform_data = &igep3_vwlan,
205 },
206};
207
208static struct omap2_hsmmc_info mmc[] = {
209 [0] = {
210 .mmc = 1,
211 .caps = MMC_CAP_4_BIT_DATA,
212 .gpio_cd = -EINVAL,
213 .gpio_wp = -EINVAL,
214 },
215#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
216 [1] = {
217 .mmc = 2,
218 .caps = MMC_CAP_4_BIT_DATA,
219 .gpio_cd = -EINVAL,
220 .gpio_wp = -EINVAL,
221 },
222#endif
223 {} /* Terminator */
224};
225
226#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
227#include <linux/leds.h>
228
229static struct gpio_led igep3_gpio_leds[] = {
230 [0] = {
231 .name = "gpio-led:red:d0",
232 .gpio = IGEP3_GPIO_LED0_RED,
233 .default_trigger = "default-off"
234 },
235 [1] = {
236 .name = "gpio-led:green:d0",
237 .gpio = IGEP3_GPIO_LED0_GREEN,
238 .default_trigger = "default-off",
239 },
240 [2] = {
241 .name = "gpio-led:red:d1",
242 .gpio = IGEP3_GPIO_LED1_RED,
243 .default_trigger = "default-off",
244 },
245 [3] = {
246 .name = "gpio-led:green:d1",
247 .default_trigger = "heartbeat",
248 .gpio = -EINVAL, /* gets replaced */
249 },
250};
251
252static struct gpio_led_platform_data igep3_led_pdata = {
253 .leds = igep3_gpio_leds,
254 .num_leds = ARRAY_SIZE(igep3_gpio_leds),
255};
256
257static struct platform_device igep3_led_device = {
258 .name = "leds-gpio",
259 .id = -1,
260 .dev = {
261 .platform_data = &igep3_led_pdata,
262 },
263};
264
265static void __init igep3_leds_init(void)
266{
267 platform_device_register(&igep3_led_device);
268}
269
270#else
271static inline void igep3_leds_init(void)
272{
273 if ((gpio_request(IGEP3_GPIO_LED0_RED, "gpio-led:red:d0") == 0) &&
274 (gpio_direction_output(IGEP3_GPIO_LED0_RED, 1) == 0)) {
275 gpio_export(IGEP3_GPIO_LED0_RED, 0);
276 gpio_set_value(IGEP3_GPIO_LED0_RED, 1);
277 } else
278 pr_warning("IGEP3: Could not obtain gpio GPIO_LED0_RED\n");
279
280 if ((gpio_request(IGEP3_GPIO_LED0_GREEN, "gpio-led:green:d0") == 0) &&
281 (gpio_direction_output(IGEP3_GPIO_LED0_GREEN, 1) == 0)) {
282 gpio_export(IGEP3_GPIO_LED0_GREEN, 0);
283 gpio_set_value(IGEP3_GPIO_LED0_GREEN, 1);
284 } else
285 pr_warning("IGEP3: Could not obtain gpio GPIO_LED0_GREEN\n");
286
287 if ((gpio_request(IGEP3_GPIO_LED1_RED, "gpio-led:red:d1") == 0) &&
288 (gpio_direction_output(IGEP3_GPIO_LED1_RED, 1) == 0)) {
289 gpio_export(IGEP3_GPIO_LED1_RED, 0);
290 gpio_set_value(IGEP3_GPIO_LED1_RED, 1);
291 } else
292 pr_warning("IGEP3: Could not obtain gpio GPIO_LED1_RED\n");
293}
294#endif
295
296static int igep3_twl4030_gpio_setup(struct device *dev,
297 unsigned gpio, unsigned ngpio)
298{
299 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
300 mmc[0].gpio_cd = gpio + 0;
301 omap2_hsmmc_init(mmc);
302
303 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
304#if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
305 if ((gpio_request(gpio+TWL4030_GPIO_MAX+1, "gpio-led:green:d1") == 0)
306 && (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0)) {
307 gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0);
308 gpio_set_value(gpio + TWL4030_GPIO_MAX + 1, 0);
309 } else
310 pr_warning("IGEP3: Could not obtain gpio GPIO_LED1_GREEN\n");
311#else
312 igep3_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1;
313#endif
314
315 return 0;
316};
317
318static struct twl4030_gpio_platform_data igep3_twl4030_gpio_pdata = {
319 .gpio_base = OMAP_MAX_GPIO_LINES,
320 .irq_base = TWL4030_GPIO_IRQ_BASE,
321 .irq_end = TWL4030_GPIO_IRQ_END,
322 .use_leds = true,
323 .setup = igep3_twl4030_gpio_setup,
324};
325
326static struct twl4030_usb_data igep3_twl4030_usb_data = {
327 .usb_mode = T2_USB_MODE_ULPI,
328};
329
330static struct platform_device *igep3_devices[] __initdata = {
331 &igep3_vwlan_device,
332};
333
334static void __init igep3_init_early(void)
335{
336 omap2_init_common_infrastructure();
337 omap2_init_common_devices(m65kxxxxam_sdrc_params,
338 m65kxxxxam_sdrc_params);
339}
340
341static struct twl4030_platform_data igep3_twl4030_pdata = {
342 .irq_base = TWL4030_IRQ_BASE,
343 .irq_end = TWL4030_IRQ_END,
344
345 /* platform_data for children goes here */
346 .usb = &igep3_twl4030_usb_data,
347 .gpio = &igep3_twl4030_gpio_pdata,
348 .vmmc1 = &igep3_vmmc1,
349 .vio = &igep3_vio,
350};
351
352static struct i2c_board_info __initdata igep3_i2c_boardinfo[] = {
353 {
354 I2C_BOARD_INFO("twl4030", 0x48),
355 .flags = I2C_CLIENT_WAKE,
356 .irq = INT_34XX_SYS_NIRQ,
357 .platform_data = &igep3_twl4030_pdata,
358 },
359};
360
361static int __init igep3_i2c_init(void)
362{
363 omap_register_i2c_bus(1, 2600, igep3_i2c_boardinfo,
364 ARRAY_SIZE(igep3_i2c_boardinfo));
365
366 return 0;
367}
368
369static struct omap_musb_board_data musb_board_data = {
370 .interface_type = MUSB_INTERFACE_ULPI,
371 .mode = MUSB_OTG,
372 .power = 100,
373};
374
375#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
376
377static void __init igep3_wifi_bt_init(void)
378{
379 /* Configure MUX values for W-LAN + Bluetooth GPIO's */
380 omap_mux_init_gpio(IGEP3_GPIO_WIFI_NPD, OMAP_PIN_OUTPUT);
381 omap_mux_init_gpio(IGEP3_GPIO_WIFI_NRESET, OMAP_PIN_OUTPUT);
382 omap_mux_init_gpio(IGEP3_GPIO_BT_NRESET, OMAP_PIN_OUTPUT);
383
384 /* Set GPIO's for W-LAN + Bluetooth combo module */
385 if ((gpio_request(IGEP3_GPIO_WIFI_NPD, "GPIO_WIFI_NPD") == 0) &&
386 (gpio_direction_output(IGEP3_GPIO_WIFI_NPD, 1) == 0)) {
387 gpio_export(IGEP3_GPIO_WIFI_NPD, 0);
388 } else
389 pr_warning("IGEP3: Could not obtain gpio GPIO_WIFI_NPD\n");
390
391 if ((gpio_request(IGEP3_GPIO_WIFI_NRESET, "GPIO_WIFI_NRESET") == 0) &&
392 (gpio_direction_output(IGEP3_GPIO_WIFI_NRESET, 1) == 0)) {
393 gpio_export(IGEP3_GPIO_WIFI_NRESET, 0);
394 gpio_set_value(IGEP3_GPIO_WIFI_NRESET, 0);
395 udelay(10);
396 gpio_set_value(IGEP3_GPIO_WIFI_NRESET, 1);
397 } else
398 pr_warning("IGEP3: Could not obtain gpio GPIO_WIFI_NRESET\n");
399
400 if ((gpio_request(IGEP3_GPIO_BT_NRESET, "GPIO_BT_NRESET") == 0) &&
401 (gpio_direction_output(IGEP3_GPIO_BT_NRESET, 1) == 0)) {
402 gpio_export(IGEP3_GPIO_BT_NRESET, 0);
403 } else
404 pr_warning("IGEP3: Could not obtain gpio GPIO_BT_NRESET\n");
405}
406#else
407void __init igep3_wifi_bt_init(void) {}
408#endif
409
410static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
411 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
412 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
413 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
414
415 .phy_reset = true,
416 .reset_gpio_port[0] = -EINVAL,
417 .reset_gpio_port[1] = IGEP3_GPIO_USBH_NRESET,
418 .reset_gpio_port[2] = -EINVAL,
419};
420
421#ifdef CONFIG_OMAP_MUX
422static struct omap_board_mux board_mux[] __initdata = {
423 OMAP3_MUX(I2C2_SDA, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
424 { .reg_offset = OMAP_MUX_TERMINATOR },
425};
426#endif
427
428static void __init igep3_init(void)
429{
430 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
431
432 /* Register I2C busses and drivers */
433 igep3_i2c_init();
434 platform_add_devices(igep3_devices, ARRAY_SIZE(igep3_devices));
435 omap_serial_init();
436 usb_musb_init(&musb_board_data);
437 usbhs_init(&usbhs_bdata);
438
439 igep3_flash_init();
440 igep3_leds_init();
441
442 /*
443 * WLAN-BT combo module from MuRata which has a Marvell WLAN
444 * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
445 */
446 igep3_wifi_bt_init();
447
448}
449
450MACHINE_START(IGEP0030, "IGEP OMAP3 module")
451 .boot_params = 0x80000100,
452 .reserve = omap_reserve,
453 .map_io = omap3_map_io,
454 .init_early = igep3_init_early,
455 .init_irq = omap_init_irq,
456 .init_machine = igep3_init,
457 .timer = &omap_timer,
458MACHINE_END
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index e2ba77957a8c..f7d6038075f0 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -22,7 +22,6 @@
22#include <linux/err.h> 22#include <linux/err.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/spi/spi.h> 24#include <linux/spi/spi.h>
25#include <linux/spi/ads7846.h>
26#include <linux/regulator/machine.h> 25#include <linux/regulator/machine.h>
27#include <linux/i2c/twl.h> 26#include <linux/i2c/twl.h>
28#include <linux/io.h> 27#include <linux/io.h>
@@ -43,47 +42,19 @@
43 42
44#include <asm/delay.h> 43#include <asm/delay.h>
45#include <plat/usb.h> 44#include <plat/usb.h>
45#include <plat/gpmc-smsc911x.h>
46 46
47#include "board-flash.h" 47#include "board-flash.h"
48#include "mux.h" 48#include "mux.h"
49#include "hsmmc.h" 49#include "hsmmc.h"
50#include "control.h" 50#include "control.h"
51#include "common-board-devices.h"
51 52
52#define LDP_SMSC911X_CS 1 53#define LDP_SMSC911X_CS 1
53#define LDP_SMSC911X_GPIO 152 54#define LDP_SMSC911X_GPIO 152
54#define DEBUG_BASE 0x08000000 55#define DEBUG_BASE 0x08000000
55#define LDP_ETHR_START DEBUG_BASE 56#define LDP_ETHR_START DEBUG_BASE
56 57
57static struct resource ldp_smsc911x_resources[] = {
58 [0] = {
59 .start = LDP_ETHR_START,
60 .end = LDP_ETHR_START + SZ_4K,
61 .flags = IORESOURCE_MEM,
62 },
63 [1] = {
64 .start = 0,
65 .end = 0,
66 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
67 },
68};
69
70static struct smsc911x_platform_config ldp_smsc911x_config = {
71 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
72 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
73 .flags = SMSC911X_USE_32BIT,
74 .phy_interface = PHY_INTERFACE_MODE_MII,
75};
76
77static struct platform_device ldp_smsc911x_device = {
78 .name = "smsc911x",
79 .id = -1,
80 .num_resources = ARRAY_SIZE(ldp_smsc911x_resources),
81 .resource = ldp_smsc911x_resources,
82 .dev = {
83 .platform_data = &ldp_smsc911x_config,
84 },
85};
86
87static uint32_t board_keymap[] = { 58static uint32_t board_keymap[] = {
88 KEY(0, 0, KEY_1), 59 KEY(0, 0, KEY_1),
89 KEY(1, 0, KEY_2), 60 KEY(1, 0, KEY_2),
@@ -197,82 +168,16 @@ static struct platform_device ldp_gpio_keys_device = {
197 }, 168 },
198}; 169};
199 170
200static int ts_gpio; 171static struct omap_smsc911x_platform_data smsc911x_cfg = {
201 172 .cs = LDP_SMSC911X_CS,
202/** 173 .gpio_irq = LDP_SMSC911X_GPIO,
203 * @brief ads7846_dev_init : Requests & sets GPIO line for pen-irq 174 .gpio_reset = -EINVAL,
204 * 175 .flags = SMSC911X_USE_32BIT,
205 * @return - void. If request gpio fails then Flag KERN_ERR.
206 */
207static void ads7846_dev_init(void)
208{
209 if (gpio_request(ts_gpio, "ads7846 irq") < 0) {
210 printk(KERN_ERR "can't get ads746 pen down GPIO\n");
211 return;
212 }
213
214 gpio_direction_input(ts_gpio);
215 gpio_set_debounce(ts_gpio, 310);
216}
217
218static int ads7846_get_pendown_state(void)
219{
220 return !gpio_get_value(ts_gpio);
221}
222
223static struct ads7846_platform_data tsc2046_config __initdata = {
224 .get_pendown_state = ads7846_get_pendown_state,
225 .keep_vref_on = 1,
226};
227
228static struct omap2_mcspi_device_config tsc2046_mcspi_config = {
229 .turbo_mode = 0,
230 .single_channel = 1, /* 0: slave, 1: master */
231};
232
233static struct spi_board_info ldp_spi_board_info[] __initdata = {
234 [0] = {
235 /*
236 * TSC2046 operates at a max freqency of 2MHz, so
237 * operate slightly below at 1.5MHz
238 */
239 .modalias = "ads7846",
240 .bus_num = 1,
241 .chip_select = 0,
242 .max_speed_hz = 1500000,
243 .controller_data = &tsc2046_mcspi_config,
244 .irq = 0,
245 .platform_data = &tsc2046_config,
246 },
247}; 176};
248 177
249static inline void __init ldp_init_smsc911x(void) 178static inline void __init ldp_init_smsc911x(void)
250{ 179{
251 int eth_cs; 180 gpmc_smsc911x_init(&smsc911x_cfg);
252 unsigned long cs_mem_base;
253 int eth_gpio = 0;
254
255 eth_cs = LDP_SMSC911X_CS;
256
257 if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
258 printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n");
259 return;
260 }
261
262 ldp_smsc911x_resources[0].start = cs_mem_base + 0x0;
263 ldp_smsc911x_resources[0].end = cs_mem_base + 0xff;
264 udelay(100);
265
266 eth_gpio = LDP_SMSC911X_GPIO;
267
268 ldp_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
269
270 if (gpio_request(eth_gpio, "smsc911x irq") < 0) {
271 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
272 eth_gpio);
273 return;
274 }
275 gpio_direction_input(eth_gpio);
276} 181}
277 182
278static struct platform_device ldp_lcd_device = { 183static struct platform_device ldp_lcd_device = {
@@ -360,19 +265,9 @@ static struct twl4030_platform_data ldp_twldata = {
360 .keypad = &ldp_kp_twl4030_data, 265 .keypad = &ldp_kp_twl4030_data,
361}; 266};
362 267
363static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = {
364 {
365 I2C_BOARD_INFO("twl4030", 0x48),
366 .flags = I2C_CLIENT_WAKE,
367 .irq = INT_34XX_SYS_NIRQ,
368 .platform_data = &ldp_twldata,
369 },
370};
371
372static int __init omap_i2c_init(void) 268static int __init omap_i2c_init(void)
373{ 269{
374 omap_register_i2c_bus(1, 2600, ldp_i2c_boardinfo, 270 omap3_pmic_init("twl4030", &ldp_twldata);
375 ARRAY_SIZE(ldp_i2c_boardinfo));
376 omap_register_i2c_bus(2, 400, NULL, 0); 271 omap_register_i2c_bus(2, 400, NULL, 0);
377 omap_register_i2c_bus(3, 400, NULL, 0); 272 omap_register_i2c_bus(3, 400, NULL, 0);
378 return 0; 273 return 0;
@@ -389,7 +284,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = {
389}; 284};
390 285
391static struct platform_device *ldp_devices[] __initdata = { 286static struct platform_device *ldp_devices[] __initdata = {
392 &ldp_smsc911x_device,
393 &ldp_lcd_device, 287 &ldp_lcd_device,
394 &ldp_gpio_keys_device, 288 &ldp_gpio_keys_device,
395}; 289};
@@ -400,12 +294,6 @@ static struct omap_board_mux board_mux[] __initdata = {
400}; 294};
401#endif 295#endif
402 296
403static struct omap_musb_board_data musb_board_data = {
404 .interface_type = MUSB_INTERFACE_ULPI,
405 .mode = MUSB_OTG,
406 .power = 100,
407};
408
409static struct mtd_partition ldp_nand_partitions[] = { 297static struct mtd_partition ldp_nand_partitions[] = {
410 /* All the partition sizes are listed in terms of NAND block size */ 298 /* All the partition sizes are listed in terms of NAND block size */
411 { 299 {
@@ -446,13 +334,9 @@ static void __init omap_ldp_init(void)
446 ldp_init_smsc911x(); 334 ldp_init_smsc911x();
447 omap_i2c_init(); 335 omap_i2c_init();
448 platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices)); 336 platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices));
449 ts_gpio = 54; 337 omap_ads7846_init(1, 54, 310, NULL);
450 ldp_spi_board_info[0].irq = gpio_to_irq(ts_gpio);
451 spi_register_board_info(ldp_spi_board_info,
452 ARRAY_SIZE(ldp_spi_board_info));
453 ads7846_dev_init();
454 omap_serial_init(); 338 omap_serial_init();
455 usb_musb_init(&musb_board_data); 339 usb_musb_init(NULL);
456 board_nand_init(ldp_nand_partitions, 340 board_nand_init(ldp_nand_partitions,
457 ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0); 341 ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0);
458 342
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index e710cd9e079b..8d74318ed495 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -106,14 +106,13 @@ static void __init n8x0_usb_init(void)
106 static char announce[] __initdata = KERN_INFO "TUSB 6010\n"; 106 static char announce[] __initdata = KERN_INFO "TUSB 6010\n";
107 107
108 /* PM companion chip power control pin */ 108 /* PM companion chip power control pin */
109 ret = gpio_request(TUSB6010_GPIO_ENABLE, "TUSB6010 enable"); 109 ret = gpio_request_one(TUSB6010_GPIO_ENABLE, GPIOF_OUT_INIT_LOW,
110 "TUSB6010 enable");
110 if (ret != 0) { 111 if (ret != 0) {
111 printk(KERN_ERR "Could not get TUSB power GPIO%i\n", 112 printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
112 TUSB6010_GPIO_ENABLE); 113 TUSB6010_GPIO_ENABLE);
113 return; 114 return;
114 } 115 }
115 gpio_direction_output(TUSB6010_GPIO_ENABLE, 0);
116
117 tusb_set_power(0); 116 tusb_set_power(0);
118 117
119 ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2, 118 ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2,
@@ -494,8 +493,12 @@ static struct omap_mmc_platform_data mmc1_data = {
494 493
495static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC]; 494static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC];
496 495
497static void __init n8x0_mmc_init(void) 496static struct gpio n810_emmc_gpios[] __initdata = {
497 { N810_EMMC_VSD_GPIO, GPIOF_OUT_INIT_LOW, "MMC slot 2 Vddf" },
498 { N810_EMMC_VIO_GPIO, GPIOF_OUT_INIT_LOW, "MMC slot 2 Vdd" },
499};
498 500
501static void __init n8x0_mmc_init(void)
499{ 502{
500 int err; 503 int err;
501 504
@@ -512,27 +515,18 @@ static void __init n8x0_mmc_init(void)
512 mmc1_data.slots[1].ban_openended = 1; 515 mmc1_data.slots[1].ban_openended = 1;
513 } 516 }
514 517
515 err = gpio_request(N8X0_SLOT_SWITCH_GPIO, "MMC slot switch"); 518 err = gpio_request_one(N8X0_SLOT_SWITCH_GPIO, GPIOF_OUT_INIT_LOW,
519 "MMC slot switch");
516 if (err) 520 if (err)
517 return; 521 return;
518 522
519 gpio_direction_output(N8X0_SLOT_SWITCH_GPIO, 0);
520
521 if (machine_is_nokia_n810()) { 523 if (machine_is_nokia_n810()) {
522 err = gpio_request(N810_EMMC_VSD_GPIO, "MMC slot 2 Vddf"); 524 err = gpio_request_array(n810_emmc_gpios,
523 if (err) { 525 ARRAY_SIZE(n810_emmc_gpios));
524 gpio_free(N8X0_SLOT_SWITCH_GPIO);
525 return;
526 }
527 gpio_direction_output(N810_EMMC_VSD_GPIO, 0);
528
529 err = gpio_request(N810_EMMC_VIO_GPIO, "MMC slot 2 Vdd");
530 if (err) { 526 if (err) {
531 gpio_free(N8X0_SLOT_SWITCH_GPIO); 527 gpio_free(N8X0_SLOT_SWITCH_GPIO);
532 gpio_free(N810_EMMC_VSD_GPIO);
533 return; 528 return;
534 } 529 }
535 gpio_direction_output(N810_EMMC_VIO_GPIO, 0);
536 } 530 }
537 531
538 mmc_data[0] = &mmc1_data; 532 mmc_data[0] = &mmc1_data;
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 33007fd4a083..3ff3a2c4b86e 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -52,6 +52,7 @@
52#include "hsmmc.h" 52#include "hsmmc.h"
53#include "timer-gp.h" 53#include "timer-gp.h"
54#include "pm.h" 54#include "pm.h"
55#include "common-board-devices.h"
55 56
56#define NAND_BLOCK_SIZE SZ_128K 57#define NAND_BLOCK_SIZE SZ_128K
57 58
@@ -79,6 +80,12 @@ static u8 omap3_beagle_get_rev(void)
79 return omap3_beagle_version; 80 return omap3_beagle_version;
80} 81}
81 82
83static struct gpio omap3_beagle_rev_gpios[] __initdata = {
84 { 171, GPIOF_IN, "rev_id_0" },
85 { 172, GPIOF_IN, "rev_id_1" },
86 { 173, GPIOF_IN, "rev_id_2" },
87};
88
82static void __init omap3_beagle_init_rev(void) 89static void __init omap3_beagle_init_rev(void)
83{ 90{
84 int ret; 91 int ret;
@@ -88,21 +95,13 @@ static void __init omap3_beagle_init_rev(void)
88 omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP); 95 omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP);
89 omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP); 96 omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP);
90 97
91 ret = gpio_request(171, "rev_id_0"); 98 ret = gpio_request_array(omap3_beagle_rev_gpios,
92 if (ret < 0) 99 ARRAY_SIZE(omap3_beagle_rev_gpios));
93 goto fail0; 100 if (ret < 0) {
94 101 printk(KERN_ERR "Unable to get revision detection GPIO pins\n");
95 ret = gpio_request(172, "rev_id_1"); 102 omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
96 if (ret < 0) 103 return;
97 goto fail1; 104 }
98
99 ret = gpio_request(173, "rev_id_2");
100 if (ret < 0)
101 goto fail2;
102
103 gpio_direction_input(171);
104 gpio_direction_input(172);
105 gpio_direction_input(173);
106 105
107 beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1) 106 beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1)
108 | (gpio_get_value(173) << 2); 107 | (gpio_get_value(173) << 2);
@@ -128,18 +127,6 @@ static void __init omap3_beagle_init_rev(void)
128 printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev); 127 printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev);
129 omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; 128 omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
130 } 129 }
131
132 return;
133
134fail2:
135 gpio_free(172);
136fail1:
137 gpio_free(171);
138fail0:
139 printk(KERN_ERR "Unable to get revision detection GPIO pins\n");
140 omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
141
142 return;
143} 130}
144 131
145static struct mtd_partition omap3beagle_nand_partitions[] = { 132static struct mtd_partition omap3beagle_nand_partitions[] = {
@@ -173,15 +160,6 @@ static struct mtd_partition omap3beagle_nand_partitions[] = {
173 }, 160 },
174}; 161};
175 162
176static struct omap_nand_platform_data omap3beagle_nand_data = {
177 .options = NAND_BUSWIDTH_16,
178 .parts = omap3beagle_nand_partitions,
179 .nr_parts = ARRAY_SIZE(omap3beagle_nand_partitions),
180 .dma_channel = -1, /* disable DMA in OMAP NAND driver */
181 .nand_setup = NULL,
182 .dev_ready = NULL,
183};
184
185/* DSS */ 163/* DSS */
186 164
187static int beagle_enable_dvi(struct omap_dss_device *dssdev) 165static int beagle_enable_dvi(struct omap_dss_device *dssdev)
@@ -243,13 +221,10 @@ static void __init beagle_display_init(void)
243{ 221{
244 int r; 222 int r;
245 223
246 r = gpio_request(beagle_dvi_device.reset_gpio, "DVI reset"); 224 r = gpio_request_one(beagle_dvi_device.reset_gpio, GPIOF_OUT_INIT_LOW,
247 if (r < 0) { 225 "DVI reset");
226 if (r < 0)
248 printk(KERN_ERR "Unable to get DVI reset GPIO\n"); 227 printk(KERN_ERR "Unable to get DVI reset GPIO\n");
249 return;
250 }
251
252 gpio_direction_output(beagle_dvi_device.reset_gpio, 0);
253} 228}
254 229
255#include "sdram-micron-mt46h32m32lf-6.h" 230#include "sdram-micron-mt46h32m32lf-6.h"
@@ -276,7 +251,7 @@ static struct gpio_led gpio_leds[];
276static int beagle_twl_gpio_setup(struct device *dev, 251static int beagle_twl_gpio_setup(struct device *dev,
277 unsigned gpio, unsigned ngpio) 252 unsigned gpio, unsigned ngpio)
278{ 253{
279 int r; 254 int r, usb_pwr_level;
280 255
281 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { 256 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) {
282 mmc[0].gpio_wp = -EINVAL; 257 mmc[0].gpio_wp = -EINVAL;
@@ -295,66 +270,46 @@ static int beagle_twl_gpio_setup(struct device *dev,
295 beagle_vmmc1_supply.dev = mmc[0].dev; 270 beagle_vmmc1_supply.dev = mmc[0].dev;
296 beagle_vsim_supply.dev = mmc[0].dev; 271 beagle_vsim_supply.dev = mmc[0].dev;
297 272
298 /* REVISIT: need ehci-omap hooks for external VBUS
299 * power switch and overcurrent detect
300 */
301 if (omap3_beagle_get_rev() != OMAP3BEAGLE_BOARD_XM) {
302 r = gpio_request(gpio + 1, "EHCI_nOC");
303 if (!r) {
304 r = gpio_direction_input(gpio + 1);
305 if (r)
306 gpio_free(gpio + 1);
307 }
308 if (r)
309 pr_err("%s: unable to configure EHCI_nOC\n", __func__);
310 }
311
312 /* 273 /*
313 * TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, XM active 274 * TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, XM active
314 * high / others active low) 275 * high / others active low)
315 */ 276 * DVI reset GPIO is different between beagle revisions
316 gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR");
317 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM)
318 gpio_direction_output(gpio + TWL4030_GPIO_MAX, 1);
319 else
320 gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
321
322 /* DVI reset GPIO is different between beagle revisions */
323 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM)
324 beagle_dvi_device.reset_gpio = 129;
325 else
326 beagle_dvi_device.reset_gpio = 170;
327
328 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
329 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
330
331 /*
332 * gpio + 1 on Xm controls the TFP410's enable line (active low)
333 * gpio + 2 control varies depending on the board rev as follows:
334 * P7/P8 revisions(prototype): Camera EN
335 * A2+ revisions (production): LDO (supplies DVI, serial, led blocks)
336 */ 277 */
337 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { 278 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) {
338 r = gpio_request(gpio + 1, "nDVI_PWR_EN"); 279 usb_pwr_level = GPIOF_OUT_INIT_HIGH;
339 if (!r) { 280 beagle_dvi_device.reset_gpio = 129;
340 r = gpio_direction_output(gpio + 1, 0); 281 /*
341 if (r) 282 * gpio + 1 on Xm controls the TFP410's enable line (active low)
342 gpio_free(gpio + 1); 283 * gpio + 2 control varies depending on the board rev as below:
343 } 284 * P7/P8 revisions(prototype): Camera EN
285 * A2+ revisions (production): LDO (DVI, serial, led blocks)
286 */
287 r = gpio_request_one(gpio + 1, GPIOF_OUT_INIT_LOW,
288 "nDVI_PWR_EN");
344 if (r) 289 if (r)
345 pr_err("%s: unable to configure nDVI_PWR_EN\n", 290 pr_err("%s: unable to configure nDVI_PWR_EN\n",
346 __func__); 291 __func__);
347 r = gpio_request(gpio + 2, "DVI_LDO_EN"); 292 r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
348 if (!r) { 293 "DVI_LDO_EN");
349 r = gpio_direction_output(gpio + 2, 1);
350 if (r)
351 gpio_free(gpio + 2);
352 }
353 if (r) 294 if (r)
354 pr_err("%s: unable to configure DVI_LDO_EN\n", 295 pr_err("%s: unable to configure DVI_LDO_EN\n",
355 __func__); 296 __func__);
297 } else {
298 usb_pwr_level = GPIOF_OUT_INIT_LOW;
299 beagle_dvi_device.reset_gpio = 170;
300 /*
301 * REVISIT: need ehci-omap hooks for external VBUS
302 * power switch and overcurrent detect
303 */
304 if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
305 pr_err("%s: unable to configure EHCI_nOC\n", __func__);
356 } 306 }
357 307
308 gpio_request_one(gpio + TWL4030_GPIO_MAX, usb_pwr_level, "nEN_USB_PWR");
309
310 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
311 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
312
358 return 0; 313 return 0;
359} 314}
360 315
@@ -453,15 +408,6 @@ static struct twl4030_platform_data beagle_twldata = {
453 .vpll2 = &beagle_vpll2, 408 .vpll2 = &beagle_vpll2,
454}; 409};
455 410
456static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
457 {
458 I2C_BOARD_INFO("twl4030", 0x48),
459 .flags = I2C_CLIENT_WAKE,
460 .irq = INT_34XX_SYS_NIRQ,
461 .platform_data = &beagle_twldata,
462 },
463};
464
465static struct i2c_board_info __initdata beagle_i2c_eeprom[] = { 411static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {
466 { 412 {
467 I2C_BOARD_INFO("eeprom", 0x50), 413 I2C_BOARD_INFO("eeprom", 0x50),
@@ -470,8 +416,7 @@ static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {
470 416
471static int __init omap3_beagle_i2c_init(void) 417static int __init omap3_beagle_i2c_init(void)
472{ 418{
473 omap_register_i2c_bus(1, 2600, beagle_i2c_boardinfo, 419 omap3_pmic_init("twl4030", &beagle_twldata);
474 ARRAY_SIZE(beagle_i2c_boardinfo));
475 /* Bus 3 is attached to the DVI port where devices like the pico DLP 420 /* Bus 3 is attached to the DVI port where devices like the pico DLP
476 * projector don't work reliably with 400kHz */ 421 * projector don't work reliably with 400kHz */
477 omap_register_i2c_bus(3, 100, beagle_i2c_eeprom, ARRAY_SIZE(beagle_i2c_eeprom)); 422 omap_register_i2c_bus(3, 100, beagle_i2c_eeprom, ARRAY_SIZE(beagle_i2c_eeprom));
@@ -551,39 +496,6 @@ static struct platform_device *omap3_beagle_devices[] __initdata = {
551 &keys_gpio, 496 &keys_gpio,
552}; 497};
553 498
554static void __init omap3beagle_flash_init(void)
555{
556 u8 cs = 0;
557 u8 nandcs = GPMC_CS_NUM + 1;
558
559 /* find out the chip-select on which NAND exists */
560 while (cs < GPMC_CS_NUM) {
561 u32 ret = 0;
562 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
563
564 if ((ret & 0xC00) == 0x800) {
565 printk(KERN_INFO "Found NAND on CS%d\n", cs);
566 if (nandcs > GPMC_CS_NUM)
567 nandcs = cs;
568 }
569 cs++;
570 }
571
572 if (nandcs > GPMC_CS_NUM) {
573 printk(KERN_INFO "NAND: Unable to find configuration "
574 "in GPMC\n ");
575 return;
576 }
577
578 if (nandcs < GPMC_CS_NUM) {
579 omap3beagle_nand_data.cs = nandcs;
580
581 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
582 if (gpmc_nand_init(&omap3beagle_nand_data) < 0)
583 printk(KERN_ERR "Unable to register NAND device\n");
584 }
585}
586
587static const struct usbhs_omap_board_data usbhs_bdata __initconst = { 499static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
588 500
589 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 501 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
@@ -602,12 +514,6 @@ static struct omap_board_mux board_mux[] __initdata = {
602}; 514};
603#endif 515#endif
604 516
605static struct omap_musb_board_data musb_board_data = {
606 .interface_type = MUSB_INTERFACE_ULPI,
607 .mode = MUSB_OTG,
608 .power = 100,
609};
610
611static void __init beagle_opp_init(void) 517static void __init beagle_opp_init(void)
612{ 518{
613 int r = 0; 519 int r = 0;
@@ -665,13 +571,13 @@ static void __init omap3_beagle_init(void)
665 omap_serial_init(); 571 omap_serial_init();
666 572
667 omap_mux_init_gpio(170, OMAP_PIN_INPUT); 573 omap_mux_init_gpio(170, OMAP_PIN_INPUT);
668 gpio_request(170, "DVI_nPD");
669 /* REVISIT leave DVI powered down until it's needed ... */ 574 /* REVISIT leave DVI powered down until it's needed ... */
670 gpio_direction_output(170, true); 575 gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD");
671 576
672 usb_musb_init(&musb_board_data); 577 usb_musb_init(NULL);
673 usbhs_init(&usbhs_bdata); 578 usbhs_init(&usbhs_bdata);
674 omap3beagle_flash_init(); 579 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions,
580 ARRAY_SIZE(omap3beagle_nand_partitions));
675 581
676 /* Ensure SDRC pins are mux'd for self-refresh */ 582 /* Ensure SDRC pins are mux'd for self-refresh */
677 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 583 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 5a1a916e5cc8..02e1ad29e1e8 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -50,6 +50,7 @@
50#include "mux.h" 50#include "mux.h"
51#include "sdram-micron-mt46h32m32lf-6.h" 51#include "sdram-micron-mt46h32m32lf-6.h"
52#include "hsmmc.h" 52#include "hsmmc.h"
53#include "common-board-devices.h"
53 54
54#define OMAP3_EVM_TS_GPIO 175 55#define OMAP3_EVM_TS_GPIO 175
55#define OMAP3_EVM_EHCI_VBUS 22 56#define OMAP3_EVM_EHCI_VBUS 22
@@ -101,49 +102,20 @@ static void __init omap3_evm_get_revision(void)
101} 102}
102 103
103#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 104#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
104static struct resource omap3evm_smsc911x_resources[] = { 105#include <plat/gpmc-smsc911x.h>
105 [0] = {
106 .start = OMAP3EVM_ETHR_START,
107 .end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1),
108 .flags = IORESOURCE_MEM,
109 },
110 [1] = {
111 .start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
112 .end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
113 .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW),
114 },
115};
116 106
117static struct smsc911x_platform_config smsc911x_config = { 107static struct omap_smsc911x_platform_data smsc911x_cfg = {
118 .phy_interface = PHY_INTERFACE_MODE_MII, 108 .cs = OMAP3EVM_SMSC911X_CS,
119 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 109 .gpio_irq = OMAP3EVM_ETHR_GPIO_IRQ,
120 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, 110 .gpio_reset = -EINVAL,
121 .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS), 111 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
122};
123
124static struct platform_device omap3evm_smsc911x_device = {
125 .name = "smsc911x",
126 .id = -1,
127 .num_resources = ARRAY_SIZE(omap3evm_smsc911x_resources),
128 .resource = &omap3evm_smsc911x_resources[0],
129 .dev = {
130 .platform_data = &smsc911x_config,
131 },
132}; 112};
133 113
134static inline void __init omap3evm_init_smsc911x(void) 114static inline void __init omap3evm_init_smsc911x(void)
135{ 115{
136 int eth_cs, eth_rst;
137 struct clk *l3ck; 116 struct clk *l3ck;
138 unsigned int rate; 117 unsigned int rate;
139 118
140 if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1)
141 eth_rst = OMAP3EVM_GEN1_ETHR_GPIO_RST;
142 else
143 eth_rst = OMAP3EVM_GEN2_ETHR_GPIO_RST;
144
145 eth_cs = OMAP3EVM_SMSC911X_CS;
146
147 l3ck = clk_get(NULL, "l3_ck"); 119 l3ck = clk_get(NULL, "l3_ck");
148 if (IS_ERR(l3ck)) 120 if (IS_ERR(l3ck))
149 rate = 100000000; 121 rate = 100000000;
@@ -152,33 +124,13 @@ static inline void __init omap3evm_init_smsc911x(void)
152 124
153 /* Configure ethernet controller reset gpio */ 125 /* Configure ethernet controller reset gpio */
154 if (cpu_is_omap3430()) { 126 if (cpu_is_omap3430()) {
155 if (gpio_request(eth_rst, "SMSC911x gpio") < 0) { 127 if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1)
156 pr_err(KERN_ERR "Failed to request %d for smsc911x\n", 128 smsc911x_cfg.gpio_reset = OMAP3EVM_GEN1_ETHR_GPIO_RST;
157 eth_rst); 129 else
158 return; 130 smsc911x_cfg.gpio_reset = OMAP3EVM_GEN2_ETHR_GPIO_RST;
159 }
160
161 if (gpio_direction_output(eth_rst, 1) < 0) {
162 pr_err(KERN_ERR "Failed to set direction of %d for" \
163 " smsc911x\n", eth_rst);
164 return;
165 }
166 /* reset pulse to ethernet controller*/
167 usleep_range(150, 220);
168 gpio_set_value(eth_rst, 0);
169 usleep_range(150, 220);
170 gpio_set_value(eth_rst, 1);
171 usleep_range(1, 2);
172 }
173
174 if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) {
175 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
176 OMAP3EVM_ETHR_GPIO_IRQ);
177 return;
178 } 131 }
179 132
180 gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ); 133 gpmc_smsc911x_init(&smsc911x_cfg);
181 platform_device_register(&omap3evm_smsc911x_device);
182} 134}
183 135
184#else 136#else
@@ -197,6 +149,15 @@ static inline void __init omap3evm_init_smsc911x(void) { return; }
197#define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210 149#define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210
198#define OMAP3EVM_DVI_PANEL_EN_GPIO 199 150#define OMAP3EVM_DVI_PANEL_EN_GPIO 199
199 151
152static struct gpio omap3_evm_dss_gpios[] __initdata = {
153 { OMAP3EVM_LCD_PANEL_RESB, GPIOF_OUT_INIT_HIGH, "lcd_panel_resb" },
154 { OMAP3EVM_LCD_PANEL_INI, GPIOF_OUT_INIT_HIGH, "lcd_panel_ini" },
155 { OMAP3EVM_LCD_PANEL_QVGA, GPIOF_OUT_INIT_LOW, "lcd_panel_qvga" },
156 { OMAP3EVM_LCD_PANEL_LR, GPIOF_OUT_INIT_HIGH, "lcd_panel_lr" },
157 { OMAP3EVM_LCD_PANEL_UD, GPIOF_OUT_INIT_HIGH, "lcd_panel_ud" },
158 { OMAP3EVM_LCD_PANEL_ENVDD, GPIOF_OUT_INIT_LOW, "lcd_panel_envdd" },
159};
160
200static int lcd_enabled; 161static int lcd_enabled;
201static int dvi_enabled; 162static int dvi_enabled;
202 163
@@ -204,61 +165,10 @@ static void __init omap3_evm_display_init(void)
204{ 165{
205 int r; 166 int r;
206 167
207 r = gpio_request(OMAP3EVM_LCD_PANEL_RESB, "lcd_panel_resb"); 168 r = gpio_request_array(omap3_evm_dss_gpios,
208 if (r) { 169 ARRAY_SIZE(omap3_evm_dss_gpios));
209 printk(KERN_ERR "failed to get lcd_panel_resb\n"); 170 if (r)
210 return; 171 printk(KERN_ERR "failed to get lcd_panel_* gpios\n");
211 }
212 gpio_direction_output(OMAP3EVM_LCD_PANEL_RESB, 1);
213
214 r = gpio_request(OMAP3EVM_LCD_PANEL_INI, "lcd_panel_ini");
215 if (r) {
216 printk(KERN_ERR "failed to get lcd_panel_ini\n");
217 goto err_1;
218 }
219 gpio_direction_output(OMAP3EVM_LCD_PANEL_INI, 1);
220
221 r = gpio_request(OMAP3EVM_LCD_PANEL_QVGA, "lcd_panel_qvga");
222 if (r) {
223 printk(KERN_ERR "failed to get lcd_panel_qvga\n");
224 goto err_2;
225 }
226 gpio_direction_output(OMAP3EVM_LCD_PANEL_QVGA, 0);
227
228 r = gpio_request(OMAP3EVM_LCD_PANEL_LR, "lcd_panel_lr");
229 if (r) {
230 printk(KERN_ERR "failed to get lcd_panel_lr\n");
231 goto err_3;
232 }
233 gpio_direction_output(OMAP3EVM_LCD_PANEL_LR, 1);
234
235 r = gpio_request(OMAP3EVM_LCD_PANEL_UD, "lcd_panel_ud");
236 if (r) {
237 printk(KERN_ERR "failed to get lcd_panel_ud\n");
238 goto err_4;
239 }
240 gpio_direction_output(OMAP3EVM_LCD_PANEL_UD, 1);
241
242 r = gpio_request(OMAP3EVM_LCD_PANEL_ENVDD, "lcd_panel_envdd");
243 if (r) {
244 printk(KERN_ERR "failed to get lcd_panel_envdd\n");
245 goto err_5;
246 }
247 gpio_direction_output(OMAP3EVM_LCD_PANEL_ENVDD, 0);
248
249 return;
250
251err_5:
252 gpio_free(OMAP3EVM_LCD_PANEL_UD);
253err_4:
254 gpio_free(OMAP3EVM_LCD_PANEL_LR);
255err_3:
256 gpio_free(OMAP3EVM_LCD_PANEL_QVGA);
257err_2:
258 gpio_free(OMAP3EVM_LCD_PANEL_INI);
259err_1:
260 gpio_free(OMAP3EVM_LCD_PANEL_RESB);
261
262} 172}
263 173
264static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev) 174static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev)
@@ -448,7 +358,7 @@ static struct platform_device leds_gpio = {
448static int omap3evm_twl_gpio_setup(struct device *dev, 358static int omap3evm_twl_gpio_setup(struct device *dev,
449 unsigned gpio, unsigned ngpio) 359 unsigned gpio, unsigned ngpio)
450{ 360{
451 int r; 361 int r, lcd_bl_en;
452 362
453 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 363 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
454 omap_mux_init_gpio(63, OMAP_PIN_INPUT); 364 omap_mux_init_gpio(63, OMAP_PIN_INPUT);
@@ -465,16 +375,14 @@ static int omap3evm_twl_gpio_setup(struct device *dev,
465 */ 375 */
466 376
467 /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ 377 /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */
468 r = gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL"); 378 lcd_bl_en = get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2 ?
469 if (!r) 379 GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
470 r = gpio_direction_output(gpio + TWL4030_GPIO_MAX, 380 r = gpio_request_one(gpio + TWL4030_GPIO_MAX, lcd_bl_en, "EN_LCD_BKL");
471 (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) ? 1 : 0);
472 if (r) 381 if (r)
473 printk(KERN_ERR "failed to get/set lcd_bkl gpio\n"); 382 printk(KERN_ERR "failed to get/set lcd_bkl gpio\n");
474 383
475 /* gpio + 7 == DVI Enable */ 384 /* gpio + 7 == DVI Enable */
476 gpio_request(gpio + 7, "EN_DVI"); 385 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI");
477 gpio_direction_output(gpio + 7, 0);
478 386
479 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ 387 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
480 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 388 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -652,78 +560,18 @@ static struct twl4030_platform_data omap3evm_twldata = {
652 .vdac = &omap3_evm_vdac, 560 .vdac = &omap3_evm_vdac,
653 .vpll2 = &omap3_evm_vpll2, 561 .vpll2 = &omap3_evm_vpll2,
654 .vio = &omap3evm_vio, 562 .vio = &omap3evm_vio,
655}; 563 .vmmc1 = &omap3evm_vmmc1,
656 564 .vsim = &omap3evm_vsim,
657static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = {
658 {
659 I2C_BOARD_INFO("twl4030", 0x48),
660 .flags = I2C_CLIENT_WAKE,
661 .irq = INT_34XX_SYS_NIRQ,
662 .platform_data = &omap3evm_twldata,
663 },
664}; 565};
665 566
666static int __init omap3_evm_i2c_init(void) 567static int __init omap3_evm_i2c_init(void)
667{ 568{
668 /* 569 omap3_pmic_init("twl4030", &omap3evm_twldata);
669 * REVISIT: These entries can be set in omap3evm_twl_data
670 * after a merge with MFD tree
671 */
672 omap3evm_twldata.vmmc1 = &omap3evm_vmmc1;
673 omap3evm_twldata.vsim = &omap3evm_vsim;
674
675 omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo,
676 ARRAY_SIZE(omap3evm_i2c_boardinfo));
677 omap_register_i2c_bus(2, 400, NULL, 0); 570 omap_register_i2c_bus(2, 400, NULL, 0);
678 omap_register_i2c_bus(3, 400, NULL, 0); 571 omap_register_i2c_bus(3, 400, NULL, 0);
679 return 0; 572 return 0;
680} 573}
681 574
682static void ads7846_dev_init(void)
683{
684 if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0)
685 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
686
687 gpio_direction_input(OMAP3_EVM_TS_GPIO);
688 gpio_set_debounce(OMAP3_EVM_TS_GPIO, 310);
689}
690
691static int ads7846_get_pendown_state(void)
692{
693 return !gpio_get_value(OMAP3_EVM_TS_GPIO);
694}
695
696static struct ads7846_platform_data ads7846_config = {
697 .x_max = 0x0fff,
698 .y_max = 0x0fff,
699 .x_plate_ohms = 180,
700 .pressure_max = 255,
701 .debounce_max = 10,
702 .debounce_tol = 3,
703 .debounce_rep = 1,
704 .get_pendown_state = ads7846_get_pendown_state,
705 .keep_vref_on = 1,
706 .settle_delay_usecs = 150,
707 .wakeup = true,
708};
709
710static struct omap2_mcspi_device_config ads7846_mcspi_config = {
711 .turbo_mode = 0,
712 .single_channel = 1, /* 0: slave, 1: master */
713};
714
715static struct spi_board_info omap3evm_spi_board_info[] = {
716 [0] = {
717 .modalias = "ads7846",
718 .bus_num = 1,
719 .chip_select = 0,
720 .max_speed_hz = 1500000,
721 .controller_data = &ads7846_mcspi_config,
722 .irq = OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO),
723 .platform_data = &ads7846_config,
724 },
725};
726
727static struct omap_board_config_kernel omap3_evm_config[] __initdata = { 575static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
728}; 576};
729 577
@@ -825,6 +673,11 @@ static struct omap_musb_board_data musb_board_data = {
825 .power = 100, 673 .power = 100,
826}; 674};
827 675
676static struct gpio omap3_evm_ehci_gpios[] __initdata = {
677 { OMAP3_EVM_EHCI_VBUS, GPIOF_OUT_INIT_HIGH, "enable EHCI VBUS" },
678 { OMAP3_EVM_EHCI_SELECT, GPIOF_OUT_INIT_LOW, "select EHCI port" },
679};
680
828static void __init omap3_evm_init(void) 681static void __init omap3_evm_init(void)
829{ 682{
830 omap3_evm_get_revision(); 683 omap3_evm_get_revision();
@@ -841,9 +694,6 @@ static void __init omap3_evm_init(void)
841 694
842 omap_display_init(&omap3_evm_dss_data); 695 omap_display_init(&omap3_evm_dss_data);
843 696
844 spi_register_board_info(omap3evm_spi_board_info,
845 ARRAY_SIZE(omap3evm_spi_board_info));
846
847 omap_serial_init(); 697 omap_serial_init();
848 698
849 /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */ 699 /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
@@ -851,16 +701,12 @@ static void __init omap3_evm_init(void)
851 701
852 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) { 702 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
853 /* enable EHCI VBUS using GPIO22 */ 703 /* enable EHCI VBUS using GPIO22 */
854 omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP); 704 omap_mux_init_gpio(OMAP3_EVM_EHCI_VBUS, OMAP_PIN_INPUT_PULLUP);
855 gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS");
856 gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0);
857 gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1);
858
859 /* Select EHCI port on main board */ 705 /* Select EHCI port on main board */
860 omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP); 706 omap_mux_init_gpio(OMAP3_EVM_EHCI_SELECT,
861 gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port"); 707 OMAP_PIN_INPUT_PULLUP);
862 gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0); 708 gpio_request_array(omap3_evm_ehci_gpios,
863 gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0); 709 ARRAY_SIZE(omap3_evm_ehci_gpios));
864 710
865 /* setup EHCI phy reset config */ 711 /* setup EHCI phy reset config */
866 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); 712 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
@@ -876,7 +722,7 @@ static void __init omap3_evm_init(void)
876 } 722 }
877 usb_musb_init(&musb_board_data); 723 usb_musb_init(&musb_board_data);
878 usbhs_init(&usbhs_bdata); 724 usbhs_init(&usbhs_bdata);
879 ads7846_dev_init(); 725 omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
880 omap3evm_init_smsc911x(); 726 omap3evm_init_smsc911x();
881 omap3_evm_display_init(); 727 omap3_evm_display_init();
882 728
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index b726943d7c93..60d9be49dbab 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -37,6 +37,7 @@
37#include "hsmmc.h" 37#include "hsmmc.h"
38#include "timer-gp.h" 38#include "timer-gp.h"
39#include "control.h" 39#include "control.h"
40#include "common-board-devices.h"
40 41
41#include <plat/mux.h> 42#include <plat/mux.h>
42#include <plat/board.h> 43#include <plat/board.h>
@@ -93,19 +94,9 @@ static struct twl4030_platform_data omap3logic_twldata = {
93 .vmmc1 = &omap3logic_vmmc1, 94 .vmmc1 = &omap3logic_vmmc1,
94}; 95};
95 96
96static struct i2c_board_info __initdata omap3logic_i2c_boardinfo[] = {
97 {
98 I2C_BOARD_INFO("twl4030", 0x48),
99 .flags = I2C_CLIENT_WAKE,
100 .irq = INT_34XX_SYS_NIRQ,
101 .platform_data = &omap3logic_twldata,
102 },
103};
104
105static int __init omap3logic_i2c_init(void) 97static int __init omap3logic_i2c_init(void)
106{ 98{
107 omap_register_i2c_bus(1, 2600, omap3logic_i2c_boardinfo, 99 omap3_pmic_init("twl4030", &omap3logic_twldata);
108 ARRAY_SIZE(omap3logic_i2c_boardinfo));
109 return 0; 100 return 0;
110} 101}
111 102
@@ -147,7 +138,6 @@ static struct omap_smsc911x_platform_data __initdata board_smsc911x_data = {
147 .cs = OMAP3LOGIC_SMSC911X_CS, 138 .cs = OMAP3LOGIC_SMSC911X_CS,
148 .gpio_irq = -EINVAL, 139 .gpio_irq = -EINVAL,
149 .gpio_reset = -EINVAL, 140 .gpio_reset = -EINVAL,
150 .flags = IORESOURCE_IRQ_LOWLEVEL,
151}; 141};
152 142
153/* TODO/FIXME (comment by Peter Barada, LogicPD): 143/* TODO/FIXME (comment by Peter Barada, LogicPD):
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 07dba888f450..78dd2a7fe6e6 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -22,7 +22,6 @@
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23 23
24#include <linux/spi/spi.h> 24#include <linux/spi/spi.h>
25#include <linux/spi/ads7846.h>
26#include <linux/regulator/machine.h> 25#include <linux/regulator/machine.h>
27#include <linux/i2c/twl.h> 26#include <linux/i2c/twl.h>
28#include <linux/wl12xx.h> 27#include <linux/wl12xx.h>
@@ -52,6 +51,7 @@
52#include "mux.h" 51#include "mux.h"
53#include "sdram-micron-mt46h32m32lf-6.h" 52#include "sdram-micron-mt46h32m32lf-6.h"
54#include "hsmmc.h" 53#include "hsmmc.h"
54#include "common-board-devices.h"
55 55
56#define PANDORA_WIFI_IRQ_GPIO 21 56#define PANDORA_WIFI_IRQ_GPIO 21
57#define PANDORA_WIFI_NRESET_GPIO 23 57#define PANDORA_WIFI_NRESET_GPIO 23
@@ -305,24 +305,13 @@ static int omap3pandora_twl_gpio_setup(struct device *dev,
305 305
306 /* gpio + 13 drives 32kHz buffer for wifi module */ 306 /* gpio + 13 drives 32kHz buffer for wifi module */
307 gpio_32khz = gpio + 13; 307 gpio_32khz = gpio + 13;
308 ret = gpio_request(gpio_32khz, "wifi 32kHz"); 308 ret = gpio_request_one(gpio_32khz, GPIOF_OUT_INIT_HIGH, "wifi 32kHz");
309 if (ret < 0) { 309 if (ret < 0) {
310 pr_err("Cannot get GPIO line %d, ret=%d\n", gpio_32khz, ret); 310 pr_err("Cannot get GPIO line %d, ret=%d\n", gpio_32khz, ret);
311 goto fail; 311 return -ENODEV;
312 }
313
314 ret = gpio_direction_output(gpio_32khz, 1);
315 if (ret < 0) {
316 pr_err("Cannot set GPIO line %d, ret=%d\n", gpio_32khz, ret);
317 goto fail_direction;
318 } 312 }
319 313
320 return 0; 314 return 0;
321
322fail_direction:
323 gpio_free(gpio_32khz);
324fail:
325 return -ENODEV;
326} 315}
327 316
328static struct twl4030_gpio_platform_data omap3pandora_gpio_data = { 317static struct twl4030_gpio_platform_data omap3pandora_gpio_data = {
@@ -544,15 +533,6 @@ static struct twl4030_platform_data omap3pandora_twldata = {
544 .bci = &pandora_bci_data, 533 .bci = &pandora_bci_data,
545}; 534};
546 535
547static struct i2c_board_info __initdata omap3pandora_i2c_boardinfo[] = {
548 {
549 I2C_BOARD_INFO("tps65950", 0x48),
550 .flags = I2C_CLIENT_WAKE,
551 .irq = INT_34XX_SYS_NIRQ,
552 .platform_data = &omap3pandora_twldata,
553 },
554};
555
556static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = { 536static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = {
557 { 537 {
558 I2C_BOARD_INFO("bq27500", 0x55), 538 I2C_BOARD_INFO("bq27500", 0x55),
@@ -562,61 +542,15 @@ static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = {
562 542
563static int __init omap3pandora_i2c_init(void) 543static int __init omap3pandora_i2c_init(void)
564{ 544{
565 omap_register_i2c_bus(1, 2600, omap3pandora_i2c_boardinfo, 545 omap3_pmic_init("tps65950", &omap3pandora_twldata);
566 ARRAY_SIZE(omap3pandora_i2c_boardinfo));
567 /* i2c2 pins are not connected */ 546 /* i2c2 pins are not connected */
568 omap_register_i2c_bus(3, 100, omap3pandora_i2c3_boardinfo, 547 omap_register_i2c_bus(3, 100, omap3pandora_i2c3_boardinfo,
569 ARRAY_SIZE(omap3pandora_i2c3_boardinfo)); 548 ARRAY_SIZE(omap3pandora_i2c3_boardinfo));
570 return 0; 549 return 0;
571} 550}
572 551
573static void __init omap3pandora_ads7846_init(void)
574{
575 int gpio = OMAP3_PANDORA_TS_GPIO;
576 int ret;
577
578 ret = gpio_request(gpio, "ads7846_pen_down");
579 if (ret < 0) {
580 printk(KERN_ERR "Failed to request GPIO %d for "
581 "ads7846 pen down IRQ\n", gpio);
582 return;
583 }
584
585 gpio_direction_input(gpio);
586}
587
588static int ads7846_get_pendown_state(void)
589{
590 return !gpio_get_value(OMAP3_PANDORA_TS_GPIO);
591}
592
593static struct ads7846_platform_data ads7846_config = {
594 .x_max = 0x0fff,
595 .y_max = 0x0fff,
596 .x_plate_ohms = 180,
597 .pressure_max = 255,
598 .debounce_max = 10,
599 .debounce_tol = 3,
600 .debounce_rep = 1,
601 .get_pendown_state = ads7846_get_pendown_state,
602 .keep_vref_on = 1,
603};
604
605static struct omap2_mcspi_device_config ads7846_mcspi_config = {
606 .turbo_mode = 0,
607 .single_channel = 1, /* 0: slave, 1: master */
608};
609
610static struct spi_board_info omap3pandora_spi_board_info[] __initdata = { 552static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
611 { 553 {
612 .modalias = "ads7846",
613 .bus_num = 1,
614 .chip_select = 0,
615 .max_speed_hz = 1500000,
616 .controller_data = &ads7846_mcspi_config,
617 .irq = OMAP_GPIO_IRQ(OMAP3_PANDORA_TS_GPIO),
618 .platform_data = &ads7846_config,
619 }, {
620 .modalias = "tpo_td043mtea1_panel_spi", 554 .modalias = "tpo_td043mtea1_panel_spi",
621 .bus_num = 1, 555 .bus_num = 1,
622 .chip_select = 1, 556 .chip_select = 1,
@@ -639,14 +573,10 @@ static void __init pandora_wl1251_init(void)
639 573
640 memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata)); 574 memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
641 575
642 ret = gpio_request(PANDORA_WIFI_IRQ_GPIO, "wl1251 irq"); 576 ret = gpio_request_one(PANDORA_WIFI_IRQ_GPIO, GPIOF_IN, "wl1251 irq");
643 if (ret < 0) 577 if (ret < 0)
644 goto fail; 578 goto fail;
645 579
646 ret = gpio_direction_input(PANDORA_WIFI_IRQ_GPIO);
647 if (ret < 0)
648 goto fail_irq;
649
650 pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO); 580 pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO);
651 if (pandora_wl1251_pdata.irq < 0) 581 if (pandora_wl1251_pdata.irq < 0)
652 goto fail_irq; 582 goto fail_irq;
@@ -688,12 +618,6 @@ static struct omap_board_mux board_mux[] __initdata = {
688}; 618};
689#endif 619#endif
690 620
691static struct omap_musb_board_data musb_board_data = {
692 .interface_type = MUSB_INTERFACE_ULPI,
693 .mode = MUSB_OTG,
694 .power = 100,
695};
696
697static void __init omap3pandora_init(void) 621static void __init omap3pandora_init(void)
698{ 622{
699 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 623 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
@@ -705,9 +629,9 @@ static void __init omap3pandora_init(void)
705 omap_serial_init(); 629 omap_serial_init();
706 spi_register_board_info(omap3pandora_spi_board_info, 630 spi_register_board_info(omap3pandora_spi_board_info,
707 ARRAY_SIZE(omap3pandora_spi_board_info)); 631 ARRAY_SIZE(omap3pandora_spi_board_info));
708 omap3pandora_ads7846_init(); 632 omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL);
709 usbhs_init(&usbhs_bdata); 633 usbhs_init(&usbhs_bdata);
710 usb_musb_init(&musb_board_data); 634 usb_musb_init(NULL);
711 gpmc_nand_init(&pandora_nand_data); 635 gpmc_nand_init(&pandora_nand_data);
712 636
713 /* Ensure SDRC pins are mux'd for self-refresh */ 637 /* Ensure SDRC pins are mux'd for self-refresh */
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index a6e0b9161c99..085c60a7c47c 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -45,7 +45,6 @@
45#include <plat/mcspi.h> 45#include <plat/mcspi.h>
46#include <linux/input/matrix_keypad.h> 46#include <linux/input/matrix_keypad.h>
47#include <linux/spi/spi.h> 47#include <linux/spi/spi.h>
48#include <linux/spi/ads7846.h>
49#include <linux/interrupt.h> 48#include <linux/interrupt.h>
50#include <linux/smsc911x.h> 49#include <linux/smsc911x.h>
51#include <linux/i2c/at24.h> 50#include <linux/i2c/at24.h>
@@ -54,52 +53,28 @@
54#include "mux.h" 53#include "mux.h"
55#include "hsmmc.h" 54#include "hsmmc.h"
56#include "timer-gp.h" 55#include "timer-gp.h"
56#include "common-board-devices.h"
57 57
58#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 58#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
59#include <plat/gpmc-smsc911x.h>
60
59#define OMAP3STALKER_ETHR_START 0x2c000000 61#define OMAP3STALKER_ETHR_START 0x2c000000
60#define OMAP3STALKER_ETHR_SIZE 1024 62#define OMAP3STALKER_ETHR_SIZE 1024
61#define OMAP3STALKER_ETHR_GPIO_IRQ 19 63#define OMAP3STALKER_ETHR_GPIO_IRQ 19
62#define OMAP3STALKER_SMC911X_CS 5 64#define OMAP3STALKER_SMC911X_CS 5
63 65
64static struct resource omap3stalker_smsc911x_resources[] = { 66static struct omap_smsc911x_platform_data smsc911x_cfg = {
65 [0] = { 67 .cs = OMAP3STALKER_SMC911X_CS,
66 .start = OMAP3STALKER_ETHR_START, 68 .gpio_irq = OMAP3STALKER_ETHR_GPIO_IRQ,
67 .end = 69 .gpio_reset = -EINVAL,
68 (OMAP3STALKER_ETHR_START + OMAP3STALKER_ETHR_SIZE - 1),
69 .flags = IORESOURCE_MEM,
70 },
71 [1] = {
72 .start = OMAP_GPIO_IRQ(OMAP3STALKER_ETHR_GPIO_IRQ),
73 .end = OMAP_GPIO_IRQ(OMAP3STALKER_ETHR_GPIO_IRQ),
74 .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW),
75 },
76};
77
78static struct smsc911x_platform_config smsc911x_config = {
79 .phy_interface = PHY_INTERFACE_MODE_MII,
80 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
81 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
82 .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS), 70 .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS),
83}; 71};
84 72
85static struct platform_device omap3stalker_smsc911x_device = {
86 .name = "smsc911x",
87 .id = -1,
88 .num_resources = ARRAY_SIZE(omap3stalker_smsc911x_resources),
89 .resource = &omap3stalker_smsc911x_resources[0],
90 .dev = {
91 .platform_data = &smsc911x_config,
92 },
93};
94
95static inline void __init omap3stalker_init_eth(void) 73static inline void __init omap3stalker_init_eth(void)
96{ 74{
97 int eth_cs;
98 struct clk *l3ck; 75 struct clk *l3ck;
99 unsigned int rate; 76 unsigned int rate;
100 77
101 eth_cs = OMAP3STALKER_SMC911X_CS;
102
103 l3ck = clk_get(NULL, "l3_ck"); 78 l3ck = clk_get(NULL, "l3_ck");
104 if (IS_ERR(l3ck)) 79 if (IS_ERR(l3ck))
105 rate = 100000000; 80 rate = 100000000;
@@ -107,16 +82,7 @@ static inline void __init omap3stalker_init_eth(void)
107 rate = clk_get_rate(l3ck); 82 rate = clk_get_rate(l3ck);
108 83
109 omap_mux_init_gpio(19, OMAP_PIN_INPUT_PULLUP); 84 omap_mux_init_gpio(19, OMAP_PIN_INPUT_PULLUP);
110 if (gpio_request(OMAP3STALKER_ETHR_GPIO_IRQ, "SMC911x irq") < 0) { 85 gpmc_smsc911x_init(&smsc911x_cfg);
111 printk(KERN_ERR
112 "Failed to request GPIO%d for smc911x IRQ\n",
113 OMAP3STALKER_ETHR_GPIO_IRQ);
114 return;
115 }
116
117 gpio_direction_input(OMAP3STALKER_ETHR_GPIO_IRQ);
118
119 platform_device_register(&omap3stalker_smsc911x_device);
120} 86}
121 87
122#else 88#else
@@ -365,12 +331,11 @@ omap3stalker_twl_gpio_setup(struct device *dev,
365 */ 331 */
366 332
367 /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ 333 /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */
368 gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL"); 334 gpio_request_one(gpio + TWL4030_GPIO_MAX, GPIOF_OUT_INIT_LOW,
369 gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0); 335 "EN_LCD_BKL");
370 336
371 /* gpio + 7 == DVI Enable */ 337 /* gpio + 7 == DVI Enable */
372 gpio_request(gpio + 7, "EN_DVI"); 338 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI");
373 gpio_direction_output(gpio + 7, 0);
374 339
375 /* TWL4030_GPIO_MAX + 1 == ledB (out, mmc0) */ 340 /* TWL4030_GPIO_MAX + 1 == ledB (out, mmc0) */
376 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 341 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -489,15 +454,8 @@ static struct twl4030_platform_data omap3stalker_twldata = {
489 .codec = &omap3stalker_codec_data, 454 .codec = &omap3stalker_codec_data,
490 .vdac = &omap3_stalker_vdac, 455 .vdac = &omap3_stalker_vdac,
491 .vpll2 = &omap3_stalker_vpll2, 456 .vpll2 = &omap3_stalker_vpll2,
492}; 457 .vmmc1 = &omap3stalker_vmmc1,
493 458 .vsim = &omap3stalker_vsim,
494static struct i2c_board_info __initdata omap3stalker_i2c_boardinfo[] = {
495 {
496 I2C_BOARD_INFO("twl4030", 0x48),
497 .flags = I2C_CLIENT_WAKE,
498 .irq = INT_34XX_SYS_NIRQ,
499 .platform_data = &omap3stalker_twldata,
500 },
501}; 459};
502 460
503static struct at24_platform_data fram_info = { 461static struct at24_platform_data fram_info = {
@@ -516,15 +474,7 @@ static struct i2c_board_info __initdata omap3stalker_i2c_boardinfo3[] = {
516 474
517static int __init omap3_stalker_i2c_init(void) 475static int __init omap3_stalker_i2c_init(void)
518{ 476{
519 /* 477 omap3_pmic_init("twl4030", &omap3stalker_twldata);
520 * REVISIT: These entries can be set in omap3evm_twl_data
521 * after a merge with MFD tree
522 */
523 omap3stalker_twldata.vmmc1 = &omap3stalker_vmmc1;
524 omap3stalker_twldata.vsim = &omap3stalker_vsim;
525
526 omap_register_i2c_bus(1, 2600, omap3stalker_i2c_boardinfo,
527 ARRAY_SIZE(omap3stalker_i2c_boardinfo));
528 omap_register_i2c_bus(2, 400, NULL, 0); 478 omap_register_i2c_bus(2, 400, NULL, 0);
529 omap_register_i2c_bus(3, 400, omap3stalker_i2c_boardinfo3, 479 omap_register_i2c_bus(3, 400, omap3stalker_i2c_boardinfo3,
530 ARRAY_SIZE(omap3stalker_i2c_boardinfo3)); 480 ARRAY_SIZE(omap3stalker_i2c_boardinfo3));
@@ -532,49 +482,6 @@ static int __init omap3_stalker_i2c_init(void)
532} 482}
533 483
534#define OMAP3_STALKER_TS_GPIO 175 484#define OMAP3_STALKER_TS_GPIO 175
535static void ads7846_dev_init(void)
536{
537 if (gpio_request(OMAP3_STALKER_TS_GPIO, "ADS7846 pendown") < 0)
538 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
539
540 gpio_direction_input(OMAP3_STALKER_TS_GPIO);
541 gpio_set_debounce(OMAP3_STALKER_TS_GPIO, 310);
542}
543
544static int ads7846_get_pendown_state(void)
545{
546 return !gpio_get_value(OMAP3_STALKER_TS_GPIO);
547}
548
549static struct ads7846_platform_data ads7846_config = {
550 .x_max = 0x0fff,
551 .y_max = 0x0fff,
552 .x_plate_ohms = 180,
553 .pressure_max = 255,
554 .debounce_max = 10,
555 .debounce_tol = 3,
556 .debounce_rep = 1,
557 .get_pendown_state = ads7846_get_pendown_state,
558 .keep_vref_on = 1,
559 .settle_delay_usecs = 150,
560};
561
562static struct omap2_mcspi_device_config ads7846_mcspi_config = {
563 .turbo_mode = 0,
564 .single_channel = 1, /* 0: slave, 1: master */
565};
566
567static struct spi_board_info omap3stalker_spi_board_info[] = {
568 [0] = {
569 .modalias = "ads7846",
570 .bus_num = 1,
571 .chip_select = 0,
572 .max_speed_hz = 1500000,
573 .controller_data = &ads7846_mcspi_config,
574 .irq = OMAP_GPIO_IRQ(OMAP3_STALKER_TS_GPIO),
575 .platform_data = &ads7846_config,
576 },
577};
578 485
579static struct omap_board_config_kernel omap3_stalker_config[] __initdata = { 486static struct omap_board_config_kernel omap3_stalker_config[] __initdata = {
580}; 487};
@@ -618,12 +525,6 @@ static struct omap_board_mux board_mux[] __initdata = {
618}; 525};
619#endif 526#endif
620 527
621static struct omap_musb_board_data musb_board_data = {
622 .interface_type = MUSB_INTERFACE_ULPI,
623 .mode = MUSB_OTG,
624 .power = 100,
625};
626
627static void __init omap3_stalker_init(void) 528static void __init omap3_stalker_init(void)
628{ 529{
629 omap3_mux_init(board_mux, OMAP_PACKAGE_CUS); 530 omap3_mux_init(board_mux, OMAP_PACKAGE_CUS);
@@ -636,13 +537,11 @@ static void __init omap3_stalker_init(void)
636 ARRAY_SIZE(omap3_stalker_devices)); 537 ARRAY_SIZE(omap3_stalker_devices));
637 538
638 omap_display_init(&omap3_stalker_dss_data); 539 omap_display_init(&omap3_stalker_dss_data);
639 spi_register_board_info(omap3stalker_spi_board_info,
640 ARRAY_SIZE(omap3stalker_spi_board_info));
641 540
642 omap_serial_init(); 541 omap_serial_init();
643 usb_musb_init(&musb_board_data); 542 usb_musb_init(NULL);
644 usbhs_init(&usbhs_bdata); 543 usbhs_init(&usbhs_bdata);
645 ads7846_dev_init(); 544 omap_ads7846_init(1, OMAP3_STALKER_TS_GPIO, 310, NULL);
646 545
647 omap_mux_init_gpio(21, OMAP_PIN_OUTPUT); 546 omap_mux_init_gpio(21, OMAP_PIN_OUTPUT);
648 omap_mux_init_gpio(18, OMAP_PIN_INPUT_PULLUP); 547 omap_mux_init_gpio(18, OMAP_PIN_INPUT_PULLUP);
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index 127cb1752bdd..82872d7d313b 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -52,6 +52,7 @@
52#include "mux.h" 52#include "mux.h"
53#include "hsmmc.h" 53#include "hsmmc.h"
54#include "timer-gp.h" 54#include "timer-gp.h"
55#include "common-board-devices.h"
55 56
56#include <asm/setup.h> 57#include <asm/setup.h>
57 58
@@ -95,15 +96,6 @@ static struct mtd_partition omap3touchbook_nand_partitions[] = {
95 }, 96 },
96}; 97};
97 98
98static struct omap_nand_platform_data omap3touchbook_nand_data = {
99 .options = NAND_BUSWIDTH_16,
100 .parts = omap3touchbook_nand_partitions,
101 .nr_parts = ARRAY_SIZE(omap3touchbook_nand_partitions),
102 .dma_channel = -1, /* disable DMA in OMAP NAND driver */
103 .nand_setup = NULL,
104 .dev_ready = NULL,
105};
106
107#include "sdram-micron-mt46h32m32lf-6.h" 99#include "sdram-micron-mt46h32m32lf-6.h"
108 100
109static struct omap2_hsmmc_info mmc[] = { 101static struct omap2_hsmmc_info mmc[] = {
@@ -154,13 +146,11 @@ static int touchbook_twl_gpio_setup(struct device *dev,
154 /* REVISIT: need ehci-omap hooks for external VBUS 146 /* REVISIT: need ehci-omap hooks for external VBUS
155 * power switch and overcurrent detect 147 * power switch and overcurrent detect
156 */ 148 */
157 149 gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC");
158 gpio_request(gpio + 1, "EHCI_nOC");
159 gpio_direction_input(gpio + 1);
160 150
161 /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */ 151 /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */
162 gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR"); 152 gpio_request_one(gpio + TWL4030_GPIO_MAX, GPIOF_OUT_INIT_LOW,
163 gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0); 153 "nEN_USB_PWR");
164 154
165 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ 155 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
166 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 156 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -273,15 +263,6 @@ static struct twl4030_platform_data touchbook_twldata = {
273 .vpll2 = &touchbook_vpll2, 263 .vpll2 = &touchbook_vpll2,
274}; 264};
275 265
276static struct i2c_board_info __initdata touchbook_i2c_boardinfo[] = {
277 {
278 I2C_BOARD_INFO("twl4030", 0x48),
279 .flags = I2C_CLIENT_WAKE,
280 .irq = INT_34XX_SYS_NIRQ,
281 .platform_data = &touchbook_twldata,
282 },
283};
284
285static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = { 266static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = {
286 { 267 {
287 I2C_BOARD_INFO("bq27200", 0x55), 268 I2C_BOARD_INFO("bq27200", 0x55),
@@ -291,8 +272,7 @@ static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = {
291static int __init omap3_touchbook_i2c_init(void) 272static int __init omap3_touchbook_i2c_init(void)
292{ 273{
293 /* Standard TouchBook bus */ 274 /* Standard TouchBook bus */
294 omap_register_i2c_bus(1, 2600, touchbook_i2c_boardinfo, 275 omap3_pmic_init("twl4030", &touchbook_twldata);
295 ARRAY_SIZE(touchbook_i2c_boardinfo));
296 276
297 /* Additional TouchBook bus */ 277 /* Additional TouchBook bus */
298 omap_register_i2c_bus(3, 100, touchBook_i2c_boardinfo, 278 omap_register_i2c_bus(3, 100, touchBook_i2c_boardinfo,
@@ -301,19 +281,7 @@ static int __init omap3_touchbook_i2c_init(void)
301 return 0; 281 return 0;
302} 282}
303 283
304static void __init omap3_ads7846_init(void) 284static struct ads7846_platform_data ads7846_pdata = {
305{
306 if (gpio_request(OMAP3_TS_GPIO, "ads7846_pen_down")) {
307 printk(KERN_ERR "Failed to request GPIO %d for "
308 "ads7846 pen down IRQ\n", OMAP3_TS_GPIO);
309 return;
310 }
311
312 gpio_direction_input(OMAP3_TS_GPIO);
313 gpio_set_debounce(OMAP3_TS_GPIO, 310);
314}
315
316static struct ads7846_platform_data ads7846_config = {
317 .x_min = 100, 285 .x_min = 100,
318 .y_min = 265, 286 .y_min = 265,
319 .x_max = 3950, 287 .x_max = 3950,
@@ -327,23 +295,6 @@ static struct ads7846_platform_data ads7846_config = {
327 .keep_vref_on = 1, 295 .keep_vref_on = 1,
328}; 296};
329 297
330static struct omap2_mcspi_device_config ads7846_mcspi_config = {
331 .turbo_mode = 0,
332 .single_channel = 1, /* 0: slave, 1: master */
333};
334
335static struct spi_board_info omap3_ads7846_spi_board_info[] __initdata = {
336 {
337 .modalias = "ads7846",
338 .bus_num = 4,
339 .chip_select = 0,
340 .max_speed_hz = 1500000,
341 .controller_data = &ads7846_mcspi_config,
342 .irq = OMAP_GPIO_IRQ(OMAP3_TS_GPIO),
343 .platform_data = &ads7846_config,
344 }
345};
346
347static struct gpio_led gpio_leds[] = { 298static struct gpio_led gpio_leds[] = {
348 { 299 {
349 .name = "touchbook::usr0", 300 .name = "touchbook::usr0",
@@ -434,39 +385,6 @@ static struct platform_device *omap3_touchbook_devices[] __initdata = {
434 &keys_gpio, 385 &keys_gpio,
435}; 386};
436 387
437static void __init omap3touchbook_flash_init(void)
438{
439 u8 cs = 0;
440 u8 nandcs = GPMC_CS_NUM + 1;
441
442 /* find out the chip-select on which NAND exists */
443 while (cs < GPMC_CS_NUM) {
444 u32 ret = 0;
445 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
446
447 if ((ret & 0xC00) == 0x800) {
448 printk(KERN_INFO "Found NAND on CS%d\n", cs);
449 if (nandcs > GPMC_CS_NUM)
450 nandcs = cs;
451 }
452 cs++;
453 }
454
455 if (nandcs > GPMC_CS_NUM) {
456 printk(KERN_INFO "NAND: Unable to find configuration "
457 "in GPMC\n ");
458 return;
459 }
460
461 if (nandcs < GPMC_CS_NUM) {
462 omap3touchbook_nand_data.cs = nandcs;
463
464 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
465 if (gpmc_nand_init(&omap3touchbook_nand_data) < 0)
466 printk(KERN_ERR "Unable to register NAND device\n");
467 }
468}
469
470static const struct usbhs_omap_board_data usbhs_bdata __initconst = { 388static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
471 389
472 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 390 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
@@ -481,15 +399,10 @@ static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
481 399
482static void omap3_touchbook_poweroff(void) 400static void omap3_touchbook_poweroff(void)
483{ 401{
484 int r; 402 int pwr_off = TB_KILL_POWER_GPIO;
485 403
486 r = gpio_request(TB_KILL_POWER_GPIO, "DVI reset"); 404 if (gpio_request_one(pwr_off, GPIOF_OUT_INIT_LOW, "DVI reset") < 0)
487 if (r < 0) {
488 printk(KERN_ERR "Unable to get kill power GPIO\n"); 405 printk(KERN_ERR "Unable to get kill power GPIO\n");
489 return;
490 }
491
492 gpio_direction_output(TB_KILL_POWER_GPIO, 0);
493} 406}
494 407
495static int __init early_touchbook_revision(char *p) 408static int __init early_touchbook_revision(char *p)
@@ -501,12 +414,6 @@ static int __init early_touchbook_revision(char *p)
501} 414}
502early_param("tbr", early_touchbook_revision); 415early_param("tbr", early_touchbook_revision);
503 416
504static struct omap_musb_board_data musb_board_data = {
505 .interface_type = MUSB_INTERFACE_ULPI,
506 .mode = MUSB_OTG,
507 .power = 100,
508};
509
510static void __init omap3_touchbook_init(void) 417static void __init omap3_touchbook_init(void)
511{ 418{
512 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 419 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
@@ -521,17 +428,15 @@ static void __init omap3_touchbook_init(void)
521 omap_serial_init(); 428 omap_serial_init();
522 429
523 omap_mux_init_gpio(170, OMAP_PIN_INPUT); 430 omap_mux_init_gpio(170, OMAP_PIN_INPUT);
524 gpio_request(176, "DVI_nPD");
525 /* REVISIT leave DVI powered down until it's needed ... */ 431 /* REVISIT leave DVI powered down until it's needed ... */
526 gpio_direction_output(176, true); 432 gpio_request_one(176, GPIOF_OUT_INIT_HIGH, "DVI_nPD");
527 433
528 /* Touchscreen and accelerometer */ 434 /* Touchscreen and accelerometer */
529 spi_register_board_info(omap3_ads7846_spi_board_info, 435 omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata);
530 ARRAY_SIZE(omap3_ads7846_spi_board_info)); 436 usb_musb_init(NULL);
531 omap3_ads7846_init();
532 usb_musb_init(&musb_board_data);
533 usbhs_init(&usbhs_bdata); 437 usbhs_init(&usbhs_bdata);
534 omap3touchbook_flash_init(); 438 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3touchbook_nand_partitions,
439 ARRAY_SIZE(omap3touchbook_nand_partitions));
535 440
536 /* Ensure SDRC pins are mux'd for self-refresh */ 441 /* Ensure SDRC pins are mux'd for self-refresh */
537 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 442 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index f3a7b1011914..5d7c0a313dc7 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -46,6 +46,7 @@
46#include "hsmmc.h" 46#include "hsmmc.h"
47#include "control.h" 47#include "control.h"
48#include "mux.h" 48#include "mux.h"
49#include "common-board-devices.h"
49 50
50#define GPIO_HUB_POWER 1 51#define GPIO_HUB_POWER 1
51#define GPIO_HUB_NRESET 62 52#define GPIO_HUB_NRESET 62
@@ -111,6 +112,11 @@ static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
111 .reset_gpio_port[2] = -EINVAL 112 .reset_gpio_port[2] = -EINVAL
112}; 113};
113 114
115static struct gpio panda_ehci_gpios[] __initdata = {
116 { GPIO_HUB_POWER, GPIOF_OUT_INIT_LOW, "hub_power" },
117 { GPIO_HUB_NRESET, GPIOF_OUT_INIT_LOW, "hub_nreset" },
118};
119
114static void __init omap4_ehci_init(void) 120static void __init omap4_ehci_init(void)
115{ 121{
116 int ret; 122 int ret;
@@ -120,44 +126,27 @@ static void __init omap4_ehci_init(void)
120 phy_ref_clk = clk_get(NULL, "auxclk3_ck"); 126 phy_ref_clk = clk_get(NULL, "auxclk3_ck");
121 if (IS_ERR(phy_ref_clk)) { 127 if (IS_ERR(phy_ref_clk)) {
122 pr_err("Cannot request auxclk3\n"); 128 pr_err("Cannot request auxclk3\n");
123 goto error1; 129 return;
124 } 130 }
125 clk_set_rate(phy_ref_clk, 19200000); 131 clk_set_rate(phy_ref_clk, 19200000);
126 clk_enable(phy_ref_clk); 132 clk_enable(phy_ref_clk);
127 133
128 /* disable the power to the usb hub prior to init */ 134 /* disable the power to the usb hub prior to init and reset phy+hub */
129 ret = gpio_request(GPIO_HUB_POWER, "hub_power"); 135 ret = gpio_request_array(panda_ehci_gpios,
136 ARRAY_SIZE(panda_ehci_gpios));
130 if (ret) { 137 if (ret) {
131 pr_err("Cannot request GPIO %d\n", GPIO_HUB_POWER); 138 pr_err("Unable to initialize EHCI power/reset\n");
132 goto error1; 139 return;
133 } 140 }
134 gpio_export(GPIO_HUB_POWER, 0);
135 gpio_direction_output(GPIO_HUB_POWER, 0);
136 gpio_set_value(GPIO_HUB_POWER, 0);
137 141
138 /* reset phy+hub */ 142 gpio_export(GPIO_HUB_POWER, 0);
139 ret = gpio_request(GPIO_HUB_NRESET, "hub_nreset");
140 if (ret) {
141 pr_err("Cannot request GPIO %d\n", GPIO_HUB_NRESET);
142 goto error2;
143 }
144 gpio_export(GPIO_HUB_NRESET, 0); 143 gpio_export(GPIO_HUB_NRESET, 0);
145 gpio_direction_output(GPIO_HUB_NRESET, 0);
146 gpio_set_value(GPIO_HUB_NRESET, 0);
147 gpio_set_value(GPIO_HUB_NRESET, 1); 144 gpio_set_value(GPIO_HUB_NRESET, 1);
148 145
149 usbhs_init(&usbhs_bdata); 146 usbhs_init(&usbhs_bdata);
150 147
151 /* enable power to hub */ 148 /* enable power to hub */
152 gpio_set_value(GPIO_HUB_POWER, 1); 149 gpio_set_value(GPIO_HUB_POWER, 1);
153 return;
154
155error2:
156 gpio_free(GPIO_HUB_POWER);
157error1:
158 pr_err("Unable to initialize EHCI power/reset\n");
159 return;
160
161} 150}
162 151
163static struct omap_musb_board_data musb_board_data = { 152static struct omap_musb_board_data musb_board_data = {
@@ -408,15 +397,6 @@ static struct twl4030_platform_data omap4_panda_twldata = {
408 .usb = &omap4_usbphy_data, 397 .usb = &omap4_usbphy_data,
409}; 398};
410 399
411static struct i2c_board_info __initdata omap4_panda_i2c_boardinfo[] = {
412 {
413 I2C_BOARD_INFO("twl6030", 0x48),
414 .flags = I2C_CLIENT_WAKE,
415 .irq = OMAP44XX_IRQ_SYS_1N,
416 .platform_data = &omap4_panda_twldata,
417 },
418};
419
420/* 400/*
421 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM 401 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM
422 * is connected as I2C slave device, and can be accessed at address 0x50 402 * is connected as I2C slave device, and can be accessed at address 0x50
@@ -429,12 +409,7 @@ static struct i2c_board_info __initdata panda_i2c_eeprom[] = {
429 409
430static int __init omap4_panda_i2c_init(void) 410static int __init omap4_panda_i2c_init(void)
431{ 411{
432 /* 412 omap4_pmic_init("twl6030", &omap4_panda_twldata);
433 * Phoenix Audio IC needs I2C1 to
434 * start with 400 KHz or less
435 */
436 omap_register_i2c_bus(1, 400, omap4_panda_i2c_boardinfo,
437 ARRAY_SIZE(omap4_panda_i2c_boardinfo));
438 omap_register_i2c_bus(2, 400, NULL, 0); 413 omap_register_i2c_bus(2, 400, NULL, 0);
439 /* 414 /*
440 * Bus 3 is attached to the DVI port where devices like the pico DLP 415 * Bus 3 is attached to the DVI port where devices like the pico DLP
@@ -651,27 +626,19 @@ static void omap4_panda_hdmi_mux_init(void)
651 OMAP_PIN_INPUT_PULLUP); 626 OMAP_PIN_INPUT_PULLUP);
652} 627}
653 628
629static struct gpio panda_hdmi_gpios[] = {
630 { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" },
631 { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" },
632};
633
654static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev) 634static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev)
655{ 635{
656 int status; 636 int status;
657 637
658 status = gpio_request_one(HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, 638 status = gpio_request_array(panda_hdmi_gpios,
659 "hdmi_gpio_hpd"); 639 ARRAY_SIZE(panda_hdmi_gpios));
660 if (status) { 640 if (status)
661 pr_err("Cannot request GPIO %d\n", HDMI_GPIO_HPD); 641 pr_err("Cannot request HDMI GPIOs\n");
662 return status;
663 }
664 status = gpio_request_one(HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH,
665 "hdmi_gpio_ls_oe");
666 if (status) {
667 pr_err("Cannot request GPIO %d\n", HDMI_GPIO_LS_OE);
668 goto error1;
669 }
670
671 return 0;
672
673error1:
674 gpio_free(HDMI_GPIO_HPD);
675 642
676 return status; 643 return status;
677} 644}
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 59ca33326b8c..c03f92b14f9c 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -56,6 +56,7 @@
56#include "mux.h" 56#include "mux.h"
57#include "sdram-micron-mt46h32m32lf-6.h" 57#include "sdram-micron-mt46h32m32lf-6.h"
58#include "hsmmc.h" 58#include "hsmmc.h"
59#include "common-board-devices.h"
59 60
60#define OVERO_GPIO_BT_XGATE 15 61#define OVERO_GPIO_BT_XGATE 15
61#define OVERO_GPIO_W2W_NRESET 16 62#define OVERO_GPIO_W2W_NRESET 16
@@ -74,30 +75,6 @@
74#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ 75#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
75 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 76 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
76 77
77#include <linux/spi/ads7846.h>
78
79static struct omap2_mcspi_device_config ads7846_mcspi_config = {
80 .turbo_mode = 0,
81 .single_channel = 1, /* 0: slave, 1: master */
82};
83
84static int ads7846_get_pendown_state(void)
85{
86 return !gpio_get_value(OVERO_GPIO_PENDOWN);
87}
88
89static struct ads7846_platform_data ads7846_config = {
90 .x_max = 0x0fff,
91 .y_max = 0x0fff,
92 .x_plate_ohms = 180,
93 .pressure_max = 255,
94 .debounce_max = 10,
95 .debounce_tol = 3,
96 .debounce_rep = 1,
97 .get_pendown_state = ads7846_get_pendown_state,
98 .keep_vref_on = 1,
99};
100
101/* fixed regulator for ads7846 */ 78/* fixed regulator for ads7846 */
102static struct regulator_consumer_supply ads7846_supply = 79static struct regulator_consumer_supply ads7846_supply =
103 REGULATOR_SUPPLY("vcc", "spi1.0"); 80 REGULATOR_SUPPLY("vcc", "spi1.0");
@@ -128,14 +105,7 @@ static struct platform_device vads7846_device = {
128 105
129static void __init overo_ads7846_init(void) 106static void __init overo_ads7846_init(void)
130{ 107{
131 if ((gpio_request(OVERO_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) && 108 omap_ads7846_init(1, OVERO_GPIO_PENDOWN, 0, NULL);
132 (gpio_direction_input(OVERO_GPIO_PENDOWN) == 0)) {
133 gpio_export(OVERO_GPIO_PENDOWN, 0);
134 } else {
135 printk(KERN_ERR "could not obtain gpio for ADS7846_PENDOWN\n");
136 return;
137 }
138
139 platform_device_register(&vads7846_device); 109 platform_device_register(&vads7846_device);
140} 110}
141 111
@@ -146,106 +116,28 @@ static inline void __init overo_ads7846_init(void) { return; }
146#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 116#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
147 117
148#include <linux/smsc911x.h> 118#include <linux/smsc911x.h>
119#include <plat/gpmc-smsc911x.h>
149 120
150static struct resource overo_smsc911x_resources[] = { 121static struct omap_smsc911x_platform_data smsc911x_cfg = {
151 {
152 .name = "smsc911x-memory",
153 .flags = IORESOURCE_MEM,
154 },
155 {
156 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
157 },
158};
159
160static struct resource overo_smsc911x2_resources[] = {
161 {
162 .name = "smsc911x2-memory",
163 .flags = IORESOURCE_MEM,
164 },
165 {
166 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
167 },
168};
169
170static struct smsc911x_platform_config overo_smsc911x_config = {
171 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
172 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
173 .flags = SMSC911X_USE_32BIT ,
174 .phy_interface = PHY_INTERFACE_MODE_MII,
175};
176
177static struct platform_device overo_smsc911x_device = {
178 .name = "smsc911x",
179 .id = 0, 122 .id = 0,
180 .num_resources = ARRAY_SIZE(overo_smsc911x_resources), 123 .cs = OVERO_SMSC911X_CS,
181 .resource = overo_smsc911x_resources, 124 .gpio_irq = OVERO_SMSC911X_GPIO,
182 .dev = { 125 .gpio_reset = -EINVAL,
183 .platform_data = &overo_smsc911x_config, 126 .flags = SMSC911X_USE_32BIT,
184 },
185}; 127};
186 128
187static struct platform_device overo_smsc911x2_device = { 129static struct omap_smsc911x_platform_data smsc911x2_cfg = {
188 .name = "smsc911x",
189 .id = 1, 130 .id = 1,
190 .num_resources = ARRAY_SIZE(overo_smsc911x2_resources), 131 .cs = OVERO_SMSC911X2_CS,
191 .resource = overo_smsc911x2_resources, 132 .gpio_irq = OVERO_SMSC911X2_GPIO,
192 .dev = { 133 .gpio_reset = -EINVAL,
193 .platform_data = &overo_smsc911x_config, 134 .flags = SMSC911X_USE_32BIT,
194 },
195}; 135};
196 136
197static struct platform_device *smsc911x_devices[] = { 137static void __init overo_init_smsc911x(void)
198 &overo_smsc911x_device,
199 &overo_smsc911x2_device,
200};
201
202static inline void __init overo_init_smsc911x(void)
203{ 138{
204 unsigned long cs_mem_base, cs_mem_base2; 139 gpmc_smsc911x_init(&smsc911x_cfg);
205 140 gpmc_smsc911x_init(&smsc911x2_cfg);
206 /* set up first smsc911x chip */
207
208 if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
209 printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n");
210 return;
211 }
212
213 overo_smsc911x_resources[0].start = cs_mem_base + 0x0;
214 overo_smsc911x_resources[0].end = cs_mem_base + 0xff;
215
216 if ((gpio_request(OVERO_SMSC911X_GPIO, "SMSC911X IRQ") == 0) &&
217 (gpio_direction_input(OVERO_SMSC911X_GPIO) == 0)) {
218 gpio_export(OVERO_SMSC911X_GPIO, 0);
219 } else {
220 printk(KERN_ERR "could not obtain gpio for SMSC911X IRQ\n");
221 return;
222 }
223
224 overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO);
225 overo_smsc911x_resources[1].end = 0;
226
227 /* set up second smsc911x chip */
228
229 if (gpmc_cs_request(OVERO_SMSC911X2_CS, SZ_16M, &cs_mem_base2) < 0) {
230 printk(KERN_ERR "Failed request for GPMC mem for smsc911x2\n");
231 return;
232 }
233
234 overo_smsc911x2_resources[0].start = cs_mem_base2 + 0x0;
235 overo_smsc911x2_resources[0].end = cs_mem_base2 + 0xff;
236
237 if ((gpio_request(OVERO_SMSC911X2_GPIO, "SMSC911X2 IRQ") == 0) &&
238 (gpio_direction_input(OVERO_SMSC911X2_GPIO) == 0)) {
239 gpio_export(OVERO_SMSC911X2_GPIO, 0);
240 } else {
241 printk(KERN_ERR "could not obtain gpio for SMSC911X2 IRQ\n");
242 return;
243 }
244
245 overo_smsc911x2_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X2_GPIO);
246 overo_smsc911x2_resources[1].end = 0;
247
248 platform_add_devices(smsc911x_devices, ARRAY_SIZE(smsc911x_devices));
249} 141}
250 142
251#else 143#else
@@ -259,21 +151,20 @@ static int dvi_enabled;
259#define OVERO_GPIO_LCD_EN 144 151#define OVERO_GPIO_LCD_EN 144
260#define OVERO_GPIO_LCD_BL 145 152#define OVERO_GPIO_LCD_BL 145
261 153
154static struct gpio overo_dss_gpios[] __initdata = {
155 { OVERO_GPIO_LCD_EN, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_EN" },
156 { OVERO_GPIO_LCD_BL, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_BL" },
157};
158
262static void __init overo_display_init(void) 159static void __init overo_display_init(void)
263{ 160{
264 if ((gpio_request(OVERO_GPIO_LCD_EN, "OVERO_GPIO_LCD_EN") == 0) && 161 if (gpio_request_array(overo_dss_gpios, ARRAY_SIZE(overo_dss_gpios))) {
265 (gpio_direction_output(OVERO_GPIO_LCD_EN, 1) == 0)) 162 printk(KERN_ERR "could not obtain DSS control GPIOs\n");
266 gpio_export(OVERO_GPIO_LCD_EN, 0); 163 return;
267 else 164 }
268 printk(KERN_ERR "could not obtain gpio for "
269 "OVERO_GPIO_LCD_EN\n");
270 165
271 if ((gpio_request(OVERO_GPIO_LCD_BL, "OVERO_GPIO_LCD_BL") == 0) && 166 gpio_export(OVERO_GPIO_LCD_EN, 0);
272 (gpio_direction_output(OVERO_GPIO_LCD_BL, 1) == 0)) 167 gpio_export(OVERO_GPIO_LCD_BL, 0);
273 gpio_export(OVERO_GPIO_LCD_BL, 0);
274 else
275 printk(KERN_ERR "could not obtain gpio for "
276 "OVERO_GPIO_LCD_BL\n");
277} 168}
278 169
279static int overo_panel_enable_dvi(struct omap_dss_device *dssdev) 170static int overo_panel_enable_dvi(struct omap_dss_device *dssdev)
@@ -412,45 +303,6 @@ static struct mtd_partition overo_nand_partitions[] = {
412 }, 303 },
413}; 304};
414 305
415static struct omap_nand_platform_data overo_nand_data = {
416 .parts = overo_nand_partitions,
417 .nr_parts = ARRAY_SIZE(overo_nand_partitions),
418 .dma_channel = -1, /* disable DMA in OMAP NAND driver */
419};
420
421static void __init overo_flash_init(void)
422{
423 u8 cs = 0;
424 u8 nandcs = GPMC_CS_NUM + 1;
425
426 /* find out the chip-select on which NAND exists */
427 while (cs < GPMC_CS_NUM) {
428 u32 ret = 0;
429 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
430
431 if ((ret & 0xC00) == 0x800) {
432 printk(KERN_INFO "Found NAND on CS%d\n", cs);
433 if (nandcs > GPMC_CS_NUM)
434 nandcs = cs;
435 }
436 cs++;
437 }
438
439 if (nandcs > GPMC_CS_NUM) {
440 printk(KERN_INFO "NAND: Unable to find configuration "
441 "in GPMC\n ");
442 return;
443 }
444
445 if (nandcs < GPMC_CS_NUM) {
446 overo_nand_data.cs = nandcs;
447
448 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
449 if (gpmc_nand_init(&overo_nand_data) < 0)
450 printk(KERN_ERR "Unable to register NAND device\n");
451 }
452}
453
454static struct omap2_hsmmc_info mmc[] = { 306static struct omap2_hsmmc_info mmc[] = {
455 { 307 {
456 .mmc = 1, 308 .mmc = 1,
@@ -648,37 +500,15 @@ static struct twl4030_platform_data overo_twldata = {
648 .vpll2 = &overo_vpll2, 500 .vpll2 = &overo_vpll2,
649}; 501};
650 502
651static struct i2c_board_info __initdata overo_i2c_boardinfo[] = {
652 {
653 I2C_BOARD_INFO("tps65950", 0x48),
654 .flags = I2C_CLIENT_WAKE,
655 .irq = INT_34XX_SYS_NIRQ,
656 .platform_data = &overo_twldata,
657 },
658};
659
660static int __init overo_i2c_init(void) 503static int __init overo_i2c_init(void)
661{ 504{
662 omap_register_i2c_bus(1, 2600, overo_i2c_boardinfo, 505 omap3_pmic_init("tps65950", &overo_twldata);
663 ARRAY_SIZE(overo_i2c_boardinfo));
664 /* i2c2 pins are used for gpio */ 506 /* i2c2 pins are used for gpio */
665 omap_register_i2c_bus(3, 400, NULL, 0); 507 omap_register_i2c_bus(3, 400, NULL, 0);
666 return 0; 508 return 0;
667} 509}
668 510
669static struct spi_board_info overo_spi_board_info[] __initdata = { 511static struct spi_board_info overo_spi_board_info[] __initdata = {
670#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
671 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
672 {
673 .modalias = "ads7846",
674 .bus_num = 1,
675 .chip_select = 0,
676 .max_speed_hz = 1500000,
677 .controller_data = &ads7846_mcspi_config,
678 .irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN),
679 .platform_data = &ads7846_config,
680 },
681#endif
682#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \ 512#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
683 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE) 513 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
684 { 514 {
@@ -722,20 +552,22 @@ static struct omap_board_mux board_mux[] __initdata = {
722}; 552};
723#endif 553#endif
724 554
725static struct omap_musb_board_data musb_board_data = { 555static struct gpio overo_bt_gpios[] __initdata = {
726 .interface_type = MUSB_INTERFACE_ULPI, 556 { OVERO_GPIO_BT_XGATE, GPIOF_OUT_INIT_LOW, "lcd enable" },
727 .mode = MUSB_OTG, 557 { OVERO_GPIO_BT_NRESET, GPIOF_OUT_INIT_HIGH, "lcd bl enable" },
728 .power = 100,
729}; 558};
730 559
731static void __init overo_init(void) 560static void __init overo_init(void)
732{ 561{
562 int ret;
563
733 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 564 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
734 overo_i2c_init(); 565 overo_i2c_init();
735 omap_display_init(&overo_dss_data); 566 omap_display_init(&overo_dss_data);
736 omap_serial_init(); 567 omap_serial_init();
737 overo_flash_init(); 568 omap_nand_flash_init(0, overo_nand_partitions,
738 usb_musb_init(&musb_board_data); 569 ARRAY_SIZE(overo_nand_partitions));
570 usb_musb_init(NULL);
739 usbhs_init(&usbhs_bdata); 571 usbhs_init(&usbhs_bdata);
740 overo_spi_init(); 572 overo_spi_init();
741 overo_ads7846_init(); 573 overo_ads7846_init();
@@ -748,9 +580,9 @@ static void __init overo_init(void)
748 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 580 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
749 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); 581 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
750 582
751 if ((gpio_request(OVERO_GPIO_W2W_NRESET, 583 ret = gpio_request_one(OVERO_GPIO_W2W_NRESET, GPIOF_OUT_INIT_HIGH,
752 "OVERO_GPIO_W2W_NRESET") == 0) && 584 "OVERO_GPIO_W2W_NRESET");
753 (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) { 585 if (ret == 0) {
754 gpio_export(OVERO_GPIO_W2W_NRESET, 0); 586 gpio_export(OVERO_GPIO_W2W_NRESET, 0);
755 gpio_set_value(OVERO_GPIO_W2W_NRESET, 0); 587 gpio_set_value(OVERO_GPIO_W2W_NRESET, 0);
756 udelay(10); 588 udelay(10);
@@ -760,25 +592,20 @@ static void __init overo_init(void)
760 "OVERO_GPIO_W2W_NRESET\n"); 592 "OVERO_GPIO_W2W_NRESET\n");
761 } 593 }
762 594
763 if ((gpio_request(OVERO_GPIO_BT_XGATE, "OVERO_GPIO_BT_XGATE") == 0) && 595 ret = gpio_request_array(overo_bt_gpios, ARRAY_SIZE(overo_bt_gpios));
764 (gpio_direction_output(OVERO_GPIO_BT_XGATE, 0) == 0)) 596 if (ret) {
597 pr_err("%s: could not obtain BT gpios\n", __func__);
598 } else {
765 gpio_export(OVERO_GPIO_BT_XGATE, 0); 599 gpio_export(OVERO_GPIO_BT_XGATE, 0);
766 else
767 printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_BT_XGATE\n");
768
769 if ((gpio_request(OVERO_GPIO_BT_NRESET, "OVERO_GPIO_BT_NRESET") == 0) &&
770 (gpio_direction_output(OVERO_GPIO_BT_NRESET, 1) == 0)) {
771 gpio_export(OVERO_GPIO_BT_NRESET, 0); 600 gpio_export(OVERO_GPIO_BT_NRESET, 0);
772 gpio_set_value(OVERO_GPIO_BT_NRESET, 0); 601 gpio_set_value(OVERO_GPIO_BT_NRESET, 0);
773 mdelay(6); 602 mdelay(6);
774 gpio_set_value(OVERO_GPIO_BT_NRESET, 1); 603 gpio_set_value(OVERO_GPIO_BT_NRESET, 1);
775 } else {
776 printk(KERN_ERR "could not obtain gpio for "
777 "OVERO_GPIO_BT_NRESET\n");
778 } 604 }
779 605
780 if ((gpio_request(OVERO_GPIO_USBH_CPEN, "OVERO_GPIO_USBH_CPEN") == 0) && 606 ret = gpio_request_one(OVERO_GPIO_USBH_CPEN, GPIOF_OUT_INIT_HIGH,
781 (gpio_direction_output(OVERO_GPIO_USBH_CPEN, 1) == 0)) 607 "OVERO_GPIO_USBH_CPEN");
608 if (ret == 0)
782 gpio_export(OVERO_GPIO_USBH_CPEN, 0); 609 gpio_export(OVERO_GPIO_USBH_CPEN, 0);
783 else 610 else
784 printk(KERN_ERR "could not obtain gpio for " 611 printk(KERN_ERR "could not obtain gpio for "
diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c
index 2af8b05e786d..42d10b12da3c 100644
--- a/arch/arm/mach-omap2/board-rm680.c
+++ b/arch/arm/mach-omap2/board-rm680.c
@@ -31,6 +31,7 @@
31#include "mux.h" 31#include "mux.h"
32#include "hsmmc.h" 32#include "hsmmc.h"
33#include "sdram-nokia.h" 33#include "sdram-nokia.h"
34#include "common-board-devices.h"
34 35
35static struct regulator_consumer_supply rm680_vemmc_consumers[] = { 36static struct regulator_consumer_supply rm680_vemmc_consumers[] = {
36 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"), 37 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
@@ -90,19 +91,9 @@ static struct twl4030_platform_data rm680_twl_data = {
90 /* add rest of the children here */ 91 /* add rest of the children here */
91}; 92};
92 93
93static struct i2c_board_info __initdata rm680_twl_i2c_board_info[] = {
94 {
95 I2C_BOARD_INFO("twl5031", 0x48),
96 .flags = I2C_CLIENT_WAKE,
97 .irq = INT_34XX_SYS_NIRQ,
98 .platform_data = &rm680_twl_data,
99 },
100};
101
102static void __init rm680_i2c_init(void) 94static void __init rm680_i2c_init(void)
103{ 95{
104 omap_register_i2c_bus(1, 2900, rm680_twl_i2c_board_info, 96 omap_pmic_init(1, 2900, "twl5031", INT_34XX_SYS_NIRQ, &rm680_twl_data);
105 ARRAY_SIZE(rm680_twl_i2c_board_info));
106 omap_register_i2c_bus(2, 400, NULL, 0); 97 omap_register_i2c_bus(2, 400, NULL, 0);
107 omap_register_i2c_bus(3, 400, NULL, 0); 98 omap_register_i2c_bus(3, 400, NULL, 0);
108} 99}
@@ -153,17 +144,11 @@ static struct omap_board_mux board_mux[] __initdata = {
153}; 144};
154#endif 145#endif
155 146
156static struct omap_musb_board_data rm680_musb_data = {
157 .interface_type = MUSB_INTERFACE_ULPI,
158 .mode = MUSB_PERIPHERAL,
159 .power = 100,
160};
161
162static void __init rm680_init(void) 147static void __init rm680_init(void)
163{ 148{
164 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 149 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
165 omap_serial_init(); 150 omap_serial_init();
166 usb_musb_init(&rm680_musb_data); 151 usb_musb_init(NULL);
167 rm680_peripherals_init(); 152 rm680_peripherals_init();
168} 153}
169 154
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index bbcb6775a6a3..2e509f9149e2 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -43,6 +43,7 @@
43 43
44#include "mux.h" 44#include "mux.h"
45#include "hsmmc.h" 45#include "hsmmc.h"
46#include "common-board-devices.h"
46 47
47#define SYSTEM_REV_B_USES_VAUX3 0x1699 48#define SYSTEM_REV_B_USES_VAUX3 0x1699
48#define SYSTEM_REV_S_USES_VAUX3 0x8 49#define SYSTEM_REV_S_USES_VAUX3 0x8
@@ -557,10 +558,8 @@ static __init void rx51_init_si4713(void)
557static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n) 558static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n)
558{ 559{
559 /* FIXME this gpio setup is just a placeholder for now */ 560 /* FIXME this gpio setup is just a placeholder for now */
560 gpio_request(gpio + 6, "backlight_pwm"); 561 gpio_request_one(gpio + 6, GPIOF_OUT_INIT_LOW, "backlight_pwm");
561 gpio_direction_output(gpio + 6, 0); 562 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_HIGH, "speaker_en");
562 gpio_request(gpio + 7, "speaker_en");
563 gpio_direction_output(gpio + 7, 1);
564 563
565 return 0; 564 return 0;
566} 565}
@@ -777,15 +776,6 @@ static struct tpa6130a2_platform_data rx51_tpa6130a2_data __initdata_or_module =
777 .power_gpio = 98, 776 .power_gpio = 98,
778}; 777};
779 778
780static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_1[] = {
781 {
782 I2C_BOARD_INFO("twl5030", 0x48),
783 .flags = I2C_CLIENT_WAKE,
784 .irq = INT_34XX_SYS_NIRQ,
785 .platform_data = &rx51_twldata,
786 },
787};
788
789/* Audio setup data */ 779/* Audio setup data */
790static struct aic3x_setup_data rx51_aic34_setup = { 780static struct aic3x_setup_data rx51_aic34_setup = {
791 .gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED, 781 .gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED,
@@ -833,8 +823,7 @@ static int __init rx51_i2c_init(void)
833 rx51_twldata.vaux3 = &rx51_vaux3_cam; 823 rx51_twldata.vaux3 = &rx51_vaux3_cam;
834 } 824 }
835 rx51_twldata.vmmc2 = &rx51_vmmc2; 825 rx51_twldata.vmmc2 = &rx51_vmmc2;
836 omap_register_i2c_bus(1, 2200, rx51_peripherals_i2c_board_info_1, 826 omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata);
837 ARRAY_SIZE(rx51_peripherals_i2c_board_info_1));
838 omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2, 827 omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
839 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2)); 828 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
840 omap_register_i2c_bus(3, 400, NULL, 0); 829 omap_register_i2c_bus(3, 400, NULL, 0);
@@ -921,26 +910,20 @@ static void rx51_wl1251_set_power(bool enable)
921 gpio_set_value(RX51_WL1251_POWER_GPIO, enable); 910 gpio_set_value(RX51_WL1251_POWER_GPIO, enable);
922} 911}
923 912
913static struct gpio rx51_wl1251_gpios[] __initdata = {
914 { RX51_WL1251_POWER_GPIO, GPIOF_OUT_INIT_LOW, "wl1251 power" },
915 { RX51_WL1251_IRQ_GPIO, GPIOF_IN, "wl1251 irq" },
916};
917
924static void __init rx51_init_wl1251(void) 918static void __init rx51_init_wl1251(void)
925{ 919{
926 int irq, ret; 920 int irq, ret;
927 921
928 ret = gpio_request(RX51_WL1251_POWER_GPIO, "wl1251 power"); 922 ret = gpio_request_array(rx51_wl1251_gpios,
923 ARRAY_SIZE(rx51_wl1251_gpios));
929 if (ret < 0) 924 if (ret < 0)
930 goto error; 925 goto error;
931 926
932 ret = gpio_direction_output(RX51_WL1251_POWER_GPIO, 0);
933 if (ret < 0)
934 goto err_power;
935
936 ret = gpio_request(RX51_WL1251_IRQ_GPIO, "wl1251 irq");
937 if (ret < 0)
938 goto err_power;
939
940 ret = gpio_direction_input(RX51_WL1251_IRQ_GPIO);
941 if (ret < 0)
942 goto err_irq;
943
944 irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO); 927 irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO);
945 if (irq < 0) 928 if (irq < 0)
946 goto err_irq; 929 goto err_irq;
@@ -952,10 +935,7 @@ static void __init rx51_init_wl1251(void)
952 935
953err_irq: 936err_irq:
954 gpio_free(RX51_WL1251_IRQ_GPIO); 937 gpio_free(RX51_WL1251_IRQ_GPIO);
955
956err_power:
957 gpio_free(RX51_WL1251_POWER_GPIO); 938 gpio_free(RX51_WL1251_POWER_GPIO);
958
959error: 939error:
960 printk(KERN_ERR "wl1251 board initialisation failed\n"); 940 printk(KERN_ERR "wl1251 board initialisation failed\n");
961 wl1251_pdata.set_power = NULL; 941 wl1251_pdata.set_power = NULL;
diff --git a/arch/arm/mach-omap2/board-rx51-video.c b/arch/arm/mach-omap2/board-rx51-video.c
index 89a66db8b77d..19777333aef8 100644
--- a/arch/arm/mach-omap2/board-rx51-video.c
+++ b/arch/arm/mach-omap2/board-rx51-video.c
@@ -76,13 +76,12 @@ static int __init rx51_video_init(void)
76 return 0; 76 return 0;
77 } 77 }
78 78
79 if (gpio_request(RX51_LCD_RESET_GPIO, "LCD ACX565AKM reset")) { 79 if (gpio_request_one(RX51_LCD_RESET_GPIO, GPIOF_OUT_INIT_HIGH,
80 "LCD ACX565AKM reset")) {
80 pr_err("%s failed to get LCD Reset GPIO\n", __func__); 81 pr_err("%s failed to get LCD Reset GPIO\n", __func__);
81 return 0; 82 return 0;
82 } 83 }
83 84
84 gpio_direction_output(RX51_LCD_RESET_GPIO, 1);
85
86 omap_display_init(&rx51_dss_board_info); 85 omap_display_init(&rx51_dss_board_info);
87 return 0; 86 return 0;
88} 87}
diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c
index 007ebdc6c993..6402e781c458 100644
--- a/arch/arm/mach-omap2/board-zoom-debugboard.c
+++ b/arch/arm/mach-omap2/board-zoom-debugboard.c
@@ -15,6 +15,7 @@
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16 16
17#include <plat/gpmc.h> 17#include <plat/gpmc.h>
18#include <plat/gpmc-smsc911x.h>
18 19
19#include <mach/board-zoom.h> 20#include <mach/board-zoom.h>
20 21
@@ -26,60 +27,16 @@
26#define DEBUG_BASE 0x08000000 27#define DEBUG_BASE 0x08000000
27#define ZOOM_ETHR_START DEBUG_BASE 28#define ZOOM_ETHR_START DEBUG_BASE
28 29
29static struct resource zoom_smsc911x_resources[] = { 30static struct omap_smsc911x_platform_data zoom_smsc911x_cfg = {
30 [0] = { 31 .cs = ZOOM_SMSC911X_CS,
31 .start = ZOOM_ETHR_START, 32 .gpio_irq = ZOOM_SMSC911X_GPIO,
32 .end = ZOOM_ETHR_START + SZ_4K, 33 .gpio_reset = -EINVAL,
33 .flags = IORESOURCE_MEM,
34 },
35 [1] = {
36 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
37 },
38};
39
40static struct smsc911x_platform_config zoom_smsc911x_config = {
41 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
42 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
43 .flags = SMSC911X_USE_32BIT, 34 .flags = SMSC911X_USE_32BIT,
44 .phy_interface = PHY_INTERFACE_MODE_MII,
45};
46
47static struct platform_device zoom_smsc911x_device = {
48 .name = "smsc911x",
49 .id = -1,
50 .num_resources = ARRAY_SIZE(zoom_smsc911x_resources),
51 .resource = zoom_smsc911x_resources,
52 .dev = {
53 .platform_data = &zoom_smsc911x_config,
54 },
55}; 35};
56 36
57static inline void __init zoom_init_smsc911x(void) 37static inline void __init zoom_init_smsc911x(void)
58{ 38{
59 int eth_cs; 39 gpmc_smsc911x_init(&zoom_smsc911x_cfg);
60 unsigned long cs_mem_base;
61 int eth_gpio = 0;
62
63 eth_cs = ZOOM_SMSC911X_CS;
64
65 if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
66 printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n");
67 return;
68 }
69
70 zoom_smsc911x_resources[0].start = cs_mem_base + 0x0;
71 zoom_smsc911x_resources[0].end = cs_mem_base + 0xff;
72
73 eth_gpio = ZOOM_SMSC911X_GPIO;
74
75 zoom_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
76
77 if (gpio_request(eth_gpio, "smsc911x irq") < 0) {
78 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
79 eth_gpio);
80 return;
81 }
82 gpio_direction_input(eth_gpio);
83} 40}
84 41
85static struct plat_serial8250_port serial_platform_data[] = { 42static struct plat_serial8250_port serial_platform_data[] = {
@@ -120,12 +77,9 @@ static inline void __init zoom_init_quaduart(void)
120 77
121 quart_gpio = ZOOM_QUADUART_GPIO; 78 quart_gpio = ZOOM_QUADUART_GPIO;
122 79
123 if (gpio_request(quart_gpio, "TL16CP754C GPIO") < 0) { 80 if (gpio_request_one(quart_gpio, GPIOF_IN, "TL16CP754C GPIO") < 0)
124 printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C\n", 81 printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C\n",
125 quart_gpio); 82 quart_gpio);
126 return;
127 }
128 gpio_direction_input(quart_gpio);
129} 83}
130 84
131static inline int omap_zoom_debugboard_detect(void) 85static inline int omap_zoom_debugboard_detect(void)
@@ -135,12 +89,12 @@ static inline int omap_zoom_debugboard_detect(void)
135 89
136 debug_board_detect = ZOOM_SMSC911X_GPIO; 90 debug_board_detect = ZOOM_SMSC911X_GPIO;
137 91
138 if (gpio_request(debug_board_detect, "Zoom debug board detect") < 0) { 92 if (gpio_request_one(debug_board_detect, GPIOF_IN,
93 "Zoom debug board detect") < 0) {
139 printk(KERN_ERR "Failed to request GPIO%d for Zoom debug" 94 printk(KERN_ERR "Failed to request GPIO%d for Zoom debug"
140 "board detect\n", debug_board_detect); 95 "board detect\n", debug_board_detect);
141 return 0; 96 return 0;
142 } 97 }
143 gpio_direction_input(debug_board_detect);
144 98
145 if (!gpio_get_value(debug_board_detect)) { 99 if (!gpio_get_value(debug_board_detect)) {
146 ret = 0; 100 ret = 0;
@@ -150,7 +104,6 @@ static inline int omap_zoom_debugboard_detect(void)
150} 104}
151 105
152static struct platform_device *zoom_devices[] __initdata = { 106static struct platform_device *zoom_devices[] __initdata = {
153 &zoom_smsc911x_device,
154 &zoom_debugboard_serial_device, 107 &zoom_debugboard_serial_device,
155}; 108};
156 109
diff --git a/arch/arm/mach-omap2/board-zoom-display.c b/arch/arm/mach-omap2/board-zoom-display.c
index 37b84c2b850f..ce53e82ba136 100644
--- a/arch/arm/mach-omap2/board-zoom-display.c
+++ b/arch/arm/mach-omap2/board-zoom-display.c
@@ -21,34 +21,19 @@
21#define LCD_PANEL_RESET_GPIO_PILOT 55 21#define LCD_PANEL_RESET_GPIO_PILOT 55
22#define LCD_PANEL_QVGA_GPIO 56 22#define LCD_PANEL_QVGA_GPIO 56
23 23
24static struct gpio zoom_lcd_gpios[] __initdata = {
25 { -EINVAL, GPIOF_OUT_INIT_HIGH, "lcd reset" },
26 { LCD_PANEL_QVGA_GPIO, GPIOF_OUT_INIT_HIGH, "lcd qvga" },
27};
28
24static void zoom_lcd_panel_init(void) 29static void zoom_lcd_panel_init(void)
25{ 30{
26 int ret; 31 zoom_lcd_gpios[0].gpio = (omap_rev() > OMAP3430_REV_ES3_0) ?
27 unsigned char lcd_panel_reset_gpio;
28
29 lcd_panel_reset_gpio = (omap_rev() > OMAP3430_REV_ES3_0) ?
30 LCD_PANEL_RESET_GPIO_PROD : 32 LCD_PANEL_RESET_GPIO_PROD :
31 LCD_PANEL_RESET_GPIO_PILOT; 33 LCD_PANEL_RESET_GPIO_PILOT;
32 34
33 ret = gpio_request(lcd_panel_reset_gpio, "lcd reset"); 35 if (gpio_request_array(zoom_lcd_gpios, ARRAY_SIZE(zoom_lcd_gpios)))
34 if (ret) { 36 pr_err("%s: Failed to get LCD GPIOs.\n", __func__);
35 pr_err("Failed to get LCD reset GPIO (gpio%d).\n",
36 lcd_panel_reset_gpio);
37 return;
38 }
39 gpio_direction_output(lcd_panel_reset_gpio, 1);
40
41 ret = gpio_request(LCD_PANEL_QVGA_GPIO, "lcd qvga");
42 if (ret) {
43 pr_err("Failed to get LCD_PANEL_QVGA_GPIO (gpio%d).\n",
44 LCD_PANEL_QVGA_GPIO);
45 goto err0;
46 }
47 gpio_direction_output(LCD_PANEL_QVGA_GPIO, 1);
48
49 return;
50err0:
51 gpio_free(lcd_panel_reset_gpio);
52} 37}
53 38
54static int zoom_panel_enable_lcd(struct omap_dss_device *dssdev) 39static int zoom_panel_enable_lcd(struct omap_dss_device *dssdev)
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index 8dee7549fbdf..118c6f53c5eb 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -31,6 +31,7 @@
31 31
32#include "mux.h" 32#include "mux.h"
33#include "hsmmc.h" 33#include "hsmmc.h"
34#include "common-board-devices.h"
34 35
35#define OMAP_ZOOM_WLAN_PMENA_GPIO (101) 36#define OMAP_ZOOM_WLAN_PMENA_GPIO (101)
36#define OMAP_ZOOM_WLAN_IRQ_GPIO (162) 37#define OMAP_ZOOM_WLAN_IRQ_GPIO (162)
@@ -276,13 +277,11 @@ static int zoom_twl_gpio_setup(struct device *dev,
276 zoom_vsim_supply.dev = mmc[0].dev; 277 zoom_vsim_supply.dev = mmc[0].dev;
277 zoom_vmmc2_supply.dev = mmc[1].dev; 278 zoom_vmmc2_supply.dev = mmc[1].dev;
278 279
279 ret = gpio_request(LCD_PANEL_ENABLE_GPIO, "lcd enable"); 280 ret = gpio_request_one(LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW,
280 if (ret) { 281 "lcd enable");
282 if (ret)
281 pr_err("Failed to get LCD_PANEL_ENABLE_GPIO (gpio%d).\n", 283 pr_err("Failed to get LCD_PANEL_ENABLE_GPIO (gpio%d).\n",
282 LCD_PANEL_ENABLE_GPIO); 284 LCD_PANEL_ENABLE_GPIO);
283 return ret;
284 }
285 gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 0);
286 285
287 return ret; 286 return ret;
288} 287}
@@ -349,15 +348,6 @@ static struct twl4030_platform_data zoom_twldata = {
349 .vdac = &zoom_vdac, 348 .vdac = &zoom_vdac,
350}; 349};
351 350
352static struct i2c_board_info __initdata zoom_i2c_boardinfo[] = {
353 {
354 I2C_BOARD_INFO("twl5030", 0x48),
355 .flags = I2C_CLIENT_WAKE,
356 .irq = INT_34XX_SYS_NIRQ,
357 .platform_data = &zoom_twldata,
358 },
359};
360
361static int __init omap_i2c_init(void) 351static int __init omap_i2c_init(void)
362{ 352{
363 if (machine_is_omap_zoom2()) { 353 if (machine_is_omap_zoom2()) {
@@ -365,19 +355,12 @@ static int __init omap_i2c_init(void)
365 zoom_audio_data.hs_extmute = 1; 355 zoom_audio_data.hs_extmute = 1;
366 zoom_audio_data.set_hs_extmute = zoom2_set_hs_extmute; 356 zoom_audio_data.set_hs_extmute = zoom2_set_hs_extmute;
367 } 357 }
368 omap_register_i2c_bus(1, 2400, zoom_i2c_boardinfo, 358 omap_pmic_init(1, 2400, "twl5030", INT_34XX_SYS_NIRQ, &zoom_twldata);
369 ARRAY_SIZE(zoom_i2c_boardinfo));
370 omap_register_i2c_bus(2, 400, NULL, 0); 359 omap_register_i2c_bus(2, 400, NULL, 0);
371 omap_register_i2c_bus(3, 400, NULL, 0); 360 omap_register_i2c_bus(3, 400, NULL, 0);
372 return 0; 361 return 0;
373} 362}
374 363
375static struct omap_musb_board_data musb_board_data = {
376 .interface_type = MUSB_INTERFACE_ULPI,
377 .mode = MUSB_OTG,
378 .power = 100,
379};
380
381static void enable_board_wakeup_source(void) 364static void enable_board_wakeup_source(void)
382{ 365{
383 /* T2 interrupt line (keypad) */ 366 /* T2 interrupt line (keypad) */
@@ -392,7 +375,7 @@ void __init zoom_peripherals_init(void)
392 375
393 omap_i2c_init(); 376 omap_i2c_init();
394 platform_device_register(&omap_vwlan_device); 377 platform_device_register(&omap_vwlan_device);
395 usb_musb_init(&musb_board_data); 378 usb_musb_init(NULL);
396 enable_board_wakeup_source(); 379 enable_board_wakeup_source();
397 omap_serial_init(); 380 omap_serial_init();
398} 381}
diff --git a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
index b2b1e37bb6bb..d6e34dd9e7e7 100644
--- a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
+++ b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
@@ -115,6 +115,7 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
115 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla, 115 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
116 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr, 116 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
117 0, 0, 0, 0); 117 0, 0, 0, 0);
118 clk->rate = rate;
118 119
119 return 0; 120 return 0;
120} 121}
diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
new file mode 100644
index 000000000000..e94903b2c65b
--- /dev/null
+++ b/arch/arm/mach-omap2/common-board-devices.c
@@ -0,0 +1,163 @@
1/*
2 * common-board-devices.c
3 *
4 * Copyright (C) 2011 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/i2c.h>
24#include <linux/i2c/twl.h>
25
26#include <linux/gpio.h>
27#include <linux/spi/spi.h>
28#include <linux/spi/ads7846.h>
29
30#include <plat/i2c.h>
31#include <plat/mcspi.h>
32#include <plat/nand.h>
33
34#include "common-board-devices.h"
35
36static struct i2c_board_info __initdata pmic_i2c_board_info = {
37 .addr = 0x48,
38 .flags = I2C_CLIENT_WAKE,
39};
40
41void __init omap_pmic_init(int bus, u32 clkrate,
42 const char *pmic_type, int pmic_irq,
43 struct twl4030_platform_data *pmic_data)
44{
45 strncpy(pmic_i2c_board_info.type, pmic_type,
46 sizeof(pmic_i2c_board_info.type));
47 pmic_i2c_board_info.irq = pmic_irq;
48 pmic_i2c_board_info.platform_data = pmic_data;
49
50 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
51}
52
53#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
54 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
55static struct omap2_mcspi_device_config ads7846_mcspi_config = {
56 .turbo_mode = 0,
57 .single_channel = 1, /* 0: slave, 1: master */
58};
59
60static struct ads7846_platform_data ads7846_config = {
61 .x_max = 0x0fff,
62 .y_max = 0x0fff,
63 .x_plate_ohms = 180,
64 .pressure_max = 255,
65 .debounce_max = 10,
66 .debounce_tol = 3,
67 .debounce_rep = 1,
68 .gpio_pendown = -EINVAL,
69 .keep_vref_on = 1,
70};
71
72static struct spi_board_info ads7846_spi_board_info __initdata = {
73 .modalias = "ads7846",
74 .bus_num = -EINVAL,
75 .chip_select = 0,
76 .max_speed_hz = 1500000,
77 .controller_data = &ads7846_mcspi_config,
78 .irq = -EINVAL,
79 .platform_data = &ads7846_config,
80};
81
82void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
83 struct ads7846_platform_data *board_pdata)
84{
85 struct spi_board_info *spi_bi = &ads7846_spi_board_info;
86 int err;
87
88 err = gpio_request(gpio_pendown, "TS PenDown");
89 if (err) {
90 pr_err("Could not obtain gpio for TS PenDown: %d\n", err);
91 return;
92 }
93
94 gpio_direction_input(gpio_pendown);
95 gpio_export(gpio_pendown, 0);
96
97 if (gpio_debounce)
98 gpio_set_debounce(gpio_pendown, gpio_debounce);
99
100 ads7846_config.gpio_pendown = gpio_pendown;
101
102 spi_bi->bus_num = bus_num;
103 spi_bi->irq = OMAP_GPIO_IRQ(gpio_pendown);
104
105 if (board_pdata)
106 spi_bi->platform_data = board_pdata;
107
108 spi_register_board_info(&ads7846_spi_board_info, 1);
109}
110#else
111void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
112 struct ads7846_platform_data *board_pdata)
113{
114}
115#endif
116
117#if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
118static struct omap_nand_platform_data nand_data = {
119 .dma_channel = -1, /* disable DMA in OMAP NAND driver */
120};
121
122void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
123 int nr_parts)
124{
125 u8 cs = 0;
126 u8 nandcs = GPMC_CS_NUM + 1;
127
128 /* find out the chip-select on which NAND exists */
129 while (cs < GPMC_CS_NUM) {
130 u32 ret = 0;
131 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
132
133 if ((ret & 0xC00) == 0x800) {
134 printk(KERN_INFO "Found NAND on CS%d\n", cs);
135 if (nandcs > GPMC_CS_NUM)
136 nandcs = cs;
137 }
138 cs++;
139 }
140
141 if (nandcs > GPMC_CS_NUM) {
142 printk(KERN_INFO "NAND: Unable to find configuration "
143 "in GPMC\n ");
144 return;
145 }
146
147 if (nandcs < GPMC_CS_NUM) {
148 nand_data.cs = nandcs;
149 nand_data.parts = parts;
150 nand_data.nr_parts = nr_parts;
151 nand_data.options = options;
152
153 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
154 if (gpmc_nand_init(&nand_data) < 0)
155 printk(KERN_ERR "Unable to register NAND device\n");
156 }
157}
158#else
159void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
160 int nr_parts)
161{
162}
163#endif
diff --git a/arch/arm/mach-omap2/common-board-devices.h b/arch/arm/mach-omap2/common-board-devices.h
new file mode 100644
index 000000000000..eb80b3b0ef47
--- /dev/null
+++ b/arch/arm/mach-omap2/common-board-devices.h
@@ -0,0 +1,35 @@
1#ifndef __OMAP_COMMON_BOARD_DEVICES__
2#define __OMAP_COMMON_BOARD_DEVICES__
3
4struct twl4030_platform_data;
5struct mtd_partition;
6
7void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq,
8 struct twl4030_platform_data *pmic_data);
9
10static inline void omap2_pmic_init(const char *pmic_type,
11 struct twl4030_platform_data *pmic_data)
12{
13 omap_pmic_init(2, 2600, pmic_type, INT_24XX_SYS_NIRQ, pmic_data);
14}
15
16static inline void omap3_pmic_init(const char *pmic_type,
17 struct twl4030_platform_data *pmic_data)
18{
19 omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data);
20}
21
22static inline void omap4_pmic_init(const char *pmic_type,
23 struct twl4030_platform_data *pmic_data)
24{
25 /* Phoenix Audio IC needs I2C1 to start with 400 KHz or less */
26 omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data);
27}
28
29struct ads7846_platform_data;
30
31void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
32 struct ads7846_platform_data *board_pdata);
33void omap_nand_flash_init(int opts, struct mtd_partition *parts, int n_parts);
34
35#endif /* __OMAP_COMMON_BOARD_DEVICES__ */
diff --git a/arch/arm/mach-omap2/gpmc-smc91x.c b/arch/arm/mach-omap2/gpmc-smc91x.c
index 877c6f5807b7..ba10c24f3d8d 100644
--- a/arch/arm/mach-omap2/gpmc-smc91x.c
+++ b/arch/arm/mach-omap2/gpmc-smc91x.c
@@ -147,25 +147,24 @@ void __init gpmc_smc91x_init(struct omap_smc91x_platform_data *board_data)
147 goto free1; 147 goto free1;
148 } 148 }
149 149
150 if (gpio_request(gpmc_cfg->gpio_irq, "SMC91X irq") < 0) 150 if (gpio_request_one(gpmc_cfg->gpio_irq, GPIOF_IN, "SMC91X irq") < 0)
151 goto free1; 151 goto free1;
152 152
153 gpio_direction_input(gpmc_cfg->gpio_irq);
154 gpmc_smc91x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq); 153 gpmc_smc91x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq);
155 154
156 if (gpmc_cfg->gpio_pwrdwn) { 155 if (gpmc_cfg->gpio_pwrdwn) {
157 ret = gpio_request(gpmc_cfg->gpio_pwrdwn, "SMC91X powerdown"); 156 ret = gpio_request_one(gpmc_cfg->gpio_pwrdwn,
157 GPIOF_OUT_INIT_LOW, "SMC91X powerdown");
158 if (ret) 158 if (ret)
159 goto free2; 159 goto free2;
160 gpio_direction_output(gpmc_cfg->gpio_pwrdwn, 0);
161 } 160 }
162 161
163 if (gpmc_cfg->gpio_reset) { 162 if (gpmc_cfg->gpio_reset) {
164 ret = gpio_request(gpmc_cfg->gpio_reset, "SMC91X reset"); 163 ret = gpio_request_one(gpmc_cfg->gpio_reset,
164 GPIOF_OUT_INIT_LOW, "SMC91X reset");
165 if (ret) 165 if (ret)
166 goto free3; 166 goto free3;
167 167
168 gpio_direction_output(gpmc_cfg->gpio_reset, 0);
169 gpio_set_value(gpmc_cfg->gpio_reset, 1); 168 gpio_set_value(gpmc_cfg->gpio_reset, 1);
170 msleep(100); 169 msleep(100);
171 gpio_set_value(gpmc_cfg->gpio_reset, 0); 170 gpio_set_value(gpmc_cfg->gpio_reset, 0);
diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c
index 703f150dd01d..997033129d26 100644
--- a/arch/arm/mach-omap2/gpmc-smsc911x.c
+++ b/arch/arm/mach-omap2/gpmc-smsc911x.c
@@ -10,6 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13#define pr_fmt(fmt) "%s: " fmt, __func__
13 14
14#include <linux/kernel.h> 15#include <linux/kernel.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
@@ -30,7 +31,7 @@ static struct resource gpmc_smsc911x_resources[] = {
30 .flags = IORESOURCE_MEM, 31 .flags = IORESOURCE_MEM,
31 }, 32 },
32 [1] = { 33 [1] = {
33 .flags = IORESOURCE_IRQ, 34 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
34 }, 35 },
35}; 36};
36 37
@@ -41,16 +42,6 @@ static struct smsc911x_platform_config gpmc_smsc911x_config = {
41 .flags = SMSC911X_USE_16BIT, 42 .flags = SMSC911X_USE_16BIT,
42}; 43};
43 44
44static struct platform_device gpmc_smsc911x_device = {
45 .name = "smsc911x",
46 .id = -1,
47 .num_resources = ARRAY_SIZE(gpmc_smsc911x_resources),
48 .resource = gpmc_smsc911x_resources,
49 .dev = {
50 .platform_data = &gpmc_smsc911x_config,
51 },
52};
53
54/* 45/*
55 * Initialize smsc911x device connected to the GPMC. Note that we 46 * Initialize smsc911x device connected to the GPMC. Note that we
56 * assume that pin multiplexing is done in the board-*.c file, 47 * assume that pin multiplexing is done in the board-*.c file,
@@ -58,46 +49,49 @@ static struct platform_device gpmc_smsc911x_device = {
58 */ 49 */
59void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data) 50void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data)
60{ 51{
52 struct platform_device *pdev;
61 unsigned long cs_mem_base; 53 unsigned long cs_mem_base;
62 int ret; 54 int ret;
63 55
64 gpmc_cfg = board_data; 56 gpmc_cfg = board_data;
65 57
66 if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) { 58 if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) {
67 printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n"); 59 pr_err("Failed to request GPMC mem region\n");
68 return; 60 return;
69 } 61 }
70 62
71 gpmc_smsc911x_resources[0].start = cs_mem_base + 0x0; 63 gpmc_smsc911x_resources[0].start = cs_mem_base + 0x0;
72 gpmc_smsc911x_resources[0].end = cs_mem_base + 0xff; 64 gpmc_smsc911x_resources[0].end = cs_mem_base + 0xff;
73 65
74 if (gpio_request(gpmc_cfg->gpio_irq, "smsc911x irq") < 0) { 66 if (gpio_request_one(gpmc_cfg->gpio_irq, GPIOF_IN, "smsc911x irq")) {
75 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n", 67 pr_err("Failed to request IRQ GPIO%d\n", gpmc_cfg->gpio_irq);
76 gpmc_cfg->gpio_irq);
77 goto free1; 68 goto free1;
78 } 69 }
79 70
80 gpio_direction_input(gpmc_cfg->gpio_irq);
81 gpmc_smsc911x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq); 71 gpmc_smsc911x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq);
82 gpmc_smsc911x_resources[1].flags |=
83 (gpmc_cfg->flags & IRQF_TRIGGER_MASK);
84 72
85 if (gpio_is_valid(gpmc_cfg->gpio_reset)) { 73 if (gpio_is_valid(gpmc_cfg->gpio_reset)) {
86 ret = gpio_request(gpmc_cfg->gpio_reset, "smsc911x reset"); 74 ret = gpio_request_one(gpmc_cfg->gpio_reset,
75 GPIOF_OUT_INIT_HIGH, "smsc911x reset");
87 if (ret) { 76 if (ret) {
88 printk(KERN_ERR "Failed to request GPIO%d for smsc911x reset\n", 77 pr_err("Failed to request reset GPIO%d\n",
89 gpmc_cfg->gpio_reset); 78 gpmc_cfg->gpio_reset);
90 goto free2; 79 goto free2;
91 } 80 }
92 81
93 gpio_direction_output(gpmc_cfg->gpio_reset, 1);
94 gpio_set_value(gpmc_cfg->gpio_reset, 0); 82 gpio_set_value(gpmc_cfg->gpio_reset, 0);
95 msleep(100); 83 msleep(100);
96 gpio_set_value(gpmc_cfg->gpio_reset, 1); 84 gpio_set_value(gpmc_cfg->gpio_reset, 1);
97 } 85 }
98 86
99 if (platform_device_register(&gpmc_smsc911x_device) < 0) { 87 if (gpmc_cfg->flags)
100 printk(KERN_ERR "Unable to register smsc911x device\n"); 88 gpmc_smsc911x_config.flags = gpmc_cfg->flags;
89
90 pdev = platform_device_register_resndata(NULL, "smsc911x", gpmc_cfg->id,
91 gpmc_smsc911x_resources, ARRAY_SIZE(gpmc_smsc911x_resources),
92 &gpmc_smsc911x_config, sizeof(gpmc_smsc911x_config));
93 if (!pdev) {
94 pr_err("Unable to register platform device\n");
101 gpio_free(gpmc_cfg->gpio_reset); 95 gpio_free(gpmc_cfg->gpio_reset);
102 goto free2; 96 goto free2;
103 } 97 }
@@ -109,5 +103,5 @@ free2:
109free1: 103free1:
110 gpmc_cs_free(gpmc_cfg->cs); 104 gpmc_cs_free(gpmc_cfg->cs);
111 105
112 printk(KERN_ERR "Could not initialize smsc911x\n"); 106 pr_err("Could not initialize smsc911x device\n");
113} 107}
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 237e4530abf2..3af2b7a1045e 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -73,83 +73,18 @@ static u32 intc_bank_read_reg(struct omap_irq_bank *bank, u16 reg)
73 return __raw_readl(bank->base_reg + reg); 73 return __raw_readl(bank->base_reg + reg);
74} 74}
75 75
76static int previous_irq;
77
78/*
79 * On 34xx we can get occasional spurious interrupts if the ack from
80 * an interrupt handler does not get posted before we unmask. Warn about
81 * the interrupt handlers that need to flush posted writes.
82 */
83static int omap_check_spurious(unsigned int irq)
84{
85 u32 sir, spurious;
86
87 sir = intc_bank_read_reg(&irq_banks[0], INTC_SIR);
88 spurious = sir >> 7;
89
90 if (spurious) {
91 printk(KERN_WARNING "Spurious irq %i: 0x%08x, please flush "
92 "posted write for irq %i\n",
93 irq, sir, previous_irq);
94 return spurious;
95 }
96
97 return 0;
98}
99
100/* XXX: FIQ and additional INTC support (only MPU at the moment) */ 76/* XXX: FIQ and additional INTC support (only MPU at the moment) */
101static void omap_ack_irq(struct irq_data *d) 77static void omap_ack_irq(struct irq_data *d)
102{ 78{
103 intc_bank_write_reg(0x1, &irq_banks[0], INTC_CONTROL); 79 intc_bank_write_reg(0x1, &irq_banks[0], INTC_CONTROL);
104} 80}
105 81
106static void omap_mask_irq(struct irq_data *d)
107{
108 unsigned int irq = d->irq;
109 int offset = irq & (~(IRQ_BITS_PER_REG - 1));
110
111 if (cpu_is_omap34xx() && !cpu_is_ti816x()) {
112 int spurious = 0;
113
114 /*
115 * INT_34XX_GPT12_IRQ is also the spurious irq. Maybe because
116 * it is the highest irq number?
117 */
118 if (irq == INT_34XX_GPT12_IRQ)
119 spurious = omap_check_spurious(irq);
120
121 if (!spurious)
122 previous_irq = irq;
123 }
124
125 irq &= (IRQ_BITS_PER_REG - 1);
126
127 intc_bank_write_reg(1 << irq, &irq_banks[0], INTC_MIR_SET0 + offset);
128}
129
130static void omap_unmask_irq(struct irq_data *d)
131{
132 unsigned int irq = d->irq;
133 int offset = irq & (~(IRQ_BITS_PER_REG - 1));
134
135 irq &= (IRQ_BITS_PER_REG - 1);
136
137 intc_bank_write_reg(1 << irq, &irq_banks[0], INTC_MIR_CLEAR0 + offset);
138}
139
140static void omap_mask_ack_irq(struct irq_data *d) 82static void omap_mask_ack_irq(struct irq_data *d)
141{ 83{
142 omap_mask_irq(d); 84 irq_gc_mask_disable_reg(d);
143 omap_ack_irq(d); 85 omap_ack_irq(d);
144} 86}
145 87
146static struct irq_chip omap_irq_chip = {
147 .name = "INTC",
148 .irq_ack = omap_mask_ack_irq,
149 .irq_mask = omap_mask_irq,
150 .irq_unmask = omap_unmask_irq,
151};
152
153static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank) 88static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank)
154{ 89{
155 unsigned long tmp; 90 unsigned long tmp;
@@ -186,11 +121,31 @@ int omap_irq_pending(void)
186 return 0; 121 return 0;
187} 122}
188 123
124static __init void
125omap_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
126{
127 struct irq_chip_generic *gc;
128 struct irq_chip_type *ct;
129
130 gc = irq_alloc_generic_chip("INTC", 1, irq_start, base,
131 handle_level_irq);
132 ct = gc->chip_types;
133 ct->chip.irq_ack = omap_mask_ack_irq;
134 ct->chip.irq_mask = irq_gc_mask_disable_reg;
135 ct->chip.irq_unmask = irq_gc_unmask_enable_reg;
136
137 ct->regs.ack = INTC_CONTROL;
138 ct->regs.enable = INTC_MIR_CLEAR0;
139 ct->regs.disable = INTC_MIR_SET0;
140 irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE,
141 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
142}
143
189void __init omap_init_irq(void) 144void __init omap_init_irq(void)
190{ 145{
191 unsigned long nr_of_irqs = 0; 146 unsigned long nr_of_irqs = 0;
192 unsigned int nr_banks = 0; 147 unsigned int nr_banks = 0;
193 int i; 148 int i, j;
194 149
195 for (i = 0; i < ARRAY_SIZE(irq_banks); i++) { 150 for (i = 0; i < ARRAY_SIZE(irq_banks); i++) {
196 unsigned long base = 0; 151 unsigned long base = 0;
@@ -215,17 +170,15 @@ void __init omap_init_irq(void)
215 170
216 omap_irq_bank_init_one(bank); 171 omap_irq_bank_init_one(bank);
217 172
173 for (i = 0, j = 0; i < bank->nr_irqs; i += 32, j += 0x20)
174 omap_alloc_gc(bank->base_reg + j, i, 32);
175
218 nr_of_irqs += bank->nr_irqs; 176 nr_of_irqs += bank->nr_irqs;
219 nr_banks++; 177 nr_banks++;
220 } 178 }
221 179
222 printk(KERN_INFO "Total of %ld interrupts on %d active controller%s\n", 180 printk(KERN_INFO "Total of %ld interrupts on %d active controller%s\n",
223 nr_of_irqs, nr_banks, nr_banks > 1 ? "s" : ""); 181 nr_of_irqs, nr_banks, nr_banks > 1 ? "s" : "");
224
225 for (i = 0; i < nr_of_irqs; i++) {
226 irq_set_chip_and_handler(i, &omap_irq_chip, handle_level_irq);
227 set_irq_flags(i, IRQF_VALID);
228 }
229} 182}
230 183
231#ifdef CONFIG_ARCH_OMAP3 184#ifdef CONFIG_ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/omap_l3_noc.c b/arch/arm/mach-omap2/omap_l3_noc.c
index 82632c24076f..7b9f1909ddb2 100644
--- a/arch/arm/mach-omap2/omap_l3_noc.c
+++ b/arch/arm/mach-omap2/omap_l3_noc.c
@@ -63,10 +63,7 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
63 char *source_name; 63 char *source_name;
64 64
65 /* Get the Type of interrupt */ 65 /* Get the Type of interrupt */
66 if (irq == l3->app_irq) 66 inttype = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR;
67 inttype = L3_APPLICATION_ERROR;
68 else
69 inttype = L3_DEBUG_ERROR;
70 67
71 for (i = 0; i < L3_MODULES; i++) { 68 for (i = 0; i < L3_MODULES; i++) {
72 /* 69 /*
@@ -84,10 +81,10 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
84 81
85 err_src = j; 82 err_src = j;
86 /* Read the stderrlog_main_source from clk domain */ 83 /* Read the stderrlog_main_source from clk domain */
87 std_err_main_addr = base + (*(l3_targ[i] + err_src)); 84 std_err_main_addr = base + *(l3_targ[i] + err_src);
88 std_err_main = readl(std_err_main_addr); 85 std_err_main = readl(std_err_main_addr);
89 86
90 switch ((std_err_main & CUSTOM_ERROR)) { 87 switch (std_err_main & CUSTOM_ERROR) {
91 case STANDARD_ERROR: 88 case STANDARD_ERROR:
92 source_name = 89 source_name =
93 l3_targ_stderrlog_main_name[i][err_src]; 90 l3_targ_stderrlog_main_name[i][err_src];
@@ -132,49 +129,49 @@ static int __init omap4_l3_probe(struct platform_device *pdev)
132 129
133 l3 = kzalloc(sizeof(*l3), GFP_KERNEL); 130 l3 = kzalloc(sizeof(*l3), GFP_KERNEL);
134 if (!l3) 131 if (!l3)
135 ret = -ENOMEM; 132 return -ENOMEM;
136 133
137 platform_set_drvdata(pdev, l3); 134 platform_set_drvdata(pdev, l3);
138 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 135 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
139 if (!res) { 136 if (!res) {
140 dev_err(&pdev->dev, "couldn't find resource 0\n"); 137 dev_err(&pdev->dev, "couldn't find resource 0\n");
141 ret = -ENODEV; 138 ret = -ENODEV;
142 goto err1; 139 goto err0;
143 } 140 }
144 141
145 l3->l3_base[0] = ioremap(res->start, resource_size(res)); 142 l3->l3_base[0] = ioremap(res->start, resource_size(res));
146 if (!(l3->l3_base[0])) { 143 if (!l3->l3_base[0]) {
147 dev_err(&pdev->dev, "ioremap failed\n"); 144 dev_err(&pdev->dev, "ioremap failed\n");
148 ret = -ENOMEM; 145 ret = -ENOMEM;
149 goto err2; 146 goto err0;
150 } 147 }
151 148
152 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 149 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
153 if (!res) { 150 if (!res) {
154 dev_err(&pdev->dev, "couldn't find resource 1\n"); 151 dev_err(&pdev->dev, "couldn't find resource 1\n");
155 ret = -ENODEV; 152 ret = -ENODEV;
156 goto err3; 153 goto err1;
157 } 154 }
158 155
159 l3->l3_base[1] = ioremap(res->start, resource_size(res)); 156 l3->l3_base[1] = ioremap(res->start, resource_size(res));
160 if (!(l3->l3_base[1])) { 157 if (!l3->l3_base[1]) {
161 dev_err(&pdev->dev, "ioremap failed\n"); 158 dev_err(&pdev->dev, "ioremap failed\n");
162 ret = -ENOMEM; 159 ret = -ENOMEM;
163 goto err4; 160 goto err1;
164 } 161 }
165 162
166 res = platform_get_resource(pdev, IORESOURCE_MEM, 2); 163 res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
167 if (!res) { 164 if (!res) {
168 dev_err(&pdev->dev, "couldn't find resource 2\n"); 165 dev_err(&pdev->dev, "couldn't find resource 2\n");
169 ret = -ENODEV; 166 ret = -ENODEV;
170 goto err5; 167 goto err2;
171 } 168 }
172 169
173 l3->l3_base[2] = ioremap(res->start, resource_size(res)); 170 l3->l3_base[2] = ioremap(res->start, resource_size(res));
174 if (!(l3->l3_base[2])) { 171 if (!l3->l3_base[2]) {
175 dev_err(&pdev->dev, "ioremap failed\n"); 172 dev_err(&pdev->dev, "ioremap failed\n");
176 ret = -ENOMEM; 173 ret = -ENOMEM;
177 goto err6; 174 goto err2;
178 } 175 }
179 176
180 /* 177 /*
@@ -187,7 +184,7 @@ static int __init omap4_l3_probe(struct platform_device *pdev)
187 if (ret) { 184 if (ret) {
188 pr_crit("L3: request_irq failed to register for 0x%x\n", 185 pr_crit("L3: request_irq failed to register for 0x%x\n",
189 OMAP44XX_IRQ_L3_DBG); 186 OMAP44XX_IRQ_L3_DBG);
190 goto err7; 187 goto err3;
191 } 188 }
192 l3->debug_irq = irq; 189 l3->debug_irq = irq;
193 190
@@ -198,24 +195,22 @@ static int __init omap4_l3_probe(struct platform_device *pdev)
198 if (ret) { 195 if (ret) {
199 pr_crit("L3: request_irq failed to register for 0x%x\n", 196 pr_crit("L3: request_irq failed to register for 0x%x\n",
200 OMAP44XX_IRQ_L3_APP); 197 OMAP44XX_IRQ_L3_APP);
201 goto err8; 198 goto err4;
202 } 199 }
203 l3->app_irq = irq; 200 l3->app_irq = irq;
204 201
205 goto err0; 202 return 0;
206err8: 203
207err7:
208 iounmap(l3->l3_base[2]);
209err6:
210err5:
211 iounmap(l3->l3_base[1]);
212err4: 204err4:
205 free_irq(l3->debug_irq, l3);
213err3: 206err3:
214 iounmap(l3->l3_base[0]); 207 iounmap(l3->l3_base[2]);
215err2: 208err2:
209 iounmap(l3->l3_base[1]);
216err1: 210err1:
217 kfree(l3); 211 iounmap(l3->l3_base[0]);
218err0: 212err0:
213 kfree(l3);
219 return ret; 214 return ret;
220} 215}
221 216
diff --git a/arch/arm/mach-omap2/omap_l3_smx.c b/arch/arm/mach-omap2/omap_l3_smx.c
index 4321e7938929..873c0e33b512 100644
--- a/arch/arm/mach-omap2/omap_l3_smx.c
+++ b/arch/arm/mach-omap2/omap_l3_smx.c
@@ -155,7 +155,7 @@ static irqreturn_t omap3_l3_block_irq(struct omap3_l3 *l3,
155 u8 multi = error & L3_ERROR_LOG_MULTI; 155 u8 multi = error & L3_ERROR_LOG_MULTI;
156 u32 address = omap3_l3_decode_addr(error_addr); 156 u32 address = omap3_l3_decode_addr(error_addr);
157 157
158 WARN(true, "%s Error seen by %s %s at address %x\n", 158 WARN(true, "%s seen by %s %s at address %x\n",
159 omap3_l3_code_string(code), 159 omap3_l3_code_string(code),
160 omap3_l3_initiator_string(initid), 160 omap3_l3_initiator_string(initid),
161 multi ? "Multiple Errors" : "", 161 multi ? "Multiple Errors" : "",
@@ -167,21 +167,15 @@ static irqreturn_t omap3_l3_block_irq(struct omap3_l3 *l3,
167static irqreturn_t omap3_l3_app_irq(int irq, void *_l3) 167static irqreturn_t omap3_l3_app_irq(int irq, void *_l3)
168{ 168{
169 struct omap3_l3 *l3 = _l3; 169 struct omap3_l3 *l3 = _l3;
170
171 u64 status, clear; 170 u64 status, clear;
172 u64 error; 171 u64 error;
173 u64 error_addr; 172 u64 error_addr;
174 u64 err_source = 0; 173 u64 err_source = 0;
175 void __iomem *base; 174 void __iomem *base;
176 int int_type; 175 int int_type;
177
178 irqreturn_t ret = IRQ_NONE; 176 irqreturn_t ret = IRQ_NONE;
179 177
180 if (irq == l3->app_irq) 178 int_type = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR;
181 int_type = L3_APPLICATION_ERROR;
182 else
183 int_type = L3_DEBUG_ERROR;
184
185 if (!int_type) { 179 if (!int_type) {
186 status = omap3_l3_readll(l3->rt, L3_SI_FLAG_STATUS_0); 180 status = omap3_l3_readll(l3->rt, L3_SI_FLAG_STATUS_0);
187 /* 181 /*
@@ -202,7 +196,6 @@ static irqreturn_t omap3_l3_app_irq(int irq, void *_l3)
202 196
203 base = l3->rt + *(omap3_l3_bases[int_type] + err_source); 197 base = l3->rt + *(omap3_l3_bases[int_type] + err_source);
204 error = omap3_l3_readll(base, L3_ERROR_LOG); 198 error = omap3_l3_readll(base, L3_ERROR_LOG);
205
206 if (error) { 199 if (error) {
207 error_addr = omap3_l3_readll(base, L3_ERROR_LOG_ADDR); 200 error_addr = omap3_l3_readll(base, L3_ERROR_LOG_ADDR);
208 201
@@ -210,9 +203,8 @@ static irqreturn_t omap3_l3_app_irq(int irq, void *_l3)
210 } 203 }
211 204
212 /* Clear the status register */ 205 /* Clear the status register */
213 clear = ((L3_AGENT_STATUS_CLEAR_IA << int_type) | 206 clear = (L3_AGENT_STATUS_CLEAR_IA << int_type) |
214 (L3_AGENT_STATUS_CLEAR_TA)); 207 L3_AGENT_STATUS_CLEAR_TA;
215
216 omap3_l3_writell(base, L3_AGENT_STATUS, clear); 208 omap3_l3_writell(base, L3_AGENT_STATUS, clear);
217 209
218 /* clear the error log register */ 210 /* clear the error log register */
@@ -228,10 +220,8 @@ static int __init omap3_l3_probe(struct platform_device *pdev)
228 int ret; 220 int ret;
229 221
230 l3 = kzalloc(sizeof(*l3), GFP_KERNEL); 222 l3 = kzalloc(sizeof(*l3), GFP_KERNEL);
231 if (!l3) { 223 if (!l3)
232 ret = -ENOMEM; 224 return -ENOMEM;
233 goto err0;
234 }
235 225
236 platform_set_drvdata(pdev, l3); 226 platform_set_drvdata(pdev, l3);
237 227
@@ -239,13 +229,13 @@ static int __init omap3_l3_probe(struct platform_device *pdev)
239 if (!res) { 229 if (!res) {
240 dev_err(&pdev->dev, "couldn't find resource\n"); 230 dev_err(&pdev->dev, "couldn't find resource\n");
241 ret = -ENODEV; 231 ret = -ENODEV;
242 goto err1; 232 goto err0;
243 } 233 }
244 l3->rt = ioremap(res->start, resource_size(res)); 234 l3->rt = ioremap(res->start, resource_size(res));
245 if (!(l3->rt)) { 235 if (!l3->rt) {
246 dev_err(&pdev->dev, "ioremap failed\n"); 236 dev_err(&pdev->dev, "ioremap failed\n");
247 ret = -ENOMEM; 237 ret = -ENOMEM;
248 goto err2; 238 goto err0;
249 } 239 }
250 240
251 l3->debug_irq = platform_get_irq(pdev, 0); 241 l3->debug_irq = platform_get_irq(pdev, 0);
@@ -254,28 +244,26 @@ static int __init omap3_l3_probe(struct platform_device *pdev)
254 "l3-debug-irq", l3); 244 "l3-debug-irq", l3);
255 if (ret) { 245 if (ret) {
256 dev_err(&pdev->dev, "couldn't request debug irq\n"); 246 dev_err(&pdev->dev, "couldn't request debug irq\n");
257 goto err3; 247 goto err1;
258 } 248 }
259 249
260 l3->app_irq = platform_get_irq(pdev, 1); 250 l3->app_irq = platform_get_irq(pdev, 1);
261 ret = request_irq(l3->app_irq, omap3_l3_app_irq, 251 ret = request_irq(l3->app_irq, omap3_l3_app_irq,
262 IRQF_DISABLED | IRQF_TRIGGER_RISING, 252 IRQF_DISABLED | IRQF_TRIGGER_RISING,
263 "l3-app-irq", l3); 253 "l3-app-irq", l3);
264
265 if (ret) { 254 if (ret) {
266 dev_err(&pdev->dev, "couldn't request app irq\n"); 255 dev_err(&pdev->dev, "couldn't request app irq\n");
267 goto err4; 256 goto err2;
268 } 257 }
269 258
270 goto err0; 259 return 0;
271 260
272err4:
273err3:
274 iounmap(l3->rt);
275err2: 261err2:
262 free_irq(l3->debug_irq, l3);
276err1: 263err1:
277 kfree(l3); 264 iounmap(l3->rt);
278err0: 265err0:
266 kfree(l3);
279 return ret; 267 return ret;
280} 268}
281 269
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index 76cfff2db514..59a870be8390 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -105,13 +105,11 @@ static int __init omap4_pm_init(void)
105 105
106 pr_err("Power Management for TI OMAP4.\n"); 106 pr_err("Power Management for TI OMAP4.\n");
107 107
108#ifdef CONFIG_PM
109 ret = pwrdm_for_each(pwrdms_setup, NULL); 108 ret = pwrdm_for_each(pwrdms_setup, NULL);
110 if (ret) { 109 if (ret) {
111 pr_err("Failed to setup powerdomains\n"); 110 pr_err("Failed to setup powerdomains\n");
112 goto err2; 111 goto err2;
113 } 112 }
114#endif
115 113
116#ifdef CONFIG_SUSPEND 114#ifdef CONFIG_SUSPEND
117 suspend_set_ops(&omap_pm_ops); 115 suspend_set_ops(&omap_pm_ops);
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 13e24f913dd4..fb7dc52394a8 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -847,6 +847,14 @@ static int __init omap_sr_probe(struct platform_device *pdev)
847 goto err_free_devinfo; 847 goto err_free_devinfo;
848 } 848 }
849 849
850 mem = request_mem_region(mem->start, resource_size(mem),
851 dev_name(&pdev->dev));
852 if (!mem) {
853 dev_err(&pdev->dev, "%s: no mem region\n", __func__);
854 ret = -EBUSY;
855 goto err_free_devinfo;
856 }
857
850 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 858 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
851 859
852 pm_runtime_enable(&pdev->dev); 860 pm_runtime_enable(&pdev->dev);
@@ -883,7 +891,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
883 ret = sr_late_init(sr_info); 891 ret = sr_late_init(sr_info);
884 if (ret) { 892 if (ret) {
885 pr_warning("%s: Error in SR late init\n", __func__); 893 pr_warning("%s: Error in SR late init\n", __func__);
886 goto err_release_region; 894 return ret;
887 } 895 }
888 } 896 }
889 897
@@ -896,7 +904,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
896 vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm); 904 vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm);
897 if (!vdd_dbg_dir) { 905 if (!vdd_dbg_dir) {
898 ret = -EINVAL; 906 ret = -EINVAL;
899 goto err_release_region; 907 goto err_iounmap;
900 } 908 }
901 909
902 sr_info->dbg_dir = debugfs_create_dir("smartreflex", vdd_dbg_dir); 910 sr_info->dbg_dir = debugfs_create_dir("smartreflex", vdd_dbg_dir);
@@ -904,7 +912,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
904 dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n", 912 dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n",
905 __func__); 913 __func__);
906 ret = PTR_ERR(sr_info->dbg_dir); 914 ret = PTR_ERR(sr_info->dbg_dir);
907 goto err_release_region; 915 goto err_iounmap;
908 } 916 }
909 917
910 (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUSR, 918 (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUSR,
@@ -921,7 +929,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
921 dev_err(&pdev->dev, "%s: Unable to create debugfs directory" 929 dev_err(&pdev->dev, "%s: Unable to create debugfs directory"
922 "for n-values\n", __func__); 930 "for n-values\n", __func__);
923 ret = PTR_ERR(nvalue_dir); 931 ret = PTR_ERR(nvalue_dir);
924 goto err_release_region; 932 goto err_debugfs;
925 } 933 }
926 934
927 omap_voltage_get_volttable(sr_info->voltdm, &volt_data); 935 omap_voltage_get_volttable(sr_info->voltdm, &volt_data);
@@ -931,7 +939,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
931 "entries for n-values\n", 939 "entries for n-values\n",
932 __func__, sr_info->voltdm->name); 940 __func__, sr_info->voltdm->name);
933 ret = -ENODATA; 941 ret = -ENODATA;
934 goto err_release_region; 942 goto err_debugfs;
935 } 943 }
936 944
937 for (i = 0; i < sr_info->nvalue_count; i++) { 945 for (i = 0; i < sr_info->nvalue_count; i++) {
@@ -945,6 +953,11 @@ static int __init omap_sr_probe(struct platform_device *pdev)
945 953
946 return ret; 954 return ret;
947 955
956err_debugfs:
957 debugfs_remove_recursive(sr_info->dbg_dir);
958err_iounmap:
959 list_del(&sr_info->node);
960 iounmap(sr_info->base);
948err_release_region: 961err_release_region:
949 release_mem_region(mem->start, resource_size(mem)); 962 release_mem_region(mem->start, resource_size(mem));
950err_free_devinfo: 963err_free_devinfo:
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index fd95e62e8fcf..c7ed540d868d 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -108,7 +108,13 @@ static void usb_musb_mux_init(struct omap_musb_board_data *board_data)
108 } 108 }
109} 109}
110 110
111void __init usb_musb_init(struct omap_musb_board_data *board_data) 111static struct omap_musb_board_data musb_default_board_data = {
112 .interface_type = MUSB_INTERFACE_ULPI,
113 .mode = MUSB_OTG,
114 .power = 100,
115};
116
117void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
112{ 118{
113 struct omap_hwmod *oh; 119 struct omap_hwmod *oh;
114 struct omap_device *od; 120 struct omap_device *od;
@@ -116,6 +122,12 @@ void __init usb_musb_init(struct omap_musb_board_data *board_data)
116 struct device *dev; 122 struct device *dev;
117 int bus_id = -1; 123 int bus_id = -1;
118 const char *oh_name, *name; 124 const char *oh_name, *name;
125 struct omap_musb_board_data *board_data;
126
127 if (musb_board_data)
128 board_data = musb_board_data;
129 else
130 board_data = &musb_default_board_data;
119 131
120 /* 132 /*
121 * REVISIT: This line can be removed once all the platforms using 133 * REVISIT: This line can be removed once all the platforms using
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
index 8a3c05f3c1d6..8dd26b765b7d 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -293,12 +293,11 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data,
293 ); 293 );
294 294
295 /* IRQ */ 295 /* IRQ */
296 status = gpio_request(irq, "TUSB6010 irq"); 296 status = gpio_request_one(irq, GPIOF_IN, "TUSB6010 irq");
297 if (status < 0) { 297 if (status < 0) {
298 printk(error, 3, status); 298 printk(error, 3, status);
299 return status; 299 return status;
300 } 300 }
301 gpio_direction_input(irq);
302 tusb_resources[2].start = irq + IH_GPIO_BASE; 301 tusb_resources[2].start = irq + IH_GPIO_BASE;
303 302
304 /* set up memory timings ... can speed them up later */ 303 /* set up memory timings ... can speed them up later */
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 0c1552d9d995..9ef3789ded4b 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -148,7 +148,6 @@ static int vp_volt_debug_get(void *data, u64 *val)
148 } 148 }
149 149
150 vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage); 150 vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage);
151 pr_notice("curr_vsel = %x\n", vsel);
152 151
153 if (!vdd->pmic_info->vsel_to_uv) { 152 if (!vdd->pmic_info->vsel_to_uv) {
154 pr_warning("PMIC function to convert vsel to voltage" 153 pr_warning("PMIC function to convert vsel to voltage"
diff --git a/arch/arm/mach-realview/include/mach/barriers.h b/arch/arm/mach-realview/include/mach/barriers.h
index 0c5d749d7b5f..9a732195aa1c 100644
--- a/arch/arm/mach-realview/include/mach/barriers.h
+++ b/arch/arm/mach-realview/include/mach/barriers.h
@@ -4,5 +4,5 @@
4 * operation to deadlock the system. 4 * operation to deadlock the system.
5 */ 5 */
6#define mb() dsb() 6#define mb() dsb()
7#define rmb() dmb() 7#define rmb() dsb()
8#define wmb() mb() 8#define wmb() mb()
diff --git a/arch/arm/mach-tegra/include/mach/barriers.h b/arch/arm/mach-tegra/include/mach/barriers.h
index cc115174899b..425b42e91ef6 100644
--- a/arch/arm/mach-tegra/include/mach/barriers.h
+++ b/arch/arm/mach-tegra/include/mach/barriers.h
@@ -23,7 +23,7 @@
23 23
24#include <asm/outercache.h> 24#include <asm/outercache.h>
25 25
26#define rmb() dmb() 26#define rmb() dsb()
27#define wmb() do { dsb(); outer_sync(); } while (0) 27#define wmb() do { dsb(); outer_sync(); } while (0)
28#define mb() wmb() 28#define mb() wmb()
29 29
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index e5f6fc428348..e591513bb53e 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -392,7 +392,7 @@ free_memmap(unsigned long start_pfn, unsigned long end_pfn)
392 * Convert start_pfn/end_pfn to a struct page pointer. 392 * Convert start_pfn/end_pfn to a struct page pointer.
393 */ 393 */
394 start_pg = pfn_to_page(start_pfn - 1) + 1; 394 start_pg = pfn_to_page(start_pfn - 1) + 1;
395 end_pg = pfn_to_page(end_pfn); 395 end_pg = pfn_to_page(end_pfn - 1) + 1;
396 396
397 /* 397 /*
398 * Convert to physical addresses, and 398 * Convert to physical addresses, and
@@ -426,6 +426,14 @@ static void __init free_unused_memmap(struct meminfo *mi)
426 426
427 bank_start = bank_pfn_start(bank); 427 bank_start = bank_pfn_start(bank);
428 428
429#ifdef CONFIG_SPARSEMEM
430 /*
431 * Take care not to free memmap entries that don't exist
432 * due to SPARSEMEM sections which aren't present.
433 */
434 bank_start = min(bank_start,
435 ALIGN(prev_bank_end, PAGES_PER_SECTION));
436#endif
429 /* 437 /*
430 * If we had a previous bank, and there is a space 438 * If we had a previous bank, and there is a space
431 * between the current bank and the previous, free it. 439 * between the current bank and the previous, free it.
@@ -440,6 +448,12 @@ static void __init free_unused_memmap(struct meminfo *mi)
440 */ 448 */
441 prev_bank_end = ALIGN(bank_pfn_end(bank), MAX_ORDER_NR_PAGES); 449 prev_bank_end = ALIGN(bank_pfn_end(bank), MAX_ORDER_NR_PAGES);
442 } 450 }
451
452#ifdef CONFIG_SPARSEMEM
453 if (!IS_ALIGNED(prev_bank_end, PAGES_PER_SECTION))
454 free_memmap(prev_bank_end,
455 ALIGN(prev_bank_end, PAGES_PER_SECTION));
456#endif
443} 457}
444 458
445static void __init free_highpages(void) 459static void __init free_highpages(void)
diff --git a/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h b/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h
index 872de0bf1e6b..ea6c9c88c725 100644
--- a/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h
+++ b/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h
@@ -14,14 +14,14 @@
14#ifndef __ASM_ARCH_OMAP_GPMC_SMSC911X_H__ 14#ifndef __ASM_ARCH_OMAP_GPMC_SMSC911X_H__
15 15
16struct omap_smsc911x_platform_data { 16struct omap_smsc911x_platform_data {
17 int id;
17 int cs; 18 int cs;
18 int gpio_irq; 19 int gpio_irq;
19 int gpio_reset; 20 int gpio_reset;
20 u32 flags; 21 u32 flags;
21}; 22};
22 23
23#if defined(CONFIG_SMSC911X) || \ 24#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
24 defined(CONFIG_SMSC911X_MODULE)
25 25
26extern void gpmc_smsc911x_init(struct omap_smsc911x_platform_data *d); 26extern void gpmc_smsc911x_init(struct omap_smsc911x_platform_data *d);
27 27
diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
index 30b891c4a93f..2b576f1ab647 100644
--- a/arch/arm/plat-omap/include/plat/uncompress.h
+++ b/arch/arm/plat-omap/include/plat/uncompress.h
@@ -129,7 +129,6 @@ static inline void __arch_decomp_setup(unsigned long arch_id)
129 DEBUG_LL_OMAP1(3, sx1); 129 DEBUG_LL_OMAP1(3, sx1);
130 130
131 /* omap2 based boards using UART1 */ 131 /* omap2 based boards using UART1 */
132 DEBUG_LL_OMAP2(1, omap2evm);
133 DEBUG_LL_OMAP2(1, omap_2430sdp); 132 DEBUG_LL_OMAP2(1, omap_2430sdp);
134 DEBUG_LL_OMAP2(1, omap_apollon); 133 DEBUG_LL_OMAP2(1, omap_apollon);
135 DEBUG_LL_OMAP2(1, omap_h4); 134 DEBUG_LL_OMAP2(1, omap_h4);
diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
index 8a51fd58f656..34fc31ee9081 100644
--- a/arch/arm/plat-omap/iommu.c
+++ b/arch/arm/plat-omap/iommu.c
@@ -793,6 +793,8 @@ static irqreturn_t iommu_fault_handler(int irq, void *data)
793 clk_enable(obj->clk); 793 clk_enable(obj->clk);
794 errs = iommu_report_fault(obj, &da); 794 errs = iommu_report_fault(obj, &da);
795 clk_disable(obj->clk); 795 clk_disable(obj->clk);
796 if (errs == 0)
797 return IRQ_HANDLED;
796 798
797 /* Fault callback or TLB/PTE Dynamic loading */ 799 /* Fault callback or TLB/PTE Dynamic loading */
798 if (obj->isr && !obj->isr(obj, da, errs, obj->isr_priv)) 800 if (obj->isr && !obj->isr(obj, da, errs, obj->isr_priv))
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 8e256cc5dcd9..351c80fbba7e 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -997,9 +997,6 @@ config IRQ_GT641XX
997config IRQ_GIC 997config IRQ_GIC
998 bool 998 bool
999 999
1000config IRQ_CPU_OCTEON
1001 bool
1002
1003config MIPS_BOARDS_GEN 1000config MIPS_BOARDS_GEN
1004 bool 1001 bool
1005 1002
@@ -1359,8 +1356,6 @@ config CPU_SB1
1359config CPU_CAVIUM_OCTEON 1356config CPU_CAVIUM_OCTEON
1360 bool "Cavium Octeon processor" 1357 bool "Cavium Octeon processor"
1361 depends on SYS_HAS_CPU_CAVIUM_OCTEON 1358 depends on SYS_HAS_CPU_CAVIUM_OCTEON
1362 select IRQ_CPU
1363 select IRQ_CPU_OCTEON
1364 select CPU_HAS_PREFETCH 1359 select CPU_HAS_PREFETCH
1365 select CPU_SUPPORTS_64BIT_KERNEL 1360 select CPU_SUPPORTS_64BIT_KERNEL
1366 select SYS_SUPPORTS_SMP 1361 select SYS_SUPPORTS_SMP
diff --git a/arch/mips/alchemy/devboards/db1x00/board_setup.c b/arch/mips/alchemy/devboards/db1x00/board_setup.c
index 05f120ff90f9..5c956fe8760f 100644
--- a/arch/mips/alchemy/devboards/db1x00/board_setup.c
+++ b/arch/mips/alchemy/devboards/db1x00/board_setup.c
@@ -127,13 +127,10 @@ const char *get_system_type(void)
127void __init board_setup(void) 127void __init board_setup(void)
128{ 128{
129 unsigned long bcsr1, bcsr2; 129 unsigned long bcsr1, bcsr2;
130 u32 pin_func;
131 130
132 bcsr1 = DB1000_BCSR_PHYS_ADDR; 131 bcsr1 = DB1000_BCSR_PHYS_ADDR;
133 bcsr2 = DB1000_BCSR_PHYS_ADDR + DB1000_BCSR_HEXLED_OFS; 132 bcsr2 = DB1000_BCSR_PHYS_ADDR + DB1000_BCSR_HEXLED_OFS;
134 133
135 pin_func = 0;
136
137#ifdef CONFIG_MIPS_DB1000 134#ifdef CONFIG_MIPS_DB1000
138 printk(KERN_INFO "AMD Alchemy Au1000/Db1000 Board\n"); 135 printk(KERN_INFO "AMD Alchemy Au1000/Db1000 Board\n");
139#endif 136#endif
@@ -164,12 +161,16 @@ void __init board_setup(void)
164 /* Not valid for Au1550 */ 161 /* Not valid for Au1550 */
165#if defined(CONFIG_IRDA) && \ 162#if defined(CONFIG_IRDA) && \
166 (defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100)) 163 (defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100))
167 /* Set IRFIRSEL instead of GPIO15 */ 164 {
168 pin_func = au_readl(SYS_PINFUNC) | SYS_PF_IRF; 165 u32 pin_func;
169 au_writel(pin_func, SYS_PINFUNC); 166
170 /* Power off until the driver is in use */ 167 /* Set IRFIRSEL instead of GPIO15 */
171 bcsr_mod(BCSR_RESETS, BCSR_RESETS_IRDA_MODE_MASK, 168 pin_func = au_readl(SYS_PINFUNC) | SYS_PF_IRF;
172 BCSR_RESETS_IRDA_MODE_OFF); 169 au_writel(pin_func, SYS_PINFUNC);
170 /* Power off until the driver is in use */
171 bcsr_mod(BCSR_RESETS, BCSR_RESETS_IRDA_MODE_MASK,
172 BCSR_RESETS_IRDA_MODE_OFF);
173 }
173#endif 174#endif
174 bcsr_write(BCSR_PCMCIA, 0); /* turn off PCMCIA power */ 175 bcsr_write(BCSR_PCMCIA, 0); /* turn off PCMCIA power */
175 176
@@ -177,31 +178,35 @@ void __init board_setup(void)
177 alchemy_gpio1_input_enable(); 178 alchemy_gpio1_input_enable();
178 179
179#ifdef CONFIG_MIPS_MIRAGE 180#ifdef CONFIG_MIPS_MIRAGE
180 /* GPIO[20] is output */ 181 {
181 alchemy_gpio_direction_output(20, 0); 182 u32 pin_func;
182 183
183 /* Set GPIO[210:208] instead of SSI_0 */ 184 /* GPIO[20] is output */
184 pin_func = au_readl(SYS_PINFUNC) | SYS_PF_S0; 185 alchemy_gpio_direction_output(20, 0);
185 186
186 /* Set GPIO[215:211] for LEDs */ 187 /* Set GPIO[210:208] instead of SSI_0 */
187 pin_func |= 5 << 2; 188 pin_func = au_readl(SYS_PINFUNC) | SYS_PF_S0;
188 189
189 /* Set GPIO[214:213] for more LEDs */ 190 /* Set GPIO[215:211] for LEDs */
190 pin_func |= 5 << 12; 191 pin_func |= 5 << 2;
191 192
192 /* Set GPIO[207:200] instead of PCMCIA/LCD */ 193 /* Set GPIO[214:213] for more LEDs */
193 pin_func |= SYS_PF_LCD | SYS_PF_PC; 194 pin_func |= 5 << 12;
194 au_writel(pin_func, SYS_PINFUNC);
195 195
196 /* 196 /* Set GPIO[207:200] instead of PCMCIA/LCD */
197 * Enable speaker amplifier. This should 197 pin_func |= SYS_PF_LCD | SYS_PF_PC;
198 * be part of the audio driver. 198 au_writel(pin_func, SYS_PINFUNC);
199 */
200 alchemy_gpio_direction_output(209, 1);
201 199
202 pm_power_off = mirage_power_off; 200 /*
203 _machine_halt = mirage_power_off; 201 * Enable speaker amplifier. This should
204 _machine_restart = (void(*)(char *))mips_softreset; 202 * be part of the audio driver.
203 */
204 alchemy_gpio_direction_output(209, 1);
205
206 pm_power_off = mirage_power_off;
207 _machine_halt = mirage_power_off;
208 _machine_restart = (void(*)(char *))mips_softreset;
209 }
205#endif 210#endif
206 211
207#ifdef CONFIG_MIPS_BOSPORUS 212#ifdef CONFIG_MIPS_BOSPORUS
diff --git a/arch/mips/alchemy/xxs1500/init.c b/arch/mips/alchemy/xxs1500/init.c
index 15125c2fda7d..34a90a4bb6f4 100644
--- a/arch/mips/alchemy/xxs1500/init.c
+++ b/arch/mips/alchemy/xxs1500/init.c
@@ -51,10 +51,9 @@ void __init prom_init(void)
51 prom_init_cmdline(); 51 prom_init_cmdline();
52 52
53 memsize_str = prom_getenv("memsize"); 53 memsize_str = prom_getenv("memsize");
54 if (!memsize_str) 54 if (!memsize_str || strict_strtoul(memsize_str, 0, &memsize))
55 memsize = 0x04000000; 55 memsize = 0x04000000;
56 else 56
57 strict_strtoul(memsize_str, 0, &memsize);
58 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
59} 58}
60 59
diff --git a/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c b/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
index 88c9d963be88..9a6243676e22 100644
--- a/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
+++ b/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
@@ -16,8 +16,8 @@
16 16
17int main(int argc, char *argv[]) 17int main(int argc, char *argv[])
18{ 18{
19 unsigned long long vmlinux_size, vmlinux_load_addr, vmlinuz_load_addr;
19 struct stat sb; 20 struct stat sb;
20 uint64_t vmlinux_size, vmlinux_load_addr, vmlinuz_load_addr;
21 21
22 if (argc != 3) { 22 if (argc != 3) {
23 fprintf(stderr, "Usage: %s <pathname> <vmlinux_load_addr>\n", 23 fprintf(stderr, "Usage: %s <pathname> <vmlinux_load_addr>\n",
diff --git a/arch/mips/cavium-octeon/Kconfig b/arch/mips/cavium-octeon/Kconfig
index caae22858163..cad555ebeca3 100644
--- a/arch/mips/cavium-octeon/Kconfig
+++ b/arch/mips/cavium-octeon/Kconfig
@@ -1,11 +1,7 @@
1config CAVIUM_OCTEON_SPECIFIC_OPTIONS 1if CPU_CAVIUM_OCTEON
2 bool "Enable Octeon specific options"
3 depends on CPU_CAVIUM_OCTEON
4 default "y"
5 2
6config CAVIUM_CN63XXP1 3config CAVIUM_CN63XXP1
7 bool "Enable CN63XXP1 errata worarounds" 4 bool "Enable CN63XXP1 errata worarounds"
8 depends on CAVIUM_OCTEON_SPECIFIC_OPTIONS
9 default "n" 5 default "n"
10 help 6 help
11 The CN63XXP1 chip requires build time workarounds to 7 The CN63XXP1 chip requires build time workarounds to
@@ -16,7 +12,6 @@ config CAVIUM_CN63XXP1
16 12
17config CAVIUM_OCTEON_2ND_KERNEL 13config CAVIUM_OCTEON_2ND_KERNEL
18 bool "Build the kernel to be used as a 2nd kernel on the same chip" 14 bool "Build the kernel to be used as a 2nd kernel on the same chip"
19 depends on CAVIUM_OCTEON_SPECIFIC_OPTIONS
20 default "n" 15 default "n"
21 help 16 help
22 This option configures this kernel to be linked at a different 17 This option configures this kernel to be linked at a different
@@ -26,7 +21,6 @@ config CAVIUM_OCTEON_2ND_KERNEL
26 21
27config CAVIUM_OCTEON_HW_FIX_UNALIGNED 22config CAVIUM_OCTEON_HW_FIX_UNALIGNED
28 bool "Enable hardware fixups of unaligned loads and stores" 23 bool "Enable hardware fixups of unaligned loads and stores"
29 depends on CAVIUM_OCTEON_SPECIFIC_OPTIONS
30 default "y" 24 default "y"
31 help 25 help
32 Configure the Octeon hardware to automatically fix unaligned loads 26 Configure the Octeon hardware to automatically fix unaligned loads
@@ -38,7 +32,6 @@ config CAVIUM_OCTEON_HW_FIX_UNALIGNED
38 32
39config CAVIUM_OCTEON_CVMSEG_SIZE 33config CAVIUM_OCTEON_CVMSEG_SIZE
40 int "Number of L1 cache lines reserved for CVMSEG memory" 34 int "Number of L1 cache lines reserved for CVMSEG memory"
41 depends on CAVIUM_OCTEON_SPECIFIC_OPTIONS
42 range 0 54 35 range 0 54
43 default 1 36 default 1
44 help 37 help
@@ -50,7 +43,6 @@ config CAVIUM_OCTEON_CVMSEG_SIZE
50 43
51config CAVIUM_OCTEON_LOCK_L2 44config CAVIUM_OCTEON_LOCK_L2
52 bool "Lock often used kernel code in the L2" 45 bool "Lock often used kernel code in the L2"
53 depends on CAVIUM_OCTEON_SPECIFIC_OPTIONS
54 default "y" 46 default "y"
55 help 47 help
56 Enable locking parts of the kernel into the L2 cache. 48 Enable locking parts of the kernel into the L2 cache.
@@ -93,7 +85,6 @@ config CAVIUM_OCTEON_LOCK_L2_MEMCPY
93config ARCH_SPARSEMEM_ENABLE 85config ARCH_SPARSEMEM_ENABLE
94 def_bool y 86 def_bool y
95 select SPARSEMEM_STATIC 87 select SPARSEMEM_STATIC
96 depends on CPU_CAVIUM_OCTEON
97 88
98config CAVIUM_OCTEON_HELPER 89config CAVIUM_OCTEON_HELPER
99 def_bool y 90 def_bool y
@@ -107,6 +98,8 @@ config NEED_SG_DMA_LENGTH
107 98
108config SWIOTLB 99config SWIOTLB
109 def_bool y 100 def_bool y
110 depends on CPU_CAVIUM_OCTEON
111 select IOMMU_HELPER 101 select IOMMU_HELPER
112 select NEED_SG_DMA_LENGTH 102 select NEED_SG_DMA_LENGTH
103
104
105endif # CPU_CAVIUM_OCTEON
diff --git a/arch/mips/include/asm/cache.h b/arch/mips/include/asm/cache.h
index 650ac9ba734c..b4db69fbc40c 100644
--- a/arch/mips/include/asm/cache.h
+++ b/arch/mips/include/asm/cache.h
@@ -17,6 +17,6 @@
17#define SMP_CACHE_SHIFT L1_CACHE_SHIFT 17#define SMP_CACHE_SHIFT L1_CACHE_SHIFT
18#define SMP_CACHE_BYTES L1_CACHE_BYTES 18#define SMP_CACHE_BYTES L1_CACHE_BYTES
19 19
20#define __read_mostly __attribute__((__section__(".data.read_mostly"))) 20#define __read_mostly __attribute__((__section__(".data..read_mostly")))
21 21
22#endif /* _ASM_CACHE_H */ 22#endif /* _ASM_CACHE_H */
diff --git a/arch/mips/include/asm/cevt-r4k.h b/arch/mips/include/asm/cevt-r4k.h
index fa4328f9124f..65f9bdd02f1f 100644
--- a/arch/mips/include/asm/cevt-r4k.h
+++ b/arch/mips/include/asm/cevt-r4k.h
@@ -14,6 +14,9 @@
14#ifndef __ASM_CEVT_R4K_H 14#ifndef __ASM_CEVT_R4K_H
15#define __ASM_CEVT_R4K_H 15#define __ASM_CEVT_R4K_H
16 16
17#include <linux/clockchips.h>
18#include <asm/time.h>
19
17DECLARE_PER_CPU(struct clock_event_device, mips_clockevent_device); 20DECLARE_PER_CPU(struct clock_event_device, mips_clockevent_device);
18 21
19void mips_event_handler(struct clock_event_device *dev); 22void mips_event_handler(struct clock_event_device *dev);
diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h
index f5e856015329..c565b7c3f0b5 100644
--- a/arch/mips/include/asm/hugetlb.h
+++ b/arch/mips/include/asm/hugetlb.h
@@ -70,6 +70,7 @@ static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
70static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, 70static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
71 unsigned long addr, pte_t *ptep) 71 unsigned long addr, pte_t *ptep)
72{ 72{
73 flush_tlb_mm(vma->vm_mm);
73} 74}
74 75
75static inline int huge_pte_none(pte_t pte) 76static inline int huge_pte_none(pte_t pte)
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h b/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
index 32978d32561a..ed72e6a26b73 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
@@ -88,7 +88,7 @@ struct bcm_tag {
88 char kernel_crc[CRC_LEN]; 88 char kernel_crc[CRC_LEN];
89 /* 228-235: Unused at present */ 89 /* 228-235: Unused at present */
90 char reserved1[8]; 90 char reserved1[8];
91 /* 236-239: CRC32 of header excluding tagVersion */ 91 /* 236-239: CRC32 of header excluding last 20 bytes */
92 char header_crc[CRC_LEN]; 92 char header_crc[CRC_LEN];
93 /* 240-255: Unused at present */ 93 /* 240-255: Unused at present */
94 char reserved2[16]; 94 char reserved2[16];
diff --git a/arch/mips/jazz/jazzdma.c b/arch/mips/jazz/jazzdma.c
index 9ce9f64cb76f..2d8e447cb828 100644
--- a/arch/mips/jazz/jazzdma.c
+++ b/arch/mips/jazz/jazzdma.c
@@ -211,7 +211,7 @@ EXPORT_SYMBOL(vdma_free);
211 */ 211 */
212int vdma_remap(unsigned long laddr, unsigned long paddr, unsigned long size) 212int vdma_remap(unsigned long laddr, unsigned long paddr, unsigned long size)
213{ 213{
214 int first, pages, npages; 214 int first, pages;
215 215
216 if (laddr > 0xffffff) { 216 if (laddr > 0xffffff) {
217 if (vdma_debug) 217 if (vdma_debug)
@@ -228,8 +228,7 @@ int vdma_remap(unsigned long laddr, unsigned long paddr, unsigned long size)
228 return -EINVAL; /* invalid physical address */ 228 return -EINVAL; /* invalid physical address */
229 } 229 }
230 230
231 npages = pages = 231 pages = (((paddr & (VDMA_PAGESIZE - 1)) + size) >> 12) + 1;
232 (((paddr & (VDMA_PAGESIZE - 1)) + size) >> 12) + 1;
233 first = laddr >> 12; 232 first = laddr >> 12;
234 if (vdma_debug) 233 if (vdma_debug)
235 printk("vdma_remap: first=%x, pages=%x\n", first, pages); 234 printk("vdma_remap: first=%x, pages=%x\n", first, pages);
diff --git a/arch/mips/jz4740/dma.c b/arch/mips/jz4740/dma.c
index 5ebe75a68350..d7feb898692c 100644
--- a/arch/mips/jz4740/dma.c
+++ b/arch/mips/jz4740/dma.c
@@ -242,9 +242,7 @@ EXPORT_SYMBOL_GPL(jz4740_dma_get_residue);
242 242
243static void jz4740_dma_chan_irq(struct jz4740_dma_chan *dma) 243static void jz4740_dma_chan_irq(struct jz4740_dma_chan *dma)
244{ 244{
245 uint32_t status; 245 (void) jz4740_dma_read(JZ_REG_DMA_STATUS_CTRL(dma->id));
246
247 status = jz4740_dma_read(JZ_REG_DMA_STATUS_CTRL(dma->id));
248 246
249 jz4740_dma_write_mask(JZ_REG_DMA_STATUS_CTRL(dma->id), 0, 247 jz4740_dma_write_mask(JZ_REG_DMA_STATUS_CTRL(dma->id), 0,
250 JZ_DMA_STATUS_CTRL_ENABLE | JZ_DMA_STATUS_CTRL_TRANSFER_DONE); 248 JZ_DMA_STATUS_CTRL_ENABLE | JZ_DMA_STATUS_CTRL_TRANSFER_DONE);
diff --git a/arch/mips/jz4740/time.c b/arch/mips/jz4740/time.c
index fe01678d94fd..eaa853a54af6 100644
--- a/arch/mips/jz4740/time.c
+++ b/arch/mips/jz4740/time.c
@@ -89,7 +89,7 @@ static int jz4740_clockevent_set_next(unsigned long evt,
89 89
90static struct clock_event_device jz4740_clockevent = { 90static struct clock_event_device jz4740_clockevent = {
91 .name = "jz4740-timer", 91 .name = "jz4740-timer",
92 .features = CLOCK_EVT_FEAT_PERIODIC, 92 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
93 .set_next_event = jz4740_clockevent_set_next, 93 .set_next_event = jz4740_clockevent_set_next,
94 .set_mode = jz4740_clockevent_set_mode, 94 .set_mode = jz4740_clockevent_set_mode,
95 .rating = 200, 95 .rating = 200,
diff --git a/arch/mips/jz4740/timer.c b/arch/mips/jz4740/timer.c
index b2c015129055..654d5c3900b6 100644
--- a/arch/mips/jz4740/timer.c
+++ b/arch/mips/jz4740/timer.c
@@ -27,11 +27,13 @@ void jz4740_timer_enable_watchdog(void)
27{ 27{
28 writel(BIT(16), jz4740_timer_base + JZ_REG_TIMER_STOP_CLEAR); 28 writel(BIT(16), jz4740_timer_base + JZ_REG_TIMER_STOP_CLEAR);
29} 29}
30EXPORT_SYMBOL_GPL(jz4740_timer_enable_watchdog);
30 31
31void jz4740_timer_disable_watchdog(void) 32void jz4740_timer_disable_watchdog(void)
32{ 33{
33 writel(BIT(16), jz4740_timer_base + JZ_REG_TIMER_STOP_SET); 34 writel(BIT(16), jz4740_timer_base + JZ_REG_TIMER_STOP_SET);
34} 35}
36EXPORT_SYMBOL_GPL(jz4740_timer_disable_watchdog);
35 37
36void __init jz4740_timer_init(void) 38void __init jz4740_timer_init(void)
37{ 39{
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index 94ca2b018af7..feb8021a305f 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -23,6 +23,7 @@
23 23
24#define JAL 0x0c000000 /* jump & link: ip --> ra, jump to target */ 24#define JAL 0x0c000000 /* jump & link: ip --> ra, jump to target */
25#define ADDR_MASK 0x03ffffff /* op_code|addr : 31...26|25 ....0 */ 25#define ADDR_MASK 0x03ffffff /* op_code|addr : 31...26|25 ....0 */
26#define JUMP_RANGE_MASK ((1UL << 28) - 1)
26 27
27#define INSN_NOP 0x00000000 /* nop */ 28#define INSN_NOP 0x00000000 /* nop */
28#define INSN_JAL(addr) \ 29#define INSN_JAL(addr) \
@@ -44,12 +45,12 @@ static inline void ftrace_dyn_arch_init_insns(void)
44 45
45 /* jal (ftrace_caller + 8), jump over the first two instruction */ 46 /* jal (ftrace_caller + 8), jump over the first two instruction */
46 buf = (u32 *)&insn_jal_ftrace_caller; 47 buf = (u32 *)&insn_jal_ftrace_caller;
47 uasm_i_jal(&buf, (FTRACE_ADDR + 8)); 48 uasm_i_jal(&buf, (FTRACE_ADDR + 8) & JUMP_RANGE_MASK);
48 49
49#ifdef CONFIG_FUNCTION_GRAPH_TRACER 50#ifdef CONFIG_FUNCTION_GRAPH_TRACER
50 /* j ftrace_graph_caller */ 51 /* j ftrace_graph_caller */
51 buf = (u32 *)&insn_j_ftrace_graph_caller; 52 buf = (u32 *)&insn_j_ftrace_graph_caller;
52 uasm_i_j(&buf, (unsigned long)ftrace_graph_caller); 53 uasm_i_j(&buf, (unsigned long)ftrace_graph_caller & JUMP_RANGE_MASK);
53#endif 54#endif
54} 55}
55 56
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index d21c388c0116..584e6b55c865 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -540,8 +540,8 @@ asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
540 secure_computing(regs->regs[2]); 540 secure_computing(regs->regs[2]);
541 541
542 if (unlikely(current->audit_context) && entryexit) 542 if (unlikely(current->audit_context) && entryexit)
543 audit_syscall_exit(AUDITSC_RESULT(regs->regs[2]), 543 audit_syscall_exit(AUDITSC_RESULT(regs->regs[7]),
544 regs->regs[2]); 544 -regs->regs[2]);
545 545
546 if (!(current->ptrace & PT_PTRACED)) 546 if (!(current->ptrace & PT_PTRACED))
547 goto out; 547 goto out;
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 7f5468b38d4c..7f1377eb22d3 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -565,7 +565,7 @@ einval: li v0, -ENOSYS
565 sys sys_ioprio_get 2 /* 4315 */ 565 sys sys_ioprio_get 2 /* 4315 */
566 sys sys_utimensat 4 566 sys sys_utimensat 4
567 sys sys_signalfd 3 567 sys sys_signalfd 3
568 sys sys_ni_syscall 0 568 sys sys_ni_syscall 0 /* was timerfd */
569 sys sys_eventfd 1 569 sys sys_eventfd 1
570 sys sys_fallocate 6 /* 4320 */ 570 sys sys_fallocate 6 /* 4320 */
571 sys sys_timerfd_create 2 571 sys sys_timerfd_create 2
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index a2e1fcbc41dc..7c0ef7f128bf 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -404,7 +404,7 @@ sys_call_table:
404 PTR sys_ioprio_get 404 PTR sys_ioprio_get
405 PTR sys_utimensat /* 5275 */ 405 PTR sys_utimensat /* 5275 */
406 PTR sys_signalfd 406 PTR sys_signalfd
407 PTR sys_ni_syscall 407 PTR sys_ni_syscall /* was timerfd */
408 PTR sys_eventfd 408 PTR sys_eventfd
409 PTR sys_fallocate 409 PTR sys_fallocate
410 PTR sys_timerfd_create /* 5280 */ 410 PTR sys_timerfd_create /* 5280 */
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index b2c7624995b8..de6c5563beab 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -403,7 +403,7 @@ EXPORT(sysn32_call_table)
403 PTR sys_ioprio_get 403 PTR sys_ioprio_get
404 PTR compat_sys_utimensat 404 PTR compat_sys_utimensat
405 PTR compat_sys_signalfd /* 6280 */ 405 PTR compat_sys_signalfd /* 6280 */
406 PTR sys_ni_syscall 406 PTR sys_ni_syscall /* was timerfd */
407 PTR sys_eventfd 407 PTR sys_eventfd
408 PTR sys_fallocate 408 PTR sys_fallocate
409 PTR sys_timerfd_create 409 PTR sys_timerfd_create
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 049a9c8c49a0..b0541dda8830 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -522,7 +522,7 @@ sys_call_table:
522 PTR sys_ioprio_get /* 4315 */ 522 PTR sys_ioprio_get /* 4315 */
523 PTR compat_sys_utimensat 523 PTR compat_sys_utimensat
524 PTR compat_sys_signalfd 524 PTR compat_sys_signalfd
525 PTR sys_ni_syscall 525 PTR sys_ni_syscall /* was timerfd */
526 PTR sys_eventfd 526 PTR sys_eventfd
527 PTR sys32_fallocate /* 4320 */ 527 PTR sys32_fallocate /* 4320 */
528 PTR sys_timerfd_create 528 PTR sys_timerfd_create
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 832afbb87588..e4b0b0bec039 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -74,6 +74,7 @@ SECTIONS
74 INIT_TASK_DATA(PAGE_SIZE) 74 INIT_TASK_DATA(PAGE_SIZE)
75 NOSAVE_DATA 75 NOSAVE_DATA
76 CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT) 76 CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
77 READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
77 DATA_DATA 78 DATA_DATA
78 CONSTRUCTORS 79 CONSTRUCTORS
79 } 80 }
diff --git a/arch/mips/loongson/common/env.c b/arch/mips/loongson/common/env.c
index 11b193f848f8..d93830ad6113 100644
--- a/arch/mips/loongson/common/env.c
+++ b/arch/mips/loongson/common/env.c
@@ -29,9 +29,10 @@ unsigned long memsize, highmemsize;
29 29
30#define parse_even_earlier(res, option, p) \ 30#define parse_even_earlier(res, option, p) \
31do { \ 31do { \
32 int ret; \ 32 unsigned int tmp __maybe_unused; \
33 \
33 if (strncmp(option, (char *)p, strlen(option)) == 0) \ 34 if (strncmp(option, (char *)p, strlen(option)) == 0) \
34 ret = strict_strtol((char *)p + strlen(option"="), 10, &res); \ 35 tmp = strict_strtol((char *)p + strlen(option"="), 10, &res); \
35} while (0) 36} while (0)
36 37
37void __init prom_init_env(void) 38void __init prom_init_env(void)
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index b4923a75cb4b..71bddf8f7d25 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -1075,7 +1075,6 @@ static int __cpuinit probe_scache(void)
1075 unsigned long flags, addr, begin, end, pow2; 1075 unsigned long flags, addr, begin, end, pow2;
1076 unsigned int config = read_c0_config(); 1076 unsigned int config = read_c0_config();
1077 struct cpuinfo_mips *c = &current_cpu_data; 1077 struct cpuinfo_mips *c = &current_cpu_data;
1078 int tmp;
1079 1078
1080 if (config & CONF_SC) 1079 if (config & CONF_SC)
1081 return 0; 1080 return 0;
@@ -1108,7 +1107,6 @@ static int __cpuinit probe_scache(void)
1108 1107
1109 /* Now search for the wrap around point. */ 1108 /* Now search for the wrap around point. */
1110 pow2 = (128 * 1024); 1109 pow2 = (128 * 1024);
1111 tmp = 0;
1112 for (addr = begin + (128 * 1024); addr < end; addr = begin + pow2) { 1110 for (addr = begin + (128 * 1024); addr < end; addr = begin + pow2) {
1113 cache_op(Index_Load_Tag_SD, addr); 1111 cache_op(Index_Load_Tag_SD, addr);
1114 __asm__ __volatile__("nop; nop; nop; nop;"); /* hazard... */ 1112 __asm__ __volatile__("nop; nop; nop; nop;"); /* hazard... */
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 5ef294fbb6e7..f5734c2c8097 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -1151,8 +1151,8 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
1151 struct uasm_reloc *r = relocs; 1151 struct uasm_reloc *r = relocs;
1152 u32 *f; 1152 u32 *f;
1153 unsigned int final_len; 1153 unsigned int final_len;
1154 struct mips_huge_tlb_info htlb_info; 1154 struct mips_huge_tlb_info htlb_info __maybe_unused;
1155 enum vmalloc64_mode vmalloc_mode; 1155 enum vmalloc64_mode vmalloc_mode __maybe_unused;
1156 1156
1157 memset(tlb_handler, 0, sizeof(tlb_handler)); 1157 memset(tlb_handler, 0, sizeof(tlb_handler));
1158 memset(labels, 0, sizeof(labels)); 1158 memset(labels, 0, sizeof(labels));
diff --git a/arch/mips/mti-malta/malta-init.c b/arch/mips/mti-malta/malta-init.c
index 414f0c99b196..31180c321a1a 100644
--- a/arch/mips/mti-malta/malta-init.c
+++ b/arch/mips/mti-malta/malta-init.c
@@ -193,8 +193,6 @@ extern struct plat_smp_ops msmtc_smp_ops;
193 193
194void __init prom_init(void) 194void __init prom_init(void)
195{ 195{
196 int result;
197
198 prom_argc = fw_arg0; 196 prom_argc = fw_arg0;
199 _prom_argv = (int *) fw_arg1; 197 _prom_argv = (int *) fw_arg1;
200 _prom_envp = (int *) fw_arg2; 198 _prom_envp = (int *) fw_arg2;
@@ -360,20 +358,14 @@ void __init prom_init(void)
360#ifdef CONFIG_SERIAL_8250_CONSOLE 358#ifdef CONFIG_SERIAL_8250_CONSOLE
361 console_config(); 359 console_config();
362#endif 360#endif
363 /* Early detection of CMP support */
364 result = gcmp_probe(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ);
365
366#ifdef CONFIG_MIPS_CMP 361#ifdef CONFIG_MIPS_CMP
367 if (result) 362 /* Early detection of CMP support */
363 if (gcmp_probe(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ))
368 register_smp_ops(&cmp_smp_ops); 364 register_smp_ops(&cmp_smp_ops);
365 else
369#endif 366#endif
370#ifdef CONFIG_MIPS_MT_SMP 367#ifdef CONFIG_MIPS_MT_SMP
371#ifdef CONFIG_MIPS_CMP
372 if (!result)
373 register_smp_ops(&vsmp_smp_ops); 368 register_smp_ops(&vsmp_smp_ops);
374#else
375 register_smp_ops(&vsmp_smp_ops);
376#endif
377#endif 369#endif
378#ifdef CONFIG_MIPS_MT_SMTC 370#ifdef CONFIG_MIPS_MT_SMTC
379 register_smp_ops(&msmtc_smp_ops); 371 register_smp_ops(&msmtc_smp_ops);
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index 9027061f0ead..e85c977328da 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -56,7 +56,6 @@ static DEFINE_RAW_SPINLOCK(mips_irq_lock);
56static inline int mips_pcibios_iack(void) 56static inline int mips_pcibios_iack(void)
57{ 57{
58 int irq; 58 int irq;
59 u32 dummy;
60 59
61 /* 60 /*
62 * Determine highest priority pending interrupt by performing 61 * Determine highest priority pending interrupt by performing
@@ -83,7 +82,7 @@ static inline int mips_pcibios_iack(void)
83 BONITO_PCIMAP_CFG = 0x20000; 82 BONITO_PCIMAP_CFG = 0x20000;
84 83
85 /* Flush Bonito register block */ 84 /* Flush Bonito register block */
86 dummy = BONITO_PCIMAP_CFG; 85 (void) BONITO_PCIMAP_CFG;
87 iob(); /* sync */ 86 iob(); /* sync */
88 87
89 irq = __raw_readl((u32 *)_pcictrl_bonito_pcicfg); 88 irq = __raw_readl((u32 *)_pcictrl_bonito_pcicfg);
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_irq_per.c b/arch/mips/pmc-sierra/msp71xx/msp_irq_per.c
index f9b9dcdfa9dd..98fd0099d964 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_irq_per.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_irq_per.c
@@ -97,7 +97,7 @@ static int msp_per_irq_set_affinity(struct irq_data *d,
97 97
98static struct irq_chip msp_per_irq_controller = { 98static struct irq_chip msp_per_irq_controller = {
99 .name = "MSP_PER", 99 .name = "MSP_PER",
100 .irq_enable = unmask_per_irq. 100 .irq_enable = unmask_per_irq,
101 .irq_disable = mask_per_irq, 101 .irq_disable = mask_per_irq,
102 .irq_ack = msp_per_irq_ack, 102 .irq_ack = msp_per_irq_ack,
103#ifdef CONFIG_SMP 103#ifdef CONFIG_SMP
diff --git a/arch/mips/power/hibernate.S b/arch/mips/power/hibernate.S
index dbb5c7b4b70f..f8a751c03282 100644
--- a/arch/mips/power/hibernate.S
+++ b/arch/mips/power/hibernate.S
@@ -35,7 +35,7 @@ LEAF(swsusp_arch_resume)
350: 350:
36 PTR_L t1, PBE_ADDRESS(t0) /* source */ 36 PTR_L t1, PBE_ADDRESS(t0) /* source */
37 PTR_L t2, PBE_ORIG_ADDRESS(t0) /* destination */ 37 PTR_L t2, PBE_ORIG_ADDRESS(t0) /* destination */
38 PTR_ADDIU t3, t1, PAGE_SIZE 38 PTR_ADDU t3, t1, PAGE_SIZE
391: 391:
40 REG_L t8, (t1) 40 REG_L t8, (t1)
41 REG_S t8, (t2) 41 REG_S t8, (t2)
diff --git a/arch/mips/sgi-ip22/ip22-platform.c b/arch/mips/sgi-ip22/ip22-platform.c
index deddbf0ebe5c..698904daf901 100644
--- a/arch/mips/sgi-ip22/ip22-platform.c
+++ b/arch/mips/sgi-ip22/ip22-platform.c
@@ -132,7 +132,7 @@ static struct platform_device eth1_device = {
132 */ 132 */
133static int __init sgiseeq_devinit(void) 133static int __init sgiseeq_devinit(void)
134{ 134{
135 unsigned int tmp; 135 unsigned int pbdma __maybe_unused;
136 int res, i; 136 int res, i;
137 137
138 eth0_pd.hpc = hpc3c0; 138 eth0_pd.hpc = hpc3c0;
@@ -151,7 +151,7 @@ static int __init sgiseeq_devinit(void)
151 151
152 /* Second HPC is missing? */ 152 /* Second HPC is missing? */
153 if (ip22_is_fullhouse() || 153 if (ip22_is_fullhouse() ||
154 get_dbe(tmp, (unsigned int *)&hpc3c1->pbdma[1])) 154 get_dbe(pbdma, (unsigned int *)&hpc3c1->pbdma[1]))
155 return 0; 155 return 0;
156 156
157 sgimc->giopar |= SGIMC_GIOPAR_MASTEREXP1 | SGIMC_GIOPAR_EXP164 | 157 sgimc->giopar |= SGIMC_GIOPAR_MASTEREXP1 | SGIMC_GIOPAR_EXP164 |
diff --git a/arch/mips/sgi-ip22/ip22-time.c b/arch/mips/sgi-ip22/ip22-time.c
index 603fc91c1030..1a94c9894188 100644
--- a/arch/mips/sgi-ip22/ip22-time.c
+++ b/arch/mips/sgi-ip22/ip22-time.c
@@ -32,7 +32,7 @@
32static unsigned long dosample(void) 32static unsigned long dosample(void)
33{ 33{
34 u32 ct0, ct1; 34 u32 ct0, ct1;
35 u8 msb, lsb; 35 u8 msb;
36 36
37 /* Start the counter. */ 37 /* Start the counter. */
38 sgint->tcword = (SGINT_TCWORD_CNT2 | SGINT_TCWORD_CALL | 38 sgint->tcword = (SGINT_TCWORD_CNT2 | SGINT_TCWORD_CALL |
@@ -46,7 +46,7 @@ static unsigned long dosample(void)
46 /* Latch and spin until top byte of counter2 is zero */ 46 /* Latch and spin until top byte of counter2 is zero */
47 do { 47 do {
48 writeb(SGINT_TCWORD_CNT2 | SGINT_TCWORD_CLAT, &sgint->tcword); 48 writeb(SGINT_TCWORD_CNT2 | SGINT_TCWORD_CLAT, &sgint->tcword);
49 lsb = readb(&sgint->tcnt2); 49 (void) readb(&sgint->tcnt2);
50 msb = readb(&sgint->tcnt2); 50 msb = readb(&sgint->tcnt2);
51 ct1 = read_c0_count(); 51 ct1 = read_c0_count();
52 } while (msb); 52 } while (msb);
diff --git a/arch/mips/sgi-ip27/ip27-hubio.c b/arch/mips/sgi-ip27/ip27-hubio.c
index a1fa4abb3f6a..cd0d5b06cd83 100644
--- a/arch/mips/sgi-ip27/ip27-hubio.c
+++ b/arch/mips/sgi-ip27/ip27-hubio.c
@@ -29,7 +29,6 @@ unsigned long hub_pio_map(cnodeid_t cnode, xwidgetnum_t widget,
29 unsigned long xtalk_addr, size_t size) 29 unsigned long xtalk_addr, size_t size)
30{ 30{
31 nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode); 31 nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
32 volatile hubreg_t junk;
33 unsigned i; 32 unsigned i;
34 33
35 /* use small-window mapping if possible */ 34 /* use small-window mapping if possible */
@@ -64,7 +63,7 @@ unsigned long hub_pio_map(cnodeid_t cnode, xwidgetnum_t widget,
64 * after we write it. 63 * after we write it.
65 */ 64 */
66 IIO_ITTE_PUT(nasid, i, HUB_PIO_MAP_TO_MEM, widget, xtalk_addr); 65 IIO_ITTE_PUT(nasid, i, HUB_PIO_MAP_TO_MEM, widget, xtalk_addr);
67 junk = HUB_L(IIO_ITTE_GET(nasid, i)); 66 (void) HUB_L(IIO_ITTE_GET(nasid, i));
68 67
69 return NODE_BWIN_BASE(nasid, widget) + (xtalk_addr % BWIN_SIZE); 68 return NODE_BWIN_BASE(nasid, widget) + (xtalk_addr % BWIN_SIZE);
70 } 69 }
diff --git a/arch/mips/sgi-ip27/ip27-klnuma.c b/arch/mips/sgi-ip27/ip27-klnuma.c
index c3d30a88daf3..1d1919a44e88 100644
--- a/arch/mips/sgi-ip27/ip27-klnuma.c
+++ b/arch/mips/sgi-ip27/ip27-klnuma.c
@@ -54,11 +54,8 @@ void __init setup_replication_mask(void)
54 54
55static __init void set_ktext_source(nasid_t client_nasid, nasid_t server_nasid) 55static __init void set_ktext_source(nasid_t client_nasid, nasid_t server_nasid)
56{ 56{
57 cnodeid_t client_cnode;
58 kern_vars_t *kvp; 57 kern_vars_t *kvp;
59 58
60 client_cnode = NASID_TO_COMPACT_NODEID(client_nasid);
61
62 kvp = &hub_data(client_nasid)->kern_vars; 59 kvp = &hub_data(client_nasid)->kern_vars;
63 60
64 KERN_VARS_ADDR(client_nasid) = (unsigned long)kvp; 61 KERN_VARS_ADDR(client_nasid) = (unsigned long)kvp;
diff --git a/arch/mips/sni/time.c b/arch/mips/sni/time.c
index c76151b56568..0904d4d30cb3 100644
--- a/arch/mips/sni/time.c
+++ b/arch/mips/sni/time.c
@@ -95,7 +95,7 @@ static void __init sni_a20r_timer_setup(void)
95static __init unsigned long dosample(void) 95static __init unsigned long dosample(void)
96{ 96{
97 u32 ct0, ct1; 97 u32 ct0, ct1;
98 volatile u8 msb, lsb; 98 volatile u8 msb;
99 99
100 /* Start the counter. */ 100 /* Start the counter. */
101 outb_p(0x34, 0x43); 101 outb_p(0x34, 0x43);
@@ -108,7 +108,7 @@ static __init unsigned long dosample(void)
108 /* Latch and spin until top byte of counter0 is zero */ 108 /* Latch and spin until top byte of counter0 is zero */
109 do { 109 do {
110 outb(0x00, 0x43); 110 outb(0x00, 0x43);
111 lsb = inb(0x40); 111 (void) inb(0x40);
112 msb = inb(0x40); 112 msb = inb(0x40);
113 ct1 = read_c0_count(); 113 ct1 = read_c0_count();
114 } while (msb); 114 } while (msb);
diff --git a/arch/s390/include/asm/diag.h b/arch/s390/include/asm/diag.h
index 72b2e2f2d32d..7e91c58072e2 100644
--- a/arch/s390/include/asm/diag.h
+++ b/arch/s390/include/asm/diag.h
@@ -9,9 +9,22 @@
9#define _ASM_S390_DIAG_H 9#define _ASM_S390_DIAG_H
10 10
11/* 11/*
12 * Diagnose 10: Release pages 12 * Diagnose 10: Release page range
13 */ 13 */
14extern void diag10(unsigned long addr); 14static inline void diag10_range(unsigned long start_pfn, unsigned long num_pfn)
15{
16 unsigned long start_addr, end_addr;
17
18 start_addr = start_pfn << PAGE_SHIFT;
19 end_addr = (start_pfn + num_pfn - 1) << PAGE_SHIFT;
20
21 asm volatile(
22 "0: diag %0,%1,0x10\n"
23 "1:\n"
24 EX_TABLE(0b, 1b)
25 EX_TABLE(1b, 1b)
26 : : "a" (start_addr), "a" (end_addr));
27}
15 28
16/* 29/*
17 * Diagnose 14: Input spool file manipulation 30 * Diagnose 14: Input spool file manipulation
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
index a6f0e7cc9cde..8c277caa8d3a 100644
--- a/arch/s390/include/asm/mmu_context.h
+++ b/arch/s390/include/asm/mmu_context.h
@@ -23,7 +23,7 @@ static inline int init_new_context(struct task_struct *tsk,
23#ifdef CONFIG_64BIT 23#ifdef CONFIG_64BIT
24 mm->context.asce_bits |= _ASCE_TYPE_REGION3; 24 mm->context.asce_bits |= _ASCE_TYPE_REGION3;
25#endif 25#endif
26 if (current->mm->context.alloc_pgste) { 26 if (current->mm && current->mm->context.alloc_pgste) {
27 /* 27 /*
28 * alloc_pgste indicates, that any NEW context will be created 28 * alloc_pgste indicates, that any NEW context will be created
29 * with extended page tables. The old context is unchanged. The 29 * with extended page tables. The old context is unchanged. The
diff --git a/arch/s390/kernel/diag.c b/arch/s390/kernel/diag.c
index c032d11da8a1..8237fc07ac79 100644
--- a/arch/s390/kernel/diag.c
+++ b/arch/s390/kernel/diag.c
@@ -9,27 +9,6 @@
9#include <asm/diag.h> 9#include <asm/diag.h>
10 10
11/* 11/*
12 * Diagnose 10: Release pages
13 */
14void diag10(unsigned long addr)
15{
16 if (addr >= 0x7ff00000)
17 return;
18 asm volatile(
19#ifdef CONFIG_64BIT
20 " sam31\n"
21 " diag %0,%0,0x10\n"
22 "0: sam64\n"
23#else
24 " diag %0,%0,0x10\n"
25 "0:\n"
26#endif
27 EX_TABLE(0b, 0b)
28 : : "a" (addr));
29}
30EXPORT_SYMBOL(diag10);
31
32/*
33 * Diagnose 14: Input spool file manipulation 12 * Diagnose 14: Input spool file manipulation
34 */ 13 */
35int diag14(unsigned long rx, unsigned long ry1, unsigned long subcode) 14int diag14(unsigned long rx, unsigned long ry1, unsigned long subcode)
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
index c83726c9fe03..3d4a78fc1adc 100644
--- a/arch/s390/kernel/dis.c
+++ b/arch/s390/kernel/dis.c
@@ -672,6 +672,7 @@ static struct insn opcode_b2[] = {
672 { "rp", 0x77, INSTR_S_RD }, 672 { "rp", 0x77, INSTR_S_RD },
673 { "stcke", 0x78, INSTR_S_RD }, 673 { "stcke", 0x78, INSTR_S_RD },
674 { "sacf", 0x79, INSTR_S_RD }, 674 { "sacf", 0x79, INSTR_S_RD },
675 { "spp", 0x80, INSTR_S_RD },
675 { "stsi", 0x7d, INSTR_S_RD }, 676 { "stsi", 0x7d, INSTR_S_RD },
676 { "srnm", 0x99, INSTR_S_RD }, 677 { "srnm", 0x99, INSTR_S_RD },
677 { "stfpc", 0x9c, INSTR_S_RD }, 678 { "stfpc", 0x9c, INSTR_S_RD },
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 648f64239a9d..1b67fc6ebdc2 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -836,7 +836,7 @@ restart_base:
836 stosm __SF_EMPTY(%r15),0x04 # now we can turn dat on 836 stosm __SF_EMPTY(%r15),0x04 # now we can turn dat on
837 basr %r14,0 837 basr %r14,0
838 l %r14,restart_addr-.(%r14) 838 l %r14,restart_addr-.(%r14)
839 br %r14 # branch to start_secondary 839 basr %r14,%r14 # branch to start_secondary
840restart_addr: 840restart_addr:
841 .long start_secondary 841 .long start_secondary
842 .align 8 842 .align 8
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 9d3603d6c511..9fd864563499 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -841,7 +841,7 @@ restart_base:
841 mvc __LC_SYSTEM_TIMER(8),__TI_system_timer(%r1) 841 mvc __LC_SYSTEM_TIMER(8),__TI_system_timer(%r1)
842 xc __LC_STEAL_TIMER(8),__LC_STEAL_TIMER 842 xc __LC_STEAL_TIMER(8),__LC_STEAL_TIMER
843 stosm __SF_EMPTY(%r15),0x04 # now we can turn dat on 843 stosm __SF_EMPTY(%r15),0x04 # now we can turn dat on
844 jg start_secondary 844 brasl %r14,start_secondary
845 .align 8 845 .align 8
846restart_vtime: 846restart_vtime:
847 .long 0x7fffffff,0xffffffff 847 .long 0x7fffffff,0xffffffff
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index c66ffd8dbbb7..1f1dba9dcf58 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -91,7 +91,7 @@ static long cmm_alloc_pages(long nr, long *counter,
91 } else 91 } else
92 free_page((unsigned long) npa); 92 free_page((unsigned long) npa);
93 } 93 }
94 diag10(addr); 94 diag10_range(addr >> PAGE_SHIFT, 1);
95 pa->pages[pa->index++] = addr; 95 pa->pages[pa->index++] = addr;
96 (*counter)++; 96 (*counter)++;
97 spin_unlock(&cmm_lock); 97 spin_unlock(&cmm_lock);
diff --git a/arch/s390/oprofile/hwsampler.c b/arch/s390/oprofile/hwsampler.c
index 4952872d6f0a..33cbd373cce4 100644
--- a/arch/s390/oprofile/hwsampler.c
+++ b/arch/s390/oprofile/hwsampler.c
@@ -1021,20 +1021,14 @@ deallocate_exit:
1021 return rc; 1021 return rc;
1022} 1022}
1023 1023
1024long hwsampler_query_min_interval(void) 1024unsigned long hwsampler_query_min_interval(void)
1025{ 1025{
1026 if (min_sampler_rate) 1026 return min_sampler_rate;
1027 return min_sampler_rate;
1028 else
1029 return -EINVAL;
1030} 1027}
1031 1028
1032long hwsampler_query_max_interval(void) 1029unsigned long hwsampler_query_max_interval(void)
1033{ 1030{
1034 if (max_sampler_rate) 1031 return max_sampler_rate;
1035 return max_sampler_rate;
1036 else
1037 return -EINVAL;
1038} 1032}
1039 1033
1040unsigned long hwsampler_get_sample_overflow_count(unsigned int cpu) 1034unsigned long hwsampler_get_sample_overflow_count(unsigned int cpu)
diff --git a/arch/s390/oprofile/hwsampler.h b/arch/s390/oprofile/hwsampler.h
index 8c72b59316b5..1912f3bb190c 100644
--- a/arch/s390/oprofile/hwsampler.h
+++ b/arch/s390/oprofile/hwsampler.h
@@ -102,8 +102,8 @@ int hwsampler_setup(void);
102int hwsampler_shutdown(void); 102int hwsampler_shutdown(void);
103int hwsampler_allocate(unsigned long sdbt, unsigned long sdb); 103int hwsampler_allocate(unsigned long sdbt, unsigned long sdb);
104int hwsampler_deallocate(void); 104int hwsampler_deallocate(void);
105long hwsampler_query_min_interval(void); 105unsigned long hwsampler_query_min_interval(void);
106long hwsampler_query_max_interval(void); 106unsigned long hwsampler_query_max_interval(void);
107int hwsampler_start_all(unsigned long interval); 107int hwsampler_start_all(unsigned long interval);
108int hwsampler_stop_all(void); 108int hwsampler_stop_all(void);
109int hwsampler_deactivate(unsigned int cpu); 109int hwsampler_deactivate(unsigned int cpu);
diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c
index c63d7e58352b..5995e9bc72d9 100644
--- a/arch/s390/oprofile/init.c
+++ b/arch/s390/oprofile/init.c
@@ -145,15 +145,11 @@ static int oprofile_hwsampler_init(struct oprofile_operations *ops)
145 * create hwsampler files only if hwsampler_setup() succeeds. 145 * create hwsampler files only if hwsampler_setup() succeeds.
146 */ 146 */
147 oprofile_min_interval = hwsampler_query_min_interval(); 147 oprofile_min_interval = hwsampler_query_min_interval();
148 if (oprofile_min_interval < 0) { 148 if (oprofile_min_interval == 0)
149 oprofile_min_interval = 0;
150 return -ENODEV; 149 return -ENODEV;
151 }
152 oprofile_max_interval = hwsampler_query_max_interval(); 150 oprofile_max_interval = hwsampler_query_max_interval();
153 if (oprofile_max_interval < 0) { 151 if (oprofile_max_interval == 0)
154 oprofile_max_interval = 0;
155 return -ENODEV; 152 return -ENODEV;
156 }
157 153
158 if (oprofile_timer_init(ops)) 154 if (oprofile_timer_init(ops))
159 return -ENODEV; 155 return -ENODEV;