aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig.debug6
-rw-r--r--arch/arm/Makefile4
-rw-r--r--arch/arm/boot/compressed/head.S4
-rw-r--r--arch/arm/boot/dts/tegra20-harmony.dts2
-rw-r--r--arch/arm/configs/tegra_defconfig2
-rw-r--r--arch/arm/include/asm/assembler.h8
-rw-r--r--arch/arm/include/asm/memory.h3
-rw-r--r--arch/arm/include/asm/tlb.h4
-rw-r--r--arch/arm/include/asm/uaccess.h58
-rw-r--r--arch/arm/kernel/hw_breakpoint.c62
-rw-r--r--arch/arm/kernel/traps.c11
-rw-r--r--arch/arm/lib/delay.c1
-rw-r--r--arch/arm/lib/getuser.S23
-rw-r--r--arch/arm/lib/putuser.S6
-rw-r--r--arch/arm/mach-at91/at91x40.c2
-rw-r--r--arch/arm/mach-at91/at91x40_time.c4
-rw-r--r--arch/arm/mach-at91/include/mach/hardware.h4
-rw-r--r--arch/arm/mach-at91/include/mach/uncompress.h6
-rw-r--r--arch/arm/mach-at91/setup.c4
-rw-r--r--arch/arm/mach-ebsa110/core.c8
-rw-r--r--arch/arm/mach-ebsa110/core.h12
-rw-r--r--arch/arm/mach-exynos/clock-exynos5.c9
-rw-r--r--arch/arm/mach-exynos/include/mach/map.h1
-rw-r--r--arch/arm/mach-imx/clk-imx25.c6
-rw-r--r--arch/arm/mach-imx/clk-imx35.c6
-rw-r--r--arch/arm/mach-imx/mach-kzm_arm11_01.c4
-rw-r--r--arch/arm/mach-imx/mach-mx31ads.c2
-rw-r--r--arch/arm/mach-imx/mach-mx31lite.c2
-rw-r--r--arch/arm/mach-integrator/core.c4
-rw-r--r--arch/arm/mach-integrator/cpu.c8
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c12
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c6
-rw-r--r--arch/arm/mach-integrator/pci_v3.c12
-rw-r--r--arch/arm/mach-iop13xx/include/mach/iop13xx.h20
-rw-r--r--arch/arm/mach-iop13xx/include/mach/memory.h14
-rw-r--r--arch/arm/mach-iop13xx/io.c8
-rw-r--r--arch/arm/mach-iop13xx/pci.c16
-rw-r--r--arch/arm/mach-iop13xx/pci.h4
-rw-r--r--arch/arm/mach-iop13xx/setup.c10
-rw-r--r--arch/arm/mach-iop32x/glantank.c2
-rw-r--r--arch/arm/mach-ixp4xx/common.c8
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/cpu.h5
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h10
-rw-r--r--arch/arm/mach-ks8695/cpu.c2
-rw-r--r--arch/arm/mach-ks8695/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-ks8695/include/mach/uncompress.h6
-rw-r--r--arch/arm/mach-lpc32xx/common.c8
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-mmp/irq.c4
-rw-r--r--arch/arm/mach-msm/smd.c19
-rw-r--r--arch/arm/mach-nomadik/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-nomadik/include/mach/uncompress.h8
-rw-r--r--arch/arm/mach-omap2/Kconfig3
-rw-r--r--arch/arm/mach-omap2/Makefile2
-rw-r--r--arch/arm/mach-omap2/clock33xx_data.c14
-rw-r--r--arch/arm/mach-omap2/clockdomain2xxx_3xxx.c50
-rw-r--r--arch/arm/mach-omap2/cm-regbits-34xx.h1
-rw-r--r--arch/arm/mach-omap2/omap-wakeupgen.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c15
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c12
-rw-r--r--arch/arm/mach-omap2/timer.c7
-rw-r--r--arch/arm/mach-prima2/include/mach/uncompress.h4
-rw-r--r--arch/arm/mach-s3c24xx/h1940-bluetooth.c14
-rw-r--r--arch/arm/mach-s3c24xx/mach-anubis.c3
-rw-r--r--arch/arm/mach-s3c24xx/mach-jive.c12
-rw-r--r--arch/arm/mach-s3c24xx/mach-mini2440.c4
-rw-r--r--arch/arm/mach-s3c24xx/mach-nexcoder.c22
-rw-r--r--arch/arm/mach-s3c24xx/mach-osiris-dvs.c13
-rw-r--r--arch/arm/mach-s3c24xx/mach-osiris.c7
-rw-r--r--arch/arm/mach-sa1100/include/mach/simpad.h2
-rw-r--r--arch/arm/mach-sa1100/simpad.c2
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c12
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c6
-rw-r--r--arch/arm/mach-shmobile/board-bonito.c8
-rw-r--r--arch/arm/mach-shmobile/board-g3evm.c12
-rw-r--r--arch/arm/mach-shmobile/board-g4evm.c30
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c8
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c22
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c46
-rw-r--r--arch/arm/mach-shmobile/clock-sh7367.c44
-rw-r--r--arch/arm/mach-shmobile/clock-sh7372.c60
-rw-r--r--arch/arm/mach-shmobile/clock-sh7377.c50
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c70
-rw-r--r--arch/arm/mach-shmobile/include/mach/gpio.h6
-rw-r--r--arch/arm/mach-shmobile/intc-r8a7779.c14
-rw-r--r--arch/arm/mach-shmobile/intc-sh7372.c27
-rw-r--r--arch/arm/mach-shmobile/intc-sh73a0.c20
-rw-r--r--arch/arm/mach-shmobile/pm-rmobile.c6
-rw-r--r--arch/arm/mach-shmobile/pm-sh7372.c57
-rw-r--r--arch/arm/mach-shmobile/setup-sh7367.c2
-rw-r--r--arch/arm/mach-shmobile/setup-sh7377.c2
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c2
-rw-r--r--arch/arm/mach-spear13xx/include/mach/spear.h14
-rw-r--r--arch/arm/mach-spear13xx/spear13xx.c6
-rw-r--r--arch/arm/mach-tegra/Kconfig7
-rw-r--r--arch/arm/mach-tegra/Makefile1
-rw-r--r--arch/arm/mach-tegra/apbio.c118
-rw-r--r--arch/arm/mach-tegra/dma.c823
-rw-r--r--arch/arm/mach-tegra/include/mach/dma.h97
-rw-r--r--arch/arm/mm/context.c7
-rw-r--r--arch/arm/mm/dma-mapping.c2
-rw-r--r--arch/arm/mm/mmu.c4
-rw-r--r--arch/arm/plat-mxc/include/mach/mx31.h6
-rw-r--r--arch/arm/plat-omap/sram.c11
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-fns.h97
-rw-r--r--arch/arm/plat-samsung/s5p-irq-gpioint.c4
-rw-r--r--arch/blackfin/Kconfig1
-rw-r--r--arch/blackfin/Makefile1
-rw-r--r--arch/blackfin/include/asm/smp.h2
-rw-r--r--arch/blackfin/mach-common/smp.c223
-rw-r--r--arch/s390/oprofile/init.c10
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c1
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_lbr.c3
-rw-r--r--arch/x86/kernel/microcode_core.c3
-rw-r--r--arch/x86/kvm/i8259.c2
-rw-r--r--arch/x86/kvm/vmx.c23
-rw-r--r--arch/x86/kvm/x86.c13
118 files changed, 777 insertions, 1852 deletions
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index f15f82bf3a50..e968a52e4881 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -356,15 +356,15 @@ choice
356 is nothing connected to read from the DCC. 356 is nothing connected to read from the DCC.
357 357
358 config DEBUG_SEMIHOSTING 358 config DEBUG_SEMIHOSTING
359 bool "Kernel low-level debug output via semihosting I" 359 bool "Kernel low-level debug output via semihosting I/O"
360 help 360 help
361 Semihosting enables code running on an ARM target to use 361 Semihosting enables code running on an ARM target to use
362 the I/O facilities on a host debugger/emulator through a 362 the I/O facilities on a host debugger/emulator through a
363 simple SVC calls. The host debugger or emulator must have 363 simple SVC call. The host debugger or emulator must have
364 semihosting enabled for the special svc call to be trapped 364 semihosting enabled for the special svc call to be trapped
365 otherwise the kernel will crash. 365 otherwise the kernel will crash.
366 366
367 This is known to work with OpenOCD, as wellas 367 This is known to work with OpenOCD, as well as
368 ARM's Fast Models, or any other controlling environment 368 ARM's Fast Models, or any other controlling environment
369 that implements semihosting. 369 that implements semihosting.
370 370
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 210c923025b1..74381a31ee42 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -283,10 +283,10 @@ zImage Image xipImage bootpImage uImage: vmlinux
283zinstall uinstall install: vmlinux 283zinstall uinstall install: vmlinux
284 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ 284 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
285 285
286%.dtb: 286%.dtb: scripts
287 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ 287 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
288 288
289dtbs: 289dtbs: scripts
290 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ 290 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
291 291
292# We use MRPROPER_FILES and CLEAN_FILES now 292# We use MRPROPER_FILES and CLEAN_FILES now
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index b8c64b80bafc..81769c1341fa 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -659,10 +659,14 @@ __armv7_mmu_cache_on:
659#ifdef CONFIG_CPU_ENDIAN_BE8 659#ifdef CONFIG_CPU_ENDIAN_BE8
660 orr r0, r0, #1 << 25 @ big-endian page tables 660 orr r0, r0, #1 << 25 @ big-endian page tables
661#endif 661#endif
662 mrcne p15, 0, r6, c2, c0, 2 @ read ttb control reg
662 orrne r0, r0, #1 @ MMU enabled 663 orrne r0, r0, #1 @ MMU enabled
663 movne r1, #0xfffffffd @ domain 0 = client 664 movne r1, #0xfffffffd @ domain 0 = client
665 bic r6, r6, #1 << 31 @ 32-bit translation system
666 bic r6, r6, #3 << 0 @ use only ttbr0
664 mcrne p15, 0, r3, c2, c0, 0 @ load page table pointer 667 mcrne p15, 0, r3, c2, c0, 0 @ load page table pointer
665 mcrne p15, 0, r1, c3, c0, 0 @ load domain access control 668 mcrne p15, 0, r1, c3, c0, 0 @ load domain access control
669 mcrne p15, 0, r6, c2, c0, 2 @ load ttb control
666#endif 670#endif
667 mcr p15, 0, r0, c7, c5, 4 @ ISB 671 mcr p15, 0, r0, c7, c5, 4 @ ISB
668 mcr p15, 0, r0, c1, c0, 0 @ load control register 672 mcr p15, 0, r0, c1, c0, 0 @ load control register
diff --git a/arch/arm/boot/dts/tegra20-harmony.dts b/arch/arm/boot/dts/tegra20-harmony.dts
index b98a1b36e694..c3ef1ad26b6a 100644
--- a/arch/arm/boot/dts/tegra20-harmony.dts
+++ b/arch/arm/boot/dts/tegra20-harmony.dts
@@ -397,7 +397,7 @@
397 regulator@11 { 397 regulator@11 {
398 reg = <11>; 398 reg = <11>;
399 regulator-compatible = "ldo7"; 399 regulator-compatible = "ldo7";
400 regulator-name = "vdd_ldo7,avdd_hdmi,vdd_fuse"; 400 regulator-name = "vdd_ldo7,avdd_hdmi";
401 regulator-min-microvolt = <3300000>; 401 regulator-min-microvolt = <3300000>;
402 regulator-max-microvolt = <3300000>; 402 regulator-max-microvolt = <3300000>;
403 }; 403 };
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index db2245353f0f..0d6bb738c6de 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -145,6 +145,8 @@ CONFIG_MMC_SDHCI_TEGRA=y
145CONFIG_RTC_CLASS=y 145CONFIG_RTC_CLASS=y
146CONFIG_RTC_DRV_EM3027=y 146CONFIG_RTC_DRV_EM3027=y
147CONFIG_RTC_DRV_TEGRA=y 147CONFIG_RTC_DRV_TEGRA=y
148CONFIG_DMADEVICES=y
149CONFIG_TEGRA20_APB_DMA=y
148CONFIG_STAGING=y 150CONFIG_STAGING=y
149CONFIG_SENSORS_ISL29018=y 151CONFIG_SENSORS_ISL29018=y
150CONFIG_SENSORS_ISL29028=y 152CONFIG_SENSORS_ISL29028=y
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 03fb93621d0d..5c8b3bf4d825 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -320,4 +320,12 @@
320 .size \name , . - \name 320 .size \name , . - \name
321 .endm 321 .endm
322 322
323 .macro check_uaccess, addr:req, size:req, limit:req, tmp:req, bad:req
324#ifndef CONFIG_CPU_USE_DOMAINS
325 adds \tmp, \addr, #\size - 1
326 sbcccs \tmp, \tmp, \limit
327 bcs \bad
328#endif
329 .endm
330
323#endif /* __ASM_ASSEMBLER_H__ */ 331#endif /* __ASM_ASSEMBLER_H__ */
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index e965f1b560f1..5f6ddcc56452 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -187,6 +187,7 @@ static inline unsigned long __phys_to_virt(unsigned long x)
187#define __phys_to_virt(x) ((x) - PHYS_OFFSET + PAGE_OFFSET) 187#define __phys_to_virt(x) ((x) - PHYS_OFFSET + PAGE_OFFSET)
188#endif 188#endif
189#endif 189#endif
190#endif /* __ASSEMBLY__ */
190 191
191#ifndef PHYS_OFFSET 192#ifndef PHYS_OFFSET
192#ifdef PLAT_PHYS_OFFSET 193#ifdef PLAT_PHYS_OFFSET
@@ -196,6 +197,8 @@ static inline unsigned long __phys_to_virt(unsigned long x)
196#endif 197#endif
197#endif 198#endif
198 199
200#ifndef __ASSEMBLY__
201
199/* 202/*
200 * PFNs are used to describe any physical page; this means 203 * PFNs are used to describe any physical page; this means
201 * PFN 0 == physical address 0. 204 * PFN 0 == physical address 0.
diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h
index 314d4664eae7..99a19512ee26 100644
--- a/arch/arm/include/asm/tlb.h
+++ b/arch/arm/include/asm/tlb.h
@@ -199,6 +199,9 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
199{ 199{
200 pgtable_page_dtor(pte); 200 pgtable_page_dtor(pte);
201 201
202#ifdef CONFIG_ARM_LPAE
203 tlb_add_flush(tlb, addr);
204#else
202 /* 205 /*
203 * With the classic ARM MMU, a pte page has two corresponding pmd 206 * With the classic ARM MMU, a pte page has two corresponding pmd
204 * entries, each covering 1MB. 207 * entries, each covering 1MB.
@@ -206,6 +209,7 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
206 addr &= PMD_MASK; 209 addr &= PMD_MASK;
207 tlb_add_flush(tlb, addr + SZ_1M - PAGE_SIZE); 210 tlb_add_flush(tlb, addr + SZ_1M - PAGE_SIZE);
208 tlb_add_flush(tlb, addr + SZ_1M); 211 tlb_add_flush(tlb, addr + SZ_1M);
212#endif
209 213
210 tlb_remove_page(tlb, pte); 214 tlb_remove_page(tlb, pte);
211} 215}
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index 479a6352e0b5..77bd79f2ffdb 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -101,28 +101,39 @@ extern int __get_user_1(void *);
101extern int __get_user_2(void *); 101extern int __get_user_2(void *);
102extern int __get_user_4(void *); 102extern int __get_user_4(void *);
103 103
104#define __get_user_x(__r2,__p,__e,__s,__i...) \ 104#define __GUP_CLOBBER_1 "lr", "cc"
105#ifdef CONFIG_CPU_USE_DOMAINS
106#define __GUP_CLOBBER_2 "ip", "lr", "cc"
107#else
108#define __GUP_CLOBBER_2 "lr", "cc"
109#endif
110#define __GUP_CLOBBER_4 "lr", "cc"
111
112#define __get_user_x(__r2,__p,__e,__l,__s) \
105 __asm__ __volatile__ ( \ 113 __asm__ __volatile__ ( \
106 __asmeq("%0", "r0") __asmeq("%1", "r2") \ 114 __asmeq("%0", "r0") __asmeq("%1", "r2") \
115 __asmeq("%3", "r1") \
107 "bl __get_user_" #__s \ 116 "bl __get_user_" #__s \
108 : "=&r" (__e), "=r" (__r2) \ 117 : "=&r" (__e), "=r" (__r2) \
109 : "0" (__p) \ 118 : "0" (__p), "r" (__l) \
110 : __i, "cc") 119 : __GUP_CLOBBER_##__s)
111 120
112#define get_user(x,p) \ 121#define __get_user_check(x,p) \
113 ({ \ 122 ({ \
123 unsigned long __limit = current_thread_info()->addr_limit - 1; \
114 register const typeof(*(p)) __user *__p asm("r0") = (p);\ 124 register const typeof(*(p)) __user *__p asm("r0") = (p);\
115 register unsigned long __r2 asm("r2"); \ 125 register unsigned long __r2 asm("r2"); \
126 register unsigned long __l asm("r1") = __limit; \
116 register int __e asm("r0"); \ 127 register int __e asm("r0"); \
117 switch (sizeof(*(__p))) { \ 128 switch (sizeof(*(__p))) { \
118 case 1: \ 129 case 1: \
119 __get_user_x(__r2, __p, __e, 1, "lr"); \ 130 __get_user_x(__r2, __p, __e, __l, 1); \
120 break; \ 131 break; \
121 case 2: \ 132 case 2: \
122 __get_user_x(__r2, __p, __e, 2, "r3", "lr"); \ 133 __get_user_x(__r2, __p, __e, __l, 2); \
123 break; \ 134 break; \
124 case 4: \ 135 case 4: \
125 __get_user_x(__r2, __p, __e, 4, "lr"); \ 136 __get_user_x(__r2, __p, __e, __l, 4); \
126 break; \ 137 break; \
127 default: __e = __get_user_bad(); break; \ 138 default: __e = __get_user_bad(); break; \
128 } \ 139 } \
@@ -130,42 +141,57 @@ extern int __get_user_4(void *);
130 __e; \ 141 __e; \
131 }) 142 })
132 143
144#define get_user(x,p) \
145 ({ \
146 might_fault(); \
147 __get_user_check(x,p); \
148 })
149
133extern int __put_user_1(void *, unsigned int); 150extern int __put_user_1(void *, unsigned int);
134extern int __put_user_2(void *, unsigned int); 151extern int __put_user_2(void *, unsigned int);
135extern int __put_user_4(void *, unsigned int); 152extern int __put_user_4(void *, unsigned int);
136extern int __put_user_8(void *, unsigned long long); 153extern int __put_user_8(void *, unsigned long long);
137 154
138#define __put_user_x(__r2,__p,__e,__s) \ 155#define __put_user_x(__r2,__p,__e,__l,__s) \
139 __asm__ __volatile__ ( \ 156 __asm__ __volatile__ ( \
140 __asmeq("%0", "r0") __asmeq("%2", "r2") \ 157 __asmeq("%0", "r0") __asmeq("%2", "r2") \
158 __asmeq("%3", "r1") \
141 "bl __put_user_" #__s \ 159 "bl __put_user_" #__s \
142 : "=&r" (__e) \ 160 : "=&r" (__e) \
143 : "0" (__p), "r" (__r2) \ 161 : "0" (__p), "r" (__r2), "r" (__l) \
144 : "ip", "lr", "cc") 162 : "ip", "lr", "cc")
145 163
146#define put_user(x,p) \ 164#define __put_user_check(x,p) \
147 ({ \ 165 ({ \
166 unsigned long __limit = current_thread_info()->addr_limit - 1; \
148 register const typeof(*(p)) __r2 asm("r2") = (x); \ 167 register const typeof(*(p)) __r2 asm("r2") = (x); \
149 register const typeof(*(p)) __user *__p asm("r0") = (p);\ 168 register const typeof(*(p)) __user *__p asm("r0") = (p);\
169 register unsigned long __l asm("r1") = __limit; \
150 register int __e asm("r0"); \ 170 register int __e asm("r0"); \
151 switch (sizeof(*(__p))) { \ 171 switch (sizeof(*(__p))) { \
152 case 1: \ 172 case 1: \
153 __put_user_x(__r2, __p, __e, 1); \ 173 __put_user_x(__r2, __p, __e, __l, 1); \
154 break; \ 174 break; \
155 case 2: \ 175 case 2: \
156 __put_user_x(__r2, __p, __e, 2); \ 176 __put_user_x(__r2, __p, __e, __l, 2); \
157 break; \ 177 break; \
158 case 4: \ 178 case 4: \
159 __put_user_x(__r2, __p, __e, 4); \ 179 __put_user_x(__r2, __p, __e, __l, 4); \
160 break; \ 180 break; \
161 case 8: \ 181 case 8: \
162 __put_user_x(__r2, __p, __e, 8); \ 182 __put_user_x(__r2, __p, __e, __l, 8); \
163 break; \ 183 break; \
164 default: __e = __put_user_bad(); break; \ 184 default: __e = __put_user_bad(); break; \
165 } \ 185 } \
166 __e; \ 186 __e; \
167 }) 187 })
168 188
189#define put_user(x,p) \
190 ({ \
191 might_fault(); \
192 __put_user_check(x,p); \
193 })
194
169#else /* CONFIG_MMU */ 195#else /* CONFIG_MMU */
170 196
171/* 197/*
@@ -219,6 +245,7 @@ do { \
219 unsigned long __gu_addr = (unsigned long)(ptr); \ 245 unsigned long __gu_addr = (unsigned long)(ptr); \
220 unsigned long __gu_val; \ 246 unsigned long __gu_val; \
221 __chk_user_ptr(ptr); \ 247 __chk_user_ptr(ptr); \
248 might_fault(); \
222 switch (sizeof(*(ptr))) { \ 249 switch (sizeof(*(ptr))) { \
223 case 1: __get_user_asm_byte(__gu_val,__gu_addr,err); break; \ 250 case 1: __get_user_asm_byte(__gu_val,__gu_addr,err); break; \
224 case 2: __get_user_asm_half(__gu_val,__gu_addr,err); break; \ 251 case 2: __get_user_asm_half(__gu_val,__gu_addr,err); break; \
@@ -300,6 +327,7 @@ do { \
300 unsigned long __pu_addr = (unsigned long)(ptr); \ 327 unsigned long __pu_addr = (unsigned long)(ptr); \
301 __typeof__(*(ptr)) __pu_val = (x); \ 328 __typeof__(*(ptr)) __pu_val = (x); \
302 __chk_user_ptr(ptr); \ 329 __chk_user_ptr(ptr); \
330 might_fault(); \
303 switch (sizeof(*(ptr))) { \ 331 switch (sizeof(*(ptr))) { \
304 case 1: __put_user_asm_byte(__pu_val,__pu_addr,err); break; \ 332 case 1: __put_user_asm_byte(__pu_val,__pu_addr,err); break; \
305 case 2: __put_user_asm_half(__pu_val,__pu_addr,err); break; \ 333 case 2: __put_user_asm_half(__pu_val,__pu_addr,err); break; \
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index ba386bd94107..281bf3301241 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -159,6 +159,12 @@ static int debug_arch_supported(void)
159 arch >= ARM_DEBUG_ARCH_V7_1; 159 arch >= ARM_DEBUG_ARCH_V7_1;
160} 160}
161 161
162/* Can we determine the watchpoint access type from the fsr? */
163static int debug_exception_updates_fsr(void)
164{
165 return 0;
166}
167
162/* Determine number of WRP registers available. */ 168/* Determine number of WRP registers available. */
163static int get_num_wrp_resources(void) 169static int get_num_wrp_resources(void)
164{ 170{
@@ -604,13 +610,14 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
604 /* Aligned */ 610 /* Aligned */
605 break; 611 break;
606 case 1: 612 case 1:
607 /* Allow single byte watchpoint. */
608 if (info->ctrl.len == ARM_BREAKPOINT_LEN_1)
609 break;
610 case 2: 613 case 2:
611 /* Allow halfword watchpoints and breakpoints. */ 614 /* Allow halfword watchpoints and breakpoints. */
612 if (info->ctrl.len == ARM_BREAKPOINT_LEN_2) 615 if (info->ctrl.len == ARM_BREAKPOINT_LEN_2)
613 break; 616 break;
617 case 3:
618 /* Allow single byte watchpoint. */
619 if (info->ctrl.len == ARM_BREAKPOINT_LEN_1)
620 break;
614 default: 621 default:
615 ret = -EINVAL; 622 ret = -EINVAL;
616 goto out; 623 goto out;
@@ -619,18 +626,35 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
619 info->address &= ~alignment_mask; 626 info->address &= ~alignment_mask;
620 info->ctrl.len <<= offset; 627 info->ctrl.len <<= offset;
621 628
622 /* 629 if (!bp->overflow_handler) {
623 * Currently we rely on an overflow handler to take 630 /*
624 * care of single-stepping the breakpoint when it fires. 631 * Mismatch breakpoints are required for single-stepping
625 * In the case of userspace breakpoints on a core with V7 debug, 632 * breakpoints.
626 * we can use the mismatch feature as a poor-man's hardware 633 */
627 * single-step, but this only works for per-task breakpoints. 634 if (!core_has_mismatch_brps())
628 */ 635 return -EINVAL;
629 if (!bp->overflow_handler && (arch_check_bp_in_kernelspace(bp) || 636
630 !core_has_mismatch_brps() || !bp->hw.bp_target)) { 637 /* We don't allow mismatch breakpoints in kernel space. */
631 pr_warning("overflow handler required but none found\n"); 638 if (arch_check_bp_in_kernelspace(bp))
632 ret = -EINVAL; 639 return -EPERM;
640
641 /*
642 * Per-cpu breakpoints are not supported by our stepping
643 * mechanism.
644 */
645 if (!bp->hw.bp_target)
646 return -EINVAL;
647
648 /*
649 * We only support specific access types if the fsr
650 * reports them.
651 */
652 if (!debug_exception_updates_fsr() &&
653 (info->ctrl.type == ARM_BREAKPOINT_LOAD ||
654 info->ctrl.type == ARM_BREAKPOINT_STORE))
655 return -EINVAL;
633 } 656 }
657
634out: 658out:
635 return ret; 659 return ret;
636} 660}
@@ -706,10 +730,12 @@ static void watchpoint_handler(unsigned long addr, unsigned int fsr,
706 goto unlock; 730 goto unlock;
707 731
708 /* Check that the access type matches. */ 732 /* Check that the access type matches. */
709 access = (fsr & ARM_FSR_ACCESS_MASK) ? HW_BREAKPOINT_W : 733 if (debug_exception_updates_fsr()) {
710 HW_BREAKPOINT_R; 734 access = (fsr & ARM_FSR_ACCESS_MASK) ?
711 if (!(access & hw_breakpoint_type(wp))) 735 HW_BREAKPOINT_W : HW_BREAKPOINT_R;
712 goto unlock; 736 if (!(access & hw_breakpoint_type(wp)))
737 goto unlock;
738 }
713 739
714 /* We have a winner. */ 740 /* We have a winner. */
715 info->trigger = addr; 741 info->trigger = addr;
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index f7945218b8c6..b0179b89a04c 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -420,20 +420,23 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
420#endif 420#endif
421 instr = *(u32 *) pc; 421 instr = *(u32 *) pc;
422 } else if (thumb_mode(regs)) { 422 } else if (thumb_mode(regs)) {
423 get_user(instr, (u16 __user *)pc); 423 if (get_user(instr, (u16 __user *)pc))
424 goto die_sig;
424 if (is_wide_instruction(instr)) { 425 if (is_wide_instruction(instr)) {
425 unsigned int instr2; 426 unsigned int instr2;
426 get_user(instr2, (u16 __user *)pc+1); 427 if (get_user(instr2, (u16 __user *)pc+1))
428 goto die_sig;
427 instr <<= 16; 429 instr <<= 16;
428 instr |= instr2; 430 instr |= instr2;
429 } 431 }
430 } else { 432 } else if (get_user(instr, (u32 __user *)pc)) {
431 get_user(instr, (u32 __user *)pc); 433 goto die_sig;
432 } 434 }
433 435
434 if (call_undef_hook(regs, instr) == 0) 436 if (call_undef_hook(regs, instr) == 0)
435 return; 437 return;
436 438
439die_sig:
437#ifdef CONFIG_DEBUG_USER 440#ifdef CONFIG_DEBUG_USER
438 if (user_debug & UDBG_UNDEFINED) { 441 if (user_debug & UDBG_UNDEFINED) {
439 printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n", 442 printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n",
diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c
index d6dacc69254e..395d5fbb8fa2 100644
--- a/arch/arm/lib/delay.c
+++ b/arch/arm/lib/delay.c
@@ -59,6 +59,7 @@ void __init init_current_timer_delay(unsigned long freq)
59{ 59{
60 pr_info("Switching to timer-based delay loop\n"); 60 pr_info("Switching to timer-based delay loop\n");
61 lpj_fine = freq / HZ; 61 lpj_fine = freq / HZ;
62 loops_per_jiffy = lpj_fine;
62 arm_delay_ops.delay = __timer_delay; 63 arm_delay_ops.delay = __timer_delay;
63 arm_delay_ops.const_udelay = __timer_const_udelay; 64 arm_delay_ops.const_udelay = __timer_const_udelay;
64 arm_delay_ops.udelay = __timer_udelay; 65 arm_delay_ops.udelay = __timer_udelay;
diff --git a/arch/arm/lib/getuser.S b/arch/arm/lib/getuser.S
index 11093a7c3e32..9b06bb41fca6 100644
--- a/arch/arm/lib/getuser.S
+++ b/arch/arm/lib/getuser.S
@@ -16,8 +16,9 @@
16 * __get_user_X 16 * __get_user_X
17 * 17 *
18 * Inputs: r0 contains the address 18 * Inputs: r0 contains the address
19 * r1 contains the address limit, which must be preserved
19 * Outputs: r0 is the error code 20 * Outputs: r0 is the error code
20 * r2, r3 contains the zero-extended value 21 * r2 contains the zero-extended value
21 * lr corrupted 22 * lr corrupted
22 * 23 *
23 * No other registers must be altered. (see <asm/uaccess.h> 24 * No other registers must be altered. (see <asm/uaccess.h>
@@ -27,33 +28,39 @@
27 * Note also that it is intended that __get_user_bad is not global. 28 * Note also that it is intended that __get_user_bad is not global.
28 */ 29 */
29#include <linux/linkage.h> 30#include <linux/linkage.h>
31#include <asm/assembler.h>
30#include <asm/errno.h> 32#include <asm/errno.h>
31#include <asm/domain.h> 33#include <asm/domain.h>
32 34
33ENTRY(__get_user_1) 35ENTRY(__get_user_1)
36 check_uaccess r0, 1, r1, r2, __get_user_bad
341: TUSER(ldrb) r2, [r0] 371: TUSER(ldrb) r2, [r0]
35 mov r0, #0 38 mov r0, #0
36 mov pc, lr 39 mov pc, lr
37ENDPROC(__get_user_1) 40ENDPROC(__get_user_1)
38 41
39ENTRY(__get_user_2) 42ENTRY(__get_user_2)
40#ifdef CONFIG_THUMB2_KERNEL 43 check_uaccess r0, 2, r1, r2, __get_user_bad
412: TUSER(ldrb) r2, [r0] 44#ifdef CONFIG_CPU_USE_DOMAINS
423: TUSER(ldrb) r3, [r0, #1] 45rb .req ip
462: ldrbt r2, [r0], #1
473: ldrbt rb, [r0], #0
43#else 48#else
442: TUSER(ldrb) r2, [r0], #1 49rb .req r0
453: TUSER(ldrb) r3, [r0] 502: ldrb r2, [r0]
513: ldrb rb, [r0, #1]
46#endif 52#endif
47#ifndef __ARMEB__ 53#ifndef __ARMEB__
48 orr r2, r2, r3, lsl #8 54 orr r2, r2, rb, lsl #8
49#else 55#else
50 orr r2, r3, r2, lsl #8 56 orr r2, rb, r2, lsl #8
51#endif 57#endif
52 mov r0, #0 58 mov r0, #0
53 mov pc, lr 59 mov pc, lr
54ENDPROC(__get_user_2) 60ENDPROC(__get_user_2)
55 61
56ENTRY(__get_user_4) 62ENTRY(__get_user_4)
63 check_uaccess r0, 4, r1, r2, __get_user_bad
574: TUSER(ldr) r2, [r0] 644: TUSER(ldr) r2, [r0]
58 mov r0, #0 65 mov r0, #0
59 mov pc, lr 66 mov pc, lr
diff --git a/arch/arm/lib/putuser.S b/arch/arm/lib/putuser.S
index 7db25990c589..3d73dcb959b0 100644
--- a/arch/arm/lib/putuser.S
+++ b/arch/arm/lib/putuser.S
@@ -16,6 +16,7 @@
16 * __put_user_X 16 * __put_user_X
17 * 17 *
18 * Inputs: r0 contains the address 18 * Inputs: r0 contains the address
19 * r1 contains the address limit, which must be preserved
19 * r2, r3 contains the value 20 * r2, r3 contains the value
20 * Outputs: r0 is the error code 21 * Outputs: r0 is the error code
21 * lr corrupted 22 * lr corrupted
@@ -27,16 +28,19 @@
27 * Note also that it is intended that __put_user_bad is not global. 28 * Note also that it is intended that __put_user_bad is not global.
28 */ 29 */
29#include <linux/linkage.h> 30#include <linux/linkage.h>
31#include <asm/assembler.h>
30#include <asm/errno.h> 32#include <asm/errno.h>
31#include <asm/domain.h> 33#include <asm/domain.h>
32 34
33ENTRY(__put_user_1) 35ENTRY(__put_user_1)
36 check_uaccess r0, 1, r1, ip, __put_user_bad
341: TUSER(strb) r2, [r0] 371: TUSER(strb) r2, [r0]
35 mov r0, #0 38 mov r0, #0
36 mov pc, lr 39 mov pc, lr
37ENDPROC(__put_user_1) 40ENDPROC(__put_user_1)
38 41
39ENTRY(__put_user_2) 42ENTRY(__put_user_2)
43 check_uaccess r0, 2, r1, ip, __put_user_bad
40 mov ip, r2, lsr #8 44 mov ip, r2, lsr #8
41#ifdef CONFIG_THUMB2_KERNEL 45#ifdef CONFIG_THUMB2_KERNEL
42#ifndef __ARMEB__ 46#ifndef __ARMEB__
@@ -60,12 +64,14 @@ ENTRY(__put_user_2)
60ENDPROC(__put_user_2) 64ENDPROC(__put_user_2)
61 65
62ENTRY(__put_user_4) 66ENTRY(__put_user_4)
67 check_uaccess r0, 4, r1, ip, __put_user_bad
634: TUSER(str) r2, [r0] 684: TUSER(str) r2, [r0]
64 mov r0, #0 69 mov r0, #0
65 mov pc, lr 70 mov pc, lr
66ENDPROC(__put_user_4) 71ENDPROC(__put_user_4)
67 72
68ENTRY(__put_user_8) 73ENTRY(__put_user_8)
74 check_uaccess r0, 8, r1, ip, __put_user_bad
69#ifdef CONFIG_THUMB2_KERNEL 75#ifdef CONFIG_THUMB2_KERNEL
705: TUSER(str) r2, [r0] 765: TUSER(str) r2, [r0]
716: TUSER(str) r3, [r0, #4] 776: TUSER(str) r3, [r0, #4]
diff --git a/arch/arm/mach-at91/at91x40.c b/arch/arm/mach-at91/at91x40.c
index 46090e642d8e..6bd7300a2bc5 100644
--- a/arch/arm/mach-at91/at91x40.c
+++ b/arch/arm/mach-at91/at91x40.c
@@ -47,7 +47,7 @@ static void at91x40_idle(void)
47 * Disable the processor clock. The processor will be automatically 47 * Disable the processor clock. The processor will be automatically
48 * re-enabled by an interrupt or by a reset. 48 * re-enabled by an interrupt or by a reset.
49 */ 49 */
50 __raw_writel(AT91_PS_CR_CPU, AT91_PS_CR); 50 __raw_writel(AT91_PS_CR_CPU, AT91_IO_P2V(AT91_PS_CR));
51 cpu_do_idle(); 51 cpu_do_idle();
52} 52}
53 53
diff --git a/arch/arm/mach-at91/at91x40_time.c b/arch/arm/mach-at91/at91x40_time.c
index 6ca680a1d5d1..ee06d7bcdf76 100644
--- a/arch/arm/mach-at91/at91x40_time.c
+++ b/arch/arm/mach-at91/at91x40_time.c
@@ -29,10 +29,10 @@
29#include <mach/at91_tc.h> 29#include <mach/at91_tc.h>
30 30
31#define at91_tc_read(field) \ 31#define at91_tc_read(field) \
32 __raw_readl(AT91_TC + field) 32 __raw_readl(AT91_IO_P2V(AT91_TC) + field)
33 33
34#define at91_tc_write(field, value) \ 34#define at91_tc_write(field, value) \
35 __raw_writel(value, AT91_TC + field); 35 __raw_writel(value, AT91_IO_P2V(AT91_TC) + field);
36 36
37/* 37/*
38 * 3 counter/timer units present. 38 * 3 counter/timer units present.
diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h
index 09242b67d277..711a7892d331 100644
--- a/arch/arm/mach-at91/include/mach/hardware.h
+++ b/arch/arm/mach-at91/include/mach/hardware.h
@@ -67,13 +67,13 @@
67 * to 0xFEF78000 .. 0xFF000000. (544Kb) 67 * to 0xFEF78000 .. 0xFF000000. (544Kb)
68 */ 68 */
69#define AT91_IO_PHYS_BASE 0xFFF78000 69#define AT91_IO_PHYS_BASE 0xFFF78000
70#define AT91_IO_VIRT_BASE (0xFF000000 - AT91_IO_SIZE) 70#define AT91_IO_VIRT_BASE IOMEM(0xFF000000 - AT91_IO_SIZE)
71#else 71#else
72/* 72/*
73 * Identity mapping for the non MMU case. 73 * Identity mapping for the non MMU case.
74 */ 74 */
75#define AT91_IO_PHYS_BASE AT91_BASE_SYS 75#define AT91_IO_PHYS_BASE AT91_BASE_SYS
76#define AT91_IO_VIRT_BASE AT91_IO_PHYS_BASE 76#define AT91_IO_VIRT_BASE IOMEM(AT91_IO_PHYS_BASE)
77#endif 77#endif
78 78
79#define AT91_IO_SIZE (0xFFFFFFFF - AT91_IO_PHYS_BASE + 1) 79#define AT91_IO_SIZE (0xFFFFFFFF - AT91_IO_PHYS_BASE + 1)
diff --git a/arch/arm/mach-at91/include/mach/uncompress.h b/arch/arm/mach-at91/include/mach/uncompress.h
index 6f6118d1576a..97ad68a826f8 100644
--- a/arch/arm/mach-at91/include/mach/uncompress.h
+++ b/arch/arm/mach-at91/include/mach/uncompress.h
@@ -94,7 +94,7 @@ static const u32 uarts_sam9x5[] = {
94 0, 94 0,
95}; 95};
96 96
97static inline const u32* decomp_soc_detect(u32 dbgu_base) 97static inline const u32* decomp_soc_detect(void __iomem *dbgu_base)
98{ 98{
99 u32 cidr, socid; 99 u32 cidr, socid;
100 100
@@ -142,10 +142,10 @@ static inline void arch_decomp_setup(void)
142 int i = 0; 142 int i = 0;
143 const u32* usarts; 143 const u32* usarts;
144 144
145 usarts = decomp_soc_detect(AT91_BASE_DBGU0); 145 usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU0);
146 146
147 if (!usarts) 147 if (!usarts)
148 usarts = decomp_soc_detect(AT91_BASE_DBGU1); 148 usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU1);
149 if (!usarts) { 149 if (!usarts) {
150 at91_uart = NULL; 150 at91_uart = NULL;
151 return; 151 return;
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 944bffb08991..e6f52de1062f 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -73,7 +73,7 @@ void __init at91_init_sram(int bank, unsigned long base, unsigned int length)
73{ 73{
74 struct map_desc *desc = &sram_desc[bank]; 74 struct map_desc *desc = &sram_desc[bank];
75 75
76 desc->virtual = AT91_IO_VIRT_BASE - length; 76 desc->virtual = (unsigned long)AT91_IO_VIRT_BASE - length;
77 if (bank > 0) 77 if (bank > 0)
78 desc->virtual -= sram_desc[bank - 1].length; 78 desc->virtual -= sram_desc[bank - 1].length;
79 79
@@ -88,7 +88,7 @@ void __init at91_init_sram(int bank, unsigned long base, unsigned int length)
88} 88}
89 89
90static struct map_desc at91_io_desc __initdata = { 90static struct map_desc at91_io_desc __initdata = {
91 .virtual = AT91_VA_BASE_SYS, 91 .virtual = (unsigned long)AT91_VA_BASE_SYS,
92 .pfn = __phys_to_pfn(AT91_BASE_SYS), 92 .pfn = __phys_to_pfn(AT91_BASE_SYS),
93 .length = SZ_16K, 93 .length = SZ_16K,
94 .type = MT_DEVICE, 94 .type = MT_DEVICE,
diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c
index 6f8068692edf..f0fe6b5350e2 100644
--- a/arch/arm/mach-ebsa110/core.c
+++ b/arch/arm/mach-ebsa110/core.c
@@ -74,22 +74,22 @@ static struct map_desc ebsa110_io_desc[] __initdata = {
74 * sparse external-decode ISAIO space 74 * sparse external-decode ISAIO space
75 */ 75 */
76 { /* IRQ_STAT/IRQ_MCLR */ 76 { /* IRQ_STAT/IRQ_MCLR */
77 .virtual = IRQ_STAT, 77 .virtual = (unsigned long)IRQ_STAT,
78 .pfn = __phys_to_pfn(TRICK4_PHYS), 78 .pfn = __phys_to_pfn(TRICK4_PHYS),
79 .length = TRICK4_SIZE, 79 .length = TRICK4_SIZE,
80 .type = MT_DEVICE 80 .type = MT_DEVICE
81 }, { /* IRQ_MASK/IRQ_MSET */ 81 }, { /* IRQ_MASK/IRQ_MSET */
82 .virtual = IRQ_MASK, 82 .virtual = (unsigned long)IRQ_MASK,
83 .pfn = __phys_to_pfn(TRICK3_PHYS), 83 .pfn = __phys_to_pfn(TRICK3_PHYS),
84 .length = TRICK3_SIZE, 84 .length = TRICK3_SIZE,
85 .type = MT_DEVICE 85 .type = MT_DEVICE
86 }, { /* SOFT_BASE */ 86 }, { /* SOFT_BASE */
87 .virtual = SOFT_BASE, 87 .virtual = (unsigned long)SOFT_BASE,
88 .pfn = __phys_to_pfn(TRICK1_PHYS), 88 .pfn = __phys_to_pfn(TRICK1_PHYS),
89 .length = TRICK1_SIZE, 89 .length = TRICK1_SIZE,
90 .type = MT_DEVICE 90 .type = MT_DEVICE
91 }, { /* PIT_BASE */ 91 }, { /* PIT_BASE */
92 .virtual = PIT_BASE, 92 .virtual = (unsigned long)PIT_BASE,
93 .pfn = __phys_to_pfn(TRICK0_PHYS), 93 .pfn = __phys_to_pfn(TRICK0_PHYS),
94 .length = TRICK0_SIZE, 94 .length = TRICK0_SIZE,
95 .type = MT_DEVICE 95 .type = MT_DEVICE
diff --git a/arch/arm/mach-ebsa110/core.h b/arch/arm/mach-ebsa110/core.h
index c93c9e43012d..afe137ee172e 100644
--- a/arch/arm/mach-ebsa110/core.h
+++ b/arch/arm/mach-ebsa110/core.h
@@ -31,11 +31,11 @@
31#define TRICK7_PHYS 0xf3c00000 31#define TRICK7_PHYS 0xf3c00000
32 32
33/* Virtual addresses */ 33/* Virtual addresses */
34#define PIT_BASE 0xfc000000 /* trick 0 */ 34#define PIT_BASE IOMEM(0xfc000000) /* trick 0 */
35#define SOFT_BASE 0xfd000000 /* trick 1 */ 35#define SOFT_BASE IOMEM(0xfd000000) /* trick 1 */
36#define IRQ_MASK 0xfe000000 /* trick 3 - read */ 36#define IRQ_MASK IOMEM(0xfe000000) /* trick 3 - read */
37#define IRQ_MSET 0xfe000000 /* trick 3 - write */ 37#define IRQ_MSET IOMEM(0xfe000000) /* trick 3 - write */
38#define IRQ_STAT 0xff000000 /* trick 4 - read */ 38#define IRQ_STAT IOMEM(0xff000000) /* trick 4 - read */
39#define IRQ_MCLR 0xff000000 /* trick 4 - write */ 39#define IRQ_MCLR IOMEM(0xff000000) /* trick 4 - write */
40 40
41#endif 41#endif
diff --git a/arch/arm/mach-exynos/clock-exynos5.c b/arch/arm/mach-exynos/clock-exynos5.c
index 774533c67066..3b00e299b624 100644
--- a/arch/arm/mach-exynos/clock-exynos5.c
+++ b/arch/arm/mach-exynos/clock-exynos5.c
@@ -166,11 +166,6 @@ static int exynos5_clk_ip_gen_ctrl(struct clk *clk, int enable)
166 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GEN, clk, enable); 166 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GEN, clk, enable);
167} 167}
168 168
169static int exynos5_clk_ip_gps_ctrl(struct clk *clk, int enable)
170{
171 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GPS, clk, enable);
172}
173
174static int exynos5_clk_ip_mfc_ctrl(struct clk *clk, int enable) 169static int exynos5_clk_ip_mfc_ctrl(struct clk *clk, int enable)
175{ 170{
176 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_MFC, clk, enable); 171 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_MFC, clk, enable);
@@ -672,10 +667,6 @@ static struct clk exynos5_init_clocks_off[] = {
672 .enable = exynos5_clk_ip_fsys_ctrl, 667 .enable = exynos5_clk_ip_fsys_ctrl,
673 .ctrlbit = (1 << 7), 668 .ctrlbit = (1 << 7),
674 }, { 669 }, {
675 .name = "gps",
676 .enable = exynos5_clk_ip_gps_ctrl,
677 .ctrlbit = ((1 << 3) | (1 << 2) | (1 << 0)),
678 }, {
679 .name = "nfcon", 670 .name = "nfcon",
680 .enable = exynos5_clk_ip_fsys_ctrl, 671 .enable = exynos5_clk_ip_fsys_ctrl,
681 .ctrlbit = (1 << 22), 672 .ctrlbit = (1 << 22),
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index c72b675b3e4b..9d1f3ac86db2 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -131,7 +131,6 @@
131#define EXYNOS5_PA_SYSMMU_JPEG 0x11F20000 131#define EXYNOS5_PA_SYSMMU_JPEG 0x11F20000
132#define EXYNOS5_PA_SYSMMU_IOP 0x12360000 132#define EXYNOS5_PA_SYSMMU_IOP 0x12360000
133#define EXYNOS5_PA_SYSMMU_RTIC 0x12370000 133#define EXYNOS5_PA_SYSMMU_RTIC 0x12370000
134#define EXYNOS5_PA_SYSMMU_GPS 0x12630000
135#define EXYNOS5_PA_SYSMMU_ISP 0x13260000 134#define EXYNOS5_PA_SYSMMU_ISP 0x13260000
136#define EXYNOS5_PA_SYSMMU_DRC 0x12370000 135#define EXYNOS5_PA_SYSMMU_DRC 0x12370000
137#define EXYNOS5_PA_SYSMMU_SCALERC 0x13280000 136#define EXYNOS5_PA_SYSMMU_SCALERC 0x13280000
diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c
index fdd8cc87c9fe..4431a62fff5b 100644
--- a/arch/arm/mach-imx/clk-imx25.c
+++ b/arch/arm/mach-imx/clk-imx25.c
@@ -222,10 +222,8 @@ int __init mx25_clocks_init(void)
222 clk_register_clkdev(clk[lcdc_ipg], "ipg", "imx-fb.0"); 222 clk_register_clkdev(clk[lcdc_ipg], "ipg", "imx-fb.0");
223 clk_register_clkdev(clk[lcdc_ahb], "ahb", "imx-fb.0"); 223 clk_register_clkdev(clk[lcdc_ahb], "ahb", "imx-fb.0");
224 clk_register_clkdev(clk[wdt_ipg], NULL, "imx2-wdt.0"); 224 clk_register_clkdev(clk[wdt_ipg], NULL, "imx2-wdt.0");
225 clk_register_clkdev(clk[ssi1_ipg_per], "per", "imx-ssi.0"); 225 clk_register_clkdev(clk[ssi1_ipg], NULL, "imx-ssi.0");
226 clk_register_clkdev(clk[ssi1_ipg], "ipg", "imx-ssi.0"); 226 clk_register_clkdev(clk[ssi2_ipg], NULL, "imx-ssi.1");
227 clk_register_clkdev(clk[ssi2_ipg_per], "per", "imx-ssi.1");
228 clk_register_clkdev(clk[ssi2_ipg], "ipg", "imx-ssi.1");
229 clk_register_clkdev(clk[esdhc1_ipg_per], "per", "sdhci-esdhc-imx25.0"); 227 clk_register_clkdev(clk[esdhc1_ipg_per], "per", "sdhci-esdhc-imx25.0");
230 clk_register_clkdev(clk[esdhc1_ipg], "ipg", "sdhci-esdhc-imx25.0"); 228 clk_register_clkdev(clk[esdhc1_ipg], "ipg", "sdhci-esdhc-imx25.0");
231 clk_register_clkdev(clk[esdhc1_ahb], "ahb", "sdhci-esdhc-imx25.0"); 229 clk_register_clkdev(clk[esdhc1_ahb], "ahb", "sdhci-esdhc-imx25.0");
diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
index c6422fb10bae..65fb8bcd86cb 100644
--- a/arch/arm/mach-imx/clk-imx35.c
+++ b/arch/arm/mach-imx/clk-imx35.c
@@ -230,10 +230,8 @@ int __init mx35_clocks_init()
230 clk_register_clkdev(clk[ipu_gate], NULL, "mx3_sdc_fb"); 230 clk_register_clkdev(clk[ipu_gate], NULL, "mx3_sdc_fb");
231 clk_register_clkdev(clk[owire_gate], NULL, "mxc_w1"); 231 clk_register_clkdev(clk[owire_gate], NULL, "mxc_w1");
232 clk_register_clkdev(clk[sdma_gate], NULL, "imx35-sdma"); 232 clk_register_clkdev(clk[sdma_gate], NULL, "imx35-sdma");
233 clk_register_clkdev(clk[ipg], "ipg", "imx-ssi.0"); 233 clk_register_clkdev(clk[ssi1_gate], NULL, "imx-ssi.0");
234 clk_register_clkdev(clk[ssi1_div_post], "per", "imx-ssi.0"); 234 clk_register_clkdev(clk[ssi2_gate], NULL, "imx-ssi.1");
235 clk_register_clkdev(clk[ipg], "ipg", "imx-ssi.1");
236 clk_register_clkdev(clk[ssi2_div_post], "per", "imx-ssi.1");
237 /* i.mx35 has the i.mx21 type uart */ 235 /* i.mx35 has the i.mx21 type uart */
238 clk_register_clkdev(clk[uart1_gate], "per", "imx21-uart.0"); 236 clk_register_clkdev(clk[uart1_gate], "per", "imx21-uart.0");
239 clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.0"); 237 clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.0");
diff --git a/arch/arm/mach-imx/mach-kzm_arm11_01.c b/arch/arm/mach-imx/mach-kzm_arm11_01.c
index 8dc9d3edf17a..0330078ff788 100644
--- a/arch/arm/mach-imx/mach-kzm_arm11_01.c
+++ b/arch/arm/mach-imx/mach-kzm_arm11_01.c
@@ -258,13 +258,13 @@ static void __init kzm_board_init(void)
258 */ 258 */
259static struct map_desc kzm_io_desc[] __initdata = { 259static struct map_desc kzm_io_desc[] __initdata = {
260 { 260 {
261 .virtual = MX31_CS4_BASE_ADDR_VIRT, 261 .virtual = (unsigned long)MX31_CS4_BASE_ADDR_VIRT,
262 .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR), 262 .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR),
263 .length = MX31_CS4_SIZE, 263 .length = MX31_CS4_SIZE,
264 .type = MT_DEVICE 264 .type = MT_DEVICE
265 }, 265 },
266 { 266 {
267 .virtual = MX31_CS5_BASE_ADDR_VIRT, 267 .virtual = (unsigned long)MX31_CS5_BASE_ADDR_VIRT,
268 .pfn = __phys_to_pfn(MX31_CS5_BASE_ADDR), 268 .pfn = __phys_to_pfn(MX31_CS5_BASE_ADDR),
269 .length = MX31_CS5_SIZE, 269 .length = MX31_CS5_SIZE,
270 .type = MT_DEVICE 270 .type = MT_DEVICE
diff --git a/arch/arm/mach-imx/mach-mx31ads.c b/arch/arm/mach-imx/mach-mx31ads.c
index d37f4809c556..e774b07f48d3 100644
--- a/arch/arm/mach-imx/mach-mx31ads.c
+++ b/arch/arm/mach-imx/mach-mx31ads.c
@@ -540,7 +540,7 @@ static void __init mxc_init_audio(void)
540 */ 540 */
541static struct map_desc mx31ads_io_desc[] __initdata = { 541static struct map_desc mx31ads_io_desc[] __initdata = {
542 { 542 {
543 .virtual = MX31_CS4_BASE_ADDR_VIRT, 543 .virtual = (unsigned long)MX31_CS4_BASE_ADDR_VIRT,
544 .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR), 544 .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR),
545 .length = CS4_CS8900_MMIO_START, 545 .length = CS4_CS8900_MMIO_START,
546 .type = MT_DEVICE 546 .type = MT_DEVICE
diff --git a/arch/arm/mach-imx/mach-mx31lite.c b/arch/arm/mach-imx/mach-mx31lite.c
index c8785b39eaed..ef57cff5abfb 100644
--- a/arch/arm/mach-imx/mach-mx31lite.c
+++ b/arch/arm/mach-imx/mach-mx31lite.c
@@ -207,7 +207,7 @@ static struct platform_device physmap_flash_device = {
207 */ 207 */
208static struct map_desc mx31lite_io_desc[] __initdata = { 208static struct map_desc mx31lite_io_desc[] __initdata = {
209 { 209 {
210 .virtual = MX31_CS4_BASE_ADDR_VIRT, 210 .virtual = (unsigned long)MX31_CS4_BASE_ADDR_VIRT,
211 .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR), 211 .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR),
212 .length = MX31_CS4_SIZE, 212 .length = MX31_CS4_SIZE,
213 .type = MT_DEVICE 213 .type = MT_DEVICE
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 3fa6c51390da..a432d4325f89 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -95,8 +95,8 @@ arch_initcall(integrator_init);
95 * UART0 7 6 95 * UART0 7 6
96 * UART1 5 4 96 * UART1 5 4
97 */ 97 */
98#define SC_CTRLC IO_ADDRESS(INTEGRATOR_SC_CTRLC) 98#define SC_CTRLC __io_address(INTEGRATOR_SC_CTRLC)
99#define SC_CTRLS IO_ADDRESS(INTEGRATOR_SC_CTRLS) 99#define SC_CTRLS __io_address(INTEGRATOR_SC_CTRLS)
100 100
101static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *base, unsigned int mctrl) 101static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *base, unsigned int mctrl)
102{ 102{
diff --git a/arch/arm/mach-integrator/cpu.c b/arch/arm/mach-integrator/cpu.c
index fbb457779895..590c192cdf4d 100644
--- a/arch/arm/mach-integrator/cpu.c
+++ b/arch/arm/mach-integrator/cpu.c
@@ -25,10 +25,10 @@
25 25
26static struct cpufreq_driver integrator_driver; 26static struct cpufreq_driver integrator_driver;
27 27
28#define CM_ID IO_ADDRESS(INTEGRATOR_HDR_ID) 28#define CM_ID __io_address(INTEGRATOR_HDR_ID)
29#define CM_OSC IO_ADDRESS(INTEGRATOR_HDR_OSC) 29#define CM_OSC __io_address(INTEGRATOR_HDR_OSC)
30#define CM_STAT IO_ADDRESS(INTEGRATOR_HDR_STAT) 30#define CM_STAT __io_address(INTEGRATOR_HDR_STAT)
31#define CM_LOCK IO_ADDRESS(INTEGRATOR_HDR_LOCK) 31#define CM_LOCK __io_address(INTEGRATOR_HDR_LOCK)
32 32
33static const struct icst_params lclk_params = { 33static const struct icst_params lclk_params = {
34 .ref = 24000000, 34 .ref = 24000000,
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index fd3ef28d2c1a..2215d96cd735 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -134,17 +134,17 @@ static struct map_desc ap_io_desc[] __initdata = {
134 .length = SZ_4K, 134 .length = SZ_4K,
135 .type = MT_DEVICE 135 .type = MT_DEVICE
136 }, { 136 }, {
137 .virtual = PCI_MEMORY_VADDR, 137 .virtual = (unsigned long)PCI_MEMORY_VADDR,
138 .pfn = __phys_to_pfn(PHYS_PCI_MEM_BASE), 138 .pfn = __phys_to_pfn(PHYS_PCI_MEM_BASE),
139 .length = SZ_16M, 139 .length = SZ_16M,
140 .type = MT_DEVICE 140 .type = MT_DEVICE
141 }, { 141 }, {
142 .virtual = PCI_CONFIG_VADDR, 142 .virtual = (unsigned long)PCI_CONFIG_VADDR,
143 .pfn = __phys_to_pfn(PHYS_PCI_CONFIG_BASE), 143 .pfn = __phys_to_pfn(PHYS_PCI_CONFIG_BASE),
144 .length = SZ_16M, 144 .length = SZ_16M,
145 .type = MT_DEVICE 145 .type = MT_DEVICE
146 }, { 146 }, {
147 .virtual = PCI_V3_VADDR, 147 .virtual = (unsigned long)PCI_V3_VADDR,
148 .pfn = __phys_to_pfn(PHYS_PCI_V3_BASE), 148 .pfn = __phys_to_pfn(PHYS_PCI_V3_BASE),
149 .length = SZ_64K, 149 .length = SZ_64K,
150 .type = MT_DEVICE 150 .type = MT_DEVICE
@@ -314,9 +314,9 @@ static void __init ap_init(void)
314/* 314/*
315 * Where is the timer (VA)? 315 * Where is the timer (VA)?
316 */ 316 */
317#define TIMER0_VA_BASE IO_ADDRESS(INTEGRATOR_TIMER0_BASE) 317#define TIMER0_VA_BASE __io_address(INTEGRATOR_TIMER0_BASE)
318#define TIMER1_VA_BASE IO_ADDRESS(INTEGRATOR_TIMER1_BASE) 318#define TIMER1_VA_BASE __io_address(INTEGRATOR_TIMER1_BASE)
319#define TIMER2_VA_BASE IO_ADDRESS(INTEGRATOR_TIMER2_BASE) 319#define TIMER2_VA_BASE __io_address(INTEGRATOR_TIMER2_BASE)
320 320
321static unsigned long timer_reload; 321static unsigned long timer_reload;
322 322
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 82d5c837cc74..3df5fc369361 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -59,7 +59,7 @@
59 59
60#define INTCP_ETH_SIZE 0x10 60#define INTCP_ETH_SIZE 0x10
61 61
62#define INTCP_VA_CTRL_BASE IO_ADDRESS(INTEGRATOR_CP_CTL_BASE) 62#define INTCP_VA_CTRL_BASE __io_address(INTEGRATOR_CP_CTL_BASE)
63#define INTCP_FLASHPROG 0x04 63#define INTCP_FLASHPROG 0x04
64#define CINTEGRATOR_FLASHPROG_FLVPPEN (1 << 0) 64#define CINTEGRATOR_FLASHPROG_FLVPPEN (1 << 0)
65#define CINTEGRATOR_FLASHPROG_FLWREN (1 << 1) 65#define CINTEGRATOR_FLASHPROG_FLWREN (1 << 1)
@@ -265,8 +265,8 @@ static struct platform_device *intcp_devs[] __initdata = {
265 */ 265 */
266static unsigned int mmc_status(struct device *dev) 266static unsigned int mmc_status(struct device *dev)
267{ 267{
268 unsigned int status = readl(IO_ADDRESS(0xca000000 + 4)); 268 unsigned int status = readl(__io_address(0xca000000 + 4));
269 writel(8, IO_ADDRESS(INTEGRATOR_CP_CTL_BASE + 8)); 269 writel(8, __io_address(INTEGRATOR_CP_CTL_BASE + 8));
270 270
271 return status & 8; 271 return status & 8;
272} 272}
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index 495f181fc937..bbeca59df66b 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -181,7 +181,7 @@ static DEFINE_RAW_SPINLOCK(v3_lock);
181#undef V3_LB_BASE_PREFETCH 181#undef V3_LB_BASE_PREFETCH
182#define V3_LB_BASE_PREFETCH 0 182#define V3_LB_BASE_PREFETCH 0
183 183
184static unsigned long v3_open_config_window(struct pci_bus *bus, 184static void __iomem *v3_open_config_window(struct pci_bus *bus,
185 unsigned int devfn, int offset) 185 unsigned int devfn, int offset)
186{ 186{
187 unsigned int address, mapaddress, busnr; 187 unsigned int address, mapaddress, busnr;
@@ -280,7 +280,7 @@ static void v3_close_config_window(void)
280static int v3_read_config(struct pci_bus *bus, unsigned int devfn, int where, 280static int v3_read_config(struct pci_bus *bus, unsigned int devfn, int where,
281 int size, u32 *val) 281 int size, u32 *val)
282{ 282{
283 unsigned long addr; 283 void __iomem *addr;
284 unsigned long flags; 284 unsigned long flags;
285 u32 v; 285 u32 v;
286 286
@@ -311,7 +311,7 @@ static int v3_read_config(struct pci_bus *bus, unsigned int devfn, int where,
311static int v3_write_config(struct pci_bus *bus, unsigned int devfn, int where, 311static int v3_write_config(struct pci_bus *bus, unsigned int devfn, int where,
312 int size, u32 val) 312 int size, u32 val)
313{ 313{
314 unsigned long addr; 314 void __iomem *addr;
315 unsigned long flags; 315 unsigned long flags;
316 316
317 raw_spin_lock_irqsave(&v3_lock, flags); 317 raw_spin_lock_irqsave(&v3_lock, flags);
@@ -388,9 +388,9 @@ static int __init pci_v3_setup_resources(struct pci_sys_data *sys)
388 * means I can't get additional information on the reason for the pm2fb 388 * means I can't get additional information on the reason for the pm2fb
389 * problems. I suppose I'll just have to mind-meld with the machine. ;) 389 * problems. I suppose I'll just have to mind-meld with the machine. ;)
390 */ 390 */
391#define SC_PCI IO_ADDRESS(INTEGRATOR_SC_PCIENABLE) 391#define SC_PCI __io_address(INTEGRATOR_SC_PCIENABLE)
392#define SC_LBFADDR IO_ADDRESS(INTEGRATOR_SC_BASE + 0x20) 392#define SC_LBFADDR __io_address(INTEGRATOR_SC_BASE + 0x20)
393#define SC_LBFCODE IO_ADDRESS(INTEGRATOR_SC_BASE + 0x24) 393#define SC_LBFCODE __io_address(INTEGRATOR_SC_BASE + 0x24)
394 394
395static int 395static int
396v3_pci_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) 396v3_pci_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
diff --git a/arch/arm/mach-iop13xx/include/mach/iop13xx.h b/arch/arm/mach-iop13xx/include/mach/iop13xx.h
index e10e101645dd..7480f58267aa 100644
--- a/arch/arm/mach-iop13xx/include/mach/iop13xx.h
+++ b/arch/arm/mach-iop13xx/include/mach/iop13xx.h
@@ -126,18 +126,16 @@ extern unsigned long get_iop_tick_rate(void);
126 * IOP13XX chipset registers 126 * IOP13XX chipset registers
127 */ 127 */
128#define IOP13XX_PMMR_PHYS_MEM_BASE 0xffd80000UL /* PMMR phys. address */ 128#define IOP13XX_PMMR_PHYS_MEM_BASE 0xffd80000UL /* PMMR phys. address */
129#define IOP13XX_PMMR_VIRT_MEM_BASE 0xfee80000UL /* PMMR phys. address */ 129#define IOP13XX_PMMR_VIRT_MEM_BASE (void __iomem *)(0xfee80000UL) /* PMMR phys. address */
130#define IOP13XX_PMMR_MEM_WINDOW_SIZE 0x80000 130#define IOP13XX_PMMR_MEM_WINDOW_SIZE 0x80000
131#define IOP13XX_PMMR_UPPER_MEM_VA (IOP13XX_PMMR_VIRT_MEM_BASE +\ 131#define IOP13XX_PMMR_UPPER_MEM_VA (IOP13XX_PMMR_VIRT_MEM_BASE +\
132 IOP13XX_PMMR_MEM_WINDOW_SIZE - 1) 132 IOP13XX_PMMR_MEM_WINDOW_SIZE - 1)
133#define IOP13XX_PMMR_UPPER_MEM_PA (IOP13XX_PMMR_PHYS_MEM_BASE +\ 133#define IOP13XX_PMMR_UPPER_MEM_PA (IOP13XX_PMMR_PHYS_MEM_BASE +\
134 IOP13XX_PMMR_MEM_WINDOW_SIZE - 1) 134 IOP13XX_PMMR_MEM_WINDOW_SIZE - 1)
135#define IOP13XX_PMMR_VIRT_TO_PHYS(addr) (u32) ((u32) addr +\ 135#define IOP13XX_PMMR_VIRT_TO_PHYS(addr) (((addr) - IOP13XX_PMMR_VIRT_MEM_BASE)\
136 (IOP13XX_PMMR_PHYS_MEM_BASE\ 136 + IOP13XX_PMMR_PHYS_MEM_BASE)
137 - IOP13XX_PMMR_VIRT_MEM_BASE)) 137#define IOP13XX_PMMR_PHYS_TO_VIRT(addr) (((addr) - IOP13XX_PMMR_PHYS_MEM_BASE)\
138#define IOP13XX_PMMR_PHYS_TO_VIRT(addr) (u32) ((u32) addr -\ 138 + IOP13XX_PMMR_VIRT_MEM_BASE)
139 (IOP13XX_PMMR_PHYS_MEM_BASE\
140 - IOP13XX_PMMR_VIRT_MEM_BASE))
141#define IOP13XX_REG_ADDR32(reg) (IOP13XX_PMMR_VIRT_MEM_BASE + (reg)) 139#define IOP13XX_REG_ADDR32(reg) (IOP13XX_PMMR_VIRT_MEM_BASE + (reg))
142#define IOP13XX_REG_ADDR16(reg) (IOP13XX_PMMR_VIRT_MEM_BASE + (reg)) 140#define IOP13XX_REG_ADDR16(reg) (IOP13XX_PMMR_VIRT_MEM_BASE + (reg))
143#define IOP13XX_REG_ADDR8(reg) (IOP13XX_PMMR_VIRT_MEM_BASE + (reg)) 141#define IOP13XX_REG_ADDR8(reg) (IOP13XX_PMMR_VIRT_MEM_BASE + (reg))
@@ -147,10 +145,10 @@ extern unsigned long get_iop_tick_rate(void);
147#define IOP13XX_PMMR_SIZE 0x00080000 145#define IOP13XX_PMMR_SIZE 0x00080000
148 146
149/*=================== Defines for Platform Devices =====================*/ 147/*=================== Defines for Platform Devices =====================*/
150#define IOP13XX_UART0_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002300) 148#define IOP13XX_UART0_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE + 0x00002300)
151#define IOP13XX_UART1_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002340) 149#define IOP13XX_UART1_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE + 0x00002340)
152#define IOP13XX_UART0_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002300) 150#define IOP13XX_UART0_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE + 0x00002300)
153#define IOP13XX_UART1_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002340) 151#define IOP13XX_UART1_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE + 0x00002340)
154 152
155#define IOP13XX_I2C0_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002500) 153#define IOP13XX_I2C0_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002500)
156#define IOP13XX_I2C1_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002520) 154#define IOP13XX_I2C1_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002520)
diff --git a/arch/arm/mach-iop13xx/include/mach/memory.h b/arch/arm/mach-iop13xx/include/mach/memory.h
index 1afa99ef97fa..7c032d0ab24a 100644
--- a/arch/arm/mach-iop13xx/include/mach/memory.h
+++ b/arch/arm/mach-iop13xx/include/mach/memory.h
@@ -16,12 +16,12 @@
16#define IOP13XX_PMMR_P_START (IOP13XX_PMMR_PHYS_MEM_BASE) 16#define IOP13XX_PMMR_P_START (IOP13XX_PMMR_PHYS_MEM_BASE)
17#define IOP13XX_PMMR_P_END (IOP13XX_PMMR_PHYS_MEM_BASE + IOP13XX_PMMR_SIZE) 17#define IOP13XX_PMMR_P_END (IOP13XX_PMMR_PHYS_MEM_BASE + IOP13XX_PMMR_SIZE)
18 18
19static inline dma_addr_t __virt_to_lbus(unsigned long x) 19static inline dma_addr_t __virt_to_lbus(void __iomem *x)
20{ 20{
21 return x + IOP13XX_PMMR_PHYS_MEM_BASE - IOP13XX_PMMR_VIRT_MEM_BASE; 21 return x + IOP13XX_PMMR_PHYS_MEM_BASE - IOP13XX_PMMR_VIRT_MEM_BASE;
22} 22}
23 23
24static inline unsigned long __lbus_to_virt(dma_addr_t x) 24static inline void __iomem *__lbus_to_virt(dma_addr_t x)
25{ 25{
26 return x + IOP13XX_PMMR_VIRT_MEM_BASE - IOP13XX_PMMR_PHYS_MEM_BASE; 26 return x + IOP13XX_PMMR_VIRT_MEM_BASE - IOP13XX_PMMR_PHYS_MEM_BASE;
27} 27}
@@ -38,23 +38,23 @@ static inline unsigned long __lbus_to_virt(dma_addr_t x)
38 38
39#define __arch_dma_to_virt(dev, addr) \ 39#define __arch_dma_to_virt(dev, addr) \
40 ({ \ 40 ({ \
41 unsigned long __virt; \ 41 void * __virt; \
42 dma_addr_t __dma = addr; \ 42 dma_addr_t __dma = addr; \
43 if (is_lbus_device(dev) && __is_lbus_dma(__dma)) \ 43 if (is_lbus_device(dev) && __is_lbus_dma(__dma)) \
44 __virt = __lbus_to_virt(__dma); \ 44 __virt = __lbus_to_virt(__dma); \
45 else \ 45 else \
46 __virt = __phys_to_virt(__dma); \ 46 __virt = (void *)__phys_to_virt(__dma); \
47 (void *)__virt; \ 47 __virt; \
48 }) 48 })
49 49
50#define __arch_virt_to_dma(dev, addr) \ 50#define __arch_virt_to_dma(dev, addr) \
51 ({ \ 51 ({ \
52 unsigned long __virt = (unsigned long)addr; \ 52 void * __virt = addr; \
53 dma_addr_t __dma; \ 53 dma_addr_t __dma; \
54 if (is_lbus_device(dev) && __is_lbus_virt(__virt)) \ 54 if (is_lbus_device(dev) && __is_lbus_virt(__virt)) \
55 __dma = __virt_to_lbus(__virt); \ 55 __dma = __virt_to_lbus(__virt); \
56 else \ 56 else \
57 __dma = __virt_to_phys(__virt); \ 57 __dma = __virt_to_phys((unsigned long)__virt); \
58 __dma; \ 58 __dma; \
59 }) 59 })
60 60
diff --git a/arch/arm/mach-iop13xx/io.c b/arch/arm/mach-iop13xx/io.c
index 851dc8f2b6b5..183dc8b5511b 100644
--- a/arch/arm/mach-iop13xx/io.c
+++ b/arch/arm/mach-iop13xx/io.c
@@ -33,14 +33,14 @@ static void __iomem *__iop13xx_ioremap_caller(unsigned long cookie,
33 if (unlikely(!iop13xx_atux_mem_base)) 33 if (unlikely(!iop13xx_atux_mem_base))
34 retval = NULL; 34 retval = NULL;
35 else 35 else
36 retval = (void *)(iop13xx_atux_mem_base + 36 retval = (iop13xx_atux_mem_base +
37 (cookie - IOP13XX_PCIX_LOWER_MEM_RA)); 37 (cookie - IOP13XX_PCIX_LOWER_MEM_RA));
38 break; 38 break;
39 case IOP13XX_PCIE_LOWER_MEM_RA ... IOP13XX_PCIE_UPPER_MEM_RA: 39 case IOP13XX_PCIE_LOWER_MEM_RA ... IOP13XX_PCIE_UPPER_MEM_RA:
40 if (unlikely(!iop13xx_atue_mem_base)) 40 if (unlikely(!iop13xx_atue_mem_base))
41 retval = NULL; 41 retval = NULL;
42 else 42 else
43 retval = (void *)(iop13xx_atue_mem_base + 43 retval = (iop13xx_atue_mem_base +
44 (cookie - IOP13XX_PCIE_LOWER_MEM_RA)); 44 (cookie - IOP13XX_PCIE_LOWER_MEM_RA));
45 break; 45 break;
46 case IOP13XX_PBI_LOWER_MEM_RA ... IOP13XX_PBI_UPPER_MEM_RA: 46 case IOP13XX_PBI_LOWER_MEM_RA ... IOP13XX_PBI_UPPER_MEM_RA:
@@ -49,7 +49,7 @@ static void __iomem *__iop13xx_ioremap_caller(unsigned long cookie,
49 size, mtype, __builtin_return_address(0)); 49 size, mtype, __builtin_return_address(0));
50 break; 50 break;
51 case IOP13XX_PMMR_PHYS_MEM_BASE ... IOP13XX_PMMR_UPPER_MEM_PA: 51 case IOP13XX_PMMR_PHYS_MEM_BASE ... IOP13XX_PMMR_UPPER_MEM_PA:
52 retval = (void *) IOP13XX_PMMR_PHYS_TO_VIRT(cookie); 52 retval = IOP13XX_PMMR_PHYS_TO_VIRT(cookie);
53 break; 53 break;
54 default: 54 default:
55 retval = __arm_ioremap_caller(cookie, size, mtype, 55 retval = __arm_ioremap_caller(cookie, size, mtype,
@@ -74,7 +74,7 @@ static void __iop13xx_iounmap(volatile void __iomem *addr)
74 goto skip; 74 goto skip;
75 75
76 switch ((u32) addr) { 76 switch ((u32) addr) {
77 case IOP13XX_PMMR_VIRT_MEM_BASE ... IOP13XX_PMMR_UPPER_MEM_VA: 77 case (u32)IOP13XX_PMMR_VIRT_MEM_BASE ... (u32)IOP13XX_PMMR_UPPER_MEM_VA:
78 goto skip; 78 goto skip;
79 } 79 }
80 __iounmap(addr); 80 __iounmap(addr);
diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c
index 91f731a2957b..9082b84aeebb 100644
--- a/arch/arm/mach-iop13xx/pci.c
+++ b/arch/arm/mach-iop13xx/pci.c
@@ -36,8 +36,8 @@ u32 iop13xx_atux_pmmr_offset; /* This offset can change based on strapping */
36u32 iop13xx_atue_pmmr_offset; /* This offset can change based on strapping */ 36u32 iop13xx_atue_pmmr_offset; /* This offset can change based on strapping */
37static struct pci_bus *pci_bus_atux = 0; 37static struct pci_bus *pci_bus_atux = 0;
38static struct pci_bus *pci_bus_atue = 0; 38static struct pci_bus *pci_bus_atue = 0;
39u32 iop13xx_atue_mem_base; 39void __iomem *iop13xx_atue_mem_base;
40u32 iop13xx_atux_mem_base; 40void __iomem *iop13xx_atux_mem_base;
41size_t iop13xx_atue_mem_size; 41size_t iop13xx_atue_mem_size;
42size_t iop13xx_atux_mem_size; 42size_t iop13xx_atux_mem_size;
43 43
@@ -88,8 +88,7 @@ void iop13xx_map_pci_memory(void)
88 } 88 }
89 89
90 if (end) { 90 if (end) {
91 iop13xx_atux_mem_base = 91 iop13xx_atux_mem_base = __arm_ioremap_pfn(
92 (u32) __arm_ioremap_pfn(
93 __phys_to_pfn(IOP13XX_PCIX_LOWER_MEM_PA) 92 __phys_to_pfn(IOP13XX_PCIX_LOWER_MEM_PA)
94 , 0, iop13xx_atux_mem_size, MT_DEVICE); 93 , 0, iop13xx_atux_mem_size, MT_DEVICE);
95 if (!iop13xx_atux_mem_base) { 94 if (!iop13xx_atux_mem_base) {
@@ -99,7 +98,7 @@ void iop13xx_map_pci_memory(void)
99 } 98 }
100 } else 99 } else
101 iop13xx_atux_mem_size = 0; 100 iop13xx_atux_mem_size = 0;
102 PRINTK("%s: atu: %d bus_size: %d mem_base: %x\n", 101 PRINTK("%s: atu: %d bus_size: %d mem_base: %p\n",
103 __func__, atu, iop13xx_atux_mem_size, 102 __func__, atu, iop13xx_atux_mem_size,
104 iop13xx_atux_mem_base); 103 iop13xx_atux_mem_base);
105 break; 104 break;
@@ -114,8 +113,7 @@ void iop13xx_map_pci_memory(void)
114 } 113 }
115 114
116 if (end) { 115 if (end) {
117 iop13xx_atue_mem_base = 116 iop13xx_atue_mem_base = __arm_ioremap_pfn(
118 (u32) __arm_ioremap_pfn(
119 __phys_to_pfn(IOP13XX_PCIE_LOWER_MEM_PA) 117 __phys_to_pfn(IOP13XX_PCIE_LOWER_MEM_PA)
120 , 0, iop13xx_atue_mem_size, MT_DEVICE); 118 , 0, iop13xx_atue_mem_size, MT_DEVICE);
121 if (!iop13xx_atue_mem_base) { 119 if (!iop13xx_atue_mem_base) {
@@ -125,13 +123,13 @@ void iop13xx_map_pci_memory(void)
125 } 123 }
126 } else 124 } else
127 iop13xx_atue_mem_size = 0; 125 iop13xx_atue_mem_size = 0;
128 PRINTK("%s: atu: %d bus_size: %d mem_base: %x\n", 126 PRINTK("%s: atu: %d bus_size: %d mem_base: %p\n",
129 __func__, atu, iop13xx_atue_mem_size, 127 __func__, atu, iop13xx_atue_mem_size,
130 iop13xx_atue_mem_base); 128 iop13xx_atue_mem_base);
131 break; 129 break;
132 } 130 }
133 131
134 printk("%s: Initialized (%uM @ resource/virtual: %08lx/%08x)\n", 132 printk("%s: Initialized (%uM @ resource/virtual: %08lx/%p)\n",
135 atu ? "ATUE" : "ATUX", 133 atu ? "ATUE" : "ATUX",
136 (atu ? iop13xx_atue_mem_size : iop13xx_atux_mem_size) / 134 (atu ? iop13xx_atue_mem_size : iop13xx_atux_mem_size) /
137 SZ_1M, 135 SZ_1M,
diff --git a/arch/arm/mach-iop13xx/pci.h b/arch/arm/mach-iop13xx/pci.h
index c70cf5b41e31..d45a80b3080e 100644
--- a/arch/arm/mach-iop13xx/pci.h
+++ b/arch/arm/mach-iop13xx/pci.h
@@ -1,6 +1,6 @@
1#include <linux/types.h> 1#include <linux/types.h>
2 2
3extern u32 iop13xx_atue_mem_base; 3extern void __iomem *iop13xx_atue_mem_base;
4extern u32 iop13xx_atux_mem_base; 4extern void __iomem *iop13xx_atux_mem_base;
5extern size_t iop13xx_atue_mem_size; 5extern size_t iop13xx_atue_mem_size;
6extern size_t iop13xx_atux_mem_size; 6extern size_t iop13xx_atux_mem_size;
diff --git a/arch/arm/mach-iop13xx/setup.c b/arch/arm/mach-iop13xx/setup.c
index 4a7f20d7fb6e..3181f61ea63e 100644
--- a/arch/arm/mach-iop13xx/setup.c
+++ b/arch/arm/mach-iop13xx/setup.c
@@ -36,7 +36,7 @@
36 */ 36 */
37static struct map_desc iop13xx_std_desc[] __initdata = { 37static struct map_desc iop13xx_std_desc[] __initdata = {
38 { /* mem mapped registers */ 38 { /* mem mapped registers */
39 .virtual = IOP13XX_PMMR_VIRT_MEM_BASE, 39 .virtual = (unsigned long)IOP13XX_PMMR_VIRT_MEM_BASE,
40 .pfn = __phys_to_pfn(IOP13XX_PMMR_PHYS_MEM_BASE), 40 .pfn = __phys_to_pfn(IOP13XX_PMMR_PHYS_MEM_BASE),
41 .length = IOP13XX_PMMR_SIZE, 41 .length = IOP13XX_PMMR_SIZE,
42 .type = MT_DEVICE, 42 .type = MT_DEVICE,
@@ -71,8 +71,8 @@ static struct resource iop13xx_uart1_resources[] = {
71 71
72static struct plat_serial8250_port iop13xx_uart0_data[] = { 72static struct plat_serial8250_port iop13xx_uart0_data[] = {
73 { 73 {
74 .membase = (char*)(IOP13XX_UART0_VIRT), 74 .membase = IOP13XX_UART0_VIRT,
75 .mapbase = (IOP13XX_UART0_PHYS), 75 .mapbase = IOP13XX_UART0_PHYS,
76 .irq = IRQ_IOP13XX_UART0, 76 .irq = IRQ_IOP13XX_UART0,
77 .uartclk = IOP13XX_UART_XTAL, 77 .uartclk = IOP13XX_UART_XTAL,
78 .regshift = 2, 78 .regshift = 2,
@@ -84,8 +84,8 @@ static struct plat_serial8250_port iop13xx_uart0_data[] = {
84 84
85static struct plat_serial8250_port iop13xx_uart1_data[] = { 85static struct plat_serial8250_port iop13xx_uart1_data[] = {
86 { 86 {
87 .membase = (char*)(IOP13XX_UART1_VIRT), 87 .membase = IOP13XX_UART1_VIRT,
88 .mapbase = (IOP13XX_UART1_PHYS), 88 .mapbase = IOP13XX_UART1_PHYS,
89 .irq = IRQ_IOP13XX_UART1, 89 .irq = IRQ_IOP13XX_UART1,
90 .uartclk = IOP13XX_UART_XTAL, 90 .uartclk = IOP13XX_UART_XTAL,
91 .regshift = 2, 91 .regshift = 2,
diff --git a/arch/arm/mach-iop32x/glantank.c b/arch/arm/mach-iop32x/glantank.c
index c15a100ba779..02e20c3912ba 100644
--- a/arch/arm/mach-iop32x/glantank.c
+++ b/arch/arm/mach-iop32x/glantank.c
@@ -183,7 +183,7 @@ static struct i2c_board_info __initdata glantank_i2c_devices[] = {
183 183
184static void glantank_power_off(void) 184static void glantank_power_off(void)
185{ 185{
186 __raw_writeb(0x01, 0xfe8d0004); 186 __raw_writeb(0x01, IOMEM(0xfe8d0004));
187 187
188 while (1) 188 while (1)
189 ; 189 ;
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index a9f80943d01f..fdf91a160884 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -53,24 +53,24 @@ static struct clock_event_device clockevent_ixp4xx;
53 *************************************************************************/ 53 *************************************************************************/
54static struct map_desc ixp4xx_io_desc[] __initdata = { 54static struct map_desc ixp4xx_io_desc[] __initdata = {
55 { /* UART, Interrupt ctrl, GPIO, timers, NPEs, MACs, USB .... */ 55 { /* UART, Interrupt ctrl, GPIO, timers, NPEs, MACs, USB .... */
56 .virtual = IXP4XX_PERIPHERAL_BASE_VIRT, 56 .virtual = (unsigned long)IXP4XX_PERIPHERAL_BASE_VIRT,
57 .pfn = __phys_to_pfn(IXP4XX_PERIPHERAL_BASE_PHYS), 57 .pfn = __phys_to_pfn(IXP4XX_PERIPHERAL_BASE_PHYS),
58 .length = IXP4XX_PERIPHERAL_REGION_SIZE, 58 .length = IXP4XX_PERIPHERAL_REGION_SIZE,
59 .type = MT_DEVICE 59 .type = MT_DEVICE
60 }, { /* Expansion Bus Config Registers */ 60 }, { /* Expansion Bus Config Registers */
61 .virtual = IXP4XX_EXP_CFG_BASE_VIRT, 61 .virtual = (unsigned long)IXP4XX_EXP_CFG_BASE_VIRT,
62 .pfn = __phys_to_pfn(IXP4XX_EXP_CFG_BASE_PHYS), 62 .pfn = __phys_to_pfn(IXP4XX_EXP_CFG_BASE_PHYS),
63 .length = IXP4XX_EXP_CFG_REGION_SIZE, 63 .length = IXP4XX_EXP_CFG_REGION_SIZE,
64 .type = MT_DEVICE 64 .type = MT_DEVICE
65 }, { /* PCI Registers */ 65 }, { /* PCI Registers */
66 .virtual = IXP4XX_PCI_CFG_BASE_VIRT, 66 .virtual = (unsigned long)IXP4XX_PCI_CFG_BASE_VIRT,
67 .pfn = __phys_to_pfn(IXP4XX_PCI_CFG_BASE_PHYS), 67 .pfn = __phys_to_pfn(IXP4XX_PCI_CFG_BASE_PHYS),
68 .length = IXP4XX_PCI_CFG_REGION_SIZE, 68 .length = IXP4XX_PCI_CFG_REGION_SIZE,
69 .type = MT_DEVICE 69 .type = MT_DEVICE
70 }, 70 },
71#ifdef CONFIG_DEBUG_LL 71#ifdef CONFIG_DEBUG_LL
72 { /* Debug UART mapping */ 72 { /* Debug UART mapping */
73 .virtual = IXP4XX_DEBUG_UART_BASE_VIRT, 73 .virtual = (unsigned long)IXP4XX_DEBUG_UART_BASE_VIRT,
74 .pfn = __phys_to_pfn(IXP4XX_DEBUG_UART_BASE_PHYS), 74 .pfn = __phys_to_pfn(IXP4XX_DEBUG_UART_BASE_PHYS),
75 .length = IXP4XX_DEBUG_UART_REGION_SIZE, 75 .length = IXP4XX_DEBUG_UART_REGION_SIZE,
76 .type = MT_DEVICE 76 .type = MT_DEVICE
diff --git a/arch/arm/mach-ixp4xx/include/mach/cpu.h b/arch/arm/mach-ixp4xx/include/mach/cpu.h
index b2ef65db0e91..ebc0ba31ce85 100644
--- a/arch/arm/mach-ixp4xx/include/mach/cpu.h
+++ b/arch/arm/mach-ixp4xx/include/mach/cpu.h
@@ -14,6 +14,7 @@
14#ifndef __ASM_ARCH_CPU_H__ 14#ifndef __ASM_ARCH_CPU_H__
15#define __ASM_ARCH_CPU_H__ 15#define __ASM_ARCH_CPU_H__
16 16
17#include <linux/io.h>
17#include <asm/cputype.h> 18#include <asm/cputype.h>
18 19
19/* Processor id value in CP15 Register 0 */ 20/* Processor id value in CP15 Register 0 */
@@ -37,7 +38,7 @@
37 38
38static inline u32 ixp4xx_read_feature_bits(void) 39static inline u32 ixp4xx_read_feature_bits(void)
39{ 40{
40 u32 val = ~*IXP4XX_EXP_CFG2; 41 u32 val = ~__raw_readl(IXP4XX_EXP_CFG2);
41 42
42 if (cpu_is_ixp42x_rev_a0()) 43 if (cpu_is_ixp42x_rev_a0())
43 return IXP42X_FEATURE_MASK & ~(IXP4XX_FEATURE_RCOMP | 44 return IXP42X_FEATURE_MASK & ~(IXP4XX_FEATURE_RCOMP |
@@ -51,7 +52,7 @@ static inline u32 ixp4xx_read_feature_bits(void)
51 52
52static inline void ixp4xx_write_feature_bits(u32 value) 53static inline void ixp4xx_write_feature_bits(u32 value)
53{ 54{
54 *IXP4XX_EXP_CFG2 = ~value; 55 __raw_writel(~value, IXP4XX_EXP_CFG2);
55} 56}
56 57
57#endif /* _ASM_ARCH_CPU_H */ 58#endif /* _ASM_ARCH_CPU_H */
diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
index 97c530f66e78..eb68b61ce975 100644
--- a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
+++ b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
@@ -49,21 +49,21 @@
49 * Expansion BUS Configuration registers 49 * Expansion BUS Configuration registers
50 */ 50 */
51#define IXP4XX_EXP_CFG_BASE_PHYS (0xC4000000) 51#define IXP4XX_EXP_CFG_BASE_PHYS (0xC4000000)
52#define IXP4XX_EXP_CFG_BASE_VIRT (0xFFBFE000) 52#define IXP4XX_EXP_CFG_BASE_VIRT IOMEM(0xFFBFE000)
53#define IXP4XX_EXP_CFG_REGION_SIZE (0x00001000) 53#define IXP4XX_EXP_CFG_REGION_SIZE (0x00001000)
54 54
55/* 55/*
56 * PCI Config registers 56 * PCI Config registers
57 */ 57 */
58#define IXP4XX_PCI_CFG_BASE_PHYS (0xC0000000) 58#define IXP4XX_PCI_CFG_BASE_PHYS (0xC0000000)
59#define IXP4XX_PCI_CFG_BASE_VIRT (0xFFBFF000) 59#define IXP4XX_PCI_CFG_BASE_VIRT IOMEM(0xFFBFF000)
60#define IXP4XX_PCI_CFG_REGION_SIZE (0x00001000) 60#define IXP4XX_PCI_CFG_REGION_SIZE (0x00001000)
61 61
62/* 62/*
63 * Peripheral space 63 * Peripheral space
64 */ 64 */
65#define IXP4XX_PERIPHERAL_BASE_PHYS (0xC8000000) 65#define IXP4XX_PERIPHERAL_BASE_PHYS (0xC8000000)
66#define IXP4XX_PERIPHERAL_BASE_VIRT (0xFFBEB000) 66#define IXP4XX_PERIPHERAL_BASE_VIRT IOMEM(0xFFBEB000)
67#define IXP4XX_PERIPHERAL_REGION_SIZE (0x00013000) 67#define IXP4XX_PERIPHERAL_REGION_SIZE (0x00013000)
68 68
69/* 69/*
@@ -73,7 +73,7 @@
73 * aligned so that it * can be used with the low-level debug code. 73 * aligned so that it * can be used with the low-level debug code.
74 */ 74 */
75#define IXP4XX_DEBUG_UART_BASE_PHYS (0xC8000000) 75#define IXP4XX_DEBUG_UART_BASE_PHYS (0xC8000000)
76#define IXP4XX_DEBUG_UART_BASE_VIRT (0xffb00000) 76#define IXP4XX_DEBUG_UART_BASE_VIRT IOMEM(0xffb00000)
77#define IXP4XX_DEBUG_UART_REGION_SIZE (0x00001000) 77#define IXP4XX_DEBUG_UART_REGION_SIZE (0x00001000)
78 78
79#define IXP4XX_EXP_CS0_OFFSET 0x00 79#define IXP4XX_EXP_CS0_OFFSET 0x00
@@ -92,7 +92,7 @@
92/* 92/*
93 * Expansion Bus Controller registers. 93 * Expansion Bus Controller registers.
94 */ 94 */
95#define IXP4XX_EXP_REG(x) ((volatile u32 *)(IXP4XX_EXP_CFG_BASE_VIRT+(x))) 95#define IXP4XX_EXP_REG(x) ((volatile u32 __iomem *)(IXP4XX_EXP_CFG_BASE_VIRT+(x)))
96 96
97#define IXP4XX_EXP_CS0 IXP4XX_EXP_REG(IXP4XX_EXP_CS0_OFFSET) 97#define IXP4XX_EXP_CS0 IXP4XX_EXP_REG(IXP4XX_EXP_CS0_OFFSET)
98#define IXP4XX_EXP_CS1 IXP4XX_EXP_REG(IXP4XX_EXP_CS1_OFFSET) 98#define IXP4XX_EXP_CS1 IXP4XX_EXP_REG(IXP4XX_EXP_CS1_OFFSET)
diff --git a/arch/arm/mach-ks8695/cpu.c b/arch/arm/mach-ks8695/cpu.c
index 7f3f24053a00..ddb24222918e 100644
--- a/arch/arm/mach-ks8695/cpu.c
+++ b/arch/arm/mach-ks8695/cpu.c
@@ -36,7 +36,7 @@
36 36
37static struct __initdata map_desc ks8695_io_desc[] = { 37static struct __initdata map_desc ks8695_io_desc[] = {
38 { 38 {
39 .virtual = KS8695_IO_VA, 39 .virtual = (unsigned long)KS8695_IO_VA,
40 .pfn = __phys_to_pfn(KS8695_IO_PA), 40 .pfn = __phys_to_pfn(KS8695_IO_PA),
41 .length = KS8695_IO_SIZE, 41 .length = KS8695_IO_SIZE,
42 .type = MT_DEVICE, 42 .type = MT_DEVICE,
diff --git a/arch/arm/mach-ks8695/include/mach/hardware.h b/arch/arm/mach-ks8695/include/mach/hardware.h
index 5e0c388143da..5090338c0db2 100644
--- a/arch/arm/mach-ks8695/include/mach/hardware.h
+++ b/arch/arm/mach-ks8695/include/mach/hardware.h
@@ -33,7 +33,7 @@
33 * head debug code as the initial MMU setup only deals in L1 sections. 33 * head debug code as the initial MMU setup only deals in L1 sections.
34 */ 34 */
35#define KS8695_IO_PA 0x03F00000 35#define KS8695_IO_PA 0x03F00000
36#define KS8695_IO_VA 0xF0000000 36#define KS8695_IO_VA IOMEM(0xF0000000)
37#define KS8695_IO_SIZE SZ_1M 37#define KS8695_IO_SIZE SZ_1M
38 38
39#define KS8695_PCIMEM_PA 0x60000000 39#define KS8695_PCIMEM_PA 0x60000000
diff --git a/arch/arm/mach-ks8695/include/mach/uncompress.h b/arch/arm/mach-ks8695/include/mach/uncompress.h
index 9495cb4d701a..8879d610308a 100644
--- a/arch/arm/mach-ks8695/include/mach/uncompress.h
+++ b/arch/arm/mach-ks8695/include/mach/uncompress.h
@@ -19,15 +19,15 @@
19 19
20static void putc(char c) 20static void putc(char c)
21{ 21{
22 while (!(__raw_readl(KS8695_UART_PA + KS8695_URLS) & URLS_URTHRE)) 22 while (!(__raw_readl((void __iomem*)KS8695_UART_PA + KS8695_URLS) & URLS_URTHRE))
23 barrier(); 23 barrier();
24 24
25 __raw_writel(c, KS8695_UART_PA + KS8695_URTH); 25 __raw_writel(c, (void __iomem*)KS8695_UART_PA + KS8695_URTH);
26} 26}
27 27
28static inline void flush(void) 28static inline void flush(void)
29{ 29{
30 while (!(__raw_readl(KS8695_UART_PA + KS8695_URLS) & URLS_URTE)) 30 while (!(__raw_readl((void __iomem*)KS8695_UART_PA + KS8695_URLS) & URLS_URTE))
31 barrier(); 31 barrier();
32} 32}
33 33
diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c
index a48dc2dec485..0d4db8c544b5 100644
--- a/arch/arm/mach-lpc32xx/common.c
+++ b/arch/arm/mach-lpc32xx/common.c
@@ -177,25 +177,25 @@ u32 clk_get_pclk_div(void)
177 177
178static struct map_desc lpc32xx_io_desc[] __initdata = { 178static struct map_desc lpc32xx_io_desc[] __initdata = {
179 { 179 {
180 .virtual = IO_ADDRESS(LPC32XX_AHB0_START), 180 .virtual = (unsigned long)IO_ADDRESS(LPC32XX_AHB0_START),
181 .pfn = __phys_to_pfn(LPC32XX_AHB0_START), 181 .pfn = __phys_to_pfn(LPC32XX_AHB0_START),
182 .length = LPC32XX_AHB0_SIZE, 182 .length = LPC32XX_AHB0_SIZE,
183 .type = MT_DEVICE 183 .type = MT_DEVICE
184 }, 184 },
185 { 185 {
186 .virtual = IO_ADDRESS(LPC32XX_AHB1_START), 186 .virtual = (unsigned long)IO_ADDRESS(LPC32XX_AHB1_START),
187 .pfn = __phys_to_pfn(LPC32XX_AHB1_START), 187 .pfn = __phys_to_pfn(LPC32XX_AHB1_START),
188 .length = LPC32XX_AHB1_SIZE, 188 .length = LPC32XX_AHB1_SIZE,
189 .type = MT_DEVICE 189 .type = MT_DEVICE
190 }, 190 },
191 { 191 {
192 .virtual = IO_ADDRESS(LPC32XX_FABAPB_START), 192 .virtual = (unsigned long)IO_ADDRESS(LPC32XX_FABAPB_START),
193 .pfn = __phys_to_pfn(LPC32XX_FABAPB_START), 193 .pfn = __phys_to_pfn(LPC32XX_FABAPB_START),
194 .length = LPC32XX_FABAPB_SIZE, 194 .length = LPC32XX_FABAPB_SIZE,
195 .type = MT_DEVICE 195 .type = MT_DEVICE
196 }, 196 },
197 { 197 {
198 .virtual = IO_ADDRESS(LPC32XX_IRAM_BASE), 198 .virtual = (unsigned long)IO_ADDRESS(LPC32XX_IRAM_BASE),
199 .pfn = __phys_to_pfn(LPC32XX_IRAM_BASE), 199 .pfn = __phys_to_pfn(LPC32XX_IRAM_BASE),
200 .length = (LPC32XX_IRAM_BANK_SIZE * 2), 200 .length = (LPC32XX_IRAM_BANK_SIZE * 2),
201 .type = MT_DEVICE 201 .type = MT_DEVICE
diff --git a/arch/arm/mach-lpc32xx/include/mach/hardware.h b/arch/arm/mach-lpc32xx/include/mach/hardware.h
index 33e1dde37bd9..69065de97a3d 100644
--- a/arch/arm/mach-lpc32xx/include/mach/hardware.h
+++ b/arch/arm/mach-lpc32xx/include/mach/hardware.h
@@ -25,7 +25,7 @@
25/* 25/*
26 * This macro relies on fact that for all HW i/o addresses bits 20-23 are 0 26 * This macro relies on fact that for all HW i/o addresses bits 20-23 are 0
27 */ 27 */
28#define IO_ADDRESS(x) (((((x) & 0xff000000) >> 4) | ((x) & 0xfffff)) |\ 28#define IO_ADDRESS(x) IOMEM(((((x) & 0xff000000) >> 4) | ((x) & 0xfffff)) |\
29 IO_BASE) 29 IO_BASE)
30 30
31#define io_p2v(x) ((void __iomem *) (unsigned long) IO_ADDRESS(x)) 31#define io_p2v(x) ((void __iomem *) (unsigned long) IO_ADDRESS(x))
diff --git a/arch/arm/mach-mmp/irq.c b/arch/arm/mach-mmp/irq.c
index e60c7d98922b..3c71246cd994 100644
--- a/arch/arm/mach-mmp/irq.c
+++ b/arch/arm/mach-mmp/irq.c
@@ -153,10 +153,8 @@ static void icu_mux_irq_demux(unsigned int irq, struct irq_desc *desc)
153 status = readl_relaxed(data->reg_status) & ~mask; 153 status = readl_relaxed(data->reg_status) & ~mask;
154 if (status == 0) 154 if (status == 0)
155 break; 155 break;
156 n = find_first_bit(&status, BITS_PER_LONG); 156 for_each_set_bit(n, &status, BITS_PER_LONG) {
157 while (n < BITS_PER_LONG) {
158 generic_handle_irq(icu_data[i].virq_base + n); 157 generic_handle_irq(icu_data[i].virq_base + n);
159 n = find_next_bit(&status, BITS_PER_LONG, n + 1);
160 } 158 }
161 } 159 }
162} 160}
diff --git a/arch/arm/mach-msm/smd.c b/arch/arm/mach-msm/smd.c
index 84183ed2ef79..c5a2eddc6cdc 100644
--- a/arch/arm/mach-msm/smd.c
+++ b/arch/arm/mach-msm/smd.c
@@ -49,13 +49,14 @@ static int msm_smd_debug_mask;
49 49
50struct shared_info { 50struct shared_info {
51 int ready; 51 int ready;
52 unsigned state; 52 void __iomem *state;
53}; 53};
54 54
55static unsigned dummy_state[SMSM_STATE_COUNT]; 55static unsigned dummy_state[SMSM_STATE_COUNT];
56 56
57static struct shared_info smd_info = { 57static struct shared_info smd_info = {
58 .state = (unsigned) &dummy_state, 58 /* FIXME: not a real __iomem pointer */
59 .state = &dummy_state,
59}; 60};
60 61
61module_param_named(debug_mask, msm_smd_debug_mask, 62module_param_named(debug_mask, msm_smd_debug_mask,
@@ -789,22 +790,22 @@ void *smem_alloc(unsigned id, unsigned size)
789 return smem_find(id, size); 790 return smem_find(id, size);
790} 791}
791 792
792void *smem_item(unsigned id, unsigned *size) 793void __iomem *smem_item(unsigned id, unsigned *size)
793{ 794{
794 struct smem_shared *shared = (void *) MSM_SHARED_RAM_BASE; 795 struct smem_shared *shared = (void *) MSM_SHARED_RAM_BASE;
795 struct smem_heap_entry *toc = shared->heap_toc; 796 struct smem_heap_entry *toc = shared->heap_toc;
796 797
797 if (id >= SMEM_NUM_ITEMS) 798 if (id >= SMEM_NUM_ITEMS)
798 return 0; 799 return NULL;
799 800
800 if (toc[id].allocated) { 801 if (toc[id].allocated) {
801 *size = toc[id].size; 802 *size = toc[id].size;
802 return (void *) (MSM_SHARED_RAM_BASE + toc[id].offset); 803 return (MSM_SHARED_RAM_BASE + toc[id].offset);
803 } else { 804 } else {
804 *size = 0; 805 *size = 0;
805 } 806 }
806 807
807 return 0; 808 return NULL;
808} 809}
809 810
810void *smem_find(unsigned id, unsigned size_in) 811void *smem_find(unsigned id, unsigned size_in)
@@ -850,7 +851,7 @@ static irqreturn_t smsm_irq_handler(int irq, void *data)
850int smsm_change_state(enum smsm_state_item item, 851int smsm_change_state(enum smsm_state_item item,
851 uint32_t clear_mask, uint32_t set_mask) 852 uint32_t clear_mask, uint32_t set_mask)
852{ 853{
853 unsigned long addr = smd_info.state + item * 4; 854 void __iomem *addr = smd_info.state + item * 4;
854 unsigned long flags; 855 unsigned long flags;
855 unsigned state; 856 unsigned state;
856 857
@@ -936,10 +937,10 @@ int smd_core_init(void)
936 /* wait for essential items to be initialized */ 937 /* wait for essential items to be initialized */
937 for (;;) { 938 for (;;) {
938 unsigned size; 939 unsigned size;
939 void *state; 940 void __iomem *state;
940 state = smem_item(SMEM_SMSM_SHARED_STATE, &size); 941 state = smem_item(SMEM_SMSM_SHARED_STATE, &size);
941 if (size == SMSM_V1_SIZE || size == SMSM_V2_SIZE) { 942 if (size == SMSM_V1_SIZE || size == SMSM_V2_SIZE) {
942 smd_info.state = (unsigned)state; 943 smd_info.state = state;
943 break; 944 break;
944 } 945 }
945 } 946 }
diff --git a/arch/arm/mach-nomadik/include/mach/hardware.h b/arch/arm/mach-nomadik/include/mach/hardware.h
index 6316dba3bfc8..02035e459f50 100644
--- a/arch/arm/mach-nomadik/include/mach/hardware.h
+++ b/arch/arm/mach-nomadik/include/mach/hardware.h
@@ -30,7 +30,7 @@
30 - NOMADIK_IO_VIRTUAL + NOMADIK_IO_PHYSICAL) 30 - NOMADIK_IO_VIRTUAL + NOMADIK_IO_PHYSICAL)
31 31
32/* used in asm code, so no casts */ 32/* used in asm code, so no casts */
33#define IO_ADDRESS(x) ((x) - NOMADIK_IO_PHYSICAL + NOMADIK_IO_VIRTUAL) 33#define IO_ADDRESS(x) IOMEM((x) - NOMADIK_IO_PHYSICAL + NOMADIK_IO_VIRTUAL)
34 34
35/* 35/*
36 * Base address defination for Nomadik Onchip Logic Block 36 * Base address defination for Nomadik Onchip Logic Block
diff --git a/arch/arm/mach-nomadik/include/mach/uncompress.h b/arch/arm/mach-nomadik/include/mach/uncompress.h
index 071003bc8456..7d4687e9cbdf 100644
--- a/arch/arm/mach-nomadik/include/mach/uncompress.h
+++ b/arch/arm/mach-nomadik/include/mach/uncompress.h
@@ -27,10 +27,10 @@
27struct amba_device; 27struct amba_device;
28#include <linux/amba/serial.h> 28#include <linux/amba/serial.h>
29 29
30#define NOMADIK_UART_DR 0x101FB000 30#define NOMADIK_UART_DR (void __iomem *)0x101FB000
31#define NOMADIK_UART_LCRH 0x101FB02c 31#define NOMADIK_UART_LCRH (void __iomem *)0x101FB02c
32#define NOMADIK_UART_CR 0x101FB030 32#define NOMADIK_UART_CR (void __iomem *)0x101FB030
33#define NOMADIK_UART_FR 0x101FB018 33#define NOMADIK_UART_FR (void __iomem *)0x101FB018
34 34
35static void putc(const char c) 35static void putc(const char c)
36{ 36{
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index fcd4e85c4ddc..346fd26f3aa6 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -232,10 +232,11 @@ config MACH_OMAP3_PANDORA
232 select OMAP_PACKAGE_CBB 232 select OMAP_PACKAGE_CBB
233 select REGULATOR_FIXED_VOLTAGE if REGULATOR 233 select REGULATOR_FIXED_VOLTAGE if REGULATOR
234 234
235config MACH_OMAP3_TOUCHBOOK 235config MACH_TOUCHBOOK
236 bool "OMAP3 Touch Book" 236 bool "OMAP3 Touch Book"
237 depends on ARCH_OMAP3 237 depends on ARCH_OMAP3
238 default y 238 default y
239 select OMAP_PACKAGE_CBB
239 240
240config MACH_OMAP_3430SDP 241config MACH_OMAP_3430SDP
241 bool "OMAP 3430 SDP board" 242 bool "OMAP 3430 SDP board"
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index eb203ec193d0..7706fdfd0252 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -235,7 +235,7 @@ obj-$(CONFIG_MACH_OMAP_3630SDP) += board-zoom-display.o
235obj-$(CONFIG_MACH_CM_T35) += board-cm-t35.o 235obj-$(CONFIG_MACH_CM_T35) += board-cm-t35.o
236obj-$(CONFIG_MACH_CM_T3517) += board-cm-t3517.o 236obj-$(CONFIG_MACH_CM_T3517) += board-cm-t3517.o
237obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o 237obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o
238obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o 238obj-$(CONFIG_MACH_TOUCHBOOK) += board-omap3touchbook.o
239obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o 239obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o
240obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o 240obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o
241 241
diff --git a/arch/arm/mach-omap2/clock33xx_data.c b/arch/arm/mach-omap2/clock33xx_data.c
index 7aa5ecaee5a2..8e06de665b14 100644
--- a/arch/arm/mach-omap2/clock33xx_data.c
+++ b/arch/arm/mach-omap2/clock33xx_data.c
@@ -1036,13 +1036,13 @@ static struct omap_clk am33xx_clks[] = {
1036 CLK(NULL, "mmu_fck", &mmu_fck, CK_AM33XX), 1036 CLK(NULL, "mmu_fck", &mmu_fck, CK_AM33XX),
1037 CLK(NULL, "smartreflex0_fck", &smartreflex0_fck, CK_AM33XX), 1037 CLK(NULL, "smartreflex0_fck", &smartreflex0_fck, CK_AM33XX),
1038 CLK(NULL, "smartreflex1_fck", &smartreflex1_fck, CK_AM33XX), 1038 CLK(NULL, "smartreflex1_fck", &smartreflex1_fck, CK_AM33XX),
1039 CLK(NULL, "gpt1_fck", &timer1_fck, CK_AM33XX), 1039 CLK(NULL, "timer1_fck", &timer1_fck, CK_AM33XX),
1040 CLK(NULL, "gpt2_fck", &timer2_fck, CK_AM33XX), 1040 CLK(NULL, "timer2_fck", &timer2_fck, CK_AM33XX),
1041 CLK(NULL, "gpt3_fck", &timer3_fck, CK_AM33XX), 1041 CLK(NULL, "timer3_fck", &timer3_fck, CK_AM33XX),
1042 CLK(NULL, "gpt4_fck", &timer4_fck, CK_AM33XX), 1042 CLK(NULL, "timer4_fck", &timer4_fck, CK_AM33XX),
1043 CLK(NULL, "gpt5_fck", &timer5_fck, CK_AM33XX), 1043 CLK(NULL, "timer5_fck", &timer5_fck, CK_AM33XX),
1044 CLK(NULL, "gpt6_fck", &timer6_fck, CK_AM33XX), 1044 CLK(NULL, "timer6_fck", &timer6_fck, CK_AM33XX),
1045 CLK(NULL, "gpt7_fck", &timer7_fck, CK_AM33XX), 1045 CLK(NULL, "timer7_fck", &timer7_fck, CK_AM33XX),
1046 CLK(NULL, "usbotg_fck", &usbotg_fck, CK_AM33XX), 1046 CLK(NULL, "usbotg_fck", &usbotg_fck, CK_AM33XX),
1047 CLK(NULL, "ieee5000_fck", &ieee5000_fck, CK_AM33XX), 1047 CLK(NULL, "ieee5000_fck", &ieee5000_fck, CK_AM33XX),
1048 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_AM33XX), 1048 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_AM33XX),
diff --git a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
index a0d68dbecfa3..f99e65cfb862 100644
--- a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
@@ -241,6 +241,52 @@ static void omap3_clkdm_deny_idle(struct clockdomain *clkdm)
241 _clkdm_del_autodeps(clkdm); 241 _clkdm_del_autodeps(clkdm);
242} 242}
243 243
244static int omap3xxx_clkdm_clk_enable(struct clockdomain *clkdm)
245{
246 bool hwsup = false;
247
248 if (!clkdm->clktrctrl_mask)
249 return 0;
250
251 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
252 clkdm->clktrctrl_mask);
253
254 if (hwsup) {
255 /* Disable HW transitions when we are changing deps */
256 _disable_hwsup(clkdm);
257 _clkdm_add_autodeps(clkdm);
258 _enable_hwsup(clkdm);
259 } else {
260 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
261 omap3_clkdm_wakeup(clkdm);
262 }
263
264 return 0;
265}
266
267static int omap3xxx_clkdm_clk_disable(struct clockdomain *clkdm)
268{
269 bool hwsup = false;
270
271 if (!clkdm->clktrctrl_mask)
272 return 0;
273
274 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
275 clkdm->clktrctrl_mask);
276
277 if (hwsup) {
278 /* Disable HW transitions when we are changing deps */
279 _disable_hwsup(clkdm);
280 _clkdm_del_autodeps(clkdm);
281 _enable_hwsup(clkdm);
282 } else {
283 if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
284 omap3_clkdm_sleep(clkdm);
285 }
286
287 return 0;
288}
289
244struct clkdm_ops omap2_clkdm_operations = { 290struct clkdm_ops omap2_clkdm_operations = {
245 .clkdm_add_wkdep = omap2_clkdm_add_wkdep, 291 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
246 .clkdm_del_wkdep = omap2_clkdm_del_wkdep, 292 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
@@ -267,6 +313,6 @@ struct clkdm_ops omap3_clkdm_operations = {
267 .clkdm_wakeup = omap3_clkdm_wakeup, 313 .clkdm_wakeup = omap3_clkdm_wakeup,
268 .clkdm_allow_idle = omap3_clkdm_allow_idle, 314 .clkdm_allow_idle = omap3_clkdm_allow_idle,
269 .clkdm_deny_idle = omap3_clkdm_deny_idle, 315 .clkdm_deny_idle = omap3_clkdm_deny_idle,
270 .clkdm_clk_enable = omap2_clkdm_clk_enable, 316 .clkdm_clk_enable = omap3xxx_clkdm_clk_enable,
271 .clkdm_clk_disable = omap2_clkdm_clk_disable, 317 .clkdm_clk_disable = omap3xxx_clkdm_clk_disable,
272}; 318};
diff --git a/arch/arm/mach-omap2/cm-regbits-34xx.h b/arch/arm/mach-omap2/cm-regbits-34xx.h
index 766338fe4d34..975f6bda0e0b 100644
--- a/arch/arm/mach-omap2/cm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-34xx.h
@@ -67,6 +67,7 @@
67#define OMAP3430_EN_IVA2_DPLL_MASK (0x7 << 0) 67#define OMAP3430_EN_IVA2_DPLL_MASK (0x7 << 0)
68 68
69/* CM_IDLEST_IVA2 */ 69/* CM_IDLEST_IVA2 */
70#define OMAP3430_ST_IVA2_SHIFT 0
70#define OMAP3430_ST_IVA2_MASK (1 << 0) 71#define OMAP3430_ST_IVA2_MASK (1 << 0)
71 72
72/* CM_IDLEST_PLL_IVA2 */ 73/* CM_IDLEST_PLL_IVA2 */
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c
index 4c965ab426ca..b3275babf192 100644
--- a/arch/arm/mach-omap2/omap-wakeupgen.c
+++ b/arch/arm/mach-omap2/omap-wakeupgen.c
@@ -47,7 +47,7 @@
47static void __iomem *wakeupgen_base; 47static void __iomem *wakeupgen_base;
48static void __iomem *sar_base; 48static void __iomem *sar_base;
49static DEFINE_SPINLOCK(wakeupgen_lock); 49static DEFINE_SPINLOCK(wakeupgen_lock);
50static unsigned int irq_target_cpu[NR_IRQS]; 50static unsigned int irq_target_cpu[MAX_IRQS];
51static unsigned int irq_banks = MAX_NR_REG_BANKS; 51static unsigned int irq_banks = MAX_NR_REG_BANKS;
52static unsigned int max_irqs = MAX_IRQS; 52static unsigned int max_irqs = MAX_IRQS;
53static unsigned int omap_secure_apis; 53static unsigned int omap_secure_apis;
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 80b7359500f1..3615e0d9ee3c 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1889,6 +1889,7 @@ static int _enable(struct omap_hwmod *oh)
1889 _enable_sysc(oh); 1889 _enable_sysc(oh);
1890 } 1890 }
1891 } else { 1891 } else {
1892 _omap4_disable_module(oh);
1892 _disable_clocks(oh); 1893 _disable_clocks(oh);
1893 pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n", 1894 pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n",
1894 oh->name, r); 1895 oh->name, r);
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 9f85c04202d1..94b38af17055 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -100,9 +100,9 @@ static struct omap_hwmod omap3xxx_mpu_hwmod = {
100 100
101/* IVA2 (IVA2) */ 101/* IVA2 (IVA2) */
102static struct omap_hwmod_rst_info omap3xxx_iva_resets[] = { 102static struct omap_hwmod_rst_info omap3xxx_iva_resets[] = {
103 { .name = "logic", .rst_shift = 0 }, 103 { .name = "logic", .rst_shift = 0, .st_shift = 8 },
104 { .name = "seq0", .rst_shift = 1 }, 104 { .name = "seq0", .rst_shift = 1, .st_shift = 9 },
105 { .name = "seq1", .rst_shift = 2 }, 105 { .name = "seq1", .rst_shift = 2, .st_shift = 10 },
106}; 106};
107 107
108static struct omap_hwmod omap3xxx_iva_hwmod = { 108static struct omap_hwmod omap3xxx_iva_hwmod = {
@@ -112,6 +112,15 @@ static struct omap_hwmod omap3xxx_iva_hwmod = {
112 .rst_lines = omap3xxx_iva_resets, 112 .rst_lines = omap3xxx_iva_resets,
113 .rst_lines_cnt = ARRAY_SIZE(omap3xxx_iva_resets), 113 .rst_lines_cnt = ARRAY_SIZE(omap3xxx_iva_resets),
114 .main_clk = "iva2_ck", 114 .main_clk = "iva2_ck",
115 .prcm = {
116 .omap2 = {
117 .module_offs = OMAP3430_IVA2_MOD,
118 .prcm_reg_id = 1,
119 .module_bit = OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT,
120 .idlest_reg_id = 1,
121 .idlest_idle_bit = OMAP3430_ST_IVA2_SHIFT,
122 }
123 },
115}; 124};
116 125
117/* timer class */ 126/* timer class */
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index f033f950a232..f9bcb24cd515 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -4209,7 +4209,7 @@ static struct omap_hwmod_ocp_if omap44xx_dsp__iva = {
4209}; 4209};
4210 4210
4211/* dsp -> sl2if */ 4211/* dsp -> sl2if */
4212static struct omap_hwmod_ocp_if omap44xx_dsp__sl2if = { 4212static struct omap_hwmod_ocp_if __maybe_unused omap44xx_dsp__sl2if = {
4213 .master = &omap44xx_dsp_hwmod, 4213 .master = &omap44xx_dsp_hwmod,
4214 .slave = &omap44xx_sl2if_hwmod, 4214 .slave = &omap44xx_sl2if_hwmod,
4215 .clk = "dpll_iva_m5x2_ck", 4215 .clk = "dpll_iva_m5x2_ck",
@@ -4827,7 +4827,7 @@ static struct omap_hwmod_ocp_if omap44xx_l3_main_2__iss = {
4827}; 4827};
4828 4828
4829/* iva -> sl2if */ 4829/* iva -> sl2if */
4830static struct omap_hwmod_ocp_if omap44xx_iva__sl2if = { 4830static struct omap_hwmod_ocp_if __maybe_unused omap44xx_iva__sl2if = {
4831 .master = &omap44xx_iva_hwmod, 4831 .master = &omap44xx_iva_hwmod,
4832 .slave = &omap44xx_sl2if_hwmod, 4832 .slave = &omap44xx_sl2if_hwmod,
4833 .clk = "dpll_iva_m5x2_ck", 4833 .clk = "dpll_iva_m5x2_ck",
@@ -5361,7 +5361,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_wkup__scrm = {
5361}; 5361};
5362 5362
5363/* l3_main_2 -> sl2if */ 5363/* l3_main_2 -> sl2if */
5364static struct omap_hwmod_ocp_if omap44xx_l3_main_2__sl2if = { 5364static struct omap_hwmod_ocp_if __maybe_unused omap44xx_l3_main_2__sl2if = {
5365 .master = &omap44xx_l3_main_2_hwmod, 5365 .master = &omap44xx_l3_main_2_hwmod,
5366 .slave = &omap44xx_sl2if_hwmod, 5366 .slave = &omap44xx_sl2if_hwmod,
5367 .clk = "l3_div_ck", 5367 .clk = "l3_div_ck",
@@ -6031,7 +6031,7 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
6031 &omap44xx_l4_abe__dmic, 6031 &omap44xx_l4_abe__dmic,
6032 &omap44xx_l4_abe__dmic_dma, 6032 &omap44xx_l4_abe__dmic_dma,
6033 &omap44xx_dsp__iva, 6033 &omap44xx_dsp__iva,
6034 &omap44xx_dsp__sl2if, 6034 /* &omap44xx_dsp__sl2if, */
6035 &omap44xx_l4_cfg__dsp, 6035 &omap44xx_l4_cfg__dsp,
6036 &omap44xx_l3_main_2__dss, 6036 &omap44xx_l3_main_2__dss,
6037 &omap44xx_l4_per__dss, 6037 &omap44xx_l4_per__dss,
@@ -6067,7 +6067,7 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
6067 &omap44xx_l4_per__i2c4, 6067 &omap44xx_l4_per__i2c4,
6068 &omap44xx_l3_main_2__ipu, 6068 &omap44xx_l3_main_2__ipu,
6069 &omap44xx_l3_main_2__iss, 6069 &omap44xx_l3_main_2__iss,
6070 &omap44xx_iva__sl2if, 6070 /* &omap44xx_iva__sl2if, */
6071 &omap44xx_l3_main_2__iva, 6071 &omap44xx_l3_main_2__iva,
6072 &omap44xx_l4_wkup__kbd, 6072 &omap44xx_l4_wkup__kbd,
6073 &omap44xx_l4_cfg__mailbox, 6073 &omap44xx_l4_cfg__mailbox,
@@ -6098,7 +6098,7 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
6098 &omap44xx_l4_cfg__cm_core, 6098 &omap44xx_l4_cfg__cm_core,
6099 &omap44xx_l4_wkup__prm, 6099 &omap44xx_l4_wkup__prm,
6100 &omap44xx_l4_wkup__scrm, 6100 &omap44xx_l4_wkup__scrm,
6101 &omap44xx_l3_main_2__sl2if, 6101 /* &omap44xx_l3_main_2__sl2if, */
6102 &omap44xx_l4_abe__slimbus1, 6102 &omap44xx_l4_abe__slimbus1,
6103 &omap44xx_l4_abe__slimbus1_dma, 6103 &omap44xx_l4_abe__slimbus1_dma,
6104 &omap44xx_l4_per__slimbus2, 6104 &omap44xx_l4_per__slimbus2,
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index e17cf974d16c..5214d5bfba27 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -262,6 +262,7 @@ static u32 notrace dmtimer_read_sched_clock(void)
262 return 0; 262 return 0;
263} 263}
264 264
265#ifdef CONFIG_OMAP_32K_TIMER
265/* Setup free-running counter for clocksource */ 266/* Setup free-running counter for clocksource */
266static int __init omap2_sync32k_clocksource_init(void) 267static int __init omap2_sync32k_clocksource_init(void)
267{ 268{
@@ -301,6 +302,12 @@ static int __init omap2_sync32k_clocksource_init(void)
301 302
302 return ret; 303 return ret;
303} 304}
305#else
306static inline int omap2_sync32k_clocksource_init(void)
307{
308 return -ENODEV;
309}
310#endif
304 311
305static void __init omap2_gptimer_clocksource_init(int gptimer_id, 312static void __init omap2_gptimer_clocksource_init(int gptimer_id,
306 const char *fck_source) 313 const char *fck_source)
diff --git a/arch/arm/mach-prima2/include/mach/uncompress.h b/arch/arm/mach-prima2/include/mach/uncompress.h
index 83125c6a30b3..0c898fcf909c 100644
--- a/arch/arm/mach-prima2/include/mach/uncompress.h
+++ b/arch/arm/mach-prima2/include/mach/uncompress.h
@@ -25,11 +25,11 @@ static __inline__ void putc(char c)
25 * during kernel decompression, all mappings are flat: 25 * during kernel decompression, all mappings are flat:
26 * virt_addr == phys_addr 26 * virt_addr == phys_addr
27 */ 27 */
28 while (__raw_readl(SIRFSOC_UART1_PA_BASE + SIRFSOC_UART_TXFIFO_STATUS) 28 while (__raw_readl((void __iomem *)SIRFSOC_UART1_PA_BASE + SIRFSOC_UART_TXFIFO_STATUS)
29 & SIRFSOC_UART1_TXFIFO_FULL) 29 & SIRFSOC_UART1_TXFIFO_FULL)
30 barrier(); 30 barrier();
31 31
32 __raw_writel(c, SIRFSOC_UART1_PA_BASE + SIRFSOC_UART_TXFIFO_DATA); 32 __raw_writel(c, (void __iomem *)SIRFSOC_UART1_PA_BASE + SIRFSOC_UART_TXFIFO_DATA);
33} 33}
34 34
35static inline void flush(void) 35static inline void flush(void)
diff --git a/arch/arm/mach-s3c24xx/h1940-bluetooth.c b/arch/arm/mach-s3c24xx/h1940-bluetooth.c
index a5eeb62ce1c2..57aee916bdb1 100644
--- a/arch/arm/mach-s3c24xx/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c24xx/h1940-bluetooth.c
@@ -138,19 +138,7 @@ static struct platform_driver h1940bt_driver = {
138 .remove = h1940bt_remove, 138 .remove = h1940bt_remove,
139}; 139};
140 140
141 141module_platform_driver(h1940bt_driver);
142static int __init h1940bt_init(void)
143{
144 return platform_driver_register(&h1940bt_driver);
145}
146
147static void __exit h1940bt_exit(void)
148{
149 platform_driver_unregister(&h1940bt_driver);
150}
151
152module_init(h1940bt_init);
153module_exit(h1940bt_exit);
154 142
155MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>"); 143MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>");
156MODULE_DESCRIPTION("Driver for the iPAQ H1940 bluetooth chip"); 144MODULE_DESCRIPTION("Driver for the iPAQ H1940 bluetooth chip");
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c
index 5a7d0c0010f7..0c7ed7a2b0cd 100644
--- a/arch/arm/mach-s3c24xx/mach-anubis.c
+++ b/arch/arm/mach-s3c24xx/mach-anubis.c
@@ -424,7 +424,8 @@ static void __init anubis_map_io(void)
424 anubis_nand_sets[0].nr_partitions = ARRAY_SIZE(anubis_default_nand_part_large); 424 anubis_nand_sets[0].nr_partitions = ARRAY_SIZE(anubis_default_nand_part_large);
425 } else { 425 } else {
426 /* ensure that the GPIO is setup */ 426 /* ensure that the GPIO is setup */
427 s3c2410_gpio_setpin(S3C2410_GPA(0), 1); 427 gpio_request_one(S3C2410_GPA(0), GPIOF_OUT_INIT_HIGH, NULL);
428 gpio_free(S3C2410_GPA(0));
428 } 429 }
429} 430}
430 431
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
index ae73ba34ecc6..471334715c37 100644
--- a/arch/arm/mach-s3c24xx/mach-jive.c
+++ b/arch/arm/mach-s3c24xx/mach-jive.c
@@ -512,8 +512,8 @@ static void jive_power_off(void)
512{ 512{
513 printk(KERN_INFO "powering system down...\n"); 513 printk(KERN_INFO "powering system down...\n");
514 514
515 s3c2410_gpio_setpin(S3C2410_GPC(5), 1); 515 gpio_request_one(S3C2410_GPC(5), GPIOF_OUT_INIT_HIGH, NULL);
516 s3c_gpio_cfgpin(S3C2410_GPC(5), S3C2410_GPIO_OUTPUT); 516 gpio_free(S3C2410_GPC(5));
517} 517}
518 518
519static void __init jive_machine_init(void) 519static void __init jive_machine_init(void)
@@ -623,11 +623,11 @@ static void __init jive_machine_init(void)
623 gpio_request(S3C2410_GPB(7), "jive spi"); 623 gpio_request(S3C2410_GPB(7), "jive spi");
624 gpio_direction_output(S3C2410_GPB(7), 1); 624 gpio_direction_output(S3C2410_GPB(7), 1);
625 625
626 s3c2410_gpio_setpin(S3C2410_GPB(6), 0); 626 gpio_request_one(S3C2410_GPB(6), GPIOF_OUT_INIT_LOW, NULL);
627 s3c_gpio_cfgpin(S3C2410_GPB(6), S3C2410_GPIO_OUTPUT); 627 gpio_free(S3C2410_GPB(6));
628 628
629 s3c2410_gpio_setpin(S3C2410_GPG(8), 1); 629 gpio_request_one(S3C2410_GPG(8), GPIOF_OUT_INIT_HIGH, NULL);
630 s3c_gpio_cfgpin(S3C2410_GPG(8), S3C2410_GPIO_OUTPUT); 630 gpio_free(S3C2410_GPG(8));
631 631
632 /* initialise the WM8750 spi */ 632 /* initialise the WM8750 spi */
633 633
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index bd6d2525debe..734bbfe5ea22 100644
--- a/arch/arm/mach-s3c24xx/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
@@ -638,9 +638,9 @@ static void __init mini2440_init(void)
638 gpio_free(S3C2410_GPG(4)); 638 gpio_free(S3C2410_GPG(4));
639 639
640 /* remove pullup on optional PWM backlight -- unused on 3.5 and 7"s */ 640 /* remove pullup on optional PWM backlight -- unused on 3.5 and 7"s */
641 gpio_request_one(S3C2410_GPB(1), GPIOF_IN, NULL);
641 s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_UP); 642 s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_UP);
642 s3c2410_gpio_setpin(S3C2410_GPB(1), 0); 643 gpio_free(S3C2410_GPB(1));
643 s3c_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPIO_INPUT);
644 644
645 /* mark the key as input, without pullups (there is one on the board) */ 645 /* mark the key as input, without pullups (there is one on the board) */
646 for (i = 0; i < ARRAY_SIZE(mini2440_buttons); i++) { 646 for (i = 0; i < ARRAY_SIZE(mini2440_buttons); i++) {
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c
index 5c05ba1c330f..a71a551094ef 100644
--- a/arch/arm/mach-s3c24xx/mach-nexcoder.c
+++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
@@ -119,17 +119,17 @@ static struct platform_device *nexcoder_devices[] __initdata = {
119 119
120static void __init nexcoder_sensorboard_init(void) 120static void __init nexcoder_sensorboard_init(void)
121{ 121{
122 // Initialize SCCB bus 122 /* Initialize SCCB bus */
123 s3c2410_gpio_setpin(S3C2410_GPE(14), 1); // IICSCL 123 gpio_request_one(S3C2410_GPE(14), GPIOF_OUT_INIT_HIGH, NULL);
124 s3c_gpio_cfgpin(S3C2410_GPE(14), S3C2410_GPIO_OUTPUT); 124 gpio_free(S3C2410_GPE(14)); /* IICSCL */
125 s3c2410_gpio_setpin(S3C2410_GPE(15), 1); // IICSDA 125 gpio_request_one(S3C2410_GPE(15), GPIOF_OUT_INIT_HIGH, NULL);
126 s3c_gpio_cfgpin(S3C2410_GPE(15), S3C2410_GPIO_OUTPUT); 126 gpio_free(S3C2410_GPE(15)); /* IICSDA */
127 127
128 // Power up the sensor board 128 /* Power up the sensor board */
129 s3c2410_gpio_setpin(S3C2410_GPF(1), 1); 129 gpio_request_one(S3C2410_GPF(1), GPIOF_OUT_INIT_HIGH, NULL);
130 s3c_gpio_cfgpin(S3C2410_GPF(1), S3C2410_GPIO_OUTPUT); // CAM_GPIO7 => nLDO_PWRDN 130 gpio_free(S3C2410_GPF(1)); /* CAM_GPIO7 => nLDO_PWRDN */
131 s3c2410_gpio_setpin(S3C2410_GPF(2), 0); 131 gpio_request_one(S3C2410_GPF(2), GPIOF_OUT_INIT_LOW, NULL);
132 s3c_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT); // CAM_GPIO6 => CAM_PWRDN 132 gpio_free(S3C2410_GPF(2)); /* CAM_GPIO6 => CAM_PWRDN */
133} 133}
134 134
135static void __init nexcoder_map_io(void) 135static void __init nexcoder_map_io(void)
diff --git a/arch/arm/mach-s3c24xx/mach-osiris-dvs.c b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
index ad2792dfbee1..5876c6ba7500 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
@@ -175,18 +175,7 @@ static struct platform_driver osiris_dvs_driver = {
175 }, 175 },
176}; 176};
177 177
178static int __init osiris_dvs_init(void) 178module_platform_driver(osiris_dvs_driver);
179{
180 return platform_driver_register(&osiris_dvs_driver);
181}
182
183static void __exit osiris_dvs_exit(void)
184{
185 platform_driver_unregister(&osiris_dvs_driver);
186}
187
188module_init(osiris_dvs_init);
189module_exit(osiris_dvs_exit);
190 179
191MODULE_DESCRIPTION("Simtec OSIRIS DVS support"); 180MODULE_DESCRIPTION("Simtec OSIRIS DVS support");
192MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); 181MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c
index 95d077255024..c0fb3c1bc548 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris.c
@@ -274,8 +274,8 @@ static int osiris_pm_suspend(void)
274 __raw_writeb(tmp, OSIRIS_VA_CTRL0); 274 __raw_writeb(tmp, OSIRIS_VA_CTRL0);
275 275
276 /* ensure that an nRESET is not generated on resume. */ 276 /* ensure that an nRESET is not generated on resume. */
277 s3c2410_gpio_setpin(S3C2410_GPA(21), 1); 277 gpio_request_one(S3C2410_GPA(21), GPIOF_OUT_INIT_HIGH, NULL);
278 s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPIO_OUTPUT); 278 gpio_free(S3C2410_GPA(21));
279 279
280 return 0; 280 return 0;
281} 281}
@@ -396,7 +396,8 @@ static void __init osiris_map_io(void)
396 osiris_nand_sets[0].nr_partitions = ARRAY_SIZE(osiris_default_nand_part_large); 396 osiris_nand_sets[0].nr_partitions = ARRAY_SIZE(osiris_default_nand_part_large);
397 } else { 397 } else {
398 /* write-protect line to the NAND */ 398 /* write-protect line to the NAND */
399 s3c2410_gpio_setpin(S3C2410_GPA(0), 1); 399 gpio_request_one(S3C2410_GPA(0), GPIOF_OUT_INIT_HIGH, NULL);
400 gpio_free(S3C2410_GPA(0));
400 } 401 }
401 402
402 /* fix bus configuration (nBE settings wrong on ABLE pre v2.20) */ 403 /* fix bus configuration (nBE settings wrong on ABLE pre v2.20) */
diff --git a/arch/arm/mach-sa1100/include/mach/simpad.h b/arch/arm/mach-sa1100/include/mach/simpad.h
index cdea671e8931..ac2ea767215d 100644
--- a/arch/arm/mach-sa1100/include/mach/simpad.h
+++ b/arch/arm/mach-sa1100/include/mach/simpad.h
@@ -87,7 +87,7 @@
87#define SIMPAD_CS3_PCMCIA_SHORT (SIMPAD_CS3_GPIO_BASE + 22) 87#define SIMPAD_CS3_PCMCIA_SHORT (SIMPAD_CS3_GPIO_BASE + 22)
88#define SIMPAD_CS3_GPIO_23 (SIMPAD_CS3_GPIO_BASE + 23) 88#define SIMPAD_CS3_GPIO_23 (SIMPAD_CS3_GPIO_BASE + 23)
89 89
90#define CS3_BASE 0xf1000000 90#define CS3_BASE IOMEM(0xf1000000)
91 91
92long simpad_get_cs3_ro(void); 92long simpad_get_cs3_ro(void);
93long simpad_get_cs3_shadow(void); 93long simpad_get_cs3_shadow(void);
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c
index fbd53593be54..6ca92d0d32b2 100644
--- a/arch/arm/mach-sa1100/simpad.c
+++ b/arch/arm/mach-sa1100/simpad.c
@@ -124,7 +124,7 @@ static struct map_desc simpad_io_desc[] __initdata = {
124 .length = 0x00800000, 124 .length = 0x00800000,
125 .type = MT_DEVICE 125 .type = MT_DEVICE
126 }, { /* Simpad CS3 */ 126 }, { /* Simpad CS3 */
127 .virtual = CS3_BASE, 127 .virtual = (unsigned long)CS3_BASE,
128 .pfn = __phys_to_pfn(SA1100_CS3_PHYS), 128 .pfn = __phys_to_pfn(SA1100_CS3_PHYS),
129 .length = 0x00100000, 129 .length = 0x00100000,
130 .type = MT_DEVICE 130 .type = MT_DEVICE
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index f172ca85905c..1089ee5472eb 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -432,7 +432,7 @@ static void usb1_host_port_power(int port, int power)
432 return; 432 return;
433 433
434 /* set VBOUT/PWEN and EXTLP1 in DVSTCTR */ 434 /* set VBOUT/PWEN and EXTLP1 in DVSTCTR */
435 __raw_writew(__raw_readw(0xE68B0008) | 0x600, 0xE68B0008); 435 __raw_writew(__raw_readw(IOMEM(0xE68B0008)) | 0x600, IOMEM(0xE68B0008));
436} 436}
437 437
438static struct r8a66597_platdata usb1_host_data = { 438static struct r8a66597_platdata usb1_host_data = {
@@ -1224,9 +1224,9 @@ static struct i2c_board_info i2c1_devices[] = {
1224}; 1224};
1225 1225
1226 1226
1227#define GPIO_PORT9CR 0xE6051009 1227#define GPIO_PORT9CR IOMEM(0xE6051009)
1228#define GPIO_PORT10CR 0xE605100A 1228#define GPIO_PORT10CR IOMEM(0xE605100A)
1229#define USCCR1 0xE6058144 1229#define USCCR1 IOMEM(0xE6058144)
1230static void __init ap4evb_init(void) 1230static void __init ap4evb_init(void)
1231{ 1231{
1232 u32 srcr4; 1232 u32 srcr4;
@@ -1304,7 +1304,7 @@ static void __init ap4evb_init(void)
1304 gpio_request(GPIO_FN_OVCN2_1, NULL); 1304 gpio_request(GPIO_FN_OVCN2_1, NULL);
1305 1305
1306 /* setup USB phy */ 1306 /* setup USB phy */
1307 __raw_writew(0x8a0a, 0xE6058130); /* USBCR4 */ 1307 __raw_writew(0x8a0a, IOMEM(0xE6058130)); /* USBCR4 */
1308 1308
1309 /* enable FSI2 port A (ak4643) */ 1309 /* enable FSI2 port A (ak4643) */
1310 gpio_request(GPIO_FN_FSIAIBT, NULL); 1310 gpio_request(GPIO_FN_FSIAIBT, NULL);
@@ -1453,7 +1453,7 @@ static void __init ap4evb_init(void)
1453 gpio_request(GPIO_FN_HDMI_CEC, NULL); 1453 gpio_request(GPIO_FN_HDMI_CEC, NULL);
1454 1454
1455 /* Reset HDMI, must be held at least one EXTALR (32768Hz) period */ 1455 /* Reset HDMI, must be held at least one EXTALR (32768Hz) period */
1456#define SRCR4 0xe61580bc 1456#define SRCR4 IOMEM(0xe61580bc)
1457 srcr4 = __raw_readl(SRCR4); 1457 srcr4 = __raw_readl(SRCR4);
1458 __raw_writel(srcr4 | (1 << 13), SRCR4); 1458 __raw_writel(srcr4 | (1 << 13), SRCR4);
1459 udelay(50); 1459 udelay(50);
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 453a6e50db8b..45b33e02dff5 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -135,7 +135,7 @@
135 * usbhsf_power_ctrl() 135 * usbhsf_power_ctrl()
136 */ 136 */
137#define IRQ7 evt2irq(0x02e0) 137#define IRQ7 evt2irq(0x02e0)
138#define USBCR1 0xe605810a 138#define USBCR1 IOMEM(0xe605810a)
139#define USBH 0xC6700000 139#define USBH 0xC6700000
140#define USBH_USBCTR 0x10834 140#define USBH_USBCTR 0x10834
141 141
@@ -950,8 +950,8 @@ clock_error:
950/* 950/*
951 * board init 951 * board init
952 */ 952 */
953#define GPIO_PORT7CR 0xe6050007 953#define GPIO_PORT7CR IOMEM(0xe6050007)
954#define GPIO_PORT8CR 0xe6050008 954#define GPIO_PORT8CR IOMEM(0xe6050008)
955static void __init eva_init(void) 955static void __init eva_init(void)
956{ 956{
957 struct platform_device *usb = NULL; 957 struct platform_device *usb = NULL;
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c
index 4129008eae29..cb8c994e1430 100644
--- a/arch/arm/mach-shmobile/board-bonito.c
+++ b/arch/arm/mach-shmobile/board-bonito.c
@@ -108,12 +108,12 @@ static struct regulator_consumer_supply dummy_supplies[] = {
108#define FPGA_ETH_IRQ (FPGA_IRQ0 + 15) 108#define FPGA_ETH_IRQ (FPGA_IRQ0 + 15)
109static u16 bonito_fpga_read(u32 offset) 109static u16 bonito_fpga_read(u32 offset)
110{ 110{
111 return __raw_readw(0xf0003000 + offset); 111 return __raw_readw(IOMEM(0xf0003000) + offset);
112} 112}
113 113
114static void bonito_fpga_write(u32 offset, u16 val) 114static void bonito_fpga_write(u32 offset, u16 val)
115{ 115{
116 __raw_writew(val, 0xf0003000 + offset); 116 __raw_writew(val, IOMEM(0xf0003000) + offset);
117} 117}
118 118
119static void bonito_fpga_irq_disable(struct irq_data *data) 119static void bonito_fpga_irq_disable(struct irq_data *data)
@@ -361,8 +361,8 @@ static void __init bonito_map_io(void)
361#define BIT_ON(sw, bit) (sw & (1 << bit)) 361#define BIT_ON(sw, bit) (sw & (1 << bit))
362#define BIT_OFF(sw, bit) (!(sw & (1 << bit))) 362#define BIT_OFF(sw, bit) (!(sw & (1 << bit)))
363 363
364#define VCCQ1CR 0xE6058140 364#define VCCQ1CR IOMEM(0xE6058140)
365#define VCCQ1LCDCR 0xE6058186 365#define VCCQ1LCDCR IOMEM(0xE6058186)
366 366
367static void __init bonito_init(void) 367static void __init bonito_init(void)
368{ 368{
diff --git a/arch/arm/mach-shmobile/board-g3evm.c b/arch/arm/mach-shmobile/board-g3evm.c
index 796fa00ad3c4..b179d4c213bb 100644
--- a/arch/arm/mach-shmobile/board-g3evm.c
+++ b/arch/arm/mach-shmobile/board-g3evm.c
@@ -106,7 +106,7 @@ static void usb_host_port_power(int port, int power)
106 return; 106 return;
107 107
108 /* set VBOUT/PWEN and EXTLP0 in DVSTCTR */ 108 /* set VBOUT/PWEN and EXTLP0 in DVSTCTR */
109 __raw_writew(__raw_readw(0xe6890008) | 0x600, 0xe6890008); 109 __raw_writew(__raw_readw(IOMEM(0xe6890008)) | 0x600, IOMEM(0xe6890008));
110} 110}
111 111
112static struct r8a66597_platdata usb_host_data = { 112static struct r8a66597_platdata usb_host_data = {
@@ -279,10 +279,10 @@ static void __init g3evm_init(void)
279 gpio_request(GPIO_FN_IDIN, NULL); 279 gpio_request(GPIO_FN_IDIN, NULL);
280 280
281 /* setup USB phy */ 281 /* setup USB phy */
282 __raw_writew(0x0300, 0xe605810a); /* USBCR1 */ 282 __raw_writew(0x0300, IOMEM(0xe605810a)); /* USBCR1 */
283 __raw_writew(0x00e0, 0xe60581c0); /* CPFCH */ 283 __raw_writew(0x00e0, IOMEM(0xe60581c0)); /* CPFCH */
284 __raw_writew(0x6010, 0xe60581c6); /* CGPOSR */ 284 __raw_writew(0x6010, IOMEM(0xe60581c6)); /* CGPOSR */
285 __raw_writew(0x8a0a, 0xe605810c); /* USBCR2 */ 285 __raw_writew(0x8a0a, IOMEM(0xe605810c)); /* USBCR2 */
286 286
287 /* KEYSC @ CN7 */ 287 /* KEYSC @ CN7 */
288 gpio_request(GPIO_FN_PORT42_KEYOUT0, NULL); 288 gpio_request(GPIO_FN_PORT42_KEYOUT0, NULL);
@@ -320,7 +320,7 @@ static void __init g3evm_init(void)
320 gpio_request(GPIO_FN_WE0_XWR0_FWE, NULL); 320 gpio_request(GPIO_FN_WE0_XWR0_FWE, NULL);
321 gpio_request(GPIO_FN_FRB, NULL); 321 gpio_request(GPIO_FN_FRB, NULL);
322 /* FOE, FCDE, FSC on dedicated pins */ 322 /* FOE, FCDE, FSC on dedicated pins */
323 __raw_writel(__raw_readl(0xe6158048) & ~(1 << 15), 0xe6158048); 323 __raw_writel(__raw_readl(IOMEM(0xe6158048)) & ~(1 << 15), IOMEM(0xe6158048));
324 324
325 /* IrDA */ 325 /* IrDA */
326 gpio_request(GPIO_FN_IRDA_OUT, NULL); 326 gpio_request(GPIO_FN_IRDA_OUT, NULL);
diff --git a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c
index fa5dfc5c8ed6..22d689322533 100644
--- a/arch/arm/mach-shmobile/board-g4evm.c
+++ b/arch/arm/mach-shmobile/board-g4evm.c
@@ -126,7 +126,7 @@ static void usb_host_port_power(int port, int power)
126 return; 126 return;
127 127
128 /* set VBOUT/PWEN and EXTLP0 in DVSTCTR */ 128 /* set VBOUT/PWEN and EXTLP0 in DVSTCTR */
129 __raw_writew(__raw_readw(0xe6890008) | 0x600, 0xe6890008); 129 __raw_writew(__raw_readw(IOMEM(0xe6890008)) | 0x600, IOMEM(0xe6890008));
130} 130}
131 131
132static struct r8a66597_platdata usb_host_data = { 132static struct r8a66597_platdata usb_host_data = {
@@ -270,17 +270,17 @@ static struct platform_device *g4evm_devices[] __initdata = {
270 &sdhi1_device, 270 &sdhi1_device,
271}; 271};
272 272
273#define GPIO_SDHID0_D0 0xe60520fc 273#define GPIO_SDHID0_D0 IOMEM(0xe60520fc)
274#define GPIO_SDHID0_D1 0xe60520fd 274#define GPIO_SDHID0_D1 IOMEM(0xe60520fd)
275#define GPIO_SDHID0_D2 0xe60520fe 275#define GPIO_SDHID0_D2 IOMEM(0xe60520fe)
276#define GPIO_SDHID0_D3 0xe60520ff 276#define GPIO_SDHID0_D3 IOMEM(0xe60520ff)
277#define GPIO_SDHICMD0 0xe6052100 277#define GPIO_SDHICMD0 IOMEM(0xe6052100)
278 278
279#define GPIO_SDHID1_D0 0xe6052103 279#define GPIO_SDHID1_D0 IOMEM(0xe6052103)
280#define GPIO_SDHID1_D1 0xe6052104 280#define GPIO_SDHID1_D1 IOMEM(0xe6052104)
281#define GPIO_SDHID1_D2 0xe6052105 281#define GPIO_SDHID1_D2 IOMEM(0xe6052105)
282#define GPIO_SDHID1_D3 0xe6052106 282#define GPIO_SDHID1_D3 IOMEM(0xe6052106)
283#define GPIO_SDHICMD1 0xe6052107 283#define GPIO_SDHICMD1 IOMEM(0xe6052107)
284 284
285static void __init g4evm_init(void) 285static void __init g4evm_init(void)
286{ 286{
@@ -318,10 +318,10 @@ static void __init g4evm_init(void)
318 gpio_request(GPIO_FN_IDIN, NULL); 318 gpio_request(GPIO_FN_IDIN, NULL);
319 319
320 /* setup USB phy */ 320 /* setup USB phy */
321 __raw_writew(0x0200, 0xe605810a); /* USBCR1 */ 321 __raw_writew(0x0200, IOMEM(0xe605810a)); /* USBCR1 */
322 __raw_writew(0x00e0, 0xe60581c0); /* CPFCH */ 322 __raw_writew(0x00e0, IOMEM(0xe60581c0)); /* CPFCH */
323 __raw_writew(0x6010, 0xe60581c6); /* CGPOSR */ 323 __raw_writew(0x6010, IOMEM(0xe60581c6)); /* CGPOSR */
324 __raw_writew(0x8a0a, 0xe605810c); /* USBCR2 */ 324 __raw_writew(0x8a0a, IOMEM(0xe605810c)); /* USBCR2 */
325 325
326 /* KEYSC @ CN31 */ 326 /* KEYSC @ CN31 */
327 gpio_request(GPIO_FN_PORT60_KEYOUT5, NULL); 327 gpio_request(GPIO_FN_PORT60_KEYOUT5, NULL);
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index 53b7ea92c32c..5ffafc1adf99 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -133,8 +133,8 @@ static struct platform_device usb_host_device = {
133 133
134/* USB Func CN17 */ 134/* USB Func CN17 */
135struct usbhs_private { 135struct usbhs_private {
136 unsigned int phy; 136 void __iomem *phy;
137 unsigned int cr2; 137 void __iomem *cr2;
138 struct renesas_usbhs_platform_info info; 138 struct renesas_usbhs_platform_info info;
139}; 139};
140 140
@@ -232,8 +232,8 @@ static u32 usbhs_pipe_cfg[] = {
232}; 232};
233 233
234static struct usbhs_private usbhs_private = { 234static struct usbhs_private usbhs_private = {
235 .phy = 0xe60781e0, /* USBPHYINT */ 235 .phy = IOMEM(0xe60781e0), /* USBPHYINT */
236 .cr2 = 0xe605810c, /* USBCR2 */ 236 .cr2 = IOMEM(0xe605810c), /* USBCR2 */
237 .info = { 237 .info = {
238 .platform_callback = { 238 .platform_callback = {
239 .hardware_init = usbhs_hardware_init, 239 .hardware_init = usbhs_hardware_init,
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index c129542f6aed..0dce90ee6cf2 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -583,8 +583,8 @@ out:
583#define USBHS0_POLL_INTERVAL (HZ * 5) 583#define USBHS0_POLL_INTERVAL (HZ * 5)
584 584
585struct usbhs_private { 585struct usbhs_private {
586 unsigned int usbphyaddr; 586 void __iomem *usbphyaddr;
587 unsigned int usbcrcaddr; 587 void __iomem *usbcrcaddr;
588 struct renesas_usbhs_platform_info info; 588 struct renesas_usbhs_platform_info info;
589 struct delayed_work work; 589 struct delayed_work work;
590 struct platform_device *pdev; 590 struct platform_device *pdev;
@@ -642,7 +642,7 @@ static void usbhs0_hardware_exit(struct platform_device *pdev)
642} 642}
643 643
644static struct usbhs_private usbhs0_private = { 644static struct usbhs_private usbhs0_private = {
645 .usbcrcaddr = 0xe605810c, /* USBCR2 */ 645 .usbcrcaddr = IOMEM(0xe605810c), /* USBCR2 */
646 .info = { 646 .info = {
647 .platform_callback = { 647 .platform_callback = {
648 .hardware_init = usbhs0_hardware_init, 648 .hardware_init = usbhs0_hardware_init,
@@ -776,8 +776,8 @@ static u32 usbhs1_pipe_cfg[] = {
776}; 776};
777 777
778static struct usbhs_private usbhs1_private = { 778static struct usbhs_private usbhs1_private = {
779 .usbphyaddr = 0xe60581e2, /* USBPHY1INTAP */ 779 .usbphyaddr = IOMEM(0xe60581e2), /* USBPHY1INTAP */
780 .usbcrcaddr = 0xe6058130, /* USBCR4 */ 780 .usbcrcaddr = IOMEM(0xe6058130), /* USBCR4 */
781 .info = { 781 .info = {
782 .platform_callback = { 782 .platform_callback = {
783 .hardware_init = usbhs1_hardware_init, 783 .hardware_init = usbhs1_hardware_init,
@@ -1402,12 +1402,12 @@ static struct i2c_board_info i2c1_devices[] = {
1402 }, 1402 },
1403}; 1403};
1404 1404
1405#define GPIO_PORT9CR 0xE6051009 1405#define GPIO_PORT9CR IOMEM(0xE6051009)
1406#define GPIO_PORT10CR 0xE605100A 1406#define GPIO_PORT10CR IOMEM(0xE605100A)
1407#define GPIO_PORT167CR 0xE60520A7 1407#define GPIO_PORT167CR IOMEM(0xE60520A7)
1408#define GPIO_PORT168CR 0xE60520A8 1408#define GPIO_PORT168CR IOMEM(0xE60520A8)
1409#define SRCR4 0xe61580bc 1409#define SRCR4 IOMEM(0xe61580bc)
1410#define USCCR1 0xE6058144 1410#define USCCR1 IOMEM(0xE6058144)
1411static void __init mackerel_init(void) 1411static void __init mackerel_init(void)
1412{ 1412{
1413 u32 srcr4; 1413 u32 srcr4;
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index ad5fccc7b5e7..6729e0032180 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -41,29 +41,29 @@
41 */ 41 */
42 42
43/* CPG registers */ 43/* CPG registers */
44#define FRQCRA 0xe6150000 44#define FRQCRA IOMEM(0xe6150000)
45#define FRQCRB 0xe6150004 45#define FRQCRB IOMEM(0xe6150004)
46#define VCLKCR1 0xE6150008 46#define VCLKCR1 IOMEM(0xE6150008)
47#define VCLKCR2 0xE615000c 47#define VCLKCR2 IOMEM(0xE615000c)
48#define FRQCRC 0xe61500e0 48#define FRQCRC IOMEM(0xe61500e0)
49#define FSIACKCR 0xe6150018 49#define FSIACKCR IOMEM(0xe6150018)
50#define PLLC01CR 0xe6150028 50#define PLLC01CR IOMEM(0xe6150028)
51 51
52#define SUBCKCR 0xe6150080 52#define SUBCKCR IOMEM(0xe6150080)
53#define USBCKCR 0xe615008c 53#define USBCKCR IOMEM(0xe615008c)
54 54
55#define MSTPSR0 0xe6150030 55#define MSTPSR0 IOMEM(0xe6150030)
56#define MSTPSR1 0xe6150038 56#define MSTPSR1 IOMEM(0xe6150038)
57#define MSTPSR2 0xe6150040 57#define MSTPSR2 IOMEM(0xe6150040)
58#define MSTPSR3 0xe6150048 58#define MSTPSR3 IOMEM(0xe6150048)
59#define MSTPSR4 0xe615004c 59#define MSTPSR4 IOMEM(0xe615004c)
60#define FSIBCKCR 0xe6150090 60#define FSIBCKCR IOMEM(0xe6150090)
61#define HDMICKCR 0xe6150094 61#define HDMICKCR IOMEM(0xe6150094)
62#define SMSTPCR0 0xe6150130 62#define SMSTPCR0 IOMEM(0xe6150130)
63#define SMSTPCR1 0xe6150134 63#define SMSTPCR1 IOMEM(0xe6150134)
64#define SMSTPCR2 0xe6150138 64#define SMSTPCR2 IOMEM(0xe6150138)
65#define SMSTPCR3 0xe615013c 65#define SMSTPCR3 IOMEM(0xe615013c)
66#define SMSTPCR4 0xe6150140 66#define SMSTPCR4 IOMEM(0xe6150140)
67 67
68/* Fixed 32 KHz root clock from EXTALR pin */ 68/* Fixed 32 KHz root clock from EXTALR pin */
69static struct clk extalr_clk = { 69static struct clk extalr_clk = {
diff --git a/arch/arm/mach-shmobile/clock-sh7367.c b/arch/arm/mach-shmobile/clock-sh7367.c
index 162b791b8984..ef0a95e592c4 100644
--- a/arch/arm/mach-shmobile/clock-sh7367.c
+++ b/arch/arm/mach-shmobile/clock-sh7367.c
@@ -24,28 +24,28 @@
24#include <mach/common.h> 24#include <mach/common.h>
25 25
26/* SH7367 registers */ 26/* SH7367 registers */
27#define RTFRQCR 0xe6150000 27#define RTFRQCR IOMEM(0xe6150000)
28#define SYFRQCR 0xe6150004 28#define SYFRQCR IOMEM(0xe6150004)
29#define CMFRQCR 0xe61500E0 29#define CMFRQCR IOMEM(0xe61500E0)
30#define VCLKCR1 0xe6150008 30#define VCLKCR1 IOMEM(0xe6150008)
31#define VCLKCR2 0xe615000C 31#define VCLKCR2 IOMEM(0xe615000C)
32#define VCLKCR3 0xe615001C 32#define VCLKCR3 IOMEM(0xe615001C)
33#define SCLKACR 0xe6150010 33#define SCLKACR IOMEM(0xe6150010)
34#define SCLKBCR 0xe6150014 34#define SCLKBCR IOMEM(0xe6150014)
35#define SUBUSBCKCR 0xe6158080 35#define SUBUSBCKCR IOMEM(0xe6158080)
36#define SPUCKCR 0xe6150084 36#define SPUCKCR IOMEM(0xe6150084)
37#define MSUCKCR 0xe6150088 37#define MSUCKCR IOMEM(0xe6150088)
38#define MVI3CKCR 0xe6150090 38#define MVI3CKCR IOMEM(0xe6150090)
39#define VOUCKCR 0xe6150094 39#define VOUCKCR IOMEM(0xe6150094)
40#define MFCK1CR 0xe6150098 40#define MFCK1CR IOMEM(0xe6150098)
41#define MFCK2CR 0xe615009C 41#define MFCK2CR IOMEM(0xe615009C)
42#define PLLC1CR 0xe6150028 42#define PLLC1CR IOMEM(0xe6150028)
43#define PLLC2CR 0xe615002C 43#define PLLC2CR IOMEM(0xe615002C)
44#define RTMSTPCR0 0xe6158030 44#define RTMSTPCR0 IOMEM(0xe6158030)
45#define RTMSTPCR2 0xe6158038 45#define RTMSTPCR2 IOMEM(0xe6158038)
46#define SYMSTPCR0 0xe6158040 46#define SYMSTPCR0 IOMEM(0xe6158040)
47#define SYMSTPCR2 0xe6158048 47#define SYMSTPCR2 IOMEM(0xe6158048)
48#define CMMSTPCR0 0xe615804c 48#define CMMSTPCR0 IOMEM(0xe615804c)
49 49
50/* Fixed 32 KHz root clock from EXTALR pin */ 50/* Fixed 32 KHz root clock from EXTALR pin */
51static struct clk r_clk = { 51static struct clk r_clk = {
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
index 5a2894b1c965..430a90ffa120 100644
--- a/arch/arm/mach-shmobile/clock-sh7372.c
+++ b/arch/arm/mach-shmobile/clock-sh7372.c
@@ -24,36 +24,36 @@
24#include <mach/common.h> 24#include <mach/common.h>
25 25
26/* SH7372 registers */ 26/* SH7372 registers */
27#define FRQCRA 0xe6150000 27#define FRQCRA IOMEM(0xe6150000)
28#define FRQCRB 0xe6150004 28#define FRQCRB IOMEM(0xe6150004)
29#define FRQCRC 0xe61500e0 29#define FRQCRC IOMEM(0xe61500e0)
30#define FRQCRD 0xe61500e4 30#define FRQCRD IOMEM(0xe61500e4)
31#define VCLKCR1 0xe6150008 31#define VCLKCR1 IOMEM(0xe6150008)
32#define VCLKCR2 0xe615000c 32#define VCLKCR2 IOMEM(0xe615000c)
33#define VCLKCR3 0xe615001c 33#define VCLKCR3 IOMEM(0xe615001c)
34#define FMSICKCR 0xe6150010 34#define FMSICKCR IOMEM(0xe6150010)
35#define FMSOCKCR 0xe6150014 35#define FMSOCKCR IOMEM(0xe6150014)
36#define FSIACKCR 0xe6150018 36#define FSIACKCR IOMEM(0xe6150018)
37#define FSIBCKCR 0xe6150090 37#define FSIBCKCR IOMEM(0xe6150090)
38#define SUBCKCR 0xe6150080 38#define SUBCKCR IOMEM(0xe6150080)
39#define SPUCKCR 0xe6150084 39#define SPUCKCR IOMEM(0xe6150084)
40#define VOUCKCR 0xe6150088 40#define VOUCKCR IOMEM(0xe6150088)
41#define HDMICKCR 0xe6150094 41#define HDMICKCR IOMEM(0xe6150094)
42#define DSITCKCR 0xe6150060 42#define DSITCKCR IOMEM(0xe6150060)
43#define DSI0PCKCR 0xe6150064 43#define DSI0PCKCR IOMEM(0xe6150064)
44#define DSI1PCKCR 0xe6150098 44#define DSI1PCKCR IOMEM(0xe6150098)
45#define PLLC01CR 0xe6150028 45#define PLLC01CR IOMEM(0xe6150028)
46#define PLLC2CR 0xe615002c 46#define PLLC2CR IOMEM(0xe615002c)
47#define RMSTPCR0 0xe6150110 47#define RMSTPCR0 IOMEM(0xe6150110)
48#define RMSTPCR1 0xe6150114 48#define RMSTPCR1 IOMEM(0xe6150114)
49#define RMSTPCR2 0xe6150118 49#define RMSTPCR2 IOMEM(0xe6150118)
50#define RMSTPCR3 0xe615011c 50#define RMSTPCR3 IOMEM(0xe615011c)
51#define RMSTPCR4 0xe6150120 51#define RMSTPCR4 IOMEM(0xe6150120)
52#define SMSTPCR0 0xe6150130 52#define SMSTPCR0 IOMEM(0xe6150130)
53#define SMSTPCR1 0xe6150134 53#define SMSTPCR1 IOMEM(0xe6150134)
54#define SMSTPCR2 0xe6150138 54#define SMSTPCR2 IOMEM(0xe6150138)
55#define SMSTPCR3 0xe615013c 55#define SMSTPCR3 IOMEM(0xe615013c)
56#define SMSTPCR4 0xe6150140 56#define SMSTPCR4 IOMEM(0xe6150140)
57 57
58#define FSIDIVA 0xFE1F8000 58#define FSIDIVA 0xFE1F8000
59#define FSIDIVB 0xFE1F8008 59#define FSIDIVB 0xFE1F8008
diff --git a/arch/arm/mach-shmobile/clock-sh7377.c b/arch/arm/mach-shmobile/clock-sh7377.c
index 85f2a3ec2c44..b8480d19e1c8 100644
--- a/arch/arm/mach-shmobile/clock-sh7377.c
+++ b/arch/arm/mach-shmobile/clock-sh7377.c
@@ -24,31 +24,31 @@
24#include <mach/common.h> 24#include <mach/common.h>
25 25
26/* SH7377 registers */ 26/* SH7377 registers */
27#define RTFRQCR 0xe6150000 27#define RTFRQCR IOMEM(0xe6150000)
28#define SYFRQCR 0xe6150004 28#define SYFRQCR IOMEM(0xe6150004)
29#define CMFRQCR 0xe61500E0 29#define CMFRQCR IOMEM(0xe61500E0)
30#define VCLKCR1 0xe6150008 30#define VCLKCR1 IOMEM(0xe6150008)
31#define VCLKCR2 0xe615000C 31#define VCLKCR2 IOMEM(0xe615000C)
32#define VCLKCR3 0xe615001C 32#define VCLKCR3 IOMEM(0xe615001C)
33#define FMSICKCR 0xe6150010 33#define FMSICKCR IOMEM(0xe6150010)
34#define FMSOCKCR 0xe6150014 34#define FMSOCKCR IOMEM(0xe6150014)
35#define FSICKCR 0xe6150018 35#define FSICKCR IOMEM(0xe6150018)
36#define PLLC1CR 0xe6150028 36#define PLLC1CR IOMEM(0xe6150028)
37#define PLLC2CR 0xe615002C 37#define PLLC2CR IOMEM(0xe615002C)
38#define SUBUSBCKCR 0xe6150080 38#define SUBUSBCKCR IOMEM(0xe6150080)
39#define SPUCKCR 0xe6150084 39#define SPUCKCR IOMEM(0xe6150084)
40#define MSUCKCR 0xe6150088 40#define MSUCKCR IOMEM(0xe6150088)
41#define MVI3CKCR 0xe6150090 41#define MVI3CKCR IOMEM(0xe6150090)
42#define HDMICKCR 0xe6150094 42#define HDMICKCR IOMEM(0xe6150094)
43#define MFCK1CR 0xe6150098 43#define MFCK1CR IOMEM(0xe6150098)
44#define MFCK2CR 0xe615009C 44#define MFCK2CR IOMEM(0xe615009C)
45#define DSITCKCR 0xe6150060 45#define DSITCKCR IOMEM(0xe6150060)
46#define DSIPCKCR 0xe6150064 46#define DSIPCKCR IOMEM(0xe6150064)
47#define SMSTPCR0 0xe6150130 47#define SMSTPCR0 IOMEM(0xe6150130)
48#define SMSTPCR1 0xe6150134 48#define SMSTPCR1 IOMEM(0xe6150134)
49#define SMSTPCR2 0xe6150138 49#define SMSTPCR2 IOMEM(0xe6150138)
50#define SMSTPCR3 0xe615013C 50#define SMSTPCR3 IOMEM(0xe615013C)
51#define SMSTPCR4 0xe6150140 51#define SMSTPCR4 IOMEM(0xe6150140)
52 52
53/* Fixed 32 KHz root clock from EXTALR pin */ 53/* Fixed 32 KHz root clock from EXTALR pin */
54static struct clk r_clk = { 54static struct clk r_clk = {
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index 7f8da18a8580..516ff7f3e434 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -23,43 +23,43 @@
23#include <linux/clkdev.h> 23#include <linux/clkdev.h>
24#include <mach/common.h> 24#include <mach/common.h>
25 25
26#define FRQCRA 0xe6150000 26#define FRQCRA IOMEM(0xe6150000)
27#define FRQCRB 0xe6150004 27#define FRQCRB IOMEM(0xe6150004)
28#define FRQCRD 0xe61500e4 28#define FRQCRD IOMEM(0xe61500e4)
29#define VCLKCR1 0xe6150008 29#define VCLKCR1 IOMEM(0xe6150008)
30#define VCLKCR2 0xe615000C 30#define VCLKCR2 IOMEM(0xe615000C)
31#define VCLKCR3 0xe615001C 31#define VCLKCR3 IOMEM(0xe615001C)
32#define ZBCKCR 0xe6150010 32#define ZBCKCR IOMEM(0xe6150010)
33#define FLCKCR 0xe6150014 33#define FLCKCR IOMEM(0xe6150014)
34#define SD0CKCR 0xe6150074 34#define SD0CKCR IOMEM(0xe6150074)
35#define SD1CKCR 0xe6150078 35#define SD1CKCR IOMEM(0xe6150078)
36#define SD2CKCR 0xe615007C 36#define SD2CKCR IOMEM(0xe615007C)
37#define FSIACKCR 0xe6150018 37#define FSIACKCR IOMEM(0xe6150018)
38#define FSIBCKCR 0xe6150090 38#define FSIBCKCR IOMEM(0xe6150090)
39#define SUBCKCR 0xe6150080 39#define SUBCKCR IOMEM(0xe6150080)
40#define SPUACKCR 0xe6150084 40#define SPUACKCR IOMEM(0xe6150084)
41#define SPUVCKCR 0xe6150094 41#define SPUVCKCR IOMEM(0xe6150094)
42#define MSUCKCR 0xe6150088 42#define MSUCKCR IOMEM(0xe6150088)
43#define HSICKCR 0xe615008C 43#define HSICKCR IOMEM(0xe615008C)
44#define MFCK1CR 0xe6150098 44#define MFCK1CR IOMEM(0xe6150098)
45#define MFCK2CR 0xe615009C 45#define MFCK2CR IOMEM(0xe615009C)
46#define DSITCKCR 0xe6150060 46#define DSITCKCR IOMEM(0xe6150060)
47#define DSI0PCKCR 0xe6150064 47#define DSI0PCKCR IOMEM(0xe6150064)
48#define DSI1PCKCR 0xe6150068 48#define DSI1PCKCR IOMEM(0xe6150068)
49#define DSI0PHYCR 0xe615006C 49#define DSI0PHYCR 0xe615006C
50#define DSI1PHYCR 0xe6150070 50#define DSI1PHYCR 0xe6150070
51#define PLLECR 0xe61500d0 51#define PLLECR IOMEM(0xe61500d0)
52#define PLL0CR 0xe61500d8 52#define PLL0CR IOMEM(0xe61500d8)
53#define PLL1CR 0xe6150028 53#define PLL1CR IOMEM(0xe6150028)
54#define PLL2CR 0xe615002c 54#define PLL2CR IOMEM(0xe615002c)
55#define PLL3CR 0xe61500dc 55#define PLL3CR IOMEM(0xe61500dc)
56#define SMSTPCR0 0xe6150130 56#define SMSTPCR0 IOMEM(0xe6150130)
57#define SMSTPCR1 0xe6150134 57#define SMSTPCR1 IOMEM(0xe6150134)
58#define SMSTPCR2 0xe6150138 58#define SMSTPCR2 IOMEM(0xe6150138)
59#define SMSTPCR3 0xe615013c 59#define SMSTPCR3 IOMEM(0xe615013c)
60#define SMSTPCR4 0xe6150140 60#define SMSTPCR4 IOMEM(0xe6150140)
61#define SMSTPCR5 0xe6150144 61#define SMSTPCR5 IOMEM(0xe6150144)
62#define CKSCR 0xe61500c0 62#define CKSCR IOMEM(0xe61500c0)
63 63
64/* Fixed 32 KHz root clock from EXTALR pin */ 64/* Fixed 32 KHz root clock from EXTALR pin */
65static struct clk r_clk = { 65static struct clk r_clk = {
diff --git a/arch/arm/mach-shmobile/include/mach/gpio.h b/arch/arm/mach-shmobile/include/mach/gpio.h
index 844507d937cb..90a92b2c1c52 100644
--- a/arch/arm/mach-shmobile/include/mach/gpio.h
+++ b/arch/arm/mach-shmobile/include/mach/gpio.h
@@ -35,12 +35,12 @@ static inline int irq_to_gpio(unsigned int irq)
35 * the method to control only pull up/down/free. 35 * the method to control only pull up/down/free.
36 * this function should be replaced by correct gpio function 36 * this function should be replaced by correct gpio function
37 */ 37 */
38static inline void __init gpio_direction_none(u32 addr) 38static inline void __init gpio_direction_none(void __iomem * addr)
39{ 39{
40 __raw_writeb(0x00, addr); 40 __raw_writeb(0x00, addr);
41} 41}
42 42
43static inline void __init gpio_request_pullup(u32 addr) 43static inline void __init gpio_request_pullup(void __iomem * addr)
44{ 44{
45 u8 data = __raw_readb(addr); 45 u8 data = __raw_readb(addr);
46 46
@@ -49,7 +49,7 @@ static inline void __init gpio_request_pullup(u32 addr)
49 __raw_writeb(data, addr); 49 __raw_writeb(data, addr);
50} 50}
51 51
52static inline void __init gpio_request_pulldown(u32 addr) 52static inline void __init gpio_request_pulldown(void __iomem * addr)
53{ 53{
54 u8 data = __raw_readb(addr); 54 u8 data = __raw_readb(addr);
55 55
diff --git a/arch/arm/mach-shmobile/intc-r8a7779.c b/arch/arm/mach-shmobile/intc-r8a7779.c
index f04fad4ec4fb..ef66f1a8aa2e 100644
--- a/arch/arm/mach-shmobile/intc-r8a7779.c
+++ b/arch/arm/mach-shmobile/intc-r8a7779.c
@@ -29,14 +29,14 @@
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31 31
32#define INT2SMSKCR0 0xfe7822a0 32#define INT2SMSKCR0 IOMEM(0xfe7822a0)
33#define INT2SMSKCR1 0xfe7822a4 33#define INT2SMSKCR1 IOMEM(0xfe7822a4)
34#define INT2SMSKCR2 0xfe7822a8 34#define INT2SMSKCR2 IOMEM(0xfe7822a8)
35#define INT2SMSKCR3 0xfe7822ac 35#define INT2SMSKCR3 IOMEM(0xfe7822ac)
36#define INT2SMSKCR4 0xfe7822b0 36#define INT2SMSKCR4 IOMEM(0xfe7822b0)
37 37
38#define INT2NTSR0 0xfe700060 38#define INT2NTSR0 IOMEM(0xfe700060)
39#define INT2NTSR1 0xfe700064 39#define INT2NTSR1 IOMEM(0xfe700064)
40 40
41static int r8a7779_set_wake(struct irq_data *data, unsigned int on) 41static int r8a7779_set_wake(struct irq_data *data, unsigned int on)
42{ 42{
diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c
index 2587a22842f2..a91caad7db7c 100644
--- a/arch/arm/mach-shmobile/intc-sh7372.c
+++ b/arch/arm/mach-shmobile/intc-sh7372.c
@@ -624,6 +624,9 @@ void sh7372_intcs_resume(void)
624 __raw_writeb(ffd5[k], intcs_ffd5 + k); 624 __raw_writeb(ffd5[k], intcs_ffd5 + k);
625} 625}
626 626
627#define E694_BASE IOMEM(0xe6940000)
628#define E695_BASE IOMEM(0xe6950000)
629
627static unsigned short e694[0x200]; 630static unsigned short e694[0x200];
628static unsigned short e695[0x200]; 631static unsigned short e695[0x200];
629 632
@@ -632,22 +635,22 @@ void sh7372_intca_suspend(void)
632 int k; 635 int k;
633 636
634 for (k = 0x00; k <= 0x38; k += 4) 637 for (k = 0x00; k <= 0x38; k += 4)
635 e694[k] = __raw_readw(0xe6940000 + k); 638 e694[k] = __raw_readw(E694_BASE + k);
636 639
637 for (k = 0x80; k <= 0xb4; k += 4) 640 for (k = 0x80; k <= 0xb4; k += 4)
638 e694[k] = __raw_readb(0xe6940000 + k); 641 e694[k] = __raw_readb(E694_BASE + k);
639 642
640 for (k = 0x180; k <= 0x1b4; k += 4) 643 for (k = 0x180; k <= 0x1b4; k += 4)
641 e694[k] = __raw_readb(0xe6940000 + k); 644 e694[k] = __raw_readb(E694_BASE + k);
642 645
643 for (k = 0x00; k <= 0x50; k += 4) 646 for (k = 0x00; k <= 0x50; k += 4)
644 e695[k] = __raw_readw(0xe6950000 + k); 647 e695[k] = __raw_readw(E695_BASE + k);
645 648
646 for (k = 0x80; k <= 0xa8; k += 4) 649 for (k = 0x80; k <= 0xa8; k += 4)
647 e695[k] = __raw_readb(0xe6950000 + k); 650 e695[k] = __raw_readb(E695_BASE + k);
648 651
649 for (k = 0x180; k <= 0x1a8; k += 4) 652 for (k = 0x180; k <= 0x1a8; k += 4)
650 e695[k] = __raw_readb(0xe6950000 + k); 653 e695[k] = __raw_readb(E695_BASE + k);
651} 654}
652 655
653void sh7372_intca_resume(void) 656void sh7372_intca_resume(void)
@@ -655,20 +658,20 @@ void sh7372_intca_resume(void)
655 int k; 658 int k;
656 659
657 for (k = 0x00; k <= 0x38; k += 4) 660 for (k = 0x00; k <= 0x38; k += 4)
658 __raw_writew(e694[k], 0xe6940000 + k); 661 __raw_writew(e694[k], E694_BASE + k);
659 662
660 for (k = 0x80; k <= 0xb4; k += 4) 663 for (k = 0x80; k <= 0xb4; k += 4)
661 __raw_writeb(e694[k], 0xe6940000 + k); 664 __raw_writeb(e694[k], E694_BASE + k);
662 665
663 for (k = 0x180; k <= 0x1b4; k += 4) 666 for (k = 0x180; k <= 0x1b4; k += 4)
664 __raw_writeb(e694[k], 0xe6940000 + k); 667 __raw_writeb(e694[k], E694_BASE + k);
665 668
666 for (k = 0x00; k <= 0x50; k += 4) 669 for (k = 0x00; k <= 0x50; k += 4)
667 __raw_writew(e695[k], 0xe6950000 + k); 670 __raw_writew(e695[k], E695_BASE + k);
668 671
669 for (k = 0x80; k <= 0xa8; k += 4) 672 for (k = 0x80; k <= 0xa8; k += 4)
670 __raw_writeb(e695[k], 0xe6950000 + k); 673 __raw_writeb(e695[k], E695_BASE + k);
671 674
672 for (k = 0x180; k <= 0x1a8; k += 4) 675 for (k = 0x180; k <= 0x1a8; k += 4)
673 __raw_writeb(e695[k], 0xe6950000 + k); 676 __raw_writeb(e695[k], E695_BASE + k);
674} 677}
diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c
index 588555a67d9c..f0c5e5190601 100644
--- a/arch/arm/mach-shmobile/intc-sh73a0.c
+++ b/arch/arm/mach-shmobile/intc-sh73a0.c
@@ -366,10 +366,12 @@ static irqreturn_t sh73a0_irq_pin_demux(int irq, void *dev_id)
366 366
367static struct irqaction sh73a0_irq_pin_cascade[32]; 367static struct irqaction sh73a0_irq_pin_cascade[32];
368 368
369#define PINTER0 0xe69000a0 369#define PINTER0_PHYS 0xe69000a0
370#define PINTER1 0xe69000a4 370#define PINTER1_PHYS 0xe69000a4
371#define PINTRR0 0xe69000d0 371#define PINTER0_VIRT IOMEM(0xe69000a0)
372#define PINTRR1 0xe69000d4 372#define PINTER1_VIRT IOMEM(0xe69000a4)
373#define PINTRR0 IOMEM(0xe69000d0)
374#define PINTRR1 IOMEM(0xe69000d4)
373 375
374#define PINT0A_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq)) 376#define PINT0A_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq))
375#define PINT0B_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq + 8)) 377#define PINT0B_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq + 8))
@@ -377,14 +379,14 @@ static struct irqaction sh73a0_irq_pin_cascade[32];
377#define PINT0D_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq + 24)) 379#define PINT0D_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq + 24))
378#define PINT1E_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT1_IRQ(irq)) 380#define PINT1E_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT1_IRQ(irq))
379 381
380INTC_PINT(intc_pint0, PINTER0, 0xe69000b0, "sh73a0-pint0", \ 382INTC_PINT(intc_pint0, PINTER0_PHYS, 0xe69000b0, "sh73a0-pint0", \
381 INTC_PINT_E(A), INTC_PINT_E(B), INTC_PINT_E(C), INTC_PINT_E(D), \ 383 INTC_PINT_E(A), INTC_PINT_E(B), INTC_PINT_E(C), INTC_PINT_E(D), \
382 INTC_PINT_V(A, PINT0A_IRQ), INTC_PINT_V(B, PINT0B_IRQ), \ 384 INTC_PINT_V(A, PINT0A_IRQ), INTC_PINT_V(B, PINT0B_IRQ), \
383 INTC_PINT_V(C, PINT0C_IRQ), INTC_PINT_V(D, PINT0D_IRQ), \ 385 INTC_PINT_V(C, PINT0C_IRQ), INTC_PINT_V(D, PINT0D_IRQ), \
384 INTC_PINT_E(A), INTC_PINT_E(B), INTC_PINT_E(C), INTC_PINT_E(D), \ 386 INTC_PINT_E(A), INTC_PINT_E(B), INTC_PINT_E(C), INTC_PINT_E(D), \
385 INTC_PINT_E(A), INTC_PINT_E(B), INTC_PINT_E(C), INTC_PINT_E(D)); 387 INTC_PINT_E(A), INTC_PINT_E(B), INTC_PINT_E(C), INTC_PINT_E(D));
386 388
387INTC_PINT(intc_pint1, PINTER1, 0xe69000c0, "sh73a0-pint1", \ 389INTC_PINT(intc_pint1, PINTER1_PHYS, 0xe69000c0, "sh73a0-pint1", \
388 INTC_PINT_E(E), INTC_PINT_E_EMPTY, INTC_PINT_E_EMPTY, INTC_PINT_E_EMPTY, \ 390 INTC_PINT_E(E), INTC_PINT_E_EMPTY, INTC_PINT_E_EMPTY, INTC_PINT_E_EMPTY, \
389 INTC_PINT_V(E, PINT1E_IRQ), INTC_PINT_V_NONE, \ 391 INTC_PINT_V(E, PINT1E_IRQ), INTC_PINT_V_NONE, \
390 INTC_PINT_V_NONE, INTC_PINT_V_NONE, \ 392 INTC_PINT_V_NONE, INTC_PINT_V_NONE, \
@@ -394,7 +396,7 @@ INTC_PINT(intc_pint1, PINTER1, 0xe69000c0, "sh73a0-pint1", \
394static struct irqaction sh73a0_pint0_cascade; 396static struct irqaction sh73a0_pint0_cascade;
395static struct irqaction sh73a0_pint1_cascade; 397static struct irqaction sh73a0_pint1_cascade;
396 398
397static void pint_demux(unsigned long rr, unsigned long er, int base_irq) 399static void pint_demux(void __iomem *rr, void __iomem *er, int base_irq)
398{ 400{
399 unsigned long value = ioread32(rr) & ioread32(er); 401 unsigned long value = ioread32(rr) & ioread32(er);
400 int k; 402 int k;
@@ -409,13 +411,13 @@ static void pint_demux(unsigned long rr, unsigned long er, int base_irq)
409 411
410static irqreturn_t sh73a0_pint0_demux(int irq, void *dev_id) 412static irqreturn_t sh73a0_pint0_demux(int irq, void *dev_id)
411{ 413{
412 pint_demux(PINTRR0, PINTER0, SH73A0_PINT0_IRQ(0)); 414 pint_demux(PINTRR0, PINTER0_VIRT, SH73A0_PINT0_IRQ(0));
413 return IRQ_HANDLED; 415 return IRQ_HANDLED;
414} 416}
415 417
416static irqreturn_t sh73a0_pint1_demux(int irq, void *dev_id) 418static irqreturn_t sh73a0_pint1_demux(int irq, void *dev_id)
417{ 419{
418 pint_demux(PINTRR1, PINTER1, SH73A0_PINT1_IRQ(0)); 420 pint_demux(PINTRR1, PINTER1_VIRT, SH73A0_PINT1_IRQ(0));
419 return IRQ_HANDLED; 421 return IRQ_HANDLED;
420} 422}
421 423
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index a8562540f1d6..32e177275e47 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -20,9 +20,9 @@
20#include <mach/pm-rmobile.h> 20#include <mach/pm-rmobile.h>
21 21
22/* SYSC */ 22/* SYSC */
23#define SPDCR 0xe6180008 23#define SPDCR IOMEM(0xe6180008)
24#define SWUCR 0xe6180014 24#define SWUCR IOMEM(0xe6180014)
25#define PSTR 0xe6180080 25#define PSTR IOMEM(0xe6180080)
26 26
27#define PSTR_RETRIES 100 27#define PSTR_RETRIES 100
28#define PSTR_DELAY_US 10 28#define PSTR_DELAY_US 10
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index 792037069226..162121842a2b 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -29,45 +29,46 @@
29#include <mach/pm-rmobile.h> 29#include <mach/pm-rmobile.h>
30 30
31/* DBG */ 31/* DBG */
32#define DBGREG1 0xe6100020 32#define DBGREG1 IOMEM(0xe6100020)
33#define DBGREG9 0xe6100040 33#define DBGREG9 IOMEM(0xe6100040)
34 34
35/* CPGA */ 35/* CPGA */
36#define SYSTBCR 0xe6150024 36#define SYSTBCR IOMEM(0xe6150024)
37#define MSTPSR0 0xe6150030 37#define MSTPSR0 IOMEM(0xe6150030)
38#define MSTPSR1 0xe6150038 38#define MSTPSR1 IOMEM(0xe6150038)
39#define MSTPSR2 0xe6150040 39#define MSTPSR2 IOMEM(0xe6150040)
40#define MSTPSR3 0xe6150048 40#define MSTPSR3 IOMEM(0xe6150048)
41#define MSTPSR4 0xe615004c 41#define MSTPSR4 IOMEM(0xe615004c)
42#define PLLC01STPCR 0xe61500c8 42#define PLLC01STPCR IOMEM(0xe61500c8)
43 43
44/* SYSC */ 44/* SYSC */
45#define SBAR 0xe6180020 45#define SBAR IOMEM(0xe6180020)
46#define WUPRMSK 0xe6180028 46#define WUPRMSK IOMEM(0xe6180028)
47#define WUPSMSK 0xe618002c 47#define WUPSMSK IOMEM(0xe618002c)
48#define WUPSMSK2 0xe6180048 48#define WUPSMSK2 IOMEM(0xe6180048)
49#define WUPSFAC 0xe6180098 49#define WUPSFAC IOMEM(0xe6180098)
50#define IRQCR 0xe618022c 50#define IRQCR IOMEM(0xe618022c)
51#define IRQCR2 0xe6180238 51#define IRQCR2 IOMEM(0xe6180238)
52#define IRQCR3 0xe6180244 52#define IRQCR3 IOMEM(0xe6180244)
53#define IRQCR4 0xe6180248 53#define IRQCR4 IOMEM(0xe6180248)
54#define PDNSEL 0xe6180254 54#define PDNSEL IOMEM(0xe6180254)
55 55
56/* INTC */ 56/* INTC */
57#define ICR1A 0xe6900000 57#define ICR1A IOMEM(0xe6900000)
58#define ICR2A 0xe6900004 58#define ICR2A IOMEM(0xe6900004)
59#define ICR3A 0xe6900008 59#define ICR3A IOMEM(0xe6900008)
60#define ICR4A 0xe690000c 60#define ICR4A IOMEM(0xe690000c)
61#define INTMSK00A 0xe6900040 61#define INTMSK00A IOMEM(0xe6900040)
62#define INTMSK10A 0xe6900044 62#define INTMSK10A IOMEM(0xe6900044)
63#define INTMSK20A 0xe6900048 63#define INTMSK20A IOMEM(0xe6900048)
64#define INTMSK30A 0xe690004c 64#define INTMSK30A IOMEM(0xe690004c)
65 65
66/* MFIS */ 66/* MFIS */
67/* FIXME: pointing where? */
67#define SMFRAM 0xe6a70000 68#define SMFRAM 0xe6a70000
68 69
69/* AP-System Core */ 70/* AP-System Core */
70#define APARMBAREA 0xe6f10020 71#define APARMBAREA IOMEM(0xe6f10020)
71 72
72#ifdef CONFIG_PM 73#ifdef CONFIG_PM
73 74
diff --git a/arch/arm/mach-shmobile/setup-sh7367.c b/arch/arm/mach-shmobile/setup-sh7367.c
index 2e3074ab75b3..e647f5410879 100644
--- a/arch/arm/mach-shmobile/setup-sh7367.c
+++ b/arch/arm/mach-shmobile/setup-sh7367.c
@@ -462,7 +462,7 @@ static void __init sh7367_earlytimer_init(void)
462 shmobile_earlytimer_init(); 462 shmobile_earlytimer_init();
463} 463}
464 464
465#define SYMSTPCR2 0xe6158048 465#define SYMSTPCR2 IOMEM(0xe6158048)
466#define SYMSTPCR2_CMT1 (1 << 29) 466#define SYMSTPCR2_CMT1 (1 << 29)
467 467
468void __init sh7367_add_early_devices(void) 468void __init sh7367_add_early_devices(void)
diff --git a/arch/arm/mach-shmobile/setup-sh7377.c b/arch/arm/mach-shmobile/setup-sh7377.c
index 855b1506caf8..edcf98bb7012 100644
--- a/arch/arm/mach-shmobile/setup-sh7377.c
+++ b/arch/arm/mach-shmobile/setup-sh7377.c
@@ -484,7 +484,7 @@ static void __init sh7377_earlytimer_init(void)
484 shmobile_earlytimer_init(); 484 shmobile_earlytimer_init();
485} 485}
486 486
487#define SMSTPCR3 0xe615013c 487#define SMSTPCR3 IOMEM(0xe615013c)
488#define SMSTPCR3_CMT1 (1 << 29) 488#define SMSTPCR3_CMT1 (1 << 29)
489 489
490void __init sh7377_add_early_devices(void) 490void __init sh7377_add_early_devices(void)
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index d230af656fc9..a13c97b4ba1d 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -759,7 +759,7 @@ static struct platform_device *sh73a0_late_devices[] __initdata = {
759 &mpdma0_device, 759 &mpdma0_device,
760}; 760};
761 761
762#define SRCR2 0xe61580b0 762#define SRCR2 IOMEM(0xe61580b0)
763 763
764void __init sh73a0_add_standard_devices(void) 764void __init sh73a0_add_standard_devices(void)
765{ 765{
diff --git a/arch/arm/mach-spear13xx/include/mach/spear.h b/arch/arm/mach-spear13xx/include/mach/spear.h
index 65f27def239b..07d90acc92c8 100644
--- a/arch/arm/mach-spear13xx/include/mach/spear.h
+++ b/arch/arm/mach-spear13xx/include/mach/spear.h
@@ -17,26 +17,26 @@
17#include <asm/memory.h> 17#include <asm/memory.h>
18 18
19#define PERIP_GRP2_BASE UL(0xB3000000) 19#define PERIP_GRP2_BASE UL(0xB3000000)
20#define VA_PERIP_GRP2_BASE UL(0xFE000000) 20#define VA_PERIP_GRP2_BASE IOMEM(0xFE000000)
21#define MCIF_SDHCI_BASE UL(0xB3000000) 21#define MCIF_SDHCI_BASE UL(0xB3000000)
22#define SYSRAM0_BASE UL(0xB3800000) 22#define SYSRAM0_BASE UL(0xB3800000)
23#define VA_SYSRAM0_BASE UL(0xFE800000) 23#define VA_SYSRAM0_BASE IOMEM(0xFE800000)
24#define SYS_LOCATION (VA_SYSRAM0_BASE + 0x600) 24#define SYS_LOCATION (VA_SYSRAM0_BASE + 0x600)
25 25
26#define PERIP_GRP1_BASE UL(0xE0000000) 26#define PERIP_GRP1_BASE UL(0xE0000000)
27#define VA_PERIP_GRP1_BASE UL(0xFD000000) 27#define VA_PERIP_GRP1_BASE IOMEM(0xFD000000)
28#define UART_BASE UL(0xE0000000) 28#define UART_BASE UL(0xE0000000)
29#define VA_UART_BASE UL(0xFD000000) 29#define VA_UART_BASE IOMEM(0xFD000000)
30#define SSP_BASE UL(0xE0100000) 30#define SSP_BASE UL(0xE0100000)
31#define MISC_BASE UL(0xE0700000) 31#define MISC_BASE UL(0xE0700000)
32#define VA_MISC_BASE IOMEM(UL(0xFD700000)) 32#define VA_MISC_BASE IOMEM(0xFD700000)
33 33
34#define A9SM_AND_MPMC_BASE UL(0xEC000000) 34#define A9SM_AND_MPMC_BASE UL(0xEC000000)
35#define VA_A9SM_AND_MPMC_BASE UL(0xFC000000) 35#define VA_A9SM_AND_MPMC_BASE IOMEM(0xFC000000)
36 36
37/* A9SM peripheral offsets */ 37/* A9SM peripheral offsets */
38#define A9SM_PERIP_BASE UL(0xEC800000) 38#define A9SM_PERIP_BASE UL(0xEC800000)
39#define VA_A9SM_PERIP_BASE UL(0xFC800000) 39#define VA_A9SM_PERIP_BASE IOMEM(0xFC800000)
40#define VA_SCU_BASE (VA_A9SM_PERIP_BASE + 0x00) 40#define VA_SCU_BASE (VA_A9SM_PERIP_BASE + 0x00)
41 41
42#define L2CC_BASE UL(0xED000000) 42#define L2CC_BASE UL(0xED000000)
diff --git a/arch/arm/mach-spear13xx/spear13xx.c b/arch/arm/mach-spear13xx/spear13xx.c
index cf936b106e27..e10648801b2e 100644
--- a/arch/arm/mach-spear13xx/spear13xx.c
+++ b/arch/arm/mach-spear13xx/spear13xx.c
@@ -114,17 +114,17 @@ void __init spear13xx_l2x0_init(void)
114 */ 114 */
115struct map_desc spear13xx_io_desc[] __initdata = { 115struct map_desc spear13xx_io_desc[] __initdata = {
116 { 116 {
117 .virtual = VA_PERIP_GRP2_BASE, 117 .virtual = (unsigned long)VA_PERIP_GRP2_BASE,
118 .pfn = __phys_to_pfn(PERIP_GRP2_BASE), 118 .pfn = __phys_to_pfn(PERIP_GRP2_BASE),
119 .length = SZ_16M, 119 .length = SZ_16M,
120 .type = MT_DEVICE 120 .type = MT_DEVICE
121 }, { 121 }, {
122 .virtual = VA_PERIP_GRP1_BASE, 122 .virtual = (unsigned long)VA_PERIP_GRP1_BASE,
123 .pfn = __phys_to_pfn(PERIP_GRP1_BASE), 123 .pfn = __phys_to_pfn(PERIP_GRP1_BASE),
124 .length = SZ_16M, 124 .length = SZ_16M,
125 .type = MT_DEVICE 125 .type = MT_DEVICE
126 }, { 126 }, {
127 .virtual = VA_A9SM_AND_MPMC_BASE, 127 .virtual = (unsigned long)VA_A9SM_AND_MPMC_BASE,
128 .pfn = __phys_to_pfn(A9SM_AND_MPMC_BASE), 128 .pfn = __phys_to_pfn(A9SM_AND_MPMC_BASE),
129 .length = SZ_16M, 129 .length = SZ_16M,
130 .type = MT_DEVICE 130 .type = MT_DEVICE
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index b3226f80c985..5f3c03b61f8e 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -110,13 +110,6 @@ config TEGRA_DEBUG_UART_AUTO_SCRATCH
110 110
111endchoice 111endchoice
112 112
113config TEGRA_SYSTEM_DMA
114 bool "Enable system DMA driver for NVIDIA Tegra SoCs"
115 default y
116 help
117 Adds system DMA functionality for NVIDIA Tegra SoCs, used by
118 several Tegra device drivers
119
120config TEGRA_EMC_SCALING_ENABLE 113config TEGRA_EMC_SCALING_ENABLE
121 bool "Enable scaling the memory frequency" 114 bool "Enable scaling the memory frequency"
122 115
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index 56065acbd816..0974ace45558 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -18,7 +18,6 @@ obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra30_clocks.o
18obj-$(CONFIG_SMP) += platsmp.o headsmp.o 18obj-$(CONFIG_SMP) += platsmp.o headsmp.o
19obj-$(CONFIG_SMP) += reset.o 19obj-$(CONFIG_SMP) += reset.o
20obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 20obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
21obj-$(CONFIG_TEGRA_SYSTEM_DMA) += dma.o
22obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o 21obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o
23obj-$(CONFIG_TEGRA_PCI) += pcie.o 22obj-$(CONFIG_TEGRA_PCI) += pcie.o
24obj-$(CONFIG_USB_SUPPORT) += usb_phy.o 23obj-$(CONFIG_USB_SUPPORT) += usb_phy.o
diff --git a/arch/arm/mach-tegra/apbio.c b/arch/arm/mach-tegra/apbio.c
index 643a37809a15..b5015d0f1912 100644
--- a/arch/arm/mach-tegra/apbio.c
+++ b/arch/arm/mach-tegra/apbio.c
@@ -28,7 +28,7 @@
28 28
29#include "apbio.h" 29#include "apbio.h"
30 30
31#if defined(CONFIG_TEGRA_SYSTEM_DMA) || defined(CONFIG_TEGRA20_APB_DMA) 31#if defined(CONFIG_TEGRA20_APB_DMA)
32static DEFINE_MUTEX(tegra_apb_dma_lock); 32static DEFINE_MUTEX(tegra_apb_dma_lock);
33static u32 *tegra_apb_bb; 33static u32 *tegra_apb_bb;
34static dma_addr_t tegra_apb_bb_phys; 34static dma_addr_t tegra_apb_bb_phys;
@@ -37,121 +37,6 @@ static DECLARE_COMPLETION(tegra_apb_wait);
37static u32 tegra_apb_readl_direct(unsigned long offset); 37static u32 tegra_apb_readl_direct(unsigned long offset);
38static void tegra_apb_writel_direct(u32 value, unsigned long offset); 38static void tegra_apb_writel_direct(u32 value, unsigned long offset);
39 39
40#if defined(CONFIG_TEGRA_SYSTEM_DMA)
41static struct tegra_dma_channel *tegra_apb_dma;
42
43bool tegra_apb_init(void)
44{
45 struct tegra_dma_channel *ch;
46
47 mutex_lock(&tegra_apb_dma_lock);
48
49 /* Check to see if we raced to setup */
50 if (tegra_apb_dma)
51 goto out;
52
53 ch = tegra_dma_allocate_channel(TEGRA_DMA_MODE_ONESHOT |
54 TEGRA_DMA_SHARED);
55
56 if (!ch)
57 goto out_fail;
58
59 tegra_apb_bb = dma_alloc_coherent(NULL, sizeof(u32),
60 &tegra_apb_bb_phys, GFP_KERNEL);
61 if (!tegra_apb_bb) {
62 pr_err("%s: can not allocate bounce buffer\n", __func__);
63 tegra_dma_free_channel(ch);
64 goto out_fail;
65 }
66
67 tegra_apb_dma = ch;
68out:
69 mutex_unlock(&tegra_apb_dma_lock);
70 return true;
71
72out_fail:
73 mutex_unlock(&tegra_apb_dma_lock);
74 return false;
75}
76
77static void apb_dma_complete(struct tegra_dma_req *req)
78{
79 complete(&tegra_apb_wait);
80}
81
82static u32 tegra_apb_readl_using_dma(unsigned long offset)
83{
84 struct tegra_dma_req req;
85 int ret;
86
87 if (!tegra_apb_dma && !tegra_apb_init())
88 return tegra_apb_readl_direct(offset);
89
90 mutex_lock(&tegra_apb_dma_lock);
91 req.complete = apb_dma_complete;
92 req.to_memory = 1;
93 req.dest_addr = tegra_apb_bb_phys;
94 req.dest_bus_width = 32;
95 req.dest_wrap = 1;
96 req.source_addr = offset;
97 req.source_bus_width = 32;
98 req.source_wrap = 4;
99 req.req_sel = TEGRA_DMA_REQ_SEL_CNTR;
100 req.size = 4;
101
102 INIT_COMPLETION(tegra_apb_wait);
103
104 tegra_dma_enqueue_req(tegra_apb_dma, &req);
105
106 ret = wait_for_completion_timeout(&tegra_apb_wait,
107 msecs_to_jiffies(50));
108
109 if (WARN(ret == 0, "apb read dma timed out")) {
110 tegra_dma_dequeue_req(tegra_apb_dma, &req);
111 *(u32 *)tegra_apb_bb = 0;
112 }
113
114 mutex_unlock(&tegra_apb_dma_lock);
115 return *((u32 *)tegra_apb_bb);
116}
117
118static void tegra_apb_writel_using_dma(u32 value, unsigned long offset)
119{
120 struct tegra_dma_req req;
121 int ret;
122
123 if (!tegra_apb_dma && !tegra_apb_init()) {
124 tegra_apb_writel_direct(value, offset);
125 return;
126 }
127
128 mutex_lock(&tegra_apb_dma_lock);
129 *((u32 *)tegra_apb_bb) = value;
130 req.complete = apb_dma_complete;
131 req.to_memory = 0;
132 req.dest_addr = offset;
133 req.dest_wrap = 4;
134 req.dest_bus_width = 32;
135 req.source_addr = tegra_apb_bb_phys;
136 req.source_bus_width = 32;
137 req.source_wrap = 1;
138 req.req_sel = TEGRA_DMA_REQ_SEL_CNTR;
139 req.size = 4;
140
141 INIT_COMPLETION(tegra_apb_wait);
142
143 tegra_dma_enqueue_req(tegra_apb_dma, &req);
144
145 ret = wait_for_completion_timeout(&tegra_apb_wait,
146 msecs_to_jiffies(50));
147
148 if (WARN(ret == 0, "apb write dma timed out"))
149 tegra_dma_dequeue_req(tegra_apb_dma, &req);
150
151 mutex_unlock(&tegra_apb_dma_lock);
152}
153
154#else
155static struct dma_chan *tegra_apb_dma_chan; 40static struct dma_chan *tegra_apb_dma_chan;
156static struct dma_slave_config dma_sconfig; 41static struct dma_slave_config dma_sconfig;
157 42
@@ -279,7 +164,6 @@ static void tegra_apb_writel_using_dma(u32 value, unsigned long offset)
279 pr_err("error in writing offset 0x%08lx using dma\n", offset); 164 pr_err("error in writing offset 0x%08lx using dma\n", offset);
280 mutex_unlock(&tegra_apb_dma_lock); 165 mutex_unlock(&tegra_apb_dma_lock);
281} 166}
282#endif
283#else 167#else
284#define tegra_apb_readl_using_dma tegra_apb_readl_direct 168#define tegra_apb_readl_using_dma tegra_apb_readl_direct
285#define tegra_apb_writel_using_dma tegra_apb_writel_direct 169#define tegra_apb_writel_using_dma tegra_apb_writel_direct
diff --git a/arch/arm/mach-tegra/dma.c b/arch/arm/mach-tegra/dma.c
deleted file mode 100644
index 29c5114d607c..000000000000
--- a/arch/arm/mach-tegra/dma.c
+++ /dev/null
@@ -1,823 +0,0 @@
1/*
2 * arch/arm/mach-tegra/dma.c
3 *
4 * System DMA driver for NVIDIA Tegra SoCs
5 *
6 * Copyright (c) 2008-2009, NVIDIA Corporation.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23#include <linux/io.h>
24#include <linux/interrupt.h>
25#include <linux/module.h>
26#include <linux/spinlock.h>
27#include <linux/err.h>
28#include <linux/irq.h>
29#include <linux/delay.h>
30#include <linux/clk.h>
31#include <mach/dma.h>
32#include <mach/irqs.h>
33#include <mach/iomap.h>
34#include <mach/suspend.h>
35
36#include "apbio.h"
37
38#define APB_DMA_GEN 0x000
39#define GEN_ENABLE (1<<31)
40
41#define APB_DMA_CNTRL 0x010
42
43#define APB_DMA_IRQ_MASK 0x01c
44
45#define APB_DMA_IRQ_MASK_SET 0x020
46
47#define APB_DMA_CHAN_CSR 0x000
48#define CSR_ENB (1<<31)
49#define CSR_IE_EOC (1<<30)
50#define CSR_HOLD (1<<29)
51#define CSR_DIR (1<<28)
52#define CSR_ONCE (1<<27)
53#define CSR_FLOW (1<<21)
54#define CSR_REQ_SEL_SHIFT 16
55#define CSR_WCOUNT_SHIFT 2
56#define CSR_WCOUNT_MASK 0xFFFC
57
58#define APB_DMA_CHAN_STA 0x004
59#define STA_BUSY (1<<31)
60#define STA_ISE_EOC (1<<30)
61#define STA_HALT (1<<29)
62#define STA_PING_PONG (1<<28)
63#define STA_COUNT_SHIFT 2
64#define STA_COUNT_MASK 0xFFFC
65
66#define APB_DMA_CHAN_AHB_PTR 0x010
67
68#define APB_DMA_CHAN_AHB_SEQ 0x014
69#define AHB_SEQ_INTR_ENB (1<<31)
70#define AHB_SEQ_BUS_WIDTH_SHIFT 28
71#define AHB_SEQ_BUS_WIDTH_MASK (0x7<<AHB_SEQ_BUS_WIDTH_SHIFT)
72#define AHB_SEQ_BUS_WIDTH_8 (0<<AHB_SEQ_BUS_WIDTH_SHIFT)
73#define AHB_SEQ_BUS_WIDTH_16 (1<<AHB_SEQ_BUS_WIDTH_SHIFT)
74#define AHB_SEQ_BUS_WIDTH_32 (2<<AHB_SEQ_BUS_WIDTH_SHIFT)
75#define AHB_SEQ_BUS_WIDTH_64 (3<<AHB_SEQ_BUS_WIDTH_SHIFT)
76#define AHB_SEQ_BUS_WIDTH_128 (4<<AHB_SEQ_BUS_WIDTH_SHIFT)
77#define AHB_SEQ_DATA_SWAP (1<<27)
78#define AHB_SEQ_BURST_MASK (0x7<<24)
79#define AHB_SEQ_BURST_1 (4<<24)
80#define AHB_SEQ_BURST_4 (5<<24)
81#define AHB_SEQ_BURST_8 (6<<24)
82#define AHB_SEQ_DBL_BUF (1<<19)
83#define AHB_SEQ_WRAP_SHIFT 16
84#define AHB_SEQ_WRAP_MASK (0x7<<AHB_SEQ_WRAP_SHIFT)
85
86#define APB_DMA_CHAN_APB_PTR 0x018
87
88#define APB_DMA_CHAN_APB_SEQ 0x01c
89#define APB_SEQ_BUS_WIDTH_SHIFT 28
90#define APB_SEQ_BUS_WIDTH_MASK (0x7<<APB_SEQ_BUS_WIDTH_SHIFT)
91#define APB_SEQ_BUS_WIDTH_8 (0<<APB_SEQ_BUS_WIDTH_SHIFT)
92#define APB_SEQ_BUS_WIDTH_16 (1<<APB_SEQ_BUS_WIDTH_SHIFT)
93#define APB_SEQ_BUS_WIDTH_32 (2<<APB_SEQ_BUS_WIDTH_SHIFT)
94#define APB_SEQ_BUS_WIDTH_64 (3<<APB_SEQ_BUS_WIDTH_SHIFT)
95#define APB_SEQ_BUS_WIDTH_128 (4<<APB_SEQ_BUS_WIDTH_SHIFT)
96#define APB_SEQ_DATA_SWAP (1<<27)
97#define APB_SEQ_WRAP_SHIFT 16
98#define APB_SEQ_WRAP_MASK (0x7<<APB_SEQ_WRAP_SHIFT)
99
100#define TEGRA_SYSTEM_DMA_CH_NR 16
101#define TEGRA_SYSTEM_DMA_AVP_CH_NUM 4
102#define TEGRA_SYSTEM_DMA_CH_MIN 0
103#define TEGRA_SYSTEM_DMA_CH_MAX \
104 (TEGRA_SYSTEM_DMA_CH_NR - TEGRA_SYSTEM_DMA_AVP_CH_NUM - 1)
105
106#define NV_DMA_MAX_TRASFER_SIZE 0x10000
107
108static const unsigned int ahb_addr_wrap_table[8] = {
109 0, 32, 64, 128, 256, 512, 1024, 2048
110};
111
112static const unsigned int apb_addr_wrap_table[8] = {
113 0, 1, 2, 4, 8, 16, 32, 64
114};
115
116static const unsigned int bus_width_table[5] = {
117 8, 16, 32, 64, 128
118};
119
120#define TEGRA_DMA_NAME_SIZE 16
121struct tegra_dma_channel {
122 struct list_head list;
123 int id;
124 spinlock_t lock;
125 char name[TEGRA_DMA_NAME_SIZE];
126 void __iomem *addr;
127 int mode;
128 int irq;
129 int req_transfer_count;
130};
131
132#define NV_DMA_MAX_CHANNELS 32
133
134static bool tegra_dma_initialized;
135static DEFINE_MUTEX(tegra_dma_lock);
136static DEFINE_SPINLOCK(enable_lock);
137
138static DECLARE_BITMAP(channel_usage, NV_DMA_MAX_CHANNELS);
139static struct tegra_dma_channel dma_channels[NV_DMA_MAX_CHANNELS];
140
141static void tegra_dma_update_hw(struct tegra_dma_channel *ch,
142 struct tegra_dma_req *req);
143static void tegra_dma_update_hw_partial(struct tegra_dma_channel *ch,
144 struct tegra_dma_req *req);
145static void tegra_dma_stop(struct tegra_dma_channel *ch);
146
147void tegra_dma_flush(struct tegra_dma_channel *ch)
148{
149}
150EXPORT_SYMBOL(tegra_dma_flush);
151
152void tegra_dma_dequeue(struct tegra_dma_channel *ch)
153{
154 struct tegra_dma_req *req;
155
156 if (tegra_dma_is_empty(ch))
157 return;
158
159 req = list_entry(ch->list.next, typeof(*req), node);
160
161 tegra_dma_dequeue_req(ch, req);
162 return;
163}
164
165static void tegra_dma_stop(struct tegra_dma_channel *ch)
166{
167 u32 csr;
168 u32 status;
169
170 csr = readl(ch->addr + APB_DMA_CHAN_CSR);
171 csr &= ~CSR_IE_EOC;
172 writel(csr, ch->addr + APB_DMA_CHAN_CSR);
173
174 csr &= ~CSR_ENB;
175 writel(csr, ch->addr + APB_DMA_CHAN_CSR);
176
177 status = readl(ch->addr + APB_DMA_CHAN_STA);
178 if (status & STA_ISE_EOC)
179 writel(status, ch->addr + APB_DMA_CHAN_STA);
180}
181
182static int tegra_dma_cancel(struct tegra_dma_channel *ch)
183{
184 unsigned long irq_flags;
185
186 spin_lock_irqsave(&ch->lock, irq_flags);
187 while (!list_empty(&ch->list))
188 list_del(ch->list.next);
189
190 tegra_dma_stop(ch);
191
192 spin_unlock_irqrestore(&ch->lock, irq_flags);
193 return 0;
194}
195
196static unsigned int get_channel_status(struct tegra_dma_channel *ch,
197 struct tegra_dma_req *req, bool is_stop_dma)
198{
199 void __iomem *addr = IO_ADDRESS(TEGRA_APB_DMA_BASE);
200 unsigned int status;
201
202 if (is_stop_dma) {
203 /*
204 * STOP the DMA and get the transfer count.
205 * Getting the transfer count is tricky.
206 * - Globally disable DMA on all channels
207 * - Read the channel's status register to know the number
208 * of pending bytes to be transfered.
209 * - Stop the dma channel
210 * - Globally re-enable DMA to resume other transfers
211 */
212 spin_lock(&enable_lock);
213 writel(0, addr + APB_DMA_GEN);
214 udelay(20);
215 status = readl(ch->addr + APB_DMA_CHAN_STA);
216 tegra_dma_stop(ch);
217 writel(GEN_ENABLE, addr + APB_DMA_GEN);
218 spin_unlock(&enable_lock);
219 if (status & STA_ISE_EOC) {
220 pr_err("Got Dma Int here clearing");
221 writel(status, ch->addr + APB_DMA_CHAN_STA);
222 }
223 req->status = TEGRA_DMA_REQ_ERROR_ABORTED;
224 } else {
225 status = readl(ch->addr + APB_DMA_CHAN_STA);
226 }
227 return status;
228}
229
230/* should be called with the channel lock held */
231static unsigned int dma_active_count(struct tegra_dma_channel *ch,
232 struct tegra_dma_req *req, unsigned int status)
233{
234 unsigned int to_transfer;
235 unsigned int req_transfer_count;
236 unsigned int bytes_transferred;
237
238 to_transfer = ((status & STA_COUNT_MASK) >> STA_COUNT_SHIFT) + 1;
239 req_transfer_count = ch->req_transfer_count + 1;
240 bytes_transferred = req_transfer_count;
241 if (status & STA_BUSY)
242 bytes_transferred -= to_transfer;
243 /*
244 * In continuous transfer mode, DMA only tracks the count of the
245 * half DMA buffer. So, if the DMA already finished half the DMA
246 * then add the half buffer to the completed count.
247 */
248 if (ch->mode & TEGRA_DMA_MODE_CONTINOUS) {
249 if (req->buffer_status == TEGRA_DMA_REQ_BUF_STATUS_HALF_FULL)
250 bytes_transferred += req_transfer_count;
251 if (status & STA_ISE_EOC)
252 bytes_transferred += req_transfer_count;
253 }
254 bytes_transferred *= 4;
255 return bytes_transferred;
256}
257
258int tegra_dma_dequeue_req(struct tegra_dma_channel *ch,
259 struct tegra_dma_req *_req)
260{
261 unsigned int status;
262 struct tegra_dma_req *req = NULL;
263 int found = 0;
264 unsigned long irq_flags;
265 int stop = 0;
266
267 spin_lock_irqsave(&ch->lock, irq_flags);
268
269 if (list_entry(ch->list.next, struct tegra_dma_req, node) == _req)
270 stop = 1;
271
272 list_for_each_entry(req, &ch->list, node) {
273 if (req == _req) {
274 list_del(&req->node);
275 found = 1;
276 break;
277 }
278 }
279 if (!found) {
280 spin_unlock_irqrestore(&ch->lock, irq_flags);
281 return 0;
282 }
283
284 if (!stop)
285 goto skip_stop_dma;
286
287 status = get_channel_status(ch, req, true);
288 req->bytes_transferred = dma_active_count(ch, req, status);
289
290 if (!list_empty(&ch->list)) {
291 /* if the list is not empty, queue the next request */
292 struct tegra_dma_req *next_req;
293 next_req = list_entry(ch->list.next,
294 typeof(*next_req), node);
295 tegra_dma_update_hw(ch, next_req);
296 }
297
298skip_stop_dma:
299 req->status = -TEGRA_DMA_REQ_ERROR_ABORTED;
300
301 spin_unlock_irqrestore(&ch->lock, irq_flags);
302
303 /* Callback should be called without any lock */
304 req->complete(req);
305 return 0;
306}
307EXPORT_SYMBOL(tegra_dma_dequeue_req);
308
309bool tegra_dma_is_empty(struct tegra_dma_channel *ch)
310{
311 unsigned long irq_flags;
312 bool is_empty;
313
314 spin_lock_irqsave(&ch->lock, irq_flags);
315 if (list_empty(&ch->list))
316 is_empty = true;
317 else
318 is_empty = false;
319 spin_unlock_irqrestore(&ch->lock, irq_flags);
320 return is_empty;
321}
322EXPORT_SYMBOL(tegra_dma_is_empty);
323
324bool tegra_dma_is_req_inflight(struct tegra_dma_channel *ch,
325 struct tegra_dma_req *_req)
326{
327 unsigned long irq_flags;
328 struct tegra_dma_req *req;
329
330 spin_lock_irqsave(&ch->lock, irq_flags);
331 list_for_each_entry(req, &ch->list, node) {
332 if (req == _req) {
333 spin_unlock_irqrestore(&ch->lock, irq_flags);
334 return true;
335 }
336 }
337 spin_unlock_irqrestore(&ch->lock, irq_flags);
338 return false;
339}
340EXPORT_SYMBOL(tegra_dma_is_req_inflight);
341
342int tegra_dma_enqueue_req(struct tegra_dma_channel *ch,
343 struct tegra_dma_req *req)
344{
345 unsigned long irq_flags;
346 struct tegra_dma_req *_req;
347 int start_dma = 0;
348
349 if (req->size > NV_DMA_MAX_TRASFER_SIZE ||
350 req->source_addr & 0x3 || req->dest_addr & 0x3) {
351 pr_err("Invalid DMA request for channel %d\n", ch->id);
352 return -EINVAL;
353 }
354
355 spin_lock_irqsave(&ch->lock, irq_flags);
356
357 list_for_each_entry(_req, &ch->list, node) {
358 if (req == _req) {
359 spin_unlock_irqrestore(&ch->lock, irq_flags);
360 return -EEXIST;
361 }
362 }
363
364 req->bytes_transferred = 0;
365 req->status = 0;
366 req->buffer_status = 0;
367 if (list_empty(&ch->list))
368 start_dma = 1;
369
370 list_add_tail(&req->node, &ch->list);
371
372 if (start_dma)
373 tegra_dma_update_hw(ch, req);
374
375 spin_unlock_irqrestore(&ch->lock, irq_flags);
376
377 return 0;
378}
379EXPORT_SYMBOL(tegra_dma_enqueue_req);
380
381struct tegra_dma_channel *tegra_dma_allocate_channel(int mode)
382{
383 int channel;
384 struct tegra_dma_channel *ch = NULL;
385
386 if (!tegra_dma_initialized)
387 return NULL;
388
389 mutex_lock(&tegra_dma_lock);
390
391 /* first channel is the shared channel */
392 if (mode & TEGRA_DMA_SHARED) {
393 channel = TEGRA_SYSTEM_DMA_CH_MIN;
394 } else {
395 channel = find_first_zero_bit(channel_usage,
396 ARRAY_SIZE(dma_channels));
397 if (channel >= ARRAY_SIZE(dma_channels))
398 goto out;
399 }
400 __set_bit(channel, channel_usage);
401 ch = &dma_channels[channel];
402 ch->mode = mode;
403
404out:
405 mutex_unlock(&tegra_dma_lock);
406 return ch;
407}
408EXPORT_SYMBOL(tegra_dma_allocate_channel);
409
410void tegra_dma_free_channel(struct tegra_dma_channel *ch)
411{
412 if (ch->mode & TEGRA_DMA_SHARED)
413 return;
414 tegra_dma_cancel(ch);
415 mutex_lock(&tegra_dma_lock);
416 __clear_bit(ch->id, channel_usage);
417 mutex_unlock(&tegra_dma_lock);
418}
419EXPORT_SYMBOL(tegra_dma_free_channel);
420
421static void tegra_dma_update_hw_partial(struct tegra_dma_channel *ch,
422 struct tegra_dma_req *req)
423{
424 u32 apb_ptr;
425 u32 ahb_ptr;
426
427 if (req->to_memory) {
428 apb_ptr = req->source_addr;
429 ahb_ptr = req->dest_addr;
430 } else {
431 apb_ptr = req->dest_addr;
432 ahb_ptr = req->source_addr;
433 }
434 writel(apb_ptr, ch->addr + APB_DMA_CHAN_APB_PTR);
435 writel(ahb_ptr, ch->addr + APB_DMA_CHAN_AHB_PTR);
436
437 req->status = TEGRA_DMA_REQ_INFLIGHT;
438 return;
439}
440
441static void tegra_dma_update_hw(struct tegra_dma_channel *ch,
442 struct tegra_dma_req *req)
443{
444 int ahb_addr_wrap;
445 int apb_addr_wrap;
446 int ahb_bus_width;
447 int apb_bus_width;
448 int index;
449
450 u32 ahb_seq;
451 u32 apb_seq;
452 u32 ahb_ptr;
453 u32 apb_ptr;
454 u32 csr;
455
456 csr = CSR_IE_EOC | CSR_FLOW;
457 ahb_seq = AHB_SEQ_INTR_ENB | AHB_SEQ_BURST_1;
458 apb_seq = 0;
459
460 csr |= req->req_sel << CSR_REQ_SEL_SHIFT;
461
462 /* One shot mode is always single buffered,
463 * continuous mode is always double buffered
464 * */
465 if (ch->mode & TEGRA_DMA_MODE_ONESHOT) {
466 csr |= CSR_ONCE;
467 ch->req_transfer_count = (req->size >> 2) - 1;
468 } else {
469 ahb_seq |= AHB_SEQ_DBL_BUF;
470
471 /* In double buffered mode, we set the size to half the
472 * requested size and interrupt when half the buffer
473 * is full */
474 ch->req_transfer_count = (req->size >> 3) - 1;
475 }
476
477 csr |= ch->req_transfer_count << CSR_WCOUNT_SHIFT;
478
479 if (req->to_memory) {
480 apb_ptr = req->source_addr;
481 ahb_ptr = req->dest_addr;
482
483 apb_addr_wrap = req->source_wrap;
484 ahb_addr_wrap = req->dest_wrap;
485 apb_bus_width = req->source_bus_width;
486 ahb_bus_width = req->dest_bus_width;
487
488 } else {
489 csr |= CSR_DIR;
490 apb_ptr = req->dest_addr;
491 ahb_ptr = req->source_addr;
492
493 apb_addr_wrap = req->dest_wrap;
494 ahb_addr_wrap = req->source_wrap;
495 apb_bus_width = req->dest_bus_width;
496 ahb_bus_width = req->source_bus_width;
497 }
498
499 apb_addr_wrap >>= 2;
500 ahb_addr_wrap >>= 2;
501
502 /* set address wrap for APB size */
503 index = 0;
504 do {
505 if (apb_addr_wrap_table[index] == apb_addr_wrap)
506 break;
507 index++;
508 } while (index < ARRAY_SIZE(apb_addr_wrap_table));
509 BUG_ON(index == ARRAY_SIZE(apb_addr_wrap_table));
510 apb_seq |= index << APB_SEQ_WRAP_SHIFT;
511
512 /* set address wrap for AHB size */
513 index = 0;
514 do {
515 if (ahb_addr_wrap_table[index] == ahb_addr_wrap)
516 break;
517 index++;
518 } while (index < ARRAY_SIZE(ahb_addr_wrap_table));
519 BUG_ON(index == ARRAY_SIZE(ahb_addr_wrap_table));
520 ahb_seq |= index << AHB_SEQ_WRAP_SHIFT;
521
522 for (index = 0; index < ARRAY_SIZE(bus_width_table); index++) {
523 if (bus_width_table[index] == ahb_bus_width)
524 break;
525 }
526 BUG_ON(index == ARRAY_SIZE(bus_width_table));
527 ahb_seq |= index << AHB_SEQ_BUS_WIDTH_SHIFT;
528
529 for (index = 0; index < ARRAY_SIZE(bus_width_table); index++) {
530 if (bus_width_table[index] == apb_bus_width)
531 break;
532 }
533 BUG_ON(index == ARRAY_SIZE(bus_width_table));
534 apb_seq |= index << APB_SEQ_BUS_WIDTH_SHIFT;
535
536 writel(csr, ch->addr + APB_DMA_CHAN_CSR);
537 writel(apb_seq, ch->addr + APB_DMA_CHAN_APB_SEQ);
538 writel(apb_ptr, ch->addr + APB_DMA_CHAN_APB_PTR);
539 writel(ahb_seq, ch->addr + APB_DMA_CHAN_AHB_SEQ);
540 writel(ahb_ptr, ch->addr + APB_DMA_CHAN_AHB_PTR);
541
542 csr |= CSR_ENB;
543 writel(csr, ch->addr + APB_DMA_CHAN_CSR);
544
545 req->status = TEGRA_DMA_REQ_INFLIGHT;
546}
547
548static void handle_oneshot_dma(struct tegra_dma_channel *ch)
549{
550 struct tegra_dma_req *req;
551 unsigned long irq_flags;
552
553 spin_lock_irqsave(&ch->lock, irq_flags);
554 if (list_empty(&ch->list)) {
555 spin_unlock_irqrestore(&ch->lock, irq_flags);
556 return;
557 }
558
559 req = list_entry(ch->list.next, typeof(*req), node);
560 if (req) {
561 int bytes_transferred;
562
563 bytes_transferred = ch->req_transfer_count;
564 bytes_transferred += 1;
565 bytes_transferred <<= 2;
566
567 list_del(&req->node);
568 req->bytes_transferred = bytes_transferred;
569 req->status = TEGRA_DMA_REQ_SUCCESS;
570
571 spin_unlock_irqrestore(&ch->lock, irq_flags);
572 /* Callback should be called without any lock */
573 pr_debug("%s: transferred %d bytes\n", __func__,
574 req->bytes_transferred);
575 req->complete(req);
576 spin_lock_irqsave(&ch->lock, irq_flags);
577 }
578
579 if (!list_empty(&ch->list)) {
580 req = list_entry(ch->list.next, typeof(*req), node);
581 /* the complete function we just called may have enqueued
582 another req, in which case dma has already started */
583 if (req->status != TEGRA_DMA_REQ_INFLIGHT)
584 tegra_dma_update_hw(ch, req);
585 }
586 spin_unlock_irqrestore(&ch->lock, irq_flags);
587}
588
589static void handle_continuous_dma(struct tegra_dma_channel *ch)
590{
591 struct tegra_dma_req *req;
592 unsigned long irq_flags;
593
594 spin_lock_irqsave(&ch->lock, irq_flags);
595 if (list_empty(&ch->list)) {
596 spin_unlock_irqrestore(&ch->lock, irq_flags);
597 return;
598 }
599
600 req = list_entry(ch->list.next, typeof(*req), node);
601 if (req) {
602 if (req->buffer_status == TEGRA_DMA_REQ_BUF_STATUS_EMPTY) {
603 bool is_dma_ping_complete;
604 is_dma_ping_complete = (readl(ch->addr + APB_DMA_CHAN_STA)
605 & STA_PING_PONG) ? true : false;
606 if (req->to_memory)
607 is_dma_ping_complete = !is_dma_ping_complete;
608 /* Out of sync - Release current buffer */
609 if (!is_dma_ping_complete) {
610 int bytes_transferred;
611
612 bytes_transferred = ch->req_transfer_count;
613 bytes_transferred += 1;
614 bytes_transferred <<= 3;
615 req->buffer_status = TEGRA_DMA_REQ_BUF_STATUS_FULL;
616 req->bytes_transferred = bytes_transferred;
617 req->status = TEGRA_DMA_REQ_SUCCESS;
618 tegra_dma_stop(ch);
619
620 if (!list_is_last(&req->node, &ch->list)) {
621 struct tegra_dma_req *next_req;
622
623 next_req = list_entry(req->node.next,
624 typeof(*next_req), node);
625 tegra_dma_update_hw(ch, next_req);
626 }
627
628 list_del(&req->node);
629
630 /* DMA lock is NOT held when callbak is called */
631 spin_unlock_irqrestore(&ch->lock, irq_flags);
632 req->complete(req);
633 return;
634 }
635 /* Load the next request into the hardware, if available
636 * */
637 if (!list_is_last(&req->node, &ch->list)) {
638 struct tegra_dma_req *next_req;
639
640 next_req = list_entry(req->node.next,
641 typeof(*next_req), node);
642 tegra_dma_update_hw_partial(ch, next_req);
643 }
644 req->buffer_status = TEGRA_DMA_REQ_BUF_STATUS_HALF_FULL;
645 req->status = TEGRA_DMA_REQ_SUCCESS;
646 /* DMA lock is NOT held when callback is called */
647 spin_unlock_irqrestore(&ch->lock, irq_flags);
648 if (likely(req->threshold))
649 req->threshold(req);
650 return;
651
652 } else if (req->buffer_status ==
653 TEGRA_DMA_REQ_BUF_STATUS_HALF_FULL) {
654 /* Callback when the buffer is completely full (i.e on
655 * the second interrupt */
656 int bytes_transferred;
657
658 bytes_transferred = ch->req_transfer_count;
659 bytes_transferred += 1;
660 bytes_transferred <<= 3;
661
662 req->buffer_status = TEGRA_DMA_REQ_BUF_STATUS_FULL;
663 req->bytes_transferred = bytes_transferred;
664 req->status = TEGRA_DMA_REQ_SUCCESS;
665 list_del(&req->node);
666
667 /* DMA lock is NOT held when callbak is called */
668 spin_unlock_irqrestore(&ch->lock, irq_flags);
669 req->complete(req);
670 return;
671
672 } else {
673 BUG();
674 }
675 }
676 spin_unlock_irqrestore(&ch->lock, irq_flags);
677}
678
679static irqreturn_t dma_isr(int irq, void *data)
680{
681 struct tegra_dma_channel *ch = data;
682 unsigned long status;
683
684 status = readl(ch->addr + APB_DMA_CHAN_STA);
685 if (status & STA_ISE_EOC)
686 writel(status, ch->addr + APB_DMA_CHAN_STA);
687 else {
688 pr_warning("Got a spurious ISR for DMA channel %d\n", ch->id);
689 return IRQ_HANDLED;
690 }
691 return IRQ_WAKE_THREAD;
692}
693
694static irqreturn_t dma_thread_fn(int irq, void *data)
695{
696 struct tegra_dma_channel *ch = data;
697
698 if (ch->mode & TEGRA_DMA_MODE_ONESHOT)
699 handle_oneshot_dma(ch);
700 else
701 handle_continuous_dma(ch);
702
703
704 return IRQ_HANDLED;
705}
706
707int __init tegra_dma_init(void)
708{
709 int ret = 0;
710 int i;
711 unsigned int irq;
712 void __iomem *addr;
713 struct clk *c;
714
715 bitmap_fill(channel_usage, NV_DMA_MAX_CHANNELS);
716
717 c = clk_get_sys("tegra-apbdma", NULL);
718 if (IS_ERR(c)) {
719 pr_err("Unable to get clock for APB DMA\n");
720 ret = PTR_ERR(c);
721 goto fail;
722 }
723 ret = clk_prepare_enable(c);
724 if (ret != 0) {
725 pr_err("Unable to enable clock for APB DMA\n");
726 goto fail;
727 }
728
729 addr = IO_ADDRESS(TEGRA_APB_DMA_BASE);
730 writel(GEN_ENABLE, addr + APB_DMA_GEN);
731 writel(0, addr + APB_DMA_CNTRL);
732 writel(0xFFFFFFFFul >> (31 - TEGRA_SYSTEM_DMA_CH_MAX),
733 addr + APB_DMA_IRQ_MASK_SET);
734
735 for (i = TEGRA_SYSTEM_DMA_CH_MIN; i <= TEGRA_SYSTEM_DMA_CH_MAX; i++) {
736 struct tegra_dma_channel *ch = &dma_channels[i];
737
738 ch->id = i;
739 snprintf(ch->name, TEGRA_DMA_NAME_SIZE, "dma_channel_%d", i);
740
741 ch->addr = IO_ADDRESS(TEGRA_APB_DMA_CH0_BASE +
742 TEGRA_APB_DMA_CH0_SIZE * i);
743
744 spin_lock_init(&ch->lock);
745 INIT_LIST_HEAD(&ch->list);
746
747 irq = INT_APB_DMA_CH0 + i;
748 ret = request_threaded_irq(irq, dma_isr, dma_thread_fn, 0,
749 dma_channels[i].name, ch);
750 if (ret) {
751 pr_err("Failed to register IRQ %d for DMA %d\n",
752 irq, i);
753 goto fail;
754 }
755 ch->irq = irq;
756
757 __clear_bit(i, channel_usage);
758 }
759 /* mark the shared channel allocated */
760 __set_bit(TEGRA_SYSTEM_DMA_CH_MIN, channel_usage);
761
762 tegra_dma_initialized = true;
763
764 return 0;
765fail:
766 writel(0, addr + APB_DMA_GEN);
767 for (i = TEGRA_SYSTEM_DMA_CH_MIN; i <= TEGRA_SYSTEM_DMA_CH_MAX; i++) {
768 struct tegra_dma_channel *ch = &dma_channels[i];
769 if (ch->irq)
770 free_irq(ch->irq, ch);
771 }
772 return ret;
773}
774postcore_initcall(tegra_dma_init);
775
776#ifdef CONFIG_PM
777static u32 apb_dma[5*TEGRA_SYSTEM_DMA_CH_NR + 3];
778
779void tegra_dma_suspend(void)
780{
781 void __iomem *addr = IO_ADDRESS(TEGRA_APB_DMA_BASE);
782 u32 *ctx = apb_dma;
783 int i;
784
785 *ctx++ = readl(addr + APB_DMA_GEN);
786 *ctx++ = readl(addr + APB_DMA_CNTRL);
787 *ctx++ = readl(addr + APB_DMA_IRQ_MASK);
788
789 for (i = 0; i < TEGRA_SYSTEM_DMA_CH_NR; i++) {
790 addr = IO_ADDRESS(TEGRA_APB_DMA_CH0_BASE +
791 TEGRA_APB_DMA_CH0_SIZE * i);
792
793 *ctx++ = readl(addr + APB_DMA_CHAN_CSR);
794 *ctx++ = readl(addr + APB_DMA_CHAN_AHB_PTR);
795 *ctx++ = readl(addr + APB_DMA_CHAN_AHB_SEQ);
796 *ctx++ = readl(addr + APB_DMA_CHAN_APB_PTR);
797 *ctx++ = readl(addr + APB_DMA_CHAN_APB_SEQ);
798 }
799}
800
801void tegra_dma_resume(void)
802{
803 void __iomem *addr = IO_ADDRESS(TEGRA_APB_DMA_BASE);
804 u32 *ctx = apb_dma;
805 int i;
806
807 writel(*ctx++, addr + APB_DMA_GEN);
808 writel(*ctx++, addr + APB_DMA_CNTRL);
809 writel(*ctx++, addr + APB_DMA_IRQ_MASK);
810
811 for (i = 0; i < TEGRA_SYSTEM_DMA_CH_NR; i++) {
812 addr = IO_ADDRESS(TEGRA_APB_DMA_CH0_BASE +
813 TEGRA_APB_DMA_CH0_SIZE * i);
814
815 writel(*ctx++, addr + APB_DMA_CHAN_CSR);
816 writel(*ctx++, addr + APB_DMA_CHAN_AHB_PTR);
817 writel(*ctx++, addr + APB_DMA_CHAN_AHB_SEQ);
818 writel(*ctx++, addr + APB_DMA_CHAN_APB_PTR);
819 writel(*ctx++, addr + APB_DMA_CHAN_APB_SEQ);
820 }
821}
822
823#endif
diff --git a/arch/arm/mach-tegra/include/mach/dma.h b/arch/arm/mach-tegra/include/mach/dma.h
index 9077092812c0..3081cc6dda3b 100644
--- a/arch/arm/mach-tegra/include/mach/dma.h
+++ b/arch/arm/mach-tegra/include/mach/dma.h
@@ -51,101 +51,4 @@
51#define TEGRA_DMA_REQ_SEL_OWR 25 51#define TEGRA_DMA_REQ_SEL_OWR 25
52#define TEGRA_DMA_REQ_SEL_INVALID 31 52#define TEGRA_DMA_REQ_SEL_INVALID 31
53 53
54struct tegra_dma_req;
55struct tegra_dma_channel;
56
57enum tegra_dma_mode {
58 TEGRA_DMA_SHARED = 1,
59 TEGRA_DMA_MODE_CONTINOUS = 2,
60 TEGRA_DMA_MODE_ONESHOT = 4,
61};
62
63enum tegra_dma_req_error {
64 TEGRA_DMA_REQ_SUCCESS = 0,
65 TEGRA_DMA_REQ_ERROR_ABORTED,
66 TEGRA_DMA_REQ_INFLIGHT,
67};
68
69enum tegra_dma_req_buff_status {
70 TEGRA_DMA_REQ_BUF_STATUS_EMPTY = 0,
71 TEGRA_DMA_REQ_BUF_STATUS_HALF_FULL,
72 TEGRA_DMA_REQ_BUF_STATUS_FULL,
73};
74
75struct tegra_dma_req {
76 struct list_head node;
77 unsigned int modid;
78 int instance;
79
80 /* Called when the req is complete and from the DMA ISR context.
81 * When this is called the req structure is no longer queued by
82 * the DMA channel.
83 *
84 * State of the DMA depends on the number of req it has. If there are
85 * no DMA requests queued up, then it will STOP the DMA. It there are
86 * more requests in the DMA, then it will queue the next request.
87 */
88 void (*complete)(struct tegra_dma_req *req);
89
90 /* This is a called from the DMA ISR context when the DMA is still in
91 * progress and is actively filling same buffer.
92 *
93 * In case of continuous mode receive, this threshold is 1/2 the buffer
94 * size. In other cases, this will not even be called as there is no
95 * hardware support for it.
96 *
97 * In the case of continuous mode receive, if there is next req already
98 * queued, DMA programs the HW to use that req when this req is
99 * completed. If there is no "next req" queued, then DMA ISR doesn't do
100 * anything before calling this callback.
101 *
102 * This is mainly used by the cases, where the clients has queued
103 * only one req and want to get some sort of DMA threshold
104 * callback to program the next buffer.
105 *
106 */
107 void (*threshold)(struct tegra_dma_req *req);
108
109 /* 1 to copy to memory.
110 * 0 to copy from the memory to device FIFO */
111 int to_memory;
112
113 void *virt_addr;
114
115 unsigned long source_addr;
116 unsigned long dest_addr;
117 unsigned long dest_wrap;
118 unsigned long source_wrap;
119 unsigned long source_bus_width;
120 unsigned long dest_bus_width;
121 unsigned long req_sel;
122 unsigned int size;
123
124 /* Updated by the DMA driver on the conpletion of the request. */
125 int bytes_transferred;
126 int status;
127
128 /* DMA completion tracking information */
129 int buffer_status;
130
131 /* Client specific data */
132 void *dev;
133};
134
135int tegra_dma_enqueue_req(struct tegra_dma_channel *ch,
136 struct tegra_dma_req *req);
137int tegra_dma_dequeue_req(struct tegra_dma_channel *ch,
138 struct tegra_dma_req *req);
139void tegra_dma_dequeue(struct tegra_dma_channel *ch);
140void tegra_dma_flush(struct tegra_dma_channel *ch);
141
142bool tegra_dma_is_req_inflight(struct tegra_dma_channel *ch,
143 struct tegra_dma_req *req);
144bool tegra_dma_is_empty(struct tegra_dma_channel *ch);
145
146struct tegra_dma_channel *tegra_dma_allocate_channel(int mode);
147void tegra_dma_free_channel(struct tegra_dma_channel *ch);
148
149int __init tegra_dma_init(void);
150
151#endif 54#endif
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
index 119bc52ab93e..4e07eec1270d 100644
--- a/arch/arm/mm/context.c
+++ b/arch/arm/mm/context.c
@@ -63,10 +63,11 @@ static int contextidr_notifier(struct notifier_block *unused, unsigned long cmd,
63 pid = task_pid_nr(thread->task) << ASID_BITS; 63 pid = task_pid_nr(thread->task) << ASID_BITS;
64 asm volatile( 64 asm volatile(
65 " mrc p15, 0, %0, c13, c0, 1\n" 65 " mrc p15, 0, %0, c13, c0, 1\n"
66 " bfi %1, %0, #0, %2\n" 66 " and %0, %0, %2\n"
67 " mcr p15, 0, %1, c13, c0, 1\n" 67 " orr %0, %0, %1\n"
68 " mcr p15, 0, %0, c13, c0, 1\n"
68 : "=r" (contextidr), "+r" (pid) 69 : "=r" (contextidr), "+r" (pid)
69 : "I" (ASID_BITS)); 70 : "I" (~ASID_MASK));
70 isb(); 71 isb();
71 72
72 return NOTIFY_OK; 73 return NOTIFY_OK;
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 051204fc4617..e59c4ab71bcb 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -489,7 +489,7 @@ static bool __in_atomic_pool(void *start, size_t size)
489 void *pool_start = pool->vaddr; 489 void *pool_start = pool->vaddr;
490 void *pool_end = pool->vaddr + pool->size; 490 void *pool_end = pool->vaddr + pool->size;
491 491
492 if (start < pool_start || start > pool_end) 492 if (start < pool_start || start >= pool_end)
493 return false; 493 return false;
494 494
495 if (end <= pool_end) 495 if (end <= pool_end)
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index a7a9e41fa2c2..18144e6a3115 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -990,8 +990,8 @@ void __init sanity_check_meminfo(void)
990 * Check whether this memory bank would partially overlap 990 * Check whether this memory bank would partially overlap
991 * the vmalloc area. 991 * the vmalloc area.
992 */ 992 */
993 if (__va(bank->start + bank->size) > vmalloc_min || 993 if (__va(bank->start + bank->size - 1) >= vmalloc_min ||
994 __va(bank->start + bank->size) < __va(bank->start)) { 994 __va(bank->start + bank->size - 1) <= __va(bank->start)) {
995 unsigned long newsize = vmalloc_min - __va(bank->start); 995 unsigned long newsize = vmalloc_min - __va(bank->start);
996 printk(KERN_NOTICE "Truncating RAM at %.8llx-%.8llx " 996 printk(KERN_NOTICE "Truncating RAM at %.8llx-%.8llx "
997 "to -%.8llx (vmalloc region overlap).\n", 997 "to -%.8llx (vmalloc region overlap).\n",
diff --git a/arch/arm/plat-mxc/include/mach/mx31.h b/arch/arm/plat-mxc/include/mach/mx31.h
index dbced61d9fda..ee9b1f9215df 100644
--- a/arch/arm/plat-mxc/include/mach/mx31.h
+++ b/arch/arm/plat-mxc/include/mach/mx31.h
@@ -76,7 +76,7 @@
76#define MX31_RTIC_BASE_ADDR (MX31_AIPS2_BASE_ADDR + 0xec000) 76#define MX31_RTIC_BASE_ADDR (MX31_AIPS2_BASE_ADDR + 0xec000)
77 77
78#define MX31_ROMP_BASE_ADDR 0x60000000 78#define MX31_ROMP_BASE_ADDR 0x60000000
79#define MX31_ROMP_BASE_ADDR_VIRT 0xfc500000 79#define MX31_ROMP_BASE_ADDR_VIRT IOMEM(0xfc500000)
80#define MX31_ROMP_SIZE SZ_1M 80#define MX31_ROMP_SIZE SZ_1M
81 81
82#define MX31_AVIC_BASE_ADDR 0x68000000 82#define MX31_AVIC_BASE_ADDR 0x68000000
@@ -92,11 +92,11 @@
92#define MX31_CS3_BASE_ADDR 0xb2000000 92#define MX31_CS3_BASE_ADDR 0xb2000000
93 93
94#define MX31_CS4_BASE_ADDR 0xb4000000 94#define MX31_CS4_BASE_ADDR 0xb4000000
95#define MX31_CS4_BASE_ADDR_VIRT 0xf6000000 95#define MX31_CS4_BASE_ADDR_VIRT IOMEM(0xf6000000)
96#define MX31_CS4_SIZE SZ_32M 96#define MX31_CS4_SIZE SZ_32M
97 97
98#define MX31_CS5_BASE_ADDR 0xb6000000 98#define MX31_CS5_BASE_ADDR 0xb6000000
99#define MX31_CS5_BASE_ADDR_VIRT 0xf8000000 99#define MX31_CS5_BASE_ADDR_VIRT IOMEM(0xf8000000)
100#define MX31_CS5_SIZE SZ_32M 100#define MX31_CS5_SIZE SZ_32M
101 101
102#define MX31_X_MEMC_BASE_ADDR 0xb8000000 102#define MX31_X_MEMC_BASE_ADDR 0xb8000000
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index d861aa73299d..28acb383e7df 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -67,6 +67,7 @@
67 67
68static unsigned long omap_sram_start; 68static unsigned long omap_sram_start;
69static void __iomem *omap_sram_base; 69static void __iomem *omap_sram_base;
70static unsigned long omap_sram_skip;
70static unsigned long omap_sram_size; 71static unsigned long omap_sram_size;
71static void __iomem *omap_sram_ceil; 72static void __iomem *omap_sram_ceil;
72 73
@@ -105,6 +106,7 @@ static int is_sram_locked(void)
105 */ 106 */
106static void __init omap_detect_sram(void) 107static void __init omap_detect_sram(void)
107{ 108{
109 omap_sram_skip = SRAM_BOOTLOADER_SZ;
108 if (cpu_class_is_omap2()) { 110 if (cpu_class_is_omap2()) {
109 if (is_sram_locked()) { 111 if (is_sram_locked()) {
110 if (cpu_is_omap34xx()) { 112 if (cpu_is_omap34xx()) {
@@ -112,6 +114,7 @@ static void __init omap_detect_sram(void)
112 if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) || 114 if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||
113 (omap_type() == OMAP2_DEVICE_TYPE_SEC)) { 115 (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {
114 omap_sram_size = 0x7000; /* 28K */ 116 omap_sram_size = 0x7000; /* 28K */
117 omap_sram_skip += SZ_16K;
115 } else { 118 } else {
116 omap_sram_size = 0x8000; /* 32K */ 119 omap_sram_size = 0x8000; /* 32K */
117 } 120 }
@@ -174,8 +177,10 @@ static void __init omap_map_sram(void)
174 return; 177 return;
175 178
176#ifdef CONFIG_OMAP4_ERRATA_I688 179#ifdef CONFIG_OMAP4_ERRATA_I688
180 if (cpu_is_omap44xx()) {
177 omap_sram_start += PAGE_SIZE; 181 omap_sram_start += PAGE_SIZE;
178 omap_sram_size -= SZ_16K; 182 omap_sram_size -= SZ_16K;
183 }
179#endif 184#endif
180 if (cpu_is_omap34xx()) { 185 if (cpu_is_omap34xx()) {
181 /* 186 /*
@@ -202,8 +207,8 @@ static void __init omap_map_sram(void)
202 * Looks like we need to preserve some bootloader code at the 207 * Looks like we need to preserve some bootloader code at the
203 * beginning of SRAM for jumping to flash for reboot to work... 208 * beginning of SRAM for jumping to flash for reboot to work...
204 */ 209 */
205 memset_io(omap_sram_base + SRAM_BOOTLOADER_SZ, 0, 210 memset_io(omap_sram_base + omap_sram_skip, 0,
206 omap_sram_size - SRAM_BOOTLOADER_SZ); 211 omap_sram_size - omap_sram_skip);
207} 212}
208 213
209/* 214/*
@@ -217,7 +222,7 @@ void *omap_sram_push_address(unsigned long size)
217{ 222{
218 unsigned long available, new_ceil = (unsigned long)omap_sram_ceil; 223 unsigned long available, new_ceil = (unsigned long)omap_sram_ceil;
219 224
220 available = omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ); 225 available = omap_sram_ceil - (omap_sram_base + omap_sram_skip);
221 226
222 if (size > available) { 227 if (size > available) {
223 pr_err("Not enough space in SRAM\n"); 228 pr_err("Not enough space in SRAM\n");
diff --git a/arch/arm/plat-samsung/include/plat/gpio-fns.h b/arch/arm/plat-samsung/include/plat/gpio-fns.h
index bab139201761..d1ecef0e38e0 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-fns.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-fns.h
@@ -1,98 +1 @@
1/* arch/arm/mach-s3c2410/include/mach/gpio-fns.h
2 *
3 * Copyright (c) 2003-2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - hardware
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __MACH_GPIO_FNS_H
14#define __MACH_GPIO_FNS_H __FILE__
15
16/* These functions are in the to-be-removed category and it is strongly
17 * encouraged not to use these in new code. They will be marked deprecated
18 * very soon.
19 *
20 * Most of the functionality can be either replaced by the gpiocfg calls
21 * for the s3c platform or by the generic GPIOlib API.
22 *
23 * As of 2.6.35-rc, these will be removed, with the few drivers using them
24 * either replaced or given a wrapper until the calls can be removed.
25*/
26
27#include <plat/gpio-cfg.h> #include <plat/gpio-cfg.h>
28
29static inline void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int cfg)
30{
31 /* 1:1 mapping between cfgpin and setcfg calls at the moment */
32 s3c_gpio_cfgpin(pin, cfg);
33}
34
35/* external functions for GPIO support
36 *
37 * These allow various different clients to access the same GPIO
38 * registers without conflicting. If your driver only owns the entire
39 * GPIO register, then it is safe to ioremap/__raw_{read|write} to it.
40*/
41
42extern unsigned int s3c2410_gpio_getcfg(unsigned int pin);
43
44/* s3c2410_gpio_getirq
45 *
46 * turn the given pin number into the corresponding IRQ number
47 *
48 * returns:
49 * < 0 = no interrupt for this pin
50 * >=0 = interrupt number for the pin
51*/
52
53extern int s3c2410_gpio_getirq(unsigned int pin);
54
55/* s3c2410_gpio_irqfilter
56 *
57 * set the irq filtering on the given pin
58 *
59 * on = 0 => disable filtering
60 * 1 => enable filtering
61 *
62 * config = S3C2410_EINTFLT_PCLK or S3C2410_EINTFLT_EXTCLK orred with
63 * width of filter (0 through 63)
64 *
65 *
66*/
67
68extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on,
69 unsigned int config);
70
71/* s3c2410_gpio_pullup
72 *
73 * This call should be replaced with s3c_gpio_setpull().
74 *
75 * As a note, there is currently no distinction between pull-up and pull-down
76 * in the s3c24xx series devices with only an on/off configuration.
77 */
78
79/* s3c2410_gpio_pullup
80 *
81 * configure the pull-up control on the given pin
82 *
83 * to = 1 => disable the pull-up
84 * 0 => enable the pull-up
85 *
86 * eg;
87 *
88 * s3c2410_gpio_pullup(S3C2410_GPB(0), 0);
89 * s3c2410_gpio_pullup(S3C2410_GPE(8), 0);
90*/
91
92extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to);
93
94extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to);
95
96extern unsigned int s3c2410_gpio_getpin(unsigned int pin);
97
98#endif /* __MACH_GPIO_FNS_H */
diff --git a/arch/arm/plat-samsung/s5p-irq-gpioint.c b/arch/arm/plat-samsung/s5p-irq-gpioint.c
index f9431fe5b06e..23557d30e44c 100644
--- a/arch/arm/plat-samsung/s5p-irq-gpioint.c
+++ b/arch/arm/plat-samsung/s5p-irq-gpioint.c
@@ -24,7 +24,7 @@
24 24
25#include <asm/mach/irq.h> 25#include <asm/mach/irq.h>
26 26
27#define GPIO_BASE(chip) (((unsigned long)(chip)->base) & 0xFFFFF000u) 27#define GPIO_BASE(chip) ((void __iomem *)((unsigned long)((chip)->base) & 0xFFFFF000u))
28 28
29#define CON_OFFSET 0x700 29#define CON_OFFSET 0x700
30#define MASK_OFFSET 0x900 30#define MASK_OFFSET 0x900
@@ -153,7 +153,7 @@ static __init int s5p_gpioint_add(struct samsung_gpio_chip *chip)
153 bank->chips[group - bank->start] = chip; 153 bank->chips[group - bank->start] = chip;
154 154
155 gc = irq_alloc_generic_chip("s5p_gpioint", 1, chip->irq_base, 155 gc = irq_alloc_generic_chip("s5p_gpioint", 1, chip->irq_base,
156 (void __iomem *)GPIO_BASE(chip), 156 GPIO_BASE(chip),
157 handle_level_irq); 157 handle_level_irq);
158 if (!gc) 158 if (!gc)
159 return -ENOMEM; 159 return -ENOMEM;
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index f34861920634..c7092e6057c5 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -38,6 +38,7 @@ config BLACKFIN
38 select GENERIC_ATOMIC64 38 select GENERIC_ATOMIC64
39 select GENERIC_IRQ_PROBE 39 select GENERIC_IRQ_PROBE
40 select IRQ_PER_CPU if SMP 40 select IRQ_PER_CPU if SMP
41 select USE_GENERIC_SMP_HELPERS if SMP
41 select HAVE_NMI_WATCHDOG if NMI_WATCHDOG 42 select HAVE_NMI_WATCHDOG if NMI_WATCHDOG
42 select GENERIC_SMP_IDLE_THREAD 43 select GENERIC_SMP_IDLE_THREAD
43 select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS 44 select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index d3d7e64ca96d..66cf00095b84 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -20,7 +20,6 @@ endif
20KBUILD_AFLAGS += $(call cc-option,-mno-fdpic) 20KBUILD_AFLAGS += $(call cc-option,-mno-fdpic)
21KBUILD_CFLAGS_MODULE += -mlong-calls 21KBUILD_CFLAGS_MODULE += -mlong-calls
22LDFLAGS += -m elf32bfin 22LDFLAGS += -m elf32bfin
23KALLSYMS += --symbol-prefix=_
24 23
25KBUILD_DEFCONFIG := BF537-STAMP_defconfig 24KBUILD_DEFCONFIG := BF537-STAMP_defconfig
26 25
diff --git a/arch/blackfin/include/asm/smp.h b/arch/blackfin/include/asm/smp.h
index dc3d144b4bb5..9631598dcc5d 100644
--- a/arch/blackfin/include/asm/smp.h
+++ b/arch/blackfin/include/asm/smp.h
@@ -18,6 +18,8 @@
18#define raw_smp_processor_id() blackfin_core_id() 18#define raw_smp_processor_id() blackfin_core_id()
19 19
20extern void bfin_relocate_coreb_l1_mem(void); 20extern void bfin_relocate_coreb_l1_mem(void);
21extern void arch_send_call_function_single_ipi(int cpu);
22extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
21 23
22#if defined(CONFIG_SMP) && defined(CONFIG_ICACHE_FLUSH_L1) 24#if defined(CONFIG_SMP) && defined(CONFIG_ICACHE_FLUSH_L1)
23asmlinkage void blackfin_icache_flush_range_l1(unsigned long *ptr); 25asmlinkage void blackfin_icache_flush_range_l1(unsigned long *ptr);
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c
index 00bbe672b3b3..a40151306b77 100644
--- a/arch/blackfin/mach-common/smp.c
+++ b/arch/blackfin/mach-common/smp.c
@@ -48,10 +48,13 @@ unsigned long blackfin_iflush_l1_entry[NR_CPUS];
48 48
49struct blackfin_initial_pda __cpuinitdata initial_pda_coreb; 49struct blackfin_initial_pda __cpuinitdata initial_pda_coreb;
50 50
51#define BFIN_IPI_TIMER 0 51enum ipi_message_type {
52#define BFIN_IPI_RESCHEDULE 1 52 BFIN_IPI_TIMER,
53#define BFIN_IPI_CALL_FUNC 2 53 BFIN_IPI_RESCHEDULE,
54#define BFIN_IPI_CPU_STOP 3 54 BFIN_IPI_CALL_FUNC,
55 BFIN_IPI_CALL_FUNC_SINGLE,
56 BFIN_IPI_CPU_STOP,
57};
55 58
56struct blackfin_flush_data { 59struct blackfin_flush_data {
57 unsigned long start; 60 unsigned long start;
@@ -60,35 +63,20 @@ struct blackfin_flush_data {
60 63
61void *secondary_stack; 64void *secondary_stack;
62 65
63
64struct smp_call_struct {
65 void (*func)(void *info);
66 void *info;
67 int wait;
68 cpumask_t *waitmask;
69};
70
71static struct blackfin_flush_data smp_flush_data; 66static struct blackfin_flush_data smp_flush_data;
72 67
73static DEFINE_SPINLOCK(stop_lock); 68static DEFINE_SPINLOCK(stop_lock);
74 69
75struct ipi_message {
76 unsigned long type;
77 struct smp_call_struct call_struct;
78};
79
80/* A magic number - stress test shows this is safe for common cases */ 70/* A magic number - stress test shows this is safe for common cases */
81#define BFIN_IPI_MSGQ_LEN 5 71#define BFIN_IPI_MSGQ_LEN 5
82 72
83/* Simple FIFO buffer, overflow leads to panic */ 73/* Simple FIFO buffer, overflow leads to panic */
84struct ipi_message_queue { 74struct ipi_data {
85 spinlock_t lock;
86 unsigned long count; 75 unsigned long count;
87 unsigned long head; /* head of the queue */ 76 unsigned long bits;
88 struct ipi_message ipi_message[BFIN_IPI_MSGQ_LEN];
89}; 77};
90 78
91static DEFINE_PER_CPU(struct ipi_message_queue, ipi_msg_queue); 79static DEFINE_PER_CPU(struct ipi_data, bfin_ipi);
92 80
93static void ipi_cpu_stop(unsigned int cpu) 81static void ipi_cpu_stop(unsigned int cpu)
94{ 82{
@@ -129,28 +117,6 @@ static void ipi_flush_icache(void *info)
129 blackfin_icache_flush_range(fdata->start, fdata->end); 117 blackfin_icache_flush_range(fdata->start, fdata->end);
130} 118}
131 119
132static void ipi_call_function(unsigned int cpu, struct ipi_message *msg)
133{
134 int wait;
135 void (*func)(void *info);
136 void *info;
137 func = msg->call_struct.func;
138 info = msg->call_struct.info;
139 wait = msg->call_struct.wait;
140 func(info);
141 if (wait) {
142#ifdef __ARCH_SYNC_CORE_DCACHE
143 /*
144 * 'wait' usually means synchronization between CPUs.
145 * Invalidate D cache in case shared data was changed
146 * by func() to ensure cache coherence.
147 */
148 resync_core_dcache();
149#endif
150 cpumask_clear_cpu(cpu, msg->call_struct.waitmask);
151 }
152}
153
154/* Use IRQ_SUPPLE_0 to request reschedule. 120/* Use IRQ_SUPPLE_0 to request reschedule.
155 * When returning from interrupt to user space, 121 * When returning from interrupt to user space,
156 * there is chance to reschedule */ 122 * there is chance to reschedule */
@@ -172,152 +138,95 @@ void ipi_timer(void)
172 138
173static irqreturn_t ipi_handler_int1(int irq, void *dev_instance) 139static irqreturn_t ipi_handler_int1(int irq, void *dev_instance)
174{ 140{
175 struct ipi_message *msg; 141 struct ipi_data *bfin_ipi_data;
176 struct ipi_message_queue *msg_queue;
177 unsigned int cpu = smp_processor_id(); 142 unsigned int cpu = smp_processor_id();
178 unsigned long flags; 143 unsigned long pending;
144 unsigned long msg;
179 145
180 platform_clear_ipi(cpu, IRQ_SUPPLE_1); 146 platform_clear_ipi(cpu, IRQ_SUPPLE_1);
181 147
182 msg_queue = &__get_cpu_var(ipi_msg_queue); 148 bfin_ipi_data = &__get_cpu_var(bfin_ipi);
183 149
184 spin_lock_irqsave(&msg_queue->lock, flags); 150 while ((pending = xchg(&bfin_ipi_data->bits, 0)) != 0) {
185 151 msg = 0;
186 while (msg_queue->count) { 152 do {
187 msg = &msg_queue->ipi_message[msg_queue->head]; 153 msg = find_next_bit(&pending, BITS_PER_LONG, msg + 1);
188 switch (msg->type) { 154 switch (msg) {
189 case BFIN_IPI_TIMER: 155 case BFIN_IPI_TIMER:
190 ipi_timer(); 156 ipi_timer();
191 break; 157 break;
192 case BFIN_IPI_RESCHEDULE: 158 case BFIN_IPI_RESCHEDULE:
193 scheduler_ipi(); 159 scheduler_ipi();
194 break; 160 break;
195 case BFIN_IPI_CALL_FUNC: 161 case BFIN_IPI_CALL_FUNC:
196 ipi_call_function(cpu, msg); 162 generic_smp_call_function_interrupt();
197 break; 163 break;
198 case BFIN_IPI_CPU_STOP: 164
199 ipi_cpu_stop(cpu); 165 case BFIN_IPI_CALL_FUNC_SINGLE:
200 break; 166 generic_smp_call_function_single_interrupt();
201 default: 167 break;
202 printk(KERN_CRIT "CPU%u: Unknown IPI message 0x%lx\n", 168
203 cpu, msg->type); 169 case BFIN_IPI_CPU_STOP:
204 break; 170 ipi_cpu_stop(cpu);
205 } 171 break;
206 msg_queue->head++; 172 }
207 msg_queue->head %= BFIN_IPI_MSGQ_LEN; 173 } while (msg < BITS_PER_LONG);
208 msg_queue->count--; 174
175 smp_mb();
209 } 176 }
210 spin_unlock_irqrestore(&msg_queue->lock, flags);
211 return IRQ_HANDLED; 177 return IRQ_HANDLED;
212} 178}
213 179
214static void ipi_queue_init(void) 180static void bfin_ipi_init(void)
215{ 181{
216 unsigned int cpu; 182 unsigned int cpu;
217 struct ipi_message_queue *msg_queue; 183 struct ipi_data *bfin_ipi_data;
218 for_each_possible_cpu(cpu) { 184 for_each_possible_cpu(cpu) {
219 msg_queue = &per_cpu(ipi_msg_queue, cpu); 185 bfin_ipi_data = &per_cpu(bfin_ipi, cpu);
220 spin_lock_init(&msg_queue->lock); 186 bfin_ipi_data->bits = 0;
221 msg_queue->count = 0; 187 bfin_ipi_data->count = 0;
222 msg_queue->head = 0;
223 } 188 }
224} 189}
225 190
226static inline void smp_send_message(cpumask_t callmap, unsigned long type, 191void send_ipi(const struct cpumask *cpumask, enum ipi_message_type msg)
227 void (*func) (void *info), void *info, int wait)
228{ 192{
229 unsigned int cpu; 193 unsigned int cpu;
230 struct ipi_message_queue *msg_queue; 194 struct ipi_data *bfin_ipi_data;
231 struct ipi_message *msg; 195 unsigned long flags;
232 unsigned long flags, next_msg; 196
233 cpumask_t waitmask; /* waitmask is shared by all cpus */ 197 local_irq_save(flags);
234 198
235 cpumask_copy(&waitmask, &callmap); 199 for_each_cpu(cpu, cpumask) {
236 for_each_cpu(cpu, &callmap) { 200 bfin_ipi_data = &per_cpu(bfin_ipi, cpu);
237 msg_queue = &per_cpu(ipi_msg_queue, cpu); 201 smp_mb();
238 spin_lock_irqsave(&msg_queue->lock, flags); 202 set_bit(msg, &bfin_ipi_data->bits);
239 if (msg_queue->count < BFIN_IPI_MSGQ_LEN) { 203 bfin_ipi_data->count++;
240 next_msg = (msg_queue->head + msg_queue->count)
241 % BFIN_IPI_MSGQ_LEN;
242 msg = &msg_queue->ipi_message[next_msg];
243 msg->type = type;
244 if (type == BFIN_IPI_CALL_FUNC) {
245 msg->call_struct.func = func;
246 msg->call_struct.info = info;
247 msg->call_struct.wait = wait;
248 msg->call_struct.waitmask = &waitmask;
249 }
250 msg_queue->count++;
251 } else
252 panic("IPI message queue overflow\n");
253 spin_unlock_irqrestore(&msg_queue->lock, flags);
254 platform_send_ipi_cpu(cpu, IRQ_SUPPLE_1); 204 platform_send_ipi_cpu(cpu, IRQ_SUPPLE_1);
255 } 205 }
256 206
257 if (wait) { 207 local_irq_restore(flags);
258 while (!cpumask_empty(&waitmask))
259 blackfin_dcache_invalidate_range(
260 (unsigned long)(&waitmask),
261 (unsigned long)(&waitmask));
262#ifdef __ARCH_SYNC_CORE_DCACHE
263 /*
264 * Invalidate D cache in case shared data was changed by
265 * other processors to ensure cache coherence.
266 */
267 resync_core_dcache();
268#endif
269 }
270} 208}
271 209
272int smp_call_function(void (*func)(void *info), void *info, int wait) 210void arch_send_call_function_single_ipi(int cpu)
273{ 211{
274 cpumask_t callmap; 212 send_ipi(cpumask_of(cpu), BFIN_IPI_CALL_FUNC_SINGLE);
275
276 preempt_disable();
277 cpumask_copy(&callmap, cpu_online_mask);
278 cpumask_clear_cpu(smp_processor_id(), &callmap);
279 if (!cpumask_empty(&callmap))
280 smp_send_message(callmap, BFIN_IPI_CALL_FUNC, func, info, wait);
281
282 preempt_enable();
283
284 return 0;
285} 213}
286EXPORT_SYMBOL_GPL(smp_call_function);
287 214
288int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, 215void arch_send_call_function_ipi_mask(const struct cpumask *mask)
289 int wait)
290{ 216{
291 unsigned int cpu = cpuid; 217 send_ipi(mask, BFIN_IPI_CALL_FUNC);
292 cpumask_t callmap;
293
294 if (cpu_is_offline(cpu))
295 return 0;
296 cpumask_clear(&callmap);
297 cpumask_set_cpu(cpu, &callmap);
298
299 smp_send_message(callmap, BFIN_IPI_CALL_FUNC, func, info, wait);
300
301 return 0;
302} 218}
303EXPORT_SYMBOL_GPL(smp_call_function_single);
304 219
305void smp_send_reschedule(int cpu) 220void smp_send_reschedule(int cpu)
306{ 221{
307 cpumask_t callmap; 222 send_ipi(cpumask_of(cpu), BFIN_IPI_RESCHEDULE);
308 /* simply trigger an ipi */
309
310 cpumask_clear(&callmap);
311 cpumask_set_cpu(cpu, &callmap);
312
313 smp_send_message(callmap, BFIN_IPI_RESCHEDULE, NULL, NULL, 0);
314 223
315 return; 224 return;
316} 225}
317 226
318void smp_send_msg(const struct cpumask *mask, unsigned long type) 227void smp_send_msg(const struct cpumask *mask, unsigned long type)
319{ 228{
320 smp_send_message(*mask, type, NULL, NULL, 0); 229 send_ipi(mask, type);
321} 230}
322 231
323void smp_timer_broadcast(const struct cpumask *mask) 232void smp_timer_broadcast(const struct cpumask *mask)
@@ -333,7 +242,7 @@ void smp_send_stop(void)
333 cpumask_copy(&callmap, cpu_online_mask); 242 cpumask_copy(&callmap, cpu_online_mask);
334 cpumask_clear_cpu(smp_processor_id(), &callmap); 243 cpumask_clear_cpu(smp_processor_id(), &callmap);
335 if (!cpumask_empty(&callmap)) 244 if (!cpumask_empty(&callmap))
336 smp_send_message(callmap, BFIN_IPI_CPU_STOP, NULL, NULL, 0); 245 send_ipi(&callmap, BFIN_IPI_CPU_STOP);
337 246
338 preempt_enable(); 247 preempt_enable();
339 248
@@ -436,7 +345,7 @@ void __init smp_prepare_boot_cpu(void)
436void __init smp_prepare_cpus(unsigned int max_cpus) 345void __init smp_prepare_cpus(unsigned int max_cpus)
437{ 346{
438 platform_prepare_cpus(max_cpus); 347 platform_prepare_cpus(max_cpus);
439 ipi_queue_init(); 348 bfin_ipi_init();
440 platform_request_ipi(IRQ_SUPPLE_0, ipi_handler_int0); 349 platform_request_ipi(IRQ_SUPPLE_0, ipi_handler_int0);
441 platform_request_ipi(IRQ_SUPPLE_1, ipi_handler_int1); 350 platform_request_ipi(IRQ_SUPPLE_1, ipi_handler_int1);
442} 351}
diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c
index a1e9d69a9c90..584b93674ea4 100644
--- a/arch/s390/oprofile/init.c
+++ b/arch/s390/oprofile/init.c
@@ -169,7 +169,7 @@ static ssize_t hw_interval_write(struct file *file, char const __user *buf,
169 if (*offset) 169 if (*offset)
170 return -EINVAL; 170 return -EINVAL;
171 retval = oprofilefs_ulong_from_user(&val, buf, count); 171 retval = oprofilefs_ulong_from_user(&val, buf, count);
172 if (retval) 172 if (retval <= 0)
173 return retval; 173 return retval;
174 if (val < oprofile_min_interval) 174 if (val < oprofile_min_interval)
175 oprofile_hw_interval = oprofile_min_interval; 175 oprofile_hw_interval = oprofile_min_interval;
@@ -212,7 +212,7 @@ static ssize_t hwsampler_zero_write(struct file *file, char const __user *buf,
212 return -EINVAL; 212 return -EINVAL;
213 213
214 retval = oprofilefs_ulong_from_user(&val, buf, count); 214 retval = oprofilefs_ulong_from_user(&val, buf, count);
215 if (retval) 215 if (retval <= 0)
216 return retval; 216 return retval;
217 if (val != 0) 217 if (val != 0)
218 return -EINVAL; 218 return -EINVAL;
@@ -243,7 +243,7 @@ static ssize_t hwsampler_kernel_write(struct file *file, char const __user *buf,
243 return -EINVAL; 243 return -EINVAL;
244 244
245 retval = oprofilefs_ulong_from_user(&val, buf, count); 245 retval = oprofilefs_ulong_from_user(&val, buf, count);
246 if (retval) 246 if (retval <= 0)
247 return retval; 247 return retval;
248 248
249 if (val != 0 && val != 1) 249 if (val != 0 && val != 1)
@@ -278,7 +278,7 @@ static ssize_t hwsampler_user_write(struct file *file, char const __user *buf,
278 return -EINVAL; 278 return -EINVAL;
279 279
280 retval = oprofilefs_ulong_from_user(&val, buf, count); 280 retval = oprofilefs_ulong_from_user(&val, buf, count);
281 if (retval) 281 if (retval <= 0)
282 return retval; 282 return retval;
283 283
284 if (val != 0 && val != 1) 284 if (val != 0 && val != 1)
@@ -317,7 +317,7 @@ static ssize_t timer_enabled_write(struct file *file, char const __user *buf,
317 return -EINVAL; 317 return -EINVAL;
318 318
319 retval = oprofilefs_ulong_from_user(&val, buf, count); 319 retval = oprofilefs_ulong_from_user(&val, buf, count);
320 if (retval) 320 if (retval <= 0)
321 return retval; 321 return retval;
322 322
323 if (val != 0 && val != 1) 323 if (val != 0 && val != 1)
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 7f2739e03e79..0d3d63afa76a 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -2008,6 +2008,7 @@ __init int intel_pmu_init(void)
2008 break; 2008 break;
2009 2009
2010 case 28: /* Atom */ 2010 case 28: /* Atom */
2011 case 54: /* Cedariew */
2011 memcpy(hw_cache_event_ids, atom_hw_cache_event_ids, 2012 memcpy(hw_cache_event_ids, atom_hw_cache_event_ids,
2012 sizeof(hw_cache_event_ids)); 2013 sizeof(hw_cache_event_ids));
2013 2014
diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
index 520b4265fcd2..da02e9cc3754 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
@@ -686,7 +686,8 @@ void intel_pmu_lbr_init_atom(void)
686 * to have an operational LBR which can freeze 686 * to have an operational LBR which can freeze
687 * on PMU interrupt 687 * on PMU interrupt
688 */ 688 */
689 if (boot_cpu_data.x86_mask < 10) { 689 if (boot_cpu_data.x86_model == 28
690 && boot_cpu_data.x86_mask < 10) {
690 pr_cont("LBR disabled due to erratum"); 691 pr_cont("LBR disabled due to erratum");
691 return; 692 return;
692 } 693 }
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index 4873e62db6a1..9e5bcf1e2376 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -225,6 +225,9 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,
225 if (do_microcode_update(buf, len) == 0) 225 if (do_microcode_update(buf, len) == 0)
226 ret = (ssize_t)len; 226 ret = (ssize_t)len;
227 227
228 if (ret > 0)
229 perf_check_microcode();
230
228 mutex_unlock(&microcode_mutex); 231 mutex_unlock(&microcode_mutex);
229 put_online_cpus(); 232 put_online_cpus();
230 233
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index e498b18f010c..9fc9aa7ac703 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -318,7 +318,7 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val)
318 if (val & 0x10) { 318 if (val & 0x10) {
319 u8 edge_irr = s->irr & ~s->elcr; 319 u8 edge_irr = s->irr & ~s->elcr;
320 int i; 320 int i;
321 bool found; 321 bool found = false;
322 struct kvm_vcpu *vcpu; 322 struct kvm_vcpu *vcpu;
323 323
324 s->init4 = val & 1; 324 s->init4 = val & 1;
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index c00f03de1b79..b1eb202ee76a 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3619,6 +3619,7 @@ static void seg_setup(int seg)
3619 3619
3620static int alloc_apic_access_page(struct kvm *kvm) 3620static int alloc_apic_access_page(struct kvm *kvm)
3621{ 3621{
3622 struct page *page;
3622 struct kvm_userspace_memory_region kvm_userspace_mem; 3623 struct kvm_userspace_memory_region kvm_userspace_mem;
3623 int r = 0; 3624 int r = 0;
3624 3625
@@ -3633,7 +3634,13 @@ static int alloc_apic_access_page(struct kvm *kvm)
3633 if (r) 3634 if (r)
3634 goto out; 3635 goto out;
3635 3636
3636 kvm->arch.apic_access_page = gfn_to_page(kvm, 0xfee00); 3637 page = gfn_to_page(kvm, 0xfee00);
3638 if (is_error_page(page)) {
3639 r = -EFAULT;
3640 goto out;
3641 }
3642
3643 kvm->arch.apic_access_page = page;
3637out: 3644out:
3638 mutex_unlock(&kvm->slots_lock); 3645 mutex_unlock(&kvm->slots_lock);
3639 return r; 3646 return r;
@@ -3641,6 +3648,7 @@ out:
3641 3648
3642static int alloc_identity_pagetable(struct kvm *kvm) 3649static int alloc_identity_pagetable(struct kvm *kvm)
3643{ 3650{
3651 struct page *page;
3644 struct kvm_userspace_memory_region kvm_userspace_mem; 3652 struct kvm_userspace_memory_region kvm_userspace_mem;
3645 int r = 0; 3653 int r = 0;
3646 3654
@@ -3656,8 +3664,13 @@ static int alloc_identity_pagetable(struct kvm *kvm)
3656 if (r) 3664 if (r)
3657 goto out; 3665 goto out;
3658 3666
3659 kvm->arch.ept_identity_pagetable = gfn_to_page(kvm, 3667 page = gfn_to_page(kvm, kvm->arch.ept_identity_map_addr >> PAGE_SHIFT);
3660 kvm->arch.ept_identity_map_addr >> PAGE_SHIFT); 3668 if (is_error_page(page)) {
3669 r = -EFAULT;
3670 goto out;
3671 }
3672
3673 kvm->arch.ept_identity_pagetable = page;
3661out: 3674out:
3662 mutex_unlock(&kvm->slots_lock); 3675 mutex_unlock(&kvm->slots_lock);
3663 return r; 3676 return r;
@@ -6575,7 +6588,7 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu)
6575 /* Exposing INVPCID only when PCID is exposed */ 6588 /* Exposing INVPCID only when PCID is exposed */
6576 best = kvm_find_cpuid_entry(vcpu, 0x7, 0); 6589 best = kvm_find_cpuid_entry(vcpu, 0x7, 0);
6577 if (vmx_invpcid_supported() && 6590 if (vmx_invpcid_supported() &&
6578 best && (best->ecx & bit(X86_FEATURE_INVPCID)) && 6591 best && (best->ebx & bit(X86_FEATURE_INVPCID)) &&
6579 guest_cpuid_has_pcid(vcpu)) { 6592 guest_cpuid_has_pcid(vcpu)) {
6580 exec_control |= SECONDARY_EXEC_ENABLE_INVPCID; 6593 exec_control |= SECONDARY_EXEC_ENABLE_INVPCID;
6581 vmcs_write32(SECONDARY_VM_EXEC_CONTROL, 6594 vmcs_write32(SECONDARY_VM_EXEC_CONTROL,
@@ -6585,7 +6598,7 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu)
6585 vmcs_write32(SECONDARY_VM_EXEC_CONTROL, 6598 vmcs_write32(SECONDARY_VM_EXEC_CONTROL,
6586 exec_control); 6599 exec_control);
6587 if (best) 6600 if (best)
6588 best->ecx &= ~bit(X86_FEATURE_INVPCID); 6601 best->ebx &= ~bit(X86_FEATURE_INVPCID);
6589 } 6602 }
6590} 6603}
6591 6604
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 148ed666e311..2966c847d489 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5113,17 +5113,20 @@ static void post_kvm_run_save(struct kvm_vcpu *vcpu)
5113 !kvm_event_needs_reinjection(vcpu); 5113 !kvm_event_needs_reinjection(vcpu);
5114} 5114}
5115 5115
5116static void vapic_enter(struct kvm_vcpu *vcpu) 5116static int vapic_enter(struct kvm_vcpu *vcpu)
5117{ 5117{
5118 struct kvm_lapic *apic = vcpu->arch.apic; 5118 struct kvm_lapic *apic = vcpu->arch.apic;
5119 struct page *page; 5119 struct page *page;
5120 5120
5121 if (!apic || !apic->vapic_addr) 5121 if (!apic || !apic->vapic_addr)
5122 return; 5122 return 0;
5123 5123
5124 page = gfn_to_page(vcpu->kvm, apic->vapic_addr >> PAGE_SHIFT); 5124 page = gfn_to_page(vcpu->kvm, apic->vapic_addr >> PAGE_SHIFT);
5125 if (is_error_page(page))
5126 return -EFAULT;
5125 5127
5126 vcpu->arch.apic->vapic_page = page; 5128 vcpu->arch.apic->vapic_page = page;
5129 return 0;
5127} 5130}
5128 5131
5129static void vapic_exit(struct kvm_vcpu *vcpu) 5132static void vapic_exit(struct kvm_vcpu *vcpu)
@@ -5430,7 +5433,11 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
5430 } 5433 }
5431 5434
5432 vcpu->srcu_idx = srcu_read_lock(&kvm->srcu); 5435 vcpu->srcu_idx = srcu_read_lock(&kvm->srcu);
5433 vapic_enter(vcpu); 5436 r = vapic_enter(vcpu);
5437 if (r) {
5438 srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);
5439 return r;
5440 }
5434 5441
5435 r = 1; 5442 r = 1;
5436 while (r > 0) { 5443 while (r > 0) {