diff options
| author | Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> | 2007-09-30 15:36:33 -0400 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2007-10-12 18:43:41 -0400 |
| commit | 361c7ad607bc0e84ef0fef8c3f11c47b33c06e41 (patch) | |
| tree | eb4d73ce8fec23d402ce5da05f3394ada0dbb9ed | |
| parent | c54ecb2481d464d50520ce60cf36011b68d1e89a (diff) | |
[ARM] 4595/1: ns9xxx: define registers as void __iomem * instead of volatile u32
As a consequence registers are now accessed with __raw_{read,write}[bl].
Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
| -rw-r--r-- | arch/arm/mach-ns9xxx/board-a9m9750dev.c | 49 | ||||
| -rw-r--r-- | arch/arm/mach-ns9xxx/gpio.c | 44 | ||||
| -rw-r--r-- | arch/arm/mach-ns9xxx/irq.c | 17 | ||||
| -rw-r--r-- | arch/arm/mach-ns9xxx/time.c | 36 | ||||
| -rw-r--r-- | include/asm-arm/arch-ns9xxx/clock.h | 2 | ||||
| -rw-r--r-- | include/asm-arm/arch-ns9xxx/hardware.h | 10 | ||||
| -rw-r--r-- | include/asm-arm/arch-ns9xxx/regs-board-a9m9750dev.h | 4 | ||||
| -rw-r--r-- | include/asm-arm/arch-ns9xxx/system.h | 4 |
8 files changed, 92 insertions, 74 deletions
diff --git a/arch/arm/mach-ns9xxx/board-a9m9750dev.c b/arch/arm/mach-ns9xxx/board-a9m9750dev.c index 7fa3fb1f08ef..0f65177f9e5f 100644 --- a/arch/arm/mach-ns9xxx/board-a9m9750dev.c +++ b/arch/arm/mach-ns9xxx/board-a9m9750dev.c | |||
| @@ -45,7 +45,13 @@ static void a9m9750dev_fpga_ack_irq(unsigned int irq) | |||
| 45 | 45 | ||
| 46 | static void a9m9750dev_fpga_mask_irq(unsigned int irq) | 46 | static void a9m9750dev_fpga_mask_irq(unsigned int irq) |
| 47 | { | 47 | { |
| 48 | FPGA_IER &= ~(1 << (irq - FPGA_IRQ(0))); | 48 | u8 ier; |
| 49 | |||
| 50 | ier = __raw_readb(FPGA_IER); | ||
| 51 | |||
| 52 | ier &= ~(1 << (irq - FPGA_IRQ(0))); | ||
| 53 | |||
| 54 | __raw_writeb(ier, FPGA_IER); | ||
| 49 | } | 55 | } |
| 50 | 56 | ||
| 51 | static void a9m9750dev_fpga_maskack_irq(unsigned int irq) | 57 | static void a9m9750dev_fpga_maskack_irq(unsigned int irq) |
| @@ -56,7 +62,13 @@ static void a9m9750dev_fpga_maskack_irq(unsigned int irq) | |||
| 56 | 62 | ||
| 57 | static void a9m9750dev_fpga_unmask_irq(unsigned int irq) | 63 | static void a9m9750dev_fpga_unmask_irq(unsigned int irq) |
| 58 | { | 64 | { |
| 59 | FPGA_IER |= 1 << (irq - FPGA_IRQ(0)); | 65 | u8 ier; |
| 66 | |||
| 67 | ier = __raw_readb(FPGA_IER); | ||
| 68 | |||
| 69 | ier |= 1 << (irq - FPGA_IRQ(0)); | ||
| 70 | |||
| 71 | __raw_writeb(ier, FPGA_IER); | ||
| 60 | } | 72 | } |
| 61 | 73 | ||
| 62 | static struct irq_chip a9m9750dev_fpga_chip = { | 74 | static struct irq_chip a9m9750dev_fpga_chip = { |
| @@ -69,7 +81,7 @@ static struct irq_chip a9m9750dev_fpga_chip = { | |||
| 69 | static void a9m9750dev_fpga_demux_handler(unsigned int irq, | 81 | static void a9m9750dev_fpga_demux_handler(unsigned int irq, |
| 70 | struct irq_desc *desc) | 82 | struct irq_desc *desc) |
| 71 | { | 83 | { |
| 72 | int stat = FPGA_ISR; | 84 | u8 stat = __raw_readb(FPGA_ISR); |
| 73 | 85 | ||
| 74 | desc->chip->mask_ack(irq); | 86 | desc->chip->mask_ack(irq); |
| 75 | 87 | ||
| @@ -89,7 +101,7 @@ static void a9m9750dev_fpga_demux_handler(unsigned int irq, | |||
| 89 | 101 | ||
| 90 | void __init board_a9m9750dev_init_irq(void) | 102 | void __init board_a9m9750dev_init_irq(void) |
| 91 | { | 103 | { |
| 92 | u32 reg; | 104 | u32 eic; |
| 93 | int i; | 105 | int i; |
| 94 | 106 | ||
| 95 | if (gpio_request(11, "board a9m9750dev extirq2") == 0) | 107 | if (gpio_request(11, "board a9m9750dev extirq2") == 0) |
| @@ -105,10 +117,10 @@ void __init board_a9m9750dev_init_irq(void) | |||
| 105 | } | 117 | } |
| 106 | 118 | ||
| 107 | /* IRQ_EXT2: level sensitive + active low */ | 119 | /* IRQ_EXT2: level sensitive + active low */ |
| 108 | reg = SYS_EIC(2); | 120 | eic = __raw_readl(SYS_EIC(2)); |
| 109 | REGSET(reg, SYS_EIC, PLTY, AL); | 121 | REGSET(eic, SYS_EIC, PLTY, AL); |
| 110 | REGSET(reg, SYS_EIC, LVEDG, LEVEL); | 122 | REGSET(eic, SYS_EIC, LVEDG, LEVEL); |
| 111 | SYS_EIC(2) = reg; | 123 | __raw_writel(eic, SYS_EIC(2)); |
| 112 | 124 | ||
| 113 | set_irq_chained_handler(IRQ_EXT2, | 125 | set_irq_chained_handler(IRQ_EXT2, |
| 114 | a9m9750dev_fpga_demux_handler); | 126 | a9m9750dev_fpga_demux_handler); |
| @@ -172,17 +184,18 @@ void __init board_a9m9750dev_init_machine(void) | |||
| 172 | u32 reg; | 184 | u32 reg; |
| 173 | 185 | ||
| 174 | /* setup static CS0: memory base ... */ | 186 | /* setup static CS0: memory base ... */ |
| 175 | REGSETIM(SYS_SMCSSMB(0), SYS_SMCSSMB, CSxB, | 187 | reg = __raw_readl(SYS_SMCSSMB(0)); |
| 176 | NS9XXX_CSxSTAT_PHYS(0) >> 12); | 188 | REGSETIM(reg, SYS_SMCSSMB, CSxB, NS9XXX_CSxSTAT_PHYS(0) >> 12); |
| 189 | __raw_writel(reg, SYS_SMCSSMB(0)); | ||
| 177 | 190 | ||
| 178 | /* ... and mask */ | 191 | /* ... and mask */ |
| 179 | reg = SYS_SMCSSMM(0); | 192 | reg = __raw_readl(SYS_SMCSSMM(0)); |
| 180 | REGSETIM(reg, SYS_SMCSSMM, CSxM, 0xfffff); | 193 | REGSETIM(reg, SYS_SMCSSMM, CSxM, 0xfffff); |
| 181 | REGSET(reg, SYS_SMCSSMM, CSEx, EN); | 194 | REGSET(reg, SYS_SMCSSMM, CSEx, EN); |
| 182 | SYS_SMCSSMM(0) = reg; | 195 | __raw_writel(reg, SYS_SMCSSMM(0)); |
| 183 | 196 | ||
| 184 | /* setup static CS0: memory configuration */ | 197 | /* setup static CS0: memory configuration */ |
| 185 | reg = MEM_SMC(0); | 198 | reg = __raw_readl(MEM_SMC(0)); |
| 186 | REGSET(reg, MEM_SMC, PSMC, OFF); | 199 | REGSET(reg, MEM_SMC, PSMC, OFF); |
| 187 | REGSET(reg, MEM_SMC, BSMC, OFF); | 200 | REGSET(reg, MEM_SMC, BSMC, OFF); |
| 188 | REGSET(reg, MEM_SMC, EW, OFF); | 201 | REGSET(reg, MEM_SMC, EW, OFF); |
| @@ -190,13 +203,13 @@ void __init board_a9m9750dev_init_machine(void) | |||
| 190 | REGSET(reg, MEM_SMC, PC, AL); | 203 | REGSET(reg, MEM_SMC, PC, AL); |
| 191 | REGSET(reg, MEM_SMC, PM, DIS); | 204 | REGSET(reg, MEM_SMC, PM, DIS); |
| 192 | REGSET(reg, MEM_SMC, MW, 8); | 205 | REGSET(reg, MEM_SMC, MW, 8); |
| 193 | MEM_SMC(0) = reg; | 206 | __raw_writel(reg, MEM_SMC(0)); |
| 194 | 207 | ||
| 195 | /* setup static CS0: timing */ | 208 | /* setup static CS0: timing */ |
| 196 | MEM_SMWED(0) = 0x2; | 209 | __raw_writel(0x2, MEM_SMWED(0)); |
| 197 | MEM_SMOED(0) = 0x2; | 210 | __raw_writel(0x2, MEM_SMOED(0)); |
| 198 | MEM_SMRD(0) = 0x6; | 211 | __raw_writel(0x6, MEM_SMRD(0)); |
| 199 | MEM_SMWD(0) = 0x6; | 212 | __raw_writel(0x6, MEM_SMWD(0)); |
| 200 | 213 | ||
| 201 | platform_add_devices(board_a9m9750dev_devices, | 214 | platform_add_devices(board_a9m9750dev_devices, |
| 202 | ARRAY_SIZE(board_a9m9750dev_devices)); | 215 | ARRAY_SIZE(board_a9m9750dev_devices)); |
diff --git a/arch/arm/mach-ns9xxx/gpio.c b/arch/arm/mach-ns9xxx/gpio.c index 87b872fdca7e..b2230213b983 100644 --- a/arch/arm/mach-ns9xxx/gpio.c +++ b/arch/arm/mach-ns9xxx/gpio.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <asm/arch-ns9xxx/gpio.h> | 16 | #include <asm/arch-ns9xxx/gpio.h> |
| 17 | #include <asm/arch-ns9xxx/processor.h> | 17 | #include <asm/arch-ns9xxx/processor.h> |
| 18 | #include <asm/arch-ns9xxx/regs-bbu.h> | 18 | #include <asm/arch-ns9xxx/regs-bbu.h> |
| 19 | #include <asm/io.h> | ||
| 19 | #include <asm/bug.h> | 20 | #include <asm/bug.h> |
| 20 | #include <asm/types.h> | 21 | #include <asm/types.h> |
| 21 | #include <asm/bitops.h> | 22 | #include <asm/bitops.h> |
| @@ -47,38 +48,38 @@ static inline int ns9xxx_valid_gpio(unsigned gpio) | |||
| 47 | BUG(); | 48 | BUG(); |
| 48 | } | 49 | } |
| 49 | 50 | ||
| 50 | static inline volatile u32 *ns9xxx_gpio_get_gconfaddr(unsigned gpio) | 51 | static inline void __iomem *ns9xxx_gpio_get_gconfaddr(unsigned gpio) |
| 51 | { | 52 | { |
| 52 | if (gpio < 56) | 53 | if (gpio < 56) |
| 53 | return &BBU_GCONFb1(gpio / 8); | 54 | return BBU_GCONFb1(gpio / 8); |
| 54 | else | 55 | else |
| 55 | /* | 56 | /* |
| 56 | * this could be optimised away on | 57 | * this could be optimised away on |
| 57 | * ns9750 only builds, but it isn't ... | 58 | * ns9750 only builds, but it isn't ... |
| 58 | */ | 59 | */ |
| 59 | return &BBU_GCONFb2((gpio - 56) / 8); | 60 | return BBU_GCONFb2((gpio - 56) / 8); |
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | static inline volatile u32 *ns9xxx_gpio_get_gctrladdr(unsigned gpio) | 63 | static inline void __iomem *ns9xxx_gpio_get_gctrladdr(unsigned gpio) |
| 63 | { | 64 | { |
| 64 | if (gpio < 32) | 65 | if (gpio < 32) |
| 65 | return &BBU_GCTRL1; | 66 | return BBU_GCTRL1; |
| 66 | else if (gpio < 64) | 67 | else if (gpio < 64) |
| 67 | return &BBU_GCTRL2; | 68 | return BBU_GCTRL2; |
| 68 | else | 69 | else |
| 69 | /* this could be optimised away on ns9750 only builds */ | 70 | /* this could be optimised away on ns9750 only builds */ |
| 70 | return &BBU_GCTRL3; | 71 | return BBU_GCTRL3; |
| 71 | } | 72 | } |
| 72 | 73 | ||
| 73 | static inline volatile u32 *ns9xxx_gpio_get_gstataddr(unsigned gpio) | 74 | static inline void __iomem *ns9xxx_gpio_get_gstataddr(unsigned gpio) |
| 74 | { | 75 | { |
| 75 | if (gpio < 32) | 76 | if (gpio < 32) |
| 76 | return &BBU_GSTAT1; | 77 | return BBU_GSTAT1; |
| 77 | else if (gpio < 64) | 78 | else if (gpio < 64) |
| 78 | return &BBU_GSTAT2; | 79 | return BBU_GSTAT2; |
| 79 | else | 80 | else |
| 80 | /* this could be optimised away on ns9750 only builds */ | 81 | /* this could be optimised away on ns9750 only builds */ |
| 81 | return &BBU_GSTAT3; | 82 | return BBU_GSTAT3; |
| 82 | } | 83 | } |
| 83 | 84 | ||
| 84 | int gpio_request(unsigned gpio, const char *label) | 85 | int gpio_request(unsigned gpio, const char *label) |
| @@ -105,17 +106,17 @@ EXPORT_SYMBOL(gpio_free); | |||
| 105 | */ | 106 | */ |
| 106 | static int __ns9xxx_gpio_configure(unsigned gpio, int dir, int inv, int func) | 107 | static int __ns9xxx_gpio_configure(unsigned gpio, int dir, int inv, int func) |
| 107 | { | 108 | { |
| 108 | volatile u32 *conf = ns9xxx_gpio_get_gconfaddr(gpio); | 109 | void __iomem *conf = ns9xxx_gpio_get_gconfaddr(gpio); |
| 109 | u32 confval; | 110 | u32 confval; |
| 110 | unsigned long flags; | 111 | unsigned long flags; |
| 111 | 112 | ||
| 112 | spin_lock_irqsave(&gpio_lock, flags); | 113 | spin_lock_irqsave(&gpio_lock, flags); |
| 113 | 114 | ||
| 114 | confval = *conf; | 115 | confval = __raw_readl(conf); |
| 115 | REGSETIM_IDX(confval, BBU_GCONFx, DIR, gpio & 7, dir); | 116 | REGSETIM_IDX(confval, BBU_GCONFx, DIR, gpio & 7, dir); |
| 116 | REGSETIM_IDX(confval, BBU_GCONFx, INV, gpio & 7, inv); | 117 | REGSETIM_IDX(confval, BBU_GCONFx, INV, gpio & 7, inv); |
| 117 | REGSETIM_IDX(confval, BBU_GCONFx, FUNC, gpio & 7, func); | 118 | REGSETIM_IDX(confval, BBU_GCONFx, FUNC, gpio & 7, func); |
| 118 | *conf = confval; | 119 | __raw_writel(confval, conf); |
| 119 | 120 | ||
| 120 | spin_unlock_irqrestore(&gpio_lock, flags); | 121 | spin_unlock_irqrestore(&gpio_lock, flags); |
| 121 | 122 | ||
| @@ -158,10 +159,10 @@ EXPORT_SYMBOL(gpio_direction_output); | |||
| 158 | 159 | ||
| 159 | int gpio_get_value(unsigned gpio) | 160 | int gpio_get_value(unsigned gpio) |
| 160 | { | 161 | { |
| 161 | volatile u32 *stat = ns9xxx_gpio_get_gstataddr(gpio); | 162 | void __iomem *stat = ns9xxx_gpio_get_gstataddr(gpio); |
| 162 | int ret; | 163 | int ret; |
| 163 | 164 | ||
| 164 | ret = 1 & (*stat >> (gpio & 31)); | 165 | ret = 1 & (__raw_readl(stat) >> (gpio & 31)); |
| 165 | 166 | ||
| 166 | return ret; | 167 | return ret; |
| 167 | } | 168 | } |
| @@ -169,15 +170,20 @@ EXPORT_SYMBOL(gpio_get_value); | |||
| 169 | 170 | ||
| 170 | void gpio_set_value(unsigned gpio, int value) | 171 | void gpio_set_value(unsigned gpio, int value) |
| 171 | { | 172 | { |
| 172 | volatile u32 *ctrl = ns9xxx_gpio_get_gctrladdr(gpio); | 173 | void __iomem *ctrl = ns9xxx_gpio_get_gctrladdr(gpio); |
| 174 | u32 ctrlval; | ||
| 173 | unsigned long flags; | 175 | unsigned long flags; |
| 174 | 176 | ||
| 175 | spin_lock_irqsave(&gpio_lock, flags); | 177 | spin_lock_irqsave(&gpio_lock, flags); |
| 176 | 178 | ||
| 179 | ctrlval = __raw_readl(ctrl); | ||
| 180 | |||
| 177 | if (value) | 181 | if (value) |
| 178 | *ctrl |= 1 << (gpio & 31); | 182 | ctrlval |= 1 << (gpio & 31); |
| 179 | else | 183 | else |
| 180 | *ctrl &= ~(1 << (gpio & 31)); | 184 | ctrlval &= ~(1 << (gpio & 31)); |
| 185 | |||
| 186 | __raw_writel(ctrlval, ctrl); | ||
| 181 | 187 | ||
| 182 | spin_unlock_irqrestore(&gpio_lock, flags); | 188 | spin_unlock_irqrestore(&gpio_lock, flags); |
| 183 | } | 189 | } |
diff --git a/arch/arm/mach-ns9xxx/irq.c b/arch/arm/mach-ns9xxx/irq.c index 24d424e10e4c..00001b874e97 100644 --- a/arch/arm/mach-ns9xxx/irq.c +++ b/arch/arm/mach-ns9xxx/irq.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | * the Free Software Foundation. | 9 | * the Free Software Foundation. |
| 10 | */ | 10 | */ |
| 11 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
| 12 | #include <asm/io.h> | ||
| 12 | #include <asm/mach/irq.h> | 13 | #include <asm/mach/irq.h> |
| 13 | #include <asm/mach-types.h> | 14 | #include <asm/mach-types.h> |
| 14 | #include <asm/arch-ns9xxx/regs-sys.h> | 15 | #include <asm/arch-ns9xxx/regs-sys.h> |
| @@ -20,12 +21,14 @@ | |||
| 20 | static void ns9xxx_mask_irq(unsigned int irq) | 21 | static void ns9xxx_mask_irq(unsigned int irq) |
| 21 | { | 22 | { |
| 22 | /* XXX: better use cpp symbols */ | 23 | /* XXX: better use cpp symbols */ |
| 23 | SYS_IC(irq / 4) &= ~(1 << (7 + 8 * (3 - (irq & 3)))); | 24 | u32 ic = __raw_readl(SYS_IC(irq / 4)); |
| 25 | ic &= ~(1 << (7 + 8 * (3 - (irq & 3)))); | ||
| 26 | __raw_writel(ic, SYS_IC(irq / 4)); | ||
| 24 | } | 27 | } |
| 25 | 28 | ||
| 26 | static void ns9xxx_ack_irq(unsigned int irq) | 29 | static void ns9xxx_ack_irq(unsigned int irq) |
| 27 | { | 30 | { |
| 28 | SYS_ISRADDR = 0; | 31 | __raw_writel(0, SYS_ISRADDR); |
| 29 | } | 32 | } |
| 30 | 33 | ||
| 31 | static void ns9xxx_maskack_irq(unsigned int irq) | 34 | static void ns9xxx_maskack_irq(unsigned int irq) |
| @@ -37,7 +40,9 @@ static void ns9xxx_maskack_irq(unsigned int irq) | |||
| 37 | static void ns9xxx_unmask_irq(unsigned int irq) | 40 | static void ns9xxx_unmask_irq(unsigned int irq) |
| 38 | { | 41 | { |
| 39 | /* XXX: better use cpp symbols */ | 42 | /* XXX: better use cpp symbols */ |
| 40 | SYS_IC(irq / 4) |= 1 << (7 + 8 * (3 - (irq & 3))); | 43 | u32 ic = __raw_readl(SYS_IC(irq / 4)); |
| 44 | ic |= 1 << (7 + 8 * (3 - (irq & 3))); | ||
| 45 | __raw_writel(ic, SYS_IC(irq / 4)); | ||
| 41 | } | 46 | } |
| 42 | 47 | ||
| 43 | static struct irq_chip ns9xxx_chip = { | 48 | static struct irq_chip ns9xxx_chip = { |
| @@ -53,14 +58,14 @@ void __init ns9xxx_init_irq(void) | |||
| 53 | 58 | ||
| 54 | /* disable all IRQs */ | 59 | /* disable all IRQs */ |
| 55 | for (i = 0; i < 8; ++i) | 60 | for (i = 0; i < 8; ++i) |
| 56 | SYS_IC(i) = (4 * i) << 24 | (4 * i + 1) << 16 | | 61 | __raw_writel((4 * i) << 24 | (4 * i + 1) << 16 | |
| 57 | (4 * i + 2) << 8 | (4 * i + 3); | 62 | (4 * i + 2) << 8 | (4 * i + 3), SYS_IC(i)); |
| 58 | 63 | ||
| 59 | /* simple interrupt prio table: | 64 | /* simple interrupt prio table: |
| 60 | * prio(x) < prio(y) <=> x < y | 65 | * prio(x) < prio(y) <=> x < y |
| 61 | */ | 66 | */ |
| 62 | for (i = 0; i < 32; ++i) | 67 | for (i = 0; i < 32; ++i) |
| 63 | SYS_IVA(i) = i; | 68 | __raw_writel(i, SYS_IVA(i)); |
| 64 | 69 | ||
| 65 | for (i = IRQ_WATCHDOG; i <= IRQ_EXT3; ++i) { | 70 | for (i = IRQ_WATCHDOG; i <= IRQ_EXT3; ++i) { |
| 66 | set_irq_chip(i, &ns9xxx_chip); | 71 | set_irq_chip(i, &ns9xxx_chip); |
diff --git a/arch/arm/mach-ns9xxx/time.c b/arch/arm/mach-ns9xxx/time.c index 6f295158b168..c3dd1f4acb99 100644 --- a/arch/arm/mach-ns9xxx/time.c +++ b/arch/arm/mach-ns9xxx/time.c | |||
| @@ -27,7 +27,7 @@ static u32 latch; | |||
| 27 | 27 | ||
| 28 | static cycle_t ns9xxx_clocksource_read(void) | 28 | static cycle_t ns9xxx_clocksource_read(void) |
| 29 | { | 29 | { |
| 30 | return SYS_TR(TIMER_CLOCKSOURCE); | 30 | return __raw_readl(SYS_TR(TIMER_CLOCKSOURCE)); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | static struct clocksource ns9xxx_clocksource = { | 33 | static struct clocksource ns9xxx_clocksource = { |
| @@ -42,11 +42,11 @@ static struct clocksource ns9xxx_clocksource = { | |||
| 42 | static void ns9xxx_clockevent_setmode(enum clock_event_mode mode, | 42 | static void ns9xxx_clockevent_setmode(enum clock_event_mode mode, |
| 43 | struct clock_event_device *clk) | 43 | struct clock_event_device *clk) |
| 44 | { | 44 | { |
| 45 | u32 tc = SYS_TC(TIMER_CLOCKEVENT); | 45 | u32 tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT)); |
| 46 | 46 | ||
| 47 | switch(mode) { | 47 | switch(mode) { |
| 48 | case CLOCK_EVT_MODE_PERIODIC: | 48 | case CLOCK_EVT_MODE_PERIODIC: |
| 49 | SYS_TRC(TIMER_CLOCKEVENT) = latch; | 49 | __raw_writel(latch, SYS_TRC(TIMER_CLOCKEVENT)); |
| 50 | REGSET(tc, SYS_TCx, REN, EN); | 50 | REGSET(tc, SYS_TCx, REN, EN); |
| 51 | REGSET(tc, SYS_TCx, INTS, EN); | 51 | REGSET(tc, SYS_TCx, INTS, EN); |
| 52 | REGSET(tc, SYS_TCx, TEN, EN); | 52 | REGSET(tc, SYS_TCx, TEN, EN); |
| @@ -66,24 +66,24 @@ static void ns9xxx_clockevent_setmode(enum clock_event_mode mode, | |||
| 66 | break; | 66 | break; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | SYS_TC(TIMER_CLOCKEVENT) = tc; | 69 | __raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT)); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | static int ns9xxx_clockevent_setnextevent(unsigned long evt, | 72 | static int ns9xxx_clockevent_setnextevent(unsigned long evt, |
| 73 | struct clock_event_device *clk) | 73 | struct clock_event_device *clk) |
| 74 | { | 74 | { |
| 75 | u32 tc = SYS_TC(TIMER_CLOCKEVENT); | 75 | u32 tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT)); |
| 76 | 76 | ||
| 77 | if (REGGET(tc, SYS_TCx, TEN)) { | 77 | if (REGGET(tc, SYS_TCx, TEN)) { |
| 78 | REGSET(tc, SYS_TCx, TEN, DIS); | 78 | REGSET(tc, SYS_TCx, TEN, DIS); |
| 79 | SYS_TC(TIMER_CLOCKEVENT) = tc; | 79 | __raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT)); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | REGSET(tc, SYS_TCx, TEN, EN); | 82 | REGSET(tc, SYS_TCx, TEN, EN); |
| 83 | 83 | ||
| 84 | SYS_TRC(TIMER_CLOCKEVENT) = evt; | 84 | __raw_writel(evt, SYS_TRC(TIMER_CLOCKEVENT)); |
| 85 | 85 | ||
| 86 | SYS_TC(TIMER_CLOCKEVENT) = tc; | 86 | __raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT)); |
| 87 | 87 | ||
| 88 | return 0; | 88 | return 0; |
| 89 | } | 89 | } |
| @@ -104,15 +104,15 @@ static irqreturn_t ns9xxx_clockevent_handler(int irq, void *dev_id) | |||
| 104 | struct clock_event_device *evt = &ns9xxx_clockevent_device; | 104 | struct clock_event_device *evt = &ns9xxx_clockevent_device; |
| 105 | 105 | ||
| 106 | /* clear irq */ | 106 | /* clear irq */ |
| 107 | tc = SYS_TC(timerno); | 107 | tc = __raw_readl(SYS_TC(timerno)); |
| 108 | if (REGGET(tc, SYS_TCx, REN) == SYS_TCx_REN_DIS) { | 108 | if (REGGET(tc, SYS_TCx, REN) == SYS_TCx_REN_DIS) { |
| 109 | REGSET(tc, SYS_TCx, TEN, DIS); | 109 | REGSET(tc, SYS_TCx, TEN, DIS); |
| 110 | SYS_TC(timerno) = tc; | 110 | __raw_writel(tc, SYS_TC(timerno)); |
| 111 | } | 111 | } |
| 112 | REGSET(tc, SYS_TCx, INTC, SET); | 112 | REGSET(tc, SYS_TCx, INTC, SET); |
| 113 | SYS_TC(timerno) = tc; | 113 | __raw_writel(tc, SYS_TC(timerno)); |
| 114 | REGSET(tc, SYS_TCx, INTC, UNSET); | 114 | REGSET(tc, SYS_TCx, INTC, UNSET); |
| 115 | SYS_TC(timerno) = tc; | 115 | __raw_writel(tc, SYS_TC(timerno)); |
| 116 | 116 | ||
| 117 | evt->event_handler(evt); | 117 | evt->event_handler(evt); |
| 118 | 118 | ||
| @@ -129,13 +129,13 @@ static void __init ns9xxx_timer_init(void) | |||
| 129 | { | 129 | { |
| 130 | int tc; | 130 | int tc; |
| 131 | 131 | ||
| 132 | tc = SYS_TC(TIMER_CLOCKSOURCE); | 132 | tc = __raw_readl(SYS_TC(TIMER_CLOCKSOURCE)); |
| 133 | if (REGGET(tc, SYS_TCx, TEN)) { | 133 | if (REGGET(tc, SYS_TCx, TEN)) { |
| 134 | REGSET(tc, SYS_TCx, TEN, DIS); | 134 | REGSET(tc, SYS_TCx, TEN, DIS); |
| 135 | SYS_TC(TIMER_CLOCKSOURCE) = tc; | 135 | __raw_writel(tc, SYS_TC(TIMER_CLOCKSOURCE)); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | SYS_TRC(TIMER_CLOCKSOURCE) = 0; | 138 | __raw_writel(0, SYS_TRC(TIMER_CLOCKSOURCE)); |
| 139 | 139 | ||
| 140 | REGSET(tc, SYS_TCx, TEN, EN); | 140 | REGSET(tc, SYS_TCx, TEN, EN); |
| 141 | REGSET(tc, SYS_TCx, TDBG, STOP); | 141 | REGSET(tc, SYS_TCx, TDBG, STOP); |
| @@ -146,7 +146,7 @@ static void __init ns9xxx_timer_init(void) | |||
| 146 | REGSET(tc, SYS_TCx, TSZ, 32); | 146 | REGSET(tc, SYS_TCx, TSZ, 32); |
| 147 | REGSET(tc, SYS_TCx, REN, EN); | 147 | REGSET(tc, SYS_TCx, REN, EN); |
| 148 | 148 | ||
| 149 | SYS_TC(TIMER_CLOCKSOURCE) = tc; | 149 | __raw_writel(tc, SYS_TC(TIMER_CLOCKSOURCE)); |
| 150 | 150 | ||
| 151 | ns9xxx_clocksource.mult = clocksource_hz2mult(ns9xxx_cpuclock(), | 151 | ns9xxx_clocksource.mult = clocksource_hz2mult(ns9xxx_cpuclock(), |
| 152 | ns9xxx_clocksource.shift); | 152 | ns9xxx_clocksource.shift); |
| @@ -155,7 +155,7 @@ static void __init ns9xxx_timer_init(void) | |||
| 155 | 155 | ||
| 156 | latch = SH_DIV(ns9xxx_cpuclock(), HZ, 0); | 156 | latch = SH_DIV(ns9xxx_cpuclock(), HZ, 0); |
| 157 | 157 | ||
| 158 | tc = SYS_TC(TIMER_CLOCKEVENT); | 158 | tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT)); |
| 159 | REGSET(tc, SYS_TCx, TEN, DIS); | 159 | REGSET(tc, SYS_TCx, TEN, DIS); |
| 160 | REGSET(tc, SYS_TCx, TDBG, STOP); | 160 | REGSET(tc, SYS_TCx, TDBG, STOP); |
| 161 | REGSET(tc, SYS_TCx, TLCS, CPU); | 161 | REGSET(tc, SYS_TCx, TLCS, CPU); |
| @@ -164,7 +164,7 @@ static void __init ns9xxx_timer_init(void) | |||
| 164 | REGSET(tc, SYS_TCx, UDS, DOWN); | 164 | REGSET(tc, SYS_TCx, UDS, DOWN); |
| 165 | REGSET(tc, SYS_TCx, TSZ, 32); | 165 | REGSET(tc, SYS_TCx, TSZ, 32); |
| 166 | REGSET(tc, SYS_TCx, REN, EN); | 166 | REGSET(tc, SYS_TCx, REN, EN); |
| 167 | SYS_TC(TIMER_CLOCKEVENT) = tc; | 167 | __raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT)); |
| 168 | 168 | ||
| 169 | ns9xxx_clockevent_device.mult = div_sc(ns9xxx_cpuclock(), | 169 | ns9xxx_clockevent_device.mult = div_sc(ns9xxx_cpuclock(), |
| 170 | NSEC_PER_SEC, ns9xxx_clockevent_device.shift); | 170 | NSEC_PER_SEC, ns9xxx_clockevent_device.shift); |
diff --git a/include/asm-arm/arch-ns9xxx/clock.h b/include/asm-arm/arch-ns9xxx/clock.h index 90604d48d561..b943d3a92a1d 100644 --- a/include/asm-arm/arch-ns9xxx/clock.h +++ b/include/asm-arm/arch-ns9xxx/clock.h | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | static inline u32 ns9xxx_systemclock(void) __attribute__((const)); | 19 | static inline u32 ns9xxx_systemclock(void) __attribute__((const)); |
| 20 | static inline u32 ns9xxx_systemclock(void) | 20 | static inline u32 ns9xxx_systemclock(void) |
| 21 | { | 21 | { |
| 22 | u32 pll = SYS_PLL; | 22 | u32 pll = __raw_readl(SYS_PLL); |
| 23 | 23 | ||
| 24 | /* | 24 | /* |
| 25 | * The system clock should be a multiple of HZ * TIMERCLOCKSELECT (in | 25 | * The system clock should be a multiple of HZ * TIMERCLOCKSELECT (in |
diff --git a/include/asm-arm/arch-ns9xxx/hardware.h b/include/asm-arm/arch-ns9xxx/hardware.h index b5d66f963981..0b7b34603f1c 100644 --- a/include/asm-arm/arch-ns9xxx/hardware.h +++ b/include/asm-arm/arch-ns9xxx/hardware.h | |||
| @@ -35,11 +35,8 @@ | |||
| 35 | 35 | ||
| 36 | #ifndef __ASSEMBLY__ | 36 | #ifndef __ASSEMBLY__ |
| 37 | 37 | ||
| 38 | # define __REG(x) (*((volatile u32 *)io_p2v((x)))) | 38 | # define __REG(x) ((void __iomem __force *)io_p2v((x))) |
| 39 | # define __REG2(x, y) (*((volatile u32 *)io_p2v((x)) + (y))) | 39 | # define __REG2(x, y) ((void __iomem __force *)(io_p2v((x)) + 4 * (y))) |
| 40 | |||
| 41 | # define __REGB(x) (*((volatile u8 *)io_p2v((x)))) | ||
| 42 | # define __REGB2(x) (*((volatile u8 *)io_p2v((x)) + (y))) | ||
| 43 | 40 | ||
| 44 | # define __REGSET(var, field, value) \ | 41 | # define __REGSET(var, field, value) \ |
| 45 | ((var) = (((var) & ~((field) & ~(value))) | (value))) | 42 | ((var) = (((var) & ~((field) & ~(value))) | (value))) |
| @@ -77,9 +74,6 @@ | |||
| 77 | # define __REG(x) io_p2v(x) | 74 | # define __REG(x) io_p2v(x) |
| 78 | # define __REG2(x, y) io_p2v((x) + (y)) | 75 | # define __REG2(x, y) io_p2v((x) + (y)) |
| 79 | 76 | ||
| 80 | # define __REGB(x) __REG((x)) | ||
| 81 | # define __REGB2(x, y) __REG2((x), (y)) | ||
| 82 | |||
| 83 | #endif | 77 | #endif |
| 84 | 78 | ||
| 85 | #endif /* ifndef __ASM_ARCH_HARDWARE_H */ | 79 | #endif /* ifndef __ASM_ARCH_HARDWARE_H */ |
diff --git a/include/asm-arm/arch-ns9xxx/regs-board-a9m9750dev.h b/include/asm-arm/arch-ns9xxx/regs-board-a9m9750dev.h index c3dc532dd20c..afa3a9db3e1d 100644 --- a/include/asm-arm/arch-ns9xxx/regs-board-a9m9750dev.h +++ b/include/asm-arm/arch-ns9xxx/regs-board-a9m9750dev.h | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | #define FPGA_UARTC_BASE io_p2v(NS9XXX_CSxSTAT_PHYS(0) + 0x10) | 18 | #define FPGA_UARTC_BASE io_p2v(NS9XXX_CSxSTAT_PHYS(0) + 0x10) |
| 19 | #define FPGA_UARTD_BASE io_p2v(NS9XXX_CSxSTAT_PHYS(0) + 0x18) | 19 | #define FPGA_UARTD_BASE io_p2v(NS9XXX_CSxSTAT_PHYS(0) + 0x18) |
| 20 | 20 | ||
| 21 | #define FPGA_IER __REGB(NS9XXX_CSxSTAT_PHYS(0) + 0x50) | 21 | #define FPGA_IER __REG(NS9XXX_CSxSTAT_PHYS(0) + 0x50) |
| 22 | #define FPGA_ISR __REGB(NS9XXX_CSxSTAT_PHYS(0) + 0x60) | 22 | #define FPGA_ISR __REG(NS9XXX_CSxSTAT_PHYS(0) + 0x60) |
| 23 | 23 | ||
| 24 | #endif /* ifndef __ASM_ARCH_REGSBOARDA9M9750_H */ | 24 | #endif /* ifndef __ASM_ARCH_REGSBOARDA9M9750_H */ |
diff --git a/include/asm-arm/arch-ns9xxx/system.h b/include/asm-arm/arch-ns9xxx/system.h index e3cd4d31b3f3..c1082bd8977c 100644 --- a/include/asm-arm/arch-ns9xxx/system.h +++ b/include/asm-arm/arch-ns9xxx/system.h | |||
| @@ -24,9 +24,9 @@ static inline void arch_reset(char mode) | |||
| 24 | { | 24 | { |
| 25 | u32 reg; | 25 | u32 reg; |
| 26 | 26 | ||
| 27 | reg = SYS_PLL >> 16; | 27 | reg = __raw_readl(SYS_PLL) >> 16; |
| 28 | REGSET(reg, SYS_PLL, SWC, YES); | 28 | REGSET(reg, SYS_PLL, SWC, YES); |
| 29 | SYS_PLL = reg; | 29 | __raw_writel(reg, SYS_PLL); |
| 30 | 30 | ||
| 31 | BUG(); | 31 | BUG(); |
| 32 | } | 32 | } |
