aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/Kconfig4
-rw-r--r--arch/arm/configs/omap2plus_defconfig83
-rw-r--r--arch/arm/include/asm/bitops.h46
-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.c151
-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.c56
-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.c71
-rw-r--r--arch/arm/mach-omap2/board-rx51-video.c5
-rw-r--r--arch/arm/mach-omap2/board-rx51.c18
-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/common-board-devices.c163
-rw-r--r--arch/arm/mach-omap2/common-board-devices.h35
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c436
-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/omap_l3_noc.c51
-rw-r--r--arch/arm/mach-omap2/omap_l3_smx.c42
-rw-r--r--arch/arm/mach-omap2/omap_phy_internal.c9
-rw-r--r--arch/arm/mach-omap2/pm.h17
-rw-r--r--arch/arm/mach-omap2/pm34xx.c14
-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.c22
-rw-r--r--arch/arm/mach-omap2/usb-tusb6010.c3
-rw-r--r--arch/arm/mach-omap2/voltage.c1
-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/include/plat/usb.h2
-rw-r--r--arch/avr32/include/asm/bitops.h15
-rw-r--r--arch/blackfin/Kconfig3
-rw-r--r--arch/blackfin/include/asm/kgdb.h1
-rw-r--r--arch/blackfin/include/asm/ptrace.h5
-rw-r--r--arch/cris/Kconfig4
-rw-r--r--arch/frv/Kconfig8
-rw-r--r--arch/h8300/Kconfig8
-rw-r--r--arch/ia64/Kconfig4
-rw-r--r--arch/ia64/kernel/time.c2
-rw-r--r--arch/m32r/Kconfig8
-rw-r--r--arch/m32r/include/asm/smp.h4
-rw-r--r--arch/m32r/kernel/smp.c64
-rw-r--r--arch/m32r/kernel/smpboot.c48
-rw-r--r--arch/m68k/Kconfig.nommu4
-rw-r--r--arch/m68k/include/asm/bitops_mm.h8
-rw-r--r--arch/m68k/include/asm/bitops_no.h4
-rw-r--r--arch/microblaze/Kconfig6
-rw-r--r--arch/mips/Kconfig8
-rw-r--r--arch/mips/configs/bcm47xx_defconfig1
-rw-r--r--arch/mn10300/Kconfig3
-rw-r--r--arch/mn10300/configs/asb2364_defconfig1
-rw-r--r--arch/parisc/Kconfig8
-rw-r--r--arch/powerpc/Kconfig9
-rw-r--r--arch/powerpc/boot/dts/canyonlands.dts18
-rw-r--r--arch/powerpc/boot/dts/katmai.dts18
-rw-r--r--arch/powerpc/boot/dts/kilauea.dts28
-rw-r--r--arch/powerpc/boot/dts/redwood.dts20
-rw-r--r--arch/powerpc/configs/ppc6xx_defconfig1
-rw-r--r--arch/powerpc/configs/pseries_defconfig1
-rw-r--r--arch/powerpc/include/asm/fsl_lbc.h2
-rw-r--r--arch/powerpc/include/asm/ftrace.h14
-rw-r--r--arch/powerpc/include/asm/hvcall.h2
-rw-r--r--arch/powerpc/include/asm/rio.h5
-rw-r--r--arch/powerpc/include/asm/smp.h2
-rw-r--r--arch/powerpc/include/asm/syscall.h5
-rw-r--r--arch/powerpc/include/asm/thread_info.h7
-rw-r--r--arch/powerpc/kernel/Makefile1
-rw-r--r--arch/powerpc/kernel/ftrace.c8
-rw-r--r--arch/powerpc/kernel/irq.c46
-rw-r--r--arch/powerpc/kernel/ptrace.c10
-rw-r--r--arch/powerpc/kernel/smp.c2
-rw-r--r--arch/powerpc/kernel/traps.c13
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c24
-rw-r--r--arch/powerpc/platforms/40x/Kconfig2
-rw-r--r--arch/powerpc/platforms/44x/Kconfig6
-rw-r--r--arch/powerpc/platforms/cell/interrupt.c55
-rw-r--r--arch/powerpc/platforms/cell/interrupt.h2
-rw-r--r--arch/powerpc/platforms/cell/smp.c2
-rw-r--r--arch/powerpc/sysdev/Kconfig7
-rw-r--r--arch/powerpc/sysdev/Makefile1
-rw-r--r--arch/powerpc/sysdev/fsl_lbc.c9
-rw-r--r--arch/powerpc/sysdev/fsl_rio.c100
-rw-r--r--arch/powerpc/sysdev/ppc4xx_msi.c276
-rw-r--r--arch/s390/include/asm/bitops.h45
-rw-r--r--arch/score/Kconfig3
-rw-r--r--arch/sh/Kconfig6
-rw-r--r--arch/sh/configs/apsh4ad0a_defconfig1
-rw-r--r--arch/sh/configs/sdk7786_defconfig1
-rw-r--r--arch/sh/configs/se7206_defconfig1
-rw-r--r--arch/sh/configs/shx3_defconfig1
-rw-r--r--arch/sh/configs/urquell_defconfig1
-rw-r--r--arch/sh/include/asm/kgdb.h1
-rw-r--r--arch/sh/include/asm/ptrace.h6
-rw-r--r--arch/sparc/Kconfig8
-rw-r--r--arch/tile/Kconfig1
-rw-r--r--arch/um/Kconfig.x861
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/configs/i386_defconfig1
-rw-r--r--arch/x86/configs/x86_64_defconfig1
-rw-r--r--arch/x86/include/asm/kgdb.h1
-rw-r--r--arch/x86/include/asm/ptrace.h18
-rw-r--r--arch/x86/include/asm/tsc.h4
-rw-r--r--arch/x86/include/asm/vdso.h14
-rw-r--r--arch/x86/include/asm/vgtod.h2
-rw-r--r--arch/x86/include/asm/vsyscall.h12
-rw-r--r--arch/x86/include/asm/vvar.h52
-rw-r--r--arch/x86/include/asm/xen/hypercall.h7
-rw-r--r--arch/x86/kernel/Makefile8
-rw-r--r--arch/x86/kernel/time.c2
-rw-r--r--arch/x86/kernel/tsc.c19
-rw-r--r--arch/x86/kernel/vmlinux.lds.S34
-rw-r--r--arch/x86/kernel/vread_tsc_64.c36
-rw-r--r--arch/x86/kernel/vsyscall_64.c48
-rw-r--r--arch/x86/vdso/Makefile17
-rw-r--r--arch/x86/vdso/vclock_gettime.c74
-rw-r--r--arch/x86/vdso/vdso.lds.S9
-rw-r--r--arch/x86/vdso/vextern.h16
-rw-r--r--arch/x86/vdso/vgetcpu.c3
-rw-r--r--arch/x86/vdso/vma.c27
-rw-r--r--arch/x86/vdso/vvar.c12
-rw-r--r--arch/x86/xen/mmu.c284
-rw-r--r--arch/x86/xen/mmu.h37
-rw-r--r--arch/xtensa/Kconfig6
144 files changed, 2107 insertions, 3859 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index e3a82775f9da..60219bf94198 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -41,10 +41,6 @@ config ARCH_HAS_ILOG2_U64
41 bool 41 bool
42 default n 42 default n
43 43
44config GENERIC_FIND_NEXT_BIT
45 bool
46 default y
47
48config GENERIC_CALIBRATE_DELAY 44config GENERIC_CALIBRATE_DELAY
49 bool 45 bool
50 default y 46 default y
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/bitops.h b/arch/arm/include/asm/bitops.h
index 6b7403fd8f54..b4892a06442c 100644
--- a/arch/arm/include/asm/bitops.h
+++ b/arch/arm/include/asm/bitops.h
@@ -203,8 +203,6 @@ extern int _find_next_bit_be(const unsigned long *p, int size, int offset);
203#define find_first_bit(p,sz) _find_first_bit_le(p,sz) 203#define find_first_bit(p,sz) _find_first_bit_le(p,sz)
204#define find_next_bit(p,sz,off) _find_next_bit_le(p,sz,off) 204#define find_next_bit(p,sz,off) _find_next_bit_le(p,sz,off)
205 205
206#define WORD_BITOFF_TO_LE(x) ((x))
207
208#else 206#else
209/* 207/*
210 * These are the big endian, atomic definitions. 208 * These are the big endian, atomic definitions.
@@ -214,8 +212,6 @@ extern int _find_next_bit_be(const unsigned long *p, int size, int offset);
214#define find_first_bit(p,sz) _find_first_bit_be(p,sz) 212#define find_first_bit(p,sz) _find_first_bit_be(p,sz)
215#define find_next_bit(p,sz,off) _find_next_bit_be(p,sz,off) 213#define find_next_bit(p,sz,off) _find_next_bit_be(p,sz,off)
216 214
217#define WORD_BITOFF_TO_LE(x) ((x) ^ 0x18)
218
219#endif 215#endif
220 216
221#if __LINUX_ARM_ARCH__ < 5 217#if __LINUX_ARM_ARCH__ < 5
@@ -287,55 +283,29 @@ static inline int fls(int x)
287#include <asm-generic/bitops/hweight.h> 283#include <asm-generic/bitops/hweight.h>
288#include <asm-generic/bitops/lock.h> 284#include <asm-generic/bitops/lock.h>
289 285
290static inline void __set_bit_le(int nr, void *addr) 286#ifdef __ARMEB__
291{
292 __set_bit(WORD_BITOFF_TO_LE(nr), addr);
293}
294
295static inline void __clear_bit_le(int nr, void *addr)
296{
297 __clear_bit(WORD_BITOFF_TO_LE(nr), addr);
298}
299
300static inline int __test_and_set_bit_le(int nr, void *addr)
301{
302 return __test_and_set_bit(WORD_BITOFF_TO_LE(nr), addr);
303}
304
305static inline int test_and_set_bit_le(int nr, void *addr)
306{
307 return test_and_set_bit(WORD_BITOFF_TO_LE(nr), addr);
308}
309
310static inline int __test_and_clear_bit_le(int nr, void *addr)
311{
312 return __test_and_clear_bit(WORD_BITOFF_TO_LE(nr), addr);
313}
314
315static inline int test_and_clear_bit_le(int nr, void *addr)
316{
317 return test_and_clear_bit(WORD_BITOFF_TO_LE(nr), addr);
318}
319
320static inline int test_bit_le(int nr, const void *addr)
321{
322 return test_bit(WORD_BITOFF_TO_LE(nr), addr);
323}
324 287
325static inline int find_first_zero_bit_le(const void *p, unsigned size) 288static inline int find_first_zero_bit_le(const void *p, unsigned size)
326{ 289{
327 return _find_first_zero_bit_le(p, size); 290 return _find_first_zero_bit_le(p, size);
328} 291}
292#define find_first_zero_bit_le find_first_zero_bit_le
329 293
330static inline int find_next_zero_bit_le(const void *p, int size, int offset) 294static inline int find_next_zero_bit_le(const void *p, int size, int offset)
331{ 295{
332 return _find_next_zero_bit_le(p, size, offset); 296 return _find_next_zero_bit_le(p, size, offset);
333} 297}
298#define find_next_zero_bit_le find_next_zero_bit_le
334 299
335static inline int find_next_bit_le(const void *p, int size, int offset) 300static inline int find_next_bit_le(const void *p, int size, int offset)
336{ 301{
337 return _find_next_bit_le(p, size, offset); 302 return _find_next_bit_le(p, size, offset);
338} 303}
304#define find_next_bit_le find_next_bit_le
305
306#endif
307
308#include <asm-generic/bitops/le.h>
339 309
340/* 310/*
341 * Ext2 is defined to use little-endian byte ordering. 311 * Ext2 is defined to use little-endian byte ordering.
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 66dfbccacd25..b14807794401 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 23244cd0a5b6..ae2963a98041 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
@@ -59,24 +59,6 @@
59 59
60#define TWL4030_MSECURE_GPIO 22 60#define TWL4030_MSECURE_GPIO 22
61 61
62/* FIXME: These values need to be updated based on more profiling on 3430sdp*/
63static struct cpuidle_params omap3_cpuidle_params_table[] = {
64 /* C1 */
65 {1, 2, 2, 5},
66 /* C2 */
67 {1, 10, 10, 30},
68 /* C3 */
69 {1, 50, 50, 300},
70 /* C4 */
71 {1, 1500, 1800, 4000},
72 /* C5 */
73 {1, 2500, 7500, 12000},
74 /* C6 */
75 {1, 3000, 8500, 15000},
76 /* C7 */
77 {1, 10000, 30000, 300000},
78};
79
80static uint32_t board_keymap[] = { 62static uint32_t board_keymap[] = {
81 KEY(0, 0, KEY_LEFT), 63 KEY(0, 0, KEY_LEFT),
82 KEY(0, 1, KEY_RIGHT), 64 KEY(0, 1, KEY_RIGHT),
@@ -123,63 +105,14 @@ static struct twl4030_keypad_data sdp3430_kp_data = {
123 .rep = 1, 105 .rep = 1,
124}; 106};
125 107
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 108#define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8
179#define SDP3430_LCD_PANEL_ENABLE_GPIO 5 109#define SDP3430_LCD_PANEL_ENABLE_GPIO 5
180 110
181static unsigned backlight_gpio; 111static struct gpio sdp3430_dss_gpios[] __initdata = {
182static unsigned enable_gpio; 112 {SDP3430_LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, "LCD reset" },
113 {SDP3430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "LCD Backlight"},
114};
115
183static int lcd_enabled; 116static int lcd_enabled;
184static int dvi_enabled; 117static int dvi_enabled;
185 118
@@ -187,29 +120,11 @@ static void __init sdp3430_display_init(void)
187{ 120{
188 int r; 121 int r;
189 122
190 enable_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO; 123 r = gpio_request_array(sdp3430_dss_gpios,
191 backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO; 124 ARRAY_SIZE(sdp3430_dss_gpios));
192 125 if (r)
193 r = gpio_request(enable_gpio, "LCD reset"); 126 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
205 gpio_direction_output(enable_gpio, 0);
206 gpio_direction_output(backlight_gpio, 0);
207 127
208 return;
209err1:
210 gpio_free(enable_gpio);
211err0:
212 return;
213} 128}
214 129
215static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) 130static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev)
@@ -219,8 +134,8 @@ static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev)
219 return -EINVAL; 134 return -EINVAL;
220 } 135 }
221 136
222 gpio_direction_output(enable_gpio, 1); 137 gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 1);
223 gpio_direction_output(backlight_gpio, 1); 138 gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 1);
224 139
225 lcd_enabled = 1; 140 lcd_enabled = 1;
226 141
@@ -231,8 +146,8 @@ static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev)
231{ 146{
232 lcd_enabled = 0; 147 lcd_enabled = 0;
233 148
234 gpio_direction_output(enable_gpio, 0); 149 gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 0);
235 gpio_direction_output(backlight_gpio, 0); 150 gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 0);
236} 151}
237 152
238static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev) 153static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev)
@@ -360,12 +275,10 @@ static int sdp3430_twl_gpio_setup(struct device *dev,
360 omap2_hsmmc_init(mmc); 275 omap2_hsmmc_init(mmc);
361 276
362 /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */ 277 /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
363 gpio_request(gpio + 7, "sub_lcd_en_bkl"); 278 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "sub_lcd_en_bkl");
364 gpio_direction_output(gpio + 7, 0);
365 279
366 /* gpio + 15 is "sub_lcd_nRST" (output) */ 280 /* gpio + 15 is "sub_lcd_nRST" (output) */
367 gpio_request(gpio + 15, "sub_lcd_nRST"); 281 gpio_request_one(gpio + 15, GPIOF_OUT_INIT_LOW, "sub_lcd_nRST");
368 gpio_direction_output(gpio + 15, 0);
369 282
370 return 0; 283 return 0;
371} 284}
@@ -580,20 +493,10 @@ static struct twl4030_platform_data sdp3430_twldata = {
580 .vpll2 = &sdp3430_vpll2, 493 .vpll2 = &sdp3430_vpll2,
581}; 494};
582 495
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) 496static int __init omap3430_i2c_init(void)
593{ 497{
594 /* i2c1 for PMIC only */ 498 /* i2c1 for PMIC only */
595 omap_register_i2c_bus(1, 2600, sdp3430_i2c_boardinfo, 499 omap3_pmic_init("twl4030", &sdp3430_twldata);
596 ARRAY_SIZE(sdp3430_i2c_boardinfo));
597 /* i2c2 on camera connector (for sensor control) and optional isp1301 */ 500 /* i2c2 on camera connector (for sensor control) and optional isp1301 */
598 omap_register_i2c_bus(2, 400, NULL, 0); 501 omap_register_i2c_bus(2, 400, NULL, 0);
599 /* i2c3 on display connector (for DVI, tfp410) */ 502 /* i2c3 on display connector (for DVI, tfp410) */
@@ -872,30 +775,22 @@ static struct flash_partitions sdp_flash_partitions[] = {
872 }, 775 },
873}; 776};
874 777
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) 778static void __init omap_3430sdp_init(void)
882{ 779{
780 int gpio_pendown;
781
883 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 782 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
884 omap_board_config = sdp3430_config; 783 omap_board_config = sdp3430_config;
885 omap_board_config_size = ARRAY_SIZE(sdp3430_config); 784 omap_board_config_size = ARRAY_SIZE(sdp3430_config);
886 omap3_pm_init_cpuidle(omap3_cpuidle_params_table);
887 omap3430_i2c_init(); 785 omap3430_i2c_init();
888 omap_display_init(&sdp3430_dss_data); 786 omap_display_init(&sdp3430_dss_data);
889 if (omap_rev() > OMAP3430_REV_ES1_0) 787 if (omap_rev() > OMAP3430_REV_ES1_0)
890 ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV2; 788 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV2;
891 else 789 else
892 ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV1; 790 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV1;
893 sdp3430_spi_board_info[0].irq = gpio_to_irq(ts_gpio); 791 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(); 792 board_serial_init();
898 usb_musb_init(&musb_board_data); 793 usb_musb_init(NULL);
899 board_smc91x_init(); 794 board_smc91x_init();
900 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0); 795 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
901 sdp3430_display_init(); 796 sdp3430_display_init();
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 93edd7fcf451..73fa90bb6953 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 ff8c59be36e5..63af4171c043 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) {}
@@ -396,7 +374,7 @@ static struct omap_musb_board_data musb_board_data = {
396 .power = 500, 374 .power = 500,
397 .set_phy_power = am35x_musb_phy_power, 375 .set_phy_power = am35x_musb_phy_power,
398 .clear_irq = am35x_musb_clear_irq, 376 .clear_irq = am35x_musb_clear_irq,
399 .set_mode = am35x_musb_set_mode, 377 .set_mode = am35x_set_mode,
400 .reset = am35x_musb_reset, 378 .reset = am35x_musb_reset,
401}; 379};
402 380
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 9340f6a06f4a..c63115bc1536 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 1d1b56a29fb1..cf520d7dd614 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 3da64d361651..0c1bfca3f731 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 97750d483a70..be71426359f2 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 7f94cccdb076..b4d43464a303 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 1db15492d82b..1d10736c6d3c 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 a72c90a08c8a..0c108a212ea2 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 e4973ac77cbc..90485fced973 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 9d192ff3b9ac..1555918e3ffa 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..f6247e71a194 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -23,6 +23,7 @@
23#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <linux/gpio_keys.h> 24#include <linux/gpio_keys.h>
25#include <linux/mmc/host.h> 25#include <linux/mmc/host.h>
26#include <linux/power/isp1704_charger.h>
26 27
27#include <plat/mcspi.h> 28#include <plat/mcspi.h>
28#include <plat/board.h> 29#include <plat/board.h>
@@ -43,6 +44,7 @@
43 44
44#include "mux.h" 45#include "mux.h"
45#include "hsmmc.h" 46#include "hsmmc.h"
47#include "common-board-devices.h"
46 48
47#define SYSTEM_REV_B_USES_VAUX3 0x1699 49#define SYSTEM_REV_B_USES_VAUX3 0x1699
48#define SYSTEM_REV_S_USES_VAUX3 0x8 50#define SYSTEM_REV_S_USES_VAUX3 0x8
@@ -52,6 +54,8 @@
52#define RX51_FMTX_RESET_GPIO 163 54#define RX51_FMTX_RESET_GPIO 163
53#define RX51_FMTX_IRQ 53 55#define RX51_FMTX_IRQ 53
54 56
57#define RX51_USB_TRANSCEIVER_RST_GPIO 67
58
55/* list all spi devices here */ 59/* list all spi devices here */
56enum { 60enum {
57 RX51_SPI_WL1251, 61 RX51_SPI_WL1251,
@@ -110,10 +114,30 @@ static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
110 }, 114 },
111}; 115};
112 116
117static void rx51_charger_set_power(bool on)
118{
119 gpio_set_value(RX51_USB_TRANSCEIVER_RST_GPIO, on);
120}
121
122static struct isp1704_charger_data rx51_charger_data = {
123 .set_power = rx51_charger_set_power,
124};
125
113static struct platform_device rx51_charger_device = { 126static struct platform_device rx51_charger_device = {
114 .name = "isp1704_charger", 127 .name = "isp1704_charger",
128 .dev = {
129 .platform_data = &rx51_charger_data,
130 },
115}; 131};
116 132
133static void __init rx51_charger_init(void)
134{
135 WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO,
136 GPIOF_OUT_INIT_LOW, "isp1704_reset"));
137
138 platform_device_register(&rx51_charger_device);
139}
140
117#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) 141#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
118 142
119#define RX51_GPIO_CAMERA_LENS_COVER 110 143#define RX51_GPIO_CAMERA_LENS_COVER 110
@@ -557,10 +581,8 @@ static __init void rx51_init_si4713(void)
557static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n) 581static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n)
558{ 582{
559 /* FIXME this gpio setup is just a placeholder for now */ 583 /* FIXME this gpio setup is just a placeholder for now */
560 gpio_request(gpio + 6, "backlight_pwm"); 584 gpio_request_one(gpio + 6, GPIOF_OUT_INIT_LOW, "backlight_pwm");
561 gpio_direction_output(gpio + 6, 0); 585 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 586
565 return 0; 587 return 0;
566} 588}
@@ -730,7 +752,7 @@ static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
730 { .resource = RES_RESET, .devgroup = -1, 752 { .resource = RES_RESET, .devgroup = -1,
731 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1 753 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
732 }, 754 },
733 { .resource = RES_Main_Ref, .devgroup = -1, 755 { .resource = RES_MAIN_REF, .devgroup = -1,
734 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1 756 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
735 }, 757 },
736 { 0, 0}, 758 { 0, 0},
@@ -777,15 +799,6 @@ static struct tpa6130a2_platform_data rx51_tpa6130a2_data __initdata_or_module =
777 .power_gpio = 98, 799 .power_gpio = 98,
778}; 800};
779 801
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 */ 802/* Audio setup data */
790static struct aic3x_setup_data rx51_aic34_setup = { 803static struct aic3x_setup_data rx51_aic34_setup = {
791 .gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED, 804 .gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED,
@@ -833,8 +846,7 @@ static int __init rx51_i2c_init(void)
833 rx51_twldata.vaux3 = &rx51_vaux3_cam; 846 rx51_twldata.vaux3 = &rx51_vaux3_cam;
834 } 847 }
835 rx51_twldata.vmmc2 = &rx51_vmmc2; 848 rx51_twldata.vmmc2 = &rx51_vmmc2;
836 omap_register_i2c_bus(1, 2200, rx51_peripherals_i2c_board_info_1, 849 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, 850 omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
839 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2)); 851 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
840 omap_register_i2c_bus(3, 400, NULL, 0); 852 omap_register_i2c_bus(3, 400, NULL, 0);
@@ -921,26 +933,20 @@ static void rx51_wl1251_set_power(bool enable)
921 gpio_set_value(RX51_WL1251_POWER_GPIO, enable); 933 gpio_set_value(RX51_WL1251_POWER_GPIO, enable);
922} 934}
923 935
936static struct gpio rx51_wl1251_gpios[] __initdata = {
937 { RX51_WL1251_POWER_GPIO, GPIOF_OUT_INIT_LOW, "wl1251 power" },
938 { RX51_WL1251_IRQ_GPIO, GPIOF_IN, "wl1251 irq" },
939};
940
924static void __init rx51_init_wl1251(void) 941static void __init rx51_init_wl1251(void)
925{ 942{
926 int irq, ret; 943 int irq, ret;
927 944
928 ret = gpio_request(RX51_WL1251_POWER_GPIO, "wl1251 power"); 945 ret = gpio_request_array(rx51_wl1251_gpios,
946 ARRAY_SIZE(rx51_wl1251_gpios));
929 if (ret < 0) 947 if (ret < 0)
930 goto error; 948 goto error;
931 949
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); 950 irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO);
945 if (irq < 0) 951 if (irq < 0)
946 goto err_irq; 952 goto err_irq;
@@ -952,10 +958,7 @@ static void __init rx51_init_wl1251(void)
952 958
953err_irq: 959err_irq:
954 gpio_free(RX51_WL1251_IRQ_GPIO); 960 gpio_free(RX51_WL1251_IRQ_GPIO);
955
956err_power:
957 gpio_free(RX51_WL1251_POWER_GPIO); 961 gpio_free(RX51_WL1251_POWER_GPIO);
958
959error: 962error:
960 printk(KERN_ERR "wl1251 board initialisation failed\n"); 963 printk(KERN_ERR "wl1251 board initialisation failed\n");
961 wl1251_pdata.set_power = NULL; 964 wl1251_pdata.set_power = NULL;
@@ -981,6 +984,6 @@ void __init rx51_peripherals_init(void)
981 if (partition) 984 if (partition)
982 omap2_hsmmc_init(mmc); 985 omap2_hsmmc_init(mmc);
983 986
984 platform_device_register(&rx51_charger_device); 987 rx51_charger_init();
985} 988}
986 989
diff --git a/arch/arm/mach-omap2/board-rx51-video.c b/arch/arm/mach-omap2/board-rx51-video.c
index 2df10b6a5940..2c1289bd5e6a 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-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index f8ba20a14e62..fec4cac8fa0a 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -58,21 +58,25 @@ static struct platform_device leds_gpio = {
58 }, 58 },
59}; 59};
60 60
61/*
62 * cpuidle C-states definition override from the default values.
63 * The 'exit_latency' field is the sum of sleep and wake-up latencies.
64 */
61static struct cpuidle_params rx51_cpuidle_params[] = { 65static struct cpuidle_params rx51_cpuidle_params[] = {
62 /* C1 */ 66 /* C1 */
63 {1, 110, 162, 5}, 67 {110 + 162, 5 , 1},
64 /* C2 */ 68 /* C2 */
65 {1, 106, 180, 309}, 69 {106 + 180, 309, 1},
66 /* C3 */ 70 /* C3 */
67 {0, 107, 410, 46057}, 71 {107 + 410, 46057, 0},
68 /* C4 */ 72 /* C4 */
69 {0, 121, 3374, 46057}, 73 {121 + 3374, 46057, 0},
70 /* C5 */ 74 /* C5 */
71 {1, 855, 1146, 46057}, 75 {855 + 1146, 46057, 1},
72 /* C6 */ 76 /* C6 */
73 {0, 7580, 4134, 484329}, 77 {7580 + 4134, 484329, 0},
74 /* C7 */ 78 /* C7 */
75 {1, 7505, 15274, 484329}, 79 {7505 + 15274, 484329, 1},
76}; 80};
77 81
78static struct omap_lcd_config rx51_lcd_config = { 82static struct omap_lcd_config rx51_lcd_config = {
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 60e8645db59d..c7c6beb1ec24 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/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/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index 1c240eff3918..4bf6e6e8b100 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -36,36 +36,6 @@
36 36
37#ifdef CONFIG_CPU_IDLE 37#ifdef CONFIG_CPU_IDLE
38 38
39#define OMAP3_MAX_STATES 7
40#define OMAP3_STATE_C1 0 /* C1 - MPU WFI + Core active */
41#define OMAP3_STATE_C2 1 /* C2 - MPU WFI + Core inactive */
42#define OMAP3_STATE_C3 2 /* C3 - MPU CSWR + Core inactive */
43#define OMAP3_STATE_C4 3 /* C4 - MPU OFF + Core iactive */
44#define OMAP3_STATE_C5 4 /* C5 - MPU RET + Core RET */
45#define OMAP3_STATE_C6 5 /* C6 - MPU OFF + Core RET */
46#define OMAP3_STATE_C7 6 /* C7 - MPU OFF + Core OFF */
47
48#define OMAP3_STATE_MAX OMAP3_STATE_C7
49
50#define CPUIDLE_FLAG_CHECK_BM 0x10000 /* use omap3_enter_idle_bm() */
51
52struct omap3_processor_cx {
53 u8 valid;
54 u8 type;
55 u32 sleep_latency;
56 u32 wakeup_latency;
57 u32 mpu_state;
58 u32 core_state;
59 u32 threshold;
60 u32 flags;
61 const char *desc;
62};
63
64struct omap3_processor_cx omap3_power_states[OMAP3_MAX_STATES];
65struct omap3_processor_cx current_cx_state;
66struct powerdomain *mpu_pd, *core_pd, *per_pd;
67struct powerdomain *cam_pd;
68
69/* 39/*
70 * The latencies/thresholds for various C states have 40 * The latencies/thresholds for various C states have
71 * to be configured from the respective board files. 41 * to be configured from the respective board files.
@@ -75,27 +45,31 @@ struct powerdomain *cam_pd;
75 */ 45 */
76static struct cpuidle_params cpuidle_params_table[] = { 46static struct cpuidle_params cpuidle_params_table[] = {
77 /* C1 */ 47 /* C1 */
78 {1, 2, 2, 5}, 48 {2 + 2, 5, 1},
79 /* C2 */ 49 /* C2 */
80 {1, 10, 10, 30}, 50 {10 + 10, 30, 1},
81 /* C3 */ 51 /* C3 */
82 {1, 50, 50, 300}, 52 {50 + 50, 300, 1},
83 /* C4 */ 53 /* C4 */
84 {1, 1500, 1800, 4000}, 54 {1500 + 1800, 4000, 1},
85 /* C5 */ 55 /* C5 */
86 {1, 2500, 7500, 12000}, 56 {2500 + 7500, 12000, 1},
87 /* C6 */ 57 /* C6 */
88 {1, 3000, 8500, 15000}, 58 {3000 + 8500, 15000, 1},
89 /* C7 */ 59 /* C7 */
90 {1, 10000, 30000, 300000}, 60 {10000 + 30000, 300000, 1},
91}; 61};
62#define OMAP3_NUM_STATES ARRAY_SIZE(cpuidle_params_table)
92 63
93static int omap3_idle_bm_check(void) 64/* Mach specific information to be recorded in the C-state driver_data */
94{ 65struct omap3_idle_statedata {
95 if (!omap3_can_sleep()) 66 u32 mpu_state;
96 return 1; 67 u32 core_state;
97 return 0; 68 u8 valid;
98} 69};
70struct omap3_idle_statedata omap3_idle_data[OMAP3_NUM_STATES];
71
72struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd;
99 73
100static int _cpuidle_allow_idle(struct powerdomain *pwrdm, 74static int _cpuidle_allow_idle(struct powerdomain *pwrdm,
101 struct clockdomain *clkdm) 75 struct clockdomain *clkdm)
@@ -122,12 +96,10 @@ static int _cpuidle_deny_idle(struct powerdomain *pwrdm,
122static int omap3_enter_idle(struct cpuidle_device *dev, 96static int omap3_enter_idle(struct cpuidle_device *dev,
123 struct cpuidle_state *state) 97 struct cpuidle_state *state)
124{ 98{
125 struct omap3_processor_cx *cx = cpuidle_get_statedata(state); 99 struct omap3_idle_statedata *cx = cpuidle_get_statedata(state);
126 struct timespec ts_preidle, ts_postidle, ts_idle; 100 struct timespec ts_preidle, ts_postidle, ts_idle;
127 u32 mpu_state = cx->mpu_state, core_state = cx->core_state; 101 u32 mpu_state = cx->mpu_state, core_state = cx->core_state;
128 102
129 current_cx_state = *cx;
130
131 /* Used to keep track of the total time in idle */ 103 /* Used to keep track of the total time in idle */
132 getnstimeofday(&ts_preidle); 104 getnstimeofday(&ts_preidle);
133 105
@@ -140,7 +112,8 @@ static int omap3_enter_idle(struct cpuidle_device *dev,
140 if (omap_irq_pending() || need_resched()) 112 if (omap_irq_pending() || need_resched())
141 goto return_sleep_time; 113 goto return_sleep_time;
142 114
143 if (cx->type == OMAP3_STATE_C1) { 115 /* Deny idle for C1 */
116 if (state == &dev->states[0]) {
144 pwrdm_for_each_clkdm(mpu_pd, _cpuidle_deny_idle); 117 pwrdm_for_each_clkdm(mpu_pd, _cpuidle_deny_idle);
145 pwrdm_for_each_clkdm(core_pd, _cpuidle_deny_idle); 118 pwrdm_for_each_clkdm(core_pd, _cpuidle_deny_idle);
146 } 119 }
@@ -148,7 +121,8 @@ static int omap3_enter_idle(struct cpuidle_device *dev,
148 /* Execute ARM wfi */ 121 /* Execute ARM wfi */
149 omap_sram_idle(); 122 omap_sram_idle();
150 123
151 if (cx->type == OMAP3_STATE_C1) { 124 /* Re-allow idle for C1 */
125 if (state == &dev->states[0]) {
152 pwrdm_for_each_clkdm(mpu_pd, _cpuidle_allow_idle); 126 pwrdm_for_each_clkdm(mpu_pd, _cpuidle_allow_idle);
153 pwrdm_for_each_clkdm(core_pd, _cpuidle_allow_idle); 127 pwrdm_for_each_clkdm(core_pd, _cpuidle_allow_idle);
154 } 128 }
@@ -164,41 +138,53 @@ return_sleep_time:
164} 138}
165 139
166/** 140/**
167 * next_valid_state - Find next valid c-state 141 * next_valid_state - Find next valid C-state
168 * @dev: cpuidle device 142 * @dev: cpuidle device
169 * @state: Currently selected c-state 143 * @state: Currently selected C-state
170 * 144 *
171 * If the current state is valid, it is returned back to the caller. 145 * If the current state is valid, it is returned back to the caller.
172 * Else, this function searches for a lower c-state which is still 146 * Else, this function searches for a lower c-state which is still
173 * valid (as defined in omap3_power_states[]). 147 * valid.
148 *
149 * A state is valid if the 'valid' field is enabled and
150 * if it satisfies the enable_off_mode condition.
174 */ 151 */
175static struct cpuidle_state *next_valid_state(struct cpuidle_device *dev, 152static struct cpuidle_state *next_valid_state(struct cpuidle_device *dev,
176 struct cpuidle_state *curr) 153 struct cpuidle_state *curr)
177{ 154{
178 struct cpuidle_state *next = NULL; 155 struct cpuidle_state *next = NULL;
179 struct omap3_processor_cx *cx; 156 struct omap3_idle_statedata *cx = cpuidle_get_statedata(curr);
157 u32 mpu_deepest_state = PWRDM_POWER_RET;
158 u32 core_deepest_state = PWRDM_POWER_RET;
180 159
181 cx = (struct omap3_processor_cx *)cpuidle_get_statedata(curr); 160 if (enable_off_mode) {
161 mpu_deepest_state = PWRDM_POWER_OFF;
162 /*
163 * Erratum i583: valable for ES rev < Es1.2 on 3630.
164 * CORE OFF mode is not supported in a stable form, restrict
165 * instead the CORE state to RET.
166 */
167 if (!IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583))
168 core_deepest_state = PWRDM_POWER_OFF;
169 }
182 170
183 /* Check if current state is valid */ 171 /* Check if current state is valid */
184 if (cx->valid) { 172 if ((cx->valid) &&
173 (cx->mpu_state >= mpu_deepest_state) &&
174 (cx->core_state >= core_deepest_state)) {
185 return curr; 175 return curr;
186 } else { 176 } else {
187 u8 idx = OMAP3_STATE_MAX; 177 int idx = OMAP3_NUM_STATES - 1;
188 178
189 /* 179 /* Reach the current state starting at highest C-state */
190 * Reach the current state starting at highest C-state 180 for (; idx >= 0; idx--) {
191 */
192 for (; idx >= OMAP3_STATE_C1; idx--) {
193 if (&dev->states[idx] == curr) { 181 if (&dev->states[idx] == curr) {
194 next = &dev->states[idx]; 182 next = &dev->states[idx];
195 break; 183 break;
196 } 184 }
197 } 185 }
198 186
199 /* 187 /* Should never hit this condition */
200 * Should never hit this condition.
201 */
202 WARN_ON(next == NULL); 188 WARN_ON(next == NULL);
203 189
204 /* 190 /*
@@ -206,17 +192,17 @@ static struct cpuidle_state *next_valid_state(struct cpuidle_device *dev,
206 * Start search from the next (lower) state. 192 * Start search from the next (lower) state.
207 */ 193 */
208 idx--; 194 idx--;
209 for (; idx >= OMAP3_STATE_C1; idx--) { 195 for (; idx >= 0; idx--) {
210 struct omap3_processor_cx *cx;
211
212 cx = cpuidle_get_statedata(&dev->states[idx]); 196 cx = cpuidle_get_statedata(&dev->states[idx]);
213 if (cx->valid) { 197 if ((cx->valid) &&
198 (cx->mpu_state >= mpu_deepest_state) &&
199 (cx->core_state >= core_deepest_state)) {
214 next = &dev->states[idx]; 200 next = &dev->states[idx];
215 break; 201 break;
216 } 202 }
217 } 203 }
218 /* 204 /*
219 * C1 and C2 are always valid. 205 * C1 is always valid.
220 * So, no need to check for 'next==NULL' outside this loop. 206 * So, no need to check for 'next==NULL' outside this loop.
221 */ 207 */
222 } 208 }
@@ -229,36 +215,22 @@ static struct cpuidle_state *next_valid_state(struct cpuidle_device *dev,
229 * @dev: cpuidle device 215 * @dev: cpuidle device
230 * @state: The target state to be programmed 216 * @state: The target state to be programmed
231 * 217 *
232 * Used for C states with CPUIDLE_FLAG_CHECK_BM flag set. This 218 * This function checks for any pending activity and then programs
233 * function checks for any pending activity and then programs the 219 * the device to the specified or a safer state.
234 * device to the specified or a safer state.
235 */ 220 */
236static int omap3_enter_idle_bm(struct cpuidle_device *dev, 221static int omap3_enter_idle_bm(struct cpuidle_device *dev,
237 struct cpuidle_state *state) 222 struct cpuidle_state *state)
238{ 223{
239 struct cpuidle_state *new_state = next_valid_state(dev, state); 224 struct cpuidle_state *new_state;
240 u32 core_next_state, per_next_state = 0, per_saved_state = 0; 225 u32 core_next_state, per_next_state = 0, per_saved_state = 0, cam_state;
241 u32 cam_state; 226 struct omap3_idle_statedata *cx;
242 struct omap3_processor_cx *cx;
243 int ret; 227 int ret;
244 228
245 if ((state->flags & CPUIDLE_FLAG_CHECK_BM) && omap3_idle_bm_check()) { 229 if (!omap3_can_sleep()) {
246 BUG_ON(!dev->safe_state);
247 new_state = dev->safe_state; 230 new_state = dev->safe_state;
248 goto select_state; 231 goto select_state;
249 } 232 }
250 233
251 cx = cpuidle_get_statedata(state);
252 core_next_state = cx->core_state;
253
254 /*
255 * FIXME: we currently manage device-specific idle states
256 * for PER and CORE in combination with CPU-specific
257 * idle states. This is wrong, and device-specific
258 * idle management needs to be separated out into
259 * its own code.
260 */
261
262 /* 234 /*
263 * Prevent idle completely if CAM is active. 235 * Prevent idle completely if CAM is active.
264 * CAM does not have wakeup capability in OMAP3. 236 * CAM does not have wakeup capability in OMAP3.
@@ -270,9 +242,19 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,
270 } 242 }
271 243
272 /* 244 /*
245 * FIXME: we currently manage device-specific idle states
246 * for PER and CORE in combination with CPU-specific
247 * idle states. This is wrong, and device-specific
248 * idle management needs to be separated out into
249 * its own code.
250 */
251
252 /*
273 * Prevent PER off if CORE is not in retention or off as this 253 * Prevent PER off if CORE is not in retention or off as this
274 * would disable PER wakeups completely. 254 * would disable PER wakeups completely.
275 */ 255 */
256 cx = cpuidle_get_statedata(state);
257 core_next_state = cx->core_state;
276 per_next_state = per_saved_state = pwrdm_read_next_pwrst(per_pd); 258 per_next_state = per_saved_state = pwrdm_read_next_pwrst(per_pd);
277 if ((per_next_state == PWRDM_POWER_OFF) && 259 if ((per_next_state == PWRDM_POWER_OFF) &&
278 (core_next_state > PWRDM_POWER_RET)) 260 (core_next_state > PWRDM_POWER_RET))
@@ -282,6 +264,8 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,
282 if (per_next_state != per_saved_state) 264 if (per_next_state != per_saved_state)
283 pwrdm_set_next_pwrst(per_pd, per_next_state); 265 pwrdm_set_next_pwrst(per_pd, per_next_state);
284 266
267 new_state = next_valid_state(dev, state);
268
285select_state: 269select_state:
286 dev->last_state = new_state; 270 dev->last_state = new_state;
287 ret = omap3_enter_idle(dev, new_state); 271 ret = omap3_enter_idle(dev, new_state);
@@ -295,31 +279,6 @@ select_state:
295 279
296DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev); 280DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev);
297 281
298/**
299 * omap3_cpuidle_update_states() - Update the cpuidle states
300 * @mpu_deepest_state: Enable states up to and including this for mpu domain
301 * @core_deepest_state: Enable states up to and including this for core domain
302 *
303 * This goes through the list of states available and enables and disables the
304 * validity of C states based on deepest state that can be achieved for the
305 * variable domain
306 */
307void omap3_cpuidle_update_states(u32 mpu_deepest_state, u32 core_deepest_state)
308{
309 int i;
310
311 for (i = OMAP3_STATE_C1; i < OMAP3_MAX_STATES; i++) {
312 struct omap3_processor_cx *cx = &omap3_power_states[i];
313
314 if ((cx->mpu_state >= mpu_deepest_state) &&
315 (cx->core_state >= core_deepest_state)) {
316 cx->valid = 1;
317 } else {
318 cx->valid = 0;
319 }
320 }
321}
322
323void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params) 282void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params)
324{ 283{
325 int i; 284 int i;
@@ -327,212 +286,109 @@ void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params)
327 if (!cpuidle_board_params) 286 if (!cpuidle_board_params)
328 return; 287 return;
329 288
330 for (i = OMAP3_STATE_C1; i < OMAP3_MAX_STATES; i++) { 289 for (i = 0; i < OMAP3_NUM_STATES; i++) {
331 cpuidle_params_table[i].valid = 290 cpuidle_params_table[i].valid = cpuidle_board_params[i].valid;
332 cpuidle_board_params[i].valid; 291 cpuidle_params_table[i].exit_latency =
333 cpuidle_params_table[i].sleep_latency = 292 cpuidle_board_params[i].exit_latency;
334 cpuidle_board_params[i].sleep_latency; 293 cpuidle_params_table[i].target_residency =
335 cpuidle_params_table[i].wake_latency = 294 cpuidle_board_params[i].target_residency;
336 cpuidle_board_params[i].wake_latency;
337 cpuidle_params_table[i].threshold =
338 cpuidle_board_params[i].threshold;
339 } 295 }
340 return; 296 return;
341} 297}
342 298
343/* omap3_init_power_states - Initialises the OMAP3 specific C states.
344 *
345 * Below is the desciption of each C state.
346 * C1 . MPU WFI + Core active
347 * C2 . MPU WFI + Core inactive
348 * C3 . MPU CSWR + Core inactive
349 * C4 . MPU OFF + Core inactive
350 * C5 . MPU CSWR + Core CSWR
351 * C6 . MPU OFF + Core CSWR
352 * C7 . MPU OFF + Core OFF
353 */
354void omap_init_power_states(void)
355{
356 /* C1 . MPU WFI + Core active */
357 omap3_power_states[OMAP3_STATE_C1].valid =
358 cpuidle_params_table[OMAP3_STATE_C1].valid;
359 omap3_power_states[OMAP3_STATE_C1].type = OMAP3_STATE_C1;
360 omap3_power_states[OMAP3_STATE_C1].sleep_latency =
361 cpuidle_params_table[OMAP3_STATE_C1].sleep_latency;
362 omap3_power_states[OMAP3_STATE_C1].wakeup_latency =
363 cpuidle_params_table[OMAP3_STATE_C1].wake_latency;
364 omap3_power_states[OMAP3_STATE_C1].threshold =
365 cpuidle_params_table[OMAP3_STATE_C1].threshold;
366 omap3_power_states[OMAP3_STATE_C1].mpu_state = PWRDM_POWER_ON;
367 omap3_power_states[OMAP3_STATE_C1].core_state = PWRDM_POWER_ON;
368 omap3_power_states[OMAP3_STATE_C1].flags = CPUIDLE_FLAG_TIME_VALID;
369 omap3_power_states[OMAP3_STATE_C1].desc = "MPU ON + CORE ON";
370
371 /* C2 . MPU WFI + Core inactive */
372 omap3_power_states[OMAP3_STATE_C2].valid =
373 cpuidle_params_table[OMAP3_STATE_C2].valid;
374 omap3_power_states[OMAP3_STATE_C2].type = OMAP3_STATE_C2;
375 omap3_power_states[OMAP3_STATE_C2].sleep_latency =
376 cpuidle_params_table[OMAP3_STATE_C2].sleep_latency;
377 omap3_power_states[OMAP3_STATE_C2].wakeup_latency =
378 cpuidle_params_table[OMAP3_STATE_C2].wake_latency;
379 omap3_power_states[OMAP3_STATE_C2].threshold =
380 cpuidle_params_table[OMAP3_STATE_C2].threshold;
381 omap3_power_states[OMAP3_STATE_C2].mpu_state = PWRDM_POWER_ON;
382 omap3_power_states[OMAP3_STATE_C2].core_state = PWRDM_POWER_ON;
383 omap3_power_states[OMAP3_STATE_C2].flags = CPUIDLE_FLAG_TIME_VALID |
384 CPUIDLE_FLAG_CHECK_BM;
385 omap3_power_states[OMAP3_STATE_C2].desc = "MPU ON + CORE ON";
386
387 /* C3 . MPU CSWR + Core inactive */
388 omap3_power_states[OMAP3_STATE_C3].valid =
389 cpuidle_params_table[OMAP3_STATE_C3].valid;
390 omap3_power_states[OMAP3_STATE_C3].type = OMAP3_STATE_C3;
391 omap3_power_states[OMAP3_STATE_C3].sleep_latency =
392 cpuidle_params_table[OMAP3_STATE_C3].sleep_latency;
393 omap3_power_states[OMAP3_STATE_C3].wakeup_latency =
394 cpuidle_params_table[OMAP3_STATE_C3].wake_latency;
395 omap3_power_states[OMAP3_STATE_C3].threshold =
396 cpuidle_params_table[OMAP3_STATE_C3].threshold;
397 omap3_power_states[OMAP3_STATE_C3].mpu_state = PWRDM_POWER_RET;
398 omap3_power_states[OMAP3_STATE_C3].core_state = PWRDM_POWER_ON;
399 omap3_power_states[OMAP3_STATE_C3].flags = CPUIDLE_FLAG_TIME_VALID |
400 CPUIDLE_FLAG_CHECK_BM;
401 omap3_power_states[OMAP3_STATE_C3].desc = "MPU RET + CORE ON";
402
403 /* C4 . MPU OFF + Core inactive */
404 omap3_power_states[OMAP3_STATE_C4].valid =
405 cpuidle_params_table[OMAP3_STATE_C4].valid;
406 omap3_power_states[OMAP3_STATE_C4].type = OMAP3_STATE_C4;
407 omap3_power_states[OMAP3_STATE_C4].sleep_latency =
408 cpuidle_params_table[OMAP3_STATE_C4].sleep_latency;
409 omap3_power_states[OMAP3_STATE_C4].wakeup_latency =
410 cpuidle_params_table[OMAP3_STATE_C4].wake_latency;
411 omap3_power_states[OMAP3_STATE_C4].threshold =
412 cpuidle_params_table[OMAP3_STATE_C4].threshold;
413 omap3_power_states[OMAP3_STATE_C4].mpu_state = PWRDM_POWER_OFF;
414 omap3_power_states[OMAP3_STATE_C4].core_state = PWRDM_POWER_ON;
415 omap3_power_states[OMAP3_STATE_C4].flags = CPUIDLE_FLAG_TIME_VALID |
416 CPUIDLE_FLAG_CHECK_BM;
417 omap3_power_states[OMAP3_STATE_C4].desc = "MPU OFF + CORE ON";
418
419 /* C5 . MPU CSWR + Core CSWR*/
420 omap3_power_states[OMAP3_STATE_C5].valid =
421 cpuidle_params_table[OMAP3_STATE_C5].valid;
422 omap3_power_states[OMAP3_STATE_C5].type = OMAP3_STATE_C5;
423 omap3_power_states[OMAP3_STATE_C5].sleep_latency =
424 cpuidle_params_table[OMAP3_STATE_C5].sleep_latency;
425 omap3_power_states[OMAP3_STATE_C5].wakeup_latency =
426 cpuidle_params_table[OMAP3_STATE_C5].wake_latency;
427 omap3_power_states[OMAP3_STATE_C5].threshold =
428 cpuidle_params_table[OMAP3_STATE_C5].threshold;
429 omap3_power_states[OMAP3_STATE_C5].mpu_state = PWRDM_POWER_RET;
430 omap3_power_states[OMAP3_STATE_C5].core_state = PWRDM_POWER_RET;
431 omap3_power_states[OMAP3_STATE_C5].flags = CPUIDLE_FLAG_TIME_VALID |
432 CPUIDLE_FLAG_CHECK_BM;
433 omap3_power_states[OMAP3_STATE_C5].desc = "MPU RET + CORE RET";
434
435 /* C6 . MPU OFF + Core CSWR */
436 omap3_power_states[OMAP3_STATE_C6].valid =
437 cpuidle_params_table[OMAP3_STATE_C6].valid;
438 omap3_power_states[OMAP3_STATE_C6].type = OMAP3_STATE_C6;
439 omap3_power_states[OMAP3_STATE_C6].sleep_latency =
440 cpuidle_params_table[OMAP3_STATE_C6].sleep_latency;
441 omap3_power_states[OMAP3_STATE_C6].wakeup_latency =
442 cpuidle_params_table[OMAP3_STATE_C6].wake_latency;
443 omap3_power_states[OMAP3_STATE_C6].threshold =
444 cpuidle_params_table[OMAP3_STATE_C6].threshold;
445 omap3_power_states[OMAP3_STATE_C6].mpu_state = PWRDM_POWER_OFF;
446 omap3_power_states[OMAP3_STATE_C6].core_state = PWRDM_POWER_RET;
447 omap3_power_states[OMAP3_STATE_C6].flags = CPUIDLE_FLAG_TIME_VALID |
448 CPUIDLE_FLAG_CHECK_BM;
449 omap3_power_states[OMAP3_STATE_C6].desc = "MPU OFF + CORE RET";
450
451 /* C7 . MPU OFF + Core OFF */
452 omap3_power_states[OMAP3_STATE_C7].valid =
453 cpuidle_params_table[OMAP3_STATE_C7].valid;
454 omap3_power_states[OMAP3_STATE_C7].type = OMAP3_STATE_C7;
455 omap3_power_states[OMAP3_STATE_C7].sleep_latency =
456 cpuidle_params_table[OMAP3_STATE_C7].sleep_latency;
457 omap3_power_states[OMAP3_STATE_C7].wakeup_latency =
458 cpuidle_params_table[OMAP3_STATE_C7].wake_latency;
459 omap3_power_states[OMAP3_STATE_C7].threshold =
460 cpuidle_params_table[OMAP3_STATE_C7].threshold;
461 omap3_power_states[OMAP3_STATE_C7].mpu_state = PWRDM_POWER_OFF;
462 omap3_power_states[OMAP3_STATE_C7].core_state = PWRDM_POWER_OFF;
463 omap3_power_states[OMAP3_STATE_C7].flags = CPUIDLE_FLAG_TIME_VALID |
464 CPUIDLE_FLAG_CHECK_BM;
465 omap3_power_states[OMAP3_STATE_C7].desc = "MPU OFF + CORE OFF";
466
467 /*
468 * Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot
469 * enable OFF mode in a stable form for previous revisions.
470 * we disable C7 state as a result.
471 */
472 if (IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583)) {
473 omap3_power_states[OMAP3_STATE_C7].valid = 0;
474 cpuidle_params_table[OMAP3_STATE_C7].valid = 0;
475 pr_warn("%s: core off state C7 disabled due to i583\n",
476 __func__);
477 }
478}
479
480struct cpuidle_driver omap3_idle_driver = { 299struct cpuidle_driver omap3_idle_driver = {
481 .name = "omap3_idle", 300 .name = "omap3_idle",
482 .owner = THIS_MODULE, 301 .owner = THIS_MODULE,
483}; 302};
484 303
304/* Helper to fill the C-state common data and register the driver_data */
305static inline struct omap3_idle_statedata *_fill_cstate(
306 struct cpuidle_device *dev,
307 int idx, const char *descr)
308{
309 struct omap3_idle_statedata *cx = &omap3_idle_data[idx];
310 struct cpuidle_state *state = &dev->states[idx];
311
312 state->exit_latency = cpuidle_params_table[idx].exit_latency;
313 state->target_residency = cpuidle_params_table[idx].target_residency;
314 state->flags = CPUIDLE_FLAG_TIME_VALID;
315 state->enter = omap3_enter_idle_bm;
316 cx->valid = cpuidle_params_table[idx].valid;
317 sprintf(state->name, "C%d", idx + 1);
318 strncpy(state->desc, descr, CPUIDLE_DESC_LEN);
319 cpuidle_set_statedata(state, cx);
320
321 return cx;
322}
323
485/** 324/**
486 * omap3_idle_init - Init routine for OMAP3 idle 325 * omap3_idle_init - Init routine for OMAP3 idle
487 * 326 *
488 * Registers the OMAP3 specific cpuidle driver with the cpuidle 327 * Registers the OMAP3 specific cpuidle driver to the cpuidle
489 * framework with the valid set of states. 328 * framework with the valid set of states.
490 */ 329 */
491int __init omap3_idle_init(void) 330int __init omap3_idle_init(void)
492{ 331{
493 int i, count = 0;
494 struct omap3_processor_cx *cx;
495 struct cpuidle_state *state;
496 struct cpuidle_device *dev; 332 struct cpuidle_device *dev;
333 struct omap3_idle_statedata *cx;
497 334
498 mpu_pd = pwrdm_lookup("mpu_pwrdm"); 335 mpu_pd = pwrdm_lookup("mpu_pwrdm");
499 core_pd = pwrdm_lookup("core_pwrdm"); 336 core_pd = pwrdm_lookup("core_pwrdm");
500 per_pd = pwrdm_lookup("per_pwrdm"); 337 per_pd = pwrdm_lookup("per_pwrdm");
501 cam_pd = pwrdm_lookup("cam_pwrdm"); 338 cam_pd = pwrdm_lookup("cam_pwrdm");
502 339
503 omap_init_power_states();
504 cpuidle_register_driver(&omap3_idle_driver); 340 cpuidle_register_driver(&omap3_idle_driver);
505
506 dev = &per_cpu(omap3_idle_dev, smp_processor_id()); 341 dev = &per_cpu(omap3_idle_dev, smp_processor_id());
507 342
508 for (i = OMAP3_STATE_C1; i < OMAP3_MAX_STATES; i++) { 343 /* C1 . MPU WFI + Core active */
509 cx = &omap3_power_states[i]; 344 cx = _fill_cstate(dev, 0, "MPU ON + CORE ON");
510 state = &dev->states[count]; 345 (&dev->states[0])->enter = omap3_enter_idle;
511 346 dev->safe_state = &dev->states[0];
512 if (!cx->valid) 347 cx->valid = 1; /* C1 is always valid */
513 continue; 348 cx->mpu_state = PWRDM_POWER_ON;
514 cpuidle_set_statedata(state, cx); 349 cx->core_state = PWRDM_POWER_ON;
515 state->exit_latency = cx->sleep_latency + cx->wakeup_latency;
516 state->target_residency = cx->threshold;
517 state->flags = cx->flags;
518 state->enter = (state->flags & CPUIDLE_FLAG_CHECK_BM) ?
519 omap3_enter_idle_bm : omap3_enter_idle;
520 if (cx->type == OMAP3_STATE_C1)
521 dev->safe_state = state;
522 sprintf(state->name, "C%d", count+1);
523 strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);
524 count++;
525 }
526 350
527 if (!count) 351 /* C2 . MPU WFI + Core inactive */
528 return -EINVAL; 352 cx = _fill_cstate(dev, 1, "MPU ON + CORE ON");
529 dev->state_count = count; 353 cx->mpu_state = PWRDM_POWER_ON;
354 cx->core_state = PWRDM_POWER_ON;
355
356 /* C3 . MPU CSWR + Core inactive */
357 cx = _fill_cstate(dev, 2, "MPU RET + CORE ON");
358 cx->mpu_state = PWRDM_POWER_RET;
359 cx->core_state = PWRDM_POWER_ON;
530 360
531 if (enable_off_mode) 361 /* C4 . MPU OFF + Core inactive */
532 omap3_cpuidle_update_states(PWRDM_POWER_OFF, PWRDM_POWER_OFF); 362 cx = _fill_cstate(dev, 3, "MPU OFF + CORE ON");
533 else 363 cx->mpu_state = PWRDM_POWER_OFF;
534 omap3_cpuidle_update_states(PWRDM_POWER_RET, PWRDM_POWER_RET); 364 cx->core_state = PWRDM_POWER_ON;
365
366 /* C5 . MPU RET + Core RET */
367 cx = _fill_cstate(dev, 4, "MPU RET + CORE RET");
368 cx->mpu_state = PWRDM_POWER_RET;
369 cx->core_state = PWRDM_POWER_RET;
370
371 /* C6 . MPU OFF + Core RET */
372 cx = _fill_cstate(dev, 5, "MPU OFF + CORE RET");
373 cx->mpu_state = PWRDM_POWER_OFF;
374 cx->core_state = PWRDM_POWER_RET;
375
376 /* C7 . MPU OFF + Core OFF */
377 cx = _fill_cstate(dev, 6, "MPU OFF + CORE OFF");
378 /*
379 * Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot
380 * enable OFF mode in a stable form for previous revisions.
381 * We disable C7 state as a result.
382 */
383 if (IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583)) {
384 cx->valid = 0;
385 pr_warn("%s: core off state C7 disabled due to i583\n",
386 __func__);
387 }
388 cx->mpu_state = PWRDM_POWER_OFF;
389 cx->core_state = PWRDM_POWER_OFF;
535 390
391 dev->state_count = OMAP3_NUM_STATES;
536 if (cpuidle_register_device(dev)) { 392 if (cpuidle_register_device(dev)) {
537 printk(KERN_ERR "%s: CPUidle register device failed\n", 393 printk(KERN_ERR "%s: CPUidle register device failed\n",
538 __func__); 394 __func__);
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/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/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c
index 05f6abc96b0d..f47813edd951 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -50,13 +50,16 @@ int omap4430_phy_init(struct device *dev)
50{ 50{
51 ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K); 51 ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K);
52 if (!ctrl_base) { 52 if (!ctrl_base) {
53 dev_err(dev, "control module ioremap failed\n"); 53 pr_err("control module ioremap failed\n");
54 return -ENOMEM; 54 return -ENOMEM;
55 } 55 }
56 /* Power down the phy */ 56 /* Power down the phy */
57 __raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF); 57 __raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
58 phyclk = clk_get(dev, "ocp2scp_usb_phy_ick");
59 58
59 if (!dev)
60 return 0;
61
62 phyclk = clk_get(dev, "ocp2scp_usb_phy_ick");
60 if (IS_ERR(phyclk)) { 63 if (IS_ERR(phyclk)) {
61 dev_err(dev, "cannot clk_get ocp2scp_usb_phy_ick\n"); 64 dev_err(dev, "cannot clk_get ocp2scp_usb_phy_ick\n");
62 iounmap(ctrl_base); 65 iounmap(ctrl_base);
@@ -228,7 +231,7 @@ void am35x_musb_clear_irq(void)
228 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); 231 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
229} 232}
230 233
231void am35x_musb_set_mode(u8 musb_mode) 234void am35x_set_mode(u8 musb_mode)
232{ 235{
233 u32 devconf2 = omap_ctrl_readl(AM35XX_CONTROL_DEVCONF2); 236 u32 devconf2 = omap_ctrl_readl(AM35XX_CONTROL_DEVCONF2);
234 237
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 797bfd12b643..45bcfce77352 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -36,11 +36,16 @@ static inline int omap4_opp_init(void)
36} 36}
37#endif 37#endif
38 38
39/*
40 * cpuidle mach specific parameters
41 *
42 * The board code can override the default C-states definition using
43 * omap3_pm_init_cpuidle
44 */
39struct cpuidle_params { 45struct cpuidle_params {
40 u8 valid; 46 u32 exit_latency; /* exit_latency = sleep + wake-up latencies */
41 u32 sleep_latency; 47 u32 target_residency;
42 u32 wake_latency; 48 u8 valid; /* validates the C-state */
43 u32 threshold;
44}; 49};
45 50
46#if defined(CONFIG_PM) && defined(CONFIG_CPU_IDLE) 51#if defined(CONFIG_PM) && defined(CONFIG_CPU_IDLE)
@@ -73,10 +78,6 @@ extern u32 sleep_while_idle;
73#define sleep_while_idle 0 78#define sleep_while_idle 0
74#endif 79#endif
75 80
76#if defined(CONFIG_CPU_IDLE)
77extern void omap3_cpuidle_update_states(u32, u32);
78#endif
79
80#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) 81#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
81extern void pm_dbg_update_time(struct powerdomain *pwrdm, int prev); 82extern void pm_dbg_update_time(struct powerdomain *pwrdm, int prev);
82extern int pm_dbg_regset_save(int reg_set); 83extern int pm_dbg_regset_save(int reg_set);
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 0c5e3a46a3ad..c155c9d1c82c 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -779,18 +779,6 @@ void omap3_pm_off_mode_enable(int enable)
779 else 779 else
780 state = PWRDM_POWER_RET; 780 state = PWRDM_POWER_RET;
781 781
782#ifdef CONFIG_CPU_IDLE
783 /*
784 * Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot
785 * enable OFF mode in a stable form for previous revisions, restrict
786 * instead to RET
787 */
788 if (IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583))
789 omap3_cpuidle_update_states(state, PWRDM_POWER_RET);
790 else
791 omap3_cpuidle_update_states(state, state);
792#endif
793
794 list_for_each_entry(pwrst, &pwrst_list, node) { 782 list_for_each_entry(pwrst, &pwrst_list, node) {
795 if (IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583) && 783 if (IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583) &&
796 pwrst->pwrdm == core_pwrdm && 784 pwrst->pwrdm == core_pwrdm &&
@@ -895,8 +883,6 @@ static int __init omap3_pm_init(void)
895 883
896 pm_errata_configure(); 884 pm_errata_configure();
897 885
898 printk(KERN_ERR "Power Management for TI OMAP3.\n");
899
900 /* XXX prcm_setup_regs needs to be before enabling hw 886 /* XXX prcm_setup_regs needs to be before enabling hw
901 * supervised mode for powerdomains */ 887 * supervised mode for powerdomains */
902 prcm_setup_regs(); 888 prcm_setup_regs();
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 35559f77e2de..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,11 +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;
119 126
120 if (cpu_is_omap3517() || cpu_is_omap3505()) { 127 if (musb_board_data)
121 } else if (cpu_is_omap44xx()) { 128 board_data = musb_board_data;
122 usb_musb_mux_init(board_data); 129 else
123 } 130 board_data = &musb_default_board_data;
124 131
125 /* 132 /*
126 * REVISIT: This line can be removed once all the platforms using 133 * REVISIT: This line can be removed once all the platforms using
@@ -164,10 +171,15 @@ void __init usb_musb_init(struct omap_musb_board_data *board_data)
164 dev->dma_mask = &musb_dmamask; 171 dev->dma_mask = &musb_dmamask;
165 dev->coherent_dma_mask = musb_dmamask; 172 dev->coherent_dma_mask = musb_dmamask;
166 put_device(dev); 173 put_device(dev);
174
175 if (cpu_is_omap44xx())
176 omap4430_phy_init(dev);
167} 177}
168 178
169#else 179#else
170void __init usb_musb_init(struct omap_musb_board_data *board_data) 180void __init usb_musb_init(struct omap_musb_board_data *board_data)
171{ 181{
182 if (cpu_is_omap44xx())
183 omap4430_phy_init(NULL);
172} 184}
173#endif /* CONFIG_USB_MUSB_SOC */ 185#endif /* CONFIG_USB_MUSB_SOC */
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/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 565d2664f5a7..ac4b60d9aa29 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/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h
index 02b96c8f6a17..17d3c939775c 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -113,7 +113,7 @@ extern int omap4430_phy_suspend(struct device *dev, int suspend);
113extern void am35x_musb_reset(void); 113extern void am35x_musb_reset(void);
114extern void am35x_musb_phy_power(u8 on); 114extern void am35x_musb_phy_power(u8 on);
115extern void am35x_musb_clear_irq(void); 115extern void am35x_musb_clear_irq(void);
116extern void am35x_musb_set_mode(u8 musb_mode); 116extern void am35x_set_mode(u8 musb_mode);
117 117
118/* 118/*
119 * FIXME correct answer depends on hmc_mode, 119 * FIXME correct answer depends on hmc_mode,
diff --git a/arch/avr32/include/asm/bitops.h b/arch/avr32/include/asm/bitops.h
index 72444d97f80c..b70c19bab63a 100644
--- a/arch/avr32/include/asm/bitops.h
+++ b/arch/avr32/include/asm/bitops.h
@@ -270,14 +270,21 @@ static inline int __fls(unsigned long word)
270 270
271unsigned long find_first_zero_bit(const unsigned long *addr, 271unsigned long find_first_zero_bit(const unsigned long *addr,
272 unsigned long size); 272 unsigned long size);
273#define find_first_zero_bit find_first_zero_bit
274
273unsigned long find_next_zero_bit(const unsigned long *addr, 275unsigned long find_next_zero_bit(const unsigned long *addr,
274 unsigned long size, 276 unsigned long size,
275 unsigned long offset); 277 unsigned long offset);
278#define find_next_zero_bit find_next_zero_bit
279
276unsigned long find_first_bit(const unsigned long *addr, 280unsigned long find_first_bit(const unsigned long *addr,
277 unsigned long size); 281 unsigned long size);
282#define find_first_bit find_first_bit
283
278unsigned long find_next_bit(const unsigned long *addr, 284unsigned long find_next_bit(const unsigned long *addr,
279 unsigned long size, 285 unsigned long size,
280 unsigned long offset); 286 unsigned long offset);
287#define find_next_bit find_next_bit
281 288
282/* 289/*
283 * ffs: find first bit set. This is defined the same way as 290 * ffs: find first bit set. This is defined the same way as
@@ -299,6 +306,14 @@ static inline int ffs(unsigned long word)
299#include <asm-generic/bitops/hweight.h> 306#include <asm-generic/bitops/hweight.h>
300#include <asm-generic/bitops/lock.h> 307#include <asm-generic/bitops/lock.h>
301 308
309extern unsigned long find_next_zero_bit_le(const void *addr,
310 unsigned long size, unsigned long offset);
311#define find_next_zero_bit_le find_next_zero_bit_le
312
313extern unsigned long find_next_bit_le(const void *addr,
314 unsigned long size, unsigned long offset);
315#define find_next_bit_le find_next_bit_le
316
302#include <asm-generic/bitops/le.h> 317#include <asm-generic/bitops/le.h>
303#include <asm-generic/bitops/ext2-atomic.h> 318#include <asm-generic/bitops/ext2-atomic.h>
304 319
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index a18180f2d007..d619b17c4413 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -47,9 +47,6 @@ config GENERIC_BUG
47config ZONE_DMA 47config ZONE_DMA
48 def_bool y 48 def_bool y
49 49
50config GENERIC_FIND_NEXT_BIT
51 def_bool y
52
53config GENERIC_GPIO 50config GENERIC_GPIO
54 def_bool y 51 def_bool y
55 52
diff --git a/arch/blackfin/include/asm/kgdb.h b/arch/blackfin/include/asm/kgdb.h
index 3ac0c72e9fee..aaf884591b07 100644
--- a/arch/blackfin/include/asm/kgdb.h
+++ b/arch/blackfin/include/asm/kgdb.h
@@ -108,6 +108,7 @@ static inline void arch_kgdb_breakpoint(void)
108#else 108#else
109# define CACHE_FLUSH_IS_SAFE 1 109# define CACHE_FLUSH_IS_SAFE 1
110#endif 110#endif
111#define GDB_ADJUSTS_BREAK_OFFSET
111#define HW_INST_WATCHPOINT_NUM 6 112#define HW_INST_WATCHPOINT_NUM 6
112#define HW_WATCHPOINT_NUM 8 113#define HW_WATCHPOINT_NUM 8
113#define TYPE_INST_WATCHPOINT 0 114#define TYPE_INST_WATCHPOINT 0
diff --git a/arch/blackfin/include/asm/ptrace.h b/arch/blackfin/include/asm/ptrace.h
index 1066d63e62b5..7854d4367c15 100644
--- a/arch/blackfin/include/asm/ptrace.h
+++ b/arch/blackfin/include/asm/ptrace.h
@@ -102,9 +102,6 @@ struct pt_regs {
102/* user_mode returns true if only one bit is set in IPEND, other than the 102/* user_mode returns true if only one bit is set in IPEND, other than the
103 master interrupt enable. */ 103 master interrupt enable. */
104#define user_mode(regs) (!(((regs)->ipend & ~0x10) & (((regs)->ipend & ~0x10) - 1))) 104#define user_mode(regs) (!(((regs)->ipend & ~0x10) & (((regs)->ipend & ~0x10) - 1)))
105#define instruction_pointer(regs) ((regs)->pc)
106#define user_stack_pointer(regs) ((regs)->usp)
107#define profile_pc(regs) instruction_pointer(regs)
108extern void show_regs(struct pt_regs *); 105extern void show_regs(struct pt_regs *);
109 106
110#define arch_has_single_step() (1) 107#define arch_has_single_step() (1)
@@ -128,6 +125,8 @@ extern int is_user_addr_valid(struct task_struct *child,
128 ((unsigned long)task_stack_page(task) + \ 125 ((unsigned long)task_stack_page(task) + \
129 (THREAD_SIZE - sizeof(struct pt_regs))) 126 (THREAD_SIZE - sizeof(struct pt_regs)))
130 127
128#include <asm-generic/ptrace.h>
129
131#endif /* __KERNEL__ */ 130#endif /* __KERNEL__ */
132 131
133#endif /* __ASSEMBLY__ */ 132#endif /* __ASSEMBLY__ */
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index a6d03069d0ff..b6b94a27d276 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -31,10 +31,6 @@ config ARCH_HAS_ILOG2_U64
31 bool 31 bool
32 default n 32 default n
33 33
34config GENERIC_FIND_NEXT_BIT
35 bool
36 default y
37
38config GENERIC_HWEIGHT 34config GENERIC_HWEIGHT
39 bool 35 bool
40 default y 36 default y
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index 064f62196745..cb884e489425 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -19,14 +19,6 @@ config RWSEM_GENERIC_SPINLOCK
19config RWSEM_XCHGADD_ALGORITHM 19config RWSEM_XCHGADD_ALGORITHM
20 bool 20 bool
21 21
22config GENERIC_FIND_NEXT_BIT
23 bool
24 default y
25
26config GENERIC_FIND_BIT_LE
27 bool
28 default y
29
30config GENERIC_HWEIGHT 22config GENERIC_HWEIGHT
31 bool 23 bool
32 default y 24 default y
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index e20322ffcaf8..091ed6192ae8 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -41,14 +41,6 @@ config ARCH_HAS_ILOG2_U64
41 bool 41 bool
42 default n 42 default n
43 43
44config GENERIC_FIND_NEXT_BIT
45 bool
46 default y
47
48config GENERIC_FIND_BIT_LE
49 bool
50 default y
51
52config GENERIC_HWEIGHT 44config GENERIC_HWEIGHT
53 bool 45 bool
54 default y 46 default y
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index e5cc56ae6ce3..38280ef4a2af 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -78,10 +78,6 @@ config HUGETLB_PAGE_SIZE_VARIABLE
78 depends on HUGETLB_PAGE 78 depends on HUGETLB_PAGE
79 default y 79 default y
80 80
81config GENERIC_FIND_NEXT_BIT
82 bool
83 default y
84
85config GENERIC_CALIBRATE_DELAY 81config GENERIC_CALIBRATE_DELAY
86 bool 82 bool
87 default y 83 default y
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 04440cc09b40..85118dfe9bb5 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -36,7 +36,7 @@
36static cycle_t itc_get_cycles(struct clocksource *cs); 36static cycle_t itc_get_cycles(struct clocksource *cs);
37 37
38struct fsyscall_gtod_data_t fsyscall_gtod_data = { 38struct fsyscall_gtod_data_t fsyscall_gtod_data = {
39 .lock = SEQLOCK_UNLOCKED, 39 .lock = __SEQLOCK_UNLOCKED(fsyscall_gtod_data.lock),
40}; 40};
41 41
42struct itc_jitter_data_t itc_jitter_data; 42struct itc_jitter_data_t itc_jitter_data;
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 736b808d2291..85b44e858225 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -256,14 +256,6 @@ config ARCH_HAS_ILOG2_U64
256 bool 256 bool
257 default n 257 default n
258 258
259config GENERIC_FIND_NEXT_BIT
260 bool
261 default y
262
263config GENERIC_FIND_BIT_LE
264 bool
265 default y
266
267config GENERIC_HWEIGHT 259config GENERIC_HWEIGHT
268 bool 260 bool
269 default y 261 default y
diff --git a/arch/m32r/include/asm/smp.h b/arch/m32r/include/asm/smp.h
index 8accc1bb0263..cf7829a61551 100644
--- a/arch/m32r/include/asm/smp.h
+++ b/arch/m32r/include/asm/smp.h
@@ -81,11 +81,11 @@ static __inline__ int cpu_number_map(int cpu)
81 81
82static __inline__ unsigned int num_booting_cpus(void) 82static __inline__ unsigned int num_booting_cpus(void)
83{ 83{
84 return cpus_weight(cpu_callout_map); 84 return cpumask_weight(&cpu_callout_map);
85} 85}
86 86
87extern void smp_send_timer(void); 87extern void smp_send_timer(void);
88extern unsigned long send_IPI_mask_phys(cpumask_t, int, int); 88extern unsigned long send_IPI_mask_phys(const cpumask_t*, int, int);
89 89
90extern void arch_send_call_function_single_ipi(int cpu); 90extern void arch_send_call_function_single_ipi(int cpu);
91extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 91extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c
index fc10b39893d4..092d40a6708e 100644
--- a/arch/m32r/kernel/smp.c
+++ b/arch/m32r/kernel/smp.c
@@ -30,6 +30,7 @@
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/mmu_context.h> 31#include <asm/mmu_context.h>
32#include <asm/m32r.h> 32#include <asm/m32r.h>
33#include <asm/tlbflush.h>
33 34
34/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 35/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
35/* Data structures and variables */ 36/* Data structures and variables */
@@ -61,33 +62,22 @@ extern spinlock_t ipi_lock[];
61/* Function Prototypes */ 62/* Function Prototypes */
62/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 63/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
63 64
64void smp_send_reschedule(int);
65void smp_reschedule_interrupt(void); 65void smp_reschedule_interrupt(void);
66
67void smp_flush_cache_all(void);
68void smp_flush_cache_all_interrupt(void); 66void smp_flush_cache_all_interrupt(void);
69 67
70void smp_flush_tlb_all(void);
71static void flush_tlb_all_ipi(void *); 68static void flush_tlb_all_ipi(void *);
72
73void smp_flush_tlb_mm(struct mm_struct *);
74void smp_flush_tlb_range(struct vm_area_struct *, unsigned long, \
75 unsigned long);
76void smp_flush_tlb_page(struct vm_area_struct *, unsigned long);
77static void flush_tlb_others(cpumask_t, struct mm_struct *, 69static void flush_tlb_others(cpumask_t, struct mm_struct *,
78 struct vm_area_struct *, unsigned long); 70 struct vm_area_struct *, unsigned long);
71
79void smp_invalidate_interrupt(void); 72void smp_invalidate_interrupt(void);
80 73
81void smp_send_stop(void);
82static void stop_this_cpu(void *); 74static void stop_this_cpu(void *);
83 75
84void smp_send_timer(void);
85void smp_ipi_timer_interrupt(struct pt_regs *); 76void smp_ipi_timer_interrupt(struct pt_regs *);
86void smp_local_timer_interrupt(void); 77void smp_local_timer_interrupt(void);
87 78
88static void send_IPI_allbutself(int, int); 79static void send_IPI_allbutself(int, int);
89static void send_IPI_mask(const struct cpumask *, int, int); 80static void send_IPI_mask(const struct cpumask *, int, int);
90unsigned long send_IPI_mask_phys(cpumask_t, int, int);
91 81
92/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 82/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
93/* Rescheduling request Routines */ 83/* Rescheduling request Routines */
@@ -162,10 +152,10 @@ void smp_flush_cache_all(void)
162 unsigned long *mask; 152 unsigned long *mask;
163 153
164 preempt_disable(); 154 preempt_disable();
165 cpumask = cpu_online_map; 155 cpumask_copy(&cpumask, cpu_online_mask);
166 cpu_clear(smp_processor_id(), cpumask); 156 cpumask_clear_cpu(smp_processor_id(), &cpumask);
167 spin_lock(&flushcache_lock); 157 spin_lock(&flushcache_lock);
168 mask=cpus_addr(cpumask); 158 mask=cpumask_bits(&cpumask);
169 atomic_set_mask(*mask, (atomic_t *)&flushcache_cpumask); 159 atomic_set_mask(*mask, (atomic_t *)&flushcache_cpumask);
170 send_IPI_mask(&cpumask, INVALIDATE_CACHE_IPI, 0); 160 send_IPI_mask(&cpumask, INVALIDATE_CACHE_IPI, 0);
171 _flush_cache_copyback_all(); 161 _flush_cache_copyback_all();
@@ -263,8 +253,8 @@ void smp_flush_tlb_mm(struct mm_struct *mm)
263 preempt_disable(); 253 preempt_disable();
264 cpu_id = smp_processor_id(); 254 cpu_id = smp_processor_id();
265 mmc = &mm->context[cpu_id]; 255 mmc = &mm->context[cpu_id];
266 cpu_mask = *mm_cpumask(mm); 256 cpumask_copy(&cpu_mask, mm_cpumask(mm));
267 cpu_clear(cpu_id, cpu_mask); 257 cpumask_clear_cpu(cpu_id, &cpu_mask);
268 258
269 if (*mmc != NO_CONTEXT) { 259 if (*mmc != NO_CONTEXT) {
270 local_irq_save(flags); 260 local_irq_save(flags);
@@ -275,7 +265,7 @@ void smp_flush_tlb_mm(struct mm_struct *mm)
275 cpumask_clear_cpu(cpu_id, mm_cpumask(mm)); 265 cpumask_clear_cpu(cpu_id, mm_cpumask(mm));
276 local_irq_restore(flags); 266 local_irq_restore(flags);
277 } 267 }
278 if (!cpus_empty(cpu_mask)) 268 if (!cpumask_empty(&cpu_mask))
279 flush_tlb_others(cpu_mask, mm, NULL, FLUSH_ALL); 269 flush_tlb_others(cpu_mask, mm, NULL, FLUSH_ALL);
280 270
281 preempt_enable(); 271 preempt_enable();
@@ -333,8 +323,8 @@ void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va)
333 preempt_disable(); 323 preempt_disable();
334 cpu_id = smp_processor_id(); 324 cpu_id = smp_processor_id();
335 mmc = &mm->context[cpu_id]; 325 mmc = &mm->context[cpu_id];
336 cpu_mask = *mm_cpumask(mm); 326 cpumask_copy(&cpu_mask, mm_cpumask(mm));
337 cpu_clear(cpu_id, cpu_mask); 327 cpumask_clear_cpu(cpu_id, &cpu_mask);
338 328
339#ifdef DEBUG_SMP 329#ifdef DEBUG_SMP
340 if (!mm) 330 if (!mm)
@@ -348,7 +338,7 @@ void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va)
348 __flush_tlb_page(va); 338 __flush_tlb_page(va);
349 local_irq_restore(flags); 339 local_irq_restore(flags);
350 } 340 }
351 if (!cpus_empty(cpu_mask)) 341 if (!cpumask_empty(&cpu_mask))
352 flush_tlb_others(cpu_mask, mm, vma, va); 342 flush_tlb_others(cpu_mask, mm, vma, va);
353 343
354 preempt_enable(); 344 preempt_enable();
@@ -395,14 +385,14 @@ static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
395 * - current CPU must not be in mask 385 * - current CPU must not be in mask
396 * - mask must exist :) 386 * - mask must exist :)
397 */ 387 */
398 BUG_ON(cpus_empty(cpumask)); 388 BUG_ON(cpumask_empty(&cpumask));
399 389
400 BUG_ON(cpu_isset(smp_processor_id(), cpumask)); 390 BUG_ON(cpumask_test_cpu(smp_processor_id(), &cpumask));
401 BUG_ON(!mm); 391 BUG_ON(!mm);
402 392
403 /* If a CPU which we ran on has gone down, OK. */ 393 /* If a CPU which we ran on has gone down, OK. */
404 cpus_and(cpumask, cpumask, cpu_online_map); 394 cpumask_and(&cpumask, &cpumask, cpu_online_mask);
405 if (cpus_empty(cpumask)) 395 if (cpumask_empty(&cpumask))
406 return; 396 return;
407 397
408 /* 398 /*
@@ -416,7 +406,7 @@ static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
416 flush_mm = mm; 406 flush_mm = mm;
417 flush_vma = vma; 407 flush_vma = vma;
418 flush_va = va; 408 flush_va = va;
419 mask=cpus_addr(cpumask); 409 mask=cpumask_bits(&cpumask);
420 atomic_set_mask(*mask, (atomic_t *)&flush_cpumask); 410 atomic_set_mask(*mask, (atomic_t *)&flush_cpumask);
421 411
422 /* 412 /*
@@ -425,7 +415,7 @@ static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
425 */ 415 */
426 send_IPI_mask(&cpumask, INVALIDATE_TLB_IPI, 0); 416 send_IPI_mask(&cpumask, INVALIDATE_TLB_IPI, 0);
427 417
428 while (!cpus_empty(flush_cpumask)) { 418 while (!cpumask_empty((cpumask_t*)&flush_cpumask)) {
429 /* nothing. lockup detection does not belong here */ 419 /* nothing. lockup detection does not belong here */
430 mb(); 420 mb();
431 } 421 }
@@ -460,7 +450,7 @@ void smp_invalidate_interrupt(void)
460 int cpu_id = smp_processor_id(); 450 int cpu_id = smp_processor_id();
461 unsigned long *mmc = &flush_mm->context[cpu_id]; 451 unsigned long *mmc = &flush_mm->context[cpu_id];
462 452
463 if (!cpu_isset(cpu_id, flush_cpumask)) 453 if (!cpumask_test_cpu(cpu_id, &flush_cpumask))
464 return; 454 return;
465 455
466 if (flush_va == FLUSH_ALL) { 456 if (flush_va == FLUSH_ALL) {
@@ -478,7 +468,7 @@ void smp_invalidate_interrupt(void)
478 __flush_tlb_page(va); 468 __flush_tlb_page(va);
479 } 469 }
480 } 470 }
481 cpu_clear(cpu_id, flush_cpumask); 471 cpumask_clear_cpu(cpu_id, (cpumask_t*)&flush_cpumask);
482} 472}
483 473
484/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 474/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
@@ -530,7 +520,7 @@ static void stop_this_cpu(void *dummy)
530 /* 520 /*
531 * Remove this CPU: 521 * Remove this CPU:
532 */ 522 */
533 cpu_clear(cpu_id, cpu_online_map); 523 set_cpu_online(cpu_id, false);
534 524
535 /* 525 /*
536 * PSW IE = 1; 526 * PSW IE = 1;
@@ -725,8 +715,8 @@ static void send_IPI_allbutself(int ipi_num, int try)
725{ 715{
726 cpumask_t cpumask; 716 cpumask_t cpumask;
727 717
728 cpumask = cpu_online_map; 718 cpumask_copy(&cpumask, cpu_online_mask);
729 cpu_clear(smp_processor_id(), cpumask); 719 cpumask_clear_cpu(smp_processor_id(), &cpumask);
730 720
731 send_IPI_mask(&cpumask, ipi_num, try); 721 send_IPI_mask(&cpumask, ipi_num, try);
732} 722}
@@ -763,13 +753,13 @@ static void send_IPI_mask(const struct cpumask *cpumask, int ipi_num, int try)
763 cpumask_and(&tmp, cpumask, cpu_online_mask); 753 cpumask_and(&tmp, cpumask, cpu_online_mask);
764 BUG_ON(!cpumask_equal(cpumask, &tmp)); 754 BUG_ON(!cpumask_equal(cpumask, &tmp));
765 755
766 physid_mask = CPU_MASK_NONE; 756 cpumask_clear(&physid_mask);
767 for_each_cpu(cpu_id, cpumask) { 757 for_each_cpu(cpu_id, cpumask) {
768 if ((phys_id = cpu_to_physid(cpu_id)) != -1) 758 if ((phys_id = cpu_to_physid(cpu_id)) != -1)
769 cpu_set(phys_id, physid_mask); 759 cpumask_set_cpu(phys_id, &physid_mask);
770 } 760 }
771 761
772 send_IPI_mask_phys(physid_mask, ipi_num, try); 762 send_IPI_mask_phys(&physid_mask, ipi_num, try);
773} 763}
774 764
775/*==========================================================================* 765/*==========================================================================*
@@ -792,14 +782,14 @@ static void send_IPI_mask(const struct cpumask *cpumask, int ipi_num, int try)
792 * ---------- --- -------------------------------------------------------- 782 * ---------- --- --------------------------------------------------------
793 * 783 *
794 *==========================================================================*/ 784 *==========================================================================*/
795unsigned long send_IPI_mask_phys(cpumask_t physid_mask, int ipi_num, 785unsigned long send_IPI_mask_phys(const cpumask_t *physid_mask, int ipi_num,
796 int try) 786 int try)
797{ 787{
798 spinlock_t *ipilock; 788 spinlock_t *ipilock;
799 volatile unsigned long *ipicr_addr; 789 volatile unsigned long *ipicr_addr;
800 unsigned long ipicr_val; 790 unsigned long ipicr_val;
801 unsigned long my_physid_mask; 791 unsigned long my_physid_mask;
802 unsigned long mask = cpus_addr(physid_mask)[0]; 792 unsigned long mask = cpumask_bits(physid_mask)[0];
803 793
804 794
805 if (mask & ~physids_coerce(phys_cpu_present_map)) 795 if (mask & ~physids_coerce(phys_cpu_present_map))
diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c
index e034844cfc0d..cfdbe5d15002 100644
--- a/arch/m32r/kernel/smpboot.c
+++ b/arch/m32r/kernel/smpboot.c
@@ -135,9 +135,9 @@ void __devinit smp_prepare_boot_cpu(void)
135{ 135{
136 bsp_phys_id = hard_smp_processor_id(); 136 bsp_phys_id = hard_smp_processor_id();
137 physid_set(bsp_phys_id, phys_cpu_present_map); 137 physid_set(bsp_phys_id, phys_cpu_present_map);
138 cpu_set(0, cpu_online_map); /* BSP's cpu_id == 0 */ 138 set_cpu_online(0, true); /* BSP's cpu_id == 0 */
139 cpu_set(0, cpu_callout_map); 139 cpumask_set_cpu(0, &cpu_callout_map);
140 cpu_set(0, cpu_callin_map); 140 cpumask_set_cpu(0, &cpu_callin_map);
141 141
142 /* 142 /*
143 * Initialize the logical to physical CPU number mapping 143 * Initialize the logical to physical CPU number mapping
@@ -178,7 +178,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
178 for (phys_id = 0 ; phys_id < nr_cpu ; phys_id++) 178 for (phys_id = 0 ; phys_id < nr_cpu ; phys_id++)
179 physid_set(phys_id, phys_cpu_present_map); 179 physid_set(phys_id, phys_cpu_present_map);
180#ifndef CONFIG_HOTPLUG_CPU 180#ifndef CONFIG_HOTPLUG_CPU
181 init_cpu_present(&cpu_possible_map); 181 init_cpu_present(cpu_possible_mask);
182#endif 182#endif
183 183
184 show_mp_info(nr_cpu); 184 show_mp_info(nr_cpu);
@@ -294,10 +294,10 @@ static void __init do_boot_cpu(int phys_id)
294 send_status = 0; 294 send_status = 0;
295 boot_status = 0; 295 boot_status = 0;
296 296
297 cpu_set(phys_id, cpu_bootout_map); 297 cpumask_set_cpu(phys_id, &cpu_bootout_map);
298 298
299 /* Send Startup IPI */ 299 /* Send Startup IPI */
300 send_IPI_mask_phys(cpumask_of_cpu(phys_id), CPU_BOOT_IPI, 0); 300 send_IPI_mask_phys(cpumask_of(phys_id), CPU_BOOT_IPI, 0);
301 301
302 Dprintk("Waiting for send to finish...\n"); 302 Dprintk("Waiting for send to finish...\n");
303 timeout = 0; 303 timeout = 0;
@@ -306,7 +306,7 @@ static void __init do_boot_cpu(int phys_id)
306 do { 306 do {
307 Dprintk("+"); 307 Dprintk("+");
308 udelay(1000); 308 udelay(1000);
309 send_status = !cpu_isset(phys_id, cpu_bootin_map); 309 send_status = !cpumask_test_cpu(phys_id, &cpu_bootin_map);
310 } while (send_status && (timeout++ < 100)); 310 } while (send_status && (timeout++ < 100));
311 311
312 Dprintk("After Startup.\n"); 312 Dprintk("After Startup.\n");
@@ -316,19 +316,19 @@ static void __init do_boot_cpu(int phys_id)
316 * allow APs to start initializing. 316 * allow APs to start initializing.
317 */ 317 */
318 Dprintk("Before Callout %d.\n", cpu_id); 318 Dprintk("Before Callout %d.\n", cpu_id);
319 cpu_set(cpu_id, cpu_callout_map); 319 cpumask_set_cpu(cpu_id, &cpu_callout_map);
320 Dprintk("After Callout %d.\n", cpu_id); 320 Dprintk("After Callout %d.\n", cpu_id);
321 321
322 /* 322 /*
323 * Wait 5s total for a response 323 * Wait 5s total for a response
324 */ 324 */
325 for (timeout = 0; timeout < 5000; timeout++) { 325 for (timeout = 0; timeout < 5000; timeout++) {
326 if (cpu_isset(cpu_id, cpu_callin_map)) 326 if (cpumask_test_cpu(cpu_id, &cpu_callin_map))
327 break; /* It has booted */ 327 break; /* It has booted */
328 udelay(1000); 328 udelay(1000);
329 } 329 }
330 330
331 if (cpu_isset(cpu_id, cpu_callin_map)) { 331 if (cpumask_test_cpu(cpu_id, &cpu_callin_map)) {
332 /* number CPUs logically, starting from 1 (BSP is 0) */ 332 /* number CPUs logically, starting from 1 (BSP is 0) */
333 Dprintk("OK.\n"); 333 Dprintk("OK.\n");
334 } else { 334 } else {
@@ -340,9 +340,9 @@ static void __init do_boot_cpu(int phys_id)
340 340
341 if (send_status || boot_status) { 341 if (send_status || boot_status) {
342 unmap_cpu_to_physid(cpu_id, phys_id); 342 unmap_cpu_to_physid(cpu_id, phys_id);
343 cpu_clear(cpu_id, cpu_callout_map); 343 cpumask_clear_cpu(cpu_id, &cpu_callout_map);
344 cpu_clear(cpu_id, cpu_callin_map); 344 cpumask_clear_cpu(cpu_id, &cpu_callin_map);
345 cpu_clear(cpu_id, cpu_initialized); 345 cpumask_clear_cpu(cpu_id, &cpu_initialized);
346 cpucount--; 346 cpucount--;
347 } 347 }
348} 348}
@@ -351,17 +351,17 @@ int __cpuinit __cpu_up(unsigned int cpu_id)
351{ 351{
352 int timeout; 352 int timeout;
353 353
354 cpu_set(cpu_id, smp_commenced_mask); 354 cpumask_set_cpu(cpu_id, &smp_commenced_mask);
355 355
356 /* 356 /*
357 * Wait 5s total for a response 357 * Wait 5s total for a response
358 */ 358 */
359 for (timeout = 0; timeout < 5000; timeout++) { 359 for (timeout = 0; timeout < 5000; timeout++) {
360 if (cpu_isset(cpu_id, cpu_online_map)) 360 if (cpu_online(cpu_id))
361 break; 361 break;
362 udelay(1000); 362 udelay(1000);
363 } 363 }
364 if (!cpu_isset(cpu_id, cpu_online_map)) 364 if (!cpu_online(cpu_id))
365 BUG(); 365 BUG();
366 366
367 return 0; 367 return 0;
@@ -373,11 +373,11 @@ void __init smp_cpus_done(unsigned int max_cpus)
373 unsigned long bogosum = 0; 373 unsigned long bogosum = 0;
374 374
375 for (timeout = 0; timeout < 5000; timeout++) { 375 for (timeout = 0; timeout < 5000; timeout++) {
376 if (cpus_equal(cpu_callin_map, cpu_online_map)) 376 if (cpumask_equal(&cpu_callin_map, cpu_online_mask))
377 break; 377 break;
378 udelay(1000); 378 udelay(1000);
379 } 379 }
380 if (!cpus_equal(cpu_callin_map, cpu_online_map)) 380 if (!cpumask_equal(&cpu_callin_map, cpu_online_mask))
381 BUG(); 381 BUG();
382 382
383 for (cpu_id = 0 ; cpu_id < num_online_cpus() ; cpu_id++) 383 for (cpu_id = 0 ; cpu_id < num_online_cpus() ; cpu_id++)
@@ -388,7 +388,7 @@ void __init smp_cpus_done(unsigned int max_cpus)
388 */ 388 */
389 Dprintk("Before bogomips.\n"); 389 Dprintk("Before bogomips.\n");
390 if (cpucount) { 390 if (cpucount) {
391 for_each_cpu_mask(cpu_id, cpu_online_map) 391 for_each_cpu(cpu_id,cpu_online_mask)
392 bogosum += cpu_data[cpu_id].loops_per_jiffy; 392 bogosum += cpu_data[cpu_id].loops_per_jiffy;
393 393
394 printk(KERN_INFO "Total of %d processors activated " \ 394 printk(KERN_INFO "Total of %d processors activated " \
@@ -425,7 +425,7 @@ int __init start_secondary(void *unused)
425 cpu_init(); 425 cpu_init();
426 preempt_disable(); 426 preempt_disable();
427 smp_callin(); 427 smp_callin();
428 while (!cpu_isset(smp_processor_id(), smp_commenced_mask)) 428 while (!cpumask_test_cpu(smp_processor_id(), &smp_commenced_mask))
429 cpu_relax(); 429 cpu_relax();
430 430
431 smp_online(); 431 smp_online();
@@ -463,7 +463,7 @@ static void __init smp_callin(void)
463 int cpu_id = smp_processor_id(); 463 int cpu_id = smp_processor_id();
464 unsigned long timeout; 464 unsigned long timeout;
465 465
466 if (cpu_isset(cpu_id, cpu_callin_map)) { 466 if (cpumask_test_cpu(cpu_id, &cpu_callin_map)) {
467 printk("huh, phys CPU#%d, CPU#%d already present??\n", 467 printk("huh, phys CPU#%d, CPU#%d already present??\n",
468 phys_id, cpu_id); 468 phys_id, cpu_id);
469 BUG(); 469 BUG();
@@ -474,7 +474,7 @@ static void __init smp_callin(void)
474 timeout = jiffies + (2 * HZ); 474 timeout = jiffies + (2 * HZ);
475 while (time_before(jiffies, timeout)) { 475 while (time_before(jiffies, timeout)) {
476 /* Has the boot CPU finished it's STARTUP sequence ? */ 476 /* Has the boot CPU finished it's STARTUP sequence ? */
477 if (cpu_isset(cpu_id, cpu_callout_map)) 477 if (cpumask_test_cpu(cpu_id, &cpu_callout_map))
478 break; 478 break;
479 cpu_relax(); 479 cpu_relax();
480 } 480 }
@@ -486,7 +486,7 @@ static void __init smp_callin(void)
486 } 486 }
487 487
488 /* Allow the master to continue. */ 488 /* Allow the master to continue. */
489 cpu_set(cpu_id, cpu_callin_map); 489 cpumask_set_cpu(cpu_id, &cpu_callin_map);
490} 490}
491 491
492static void __init smp_online(void) 492static void __init smp_online(void)
@@ -503,7 +503,7 @@ static void __init smp_online(void)
503 /* Save our processor parameters */ 503 /* Save our processor parameters */
504 smp_store_cpu_info(cpu_id); 504 smp_store_cpu_info(cpu_id);
505 505
506 cpu_set(cpu_id, cpu_online_map); 506 set_cpu_online(cpu_id, true);
507} 507}
508 508
509/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 509/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
diff --git a/arch/m68k/Kconfig.nommu b/arch/m68k/Kconfig.nommu
index 273bccab9517..fc98f9b9d4d2 100644
--- a/arch/m68k/Kconfig.nommu
+++ b/arch/m68k/Kconfig.nommu
@@ -2,10 +2,6 @@ config FPU
2 bool 2 bool
3 default n 3 default n
4 4
5config GENERIC_FIND_NEXT_BIT
6 bool
7 default y
8
9config GENERIC_GPIO 5config GENERIC_GPIO
10 bool 6 bool
11 default n 7 default n
diff --git a/arch/m68k/include/asm/bitops_mm.h b/arch/m68k/include/asm/bitops_mm.h
index e9020f88a748..89cf5b814a4d 100644
--- a/arch/m68k/include/asm/bitops_mm.h
+++ b/arch/m68k/include/asm/bitops_mm.h
@@ -200,6 +200,7 @@ out:
200 res += ((long)p - (long)vaddr - 4) * 8; 200 res += ((long)p - (long)vaddr - 4) * 8;
201 return res < size ? res : size; 201 return res < size ? res : size;
202} 202}
203#define find_first_zero_bit find_first_zero_bit
203 204
204static inline int find_next_zero_bit(const unsigned long *vaddr, int size, 205static inline int find_next_zero_bit(const unsigned long *vaddr, int size,
205 int offset) 206 int offset)
@@ -229,6 +230,7 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size,
229 /* No zero yet, search remaining full bytes for a zero */ 230 /* No zero yet, search remaining full bytes for a zero */
230 return offset + find_first_zero_bit(p, size - offset); 231 return offset + find_first_zero_bit(p, size - offset);
231} 232}
233#define find_next_zero_bit find_next_zero_bit
232 234
233static inline int find_first_bit(const unsigned long *vaddr, unsigned size) 235static inline int find_first_bit(const unsigned long *vaddr, unsigned size)
234{ 236{
@@ -253,6 +255,7 @@ out:
253 res += ((long)p - (long)vaddr - 4) * 8; 255 res += ((long)p - (long)vaddr - 4) * 8;
254 return res < size ? res : size; 256 return res < size ? res : size;
255} 257}
258#define find_first_bit find_first_bit
256 259
257static inline int find_next_bit(const unsigned long *vaddr, int size, 260static inline int find_next_bit(const unsigned long *vaddr, int size,
258 int offset) 261 int offset)
@@ -282,6 +285,7 @@ static inline int find_next_bit(const unsigned long *vaddr, int size,
282 /* No one yet, search remaining full bytes for a one */ 285 /* No one yet, search remaining full bytes for a one */
283 return offset + find_first_bit(p, size - offset); 286 return offset + find_first_bit(p, size - offset);
284} 287}
288#define find_next_bit find_next_bit
285 289
286/* 290/*
287 * ffz = Find First Zero in word. Undefined if no zero exists, 291 * ffz = Find First Zero in word. Undefined if no zero exists,
@@ -398,6 +402,7 @@ out:
398 res += (p - addr) * 32; 402 res += (p - addr) * 32;
399 return res < size ? res : size; 403 return res < size ? res : size;
400} 404}
405#define find_first_zero_bit_le find_first_zero_bit_le
401 406
402static inline unsigned long find_next_zero_bit_le(const void *addr, 407static inline unsigned long find_next_zero_bit_le(const void *addr,
403 unsigned long size, unsigned long offset) 408 unsigned long size, unsigned long offset)
@@ -427,6 +432,7 @@ static inline unsigned long find_next_zero_bit_le(const void *addr,
427 /* No zero yet, search remaining full bytes for a zero */ 432 /* No zero yet, search remaining full bytes for a zero */
428 return offset + find_first_zero_bit_le(p, size - offset); 433 return offset + find_first_zero_bit_le(p, size - offset);
429} 434}
435#define find_next_zero_bit_le find_next_zero_bit_le
430 436
431static inline int find_first_bit_le(const void *vaddr, unsigned size) 437static inline int find_first_bit_le(const void *vaddr, unsigned size)
432{ 438{
@@ -451,6 +457,7 @@ out:
451 res += (p - addr) * 32; 457 res += (p - addr) * 32;
452 return res < size ? res : size; 458 return res < size ? res : size;
453} 459}
460#define find_first_bit_le find_first_bit_le
454 461
455static inline unsigned long find_next_bit_le(const void *addr, 462static inline unsigned long find_next_bit_le(const void *addr,
456 unsigned long size, unsigned long offset) 463 unsigned long size, unsigned long offset)
@@ -480,6 +487,7 @@ static inline unsigned long find_next_bit_le(const void *addr,
480 /* No set bit yet, search remaining full bytes for a set bit */ 487 /* No set bit yet, search remaining full bytes for a set bit */
481 return offset + find_first_bit_le(p, size - offset); 488 return offset + find_first_bit_le(p, size - offset);
482} 489}
490#define find_next_bit_le find_next_bit_le
483 491
484/* Bitmap functions for the ext2 filesystem. */ 492/* Bitmap functions for the ext2 filesystem. */
485 493
diff --git a/arch/m68k/include/asm/bitops_no.h b/arch/m68k/include/asm/bitops_no.h
index 6b0e2d349f0e..72e85acdd7bd 100644
--- a/arch/m68k/include/asm/bitops_no.h
+++ b/arch/m68k/include/asm/bitops_no.h
@@ -319,6 +319,10 @@ found_first:
319found_middle: 319found_middle:
320 return result + ffz(__swab32(tmp)); 320 return result + ffz(__swab32(tmp));
321} 321}
322#define find_next_zero_bit_le find_next_zero_bit_le
323
324extern unsigned long find_next_bit_le(const void *addr,
325 unsigned long size, unsigned long offset);
322 326
323#endif /* __KERNEL__ */ 327#endif /* __KERNEL__ */
324 328
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index eccdefe70d4e..e446bab2427b 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -33,12 +33,6 @@ config ARCH_HAS_ILOG2_U32
33config ARCH_HAS_ILOG2_U64 33config ARCH_HAS_ILOG2_U64
34 def_bool n 34 def_bool n
35 35
36config GENERIC_FIND_NEXT_BIT
37 def_bool y
38
39config GENERIC_FIND_BIT_LE
40 def_bool y
41
42config GENERIC_HWEIGHT 36config GENERIC_HWEIGHT
43 def_bool y 37 def_bool y
44 38
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index cef1a854487d..653da62d0682 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -821,14 +821,6 @@ config ARCH_SUPPORTS_OPROFILE
821 bool 821 bool
822 default y if !MIPS_MT_SMTC 822 default y if !MIPS_MT_SMTC
823 823
824config GENERIC_FIND_NEXT_BIT
825 bool
826 default y
827
828config GENERIC_FIND_BIT_LE
829 bool
830 default y
831
832config GENERIC_HWEIGHT 824config GENERIC_HWEIGHT
833 bool 825 bool
834 default y 826 default y
diff --git a/arch/mips/configs/bcm47xx_defconfig b/arch/mips/configs/bcm47xx_defconfig
index 22fdf2f0cc23..ad15fb10322b 100644
--- a/arch/mips/configs/bcm47xx_defconfig
+++ b/arch/mips/configs/bcm47xx_defconfig
@@ -16,7 +16,6 @@ CONFIG_TASK_IO_ACCOUNTING=y
16CONFIG_AUDIT=y 16CONFIG_AUDIT=y
17CONFIG_TINY_RCU=y 17CONFIG_TINY_RCU=y
18CONFIG_CGROUPS=y 18CONFIG_CGROUPS=y
19CONFIG_CGROUP_NS=y
20CONFIG_CGROUP_CPUACCT=y 19CONFIG_CGROUP_CPUACCT=y
21CONFIG_RELAY=y 20CONFIG_RELAY=y
22CONFIG_BLK_DEV_INITRD=y 21CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index feaf09cc8632..1f870340ebdd 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -44,9 +44,6 @@ config GENERIC_CALIBRATE_DELAY
44config GENERIC_CMOS_UPDATE 44config GENERIC_CMOS_UPDATE
45 def_bool n 45 def_bool n
46 46
47config GENERIC_FIND_NEXT_BIT
48 def_bool y
49
50config GENERIC_HWEIGHT 47config GENERIC_HWEIGHT
51 def_bool y 48 def_bool y
52 49
diff --git a/arch/mn10300/configs/asb2364_defconfig b/arch/mn10300/configs/asb2364_defconfig
index 31d76261a3d5..fbb96ae3122a 100644
--- a/arch/mn10300/configs/asb2364_defconfig
+++ b/arch/mn10300/configs/asb2364_defconfig
@@ -8,7 +8,6 @@ CONFIG_TASK_XACCT=y
8CONFIG_TASK_IO_ACCOUNTING=y 8CONFIG_TASK_IO_ACCOUNTING=y
9CONFIG_LOG_BUF_SHIFT=14 9CONFIG_LOG_BUF_SHIFT=14
10CONFIG_CGROUPS=y 10CONFIG_CGROUPS=y
11CONFIG_CGROUP_NS=y
12CONFIG_CGROUP_FREEZER=y 11CONFIG_CGROUP_FREEZER=y
13CONFIG_CGROUP_DEVICE=y 12CONFIG_CGROUP_DEVICE=y
14CONFIG_CGROUP_CPUACCT=y 13CONFIG_CGROUP_CPUACCT=y
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 69ff049c8571..65adc86a230e 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -47,14 +47,6 @@ config ARCH_HAS_ILOG2_U64
47 bool 47 bool
48 default n 48 default n
49 49
50config GENERIC_FIND_NEXT_BIT
51 bool
52 default y
53
54config GENERIC_FIND_BIT_LE
55 bool
56 default y
57
58config GENERIC_BUG 50config GENERIC_BUG
59 bool 51 bool
60 default y 52 default y
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 423145a6f7ba..2729c6663d8a 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -91,14 +91,6 @@ config GENERIC_HWEIGHT
91 bool 91 bool
92 default y 92 default y
93 93
94config GENERIC_FIND_NEXT_BIT
95 bool
96 default y
97
98config GENERIC_FIND_BIT_LE
99 bool
100 default y
101
102config GENERIC_GPIO 94config GENERIC_GPIO
103 bool 95 bool
104 help 96 help
@@ -141,6 +133,7 @@ config PPC
141 select GENERIC_IRQ_SHOW 133 select GENERIC_IRQ_SHOW
142 select GENERIC_IRQ_SHOW_LEVEL 134 select GENERIC_IRQ_SHOW_LEVEL
143 select HAVE_RCU_TABLE_FREE if SMP 135 select HAVE_RCU_TABLE_FREE if SMP
136 select HAVE_SYSCALL_TRACEPOINTS
144 137
145config EARLY_PRINTK 138config EARLY_PRINTK
146 bool 139 bool
diff --git a/arch/powerpc/boot/dts/canyonlands.dts b/arch/powerpc/boot/dts/canyonlands.dts
index 2779f08313a5..22dd6ae84da0 100644
--- a/arch/powerpc/boot/dts/canyonlands.dts
+++ b/arch/powerpc/boot/dts/canyonlands.dts
@@ -530,5 +530,23 @@
530 0x0 0x0 0x0 0x3 &UIC3 0x12 0x4 /* swizzled int C */ 530 0x0 0x0 0x0 0x3 &UIC3 0x12 0x4 /* swizzled int C */
531 0x0 0x0 0x0 0x4 &UIC3 0x13 0x4 /* swizzled int D */>; 531 0x0 0x0 0x0 0x4 &UIC3 0x13 0x4 /* swizzled int D */>;
532 }; 532 };
533
534 MSI: ppc4xx-msi@C10000000 {
535 compatible = "amcc,ppc4xx-msi", "ppc4xx-msi";
536 reg = < 0xC 0x10000000 0x100>;
537 sdr-base = <0x36C>;
538 msi-data = <0x00000000>;
539 msi-mask = <0x44440000>;
540 interrupt-count = <3>;
541 interrupts = <0 1 2 3>;
542 interrupt-parent = <&UIC3>;
543 #interrupt-cells = <1>;
544 #address-cells = <0>;
545 #size-cells = <0>;
546 interrupt-map = <0 &UIC3 0x18 1
547 1 &UIC3 0x19 1
548 2 &UIC3 0x1A 1
549 3 &UIC3 0x1B 1>;
550 };
533 }; 551 };
534}; 552};
diff --git a/arch/powerpc/boot/dts/katmai.dts b/arch/powerpc/boot/dts/katmai.dts
index 7c3be5e45748..f913dbe25d35 100644
--- a/arch/powerpc/boot/dts/katmai.dts
+++ b/arch/powerpc/boot/dts/katmai.dts
@@ -442,6 +442,24 @@
442 0x0 0x0 0x0 0x4 &UIC3 0xb 0x4 /* swizzled int D */>; 442 0x0 0x0 0x0 0x4 &UIC3 0xb 0x4 /* swizzled int D */>;
443 }; 443 };
444 444
445 MSI: ppc4xx-msi@400300000 {
446 compatible = "amcc,ppc4xx-msi", "ppc4xx-msi";
447 reg = < 0x4 0x00300000 0x100>;
448 sdr-base = <0x3B0>;
449 msi-data = <0x00000000>;
450 msi-mask = <0x44440000>;
451 interrupt-count = <3>;
452 interrupts =<0 1 2 3>;
453 interrupt-parent = <&UIC0>;
454 #interrupt-cells = <1>;
455 #address-cells = <0>;
456 #size-cells = <0>;
457 interrupt-map = <0 &UIC0 0xC 1
458 1 &UIC0 0x0D 1
459 2 &UIC0 0x0E 1
460 3 &UIC0 0x0F 1>;
461 };
462
445 I2O: i2o@400100000 { 463 I2O: i2o@400100000 {
446 compatible = "ibm,i2o-440spe"; 464 compatible = "ibm,i2o-440spe";
447 reg = <0x00000004 0x00100000 0x100>; 465 reg = <0x00000004 0x00100000 0x100>;
diff --git a/arch/powerpc/boot/dts/kilauea.dts b/arch/powerpc/boot/dts/kilauea.dts
index 89edb16649c3..1613d6e4049e 100644
--- a/arch/powerpc/boot/dts/kilauea.dts
+++ b/arch/powerpc/boot/dts/kilauea.dts
@@ -403,5 +403,33 @@
403 0x0 0x0 0x0 0x3 &UIC2 0xd 0x4 /* swizzled int C */ 403 0x0 0x0 0x0 0x3 &UIC2 0xd 0x4 /* swizzled int C */
404 0x0 0x0 0x0 0x4 &UIC2 0xe 0x4 /* swizzled int D */>; 404 0x0 0x0 0x0 0x4 &UIC2 0xe 0x4 /* swizzled int D */>;
405 }; 405 };
406
407 MSI: ppc4xx-msi@C10000000 {
408 compatible = "amcc,ppc4xx-msi", "ppc4xx-msi";
409 reg = < 0x0 0xEF620000 0x100>;
410 sdr-base = <0x4B0>;
411 msi-data = <0x00000000>;
412 msi-mask = <0x44440000>;
413 interrupt-count = <12>;
414 interrupts = <0 1 2 3 4 5 6 7 8 9 0xA 0xB 0xC 0xD>;
415 interrupt-parent = <&UIC2>;
416 #interrupt-cells = <1>;
417 #address-cells = <0>;
418 #size-cells = <0>;
419 interrupt-map = <0 &UIC2 0x10 1
420 1 &UIC2 0x11 1
421 2 &UIC2 0x12 1
422 2 &UIC2 0x13 1
423 2 &UIC2 0x14 1
424 2 &UIC2 0x15 1
425 2 &UIC2 0x16 1
426 2 &UIC2 0x17 1
427 2 &UIC2 0x18 1
428 2 &UIC2 0x19 1
429 2 &UIC2 0x1A 1
430 2 &UIC2 0x1B 1
431 2 &UIC2 0x1C 1
432 3 &UIC2 0x1D 1>;
433 };
406 }; 434 };
407}; 435};
diff --git a/arch/powerpc/boot/dts/redwood.dts b/arch/powerpc/boot/dts/redwood.dts
index 81636c01d906..d86a3a498118 100644
--- a/arch/powerpc/boot/dts/redwood.dts
+++ b/arch/powerpc/boot/dts/redwood.dts
@@ -358,8 +358,28 @@
358 0x0 0x0 0x0 0x4 &UIC3 0xb 0x4 /* swizzled int D */>; 358 0x0 0x0 0x0 0x4 &UIC3 0xb 0x4 /* swizzled int D */>;
359 }; 359 };
360 360
361 MSI: ppc4xx-msi@400300000 {
362 compatible = "amcc,ppc4xx-msi", "ppc4xx-msi";
363 reg = < 0x4 0x00300000 0x100
364 0x4 0x00300000 0x100>;
365 sdr-base = <0x3B0>;
366 msi-data = <0x00000000>;
367 msi-mask = <0x44440000>;
368 interrupt-count = <3>;
369 interrupts =<0 1 2 3>;
370 interrupt-parent = <&UIC0>;
371 #interrupt-cells = <1>;
372 #address-cells = <0>;
373 #size-cells = <0>;
374 interrupt-map = <0 &UIC0 0xC 1
375 1 &UIC0 0x0D 1
376 2 &UIC0 0x0E 1
377 3 &UIC0 0x0F 1>;
378 };
379
361 }; 380 };
362 381
382
363 chosen { 383 chosen {
364 linux,stdout-path = "/plb/opb/serial@ef600200"; 384 linux,stdout-path = "/plb/opb/serial@ef600200";
365 }; 385 };
diff --git a/arch/powerpc/configs/ppc6xx_defconfig b/arch/powerpc/configs/ppc6xx_defconfig
index 214208924a9c..04360f9b0109 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -10,7 +10,6 @@ CONFIG_TASK_XACCT=y
10CONFIG_TASK_IO_ACCOUNTING=y 10CONFIG_TASK_IO_ACCOUNTING=y
11CONFIG_AUDIT=y 11CONFIG_AUDIT=y
12CONFIG_CGROUPS=y 12CONFIG_CGROUPS=y
13CONFIG_CGROUP_NS=y
14CONFIG_CGROUP_DEVICE=y 13CONFIG_CGROUP_DEVICE=y
15CONFIG_CGROUP_CPUACCT=y 14CONFIG_CGROUP_CPUACCT=y
16CONFIG_RESOURCE_COUNTERS=y 15CONFIG_RESOURCE_COUNTERS=y
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index 7de13865508c..c9f212b5f3de 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -15,7 +15,6 @@ CONFIG_AUDITSYSCALL=y
15CONFIG_IKCONFIG=y 15CONFIG_IKCONFIG=y
16CONFIG_IKCONFIG_PROC=y 16CONFIG_IKCONFIG_PROC=y
17CONFIG_CGROUPS=y 17CONFIG_CGROUPS=y
18CONFIG_CGROUP_NS=y
19CONFIG_CGROUP_FREEZER=y 18CONFIG_CGROUP_FREEZER=y
20CONFIG_CGROUP_DEVICE=y 19CONFIG_CGROUP_DEVICE=y
21CONFIG_CPUSETS=y 20CONFIG_CPUSETS=y
diff --git a/arch/powerpc/include/asm/fsl_lbc.h b/arch/powerpc/include/asm/fsl_lbc.h
index 5c1bf3466749..8a0b5ece8f76 100644
--- a/arch/powerpc/include/asm/fsl_lbc.h
+++ b/arch/powerpc/include/asm/fsl_lbc.h
@@ -157,6 +157,8 @@ struct fsl_lbc_regs {
157#define LBCR_EPAR_SHIFT 16 157#define LBCR_EPAR_SHIFT 16
158#define LBCR_BMT 0x0000FF00 158#define LBCR_BMT 0x0000FF00
159#define LBCR_BMT_SHIFT 8 159#define LBCR_BMT_SHIFT 8
160#define LBCR_BMTPS 0x0000000F
161#define LBCR_BMTPS_SHIFT 0
160#define LBCR_INIT 0x00040000 162#define LBCR_INIT 0x00040000
161 __be32 lcrr; /**< Clock Ratio Register */ 163 __be32 lcrr; /**< Clock Ratio Register */
162#define LCRR_DBYP 0x80000000 164#define LCRR_DBYP 0x80000000
diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h
index dde1296b8b41..169d039ed402 100644
--- a/arch/powerpc/include/asm/ftrace.h
+++ b/arch/powerpc/include/asm/ftrace.h
@@ -60,4 +60,18 @@ struct dyn_arch_ftrace {
60 60
61#endif 61#endif
62 62
63#if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_PPC64) && !defined(__ASSEMBLY__)
64#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
65static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
66{
67 /*
68 * Compare the symbol name with the system call name. Skip the .sys or .SyS
69 * prefix from the symbol name and the sys prefix from the system call name and
70 * just match the rest. This is only needed on ppc64 since symbol names on
71 * 32bit do not start with a period so the generic function will work.
72 */
73 return !strcmp(sym + 4, name + 3);
74}
75#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_PPC64 && !__ASSEMBLY__ */
76
63#endif /* _ASM_POWERPC_FTRACE */ 77#endif /* _ASM_POWERPC_FTRACE */
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index 852b8c1c09db..fd8201dddd4b 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -236,7 +236,7 @@
236#define H_HOME_NODE_ASSOCIATIVITY 0x2EC 236#define H_HOME_NODE_ASSOCIATIVITY 0x2EC
237#define H_BEST_ENERGY 0x2F4 237#define H_BEST_ENERGY 0x2F4
238#define H_GET_MPP_X 0x314 238#define H_GET_MPP_X 0x314
239#define MAX_HCALL_OPCODE H_BEST_ENERGY 239#define MAX_HCALL_OPCODE H_GET_MPP_X
240 240
241#ifndef __ASSEMBLY__ 241#ifndef __ASSEMBLY__
242 242
diff --git a/arch/powerpc/include/asm/rio.h b/arch/powerpc/include/asm/rio.h
index 0018bf80cb25..d902abd33995 100644
--- a/arch/powerpc/include/asm/rio.h
+++ b/arch/powerpc/include/asm/rio.h
@@ -14,5 +14,10 @@
14#define ASM_PPC_RIO_H 14#define ASM_PPC_RIO_H
15 15
16extern void platform_rio_init(void); 16extern void platform_rio_init(void);
17#ifdef CONFIG_RAPIDIO
18extern int fsl_rio_mcheck_exception(struct pt_regs *);
19#else
20static inline int fsl_rio_mcheck_exception(struct pt_regs *regs) {return 0; }
21#endif
17 22
18#endif /* ASM_PPC_RIO_H */ 23#endif /* ASM_PPC_RIO_H */
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index 880b8c1e6e53..11eb404b5606 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -191,8 +191,6 @@ extern unsigned long __secondary_hold_spinloop;
191extern unsigned long __secondary_hold_acknowledge; 191extern unsigned long __secondary_hold_acknowledge;
192extern char __secondary_hold; 192extern char __secondary_hold;
193 193
194extern irqreturn_t debug_ipi_action(int irq, void *data);
195
196#endif /* __ASSEMBLY__ */ 194#endif /* __ASSEMBLY__ */
197 195
198#endif /* __KERNEL__ */ 196#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h
index 23913e902fc3..b54b2add07be 100644
--- a/arch/powerpc/include/asm/syscall.h
+++ b/arch/powerpc/include/asm/syscall.h
@@ -15,6 +15,11 @@
15 15
16#include <linux/sched.h> 16#include <linux/sched.h>
17 17
18/* ftrace syscalls requires exporting the sys_call_table */
19#ifdef CONFIG_FTRACE_SYSCALLS
20extern const unsigned long *sys_call_table;
21#endif /* CONFIG_FTRACE_SYSCALLS */
22
18static inline long syscall_get_nr(struct task_struct *task, 23static inline long syscall_get_nr(struct task_struct *task,
19 struct pt_regs *regs) 24 struct pt_regs *regs)
20{ 25{
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index 37c353e8af7c..836f231ec1f0 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -110,7 +110,8 @@ static inline struct thread_info *current_thread_info(void)
110#define TIF_NOERROR 12 /* Force successful syscall return */ 110#define TIF_NOERROR 12 /* Force successful syscall return */
111#define TIF_NOTIFY_RESUME 13 /* callback before returning to user */ 111#define TIF_NOTIFY_RESUME 13 /* callback before returning to user */
112#define TIF_FREEZE 14 /* Freezing for suspend */ 112#define TIF_FREEZE 14 /* Freezing for suspend */
113#define TIF_RUNLATCH 15 /* Is the runlatch enabled? */ 113#define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */
114#define TIF_RUNLATCH 16 /* Is the runlatch enabled? */
114 115
115/* as above, but as bit values */ 116/* as above, but as bit values */
116#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 117#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -127,8 +128,10 @@ static inline struct thread_info *current_thread_info(void)
127#define _TIF_NOERROR (1<<TIF_NOERROR) 128#define _TIF_NOERROR (1<<TIF_NOERROR)
128#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 129#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
129#define _TIF_FREEZE (1<<TIF_FREEZE) 130#define _TIF_FREEZE (1<<TIF_FREEZE)
131#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
130#define _TIF_RUNLATCH (1<<TIF_RUNLATCH) 132#define _TIF_RUNLATCH (1<<TIF_RUNLATCH)
131#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP) 133#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
134 _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT)
132 135
133#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ 136#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
134 _TIF_NOTIFY_RESUME) 137 _TIF_NOTIFY_RESUME)
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 9aab36312572..e8b981897d44 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -109,6 +109,7 @@ obj-$(CONFIG_PPC_IO_WORKAROUNDS) += io-workarounds.o
109 109
110obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 110obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
111obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o 111obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
112obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o
112obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o 113obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o
113 114
114obj-$(CONFIG_PPC_PERF_CTRS) += perf_event.o 115obj-$(CONFIG_PPC_PERF_CTRS) += perf_event.o
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index ce1f3e44c24f..bf99cfa6bbfe 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -22,6 +22,7 @@
22#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
23#include <asm/code-patching.h> 23#include <asm/code-patching.h>
24#include <asm/ftrace.h> 24#include <asm/ftrace.h>
25#include <asm/syscall.h>
25 26
26 27
27#ifdef CONFIG_DYNAMIC_FTRACE 28#ifdef CONFIG_DYNAMIC_FTRACE
@@ -600,3 +601,10 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
600 } 601 }
601} 602}
602#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 603#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
604
605#if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_PPC64)
606unsigned long __init arch_syscall_addr(int nr)
607{
608 return sys_call_table[nr*2];
609}
610#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_PPC64 */
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index a24d37d4cf51..5b428e308666 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -295,17 +295,20 @@ static inline void handle_one_irq(unsigned int irq)
295 unsigned long saved_sp_limit; 295 unsigned long saved_sp_limit;
296 struct irq_desc *desc; 296 struct irq_desc *desc;
297 297
298 desc = irq_to_desc(irq);
299 if (!desc)
300 return;
301
298 /* Switch to the irq stack to handle this */ 302 /* Switch to the irq stack to handle this */
299 curtp = current_thread_info(); 303 curtp = current_thread_info();
300 irqtp = hardirq_ctx[smp_processor_id()]; 304 irqtp = hardirq_ctx[smp_processor_id()];
301 305
302 if (curtp == irqtp) { 306 if (curtp == irqtp) {
303 /* We're already on the irq stack, just handle it */ 307 /* We're already on the irq stack, just handle it */
304 generic_handle_irq(irq); 308 desc->handle_irq(irq, desc);
305 return; 309 return;
306 } 310 }
307 311
308 desc = irq_to_desc(irq);
309 saved_sp_limit = current->thread.ksp_limit; 312 saved_sp_limit = current->thread.ksp_limit;
310 313
311 irqtp->task = curtp->task; 314 irqtp->task = curtp->task;
@@ -557,15 +560,8 @@ struct irq_host *irq_alloc_host(struct device_node *of_node,
557 if (revmap_type == IRQ_HOST_MAP_LEGACY) { 560 if (revmap_type == IRQ_HOST_MAP_LEGACY) {
558 if (irq_map[0].host != NULL) { 561 if (irq_map[0].host != NULL) {
559 raw_spin_unlock_irqrestore(&irq_big_lock, flags); 562 raw_spin_unlock_irqrestore(&irq_big_lock, flags);
560 /* If we are early boot, we can't free the structure, 563 of_node_put(host->of_node);
561 * too bad... 564 kfree(host);
562 * this will be fixed once slab is made available early
563 * instead of the current cruft
564 */
565 if (mem_init_done) {
566 of_node_put(host->of_node);
567 kfree(host);
568 }
569 return NULL; 565 return NULL;
570 } 566 }
571 irq_map[0].host = host; 567 irq_map[0].host = host;
@@ -727,9 +723,7 @@ unsigned int irq_create_mapping(struct irq_host *host,
727 } 723 }
728 pr_debug("irq: -> using host @%p\n", host); 724 pr_debug("irq: -> using host @%p\n", host);
729 725
730 /* Check if mapping already exist, if it does, call 726 /* Check if mapping already exists */
731 * host->ops->map() to update the flags
732 */
733 virq = irq_find_mapping(host, hwirq); 727 virq = irq_find_mapping(host, hwirq);
734 if (virq != NO_IRQ) { 728 if (virq != NO_IRQ) {
735 pr_debug("irq: -> existing mapping on virq %d\n", virq); 729 pr_debug("irq: -> existing mapping on virq %d\n", virq);
@@ -899,10 +893,13 @@ unsigned int irq_radix_revmap_lookup(struct irq_host *host,
899 return irq_find_mapping(host, hwirq); 893 return irq_find_mapping(host, hwirq);
900 894
901 /* 895 /*
902 * No rcu_read_lock(ing) needed, the ptr returned can't go under us 896 * The ptr returned references the static global irq_map.
903 * as it's referencing an entry in the static irq_map table. 897 * but freeing an irq can delete nodes along the path to
898 * do the lookup via call_rcu.
904 */ 899 */
900 rcu_read_lock();
905 ptr = radix_tree_lookup(&host->revmap_data.tree, hwirq); 901 ptr = radix_tree_lookup(&host->revmap_data.tree, hwirq);
902 rcu_read_unlock();
906 903
907 /* 904 /*
908 * If found in radix tree, then fine. 905 * If found in radix tree, then fine.
@@ -1010,14 +1007,23 @@ void irq_free_virt(unsigned int virq, unsigned int count)
1010 WARN_ON (virq < NUM_ISA_INTERRUPTS); 1007 WARN_ON (virq < NUM_ISA_INTERRUPTS);
1011 WARN_ON (count == 0 || (virq + count) > irq_virq_count); 1008 WARN_ON (count == 0 || (virq + count) > irq_virq_count);
1012 1009
1010 if (virq < NUM_ISA_INTERRUPTS) {
1011 if (virq + count < NUM_ISA_INTERRUPTS)
1012 return;
1013 count =- NUM_ISA_INTERRUPTS - virq;
1014 virq = NUM_ISA_INTERRUPTS;
1015 }
1016
1017 if (count > irq_virq_count || virq > irq_virq_count - count) {
1018 if (virq > irq_virq_count)
1019 return;
1020 count = irq_virq_count - virq;
1021 }
1022
1013 raw_spin_lock_irqsave(&irq_big_lock, flags); 1023 raw_spin_lock_irqsave(&irq_big_lock, flags);
1014 for (i = virq; i < (virq + count); i++) { 1024 for (i = virq; i < (virq + count); i++) {
1015 struct irq_host *host; 1025 struct irq_host *host;
1016 1026
1017 if (i < NUM_ISA_INTERRUPTS ||
1018 (virq + count) > irq_virq_count)
1019 continue;
1020
1021 host = irq_map[i].host; 1027 host = irq_map[i].host;
1022 irq_map[i].hwirq = host->inval_irq; 1028 irq_map[i].hwirq = host->inval_irq;
1023 smp_wmb(); 1029 smp_wmb();
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index a6ae1cfad86c..cb22024f2b42 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -29,6 +29,7 @@
29#include <linux/signal.h> 29#include <linux/signal.h>
30#include <linux/seccomp.h> 30#include <linux/seccomp.h>
31#include <linux/audit.h> 31#include <linux/audit.h>
32#include <trace/syscall.h>
32#ifdef CONFIG_PPC32 33#ifdef CONFIG_PPC32
33#include <linux/module.h> 34#include <linux/module.h>
34#endif 35#endif
@@ -40,6 +41,9 @@
40#include <asm/pgtable.h> 41#include <asm/pgtable.h>
41#include <asm/system.h> 42#include <asm/system.h>
42 43
44#define CREATE_TRACE_POINTS
45#include <trace/events/syscalls.h>
46
43/* 47/*
44 * The parameter save area on the stack is used to store arguments being passed 48 * The parameter save area on the stack is used to store arguments being passed
45 * to callee function and is located at fixed offset from stack pointer. 49 * to callee function and is located at fixed offset from stack pointer.
@@ -1710,6 +1714,9 @@ long do_syscall_trace_enter(struct pt_regs *regs)
1710 */ 1714 */
1711 ret = -1L; 1715 ret = -1L;
1712 1716
1717 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
1718 trace_sys_enter(regs, regs->gpr[0]);
1719
1713 if (unlikely(current->audit_context)) { 1720 if (unlikely(current->audit_context)) {
1714#ifdef CONFIG_PPC64 1721#ifdef CONFIG_PPC64
1715 if (!is_32bit_task()) 1722 if (!is_32bit_task())
@@ -1738,6 +1745,9 @@ void do_syscall_trace_leave(struct pt_regs *regs)
1738 audit_syscall_exit((regs->ccr&0x10000000)?AUDITSC_FAILURE:AUDITSC_SUCCESS, 1745 audit_syscall_exit((regs->ccr&0x10000000)?AUDITSC_FAILURE:AUDITSC_SUCCESS,
1739 regs->result); 1746 regs->result);
1740 1747
1748 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
1749 trace_sys_exit(regs, regs->result);
1750
1741 step = test_thread_flag(TIF_SINGLESTEP); 1751 step = test_thread_flag(TIF_SINGLESTEP);
1742 if (step || test_thread_flag(TIF_SYSCALL_TRACE)) 1752 if (step || test_thread_flag(TIF_SYSCALL_TRACE))
1743 tracehook_report_syscall_exit(regs, step); 1753 tracehook_report_syscall_exit(regs, step);
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 4a6f2ec7e761..8ebc6700b98d 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -129,7 +129,7 @@ static irqreturn_t call_function_single_action(int irq, void *data)
129 return IRQ_HANDLED; 129 return IRQ_HANDLED;
130} 130}
131 131
132irqreturn_t debug_ipi_action(int irq, void *data) 132static irqreturn_t debug_ipi_action(int irq, void *data)
133{ 133{
134 if (crash_ipi_function_ptr) { 134 if (crash_ipi_function_ptr) {
135 crash_ipi_function_ptr(get_irq_regs()); 135 crash_ipi_function_ptr(get_irq_regs());
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index b13306b0d925..0ff4ab98d50c 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -55,6 +55,7 @@
55#endif 55#endif
56#include <asm/kexec.h> 56#include <asm/kexec.h>
57#include <asm/ppc-opcode.h> 57#include <asm/ppc-opcode.h>
58#include <asm/rio.h>
58 59
59#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC) 60#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
60int (*__debugger)(struct pt_regs *regs) __read_mostly; 61int (*__debugger)(struct pt_regs *regs) __read_mostly;
@@ -424,6 +425,12 @@ int machine_check_e500mc(struct pt_regs *regs)
424 unsigned long reason = mcsr; 425 unsigned long reason = mcsr;
425 int recoverable = 1; 426 int recoverable = 1;
426 427
428 if (reason & MCSR_BUS_RBERR) {
429 recoverable = fsl_rio_mcheck_exception(regs);
430 if (recoverable == 1)
431 goto silent_out;
432 }
433
427 printk("Machine check in kernel mode.\n"); 434 printk("Machine check in kernel mode.\n");
428 printk("Caused by (from MCSR=%lx): ", reason); 435 printk("Caused by (from MCSR=%lx): ", reason);
429 436
@@ -499,6 +506,7 @@ int machine_check_e500mc(struct pt_regs *regs)
499 reason & MCSR_MEA ? "Effective" : "Physical", addr); 506 reason & MCSR_MEA ? "Effective" : "Physical", addr);
500 } 507 }
501 508
509silent_out:
502 mtspr(SPRN_MCSR, mcsr); 510 mtspr(SPRN_MCSR, mcsr);
503 return mfspr(SPRN_MCSR) == 0 && recoverable; 511 return mfspr(SPRN_MCSR) == 0 && recoverable;
504} 512}
@@ -507,6 +515,11 @@ int machine_check_e500(struct pt_regs *regs)
507{ 515{
508 unsigned long reason = get_mc_reason(regs); 516 unsigned long reason = get_mc_reason(regs);
509 517
518 if (reason & MCSR_BUS_RBERR) {
519 if (fsl_rio_mcheck_exception(regs))
520 return 1;
521 }
522
510 printk("Machine check in kernel mode.\n"); 523 printk("Machine check in kernel mode.\n");
511 printk("Caused by (from MCSR=%lx): ", reason); 524 printk("Caused by (from MCSR=%lx): ", reason);
512 525
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index 8ee51a252cf1..e6bec74be131 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -261,6 +261,28 @@ static int get_kernel(unsigned long pc, unsigned long mmcra)
261 return is_kernel; 261 return is_kernel;
262} 262}
263 263
264static bool pmc_overflow(unsigned long val)
265{
266 if ((int)val < 0)
267 return true;
268
269 /*
270 * Events on POWER7 can roll back if a speculative event doesn't
271 * eventually complete. Unfortunately in some rare cases they will
272 * raise a performance monitor exception. We need to catch this to
273 * ensure we reset the PMC. In all cases the PMC will be 256 or less
274 * cycles from overflow.
275 *
276 * We only do this if the first pass fails to find any overflowing
277 * PMCs because a user might set a period of less than 256 and we
278 * don't want to mistakenly reset them.
279 */
280 if (__is_processor(PV_POWER7) && ((0x80000000 - val) <= 256))
281 return true;
282
283 return false;
284}
285
264static void power4_handle_interrupt(struct pt_regs *regs, 286static void power4_handle_interrupt(struct pt_regs *regs,
265 struct op_counter_config *ctr) 287 struct op_counter_config *ctr)
266{ 288{
@@ -281,7 +303,7 @@ static void power4_handle_interrupt(struct pt_regs *regs,
281 303
282 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) { 304 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) {
283 val = classic_ctr_read(i); 305 val = classic_ctr_read(i);
284 if (val < 0) { 306 if (pmc_overflow(val)) {
285 if (oprofile_running && ctr[i].enabled) { 307 if (oprofile_running && ctr[i].enabled) {
286 oprofile_add_ext_sample(pc, regs, i, is_kernel); 308 oprofile_add_ext_sample(pc, regs, i, is_kernel);
287 classic_ctr_write(i, reset_value[i]); 309 classic_ctr_write(i, reset_value[i]);
diff --git a/arch/powerpc/platforms/40x/Kconfig b/arch/powerpc/platforms/40x/Kconfig
index b72176434ebe..d733d7ca939c 100644
--- a/arch/powerpc/platforms/40x/Kconfig
+++ b/arch/powerpc/platforms/40x/Kconfig
@@ -57,6 +57,8 @@ config KILAUEA
57 select 405EX 57 select 405EX
58 select PPC40x_SIMPLE 58 select PPC40x_SIMPLE
59 select PPC4xx_PCI_EXPRESS 59 select PPC4xx_PCI_EXPRESS
60 select PCI_MSI
61 select PPC4xx_MSI
60 help 62 help
61 This option enables support for the AMCC PPC405EX evaluation board. 63 This option enables support for the AMCC PPC405EX evaluation board.
62 64
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index f485fc5f6d5e..e958b6f48ec2 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -74,6 +74,8 @@ config KATMAI
74 select 440SPe 74 select 440SPe
75 select PCI 75 select PCI
76 select PPC4xx_PCI_EXPRESS 76 select PPC4xx_PCI_EXPRESS
77 select PCI_MSI
78 select PCC4xx_MSI
77 help 79 help
78 This option enables support for the AMCC PPC440SPe evaluation board. 80 This option enables support for the AMCC PPC440SPe evaluation board.
79 81
@@ -118,6 +120,8 @@ config CANYONLANDS
118 select 460EX 120 select 460EX
119 select PCI 121 select PCI
120 select PPC4xx_PCI_EXPRESS 122 select PPC4xx_PCI_EXPRESS
123 select PCI_MSI
124 select PPC4xx_MSI
121 select IBM_NEW_EMAC_RGMII 125 select IBM_NEW_EMAC_RGMII
122 select IBM_NEW_EMAC_ZMII 126 select IBM_NEW_EMAC_ZMII
123 help 127 help
@@ -144,6 +148,8 @@ config REDWOOD
144 select 460SX 148 select 460SX
145 select PCI 149 select PCI
146 select PPC4xx_PCI_EXPRESS 150 select PPC4xx_PCI_EXPRESS
151 select PCI_MSI
152 select PPC4xx_MSI
147 help 153 help
148 This option enables support for the AMCC PPC460SX Redwood board. 154 This option enables support for the AMCC PPC460SX Redwood board.
149 155
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c
index 449c08c15862..3e4eba603e6b 100644
--- a/arch/powerpc/platforms/cell/interrupt.c
+++ b/arch/powerpc/platforms/cell/interrupt.c
@@ -176,14 +176,14 @@ EXPORT_SYMBOL_GPL(iic_get_target_id);
176#ifdef CONFIG_SMP 176#ifdef CONFIG_SMP
177 177
178/* Use the highest interrupt priorities for IPI */ 178/* Use the highest interrupt priorities for IPI */
179static inline int iic_ipi_to_irq(int ipi) 179static inline int iic_msg_to_irq(int msg)
180{ 180{
181 return IIC_IRQ_TYPE_IPI + 0xf - ipi; 181 return IIC_IRQ_TYPE_IPI + 0xf - msg;
182} 182}
183 183
184void iic_cause_IPI(int cpu, int mesg) 184void iic_message_pass(int cpu, int msg)
185{ 185{
186 out_be64(&per_cpu(cpu_iic, cpu).regs->generate, (0xf - mesg) << 4); 186 out_be64(&per_cpu(cpu_iic, cpu).regs->generate, (0xf - msg) << 4);
187} 187}
188 188
189struct irq_host *iic_get_irq_host(int node) 189struct irq_host *iic_get_irq_host(int node)
@@ -192,50 +192,31 @@ struct irq_host *iic_get_irq_host(int node)
192} 192}
193EXPORT_SYMBOL_GPL(iic_get_irq_host); 193EXPORT_SYMBOL_GPL(iic_get_irq_host);
194 194
195static irqreturn_t iic_ipi_action(int irq, void *dev_id) 195static void iic_request_ipi(int msg)
196{
197 int ipi = (int)(long)dev_id;
198
199 switch(ipi) {
200 case PPC_MSG_CALL_FUNCTION:
201 generic_smp_call_function_interrupt();
202 break;
203 case PPC_MSG_RESCHEDULE:
204 scheduler_ipi();
205 break;
206 case PPC_MSG_CALL_FUNC_SINGLE:
207 generic_smp_call_function_single_interrupt();
208 break;
209 case PPC_MSG_DEBUGGER_BREAK:
210 debug_ipi_action(0, NULL);
211 break;
212 }
213 return IRQ_HANDLED;
214}
215static void iic_request_ipi(int ipi, const char *name)
216{ 196{
217 int virq; 197 int virq;
218 198
219 virq = irq_create_mapping(iic_host, iic_ipi_to_irq(ipi)); 199 virq = irq_create_mapping(iic_host, iic_msg_to_irq(msg));
220 if (virq == NO_IRQ) { 200 if (virq == NO_IRQ) {
221 printk(KERN_ERR 201 printk(KERN_ERR
222 "iic: failed to map IPI %s\n", name); 202 "iic: failed to map IPI %s\n", smp_ipi_name[msg]);
223 return; 203 return;
224 } 204 }
225 if (request_irq(virq, iic_ipi_action, IRQF_DISABLED, name, 205
226 (void *)(long)ipi)) 206 /*
227 printk(KERN_ERR 207 * If smp_request_message_ipi encounters an error it will notify
228 "iic: failed to request IPI %s\n", name); 208 * the error. If a message is not needed it will return non-zero.
209 */
210 if (smp_request_message_ipi(virq, msg))
211 irq_dispose_mapping(virq);
229} 212}
230 213
231void iic_request_IPIs(void) 214void iic_request_IPIs(void)
232{ 215{
233 iic_request_ipi(PPC_MSG_CALL_FUNCTION, "IPI-call"); 216 iic_request_ipi(PPC_MSG_CALL_FUNCTION);
234 iic_request_ipi(PPC_MSG_RESCHEDULE, "IPI-resched"); 217 iic_request_ipi(PPC_MSG_RESCHEDULE);
235 iic_request_ipi(PPC_MSG_CALL_FUNC_SINGLE, "IPI-call-single"); 218 iic_request_ipi(PPC_MSG_CALL_FUNC_SINGLE);
236#ifdef CONFIG_DEBUGGER 219 iic_request_ipi(PPC_MSG_DEBUGGER_BREAK);
237 iic_request_ipi(PPC_MSG_DEBUGGER_BREAK, "IPI-debug");
238#endif /* CONFIG_DEBUGGER */
239} 220}
240 221
241#endif /* CONFIG_SMP */ 222#endif /* CONFIG_SMP */
diff --git a/arch/powerpc/platforms/cell/interrupt.h b/arch/powerpc/platforms/cell/interrupt.h
index 942dc39d6045..4f60ae6ca358 100644
--- a/arch/powerpc/platforms/cell/interrupt.h
+++ b/arch/powerpc/platforms/cell/interrupt.h
@@ -75,7 +75,7 @@ enum {
75}; 75};
76 76
77extern void iic_init_IRQ(void); 77extern void iic_init_IRQ(void);
78extern void iic_cause_IPI(int cpu, int mesg); 78extern void iic_message_pass(int cpu, int msg);
79extern void iic_request_IPIs(void); 79extern void iic_request_IPIs(void);
80extern void iic_setup_cpu(void); 80extern void iic_setup_cpu(void);
81 81
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c
index d176e6148e3f..dbb641ea90dd 100644
--- a/arch/powerpc/platforms/cell/smp.c
+++ b/arch/powerpc/platforms/cell/smp.c
@@ -152,7 +152,7 @@ static int smp_cell_cpu_bootable(unsigned int nr)
152 return 1; 152 return 1;
153} 153}
154static struct smp_ops_t bpa_iic_smp_ops = { 154static struct smp_ops_t bpa_iic_smp_ops = {
155 .message_pass = iic_cause_IPI, 155 .message_pass = iic_message_pass,
156 .probe = smp_iic_probe, 156 .probe = smp_iic_probe,
157 .kick_cpu = smp_cell_kick_cpu, 157 .kick_cpu = smp_cell_kick_cpu,
158 .setup_cpu = smp_cell_setup_cpu, 158 .setup_cpu = smp_cell_setup_cpu,
diff --git a/arch/powerpc/sysdev/Kconfig b/arch/powerpc/sysdev/Kconfig
index d775fd148d13..7b4df37ac381 100644
--- a/arch/powerpc/sysdev/Kconfig
+++ b/arch/powerpc/sysdev/Kconfig
@@ -7,11 +7,18 @@ config PPC4xx_PCI_EXPRESS
7 depends on PCI && 4xx 7 depends on PCI && 4xx
8 default n 8 default n
9 9
10config PPC4xx_MSI
11 bool
12 depends on PCI_MSI
13 depends on PCI && 4xx
14 default n
15
10config PPC_MSI_BITMAP 16config PPC_MSI_BITMAP
11 bool 17 bool
12 depends on PCI_MSI 18 depends on PCI_MSI
13 default y if MPIC 19 default y if MPIC
14 default y if FSL_PCI 20 default y if FSL_PCI
21 default y if PPC4xx_MSI
15 22
16source "arch/powerpc/sysdev/xics/Kconfig" 23source "arch/powerpc/sysdev/xics/Kconfig"
17 24
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 6076e0074a87..0efa990e3344 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -41,6 +41,7 @@ obj-$(CONFIG_OF_RTC) += of_rtc.o
41ifeq ($(CONFIG_PCI),y) 41ifeq ($(CONFIG_PCI),y)
42obj-$(CONFIG_4xx) += ppc4xx_pci.o 42obj-$(CONFIG_4xx) += ppc4xx_pci.o
43endif 43endif
44obj-$(CONFIG_PPC4xx_MSI) += ppc4xx_msi.o
44obj-$(CONFIG_PPC4xx_CPM) += ppc4xx_cpm.o 45obj-$(CONFIG_PPC4xx_CPM) += ppc4xx_cpm.o
45obj-$(CONFIG_PPC4xx_GPIO) += ppc4xx_gpio.o 46obj-$(CONFIG_PPC4xx_GPIO) += ppc4xx_gpio.o
46 47
diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c
index 4fcb5a4e60dd..0608b1657da4 100644
--- a/arch/powerpc/sysdev/fsl_lbc.c
+++ b/arch/powerpc/sysdev/fsl_lbc.c
@@ -184,7 +184,8 @@ int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base, u32 mar)
184} 184}
185EXPORT_SYMBOL(fsl_upm_run_pattern); 185EXPORT_SYMBOL(fsl_upm_run_pattern);
186 186
187static int __devinit fsl_lbc_ctrl_init(struct fsl_lbc_ctrl *ctrl) 187static int __devinit fsl_lbc_ctrl_init(struct fsl_lbc_ctrl *ctrl,
188 struct device_node *node)
188{ 189{
189 struct fsl_lbc_regs __iomem *lbc = ctrl->regs; 190 struct fsl_lbc_regs __iomem *lbc = ctrl->regs;
190 191
@@ -198,6 +199,10 @@ static int __devinit fsl_lbc_ctrl_init(struct fsl_lbc_ctrl *ctrl)
198 /* Enable interrupts for any detected events */ 199 /* Enable interrupts for any detected events */
199 out_be32(&lbc->lteir, LTEIR_ENABLE); 200 out_be32(&lbc->lteir, LTEIR_ENABLE);
200 201
202 /* Set the monitor timeout value to the maximum for erratum A001 */
203 if (of_device_is_compatible(node, "fsl,elbc"))
204 clrsetbits_be32(&lbc->lbcr, LBCR_BMT, LBCR_BMTPS);
205
201 return 0; 206 return 0;
202} 207}
203 208
@@ -304,7 +309,7 @@ static int __devinit fsl_lbc_ctrl_probe(struct platform_device *dev)
304 309
305 fsl_lbc_ctrl_dev->dev = &dev->dev; 310 fsl_lbc_ctrl_dev->dev = &dev->dev;
306 311
307 ret = fsl_lbc_ctrl_init(fsl_lbc_ctrl_dev); 312 ret = fsl_lbc_ctrl_init(fsl_lbc_ctrl_dev, dev->dev.of_node);
308 if (ret < 0) 313 if (ret < 0)
309 goto err; 314 goto err;
310 315
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 49798532b477..5b206a2fe17c 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -10,7 +10,7 @@
10 * - Added Port-Write message handling 10 * - Added Port-Write message handling
11 * - Added Machine Check exception handling 11 * - Added Machine Check exception handling
12 * 12 *
13 * Copyright (C) 2007, 2008 Freescale Semiconductor, Inc. 13 * Copyright (C) 2007, 2008, 2010 Freescale Semiconductor, Inc.
14 * Zhang Wei <wei.zhang@freescale.com> 14 * Zhang Wei <wei.zhang@freescale.com>
15 * 15 *
16 * Copyright 2005 MontaVista Software, Inc. 16 * Copyright 2005 MontaVista Software, Inc.
@@ -47,15 +47,33 @@
47#define IRQ_RIO_RX(m) (((struct rio_priv *)(m->priv))->rxirq) 47#define IRQ_RIO_RX(m) (((struct rio_priv *)(m->priv))->rxirq)
48#define IRQ_RIO_PW(m) (((struct rio_priv *)(m->priv))->pwirq) 48#define IRQ_RIO_PW(m) (((struct rio_priv *)(m->priv))->pwirq)
49 49
50#define IPWSR_CLEAR 0x98
51#define OMSR_CLEAR 0x1cb3
52#define IMSR_CLEAR 0x491
53#define IDSR_CLEAR 0x91
54#define ODSR_CLEAR 0x1c00
55#define LTLEECSR_ENABLE_ALL 0xFFC000FC
56#define ESCSR_CLEAR 0x07120204
57
58#define RIO_PORT1_EDCSR 0x0640
59#define RIO_PORT2_EDCSR 0x0680
60#define RIO_PORT1_IECSR 0x10130
61#define RIO_PORT2_IECSR 0x101B0
62#define RIO_IM0SR 0x13064
63#define RIO_IM1SR 0x13164
64#define RIO_OM0SR 0x13004
65#define RIO_OM1SR 0x13104
66
50#define RIO_ATMU_REGS_OFFSET 0x10c00 67#define RIO_ATMU_REGS_OFFSET 0x10c00
51#define RIO_P_MSG_REGS_OFFSET 0x11000 68#define RIO_P_MSG_REGS_OFFSET 0x11000
52#define RIO_S_MSG_REGS_OFFSET 0x13000 69#define RIO_S_MSG_REGS_OFFSET 0x13000
53#define RIO_GCCSR 0x13c 70#define RIO_GCCSR 0x13c
54#define RIO_ESCSR 0x158 71#define RIO_ESCSR 0x158
72#define RIO_PORT2_ESCSR 0x178
55#define RIO_CCSR 0x15c 73#define RIO_CCSR 0x15c
56#define RIO_LTLEDCSR 0x0608 74#define RIO_LTLEDCSR 0x0608
57#define RIO_LTLEDCSR_IER 0x80000000 75#define RIO_LTLEDCSR_IER 0x80000000
58#define RIO_LTLEDCSR_PRT 0x01000000 76#define RIO_LTLEDCSR_PRT 0x01000000
59#define RIO_LTLEECSR 0x060c 77#define RIO_LTLEECSR 0x060c
60#define RIO_EPWISR 0x10010 78#define RIO_EPWISR 0x10010
61#define RIO_ISR_AACR 0x10120 79#define RIO_ISR_AACR 0x10120
@@ -88,7 +106,10 @@
88#define RIO_IPWSR_PWD 0x00000008 106#define RIO_IPWSR_PWD 0x00000008
89#define RIO_IPWSR_PWB 0x00000004 107#define RIO_IPWSR_PWB 0x00000004
90 108
91#define RIO_EPWISR_PINT 0x80000000 109/* EPWISR Error match value */
110#define RIO_EPWISR_PINT1 0x80000000
111#define RIO_EPWISR_PINT2 0x40000000
112#define RIO_EPWISR_MU 0x00000002
92#define RIO_EPWISR_PW 0x00000001 113#define RIO_EPWISR_PW 0x00000001
93 114
94#define RIO_MSG_DESC_SIZE 32 115#define RIO_MSG_DESC_SIZE 32
@@ -260,9 +281,7 @@ struct rio_priv {
260static void __iomem *rio_regs_win; 281static void __iomem *rio_regs_win;
261 282
262#ifdef CONFIG_E500 283#ifdef CONFIG_E500
263static int (*saved_mcheck_exception)(struct pt_regs *regs); 284int fsl_rio_mcheck_exception(struct pt_regs *regs)
264
265static int fsl_rio_mcheck_exception(struct pt_regs *regs)
266{ 285{
267 const struct exception_table_entry *entry = NULL; 286 const struct exception_table_entry *entry = NULL;
268 unsigned long reason = mfspr(SPRN_MCSR); 287 unsigned long reason = mfspr(SPRN_MCSR);
@@ -284,11 +303,9 @@ static int fsl_rio_mcheck_exception(struct pt_regs *regs)
284 } 303 }
285 } 304 }
286 305
287 if (saved_mcheck_exception) 306 return 0;
288 return saved_mcheck_exception(regs);
289 else
290 return cur_cpu_spec->machine_check(regs);
291} 307}
308EXPORT_SYMBOL_GPL(fsl_rio_mcheck_exception);
292#endif 309#endif
293 310
294/** 311/**
@@ -1064,6 +1081,40 @@ static int fsl_rio_doorbell_init(struct rio_mport *mport)
1064 return rc; 1081 return rc;
1065} 1082}
1066 1083
1084static void port_error_handler(struct rio_mport *port, int offset)
1085{
1086 /*XXX: Error recovery is not implemented, we just clear errors */
1087 out_be32((u32 *)(rio_regs_win + RIO_LTLEDCSR), 0);
1088
1089 if (offset == 0) {
1090 out_be32((u32 *)(rio_regs_win + RIO_PORT1_EDCSR), 0);
1091 out_be32((u32 *)(rio_regs_win + RIO_PORT1_IECSR), 0);
1092 out_be32((u32 *)(rio_regs_win + RIO_ESCSR), ESCSR_CLEAR);
1093 } else {
1094 out_be32((u32 *)(rio_regs_win + RIO_PORT2_EDCSR), 0);
1095 out_be32((u32 *)(rio_regs_win + RIO_PORT2_IECSR), 0);
1096 out_be32((u32 *)(rio_regs_win + RIO_PORT2_ESCSR), ESCSR_CLEAR);
1097 }
1098}
1099
1100static void msg_unit_error_handler(struct rio_mport *port)
1101{
1102 struct rio_priv *priv = port->priv;
1103
1104 /*XXX: Error recovery is not implemented, we just clear errors */
1105 out_be32((u32 *)(rio_regs_win + RIO_LTLEDCSR), 0);
1106
1107 out_be32((u32 *)(rio_regs_win + RIO_IM0SR), IMSR_CLEAR);
1108 out_be32((u32 *)(rio_regs_win + RIO_IM1SR), IMSR_CLEAR);
1109 out_be32((u32 *)(rio_regs_win + RIO_OM0SR), OMSR_CLEAR);
1110 out_be32((u32 *)(rio_regs_win + RIO_OM1SR), OMSR_CLEAR);
1111
1112 out_be32(&priv->msg_regs->odsr, ODSR_CLEAR);
1113 out_be32(&priv->msg_regs->dsr, IDSR_CLEAR);
1114
1115 out_be32(&priv->msg_regs->pwsr, IPWSR_CLEAR);
1116}
1117
1067/** 1118/**
1068 * fsl_rio_port_write_handler - MPC85xx port write interrupt handler 1119 * fsl_rio_port_write_handler - MPC85xx port write interrupt handler
1069 * @irq: Linux interrupt number 1120 * @irq: Linux interrupt number
@@ -1144,10 +1195,22 @@ fsl_rio_port_write_handler(int irq, void *dev_instance)
1144 } 1195 }
1145 1196
1146pw_done: 1197pw_done:
1147 if (epwisr & RIO_EPWISR_PINT) { 1198 if (epwisr & RIO_EPWISR_PINT1) {
1199 tmp = in_be32(priv->regs_win + RIO_LTLEDCSR);
1200 pr_debug("RIO_LTLEDCSR = 0x%x\n", tmp);
1201 port_error_handler(port, 0);
1202 }
1203
1204 if (epwisr & RIO_EPWISR_PINT2) {
1148 tmp = in_be32(priv->regs_win + RIO_LTLEDCSR); 1205 tmp = in_be32(priv->regs_win + RIO_LTLEDCSR);
1149 pr_debug("RIO_LTLEDCSR = 0x%x\n", tmp); 1206 pr_debug("RIO_LTLEDCSR = 0x%x\n", tmp);
1150 out_be32(priv->regs_win + RIO_LTLEDCSR, 0); 1207 port_error_handler(port, 1);
1208 }
1209
1210 if (epwisr & RIO_EPWISR_MU) {
1211 tmp = in_be32(priv->regs_win + RIO_LTLEDCSR);
1212 pr_debug("RIO_LTLEDCSR = 0x%x\n", tmp);
1213 msg_unit_error_handler(port);
1151 } 1214 }
1152 1215
1153 return IRQ_HANDLED; 1216 return IRQ_HANDLED;
@@ -1258,12 +1321,14 @@ static int fsl_rio_port_write_init(struct rio_mport *mport)
1258 1321
1259 1322
1260 /* Hook up port-write handler */ 1323 /* Hook up port-write handler */
1261 rc = request_irq(IRQ_RIO_PW(mport), fsl_rio_port_write_handler, 0, 1324 rc = request_irq(IRQ_RIO_PW(mport), fsl_rio_port_write_handler,
1262 "port-write", (void *)mport); 1325 IRQF_SHARED, "port-write", (void *)mport);
1263 if (rc < 0) { 1326 if (rc < 0) {
1264 pr_err("MPC85xx RIO: unable to request inbound doorbell irq"); 1327 pr_err("MPC85xx RIO: unable to request inbound doorbell irq");
1265 goto err_out; 1328 goto err_out;
1266 } 1329 }
1330 /* Enable Error Interrupt */
1331 out_be32((u32 *)(rio_regs_win + RIO_LTLEECSR), LTLEECSR_ENABLE_ALL);
1267 1332
1268 INIT_WORK(&priv->pw_work, fsl_pw_dpc); 1333 INIT_WORK(&priv->pw_work, fsl_pw_dpc);
1269 spin_lock_init(&priv->pw_fifo_lock); 1334 spin_lock_init(&priv->pw_fifo_lock);
@@ -1538,11 +1603,6 @@ int fsl_rio_setup(struct platform_device *dev)
1538 fsl_rio_doorbell_init(port); 1603 fsl_rio_doorbell_init(port);
1539 fsl_rio_port_write_init(port); 1604 fsl_rio_port_write_init(port);
1540 1605
1541#ifdef CONFIG_E500
1542 saved_mcheck_exception = ppc_md.machine_check_exception;
1543 ppc_md.machine_check_exception = fsl_rio_mcheck_exception;
1544#endif
1545
1546 return 0; 1606 return 0;
1547err: 1607err:
1548 iounmap(priv->regs_win); 1608 iounmap(priv->regs_win);
diff --git a/arch/powerpc/sysdev/ppc4xx_msi.c b/arch/powerpc/sysdev/ppc4xx_msi.c
new file mode 100644
index 000000000000..367af0241851
--- /dev/null
+++ b/arch/powerpc/sysdev/ppc4xx_msi.c
@@ -0,0 +1,276 @@
1/*
2 * Adding PCI-E MSI support for PPC4XX SoCs.
3 *
4 * Copyright (c) 2010, Applied Micro Circuits Corporation
5 * Authors: Tirumala R Marri <tmarri@apm.com>
6 * Feng Kan <fkan@apm.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24#include <linux/irq.h>
25#include <linux/bootmem.h>
26#include <linux/pci.h>
27#include <linux/msi.h>
28#include <linux/of_platform.h>
29#include <linux/interrupt.h>
30#include <asm/prom.h>
31#include <asm/hw_irq.h>
32#include <asm/ppc-pci.h>
33#include <boot/dcr.h>
34#include <asm/dcr-regs.h>
35#include <asm/msi_bitmap.h>
36
37#define PEIH_TERMADH 0x00
38#define PEIH_TERMADL 0x08
39#define PEIH_MSIED 0x10
40#define PEIH_MSIMK 0x18
41#define PEIH_MSIASS 0x20
42#define PEIH_FLUSH0 0x30
43#define PEIH_FLUSH1 0x38
44#define PEIH_CNTRST 0x48
45#define NR_MSI_IRQS 4
46
47struct ppc4xx_msi {
48 u32 msi_addr_lo;
49 u32 msi_addr_hi;
50 void __iomem *msi_regs;
51 int msi_virqs[NR_MSI_IRQS];
52 struct msi_bitmap bitmap;
53 struct device_node *msi_dev;
54};
55
56static struct ppc4xx_msi ppc4xx_msi;
57
58static int ppc4xx_msi_init_allocator(struct platform_device *dev,
59 struct ppc4xx_msi *msi_data)
60{
61 int err;
62
63 err = msi_bitmap_alloc(&msi_data->bitmap, NR_MSI_IRQS,
64 dev->dev.of_node);
65 if (err)
66 return err;
67
68 err = msi_bitmap_reserve_dt_hwirqs(&msi_data->bitmap);
69 if (err < 0) {
70 msi_bitmap_free(&msi_data->bitmap);
71 return err;
72 }
73
74 return 0;
75}
76
77static int ppc4xx_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
78{
79 int int_no = -ENOMEM;
80 unsigned int virq;
81 struct msi_msg msg;
82 struct msi_desc *entry;
83 struct ppc4xx_msi *msi_data = &ppc4xx_msi;
84
85 list_for_each_entry(entry, &dev->msi_list, list) {
86 int_no = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1);
87 if (int_no >= 0)
88 break;
89 if (int_no < 0) {
90 pr_debug("%s: fail allocating msi interrupt\n",
91 __func__);
92 }
93 virq = irq_of_parse_and_map(msi_data->msi_dev, int_no);
94 if (virq == NO_IRQ) {
95 dev_err(&dev->dev, "%s: fail mapping irq\n", __func__);
96 msi_bitmap_free_hwirqs(&msi_data->bitmap, int_no, 1);
97 return -ENOSPC;
98 }
99 dev_dbg(&dev->dev, "%s: virq = %d\n", __func__, virq);
100
101 /* Setup msi address space */
102 msg.address_hi = msi_data->msi_addr_hi;
103 msg.address_lo = msi_data->msi_addr_lo;
104
105 irq_set_msi_desc(virq, entry);
106 msg.data = int_no;
107 write_msi_msg(virq, &msg);
108 }
109 return 0;
110}
111
112void ppc4xx_teardown_msi_irqs(struct pci_dev *dev)
113{
114 struct msi_desc *entry;
115 struct ppc4xx_msi *msi_data = &ppc4xx_msi;
116
117 dev_dbg(&dev->dev, "PCIE-MSI: tearing down msi irqs\n");
118
119 list_for_each_entry(entry, &dev->msi_list, list) {
120 if (entry->irq == NO_IRQ)
121 continue;
122 irq_set_msi_desc(entry->irq, NULL);
123 msi_bitmap_free_hwirqs(&msi_data->bitmap,
124 virq_to_hw(entry->irq), 1);
125 irq_dispose_mapping(entry->irq);
126 }
127}
128
129static int ppc4xx_msi_check_device(struct pci_dev *pdev, int nvec, int type)
130{
131 dev_dbg(&pdev->dev, "PCIE-MSI:%s called. vec %x type %d\n",
132 __func__, nvec, type);
133 if (type == PCI_CAP_ID_MSIX)
134 pr_debug("ppc4xx msi: MSI-X untested, trying anyway.\n");
135
136 return 0;
137}
138
139static int ppc4xx_setup_pcieh_hw(struct platform_device *dev,
140 struct resource res, struct ppc4xx_msi *msi)
141{
142 const u32 *msi_data;
143 const u32 *msi_mask;
144 const u32 *sdr_addr;
145 dma_addr_t msi_phys;
146 void *msi_virt;
147
148 sdr_addr = of_get_property(dev->dev.of_node, "sdr-base", NULL);
149 if (!sdr_addr)
150 return -1;
151
152 SDR0_WRITE(sdr_addr, (u64)res.start >> 32); /*HIGH addr */
153 SDR0_WRITE(sdr_addr + 1, res.start & 0xFFFFFFFF); /* Low addr */
154
155
156 msi->msi_dev = of_find_node_by_name(NULL, "ppc4xx-msi");
157 if (msi->msi_dev)
158 return -ENODEV;
159
160 msi->msi_regs = of_iomap(msi->msi_dev, 0);
161 if (!msi->msi_regs) {
162 dev_err(&dev->dev, "of_iomap problem failed\n");
163 return -ENOMEM;
164 }
165 dev_dbg(&dev->dev, "PCIE-MSI: msi register mapped 0x%x 0x%x\n",
166 (u32) (msi->msi_regs + PEIH_TERMADH), (u32) (msi->msi_regs));
167
168 msi_virt = dma_alloc_coherent(&dev->dev, 64, &msi_phys, GFP_KERNEL);
169 msi->msi_addr_hi = 0x0;
170 msi->msi_addr_lo = (u32) msi_phys;
171 dev_dbg(&dev->dev, "PCIE-MSI: msi address 0x%x\n", msi->msi_addr_lo);
172
173 /* Progam the Interrupt handler Termination addr registers */
174 out_be32(msi->msi_regs + PEIH_TERMADH, msi->msi_addr_hi);
175 out_be32(msi->msi_regs + PEIH_TERMADL, msi->msi_addr_lo);
176
177 msi_data = of_get_property(dev->dev.of_node, "msi-data", NULL);
178 if (!msi_data)
179 return -1;
180 msi_mask = of_get_property(dev->dev.of_node, "msi-mask", NULL);
181 if (!msi_mask)
182 return -1;
183 /* Program MSI Expected data and Mask bits */
184 out_be32(msi->msi_regs + PEIH_MSIED, *msi_data);
185 out_be32(msi->msi_regs + PEIH_MSIMK, *msi_mask);
186
187 return 0;
188}
189
190static int ppc4xx_of_msi_remove(struct platform_device *dev)
191{
192 struct ppc4xx_msi *msi = dev->dev.platform_data;
193 int i;
194 int virq;
195
196 for (i = 0; i < NR_MSI_IRQS; i++) {
197 virq = msi->msi_virqs[i];
198 if (virq != NO_IRQ)
199 irq_dispose_mapping(virq);
200 }
201
202 if (msi->bitmap.bitmap)
203 msi_bitmap_free(&msi->bitmap);
204 iounmap(msi->msi_regs);
205 of_node_put(msi->msi_dev);
206 kfree(msi);
207
208 return 0;
209}
210
211static int __devinit ppc4xx_msi_probe(struct platform_device *dev)
212{
213 struct ppc4xx_msi *msi;
214 struct resource res;
215 int err = 0;
216
217 msi = &ppc4xx_msi;/*keep the msi data for further use*/
218
219 dev_dbg(&dev->dev, "PCIE-MSI: Setting up MSI support...\n");
220
221 msi = kzalloc(sizeof(struct ppc4xx_msi), GFP_KERNEL);
222 if (!msi) {
223 dev_err(&dev->dev, "No memory for MSI structure\n");
224 return -ENOMEM;
225 }
226 dev->dev.platform_data = msi;
227
228 /* Get MSI ranges */
229 err = of_address_to_resource(dev->dev.of_node, 0, &res);
230 if (err) {
231 dev_err(&dev->dev, "%s resource error!\n",
232 dev->dev.of_node->full_name);
233 goto error_out;
234 }
235
236 if (ppc4xx_setup_pcieh_hw(dev, res, msi))
237 goto error_out;
238
239 err = ppc4xx_msi_init_allocator(dev, msi);
240 if (err) {
241 dev_err(&dev->dev, "Error allocating MSI bitmap\n");
242 goto error_out;
243 }
244
245 ppc_md.setup_msi_irqs = ppc4xx_setup_msi_irqs;
246 ppc_md.teardown_msi_irqs = ppc4xx_teardown_msi_irqs;
247 ppc_md.msi_check_device = ppc4xx_msi_check_device;
248 return err;
249
250error_out:
251 ppc4xx_of_msi_remove(dev);
252 return err;
253}
254static const struct of_device_id ppc4xx_msi_ids[] = {
255 {
256 .compatible = "amcc,ppc4xx-msi",
257 },
258 {}
259};
260static struct platform_driver ppc4xx_msi_driver = {
261 .probe = ppc4xx_msi_probe,
262 .remove = ppc4xx_of_msi_remove,
263 .driver = {
264 .name = "ppc4xx-msi",
265 .owner = THIS_MODULE,
266 .of_match_table = ppc4xx_msi_ids,
267 },
268
269};
270
271static __init int ppc4xx_msi_init(void)
272{
273 return platform_driver_register(&ppc4xx_msi_driver);
274}
275
276subsys_initcall(ppc4xx_msi_init);
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index e1c8f3a49884..667c6e9f6a34 100644
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -621,6 +621,7 @@ static inline unsigned long find_first_zero_bit(const unsigned long *addr,
621 bits = __ffz_word(bytes*8, __load_ulong_be(addr, bytes)); 621 bits = __ffz_word(bytes*8, __load_ulong_be(addr, bytes));
622 return (bits < size) ? bits : size; 622 return (bits < size) ? bits : size;
623} 623}
624#define find_first_zero_bit find_first_zero_bit
624 625
625/** 626/**
626 * find_first_bit - find the first set bit in a memory region 627 * find_first_bit - find the first set bit in a memory region
@@ -641,6 +642,7 @@ static inline unsigned long find_first_bit(const unsigned long * addr,
641 bits = __ffs_word(bytes*8, __load_ulong_be(addr, bytes)); 642 bits = __ffs_word(bytes*8, __load_ulong_be(addr, bytes));
642 return (bits < size) ? bits : size; 643 return (bits < size) ? bits : size;
643} 644}
645#define find_first_bit find_first_bit
644 646
645/** 647/**
646 * find_next_zero_bit - find the first zero bit in a memory region 648 * find_next_zero_bit - find the first zero bit in a memory region
@@ -677,6 +679,7 @@ static inline int find_next_zero_bit (const unsigned long * addr,
677 } 679 }
678 return offset + find_first_zero_bit(p, size); 680 return offset + find_first_zero_bit(p, size);
679} 681}
682#define find_next_zero_bit find_next_zero_bit
680 683
681/** 684/**
682 * find_next_bit - find the first set bit in a memory region 685 * find_next_bit - find the first set bit in a memory region
@@ -713,6 +716,7 @@ static inline int find_next_bit (const unsigned long * addr,
713 } 716 }
714 return offset + find_first_bit(p, size); 717 return offset + find_first_bit(p, size);
715} 718}
719#define find_next_bit find_next_bit
716 720
717/* 721/*
718 * Every architecture must define this function. It's the fastest 722 * Every architecture must define this function. It's the fastest
@@ -742,41 +746,6 @@ static inline int sched_find_first_bit(unsigned long *b)
742 * 23 22 21 20 19 18 17 16 31 30 29 28 27 26 25 24 746 * 23 22 21 20 19 18 17 16 31 30 29 28 27 26 25 24
743 */ 747 */
744 748
745static inline void __set_bit_le(unsigned long nr, void *addr)
746{
747 __set_bit(nr ^ (__BITOPS_WORDSIZE - 8), addr);
748}
749
750static inline void __clear_bit_le(unsigned long nr, void *addr)
751{
752 __clear_bit(nr ^ (__BITOPS_WORDSIZE - 8), addr);
753}
754
755static inline int __test_and_set_bit_le(unsigned long nr, void *addr)
756{
757 return __test_and_set_bit(nr ^ (__BITOPS_WORDSIZE - 8), addr);
758}
759
760static inline int test_and_set_bit_le(unsigned long nr, void *addr)
761{
762 return test_and_set_bit(nr ^ (__BITOPS_WORDSIZE - 8), addr);
763}
764
765static inline int __test_and_clear_bit_le(unsigned long nr, void *addr)
766{
767 return __test_and_clear_bit(nr ^ (__BITOPS_WORDSIZE - 8), addr);
768}
769
770static inline int test_and_clear_bit_le(unsigned long nr, void *addr)
771{
772 return test_and_clear_bit(nr ^ (__BITOPS_WORDSIZE - 8), addr);
773}
774
775static inline int test_bit_le(unsigned long nr, const void *addr)
776{
777 return test_bit(nr ^ (__BITOPS_WORDSIZE - 8), addr);
778}
779
780static inline int find_first_zero_bit_le(void *vaddr, unsigned int size) 749static inline int find_first_zero_bit_le(void *vaddr, unsigned int size)
781{ 750{
782 unsigned long bytes, bits; 751 unsigned long bytes, bits;
@@ -787,6 +756,7 @@ static inline int find_first_zero_bit_le(void *vaddr, unsigned int size)
787 bits = __ffz_word(bytes*8, __load_ulong_le(vaddr, bytes)); 756 bits = __ffz_word(bytes*8, __load_ulong_le(vaddr, bytes));
788 return (bits < size) ? bits : size; 757 return (bits < size) ? bits : size;
789} 758}
759#define find_first_zero_bit_le find_first_zero_bit_le
790 760
791static inline int find_next_zero_bit_le(void *vaddr, unsigned long size, 761static inline int find_next_zero_bit_le(void *vaddr, unsigned long size,
792 unsigned long offset) 762 unsigned long offset)
@@ -816,6 +786,7 @@ static inline int find_next_zero_bit_le(void *vaddr, unsigned long size,
816 } 786 }
817 return offset + find_first_zero_bit_le(p, size); 787 return offset + find_first_zero_bit_le(p, size);
818} 788}
789#define find_next_zero_bit_le find_next_zero_bit_le
819 790
820static inline unsigned long find_first_bit_le(void *vaddr, unsigned long size) 791static inline unsigned long find_first_bit_le(void *vaddr, unsigned long size)
821{ 792{
@@ -827,6 +798,7 @@ static inline unsigned long find_first_bit_le(void *vaddr, unsigned long size)
827 bits = __ffs_word(bytes*8, __load_ulong_le(vaddr, bytes)); 798 bits = __ffs_word(bytes*8, __load_ulong_le(vaddr, bytes));
828 return (bits < size) ? bits : size; 799 return (bits < size) ? bits : size;
829} 800}
801#define find_first_bit_le find_first_bit_le
830 802
831static inline int find_next_bit_le(void *vaddr, unsigned long size, 803static inline int find_next_bit_le(void *vaddr, unsigned long size,
832 unsigned long offset) 804 unsigned long offset)
@@ -856,6 +828,9 @@ static inline int find_next_bit_le(void *vaddr, unsigned long size,
856 } 828 }
857 return offset + find_first_bit_le(p, size); 829 return offset + find_first_bit_le(p, size);
858} 830}
831#define find_next_bit_le find_next_bit_le
832
833#include <asm-generic/bitops/le.h>
859 834
860#define ext2_set_bit_atomic(lock, nr, addr) \ 835#define ext2_set_bit_atomic(lock, nr, addr) \
861 test_and_set_bit_le(nr, addr) 836 test_and_set_bit_le(nr, addr)
diff --git a/arch/score/Kconfig b/arch/score/Kconfig
index e73bc781cc14..288add8d168f 100644
--- a/arch/score/Kconfig
+++ b/arch/score/Kconfig
@@ -43,9 +43,6 @@ config NO_DMA
43config RWSEM_GENERIC_SPINLOCK 43config RWSEM_GENERIC_SPINLOCK
44 def_bool y 44 def_bool y
45 45
46config GENERIC_FIND_NEXT_BIT
47 def_bool y
48
49config GENERIC_HWEIGHT 46config GENERIC_HWEIGHT
50 def_bool y 47 def_bool y
51 48
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index b44e37753b9a..74495a5ea027 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -71,12 +71,6 @@ config GENERIC_CSUM
71 def_bool y 71 def_bool y
72 depends on SUPERH64 72 depends on SUPERH64
73 73
74config GENERIC_FIND_NEXT_BIT
75 def_bool y
76
77config GENERIC_FIND_BIT_LE
78 def_bool y
79
80config GENERIC_HWEIGHT 74config GENERIC_HWEIGHT
81 def_bool y 75 def_bool y
82 76
diff --git a/arch/sh/configs/apsh4ad0a_defconfig b/arch/sh/configs/apsh4ad0a_defconfig
index 77ec0e7b8ddf..e7583484cc07 100644
--- a/arch/sh/configs/apsh4ad0a_defconfig
+++ b/arch/sh/configs/apsh4ad0a_defconfig
@@ -7,7 +7,6 @@ CONFIG_IKCONFIG=y
7CONFIG_IKCONFIG_PROC=y 7CONFIG_IKCONFIG_PROC=y
8CONFIG_LOG_BUF_SHIFT=14 8CONFIG_LOG_BUF_SHIFT=14
9CONFIG_CGROUPS=y 9CONFIG_CGROUPS=y
10CONFIG_CGROUP_NS=y
11CONFIG_CGROUP_FREEZER=y 10CONFIG_CGROUP_FREEZER=y
12CONFIG_CGROUP_DEVICE=y 11CONFIG_CGROUP_DEVICE=y
13CONFIG_CGROUP_CPUACCT=y 12CONFIG_CGROUP_CPUACCT=y
diff --git a/arch/sh/configs/sdk7786_defconfig b/arch/sh/configs/sdk7786_defconfig
index c41650572d79..8a7dd7b59c5c 100644
--- a/arch/sh/configs/sdk7786_defconfig
+++ b/arch/sh/configs/sdk7786_defconfig
@@ -12,7 +12,6 @@ CONFIG_IKCONFIG=y
12CONFIG_IKCONFIG_PROC=y 12CONFIG_IKCONFIG_PROC=y
13CONFIG_CGROUPS=y 13CONFIG_CGROUPS=y
14CONFIG_CGROUP_DEBUG=y 14CONFIG_CGROUP_DEBUG=y
15CONFIG_CGROUP_NS=y
16CONFIG_CGROUP_FREEZER=y 15CONFIG_CGROUP_FREEZER=y
17CONFIG_CGROUP_DEVICE=y 16CONFIG_CGROUP_DEVICE=y
18CONFIG_CPUSETS=y 17CONFIG_CPUSETS=y
diff --git a/arch/sh/configs/se7206_defconfig b/arch/sh/configs/se7206_defconfig
index a468ff227fc6..72c3fad7383f 100644
--- a/arch/sh/configs/se7206_defconfig
+++ b/arch/sh/configs/se7206_defconfig
@@ -8,7 +8,6 @@ CONFIG_RCU_TRACE=y
8CONFIG_LOG_BUF_SHIFT=14 8CONFIG_LOG_BUF_SHIFT=14
9CONFIG_CGROUPS=y 9CONFIG_CGROUPS=y
10CONFIG_CGROUP_DEBUG=y 10CONFIG_CGROUP_DEBUG=y
11CONFIG_CGROUP_NS=y
12CONFIG_CGROUP_DEVICE=y 11CONFIG_CGROUP_DEVICE=y
13CONFIG_CGROUP_CPUACCT=y 12CONFIG_CGROUP_CPUACCT=y
14CONFIG_RESOURCE_COUNTERS=y 13CONFIG_RESOURCE_COUNTERS=y
diff --git a/arch/sh/configs/shx3_defconfig b/arch/sh/configs/shx3_defconfig
index 3f92d37c6374..6bb413036892 100644
--- a/arch/sh/configs/shx3_defconfig
+++ b/arch/sh/configs/shx3_defconfig
@@ -9,7 +9,6 @@ CONFIG_IKCONFIG=y
9CONFIG_IKCONFIG_PROC=y 9CONFIG_IKCONFIG_PROC=y
10CONFIG_LOG_BUF_SHIFT=14 10CONFIG_LOG_BUF_SHIFT=14
11CONFIG_CGROUPS=y 11CONFIG_CGROUPS=y
12CONFIG_CGROUP_NS=y
13CONFIG_CGROUP_FREEZER=y 12CONFIG_CGROUP_FREEZER=y
14CONFIG_CGROUP_DEVICE=y 13CONFIG_CGROUP_DEVICE=y
15CONFIG_CGROUP_CPUACCT=y 14CONFIG_CGROUP_CPUACCT=y
diff --git a/arch/sh/configs/urquell_defconfig b/arch/sh/configs/urquell_defconfig
index 7b3daec6fefe..8bfa4d056d7a 100644
--- a/arch/sh/configs/urquell_defconfig
+++ b/arch/sh/configs/urquell_defconfig
@@ -9,7 +9,6 @@ CONFIG_IKCONFIG_PROC=y
9CONFIG_LOG_BUF_SHIFT=14 9CONFIG_LOG_BUF_SHIFT=14
10CONFIG_CGROUPS=y 10CONFIG_CGROUPS=y
11CONFIG_CGROUP_DEBUG=y 11CONFIG_CGROUP_DEBUG=y
12CONFIG_CGROUP_NS=y
13CONFIG_CGROUP_FREEZER=y 12CONFIG_CGROUP_FREEZER=y
14CONFIG_CGROUP_DEVICE=y 13CONFIG_CGROUP_DEVICE=y
15CONFIG_CPUSETS=y 14CONFIG_CPUSETS=y
diff --git a/arch/sh/include/asm/kgdb.h b/arch/sh/include/asm/kgdb.h
index 4235e228d921..f3613952d1ae 100644
--- a/arch/sh/include/asm/kgdb.h
+++ b/arch/sh/include/asm/kgdb.h
@@ -34,5 +34,6 @@ static inline void arch_kgdb_breakpoint(void)
34 34
35#define CACHE_FLUSH_IS_SAFE 1 35#define CACHE_FLUSH_IS_SAFE 1
36#define BREAK_INSTR_SIZE 2 36#define BREAK_INSTR_SIZE 2
37#define GDB_ADJUSTS_BREAK_OFFSET
37 38
38#endif /* __ASM_SH_KGDB_H */ 39#endif /* __ASM_SH_KGDB_H */
diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h
index de167d3a1a80..40725b4a8018 100644
--- a/arch/sh/include/asm/ptrace.h
+++ b/arch/sh/include/asm/ptrace.h
@@ -40,9 +40,8 @@
40#include <asm/system.h> 40#include <asm/system.h>
41 41
42#define user_mode(regs) (((regs)->sr & 0x40000000)==0) 42#define user_mode(regs) (((regs)->sr & 0x40000000)==0)
43#define user_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15])
44#define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15]) 43#define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15])
45#define instruction_pointer(regs) ((unsigned long)(regs)->pc) 44#define GET_USP(regs) ((regs)->regs[15])
46 45
47extern void show_regs(struct pt_regs *); 46extern void show_regs(struct pt_regs *);
48 47
@@ -139,6 +138,9 @@ static inline unsigned long profile_pc(struct pt_regs *regs)
139 138
140 return pc; 139 return pc;
141} 140}
141#define profile_pc profile_pc
142
143#include <asm-generic/ptrace.h>
142#endif /* __KERNEL__ */ 144#endif /* __KERNEL__ */
143 145
144#endif /* __ASM_SH_PTRACE_H */ 146#endif /* __ASM_SH_PTRACE_H */
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 63a027c9ada5..af32e17fa170 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -190,14 +190,6 @@ config RWSEM_XCHGADD_ALGORITHM
190 bool 190 bool
191 default y if SPARC64 191 default y if SPARC64
192 192
193config GENERIC_FIND_NEXT_BIT
194 bool
195 default y
196
197config GENERIC_FIND_BIT_LE
198 bool
199 default y
200
201config GENERIC_HWEIGHT 193config GENERIC_HWEIGHT
202 bool 194 bool
203 default y if !ULTRA_HAS_POPULATION_COUNT 195 default y if !ULTRA_HAS_POPULATION_COUNT
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 635e1bfb1c5d..e1e50101b3bb 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -5,7 +5,6 @@ config TILE
5 def_bool y 5 def_bool y
6 select HAVE_KVM if !TILEGX 6 select HAVE_KVM if !TILEGX
7 select GENERIC_FIND_FIRST_BIT 7 select GENERIC_FIND_FIRST_BIT
8 select GENERIC_FIND_NEXT_BIT
9 select USE_GENERIC_SMP_HELPERS 8 select USE_GENERIC_SMP_HELPERS
10 select CC_OPTIMIZE_FOR_SIZE 9 select CC_OPTIMIZE_FOR_SIZE
11 select HAVE_GENERIC_HARDIRQS 10 select HAVE_GENERIC_HARDIRQS
diff --git a/arch/um/Kconfig.x86 b/arch/um/Kconfig.x86
index 795ea8e869f4..8aae429a56e2 100644
--- a/arch/um/Kconfig.x86
+++ b/arch/um/Kconfig.x86
@@ -15,7 +15,6 @@ endmenu
15config UML_X86 15config UML_X86
16 def_bool y 16 def_bool y
17 select GENERIC_FIND_FIRST_BIT 17 select GENERIC_FIND_FIRST_BIT
18 select GENERIC_FIND_NEXT_BIT
19 18
20config 64BIT 19config 64BIT
21 bool 20 bool
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 483775f42d2a..da349723d411 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -64,7 +64,6 @@ config X86
64 select HAVE_GENERIC_HARDIRQS 64 select HAVE_GENERIC_HARDIRQS
65 select HAVE_SPARSE_IRQ 65 select HAVE_SPARSE_IRQ
66 select GENERIC_FIND_FIRST_BIT 66 select GENERIC_FIND_FIRST_BIT
67 select GENERIC_FIND_NEXT_BIT
68 select GENERIC_IRQ_PROBE 67 select GENERIC_IRQ_PROBE
69 select GENERIC_PENDING_IRQ if SMP 68 select GENERIC_PENDING_IRQ if SMP
70 select GENERIC_IRQ_SHOW 69 select GENERIC_IRQ_SHOW
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
index 6f9872658dd2..2bf18059fbea 100644
--- a/arch/x86/configs/i386_defconfig
+++ b/arch/x86/configs/i386_defconfig
@@ -10,7 +10,6 @@ CONFIG_TASK_IO_ACCOUNTING=y
10CONFIG_AUDIT=y 10CONFIG_AUDIT=y
11CONFIG_LOG_BUF_SHIFT=18 11CONFIG_LOG_BUF_SHIFT=18
12CONFIG_CGROUPS=y 12CONFIG_CGROUPS=y
13CONFIG_CGROUP_NS=y
14CONFIG_CGROUP_FREEZER=y 13CONFIG_CGROUP_FREEZER=y
15CONFIG_CPUSETS=y 14CONFIG_CPUSETS=y
16CONFIG_CGROUP_CPUACCT=y 15CONFIG_CGROUP_CPUACCT=y
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index ee01a9d5d4f0..22a0dc8e51dd 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -11,7 +11,6 @@ CONFIG_TASK_IO_ACCOUNTING=y
11CONFIG_AUDIT=y 11CONFIG_AUDIT=y
12CONFIG_LOG_BUF_SHIFT=18 12CONFIG_LOG_BUF_SHIFT=18
13CONFIG_CGROUPS=y 13CONFIG_CGROUPS=y
14CONFIG_CGROUP_NS=y
15CONFIG_CGROUP_FREEZER=y 14CONFIG_CGROUP_FREEZER=y
16CONFIG_CPUSETS=y 15CONFIG_CPUSETS=y
17CONFIG_CGROUP_CPUACCT=y 16CONFIG_CGROUP_CPUACCT=y
diff --git a/arch/x86/include/asm/kgdb.h b/arch/x86/include/asm/kgdb.h
index 396f5b5fc4d7..77e95f54570a 100644
--- a/arch/x86/include/asm/kgdb.h
+++ b/arch/x86/include/asm/kgdb.h
@@ -77,6 +77,7 @@ static inline void arch_kgdb_breakpoint(void)
77} 77}
78#define BREAK_INSTR_SIZE 1 78#define BREAK_INSTR_SIZE 1
79#define CACHE_FLUSH_IS_SAFE 1 79#define CACHE_FLUSH_IS_SAFE 1
80#define GDB_ADJUSTS_BREAK_OFFSET
80 81
81extern int kgdb_ll_trap(int cmd, const char *str, 82extern int kgdb_ll_trap(int cmd, const char *str,
82 struct pt_regs *regs, long err, int trap, int sig); 83 struct pt_regs *regs, long err, int trap, int sig);
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 1babf8adecdf..94e7618fcac8 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -136,6 +136,7 @@ struct cpuinfo_x86;
136struct task_struct; 136struct task_struct;
137 137
138extern unsigned long profile_pc(struct pt_regs *regs); 138extern unsigned long profile_pc(struct pt_regs *regs);
139#define profile_pc profile_pc
139 140
140extern unsigned long 141extern unsigned long
141convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs); 142convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs);
@@ -202,20 +203,11 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
202#endif 203#endif
203} 204}
204 205
205static inline unsigned long instruction_pointer(struct pt_regs *regs) 206#define GET_IP(regs) ((regs)->ip)
206{ 207#define GET_FP(regs) ((regs)->bp)
207 return regs->ip; 208#define GET_USP(regs) ((regs)->sp)
208}
209
210static inline unsigned long frame_pointer(struct pt_regs *regs)
211{
212 return regs->bp;
213}
214 209
215static inline unsigned long user_stack_pointer(struct pt_regs *regs) 210#include <asm-generic/ptrace.h>
216{
217 return regs->sp;
218}
219 211
220/* Query offset/name of register from its name/offset */ 212/* Query offset/name of register from its name/offset */
221extern int regs_query_register_offset(const char *name); 213extern int regs_query_register_offset(const char *name);
diff --git a/arch/x86/include/asm/tsc.h b/arch/x86/include/asm/tsc.h
index 83e2efd181e2..9db5583b6d38 100644
--- a/arch/x86/include/asm/tsc.h
+++ b/arch/x86/include/asm/tsc.h
@@ -51,6 +51,10 @@ extern int unsynchronized_tsc(void);
51extern int check_tsc_unstable(void); 51extern int check_tsc_unstable(void);
52extern unsigned long native_calibrate_tsc(void); 52extern unsigned long native_calibrate_tsc(void);
53 53
54#ifdef CONFIG_X86_64
55extern cycles_t vread_tsc(void);
56#endif
57
54/* 58/*
55 * Boot-time check whether the TSCs are synchronized across 59 * Boot-time check whether the TSCs are synchronized across
56 * all CPUs/cores: 60 * all CPUs/cores:
diff --git a/arch/x86/include/asm/vdso.h b/arch/x86/include/asm/vdso.h
index 9064052b73de..bb0522850b74 100644
--- a/arch/x86/include/asm/vdso.h
+++ b/arch/x86/include/asm/vdso.h
@@ -1,20 +1,6 @@
1#ifndef _ASM_X86_VDSO_H 1#ifndef _ASM_X86_VDSO_H
2#define _ASM_X86_VDSO_H 2#define _ASM_X86_VDSO_H
3 3
4#ifdef CONFIG_X86_64
5extern const char VDSO64_PRELINK[];
6
7/*
8 * Given a pointer to the vDSO image, find the pointer to VDSO64_name
9 * as that symbol is defined in the vDSO sources or linker script.
10 */
11#define VDSO64_SYMBOL(base, name) \
12({ \
13 extern const char VDSO64_##name[]; \
14 (void *)(VDSO64_##name - VDSO64_PRELINK + (unsigned long)(base)); \
15})
16#endif
17
18#if defined CONFIG_X86_32 || defined CONFIG_COMPAT 4#if defined CONFIG_X86_32 || defined CONFIG_COMPAT
19extern const char VDSO32_PRELINK[]; 5extern const char VDSO32_PRELINK[];
20 6
diff --git a/arch/x86/include/asm/vgtod.h b/arch/x86/include/asm/vgtod.h
index 3d61e204826f..646b4c1ca695 100644
--- a/arch/x86/include/asm/vgtod.h
+++ b/arch/x86/include/asm/vgtod.h
@@ -23,8 +23,6 @@ struct vsyscall_gtod_data {
23 struct timespec wall_to_monotonic; 23 struct timespec wall_to_monotonic;
24 struct timespec wall_time_coarse; 24 struct timespec wall_time_coarse;
25}; 25};
26extern struct vsyscall_gtod_data __vsyscall_gtod_data
27__section_vsyscall_gtod_data;
28extern struct vsyscall_gtod_data vsyscall_gtod_data; 26extern struct vsyscall_gtod_data vsyscall_gtod_data;
29 27
30#endif /* _ASM_X86_VGTOD_H */ 28#endif /* _ASM_X86_VGTOD_H */
diff --git a/arch/x86/include/asm/vsyscall.h b/arch/x86/include/asm/vsyscall.h
index d0983d255fbd..d55597351f6a 100644
--- a/arch/x86/include/asm/vsyscall.h
+++ b/arch/x86/include/asm/vsyscall.h
@@ -16,27 +16,19 @@ enum vsyscall_num {
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17#include <linux/seqlock.h> 17#include <linux/seqlock.h>
18 18
19#define __section_vgetcpu_mode __attribute__ ((unused, __section__ (".vgetcpu_mode"), aligned(16)))
20#define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16)))
21
22/* Definitions for CONFIG_GENERIC_TIME definitions */ 19/* Definitions for CONFIG_GENERIC_TIME definitions */
23#define __section_vsyscall_gtod_data __attribute__ \
24 ((unused, __section__ (".vsyscall_gtod_data"),aligned(16)))
25#define __section_vsyscall_clock __attribute__ \
26 ((unused, __section__ (".vsyscall_clock"),aligned(16)))
27#define __vsyscall_fn \ 20#define __vsyscall_fn \
28 __attribute__ ((unused, __section__(".vsyscall_fn"))) notrace 21 __attribute__ ((unused, __section__(".vsyscall_fn"))) notrace
29 22
30#define VGETCPU_RDTSCP 1 23#define VGETCPU_RDTSCP 1
31#define VGETCPU_LSL 2 24#define VGETCPU_LSL 2
32 25
33extern int __vgetcpu_mode;
34extern volatile unsigned long __jiffies;
35
36/* kernel space (writeable) */ 26/* kernel space (writeable) */
37extern int vgetcpu_mode; 27extern int vgetcpu_mode;
38extern struct timezone sys_tz; 28extern struct timezone sys_tz;
39 29
30#include <asm/vvar.h>
31
40extern void map_vsyscall(void); 32extern void map_vsyscall(void);
41 33
42#endif /* __KERNEL__ */ 34#endif /* __KERNEL__ */
diff --git a/arch/x86/include/asm/vvar.h b/arch/x86/include/asm/vvar.h
new file mode 100644
index 000000000000..341b3559452b
--- /dev/null
+++ b/arch/x86/include/asm/vvar.h
@@ -0,0 +1,52 @@
1/*
2 * vvar.h: Shared vDSO/kernel variable declarations
3 * Copyright (c) 2011 Andy Lutomirski
4 * Subject to the GNU General Public License, version 2
5 *
6 * A handful of variables are accessible (read-only) from userspace
7 * code in the vsyscall page and the vdso. They are declared here.
8 * Some other file must define them with DEFINE_VVAR.
9 *
10 * In normal kernel code, they are used like any other variable.
11 * In user code, they are accessed through the VVAR macro.
12 *
13 * Each of these variables lives in the vsyscall page, and each
14 * one needs a unique offset within the little piece of the page
15 * reserved for vvars. Specify that offset in DECLARE_VVAR.
16 * (There are 896 bytes available. If you mess up, the linker will
17 * catch it.)
18 */
19
20/* Offset of vars within vsyscall page */
21#define VSYSCALL_VARS_OFFSET (3072 + 128)
22
23#if defined(__VVAR_KERNEL_LDS)
24
25/* The kernel linker script defines its own magic to put vvars in the
26 * right place.
27 */
28#define DECLARE_VVAR(offset, type, name) \
29 EMIT_VVAR(name, VSYSCALL_VARS_OFFSET + offset)
30
31#else
32
33#define DECLARE_VVAR(offset, type, name) \
34 static type const * const vvaraddr_ ## name = \
35 (void *)(VSYSCALL_START + VSYSCALL_VARS_OFFSET + (offset));
36
37#define DEFINE_VVAR(type, name) \
38 type __vvar_ ## name \
39 __attribute__((section(".vsyscall_var_" #name), aligned(16)))
40
41#define VVAR(name) (*vvaraddr_ ## name)
42
43#endif
44
45/* DECLARE_VVAR(offset, type, name) */
46
47DECLARE_VVAR(0, volatile unsigned long, jiffies)
48DECLARE_VVAR(8, int, vgetcpu_mode)
49DECLARE_VVAR(128, struct vsyscall_gtod_data, vsyscall_gtod_data)
50
51#undef DECLARE_VVAR
52#undef VSYSCALL_VARS_OFFSET
diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
index 8508bfe52296..d240ea950519 100644
--- a/arch/x86/include/asm/xen/hypercall.h
+++ b/arch/x86/include/asm/xen/hypercall.h
@@ -447,6 +447,13 @@ HYPERVISOR_hvm_op(int op, void *arg)
447 return _hypercall2(unsigned long, hvm_op, op, arg); 447 return _hypercall2(unsigned long, hvm_op, op, arg);
448} 448}
449 449
450static inline int
451HYPERVISOR_tmem_op(
452 struct tmem_op *op)
453{
454 return _hypercall1(int, tmem_op, op);
455}
456
450static inline void 457static inline void
451MULTI_fpu_taskswitch(struct multicall_entry *mcl, int set) 458MULTI_fpu_taskswitch(struct multicall_entry *mcl, int set)
452{ 459{
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 250806472a7e..f5abe3a245b8 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -8,7 +8,6 @@ CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE)
8 8
9ifdef CONFIG_FUNCTION_TRACER 9ifdef CONFIG_FUNCTION_TRACER
10# Do not profile debug and lowlevel utilities 10# Do not profile debug and lowlevel utilities
11CFLAGS_REMOVE_tsc.o = -pg
12CFLAGS_REMOVE_rtc.o = -pg 11CFLAGS_REMOVE_rtc.o = -pg
13CFLAGS_REMOVE_paravirt-spinlocks.o = -pg 12CFLAGS_REMOVE_paravirt-spinlocks.o = -pg
14CFLAGS_REMOVE_pvclock.o = -pg 13CFLAGS_REMOVE_pvclock.o = -pg
@@ -24,13 +23,16 @@ endif
24nostackp := $(call cc-option, -fno-stack-protector) 23nostackp := $(call cc-option, -fno-stack-protector)
25CFLAGS_vsyscall_64.o := $(PROFILING) -g0 $(nostackp) 24CFLAGS_vsyscall_64.o := $(PROFILING) -g0 $(nostackp)
26CFLAGS_hpet.o := $(nostackp) 25CFLAGS_hpet.o := $(nostackp)
27CFLAGS_tsc.o := $(nostackp) 26CFLAGS_vread_tsc_64.o := $(nostackp)
28CFLAGS_paravirt.o := $(nostackp) 27CFLAGS_paravirt.o := $(nostackp)
29GCOV_PROFILE_vsyscall_64.o := n 28GCOV_PROFILE_vsyscall_64.o := n
30GCOV_PROFILE_hpet.o := n 29GCOV_PROFILE_hpet.o := n
31GCOV_PROFILE_tsc.o := n 30GCOV_PROFILE_tsc.o := n
32GCOV_PROFILE_paravirt.o := n 31GCOV_PROFILE_paravirt.o := n
33 32
33# vread_tsc_64 is hot and should be fully optimized:
34CFLAGS_REMOVE_vread_tsc_64.o = -pg -fno-optimize-sibling-calls
35
34obj-y := process_$(BITS).o signal.o entry_$(BITS).o 36obj-y := process_$(BITS).o signal.o entry_$(BITS).o
35obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o 37obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
36obj-y += time.o ioport.o ldt.o dumpstack.o 38obj-y += time.o ioport.o ldt.o dumpstack.o
@@ -39,7 +41,7 @@ obj-$(CONFIG_IRQ_WORK) += irq_work.o
39obj-y += probe_roms.o 41obj-y += probe_roms.o
40obj-$(CONFIG_X86_32) += sys_i386_32.o i386_ksyms_32.o 42obj-$(CONFIG_X86_32) += sys_i386_32.o i386_ksyms_32.o
41obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o 43obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o
42obj-$(CONFIG_X86_64) += syscall_64.o vsyscall_64.o 44obj-$(CONFIG_X86_64) += syscall_64.o vsyscall_64.o vread_tsc_64.o
43obj-y += bootflag.o e820.o 45obj-y += bootflag.o e820.o
44obj-y += pci-dma.o quirks.o topology.o kdebugfs.o 46obj-y += pci-dma.o quirks.o topology.o kdebugfs.o
45obj-y += alternative.o i8253.o pci-nommu.o hw_breakpoint.o 47obj-y += alternative.o i8253.o pci-nommu.o hw_breakpoint.o
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
index 25a28a245937..00cbb272627f 100644
--- a/arch/x86/kernel/time.c
+++ b/arch/x86/kernel/time.c
@@ -23,7 +23,7 @@
23#include <asm/time.h> 23#include <asm/time.h>
24 24
25#ifdef CONFIG_X86_64 25#ifdef CONFIG_X86_64
26volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES; 26DEFINE_VVAR(volatile unsigned long, jiffies) = INITIAL_JIFFIES;
27#endif 27#endif
28 28
29unsigned long profile_pc(struct pt_regs *regs) 29unsigned long profile_pc(struct pt_regs *regs)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 9335bf7dd2e7..6cc6922262af 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -763,25 +763,6 @@ static cycle_t read_tsc(struct clocksource *cs)
763 ret : clocksource_tsc.cycle_last; 763 ret : clocksource_tsc.cycle_last;
764} 764}
765 765
766#ifdef CONFIG_X86_64
767static cycle_t __vsyscall_fn vread_tsc(void)
768{
769 cycle_t ret;
770
771 /*
772 * Surround the RDTSC by barriers, to make sure it's not
773 * speculated to outside the seqlock critical section and
774 * does not cause time warps:
775 */
776 rdtsc_barrier();
777 ret = (cycle_t)vget_cycles();
778 rdtsc_barrier();
779
780 return ret >= __vsyscall_gtod_data.clock.cycle_last ?
781 ret : __vsyscall_gtod_data.clock.cycle_last;
782}
783#endif
784
785static void resume_tsc(struct clocksource *cs) 766static void resume_tsc(struct clocksource *cs)
786{ 767{
787 clocksource_tsc.cycle_last = 0; 768 clocksource_tsc.cycle_last = 0;
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 61682f0ac264..89aed99aafce 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -161,6 +161,12 @@ SECTIONS
161 161
162#define VVIRT_OFFSET (VSYSCALL_ADDR - __vsyscall_0) 162#define VVIRT_OFFSET (VSYSCALL_ADDR - __vsyscall_0)
163#define VVIRT(x) (ADDR(x) - VVIRT_OFFSET) 163#define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)
164#define EMIT_VVAR(x, offset) .vsyscall_var_ ## x \
165 ADDR(.vsyscall_0) + offset \
166 : AT(VLOAD(.vsyscall_var_ ## x)) { \
167 *(.vsyscall_var_ ## x) \
168 } \
169 x = VVIRT(.vsyscall_var_ ## x);
164 170
165 . = ALIGN(4096); 171 . = ALIGN(4096);
166 __vsyscall_0 = .; 172 __vsyscall_0 = .;
@@ -175,18 +181,6 @@ SECTIONS
175 *(.vsyscall_fn) 181 *(.vsyscall_fn)
176 } 182 }
177 183
178 . = ALIGN(L1_CACHE_BYTES);
179 .vsyscall_gtod_data : AT(VLOAD(.vsyscall_gtod_data)) {
180 *(.vsyscall_gtod_data)
181 }
182
183 vsyscall_gtod_data = VVIRT(.vsyscall_gtod_data);
184 .vsyscall_clock : AT(VLOAD(.vsyscall_clock)) {
185 *(.vsyscall_clock)
186 }
187 vsyscall_clock = VVIRT(.vsyscall_clock);
188
189
190 .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT(VLOAD(.vsyscall_1)) { 184 .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT(VLOAD(.vsyscall_1)) {
191 *(.vsyscall_1) 185 *(.vsyscall_1)
192 } 186 }
@@ -194,21 +188,14 @@ SECTIONS
194 *(.vsyscall_2) 188 *(.vsyscall_2)
195 } 189 }
196 190
197 .vgetcpu_mode : AT(VLOAD(.vgetcpu_mode)) {
198 *(.vgetcpu_mode)
199 }
200 vgetcpu_mode = VVIRT(.vgetcpu_mode);
201
202 . = ALIGN(L1_CACHE_BYTES);
203 .jiffies : AT(VLOAD(.jiffies)) {
204 *(.jiffies)
205 }
206 jiffies = VVIRT(.jiffies);
207
208 .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3)) { 191 .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3)) {
209 *(.vsyscall_3) 192 *(.vsyscall_3)
210 } 193 }
211 194
195#define __VVAR_KERNEL_LDS
196#include <asm/vvar.h>
197#undef __VVAR_KERNEL_LDS
198
212 . = __vsyscall_0 + PAGE_SIZE; 199 . = __vsyscall_0 + PAGE_SIZE;
213 200
214#undef VSYSCALL_ADDR 201#undef VSYSCALL_ADDR
@@ -216,6 +203,7 @@ SECTIONS
216#undef VLOAD 203#undef VLOAD
217#undef VVIRT_OFFSET 204#undef VVIRT_OFFSET
218#undef VVIRT 205#undef VVIRT
206#undef EMIT_VVAR
219 207
220#endif /* CONFIG_X86_64 */ 208#endif /* CONFIG_X86_64 */
221 209
diff --git a/arch/x86/kernel/vread_tsc_64.c b/arch/x86/kernel/vread_tsc_64.c
new file mode 100644
index 000000000000..a81aa9e9894c
--- /dev/null
+++ b/arch/x86/kernel/vread_tsc_64.c
@@ -0,0 +1,36 @@
1/* This code runs in userspace. */
2
3#define DISABLE_BRANCH_PROFILING
4#include <asm/vgtod.h>
5
6notrace cycle_t __vsyscall_fn vread_tsc(void)
7{
8 cycle_t ret;
9 u64 last;
10
11 /*
12 * Empirically, a fence (of type that depends on the CPU)
13 * before rdtsc is enough to ensure that rdtsc is ordered
14 * with respect to loads. The various CPU manuals are unclear
15 * as to whether rdtsc can be reordered with later loads,
16 * but no one has ever seen it happen.
17 */
18 rdtsc_barrier();
19 ret = (cycle_t)vget_cycles();
20
21 last = VVAR(vsyscall_gtod_data).clock.cycle_last;
22
23 if (likely(ret >= last))
24 return ret;
25
26 /*
27 * GCC likes to generate cmov here, but this branch is extremely
28 * predictable (it's just a funciton of time and the likely is
29 * very likely) and there's a data dependence, so force GCC
30 * to generate a branch instead. I don't barrier() because
31 * we don't actually need a barrier, and if this function
32 * ever gets inlined it will generate worse code.
33 */
34 asm volatile ("");
35 return last;
36}
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index dcbb28c4b694..3e682184d76c 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -49,17 +49,10 @@
49 __attribute__ ((unused, __section__(".vsyscall_" #nr))) notrace 49 __attribute__ ((unused, __section__(".vsyscall_" #nr))) notrace
50#define __syscall_clobber "r11","cx","memory" 50#define __syscall_clobber "r11","cx","memory"
51 51
52/* 52DEFINE_VVAR(int, vgetcpu_mode);
53 * vsyscall_gtod_data contains data that is : 53DEFINE_VVAR(struct vsyscall_gtod_data, vsyscall_gtod_data) =
54 * - readonly from vsyscalls
55 * - written by timer interrupt or systcl (/proc/sys/kernel/vsyscall64)
56 * Try to keep this structure as small as possible to avoid cache line ping pongs
57 */
58int __vgetcpu_mode __section_vgetcpu_mode;
59
60struct vsyscall_gtod_data __vsyscall_gtod_data __section_vsyscall_gtod_data =
61{ 54{
62 .lock = SEQLOCK_UNLOCKED, 55 .lock = __SEQLOCK_UNLOCKED(__vsyscall_gtod_data.lock),
63 .sysctl_enabled = 1, 56 .sysctl_enabled = 1,
64}; 57};
65 58
@@ -97,7 +90,7 @@ void update_vsyscall(struct timespec *wall_time, struct timespec *wtm,
97 */ 90 */
98static __always_inline void do_get_tz(struct timezone * tz) 91static __always_inline void do_get_tz(struct timezone * tz)
99{ 92{
100 *tz = __vsyscall_gtod_data.sys_tz; 93 *tz = VVAR(vsyscall_gtod_data).sys_tz;
101} 94}
102 95
103static __always_inline int gettimeofday(struct timeval *tv, struct timezone *tz) 96static __always_inline int gettimeofday(struct timeval *tv, struct timezone *tz)
@@ -126,23 +119,24 @@ static __always_inline void do_vgettimeofday(struct timeval * tv)
126 unsigned long mult, shift, nsec; 119 unsigned long mult, shift, nsec;
127 cycle_t (*vread)(void); 120 cycle_t (*vread)(void);
128 do { 121 do {
129 seq = read_seqbegin(&__vsyscall_gtod_data.lock); 122 seq = read_seqbegin(&VVAR(vsyscall_gtod_data).lock);
130 123
131 vread = __vsyscall_gtod_data.clock.vread; 124 vread = VVAR(vsyscall_gtod_data).clock.vread;
132 if (unlikely(!__vsyscall_gtod_data.sysctl_enabled || !vread)) { 125 if (unlikely(!VVAR(vsyscall_gtod_data).sysctl_enabled ||
126 !vread)) {
133 gettimeofday(tv,NULL); 127 gettimeofday(tv,NULL);
134 return; 128 return;
135 } 129 }
136 130
137 now = vread(); 131 now = vread();
138 base = __vsyscall_gtod_data.clock.cycle_last; 132 base = VVAR(vsyscall_gtod_data).clock.cycle_last;
139 mask = __vsyscall_gtod_data.clock.mask; 133 mask = VVAR(vsyscall_gtod_data).clock.mask;
140 mult = __vsyscall_gtod_data.clock.mult; 134 mult = VVAR(vsyscall_gtod_data).clock.mult;
141 shift = __vsyscall_gtod_data.clock.shift; 135 shift = VVAR(vsyscall_gtod_data).clock.shift;
142 136
143 tv->tv_sec = __vsyscall_gtod_data.wall_time_sec; 137 tv->tv_sec = VVAR(vsyscall_gtod_data).wall_time_sec;
144 nsec = __vsyscall_gtod_data.wall_time_nsec; 138 nsec = VVAR(vsyscall_gtod_data).wall_time_nsec;
145 } while (read_seqretry(&__vsyscall_gtod_data.lock, seq)); 139 } while (read_seqretry(&VVAR(vsyscall_gtod_data).lock, seq));
146 140
147 /* calculate interval: */ 141 /* calculate interval: */
148 cycle_delta = (now - base) & mask; 142 cycle_delta = (now - base) & mask;
@@ -171,15 +165,15 @@ time_t __vsyscall(1) vtime(time_t *t)
171{ 165{
172 unsigned seq; 166 unsigned seq;
173 time_t result; 167 time_t result;
174 if (unlikely(!__vsyscall_gtod_data.sysctl_enabled)) 168 if (unlikely(!VVAR(vsyscall_gtod_data).sysctl_enabled))
175 return time_syscall(t); 169 return time_syscall(t);
176 170
177 do { 171 do {
178 seq = read_seqbegin(&__vsyscall_gtod_data.lock); 172 seq = read_seqbegin(&VVAR(vsyscall_gtod_data).lock);
179 173
180 result = __vsyscall_gtod_data.wall_time_sec; 174 result = VVAR(vsyscall_gtod_data).wall_time_sec;
181 175
182 } while (read_seqretry(&__vsyscall_gtod_data.lock, seq)); 176 } while (read_seqretry(&VVAR(vsyscall_gtod_data).lock, seq));
183 177
184 if (t) 178 if (t)
185 *t = result; 179 *t = result;
@@ -208,9 +202,9 @@ vgetcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
208 We do this here because otherwise user space would do it on 202 We do this here because otherwise user space would do it on
209 its own in a likely inferior way (no access to jiffies). 203 its own in a likely inferior way (no access to jiffies).
210 If you don't like it pass NULL. */ 204 If you don't like it pass NULL. */
211 if (tcache && tcache->blob[0] == (j = __jiffies)) { 205 if (tcache && tcache->blob[0] == (j = VVAR(jiffies))) {
212 p = tcache->blob[1]; 206 p = tcache->blob[1];
213 } else if (__vgetcpu_mode == VGETCPU_RDTSCP) { 207 } else if (VVAR(vgetcpu_mode) == VGETCPU_RDTSCP) {
214 /* Load per CPU data from RDTSCP */ 208 /* Load per CPU data from RDTSCP */
215 native_read_tscp(&p); 209 native_read_tscp(&p);
216 } else { 210 } else {
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index b6552b189bcd..bef0bc962400 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -11,7 +11,7 @@ vdso-install-$(VDSO32-y) += $(vdso32-images)
11 11
12 12
13# files to link into the vdso 13# files to link into the vdso
14vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vvar.o 14vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o
15 15
16# files to link into kernel 16# files to link into kernel
17obj-$(VDSO64-y) += vma.o vdso.o 17obj-$(VDSO64-y) += vma.o vdso.o
@@ -37,11 +37,24 @@ $(obj)/%.so: OBJCOPYFLAGS := -S
37$(obj)/%.so: $(obj)/%.so.dbg FORCE 37$(obj)/%.so: $(obj)/%.so.dbg FORCE
38 $(call if_changed,objcopy) 38 $(call if_changed,objcopy)
39 39
40#
41# Don't omit frame pointers for ease of userspace debugging, but do
42# optimize sibling calls.
43#
40CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \ 44CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \
41 $(filter -g%,$(KBUILD_CFLAGS)) $(call cc-option, -fno-stack-protector) 45 $(filter -g%,$(KBUILD_CFLAGS)) $(call cc-option, -fno-stack-protector) \
46 -fno-omit-frame-pointer -foptimize-sibling-calls
42 47
43$(vobjs): KBUILD_CFLAGS += $(CFL) 48$(vobjs): KBUILD_CFLAGS += $(CFL)
44 49
50#
51# vDSO code runs in userspace and -pg doesn't help with profiling anyway.
52#
53CFLAGS_REMOVE_vdso-note.o = -pg
54CFLAGS_REMOVE_vclock_gettime.o = -pg
55CFLAGS_REMOVE_vgetcpu.o = -pg
56CFLAGS_REMOVE_vvar.o = -pg
57
45targets += vdso-syms.lds 58targets += vdso-syms.lds
46obj-$(VDSO64-y) += vdso-syms.lds 59obj-$(VDSO64-y) += vdso-syms.lds
47 60
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index ee55754cc3c5..a724905fdae7 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -2,7 +2,7 @@
2 * Copyright 2006 Andi Kleen, SUSE Labs. 2 * Copyright 2006 Andi Kleen, SUSE Labs.
3 * Subject to the GNU Public License, v.2 3 * Subject to the GNU Public License, v.2
4 * 4 *
5 * Fast user context implementation of clock_gettime and gettimeofday. 5 * Fast user context implementation of clock_gettime, gettimeofday, and time.
6 * 6 *
7 * The code should have no internal unresolved relocations. 7 * The code should have no internal unresolved relocations.
8 * Check with readelf after changing. 8 * Check with readelf after changing.
@@ -22,9 +22,8 @@
22#include <asm/hpet.h> 22#include <asm/hpet.h>
23#include <asm/unistd.h> 23#include <asm/unistd.h>
24#include <asm/io.h> 24#include <asm/io.h>
25#include "vextern.h"
26 25
27#define gtod vdso_vsyscall_gtod_data 26#define gtod (&VVAR(vsyscall_gtod_data))
28 27
29notrace static long vdso_fallback_gettime(long clock, struct timespec *ts) 28notrace static long vdso_fallback_gettime(long clock, struct timespec *ts)
30{ 29{
@@ -56,22 +55,6 @@ notrace static noinline int do_realtime(struct timespec *ts)
56 return 0; 55 return 0;
57} 56}
58 57
59/* Copy of the version in kernel/time.c which we cannot directly access */
60notrace static void
61vset_normalized_timespec(struct timespec *ts, long sec, long nsec)
62{
63 while (nsec >= NSEC_PER_SEC) {
64 nsec -= NSEC_PER_SEC;
65 ++sec;
66 }
67 while (nsec < 0) {
68 nsec += NSEC_PER_SEC;
69 --sec;
70 }
71 ts->tv_sec = sec;
72 ts->tv_nsec = nsec;
73}
74
75notrace static noinline int do_monotonic(struct timespec *ts) 58notrace static noinline int do_monotonic(struct timespec *ts)
76{ 59{
77 unsigned long seq, ns, secs; 60 unsigned long seq, ns, secs;
@@ -82,7 +65,17 @@ notrace static noinline int do_monotonic(struct timespec *ts)
82 secs += gtod->wall_to_monotonic.tv_sec; 65 secs += gtod->wall_to_monotonic.tv_sec;
83 ns += gtod->wall_to_monotonic.tv_nsec; 66 ns += gtod->wall_to_monotonic.tv_nsec;
84 } while (unlikely(read_seqretry(&gtod->lock, seq))); 67 } while (unlikely(read_seqretry(&gtod->lock, seq)));
85 vset_normalized_timespec(ts, secs, ns); 68
69 /* wall_time_nsec, vgetns(), and wall_to_monotonic.tv_nsec
70 * are all guaranteed to be nonnegative.
71 */
72 while (ns >= NSEC_PER_SEC) {
73 ns -= NSEC_PER_SEC;
74 ++secs;
75 }
76 ts->tv_sec = secs;
77 ts->tv_nsec = ns;
78
86 return 0; 79 return 0;
87} 80}
88 81
@@ -107,7 +100,17 @@ notrace static noinline int do_monotonic_coarse(struct timespec *ts)
107 secs += gtod->wall_to_monotonic.tv_sec; 100 secs += gtod->wall_to_monotonic.tv_sec;
108 ns += gtod->wall_to_monotonic.tv_nsec; 101 ns += gtod->wall_to_monotonic.tv_nsec;
109 } while (unlikely(read_seqretry(&gtod->lock, seq))); 102 } while (unlikely(read_seqretry(&gtod->lock, seq)));
110 vset_normalized_timespec(ts, secs, ns); 103
104 /* wall_time_nsec and wall_to_monotonic.tv_nsec are
105 * guaranteed to be between 0 and NSEC_PER_SEC.
106 */
107 if (ns >= NSEC_PER_SEC) {
108 ns -= NSEC_PER_SEC;
109 ++secs;
110 }
111 ts->tv_sec = secs;
112 ts->tv_nsec = ns;
113
111 return 0; 114 return 0;
112} 115}
113 116
@@ -157,3 +160,32 @@ notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
157} 160}
158int gettimeofday(struct timeval *, struct timezone *) 161int gettimeofday(struct timeval *, struct timezone *)
159 __attribute__((weak, alias("__vdso_gettimeofday"))); 162 __attribute__((weak, alias("__vdso_gettimeofday")));
163
164/* This will break when the xtime seconds get inaccurate, but that is
165 * unlikely */
166
167static __always_inline long time_syscall(long *t)
168{
169 long secs;
170 asm volatile("syscall"
171 : "=a" (secs)
172 : "0" (__NR_time), "D" (t) : "cc", "r11", "cx", "memory");
173 return secs;
174}
175
176notrace time_t __vdso_time(time_t *t)
177{
178 time_t result;
179
180 if (unlikely(!VVAR(vsyscall_gtod_data).sysctl_enabled))
181 return time_syscall(t);
182
183 /* This is atomic on x86_64 so we don't need any locks. */
184 result = ACCESS_ONCE(VVAR(vsyscall_gtod_data).wall_time_sec);
185
186 if (t)
187 *t = result;
188 return result;
189}
190int time(time_t *t)
191 __attribute__((weak, alias("__vdso_time")));
diff --git a/arch/x86/vdso/vdso.lds.S b/arch/x86/vdso/vdso.lds.S
index 4e5dd3b4de7f..b96b2677cad8 100644
--- a/arch/x86/vdso/vdso.lds.S
+++ b/arch/x86/vdso/vdso.lds.S
@@ -23,15 +23,10 @@ VERSION {
23 __vdso_gettimeofday; 23 __vdso_gettimeofday;
24 getcpu; 24 getcpu;
25 __vdso_getcpu; 25 __vdso_getcpu;
26 time;
27 __vdso_time;
26 local: *; 28 local: *;
27 }; 29 };
28} 30}
29 31
30VDSO64_PRELINK = VDSO_PRELINK; 32VDSO64_PRELINK = VDSO_PRELINK;
31
32/*
33 * Define VDSO64_x for each VEXTERN(x), for use via VDSO64_SYMBOL.
34 */
35#define VEXTERN(x) VDSO64_ ## x = vdso_ ## x;
36#include "vextern.h"
37#undef VEXTERN
diff --git a/arch/x86/vdso/vextern.h b/arch/x86/vdso/vextern.h
deleted file mode 100644
index 1683ba2ae3e8..000000000000
--- a/arch/x86/vdso/vextern.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef VEXTERN
2#include <asm/vsyscall.h>
3#define VEXTERN(x) \
4 extern typeof(x) *vdso_ ## x __attribute__((visibility("hidden")));
5#endif
6
7#define VMAGIC 0xfeedbabeabcdefabUL
8
9/* Any kernel variables used in the vDSO must be exported in the main
10 kernel's vmlinux.lds.S/vsyscall.h/proper __section and
11 put into vextern.h and be referenced as a pointer with vdso prefix.
12 The main kernel later fills in the values. */
13
14VEXTERN(jiffies)
15VEXTERN(vgetcpu_mode)
16VEXTERN(vsyscall_gtod_data)
diff --git a/arch/x86/vdso/vgetcpu.c b/arch/x86/vdso/vgetcpu.c
index 9fbc6b20026b..5463ad558573 100644
--- a/arch/x86/vdso/vgetcpu.c
+++ b/arch/x86/vdso/vgetcpu.c
@@ -11,14 +11,13 @@
11#include <linux/time.h> 11#include <linux/time.h>
12#include <asm/vsyscall.h> 12#include <asm/vsyscall.h>
13#include <asm/vgtod.h> 13#include <asm/vgtod.h>
14#include "vextern.h"
15 14
16notrace long 15notrace long
17__vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused) 16__vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
18{ 17{
19 unsigned int p; 18 unsigned int p;
20 19
21 if (*vdso_vgetcpu_mode == VGETCPU_RDTSCP) { 20 if (VVAR(vgetcpu_mode) == VGETCPU_RDTSCP) {
22 /* Load per CPU data from RDTSCP */ 21 /* Load per CPU data from RDTSCP */
23 native_read_tscp(&p); 22 native_read_tscp(&p);
24 } else { 23 } else {
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c
index 4b5d26f108bb..7abd2be0f9b9 100644
--- a/arch/x86/vdso/vma.c
+++ b/arch/x86/vdso/vma.c
@@ -15,9 +15,6 @@
15#include <asm/proto.h> 15#include <asm/proto.h>
16#include <asm/vdso.h> 16#include <asm/vdso.h>
17 17
18#include "vextern.h" /* Just for VMAGIC. */
19#undef VEXTERN
20
21unsigned int __read_mostly vdso_enabled = 1; 18unsigned int __read_mostly vdso_enabled = 1;
22 19
23extern char vdso_start[], vdso_end[]; 20extern char vdso_start[], vdso_end[];
@@ -26,20 +23,10 @@ extern unsigned short vdso_sync_cpuid;
26static struct page **vdso_pages; 23static struct page **vdso_pages;
27static unsigned vdso_size; 24static unsigned vdso_size;
28 25
29static inline void *var_ref(void *p, char *name)
30{
31 if (*(void **)p != (void *)VMAGIC) {
32 printk("VDSO: variable %s broken\n", name);
33 vdso_enabled = 0;
34 }
35 return p;
36}
37
38static int __init init_vdso_vars(void) 26static int __init init_vdso_vars(void)
39{ 27{
40 int npages = (vdso_end - vdso_start + PAGE_SIZE - 1) / PAGE_SIZE; 28 int npages = (vdso_end - vdso_start + PAGE_SIZE - 1) / PAGE_SIZE;
41 int i; 29 int i;
42 char *vbase;
43 30
44 vdso_size = npages << PAGE_SHIFT; 31 vdso_size = npages << PAGE_SHIFT;
45 vdso_pages = kmalloc(sizeof(struct page *) * npages, GFP_KERNEL); 32 vdso_pages = kmalloc(sizeof(struct page *) * npages, GFP_KERNEL);
@@ -54,20 +41,6 @@ static int __init init_vdso_vars(void)
54 copy_page(page_address(p), vdso_start + i*PAGE_SIZE); 41 copy_page(page_address(p), vdso_start + i*PAGE_SIZE);
55 } 42 }
56 43
57 vbase = vmap(vdso_pages, npages, 0, PAGE_KERNEL);
58 if (!vbase)
59 goto oom;
60
61 if (memcmp(vbase, "\177ELF", 4)) {
62 printk("VDSO: I'm broken; not ELF\n");
63 vdso_enabled = 0;
64 }
65
66#define VEXTERN(x) \
67 *(typeof(__ ## x) **) var_ref(VDSO64_SYMBOL(vbase, x), #x) = &__ ## x;
68#include "vextern.h"
69#undef VEXTERN
70 vunmap(vbase);
71 return 0; 44 return 0;
72 45
73 oom: 46 oom:
diff --git a/arch/x86/vdso/vvar.c b/arch/x86/vdso/vvar.c
deleted file mode 100644
index 1b7e703684f9..000000000000
--- a/arch/x86/vdso/vvar.c
+++ /dev/null
@@ -1,12 +0,0 @@
1/* Define pointer to external vDSO variables.
2 These are part of the vDSO. The kernel fills in the real addresses
3 at boot time. This is done because when the vdso is linked the
4 kernel isn't yet and we don't know the final addresses. */
5#include <linux/kernel.h>
6#include <linux/time.h>
7#include <asm/vsyscall.h>
8#include <asm/timex.h>
9#include <asm/vgtod.h>
10
11#define VEXTERN(x) typeof (__ ## x) *const vdso_ ## x = (void *)VMAGIC;
12#include "vextern.h"
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 02d752460371..dc708dcc62f1 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -75,67 +75,12 @@
75#include "mmu.h" 75#include "mmu.h"
76#include "debugfs.h" 76#include "debugfs.h"
77 77
78#define MMU_UPDATE_HISTO 30
79
80/* 78/*
81 * Protects atomic reservation decrease/increase against concurrent increases. 79 * Protects atomic reservation decrease/increase against concurrent increases.
82 * Also protects non-atomic updates of current_pages and balloon lists. 80 * Also protects non-atomic updates of current_pages and balloon lists.
83 */ 81 */
84DEFINE_SPINLOCK(xen_reservation_lock); 82DEFINE_SPINLOCK(xen_reservation_lock);
85 83
86#ifdef CONFIG_XEN_DEBUG_FS
87
88static struct {
89 u32 pgd_update;
90 u32 pgd_update_pinned;
91 u32 pgd_update_batched;
92
93 u32 pud_update;
94 u32 pud_update_pinned;
95 u32 pud_update_batched;
96
97 u32 pmd_update;
98 u32 pmd_update_pinned;
99 u32 pmd_update_batched;
100
101 u32 pte_update;
102 u32 pte_update_pinned;
103 u32 pte_update_batched;
104
105 u32 mmu_update;
106 u32 mmu_update_extended;
107 u32 mmu_update_histo[MMU_UPDATE_HISTO];
108
109 u32 prot_commit;
110 u32 prot_commit_batched;
111
112 u32 set_pte_at;
113 u32 set_pte_at_batched;
114 u32 set_pte_at_pinned;
115 u32 set_pte_at_current;
116 u32 set_pte_at_kernel;
117} mmu_stats;
118
119static u8 zero_stats;
120
121static inline void check_zero(void)
122{
123 if (unlikely(zero_stats)) {
124 memset(&mmu_stats, 0, sizeof(mmu_stats));
125 zero_stats = 0;
126 }
127}
128
129#define ADD_STATS(elem, val) \
130 do { check_zero(); mmu_stats.elem += (val); } while(0)
131
132#else /* !CONFIG_XEN_DEBUG_FS */
133
134#define ADD_STATS(elem, val) do { (void)(val); } while(0)
135
136#endif /* CONFIG_XEN_DEBUG_FS */
137
138
139/* 84/*
140 * Identity map, in addition to plain kernel map. This needs to be 85 * Identity map, in addition to plain kernel map. This needs to be
141 * large enough to allocate page table pages to allocate the rest. 86 * large enough to allocate page table pages to allocate the rest.
@@ -243,11 +188,6 @@ static bool xen_page_pinned(void *ptr)
243 return PagePinned(page); 188 return PagePinned(page);
244} 189}
245 190
246static bool xen_iomap_pte(pte_t pte)
247{
248 return pte_flags(pte) & _PAGE_IOMAP;
249}
250
251void xen_set_domain_pte(pte_t *ptep, pte_t pteval, unsigned domid) 191void xen_set_domain_pte(pte_t *ptep, pte_t pteval, unsigned domid)
252{ 192{
253 struct multicall_space mcs; 193 struct multicall_space mcs;
@@ -257,7 +197,7 @@ void xen_set_domain_pte(pte_t *ptep, pte_t pteval, unsigned domid)
257 u = mcs.args; 197 u = mcs.args;
258 198
259 /* ptep might be kmapped when using 32-bit HIGHPTE */ 199 /* ptep might be kmapped when using 32-bit HIGHPTE */
260 u->ptr = arbitrary_virt_to_machine(ptep).maddr; 200 u->ptr = virt_to_machine(ptep).maddr;
261 u->val = pte_val_ma(pteval); 201 u->val = pte_val_ma(pteval);
262 202
263 MULTI_mmu_update(mcs.mc, mcs.args, 1, NULL, domid); 203 MULTI_mmu_update(mcs.mc, mcs.args, 1, NULL, domid);
@@ -266,11 +206,6 @@ void xen_set_domain_pte(pte_t *ptep, pte_t pteval, unsigned domid)
266} 206}
267EXPORT_SYMBOL_GPL(xen_set_domain_pte); 207EXPORT_SYMBOL_GPL(xen_set_domain_pte);
268 208
269static void xen_set_iomap_pte(pte_t *ptep, pte_t pteval)
270{
271 xen_set_domain_pte(ptep, pteval, DOMID_IO);
272}
273
274static void xen_extend_mmu_update(const struct mmu_update *update) 209static void xen_extend_mmu_update(const struct mmu_update *update)
275{ 210{
276 struct multicall_space mcs; 211 struct multicall_space mcs;
@@ -279,27 +214,17 @@ static void xen_extend_mmu_update(const struct mmu_update *update)
279 mcs = xen_mc_extend_args(__HYPERVISOR_mmu_update, sizeof(*u)); 214 mcs = xen_mc_extend_args(__HYPERVISOR_mmu_update, sizeof(*u));
280 215
281 if (mcs.mc != NULL) { 216 if (mcs.mc != NULL) {
282 ADD_STATS(mmu_update_extended, 1);
283 ADD_STATS(mmu_update_histo[mcs.mc->args[1]], -1);
284
285 mcs.mc->args[1]++; 217 mcs.mc->args[1]++;
286
287 if (mcs.mc->args[1] < MMU_UPDATE_HISTO)
288 ADD_STATS(mmu_update_histo[mcs.mc->args[1]], 1);
289 else
290 ADD_STATS(mmu_update_histo[0], 1);
291 } else { 218 } else {
292 ADD_STATS(mmu_update, 1);
293 mcs = __xen_mc_entry(sizeof(*u)); 219 mcs = __xen_mc_entry(sizeof(*u));
294 MULTI_mmu_update(mcs.mc, mcs.args, 1, NULL, DOMID_SELF); 220 MULTI_mmu_update(mcs.mc, mcs.args, 1, NULL, DOMID_SELF);
295 ADD_STATS(mmu_update_histo[1], 1);
296 } 221 }
297 222
298 u = mcs.args; 223 u = mcs.args;
299 *u = *update; 224 *u = *update;
300} 225}
301 226
302void xen_set_pmd_hyper(pmd_t *ptr, pmd_t val) 227static void xen_set_pmd_hyper(pmd_t *ptr, pmd_t val)
303{ 228{
304 struct mmu_update u; 229 struct mmu_update u;
305 230
@@ -312,17 +237,13 @@ void xen_set_pmd_hyper(pmd_t *ptr, pmd_t val)
312 u.val = pmd_val_ma(val); 237 u.val = pmd_val_ma(val);
313 xen_extend_mmu_update(&u); 238 xen_extend_mmu_update(&u);
314 239
315 ADD_STATS(pmd_update_batched, paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU);
316
317 xen_mc_issue(PARAVIRT_LAZY_MMU); 240 xen_mc_issue(PARAVIRT_LAZY_MMU);
318 241
319 preempt_enable(); 242 preempt_enable();
320} 243}
321 244
322void xen_set_pmd(pmd_t *ptr, pmd_t val) 245static void xen_set_pmd(pmd_t *ptr, pmd_t val)
323{ 246{
324 ADD_STATS(pmd_update, 1);
325
326 /* If page is not pinned, we can just update the entry 247 /* If page is not pinned, we can just update the entry
327 directly */ 248 directly */
328 if (!xen_page_pinned(ptr)) { 249 if (!xen_page_pinned(ptr)) {
@@ -330,8 +251,6 @@ void xen_set_pmd(pmd_t *ptr, pmd_t val)
330 return; 251 return;
331 } 252 }
332 253
333 ADD_STATS(pmd_update_pinned, 1);
334
335 xen_set_pmd_hyper(ptr, val); 254 xen_set_pmd_hyper(ptr, val);
336} 255}
337 256
@@ -344,35 +263,34 @@ void set_pte_mfn(unsigned long vaddr, unsigned long mfn, pgprot_t flags)
344 set_pte_vaddr(vaddr, mfn_pte(mfn, flags)); 263 set_pte_vaddr(vaddr, mfn_pte(mfn, flags));
345} 264}
346 265
347void xen_set_pte_at(struct mm_struct *mm, unsigned long addr, 266static bool xen_batched_set_pte(pte_t *ptep, pte_t pteval)
348 pte_t *ptep, pte_t pteval)
349{ 267{
350 if (xen_iomap_pte(pteval)) { 268 struct mmu_update u;
351 xen_set_iomap_pte(ptep, pteval);
352 goto out;
353 }
354 269
355 ADD_STATS(set_pte_at, 1); 270 if (paravirt_get_lazy_mode() != PARAVIRT_LAZY_MMU)
356// ADD_STATS(set_pte_at_pinned, xen_page_pinned(ptep)); 271 return false;
357 ADD_STATS(set_pte_at_current, mm == current->mm);
358 ADD_STATS(set_pte_at_kernel, mm == &init_mm);
359 272
360 if (mm == current->mm || mm == &init_mm) { 273 xen_mc_batch();
361 if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) {
362 struct multicall_space mcs;
363 mcs = xen_mc_entry(0);
364 274
365 MULTI_update_va_mapping(mcs.mc, addr, pteval, 0); 275 u.ptr = virt_to_machine(ptep).maddr | MMU_NORMAL_PT_UPDATE;
366 ADD_STATS(set_pte_at_batched, 1); 276 u.val = pte_val_ma(pteval);
367 xen_mc_issue(PARAVIRT_LAZY_MMU); 277 xen_extend_mmu_update(&u);
368 goto out; 278
369 } else 279 xen_mc_issue(PARAVIRT_LAZY_MMU);
370 if (HYPERVISOR_update_va_mapping(addr, pteval, 0) == 0)
371 goto out;
372 }
373 xen_set_pte(ptep, pteval);
374 280
375out: return; 281 return true;
282}
283
284static void xen_set_pte(pte_t *ptep, pte_t pteval)
285{
286 if (!xen_batched_set_pte(ptep, pteval))
287 native_set_pte(ptep, pteval);
288}
289
290static void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
291 pte_t *ptep, pte_t pteval)
292{
293 xen_set_pte(ptep, pteval);
376} 294}
377 295
378pte_t xen_ptep_modify_prot_start(struct mm_struct *mm, 296pte_t xen_ptep_modify_prot_start(struct mm_struct *mm,
@@ -389,13 +307,10 @@ void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
389 307
390 xen_mc_batch(); 308 xen_mc_batch();
391 309
392 u.ptr = arbitrary_virt_to_machine(ptep).maddr | MMU_PT_UPDATE_PRESERVE_AD; 310 u.ptr = virt_to_machine(ptep).maddr | MMU_PT_UPDATE_PRESERVE_AD;
393 u.val = pte_val_ma(pte); 311 u.val = pte_val_ma(pte);
394 xen_extend_mmu_update(&u); 312 xen_extend_mmu_update(&u);
395 313
396 ADD_STATS(prot_commit, 1);
397 ADD_STATS(prot_commit_batched, paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU);
398
399 xen_mc_issue(PARAVIRT_LAZY_MMU); 314 xen_mc_issue(PARAVIRT_LAZY_MMU);
400} 315}
401 316
@@ -463,7 +378,7 @@ static pteval_t iomap_pte(pteval_t val)
463 return val; 378 return val;
464} 379}
465 380
466pteval_t xen_pte_val(pte_t pte) 381static pteval_t xen_pte_val(pte_t pte)
467{ 382{
468 pteval_t pteval = pte.pte; 383 pteval_t pteval = pte.pte;
469 384
@@ -480,7 +395,7 @@ pteval_t xen_pte_val(pte_t pte)
480} 395}
481PV_CALLEE_SAVE_REGS_THUNK(xen_pte_val); 396PV_CALLEE_SAVE_REGS_THUNK(xen_pte_val);
482 397
483pgdval_t xen_pgd_val(pgd_t pgd) 398static pgdval_t xen_pgd_val(pgd_t pgd)
484{ 399{
485 return pte_mfn_to_pfn(pgd.pgd); 400 return pte_mfn_to_pfn(pgd.pgd);
486} 401}
@@ -511,7 +426,7 @@ void xen_set_pat(u64 pat)
511 WARN_ON(pat != 0x0007010600070106ull); 426 WARN_ON(pat != 0x0007010600070106ull);
512} 427}
513 428
514pte_t xen_make_pte(pteval_t pte) 429static pte_t xen_make_pte(pteval_t pte)
515{ 430{
516 phys_addr_t addr = (pte & PTE_PFN_MASK); 431 phys_addr_t addr = (pte & PTE_PFN_MASK);
517 432
@@ -581,20 +496,20 @@ pte_t xen_make_pte_debug(pteval_t pte)
581PV_CALLEE_SAVE_REGS_THUNK(xen_make_pte_debug); 496PV_CALLEE_SAVE_REGS_THUNK(xen_make_pte_debug);
582#endif 497#endif
583 498
584pgd_t xen_make_pgd(pgdval_t pgd) 499static pgd_t xen_make_pgd(pgdval_t pgd)
585{ 500{
586 pgd = pte_pfn_to_mfn(pgd); 501 pgd = pte_pfn_to_mfn(pgd);
587 return native_make_pgd(pgd); 502 return native_make_pgd(pgd);
588} 503}
589PV_CALLEE_SAVE_REGS_THUNK(xen_make_pgd); 504PV_CALLEE_SAVE_REGS_THUNK(xen_make_pgd);
590 505
591pmdval_t xen_pmd_val(pmd_t pmd) 506static pmdval_t xen_pmd_val(pmd_t pmd)
592{ 507{
593 return pte_mfn_to_pfn(pmd.pmd); 508 return pte_mfn_to_pfn(pmd.pmd);
594} 509}
595PV_CALLEE_SAVE_REGS_THUNK(xen_pmd_val); 510PV_CALLEE_SAVE_REGS_THUNK(xen_pmd_val);
596 511
597void xen_set_pud_hyper(pud_t *ptr, pud_t val) 512static void xen_set_pud_hyper(pud_t *ptr, pud_t val)
598{ 513{
599 struct mmu_update u; 514 struct mmu_update u;
600 515
@@ -607,17 +522,13 @@ void xen_set_pud_hyper(pud_t *ptr, pud_t val)
607 u.val = pud_val_ma(val); 522 u.val = pud_val_ma(val);
608 xen_extend_mmu_update(&u); 523 xen_extend_mmu_update(&u);
609 524
610 ADD_STATS(pud_update_batched, paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU);
611
612 xen_mc_issue(PARAVIRT_LAZY_MMU); 525 xen_mc_issue(PARAVIRT_LAZY_MMU);
613 526
614 preempt_enable(); 527 preempt_enable();
615} 528}
616 529
617void xen_set_pud(pud_t *ptr, pud_t val) 530static void xen_set_pud(pud_t *ptr, pud_t val)
618{ 531{
619 ADD_STATS(pud_update, 1);
620
621 /* If page is not pinned, we can just update the entry 532 /* If page is not pinned, we can just update the entry
622 directly */ 533 directly */
623 if (!xen_page_pinned(ptr)) { 534 if (!xen_page_pinned(ptr)) {
@@ -625,56 +536,28 @@ void xen_set_pud(pud_t *ptr, pud_t val)
625 return; 536 return;
626 } 537 }
627 538
628 ADD_STATS(pud_update_pinned, 1);
629
630 xen_set_pud_hyper(ptr, val); 539 xen_set_pud_hyper(ptr, val);
631} 540}
632 541
633void xen_set_pte(pte_t *ptep, pte_t pte)
634{
635 if (xen_iomap_pte(pte)) {
636 xen_set_iomap_pte(ptep, pte);
637 return;
638 }
639
640 ADD_STATS(pte_update, 1);
641// ADD_STATS(pte_update_pinned, xen_page_pinned(ptep));
642 ADD_STATS(pte_update_batched, paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU);
643
644#ifdef CONFIG_X86_PAE 542#ifdef CONFIG_X86_PAE
645 ptep->pte_high = pte.pte_high; 543static void xen_set_pte_atomic(pte_t *ptep, pte_t pte)
646 smp_wmb();
647 ptep->pte_low = pte.pte_low;
648#else
649 *ptep = pte;
650#endif
651}
652
653#ifdef CONFIG_X86_PAE
654void xen_set_pte_atomic(pte_t *ptep, pte_t pte)
655{ 544{
656 if (xen_iomap_pte(pte)) {
657 xen_set_iomap_pte(ptep, pte);
658 return;
659 }
660
661 set_64bit((u64 *)ptep, native_pte_val(pte)); 545 set_64bit((u64 *)ptep, native_pte_val(pte));
662} 546}
663 547
664void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 548static void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
665{ 549{
666 ptep->pte_low = 0; 550 if (!xen_batched_set_pte(ptep, native_make_pte(0)))
667 smp_wmb(); /* make sure low gets written first */ 551 native_pte_clear(mm, addr, ptep);
668 ptep->pte_high = 0;
669} 552}
670 553
671void xen_pmd_clear(pmd_t *pmdp) 554static void xen_pmd_clear(pmd_t *pmdp)
672{ 555{
673 set_pmd(pmdp, __pmd(0)); 556 set_pmd(pmdp, __pmd(0));
674} 557}
675#endif /* CONFIG_X86_PAE */ 558#endif /* CONFIG_X86_PAE */
676 559
677pmd_t xen_make_pmd(pmdval_t pmd) 560static pmd_t xen_make_pmd(pmdval_t pmd)
678{ 561{
679 pmd = pte_pfn_to_mfn(pmd); 562 pmd = pte_pfn_to_mfn(pmd);
680 return native_make_pmd(pmd); 563 return native_make_pmd(pmd);
@@ -682,13 +565,13 @@ pmd_t xen_make_pmd(pmdval_t pmd)
682PV_CALLEE_SAVE_REGS_THUNK(xen_make_pmd); 565PV_CALLEE_SAVE_REGS_THUNK(xen_make_pmd);
683 566
684#if PAGETABLE_LEVELS == 4 567#if PAGETABLE_LEVELS == 4
685pudval_t xen_pud_val(pud_t pud) 568static pudval_t xen_pud_val(pud_t pud)
686{ 569{
687 return pte_mfn_to_pfn(pud.pud); 570 return pte_mfn_to_pfn(pud.pud);
688} 571}
689PV_CALLEE_SAVE_REGS_THUNK(xen_pud_val); 572PV_CALLEE_SAVE_REGS_THUNK(xen_pud_val);
690 573
691pud_t xen_make_pud(pudval_t pud) 574static pud_t xen_make_pud(pudval_t pud)
692{ 575{
693 pud = pte_pfn_to_mfn(pud); 576 pud = pte_pfn_to_mfn(pud);
694 577
@@ -696,7 +579,7 @@ pud_t xen_make_pud(pudval_t pud)
696} 579}
697PV_CALLEE_SAVE_REGS_THUNK(xen_make_pud); 580PV_CALLEE_SAVE_REGS_THUNK(xen_make_pud);
698 581
699pgd_t *xen_get_user_pgd(pgd_t *pgd) 582static pgd_t *xen_get_user_pgd(pgd_t *pgd)
700{ 583{
701 pgd_t *pgd_page = (pgd_t *)(((unsigned long)pgd) & PAGE_MASK); 584 pgd_t *pgd_page = (pgd_t *)(((unsigned long)pgd) & PAGE_MASK);
702 unsigned offset = pgd - pgd_page; 585 unsigned offset = pgd - pgd_page;
@@ -728,7 +611,7 @@ static void __xen_set_pgd_hyper(pgd_t *ptr, pgd_t val)
728 * 2. It is always pinned 611 * 2. It is always pinned
729 * 3. It has no user pagetable attached to it 612 * 3. It has no user pagetable attached to it
730 */ 613 */
731void __init xen_set_pgd_hyper(pgd_t *ptr, pgd_t val) 614static void __init xen_set_pgd_hyper(pgd_t *ptr, pgd_t val)
732{ 615{
733 preempt_disable(); 616 preempt_disable();
734 617
@@ -741,12 +624,10 @@ void __init xen_set_pgd_hyper(pgd_t *ptr, pgd_t val)
741 preempt_enable(); 624 preempt_enable();
742} 625}
743 626
744void xen_set_pgd(pgd_t *ptr, pgd_t val) 627static void xen_set_pgd(pgd_t *ptr, pgd_t val)
745{ 628{
746 pgd_t *user_ptr = xen_get_user_pgd(ptr); 629 pgd_t *user_ptr = xen_get_user_pgd(ptr);
747 630
748 ADD_STATS(pgd_update, 1);
749
750 /* If page is not pinned, we can just update the entry 631 /* If page is not pinned, we can just update the entry
751 directly */ 632 directly */
752 if (!xen_page_pinned(ptr)) { 633 if (!xen_page_pinned(ptr)) {
@@ -758,9 +639,6 @@ void xen_set_pgd(pgd_t *ptr, pgd_t val)
758 return; 639 return;
759 } 640 }
760 641
761 ADD_STATS(pgd_update_pinned, 1);
762 ADD_STATS(pgd_update_batched, paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU);
763
764 /* If it's pinned, then we can at least batch the kernel and 642 /* If it's pinned, then we can at least batch the kernel and
765 user updates together. */ 643 user updates together. */
766 xen_mc_batch(); 644 xen_mc_batch();
@@ -1162,14 +1040,14 @@ void xen_mm_unpin_all(void)
1162 spin_unlock(&pgd_lock); 1040 spin_unlock(&pgd_lock);
1163} 1041}
1164 1042
1165void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next) 1043static void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next)
1166{ 1044{
1167 spin_lock(&next->page_table_lock); 1045 spin_lock(&next->page_table_lock);
1168 xen_pgd_pin(next); 1046 xen_pgd_pin(next);
1169 spin_unlock(&next->page_table_lock); 1047 spin_unlock(&next->page_table_lock);
1170} 1048}
1171 1049
1172void xen_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) 1050static void xen_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm)
1173{ 1051{
1174 spin_lock(&mm->page_table_lock); 1052 spin_lock(&mm->page_table_lock);
1175 xen_pgd_pin(mm); 1053 xen_pgd_pin(mm);
@@ -1256,7 +1134,7 @@ static void xen_drop_mm_ref(struct mm_struct *mm)
1256 * pagetable because of lazy tlb flushing. This means we need need to 1134 * pagetable because of lazy tlb flushing. This means we need need to
1257 * switch all CPUs off this pagetable before we can unpin it. 1135 * switch all CPUs off this pagetable before we can unpin it.
1258 */ 1136 */
1259void xen_exit_mmap(struct mm_struct *mm) 1137static void xen_exit_mmap(struct mm_struct *mm)
1260{ 1138{
1261 get_cpu(); /* make sure we don't move around */ 1139 get_cpu(); /* make sure we don't move around */
1262 xen_drop_mm_ref(mm); 1140 xen_drop_mm_ref(mm);
@@ -2371,7 +2249,7 @@ static int remap_area_mfn_pte_fn(pte_t *ptep, pgtable_t token,
2371 struct remap_data *rmd = data; 2249 struct remap_data *rmd = data;
2372 pte_t pte = pte_mkspecial(pfn_pte(rmd->mfn++, rmd->prot)); 2250 pte_t pte = pte_mkspecial(pfn_pte(rmd->mfn++, rmd->prot));
2373 2251
2374 rmd->mmu_update->ptr = arbitrary_virt_to_machine(ptep).maddr; 2252 rmd->mmu_update->ptr = virt_to_machine(ptep).maddr;
2375 rmd->mmu_update->val = pte_val_ma(pte); 2253 rmd->mmu_update->val = pte_val_ma(pte);
2376 rmd->mmu_update++; 2254 rmd->mmu_update++;
2377 2255
@@ -2425,7 +2303,6 @@ out:
2425EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range); 2303EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range);
2426 2304
2427#ifdef CONFIG_XEN_DEBUG_FS 2305#ifdef CONFIG_XEN_DEBUG_FS
2428
2429static int p2m_dump_open(struct inode *inode, struct file *filp) 2306static int p2m_dump_open(struct inode *inode, struct file *filp)
2430{ 2307{
2431 return single_open(filp, p2m_dump_show, NULL); 2308 return single_open(filp, p2m_dump_show, NULL);
@@ -2437,65 +2314,4 @@ static const struct file_operations p2m_dump_fops = {
2437 .llseek = seq_lseek, 2314 .llseek = seq_lseek,
2438 .release = single_release, 2315 .release = single_release,
2439}; 2316};
2440 2317#endif /* CONFIG_XEN_DEBUG_FS */
2441static struct dentry *d_mmu_debug;
2442
2443static int __init xen_mmu_debugfs(void)
2444{
2445 struct dentry *d_xen = xen_init_debugfs();
2446
2447 if (d_xen == NULL)
2448 return -ENOMEM;
2449
2450 d_mmu_debug = debugfs_create_dir("mmu", d_xen);
2451
2452 debugfs_create_u8("zero_stats", 0644, d_mmu_debug, &zero_stats);
2453
2454 debugfs_create_u32("pgd_update", 0444, d_mmu_debug, &mmu_stats.pgd_update);
2455 debugfs_create_u32("pgd_update_pinned", 0444, d_mmu_debug,
2456 &mmu_stats.pgd_update_pinned);
2457 debugfs_create_u32("pgd_update_batched", 0444, d_mmu_debug,
2458 &mmu_stats.pgd_update_pinned);
2459
2460 debugfs_create_u32("pud_update", 0444, d_mmu_debug, &mmu_stats.pud_update);
2461 debugfs_create_u32("pud_update_pinned", 0444, d_mmu_debug,
2462 &mmu_stats.pud_update_pinned);
2463 debugfs_create_u32("pud_update_batched", 0444, d_mmu_debug,
2464 &mmu_stats.pud_update_pinned);
2465
2466 debugfs_create_u32("pmd_update", 0444, d_mmu_debug, &mmu_stats.pmd_update);
2467 debugfs_create_u32("pmd_update_pinned", 0444, d_mmu_debug,
2468 &mmu_stats.pmd_update_pinned);
2469 debugfs_create_u32("pmd_update_batched", 0444, d_mmu_debug,
2470 &mmu_stats.pmd_update_pinned);
2471
2472 debugfs_create_u32("pte_update", 0444, d_mmu_debug, &mmu_stats.pte_update);
2473// debugfs_create_u32("pte_update_pinned", 0444, d_mmu_debug,
2474// &mmu_stats.pte_update_pinned);
2475 debugfs_create_u32("pte_update_batched", 0444, d_mmu_debug,
2476 &mmu_stats.pte_update_pinned);
2477
2478 debugfs_create_u32("mmu_update", 0444, d_mmu_debug, &mmu_stats.mmu_update);
2479 debugfs_create_u32("mmu_update_extended", 0444, d_mmu_debug,
2480 &mmu_stats.mmu_update_extended);
2481 xen_debugfs_create_u32_array("mmu_update_histo", 0444, d_mmu_debug,
2482 mmu_stats.mmu_update_histo, 20);
2483
2484 debugfs_create_u32("set_pte_at", 0444, d_mmu_debug, &mmu_stats.set_pte_at);
2485 debugfs_create_u32("set_pte_at_batched", 0444, d_mmu_debug,
2486 &mmu_stats.set_pte_at_batched);
2487 debugfs_create_u32("set_pte_at_current", 0444, d_mmu_debug,
2488 &mmu_stats.set_pte_at_current);
2489 debugfs_create_u32("set_pte_at_kernel", 0444, d_mmu_debug,
2490 &mmu_stats.set_pte_at_kernel);
2491
2492 debugfs_create_u32("prot_commit", 0444, d_mmu_debug, &mmu_stats.prot_commit);
2493 debugfs_create_u32("prot_commit_batched", 0444, d_mmu_debug,
2494 &mmu_stats.prot_commit_batched);
2495
2496 debugfs_create_file("p2m", 0600, d_mmu_debug, NULL, &p2m_dump_fops);
2497 return 0;
2498}
2499fs_initcall(xen_mmu_debugfs);
2500
2501#endif /* CONFIG_XEN_DEBUG_FS */
diff --git a/arch/x86/xen/mmu.h b/arch/x86/xen/mmu.h
index 537bb9aab777..73809bb951b4 100644
--- a/arch/x86/xen/mmu.h
+++ b/arch/x86/xen/mmu.h
@@ -15,43 +15,6 @@ bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn);
15 15
16void set_pte_mfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags); 16void set_pte_mfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags);
17 17
18
19void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next);
20void xen_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm);
21void xen_exit_mmap(struct mm_struct *mm);
22
23pteval_t xen_pte_val(pte_t);
24pmdval_t xen_pmd_val(pmd_t);
25pgdval_t xen_pgd_val(pgd_t);
26
27pte_t xen_make_pte(pteval_t);
28pmd_t xen_make_pmd(pmdval_t);
29pgd_t xen_make_pgd(pgdval_t);
30
31void xen_set_pte(pte_t *ptep, pte_t pteval);
32void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
33 pte_t *ptep, pte_t pteval);
34
35#ifdef CONFIG_X86_PAE
36void xen_set_pte_atomic(pte_t *ptep, pte_t pte);
37void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
38void xen_pmd_clear(pmd_t *pmdp);
39#endif /* CONFIG_X86_PAE */
40
41void xen_set_pmd(pmd_t *pmdp, pmd_t pmdval);
42void xen_set_pud(pud_t *ptr, pud_t val);
43void xen_set_pmd_hyper(pmd_t *pmdp, pmd_t pmdval);
44void xen_set_pud_hyper(pud_t *ptr, pud_t val);
45
46#if PAGETABLE_LEVELS == 4
47pudval_t xen_pud_val(pud_t pud);
48pud_t xen_make_pud(pudval_t pudval);
49void xen_set_pgd(pgd_t *pgdp, pgd_t pgd);
50void xen_set_pgd_hyper(pgd_t *pgdp, pgd_t pgd);
51#endif
52
53pgd_t *xen_get_user_pgd(pgd_t *pgd);
54
55pte_t xen_ptep_modify_prot_start(struct mm_struct *mm, unsigned long addr, pte_t *ptep); 18pte_t xen_ptep_modify_prot_start(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
56void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr, 19void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
57 pte_t *ptep, pte_t pte); 20 pte_t *ptep, pte_t pte);
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 7c275f5d0df0..5d43c1f8ada8 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -20,12 +20,6 @@ config XTENSA
20config RWSEM_XCHGADD_ALGORITHM 20config RWSEM_XCHGADD_ALGORITHM
21 def_bool y 21 def_bool y
22 22
23config GENERIC_FIND_NEXT_BIT
24 def_bool y
25
26config GENERIC_FIND_BIT_LE
27 def_bool y
28
29config GENERIC_HWEIGHT 23config GENERIC_HWEIGHT
30 def_bool y 24 def_bool y
31 25