Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: sa11x0/pxa: convert OS timer registers to IOMEM

Make the OS timer registers have IOMEM like properities so they can
be passed to readl_relaxed/writel_relaxed() et.al. rather than being
straight volatile dereferences. Add linux/io.h includes where
required.

linux/io.h includes added to arch/arm/mach-sa1100/cpu-sa1100.c,
arch/arm/mach-sa1100/jornada720_ssp.c, arch/arm/mach-sa1100/leds-lart.c
drivers/input/touchscreen/jornada720_ts.c, drivers/pcmcia/sa1100_shannon.c
from Arnd.

This fixes these warnings:

arch/arm/mach-sa1100/time.c: In function 'sa1100_timer_init':
arch/arm/mach-sa1100/time.c:104: warning: passing argument 1 of 'clocksource_mmio_init' discards qualifiers from pointer target type
arch/arm/mach-pxa/time.c: In function 'pxa_timer_init':
arch/arm/mach-pxa/time.c:126: warning: passing argument 1 of 'clocksource_mmio_init' discards qualifiers from pointer target type

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

+97 -82
+11 -11
arch/arm/mach-pxa/include/mach/regs-ost.h
··· 7 7 * OS Timer & Match Registers 8 8 */ 9 9 10 - #define OSMR0 __REG(0x40A00000) /* */ 11 - #define OSMR1 __REG(0x40A00004) /* */ 12 - #define OSMR2 __REG(0x40A00008) /* */ 13 - #define OSMR3 __REG(0x40A0000C) /* */ 14 - #define OSMR4 __REG(0x40A00080) /* */ 15 - #define OSCR __REG(0x40A00010) /* OS Timer Counter Register */ 16 - #define OSCR4 __REG(0x40A00040) /* OS Timer Counter Register */ 17 - #define OMCR4 __REG(0x40A000C0) /* */ 18 - #define OSSR __REG(0x40A00014) /* OS Timer Status Register */ 19 - #define OWER __REG(0x40A00018) /* OS Timer Watchdog Enable Register */ 20 - #define OIER __REG(0x40A0001C) /* OS Timer Interrupt Enable Register */ 10 + #define OSMR0 io_p2v(0x40A00000) /* */ 11 + #define OSMR1 io_p2v(0x40A00004) /* */ 12 + #define OSMR2 io_p2v(0x40A00008) /* */ 13 + #define OSMR3 io_p2v(0x40A0000C) /* */ 14 + #define OSMR4 io_p2v(0x40A00080) /* */ 15 + #define OSCR io_p2v(0x40A00010) /* OS Timer Counter Register */ 16 + #define OSCR4 io_p2v(0x40A00040) /* OS Timer Counter Register */ 17 + #define OMCR4 io_p2v(0x40A000C0) /* */ 18 + #define OSSR io_p2v(0x40A00014) /* OS Timer Status Register */ 19 + #define OWER io_p2v(0x40A00018) /* OS Timer Watchdog Enable Register */ 20 + #define OIER io_p2v(0x40A0001C) /* OS Timer Interrupt Enable Register */ 21 21 22 22 #define OSSR_M3 (1 << 3) /* Match status channel 3 */ 23 23 #define OSSR_M2 (1 << 2) /* Match status channel 2 */
+4 -3
arch/arm/mach-pxa/reset.c
··· 77 77 static void do_hw_reset(void) 78 78 { 79 79 /* Initialize the watchdog and let it fire */ 80 - OWER = OWER_WME; 81 - OSSR = OSSR_M3; 82 - OSMR3 = OSCR + 368640; /* ... in 100 ms */ 80 + writel_relaxed(OWER_WME, OWER); 81 + writel_relaxed(OSSR_M3, OSSR); 82 + /* ... in 100 ms */ 83 + writel_relaxed(readl_relaxed(OSCR) + 368640, OSMR3); 83 84 } 84 85 85 86 void pxa_restart(char mode, const char *cmd)
+26 -26
arch/arm/mach-pxa/time.c
··· 35 35 36 36 static u32 notrace pxa_read_sched_clock(void) 37 37 { 38 - return OSCR; 38 + return readl_relaxed(OSCR); 39 39 } 40 40 41 41 ··· 47 47 struct clock_event_device *c = dev_id; 48 48 49 49 /* Disarm the compare/match, signal the event. */ 50 - OIER &= ~OIER_E0; 51 - OSSR = OSSR_M0; 50 + writel_relaxed(readl_relaxed(OIER) & ~OIER_E0, OIER); 51 + writel_relaxed(OSSR_M0, OSSR); 52 52 c->event_handler(c); 53 53 54 54 return IRQ_HANDLED; ··· 59 59 { 60 60 unsigned long next, oscr; 61 61 62 - OIER |= OIER_E0; 63 - next = OSCR + delta; 64 - OSMR0 = next; 65 - oscr = OSCR; 62 + writel_relaxed(readl_relaxed(OIER) | OIER_E0, OIER); 63 + next = readl_relaxed(OSCR) + delta; 64 + writel_relaxed(next, OSMR0); 65 + oscr = readl_relaxed(OSCR); 66 66 67 67 return (signed)(next - oscr) <= MIN_OSCR_DELTA ? -ETIME : 0; 68 68 } ··· 72 72 { 73 73 switch (mode) { 74 74 case CLOCK_EVT_MODE_ONESHOT: 75 - OIER &= ~OIER_E0; 76 - OSSR = OSSR_M0; 75 + writel_relaxed(readl_relaxed(OIER) & ~OIER_E0, OIER); 76 + writel_relaxed(OSSR_M0, OSSR); 77 77 break; 78 78 79 79 case CLOCK_EVT_MODE_UNUSED: 80 80 case CLOCK_EVT_MODE_SHUTDOWN: 81 81 /* initializing, released, or preparing for suspend */ 82 - OIER &= ~OIER_E0; 83 - OSSR = OSSR_M0; 82 + writel_relaxed(readl_relaxed(OIER) & ~OIER_E0, OIER); 83 + writel_relaxed(OSSR_M0, OSSR); 84 84 break; 85 85 86 86 case CLOCK_EVT_MODE_RESUME: ··· 108 108 { 109 109 unsigned long clock_tick_rate = get_clock_tick_rate(); 110 110 111 - OIER = 0; 112 - OSSR = OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3; 111 + writel_relaxed(0, OIER); 112 + writel_relaxed(OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3, OSSR); 113 113 114 114 setup_sched_clock(pxa_read_sched_clock, 32, clock_tick_rate); 115 115 ··· 122 122 123 123 setup_irq(IRQ_OST0, &pxa_ost0_irq); 124 124 125 - clocksource_mmio_init(&OSCR, "oscr0", clock_tick_rate, 200, 32, 125 + clocksource_mmio_init(OSCR, "oscr0", clock_tick_rate, 200, 32, 126 126 clocksource_mmio_readl_up); 127 127 clockevents_register_device(&ckevt_pxa_osmr0); 128 128 } ··· 132 132 133 133 static void pxa_timer_suspend(void) 134 134 { 135 - osmr[0] = OSMR0; 136 - osmr[1] = OSMR1; 137 - osmr[2] = OSMR2; 138 - osmr[3] = OSMR3; 139 - oier = OIER; 140 - oscr = OSCR; 135 + osmr[0] = readl_relaxed(OSMR0); 136 + osmr[1] = readl_relaxed(OSMR1); 137 + osmr[2] = readl_relaxed(OSMR2); 138 + osmr[3] = readl_relaxed(OSMR3); 139 + oier = readl_relaxed(OIER); 140 + oscr = readl_relaxed(OSCR); 141 141 } 142 142 143 143 static void pxa_timer_resume(void) ··· 151 151 if (osmr[0] - oscr < MIN_OSCR_DELTA) 152 152 osmr[0] += MIN_OSCR_DELTA; 153 153 154 - OSMR0 = osmr[0]; 155 - OSMR1 = osmr[1]; 156 - OSMR2 = osmr[2]; 157 - OSMR3 = osmr[3]; 158 - OIER = oier; 159 - OSCR = oscr; 154 + writel_relaxed(osmr[0], OSMR0); 155 + writel_relaxed(osmr[1], OSMR1); 156 + writel_relaxed(osmr[2], OSMR2); 157 + writel_relaxed(osmr[3], OSMR3); 158 + writel_relaxed(oier, OIER); 159 + writel_relaxed(oscr, OSCR); 160 160 } 161 161 #else 162 162 #define pxa_timer_suspend NULL
+1 -1
arch/arm/mach-sa1100/assabet.c
··· 362 362 static void __init map_sa1100_gpio_regs( void ) 363 363 { 364 364 unsigned long phys = __PREG(GPLR) & PMD_MASK; 365 - unsigned long virt = io_p2v(phys); 365 + unsigned long virt = (unsigned long)io_p2v(phys); 366 366 int prot = PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_DOMAIN(DOMAIN_IO); 367 367 pmd_t *pmd; 368 368
+1
arch/arm/mach-sa1100/cpu-sa1100.c
··· 87 87 #include <linux/types.h> 88 88 #include <linux/init.h> 89 89 #include <linux/cpufreq.h> 90 + #include <linux/io.h> 90 91 91 92 #include <asm/cputype.h> 92 93
+1
arch/arm/mach-sa1100/cpu-sa1110.c
··· 19 19 #include <linux/cpufreq.h> 20 20 #include <linux/delay.h> 21 21 #include <linux/init.h> 22 + #include <linux/io.h> 22 23 #include <linux/kernel.h> 23 24 #include <linux/moduleparam.h> 24 25 #include <linux/types.h>
+8 -8
arch/arm/mach-sa1100/include/mach/SA-1100.h
··· 830 830 * (read/write). 831 831 */ 832 832 833 - #define OSMR0 __REG(0x90000000) /* OS timer Match Reg. 0 */ 834 - #define OSMR1 __REG(0x90000004) /* OS timer Match Reg. 1 */ 835 - #define OSMR2 __REG(0x90000008) /* OS timer Match Reg. 2 */ 836 - #define OSMR3 __REG(0x9000000c) /* OS timer Match Reg. 3 */ 837 - #define OSCR __REG(0x90000010) /* OS timer Counter Reg. */ 838 - #define OSSR __REG(0x90000014 ) /* OS timer Status Reg. */ 839 - #define OWER __REG(0x90000018 ) /* OS timer Watch-dog Enable Reg. */ 840 - #define OIER __REG(0x9000001C ) /* OS timer Interrupt Enable Reg. */ 833 + #define OSMR0 io_p2v(0x90000000) /* OS timer Match Reg. 0 */ 834 + #define OSMR1 io_p2v(0x90000004) /* OS timer Match Reg. 1 */ 835 + #define OSMR2 io_p2v(0x90000008) /* OS timer Match Reg. 2 */ 836 + #define OSMR3 io_p2v(0x9000000c) /* OS timer Match Reg. 3 */ 837 + #define OSCR io_p2v(0x90000010) /* OS timer Counter Reg. */ 838 + #define OSSR io_p2v(0x90000014) /* OS timer Status Reg. */ 839 + #define OWER io_p2v(0x90000018) /* OS timer Watch-dog Enable Reg. */ 840 + #define OIER io_p2v(0x9000001C) /* OS timer Interrupt Enable Reg. */ 841 841 842 842 #define OSSR_M(Nb) /* Match detected [0..3] */ \ 843 843 (0x00000001 << (Nb))
+1
arch/arm/mach-sa1100/include/mach/gpio.h
··· 24 24 #ifndef __ASM_ARCH_SA1100_GPIO_H 25 25 #define __ASM_ARCH_SA1100_GPIO_H 26 26 27 + #include <linux/io.h> 27 28 #include <mach/hardware.h> 28 29 #include <asm/irq.h> 29 30 #include <asm-generic/gpio.h>
+4 -2
arch/arm/mach-sa1100/include/mach/hardware.h
··· 32 32 #define PIO_START 0x80000000 /* physical start of IO space */ 33 33 34 34 #define io_p2v( x ) \ 35 - ( (((x)&0x00ffffff) | (((x)&0x30000000)>>VIO_SHIFT)) + VIO_BASE ) 35 + IOMEM( (((x)&0x00ffffff) | (((x)&0x30000000)>>VIO_SHIFT)) + VIO_BASE ) 36 36 #define io_v2p( x ) \ 37 37 ( (((x)&0x00ffffff) | (((x)&(0x30000000>>VIO_SHIFT))<<VIO_SHIFT)) + PIO_START ) 38 38 ··· 47 47 #define CPU_SA1110_ID (0x6901b110) 48 48 #define CPU_SA1110_MASK (0xfffffff0) 49 49 50 + #define __MREG(x) IOMEM(io_p2v(x)) 51 + 50 52 #ifndef __ASSEMBLY__ 51 53 52 54 #include <asm/cputype.h> ··· 58 56 #define cpu_is_sa1100() ((read_cpuid_id() & CPU_SA1100_MASK) == CPU_SA1100_ID) 59 57 #define cpu_is_sa1110() ((read_cpuid_id() & CPU_SA1110_MASK) == CPU_SA1110_ID) 60 58 61 - # define __REG(x) (*((volatile unsigned long *)io_p2v(x))) 59 + # define __REG(x) (*((volatile unsigned long __iomem *)io_p2v(x))) 62 60 # define __PREG(x) (io_v2p((unsigned long)&(x))) 63 61 64 62 static inline unsigned long get_clock_tick_rate(void)
+2
arch/arm/mach-sa1100/include/mach/uncompress.h
··· 8 8 9 9 #include "hardware.h" 10 10 11 + #define IOMEM(x) (x) 12 + 11 13 /* 12 14 * The following code assumes the serial port has already been 13 15 * initialized by the bootloader. We search for the first enabled
+1
arch/arm/mach-sa1100/irq.c
··· 12 12 #include <linux/init.h> 13 13 #include <linux/module.h> 14 14 #include <linux/interrupt.h> 15 + #include <linux/io.h> 15 16 #include <linux/irq.h> 16 17 #include <linux/ioport.h> 17 18 #include <linux/syscore_ops.h>
+1
arch/arm/mach-sa1100/jornada720_ssp.c
··· 18 18 #include <linux/module.h> 19 19 #include <linux/platform_device.h> 20 20 #include <linux/sched.h> 21 + #include <linux/io.h> 21 22 22 23 #include <mach/hardware.h> 23 24 #include <mach/jornada720.h>
+1
arch/arm/mach-sa1100/leds-cerf.c
··· 4 4 * Author: ??? 5 5 */ 6 6 #include <linux/init.h> 7 + #include <linux/io.h> 7 8 8 9 #include <mach/hardware.h> 9 10 #include <asm/leds.h>
+1
arch/arm/mach-sa1100/leds-lart.c
··· 10 10 * pace of the LED. 11 11 */ 12 12 #include <linux/init.h> 13 + #include <linux/io.h> 13 14 14 15 #include <mach/hardware.h> 15 16 #include <asm/leds.h>
+1
arch/arm/mach-sa1100/pm.c
··· 23 23 * Storage is local on the stack now. 24 24 */ 25 25 #include <linux/init.h> 26 + #include <linux/io.h> 26 27 #include <linux/suspend.h> 27 28 #include <linux/errno.h> 28 29 #include <linux/time.h>
+24 -24
arch/arm/mach-sa1100/time.c
··· 22 22 23 23 static u32 notrace sa1100_read_sched_clock(void) 24 24 { 25 - return OSCR; 25 + return readl_relaxed(OSCR); 26 26 } 27 27 28 28 #define MIN_OSCR_DELTA 2 ··· 32 32 struct clock_event_device *c = dev_id; 33 33 34 34 /* Disarm the compare/match, signal the event. */ 35 - OIER &= ~OIER_E0; 36 - OSSR = OSSR_M0; 35 + writel_relaxed(readl_relaxed(OIER) & ~OIER_E0, OIER); 36 + writel_relaxed(OSSR_M0, OSSR); 37 37 c->event_handler(c); 38 38 39 39 return IRQ_HANDLED; ··· 44 44 { 45 45 unsigned long next, oscr; 46 46 47 - OIER |= OIER_E0; 48 - next = OSCR + delta; 49 - OSMR0 = next; 50 - oscr = OSCR; 47 + writel_relaxed(readl_relaxed(OIER) | OIER_E0, OIER); 48 + next = readl_relaxed(OSCR) + delta; 49 + writel_relaxed(next, OSMR0); 50 + oscr = readl_relaxed(OSCR); 51 51 52 52 return (signed)(next - oscr) <= MIN_OSCR_DELTA ? -ETIME : 0; 53 53 } ··· 59 59 case CLOCK_EVT_MODE_ONESHOT: 60 60 case CLOCK_EVT_MODE_UNUSED: 61 61 case CLOCK_EVT_MODE_SHUTDOWN: 62 - OIER &= ~OIER_E0; 63 - OSSR = OSSR_M0; 62 + writel_relaxed(readl_relaxed(OIER) & ~OIER_E0, OIER); 63 + writel_relaxed(OSSR_M0, OSSR); 64 64 break; 65 65 66 66 case CLOCK_EVT_MODE_RESUME: ··· 86 86 87 87 static void __init sa1100_timer_init(void) 88 88 { 89 - OIER = 0; 90 - OSSR = OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3; 89 + writel_relaxed(0, OIER); 90 + writel_relaxed(OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3, OSSR); 91 91 92 92 setup_sched_clock(sa1100_read_sched_clock, 32, 3686400); 93 93 ··· 100 100 101 101 setup_irq(IRQ_OST0, &sa1100_timer_irq); 102 102 103 - clocksource_mmio_init(&OSCR, "oscr", CLOCK_TICK_RATE, 200, 32, 103 + clocksource_mmio_init(OSCR, "oscr", CLOCK_TICK_RATE, 200, 32, 104 104 clocksource_mmio_readl_up); 105 105 clockevents_register_device(&ckevt_sa1100_osmr0); 106 106 } ··· 110 110 111 111 static void sa1100_timer_suspend(void) 112 112 { 113 - osmr[0] = OSMR0; 114 - osmr[1] = OSMR1; 115 - osmr[2] = OSMR2; 116 - osmr[3] = OSMR3; 117 - oier = OIER; 113 + osmr[0] = readl_relaxed(OSMR0); 114 + osmr[1] = readl_relaxed(OSMR1); 115 + osmr[2] = readl_relaxed(OSMR2); 116 + osmr[3] = readl_relaxed(OSMR3); 117 + oier = readl_relaxed(OIER); 118 118 } 119 119 120 120 static void sa1100_timer_resume(void) 121 121 { 122 - OSSR = 0x0f; 123 - OSMR0 = osmr[0]; 124 - OSMR1 = osmr[1]; 125 - OSMR2 = osmr[2]; 126 - OSMR3 = osmr[3]; 127 - OIER = oier; 122 + writel_relaxed(0x0f, OSSR); 123 + writel_relaxed(osmr[0], OSMR0); 124 + writel_relaxed(osmr[1], OSMR1); 125 + writel_relaxed(osmr[2], OSMR2); 126 + writel_relaxed(osmr[3], OSMR3); 127 + writel_relaxed(oier, OIER); 128 128 129 129 /* 130 130 * OSMR0 is the system timer: make sure OSCR is sufficiently behind 131 131 */ 132 - OSCR = OSMR0 - LATCH; 132 + writel_relaxed(OSMR0 - LATCH, OSCR); 133 133 } 134 134 #else 135 135 #define sa1100_timer_suspend NULL
+1
drivers/input/touchscreen/jornada720_ts.c
··· 19 19 #include <linux/interrupt.h> 20 20 #include <linux/module.h> 21 21 #include <linux/slab.h> 22 + #include <linux/io.h> 22 23 23 24 #include <mach/hardware.h> 24 25 #include <mach/jornada720.h>
+1
drivers/pcmcia/sa1100_shannon.c
··· 8 8 #include <linux/kernel.h> 9 9 #include <linux/device.h> 10 10 #include <linux/init.h> 11 + #include <linux/io.h> 11 12 12 13 #include <mach/hardware.h> 13 14 #include <asm/mach-types.h>
+7 -7
drivers/watchdog/sa1100_wdt.c
··· 54 54 return -EBUSY; 55 55 56 56 /* Activate SA1100 Watchdog timer */ 57 - OSMR3 = OSCR + pre_margin; 58 - OSSR = OSSR_M3; 59 - OWER = OWER_WME; 60 - OIER |= OIER_E3; 57 + writel_relaxed(readl_relaxed(OSCR) + pre_margin, OSMR3); 58 + writel_relaxed(OSSR_M3, OSSR); 59 + writel_relaxed(OWER_WME, OWER); 60 + writel_relaxed(readl_relaxed(OIER) | OIER_E3, OIER); 61 61 return nonseekable_open(inode, file); 62 62 } 63 63 ··· 80 80 { 81 81 if (len) 82 82 /* Refresh OSMR3 timer. */ 83 - OSMR3 = OSCR + pre_margin; 83 + writel_relaxed(readl_relaxed(OSCR) + pre_margin, OSMR3); 84 84 return len; 85 85 } 86 86 ··· 114 114 break; 115 115 116 116 case WDIOC_KEEPALIVE: 117 - OSMR3 = OSCR + pre_margin; 117 + writel_relaxed(readl_relaxed(OSCR) + pre_margin, OSMR3); 118 118 ret = 0; 119 119 break; 120 120 ··· 129 129 } 130 130 131 131 pre_margin = oscr_freq * time; 132 - OSMR3 = OSCR + pre_margin; 132 + writel_relaxed(readl_relaxed(OSCR) + pre_margin, OSMR3); 133 133 /*fall through*/ 134 134 135 135 case WDIOC_GETTIMEOUT: