diff options
author | GuanXuetao <gxt@mprc.pku.edu.cn> | 2011-02-26 08:21:18 -0500 |
---|---|---|
committer | GuanXuetao <gxt@mprc.pku.edu.cn> | 2011-03-16 21:19:19 -0400 |
commit | e5abf78b57199a417eb01ff922a5ea6ff9e10b61 (patch) | |
tree | 6f72a13d44c0dc8c4d575d84885f5694c16ed1da /arch/unicore32 | |
parent | 4517366d870b89d6fb8c0c90deb6c73d975908af (diff) |
unicore32 io: redefine __REG(x) and re-use readl/writel funcs
-- by advice of Arnd Bergmann
Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/unicore32')
-rw-r--r-- | arch/unicore32/include/asm/gpio.h | 9 | ||||
-rw-r--r-- | arch/unicore32/include/mach/dma.h | 11 | ||||
-rw-r--r-- | arch/unicore32/include/mach/hardware.h | 8 | ||||
-rw-r--r-- | arch/unicore32/kernel/clock.c | 34 | ||||
-rw-r--r-- | arch/unicore32/kernel/dma.c | 15 | ||||
-rw-r--r-- | arch/unicore32/kernel/gpio.c | 12 | ||||
-rw-r--r-- | arch/unicore32/kernel/irq.c | 80 | ||||
-rw-r--r-- | arch/unicore32/kernel/pci.c | 58 | ||||
-rw-r--r-- | arch/unicore32/kernel/process.c | 10 | ||||
-rw-r--r-- | arch/unicore32/kernel/puv3-core.c | 10 | ||||
-rw-r--r-- | arch/unicore32/kernel/rtc.c | 34 | ||||
-rw-r--r-- | arch/unicore32/kernel/time.c | 46 |
12 files changed, 167 insertions, 160 deletions
diff --git a/arch/unicore32/include/asm/gpio.h b/arch/unicore32/include/asm/gpio.h index 3aaa41e9e413..2716f14e3ff6 100644 --- a/arch/unicore32/include/asm/gpio.h +++ b/arch/unicore32/include/asm/gpio.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #ifndef __UNICORE_GPIO_H__ | 13 | #ifndef __UNICORE_GPIO_H__ |
14 | #define __UNICORE_GPIO_H__ | 14 | #define __UNICORE_GPIO_H__ |
15 | 15 | ||
16 | #include <linux/io.h> | ||
16 | #include <asm/irq.h> | 17 | #include <asm/irq.h> |
17 | #include <mach/hardware.h> | 18 | #include <mach/hardware.h> |
18 | #include <asm-generic/gpio.h> | 19 | #include <asm-generic/gpio.h> |
@@ -66,7 +67,7 @@ | |||
66 | static inline int gpio_get_value(unsigned gpio) | 67 | static inline int gpio_get_value(unsigned gpio) |
67 | { | 68 | { |
68 | if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX)) | 69 | if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX)) |
69 | return GPIO_GPLR & GPIO_GPIO(gpio); | 70 | return readl(GPIO_GPLR) & GPIO_GPIO(gpio); |
70 | else | 71 | else |
71 | return __gpio_get_value(gpio); | 72 | return __gpio_get_value(gpio); |
72 | } | 73 | } |
@@ -75,9 +76,9 @@ static inline void gpio_set_value(unsigned gpio, int value) | |||
75 | { | 76 | { |
76 | if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX)) | 77 | if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX)) |
77 | if (value) | 78 | if (value) |
78 | GPIO_GPSR = GPIO_GPIO(gpio); | 79 | writel(GPIO_GPIO(gpio), GPIO_GPSR); |
79 | else | 80 | else |
80 | GPIO_GPCR = GPIO_GPIO(gpio); | 81 | writel(GPIO_GPIO(gpio), GPIO_GPCR); |
81 | else | 82 | else |
82 | __gpio_set_value(gpio, value); | 83 | __gpio_set_value(gpio, value); |
83 | } | 84 | } |
@@ -86,7 +87,7 @@ static inline void gpio_set_value(unsigned gpio, int value) | |||
86 | 87 | ||
87 | static inline unsigned gpio_to_irq(unsigned gpio) | 88 | static inline unsigned gpio_to_irq(unsigned gpio) |
88 | { | 89 | { |
89 | if ((gpio < IRQ_GPIOHIGH) && (FIELD(1, 1, gpio) & GPIO_GPIR)) | 90 | if ((gpio < IRQ_GPIOHIGH) && (FIELD(1, 1, gpio) & readl(GPIO_GPIR))) |
90 | return IRQ_GPIOLOW0 + gpio; | 91 | return IRQ_GPIOLOW0 + gpio; |
91 | else | 92 | else |
92 | return IRQ_GPIO0 + gpio; | 93 | return IRQ_GPIO0 + gpio; |
diff --git a/arch/unicore32/include/mach/dma.h b/arch/unicore32/include/mach/dma.h index 3e3224a10525..d655c1b6e083 100644 --- a/arch/unicore32/include/mach/dma.h +++ b/arch/unicore32/include/mach/dma.h | |||
@@ -35,7 +35,14 @@ extern int puv3_request_dma(char *name, | |||
35 | 35 | ||
36 | extern void puv3_free_dma(int dma_ch); | 36 | extern void puv3_free_dma(int dma_ch); |
37 | 37 | ||
38 | #define puv3_stop_dma(ch) (DMAC_CONFIG(ch) &= ~DMAC_CONFIG_EN) | 38 | static inline void puv3_stop_dma(int ch) |
39 | #define puv3_resume_dma(ch) (DMAC_CONFIG(ch) |= DMAC_CONFIG_EN) | 39 | { |
40 | writel(readl(DMAC_CONFIG(ch)) & ~DMAC_CONFIG_EN, DMAC_CONFIG(ch)); | ||
41 | } | ||
42 | |||
43 | static inline void puv3_resume_dma(int ch) | ||
44 | { | ||
45 | writel(readl(DMAC_CONFIG(ch)) | DMAC_CONFIG_EN, DMAC_CONFIG(ch)); | ||
46 | } | ||
40 | 47 | ||
41 | #endif /* __MACH_PUV3_DMA_H__ */ | 48 | #endif /* __MACH_PUV3_DMA_H__ */ |
diff --git a/arch/unicore32/include/mach/hardware.h b/arch/unicore32/include/mach/hardware.h index c7d3dd6b4eff..b71405ab6de6 100644 --- a/arch/unicore32/include/mach/hardware.h +++ b/arch/unicore32/include/mach/hardware.h | |||
@@ -22,13 +22,7 @@ | |||
22 | 22 | ||
23 | #ifndef __ASSEMBLY__ | 23 | #ifndef __ASSEMBLY__ |
24 | 24 | ||
25 | # define __REG(x) (*((volatile unsigned long *)io_p2v(x))) | 25 | # define __REG(x) (void __iomem *)io_p2v(x) |
26 | # define __PREG(x) (io_v2p((unsigned long)&(x))) | ||
27 | |||
28 | #else | ||
29 | |||
30 | # define __REG(x) io_p2v(x) | ||
31 | # define __PREG(x) io_v2p(x) | ||
32 | 26 | ||
33 | #endif | 27 | #endif |
34 | 28 | ||
diff --git a/arch/unicore32/kernel/clock.c b/arch/unicore32/kernel/clock.c index 80323db581fd..18d4563e6fa5 100644 --- a/arch/unicore32/kernel/clock.c +++ b/arch/unicore32/kernel/clock.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
21 | #include <linux/mutex.h> | 21 | #include <linux/mutex.h> |
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/io.h> | ||
23 | 24 | ||
24 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
25 | 26 | ||
@@ -152,28 +153,29 @@ int clk_set_rate(struct clk *clk, unsigned long rate) | |||
152 | if (ret) | 153 | if (ret) |
153 | return ret; | 154 | return ret; |
154 | 155 | ||
155 | if (PM_PLLVGACFG == pll_vgacfg) | 156 | if (readl(PM_PLLVGACFG) == pll_vgacfg) |
156 | return 0; | 157 | return 0; |
157 | 158 | ||
158 | /* set pll vga cfg reg. */ | 159 | /* set pll vga cfg reg. */ |
159 | PM_PLLVGACFG = pll_vgacfg; | 160 | writel(pll_vgacfg, PM_PLLVGACFG); |
160 | 161 | ||
161 | PM_PMCR = PM_PMCR_CFBVGA; | 162 | writel(PM_PMCR_CFBVGA, PM_PMCR); |
162 | while ((PM_PLLDFCDONE & PM_PLLDFCDONE_VGADFC) | 163 | while ((readl(PM_PLLDFCDONE) & PM_PLLDFCDONE_VGADFC) |
163 | != PM_PLLDFCDONE_VGADFC) | 164 | != PM_PLLDFCDONE_VGADFC) |
164 | udelay(100); /* about 1ms */ | 165 | udelay(100); /* about 1ms */ |
165 | 166 | ||
166 | /* set div cfg reg. */ | 167 | /* set div cfg reg. */ |
167 | PM_PCGR |= PM_PCGR_VGACLK; | 168 | writel(readl(PM_PCGR) | PM_PCGR_VGACLK, PM_PCGR); |
168 | 169 | ||
169 | PM_DIVCFG = (PM_DIVCFG & ~PM_DIVCFG_VGACLK_MASK) | 170 | writel((readl(PM_DIVCFG) & ~PM_DIVCFG_VGACLK_MASK) |
170 | | PM_DIVCFG_VGACLK(pll_vgadiv); | 171 | | PM_DIVCFG_VGACLK(pll_vgadiv), PM_DIVCFG); |
171 | 172 | ||
172 | PM_SWRESET |= PM_SWRESET_VGADIV; | 173 | writel(readl(PM_SWRESET) | PM_SWRESET_VGADIV, PM_SWRESET); |
173 | while ((PM_SWRESET & PM_SWRESET_VGADIV) == PM_SWRESET_VGADIV) | 174 | while ((readl(PM_SWRESET) & PM_SWRESET_VGADIV) |
175 | == PM_SWRESET_VGADIV) | ||
174 | udelay(100); /* 65536 bclk32, about 320us */ | 176 | udelay(100); /* 65536 bclk32, about 320us */ |
175 | 177 | ||
176 | PM_PCGR &= ~PM_PCGR_VGACLK; | 178 | writel(readl(PM_PCGR) & ~PM_PCGR_VGACLK, PM_PCGR); |
177 | } | 179 | } |
178 | #ifdef CONFIG_CPU_FREQ | 180 | #ifdef CONFIG_CPU_FREQ |
179 | if (clk == &clk_mclk_clk) { | 181 | if (clk == &clk_mclk_clk) { |
@@ -323,15 +325,15 @@ struct { | |||
323 | static int __init clk_init(void) | 325 | static int __init clk_init(void) |
324 | { | 326 | { |
325 | #ifdef CONFIG_PUV3_PM | 327 | #ifdef CONFIG_PUV3_PM |
326 | u32 pllrate, divstatus = PM_DIVSTATUS; | 328 | u32 pllrate, divstatus = readl(PM_DIVSTATUS); |
327 | u32 pcgr_val = PM_PCGR; | 329 | u32 pcgr_val = readl(PM_PCGR); |
328 | int i; | 330 | int i; |
329 | 331 | ||
330 | pcgr_val |= PM_PCGR_BCLKMME | PM_PCGR_BCLKH264E | PM_PCGR_BCLKH264D | 332 | pcgr_val |= PM_PCGR_BCLKMME | PM_PCGR_BCLKH264E | PM_PCGR_BCLKH264D |
331 | | PM_PCGR_HECLK | PM_PCGR_HDCLK; | 333 | | PM_PCGR_HECLK | PM_PCGR_HDCLK; |
332 | PM_PCGR = pcgr_val; | 334 | writel(pcgr_val, PM_PCGR); |
333 | 335 | ||
334 | pllrate = PM_PLLSYSSTATUS; | 336 | pllrate = readl(PM_PLLSYSSTATUS); |
335 | 337 | ||
336 | /* lookup pmclk_table */ | 338 | /* lookup pmclk_table */ |
337 | clk_mclk_clk.rate = 0; | 339 | clk_mclk_clk.rate = 0; |
@@ -346,7 +348,7 @@ static int __init clk_init(void) | |||
346 | clk_bclk32_clk.rate = clk_mclk_clk.rate / | 348 | clk_bclk32_clk.rate = clk_mclk_clk.rate / |
347 | (((divstatus & 0x0000f000) >> 12) + 1); | 349 | (((divstatus & 0x0000f000) >> 12) + 1); |
348 | 350 | ||
349 | pllrate = PM_PLLDDRSTATUS; | 351 | pllrate = readl(PM_PLLDDRSTATUS); |
350 | 352 | ||
351 | /* lookup pddr_table */ | 353 | /* lookup pddr_table */ |
352 | clk_ddr_clk.rate = 0; | 354 | clk_ddr_clk.rate = 0; |
@@ -357,7 +359,7 @@ static int __init clk_init(void) | |||
357 | } | 359 | } |
358 | } | 360 | } |
359 | 361 | ||
360 | pllrate = PM_PLLVGASTATUS; | 362 | pllrate = readl(PM_PLLVGASTATUS); |
361 | 363 | ||
362 | /* lookup pvga_table */ | 364 | /* lookup pvga_table */ |
363 | clk_vga_clk.rate = 0; | 365 | clk_vga_clk.rate = 0; |
diff --git a/arch/unicore32/kernel/dma.c b/arch/unicore32/kernel/dma.c index b8dcc2514e9a..ae441bc3122c 100644 --- a/arch/unicore32/kernel/dma.c +++ b/arch/unicore32/kernel/dma.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
19 | #include <linux/io.h> | ||
19 | 20 | ||
20 | #include <asm/system.h> | 21 | #include <asm/system.h> |
21 | #include <asm/irq.h> | 22 | #include <asm/irq.h> |
@@ -94,15 +95,16 @@ EXPORT_SYMBOL(puv3_free_dma); | |||
94 | 95 | ||
95 | static irqreturn_t dma_irq_handler(int irq, void *dev_id) | 96 | static irqreturn_t dma_irq_handler(int irq, void *dev_id) |
96 | { | 97 | { |
97 | int i, dint = DMAC_ITCSR; | 98 | int i, dint; |
98 | 99 | ||
100 | dint = readl(DMAC_ITCSR); | ||
99 | for (i = 0; i < MAX_DMA_CHANNELS; i++) { | 101 | for (i = 0; i < MAX_DMA_CHANNELS; i++) { |
100 | if (dint & DMAC_CHANNEL(i)) { | 102 | if (dint & DMAC_CHANNEL(i)) { |
101 | struct dma_channel *channel = &dma_channels[i]; | 103 | struct dma_channel *channel = &dma_channels[i]; |
102 | 104 | ||
103 | /* Clear TC interrupt of channel i */ | 105 | /* Clear TC interrupt of channel i */ |
104 | DMAC_ITCCR = DMAC_CHANNEL(i); | 106 | writel(DMAC_CHANNEL(i), DMAC_ITCCR); |
105 | DMAC_ITCCR = 0; | 107 | writel(0, DMAC_ITCCR); |
106 | 108 | ||
107 | if (channel->name && channel->irq_handler) { | 109 | if (channel->name && channel->irq_handler) { |
108 | channel->irq_handler(i, channel->data); | 110 | channel->irq_handler(i, channel->data); |
@@ -121,15 +123,16 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id) | |||
121 | 123 | ||
122 | static irqreturn_t dma_err_handler(int irq, void *dev_id) | 124 | static irqreturn_t dma_err_handler(int irq, void *dev_id) |
123 | { | 125 | { |
124 | int i, dint = DMAC_IESR; | 126 | int i, dint; |
125 | 127 | ||
128 | dint = readl(DMAC_IESR); | ||
126 | for (i = 0; i < MAX_DMA_CHANNELS; i++) { | 129 | for (i = 0; i < MAX_DMA_CHANNELS; i++) { |
127 | if (dint & DMAC_CHANNEL(i)) { | 130 | if (dint & DMAC_CHANNEL(i)) { |
128 | struct dma_channel *channel = &dma_channels[i]; | 131 | struct dma_channel *channel = &dma_channels[i]; |
129 | 132 | ||
130 | /* Clear Err interrupt of channel i */ | 133 | /* Clear Err interrupt of channel i */ |
131 | DMAC_IECR = DMAC_CHANNEL(i); | 134 | writel(DMAC_CHANNEL(i), DMAC_IECR); |
132 | DMAC_IECR = 0; | 135 | writel(0, DMAC_IECR); |
133 | 136 | ||
134 | if (channel->name && channel->err_handler) { | 137 | if (channel->name && channel->err_handler) { |
135 | channel->err_handler(i, channel->data); | 138 | channel->err_handler(i, channel->data); |
diff --git a/arch/unicore32/kernel/gpio.c b/arch/unicore32/kernel/gpio.c index 4cb28308bb5f..cb12ec39552c 100644 --- a/arch/unicore32/kernel/gpio.c +++ b/arch/unicore32/kernel/gpio.c | |||
@@ -52,15 +52,15 @@ device_initcall(puv3_gpio_leds_init); | |||
52 | 52 | ||
53 | static int puv3_gpio_get(struct gpio_chip *chip, unsigned offset) | 53 | static int puv3_gpio_get(struct gpio_chip *chip, unsigned offset) |
54 | { | 54 | { |
55 | return GPIO_GPLR & GPIO_GPIO(offset); | 55 | return readl(GPIO_GPLR) & GPIO_GPIO(offset); |
56 | } | 56 | } |
57 | 57 | ||
58 | static void puv3_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 58 | static void puv3_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
59 | { | 59 | { |
60 | if (value) | 60 | if (value) |
61 | GPIO_GPSR = GPIO_GPIO(offset); | 61 | writel(GPIO_GPIO(offset), GPIO_GPSR); |
62 | else | 62 | else |
63 | GPIO_GPCR = GPIO_GPIO(offset); | 63 | writel(GPIO_GPIO(offset), GPIO_GPCR); |
64 | } | 64 | } |
65 | 65 | ||
66 | static int puv3_direction_input(struct gpio_chip *chip, unsigned offset) | 66 | static int puv3_direction_input(struct gpio_chip *chip, unsigned offset) |
@@ -68,7 +68,7 @@ static int puv3_direction_input(struct gpio_chip *chip, unsigned offset) | |||
68 | unsigned long flags; | 68 | unsigned long flags; |
69 | 69 | ||
70 | local_irq_save(flags); | 70 | local_irq_save(flags); |
71 | GPIO_GPDR &= ~GPIO_GPIO(offset); | 71 | writel(readl(GPIO_GPDR) & ~GPIO_GPIO(offset), GPIO_GPDR); |
72 | local_irq_restore(flags); | 72 | local_irq_restore(flags); |
73 | return 0; | 73 | return 0; |
74 | } | 74 | } |
@@ -80,7 +80,7 @@ static int puv3_direction_output(struct gpio_chip *chip, unsigned offset, | |||
80 | 80 | ||
81 | local_irq_save(flags); | 81 | local_irq_save(flags); |
82 | puv3_gpio_set(chip, offset, value); | 82 | puv3_gpio_set(chip, offset, value); |
83 | GPIO_GPDR |= GPIO_GPIO(offset); | 83 | writel(readl(GPIO_GPDR) | GPIO_GPIO(offset), GPIO_GPDR); |
84 | local_irq_restore(flags); | 84 | local_irq_restore(flags); |
85 | return 0; | 85 | return 0; |
86 | } | 86 | } |
@@ -97,7 +97,7 @@ static struct gpio_chip puv3_gpio_chip = { | |||
97 | 97 | ||
98 | void __init puv3_init_gpio(void) | 98 | void __init puv3_init_gpio(void) |
99 | { | 99 | { |
100 | GPIO_GPDR = GPIO_DIR; | 100 | writel(GPIO_DIR, GPIO_GPDR); |
101 | #if defined(CONFIG_PUV3_NB0916) || defined(CONFIG_PUV3_SMW0919) \ | 101 | #if defined(CONFIG_PUV3_NB0916) || defined(CONFIG_PUV3_SMW0919) \ |
102 | || defined(CONFIG_PUV3_DB0913) | 102 | || defined(CONFIG_PUV3_DB0913) |
103 | gpio_set_value(GPO_WIFI_EN, 1); | 103 | gpio_set_value(GPO_WIFI_EN, 1); |
diff --git a/arch/unicore32/kernel/irq.c b/arch/unicore32/kernel/irq.c index 38e30897dea3..e1dbfcb61873 100644 --- a/arch/unicore32/kernel/irq.c +++ b/arch/unicore32/kernel/irq.c | |||
@@ -66,8 +66,8 @@ static int puv3_gpio_type(struct irq_data *d, unsigned int type) | |||
66 | else | 66 | else |
67 | GPIO_IRQ_falling_edge &= ~mask; | 67 | GPIO_IRQ_falling_edge &= ~mask; |
68 | 68 | ||
69 | GPIO_GRER = GPIO_IRQ_rising_edge & GPIO_IRQ_mask; | 69 | writel(GPIO_IRQ_rising_edge & GPIO_IRQ_mask, GPIO_GRER); |
70 | GPIO_GFER = GPIO_IRQ_falling_edge & GPIO_IRQ_mask; | 70 | writel(GPIO_IRQ_falling_edge & GPIO_IRQ_mask, GPIO_GFER); |
71 | 71 | ||
72 | return 0; | 72 | return 0; |
73 | } | 73 | } |
@@ -77,25 +77,25 @@ static int puv3_gpio_type(struct irq_data *d, unsigned int type) | |||
77 | */ | 77 | */ |
78 | static void puv3_low_gpio_ack(struct irq_data *d) | 78 | static void puv3_low_gpio_ack(struct irq_data *d) |
79 | { | 79 | { |
80 | GPIO_GEDR = (1 << d->irq); | 80 | writel((1 << d->irq), GPIO_GEDR); |
81 | } | 81 | } |
82 | 82 | ||
83 | static void puv3_low_gpio_mask(struct irq_data *d) | 83 | static void puv3_low_gpio_mask(struct irq_data *d) |
84 | { | 84 | { |
85 | INTC_ICMR &= ~(1 << d->irq); | 85 | writel(readl(INTC_ICMR) & ~(1 << d->irq), INTC_ICMR); |
86 | } | 86 | } |
87 | 87 | ||
88 | static void puv3_low_gpio_unmask(struct irq_data *d) | 88 | static void puv3_low_gpio_unmask(struct irq_data *d) |
89 | { | 89 | { |
90 | INTC_ICMR |= 1 << d->irq; | 90 | writel(readl(INTC_ICMR) | (1 << d->irq), INTC_ICMR); |
91 | } | 91 | } |
92 | 92 | ||
93 | static int puv3_low_gpio_wake(struct irq_data *d, unsigned int on) | 93 | static int puv3_low_gpio_wake(struct irq_data *d, unsigned int on) |
94 | { | 94 | { |
95 | if (on) | 95 | if (on) |
96 | PM_PWER |= 1 << d->irq; | 96 | writel(readl(PM_PWER) | (1 << d->irq), PM_PWER); |
97 | else | 97 | else |
98 | PM_PWER &= ~(1 << d->irq); | 98 | writel(readl(PM_PWER) & ~(1 << d->irq), PM_PWER); |
99 | return 0; | 99 | return 0; |
100 | } | 100 | } |
101 | 101 | ||
@@ -118,13 +118,13 @@ puv3_gpio_handler(unsigned int irq, struct irq_desc *desc) | |||
118 | { | 118 | { |
119 | unsigned int mask; | 119 | unsigned int mask; |
120 | 120 | ||
121 | mask = GPIO_GEDR; | 121 | mask = readl(GPIO_GEDR); |
122 | do { | 122 | do { |
123 | /* | 123 | /* |
124 | * clear down all currently active IRQ sources. | 124 | * clear down all currently active IRQ sources. |
125 | * We will be processing them all. | 125 | * We will be processing them all. |
126 | */ | 126 | */ |
127 | GPIO_GEDR = mask; | 127 | writel(mask, GPIO_GEDR); |
128 | 128 | ||
129 | irq = IRQ_GPIO0; | 129 | irq = IRQ_GPIO0; |
130 | do { | 130 | do { |
@@ -133,7 +133,7 @@ puv3_gpio_handler(unsigned int irq, struct irq_desc *desc) | |||
133 | mask >>= 1; | 133 | mask >>= 1; |
134 | irq++; | 134 | irq++; |
135 | } while (mask); | 135 | } while (mask); |
136 | mask = GPIO_GEDR; | 136 | mask = readl(GPIO_GEDR); |
137 | } while (mask); | 137 | } while (mask); |
138 | } | 138 | } |
139 | 139 | ||
@@ -146,7 +146,7 @@ static void puv3_high_gpio_ack(struct irq_data *d) | |||
146 | { | 146 | { |
147 | unsigned int mask = GPIO_MASK(d->irq); | 147 | unsigned int mask = GPIO_MASK(d->irq); |
148 | 148 | ||
149 | GPIO_GEDR = mask; | 149 | writel(mask, GPIO_GEDR); |
150 | } | 150 | } |
151 | 151 | ||
152 | static void puv3_high_gpio_mask(struct irq_data *d) | 152 | static void puv3_high_gpio_mask(struct irq_data *d) |
@@ -155,8 +155,8 @@ static void puv3_high_gpio_mask(struct irq_data *d) | |||
155 | 155 | ||
156 | GPIO_IRQ_mask &= ~mask; | 156 | GPIO_IRQ_mask &= ~mask; |
157 | 157 | ||
158 | GPIO_GRER &= ~mask; | 158 | writel(readl(GPIO_GRER) & ~mask, GPIO_GRER); |
159 | GPIO_GFER &= ~mask; | 159 | writel(readl(GPIO_GFER) & ~mask, GPIO_GFER); |
160 | } | 160 | } |
161 | 161 | ||
162 | static void puv3_high_gpio_unmask(struct irq_data *d) | 162 | static void puv3_high_gpio_unmask(struct irq_data *d) |
@@ -165,16 +165,16 @@ static void puv3_high_gpio_unmask(struct irq_data *d) | |||
165 | 165 | ||
166 | GPIO_IRQ_mask |= mask; | 166 | GPIO_IRQ_mask |= mask; |
167 | 167 | ||
168 | GPIO_GRER = GPIO_IRQ_rising_edge & GPIO_IRQ_mask; | 168 | writel(GPIO_IRQ_rising_edge & GPIO_IRQ_mask, GPIO_GRER); |
169 | GPIO_GFER = GPIO_IRQ_falling_edge & GPIO_IRQ_mask; | 169 | writel(GPIO_IRQ_falling_edge & GPIO_IRQ_mask, GPIO_GFER); |
170 | } | 170 | } |
171 | 171 | ||
172 | static int puv3_high_gpio_wake(struct irq_data *d, unsigned int on) | 172 | static int puv3_high_gpio_wake(struct irq_data *d, unsigned int on) |
173 | { | 173 | { |
174 | if (on) | 174 | if (on) |
175 | PM_PWER |= PM_PWER_GPIOHIGH; | 175 | writel(readl(PM_PWER) | PM_PWER_GPIOHIGH, PM_PWER); |
176 | else | 176 | else |
177 | PM_PWER &= ~PM_PWER_GPIOHIGH; | 177 | writel(readl(PM_PWER) & ~PM_PWER_GPIOHIGH, PM_PWER); |
178 | return 0; | 178 | return 0; |
179 | } | 179 | } |
180 | 180 | ||
@@ -193,12 +193,12 @@ static struct irq_chip puv3_high_gpio_chip = { | |||
193 | */ | 193 | */ |
194 | static void puv3_mask_irq(struct irq_data *d) | 194 | static void puv3_mask_irq(struct irq_data *d) |
195 | { | 195 | { |
196 | INTC_ICMR &= ~(1 << d->irq); | 196 | writel(readl(INTC_ICMR) & ~(1 << d->irq), INTC_ICMR); |
197 | } | 197 | } |
198 | 198 | ||
199 | static void puv3_unmask_irq(struct irq_data *d) | 199 | static void puv3_unmask_irq(struct irq_data *d) |
200 | { | 200 | { |
201 | INTC_ICMR |= (1 << d->irq); | 201 | writel(readl(INTC_ICMR) | (1 << d->irq), INTC_ICMR); |
202 | } | 202 | } |
203 | 203 | ||
204 | /* | 204 | /* |
@@ -208,9 +208,9 @@ static int puv3_set_wake(struct irq_data *d, unsigned int on) | |||
208 | { | 208 | { |
209 | if (d->irq == IRQ_RTCAlarm) { | 209 | if (d->irq == IRQ_RTCAlarm) { |
210 | if (on) | 210 | if (on) |
211 | PM_PWER |= PM_PWER_RTC; | 211 | writel(readl(PM_PWER) | PM_PWER_RTC, PM_PWER); |
212 | else | 212 | else |
213 | PM_PWER &= ~PM_PWER_RTC; | 213 | writel(readl(PM_PWER) & ~PM_PWER_RTC, PM_PWER); |
214 | return 0; | 214 | return 0; |
215 | } | 215 | } |
216 | return -EINVAL; | 216 | return -EINVAL; |
@@ -242,25 +242,25 @@ static int puv3_irq_suspend(struct sys_device *dev, pm_message_t state) | |||
242 | struct puv3_irq_state *st = &puv3_irq_state; | 242 | struct puv3_irq_state *st = &puv3_irq_state; |
243 | 243 | ||
244 | st->saved = 1; | 244 | st->saved = 1; |
245 | st->icmr = INTC_ICMR; | 245 | st->icmr = readl(INTC_ICMR); |
246 | st->iclr = INTC_ICLR; | 246 | st->iclr = readl(INTC_ICLR); |
247 | st->iccr = INTC_ICCR; | 247 | st->iccr = readl(INTC_ICCR); |
248 | 248 | ||
249 | /* | 249 | /* |
250 | * Disable all GPIO-based interrupts. | 250 | * Disable all GPIO-based interrupts. |
251 | */ | 251 | */ |
252 | INTC_ICMR &= ~(0x1ff); | 252 | writel(readl(INTC_ICMR) & ~(0x1ff), INTC_ICMR); |
253 | 253 | ||
254 | /* | 254 | /* |
255 | * Set the appropriate edges for wakeup. | 255 | * Set the appropriate edges for wakeup. |
256 | */ | 256 | */ |
257 | GPIO_GRER = PM_PWER & GPIO_IRQ_rising_edge; | 257 | writel(readl(PM_PWER) & GPIO_IRQ_rising_edge, GPIO_GRER); |
258 | GPIO_GFER = PM_PWER & GPIO_IRQ_falling_edge; | 258 | writel(readl(PM_PWER) & GPIO_IRQ_falling_edge, GPIO_GFER); |
259 | 259 | ||
260 | /* | 260 | /* |
261 | * Clear any pending GPIO interrupts. | 261 | * Clear any pending GPIO interrupts. |
262 | */ | 262 | */ |
263 | GPIO_GEDR = GPIO_GEDR; | 263 | writel(readl(GPIO_GEDR), GPIO_GEDR); |
264 | 264 | ||
265 | return 0; | 265 | return 0; |
266 | } | 266 | } |
@@ -270,13 +270,13 @@ static int puv3_irq_resume(struct sys_device *dev) | |||
270 | struct puv3_irq_state *st = &puv3_irq_state; | 270 | struct puv3_irq_state *st = &puv3_irq_state; |
271 | 271 | ||
272 | if (st->saved) { | 272 | if (st->saved) { |
273 | INTC_ICCR = st->iccr; | 273 | writel(st->iccr, INTC_ICCR); |
274 | INTC_ICLR = st->iclr; | 274 | writel(st->iclr, INTC_ICLR); |
275 | 275 | ||
276 | GPIO_GRER = GPIO_IRQ_rising_edge & GPIO_IRQ_mask; | 276 | writel(GPIO_IRQ_rising_edge & GPIO_IRQ_mask, GPIO_GRER); |
277 | GPIO_GFER = GPIO_IRQ_falling_edge & GPIO_IRQ_mask; | 277 | writel(GPIO_IRQ_falling_edge & GPIO_IRQ_mask, GPIO_GFER); |
278 | 278 | ||
279 | INTC_ICMR = st->icmr; | 279 | writel(st->icmr, INTC_ICMR); |
280 | } | 280 | } |
281 | return 0; | 281 | return 0; |
282 | } | 282 | } |
@@ -307,18 +307,18 @@ void __init init_IRQ(void) | |||
307 | request_resource(&iomem_resource, &irq_resource); | 307 | request_resource(&iomem_resource, &irq_resource); |
308 | 308 | ||
309 | /* disable all IRQs */ | 309 | /* disable all IRQs */ |
310 | INTC_ICMR = 0; | 310 | writel(0, INTC_ICMR); |
311 | 311 | ||
312 | /* all IRQs are IRQ, not REAL */ | 312 | /* all IRQs are IRQ, not REAL */ |
313 | INTC_ICLR = 0; | 313 | writel(0, INTC_ICLR); |
314 | 314 | ||
315 | /* clear all GPIO edge detects */ | 315 | /* clear all GPIO edge detects */ |
316 | GPIO_GPIR = FMASK(8, 0) & ~FIELD(1, 1, GPI_SOFF_REQ); | 316 | writel(FMASK(8, 0) & ~FIELD(1, 1, GPI_SOFF_REQ), GPIO_GPIR); |
317 | GPIO_GFER = 0; | 317 | writel(0, GPIO_GFER); |
318 | GPIO_GRER = 0; | 318 | writel(0, GPIO_GRER); |
319 | GPIO_GEDR = 0x0FFFFFFF; | 319 | writel(0x0FFFFFFF, GPIO_GEDR); |
320 | 320 | ||
321 | INTC_ICCR = 1; | 321 | writel(1, INTC_ICCR); |
322 | 322 | ||
323 | for (irq = 0; irq < IRQ_GPIOHIGH; irq++) { | 323 | for (irq = 0; irq < IRQ_GPIOHIGH; irq++) { |
324 | set_irq_chip(irq, &puv3_low_gpio_chip); | 324 | set_irq_chip(irq, &puv3_low_gpio_chip); |
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c index d4e55e2d2d29..65c265ee8e94 100644 --- a/arch/unicore32/kernel/pci.c +++ b/arch/unicore32/kernel/pci.c | |||
@@ -30,16 +30,16 @@ static int | |||
30 | puv3_read_config(struct pci_bus *bus, unsigned int devfn, int where, | 30 | puv3_read_config(struct pci_bus *bus, unsigned int devfn, int where, |
31 | int size, u32 *value) | 31 | int size, u32 *value) |
32 | { | 32 | { |
33 | PCICFG_ADDR = CONFIG_CMD(bus, devfn, where); | 33 | writel(CONFIG_CMD(bus, devfn, where), PCICFG_ADDR); |
34 | switch (size) { | 34 | switch (size) { |
35 | case 1: | 35 | case 1: |
36 | *value = (PCICFG_DATA >> ((where & 3) * 8)) & 0xFF; | 36 | *value = (readl(PCICFG_DATA) >> ((where & 3) * 8)) & 0xFF; |
37 | break; | 37 | break; |
38 | case 2: | 38 | case 2: |
39 | *value = (PCICFG_DATA >> ((where & 2) * 8)) & 0xFFFF; | 39 | *value = (readl(PCICFG_DATA) >> ((where & 2) * 8)) & 0xFFFF; |
40 | break; | 40 | break; |
41 | case 4: | 41 | case 4: |
42 | *value = PCICFG_DATA; | 42 | *value = readl(PCICFG_DATA); |
43 | break; | 43 | break; |
44 | } | 44 | } |
45 | return PCIBIOS_SUCCESSFUL; | 45 | return PCIBIOS_SUCCESSFUL; |
@@ -49,18 +49,18 @@ static int | |||
49 | puv3_write_config(struct pci_bus *bus, unsigned int devfn, int where, | 49 | puv3_write_config(struct pci_bus *bus, unsigned int devfn, int where, |
50 | int size, u32 value) | 50 | int size, u32 value) |
51 | { | 51 | { |
52 | PCICFG_ADDR = CONFIG_CMD(bus, devfn, where); | 52 | writel(CONFIG_CMD(bus, devfn, where), PCICFG_ADDR); |
53 | switch (size) { | 53 | switch (size) { |
54 | case 1: | 54 | case 1: |
55 | PCICFG_DATA = (PCICFG_DATA & ~FMASK(8, (where&3)*8)) | 55 | writel((readl(PCICFG_DATA) & ~FMASK(8, (where&3)*8)) |
56 | | FIELD(value, 8, (where&3)*8); | 56 | | FIELD(value, 8, (where&3)*8), PCICFG_DATA); |
57 | break; | 57 | break; |
58 | case 2: | 58 | case 2: |
59 | PCICFG_DATA = (PCICFG_DATA & ~FMASK(16, (where&2)*8)) | 59 | writel((readl(PCICFG_DATA) & ~FMASK(16, (where&2)*8)) |
60 | | FIELD(value, 16, (where&2)*8); | 60 | | FIELD(value, 16, (where&2)*8), PCICFG_DATA); |
61 | break; | 61 | break; |
62 | case 4: | 62 | case 4: |
63 | PCICFG_DATA = value; | 63 | writel(value, PCICFG_DATA); |
64 | break; | 64 | break; |
65 | } | 65 | } |
66 | return PCIBIOS_SUCCESSFUL; | 66 | return PCIBIOS_SUCCESSFUL; |
@@ -75,31 +75,31 @@ void pci_puv3_preinit(void) | |||
75 | { | 75 | { |
76 | printk(KERN_DEBUG "PCI: PKUnity PCI Controller Initializing ...\n"); | 76 | printk(KERN_DEBUG "PCI: PKUnity PCI Controller Initializing ...\n"); |
77 | /* config PCI bridge base */ | 77 | /* config PCI bridge base */ |
78 | PCICFG_BRIBASE = PKUNITY_PCIBRI_BASE; | 78 | writel(PKUNITY_PCIBRI_BASE, PCICFG_BRIBASE); |
79 | 79 | ||
80 | PCIBRI_AHBCTL0 = 0; | 80 | writel(0, PCIBRI_AHBCTL0); |
81 | PCIBRI_AHBBAR0 = PKUNITY_PCIBRI_BASE | PCIBRI_BARx_MEM; | 81 | writel(PKUNITY_PCIBRI_BASE | PCIBRI_BARx_MEM, PCIBRI_AHBBAR0); |
82 | PCIBRI_AHBAMR0 = 0xFFFF0000; | 82 | writel(0xFFFF0000, PCIBRI_AHBAMR0); |
83 | PCIBRI_AHBTAR0 = 0; | 83 | writel(0, PCIBRI_AHBTAR0); |
84 | 84 | ||
85 | PCIBRI_AHBCTL1 = PCIBRI_CTLx_AT; | 85 | writel(PCIBRI_CTLx_AT, PCIBRI_AHBCTL1); |
86 | PCIBRI_AHBBAR1 = PKUNITY_PCILIO_BASE | PCIBRI_BARx_IO; | 86 | writel(PKUNITY_PCILIO_BASE | PCIBRI_BARx_IO, PCIBRI_AHBBAR1); |
87 | PCIBRI_AHBAMR1 = 0xFFFF0000; | 87 | writel(0xFFFF0000, PCIBRI_AHBAMR1); |
88 | PCIBRI_AHBTAR1 = 0x00000000; | 88 | writel(0x00000000, PCIBRI_AHBTAR1); |
89 | 89 | ||
90 | PCIBRI_AHBCTL2 = PCIBRI_CTLx_PREF; | 90 | writel(PCIBRI_CTLx_PREF, PCIBRI_AHBCTL2); |
91 | PCIBRI_AHBBAR2 = PKUNITY_PCIMEM_BASE | PCIBRI_BARx_MEM; | 91 | writel(PKUNITY_PCIMEM_BASE | PCIBRI_BARx_MEM, PCIBRI_AHBBAR2); |
92 | PCIBRI_AHBAMR2 = 0xF8000000; | 92 | writel(0xF8000000, PCIBRI_AHBAMR2); |
93 | PCIBRI_AHBTAR2 = 0; | 93 | writel(0, PCIBRI_AHBTAR2); |
94 | 94 | ||
95 | PCIBRI_BAR1 = PKUNITY_PCIAHB_BASE | PCIBRI_BARx_MEM; | 95 | writel(PKUNITY_PCIAHB_BASE | PCIBRI_BARx_MEM, PCIBRI_BAR1); |
96 | 96 | ||
97 | PCIBRI_PCICTL0 = PCIBRI_CTLx_AT | PCIBRI_CTLx_PREF; | 97 | writel(PCIBRI_CTLx_AT | PCIBRI_CTLx_PREF, PCIBRI_PCICTL0); |
98 | PCIBRI_PCIBAR0 = PKUNITY_PCIAHB_BASE | PCIBRI_BARx_MEM; | 98 | writel(PKUNITY_PCIAHB_BASE | PCIBRI_BARx_MEM, PCIBRI_PCIBAR0); |
99 | PCIBRI_PCIAMR0 = 0xF8000000; | 99 | writel(0xF8000000, PCIBRI_PCIAMR0); |
100 | PCIBRI_PCITAR0 = PKUNITY_SDRAM_BASE; | 100 | writel(PKUNITY_SDRAM_BASE, PCIBRI_PCITAR0); |
101 | 101 | ||
102 | PCIBRI_CMD = PCIBRI_CMD | PCIBRI_CMD_IO | PCIBRI_CMD_MEM; | 102 | writel(readl(PCIBRI_CMD) | PCIBRI_CMD_IO | PCIBRI_CMD_MEM, PCIBRI_CMD); |
103 | } | 103 | } |
104 | 104 | ||
105 | static int __init pci_puv3_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 105 | static int __init pci_puv3_map_irq(struct pci_dev *dev, u8 slot, u8 pin) |
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c index 8d4a273ae086..ba401df971ed 100644 --- a/arch/unicore32/kernel/process.c +++ b/arch/unicore32/kernel/process.c | |||
@@ -125,9 +125,9 @@ void machine_restart(char *cmd) | |||
125 | /* Jump into ROM at address 0xffff0000 */ | 125 | /* Jump into ROM at address 0xffff0000 */ |
126 | cpu_reset(VECTORS_BASE); | 126 | cpu_reset(VECTORS_BASE); |
127 | } else { | 127 | } else { |
128 | PM_PLLSYSCFG = 0x00002001; /* cpu clk = 250M */ | 128 | writel(0x00002001, PM_PLLSYSCFG); /* cpu clk = 250M */ |
129 | PM_PLLDDRCFG = 0x00100800; /* ddr clk = 44M */ | 129 | writel(0x00100800, PM_PLLDDRCFG); /* ddr clk = 44M */ |
130 | PM_PLLVGACFG = 0x00002001; /* vga clk = 250M */ | 130 | writel(0x00002001, PM_PLLVGACFG); /* vga clk = 250M */ |
131 | 131 | ||
132 | /* Use on-chip reset capability */ | 132 | /* Use on-chip reset capability */ |
133 | /* following instructions must be in one icache line */ | 133 | /* following instructions must be in one icache line */ |
@@ -141,10 +141,10 @@ void machine_restart(char *cmd) | |||
141 | " nop; nop; nop\n\t" | 141 | " nop; nop; nop\n\t" |
142 | /* prefetch 3 instructions at most */ | 142 | /* prefetch 3 instructions at most */ |
143 | : | 143 | : |
144 | : "r" ((unsigned long)&PM_PMCR), | 144 | : "r" (PM_PMCR), |
145 | "r" (PM_PMCR_CFBSYS | PM_PMCR_CFBDDR | 145 | "r" (PM_PMCR_CFBSYS | PM_PMCR_CFBDDR |
146 | | PM_PMCR_CFBVGA), | 146 | | PM_PMCR_CFBVGA), |
147 | "r" ((unsigned long)&RESETC_SWRR), | 147 | "r" (RESETC_SWRR), |
148 | "r" (RESETC_SWRR_SRB) | 148 | "r" (RESETC_SWRR_SRB) |
149 | : "r0", "memory"); | 149 | : "r0", "memory"); |
150 | } | 150 | } |
diff --git a/arch/unicore32/kernel/puv3-core.c b/arch/unicore32/kernel/puv3-core.c index 26cc52b51e7b..6edf928a106c 100644 --- a/arch/unicore32/kernel/puv3-core.c +++ b/arch/unicore32/kernel/puv3-core.c | |||
@@ -36,7 +36,7 @@ | |||
36 | */ | 36 | */ |
37 | unsigned long long sched_clock(void) | 37 | unsigned long long sched_clock(void) |
38 | { | 38 | { |
39 | unsigned long long v = cnt32_to_63(OST_OSCR); | 39 | unsigned long long v = cnt32_to_63(readl(OST_OSCR)); |
40 | 40 | ||
41 | /* original conservative method, but overflow frequently | 41 | /* original conservative method, but overflow frequently |
42 | * v *= NSEC_PER_SEC >> 12; | 42 | * v *= NSEC_PER_SEC >> 12; |
@@ -187,15 +187,15 @@ static void puv3_cpu_pm_restore(unsigned long *sleep_save) | |||
187 | static int puv3_cpu_pm_prepare(void) | 187 | static int puv3_cpu_pm_prepare(void) |
188 | { | 188 | { |
189 | /* set resume return address */ | 189 | /* set resume return address */ |
190 | PM_DIVCFG = virt_to_phys(puv3_cpu_resume); | 190 | writel(virt_to_phys(puv3_cpu_resume), PM_DIVCFG); |
191 | return 0; | 191 | return 0; |
192 | } | 192 | } |
193 | 193 | ||
194 | static void puv3_cpu_pm_enter(suspend_state_t state) | 194 | static void puv3_cpu_pm_enter(suspend_state_t state) |
195 | { | 195 | { |
196 | /* Clear reset status */ | 196 | /* Clear reset status */ |
197 | RESETC_RSSR = RESETC_RSSR_HWR | RESETC_RSSR_WDR | 197 | writel(RESETC_RSSR_HWR | RESETC_RSSR_WDR |
198 | | RESETC_RSSR_SMR | RESETC_RSSR_SWR; | 198 | | RESETC_RSSR_SMR | RESETC_RSSR_SWR, RESETC_RSSR); |
199 | 199 | ||
200 | switch (state) { | 200 | switch (state) { |
201 | /* case PM_SUSPEND_ON: | 201 | /* case PM_SUSPEND_ON: |
@@ -242,7 +242,7 @@ void puv3_ps2_init(void) | |||
242 | struct clk *bclk32; | 242 | struct clk *bclk32; |
243 | 243 | ||
244 | bclk32 = clk_get(NULL, "BUS32_CLK"); | 244 | bclk32 = clk_get(NULL, "BUS32_CLK"); |
245 | PS2_CNT = clk_get_rate(bclk32) / 200000; /* should > 5us */ | 245 | writel(clk_get_rate(bclk32) / 200000, PS2_CNT); /* should > 5us */ |
246 | } | 246 | } |
247 | 247 | ||
248 | void __init puv3_core_init(void) | 248 | void __init puv3_core_init(void) |
diff --git a/arch/unicore32/kernel/rtc.c b/arch/unicore32/kernel/rtc.c index 5e4db4158589..c5f068295b51 100644 --- a/arch/unicore32/kernel/rtc.c +++ b/arch/unicore32/kernel/rtc.c | |||
@@ -41,7 +41,7 @@ static irqreturn_t puv3_rtc_alarmirq(int irq, void *id) | |||
41 | { | 41 | { |
42 | struct rtc_device *rdev = id; | 42 | struct rtc_device *rdev = id; |
43 | 43 | ||
44 | RTC_RTSR |= RTC_RTSR_AL; | 44 | writel(readl(RTC_RTSR) | RTC_RTSR_AL, RTC_RTSR); |
45 | rtc_update_irq(rdev, 1, RTC_AF | RTC_IRQF); | 45 | rtc_update_irq(rdev, 1, RTC_AF | RTC_IRQF); |
46 | return IRQ_HANDLED; | 46 | return IRQ_HANDLED; |
47 | } | 47 | } |
@@ -50,7 +50,7 @@ static irqreturn_t puv3_rtc_tickirq(int irq, void *id) | |||
50 | { | 50 | { |
51 | struct rtc_device *rdev = id; | 51 | struct rtc_device *rdev = id; |
52 | 52 | ||
53 | RTC_RTSR |= RTC_RTSR_HZ; | 53 | writel(readl(RTC_RTSR) | RTC_RTSR_HZ, RTC_RTSR); |
54 | rtc_update_irq(rdev, 1, RTC_PF | RTC_IRQF); | 54 | rtc_update_irq(rdev, 1, RTC_PF | RTC_IRQF); |
55 | return IRQ_HANDLED; | 55 | return IRQ_HANDLED; |
56 | } | 56 | } |
@@ -62,12 +62,12 @@ static void puv3_rtc_setaie(int to) | |||
62 | 62 | ||
63 | pr_debug("%s: aie=%d\n", __func__, to); | 63 | pr_debug("%s: aie=%d\n", __func__, to); |
64 | 64 | ||
65 | tmp = RTC_RTSR & ~RTC_RTSR_ALE; | 65 | tmp = readl(RTC_RTSR) & ~RTC_RTSR_ALE; |
66 | 66 | ||
67 | if (to) | 67 | if (to) |
68 | tmp |= RTC_RTSR_ALE; | 68 | tmp |= RTC_RTSR_ALE; |
69 | 69 | ||
70 | RTC_RTSR = tmp; | 70 | writel(tmp, RTC_RTSR); |
71 | } | 71 | } |
72 | 72 | ||
73 | static int puv3_rtc_setpie(struct device *dev, int enabled) | 73 | static int puv3_rtc_setpie(struct device *dev, int enabled) |
@@ -77,12 +77,12 @@ static int puv3_rtc_setpie(struct device *dev, int enabled) | |||
77 | pr_debug("%s: pie=%d\n", __func__, enabled); | 77 | pr_debug("%s: pie=%d\n", __func__, enabled); |
78 | 78 | ||
79 | spin_lock_irq(&puv3_rtc_pie_lock); | 79 | spin_lock_irq(&puv3_rtc_pie_lock); |
80 | tmp = RTC_RTSR & ~RTC_RTSR_HZE; | 80 | tmp = readl(RTC_RTSR) & ~RTC_RTSR_HZE; |
81 | 81 | ||
82 | if (enabled) | 82 | if (enabled) |
83 | tmp |= RTC_RTSR_HZE; | 83 | tmp |= RTC_RTSR_HZE; |
84 | 84 | ||
85 | RTC_RTSR = tmp; | 85 | writel(tmp, RTC_RTSR); |
86 | spin_unlock_irq(&puv3_rtc_pie_lock); | 86 | spin_unlock_irq(&puv3_rtc_pie_lock); |
87 | 87 | ||
88 | return 0; | 88 | return 0; |
@@ -97,7 +97,7 @@ static int puv3_rtc_setfreq(struct device *dev, int freq) | |||
97 | 97 | ||
98 | static int puv3_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) | 98 | static int puv3_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) |
99 | { | 99 | { |
100 | rtc_time_to_tm(RTC_RCNR, rtc_tm); | 100 | rtc_time_to_tm(readl(RTC_RCNR), rtc_tm); |
101 | 101 | ||
102 | pr_debug("read time %02x.%02x.%02x %02x/%02x/%02x\n", | 102 | pr_debug("read time %02x.%02x.%02x %02x/%02x/%02x\n", |
103 | rtc_tm->tm_year, rtc_tm->tm_mon, rtc_tm->tm_mday, | 103 | rtc_tm->tm_year, rtc_tm->tm_mon, rtc_tm->tm_mday, |
@@ -115,7 +115,7 @@ static int puv3_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
115 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 115 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
116 | 116 | ||
117 | rtc_tm_to_time(tm, &rtc_count); | 117 | rtc_tm_to_time(tm, &rtc_count); |
118 | RTC_RCNR = rtc_count; | 118 | writel(rtc_count, RTC_RCNR); |
119 | 119 | ||
120 | return 0; | 120 | return 0; |
121 | } | 121 | } |
@@ -124,9 +124,9 @@ static int puv3_rtc_getalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
124 | { | 124 | { |
125 | struct rtc_time *alm_tm = &alrm->time; | 125 | struct rtc_time *alm_tm = &alrm->time; |
126 | 126 | ||
127 | rtc_time_to_tm(RTC_RTAR, alm_tm); | 127 | rtc_time_to_tm(readl(RTC_RTAR), alm_tm); |
128 | 128 | ||
129 | alrm->enabled = RTC_RTSR & RTC_RTSR_ALE; | 129 | alrm->enabled = readl(RTC_RTSR) & RTC_RTSR_ALE; |
130 | 130 | ||
131 | pr_debug("read alarm %02x %02x.%02x.%02x %02x/%02x/%02x\n", | 131 | pr_debug("read alarm %02x %02x.%02x.%02x %02x/%02x/%02x\n", |
132 | alrm->enabled, | 132 | alrm->enabled, |
@@ -147,7 +147,7 @@ static int puv3_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
147 | tm->tm_hour & 0xff, tm->tm_min & 0xff, tm->tm_sec); | 147 | tm->tm_hour & 0xff, tm->tm_min & 0xff, tm->tm_sec); |
148 | 148 | ||
149 | rtc_tm_to_time(tm, &rtcalarm_count); | 149 | rtc_tm_to_time(tm, &rtcalarm_count); |
150 | RTC_RTAR = rtcalarm_count; | 150 | writel(rtcalarm_count, RTC_RTAR); |
151 | 151 | ||
152 | puv3_rtc_setaie(alrm->enabled); | 152 | puv3_rtc_setaie(alrm->enabled); |
153 | 153 | ||
@@ -162,7 +162,7 @@ static int puv3_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
162 | static int puv3_rtc_proc(struct device *dev, struct seq_file *seq) | 162 | static int puv3_rtc_proc(struct device *dev, struct seq_file *seq) |
163 | { | 163 | { |
164 | seq_printf(seq, "periodic_IRQ\t: %s\n", | 164 | seq_printf(seq, "periodic_IRQ\t: %s\n", |
165 | (RTC_RTSR & RTC_RTSR_HZE) ? "yes" : "no"); | 165 | (readl(RTC_RTSR) & RTC_RTSR_HZE) ? "yes" : "no"); |
166 | return 0; | 166 | return 0; |
167 | } | 167 | } |
168 | 168 | ||
@@ -222,13 +222,13 @@ static const struct rtc_class_ops puv3_rtcops = { | |||
222 | static void puv3_rtc_enable(struct platform_device *pdev, int en) | 222 | static void puv3_rtc_enable(struct platform_device *pdev, int en) |
223 | { | 223 | { |
224 | if (!en) { | 224 | if (!en) { |
225 | RTC_RTSR &= ~RTC_RTSR_HZE; | 225 | writel(readl(RTC_RTSR) & ~RTC_RTSR_HZE, RTC_RTSR); |
226 | } else { | 226 | } else { |
227 | /* re-enable the device, and check it is ok */ | 227 | /* re-enable the device, and check it is ok */ |
228 | 228 | ||
229 | if ((RTC_RTSR & RTC_RTSR_HZE) == 0) { | 229 | if ((readl(RTC_RTSR) & RTC_RTSR_HZE) == 0) { |
230 | dev_info(&pdev->dev, "rtc disabled, re-enabling\n"); | 230 | dev_info(&pdev->dev, "rtc disabled, re-enabling\n"); |
231 | RTC_RTSR |= RTC_RTSR_HZE; | 231 | writel(readl(RTC_RTSR) | RTC_RTSR_HZE, RTC_RTSR); |
232 | } | 232 | } |
233 | } | 233 | } |
234 | } | 234 | } |
@@ -331,7 +331,7 @@ static int ticnt_save; | |||
331 | static int puv3_rtc_suspend(struct platform_device *pdev, pm_message_t state) | 331 | static int puv3_rtc_suspend(struct platform_device *pdev, pm_message_t state) |
332 | { | 332 | { |
333 | /* save RTAR for anyone using periodic interrupts */ | 333 | /* save RTAR for anyone using periodic interrupts */ |
334 | ticnt_save = RTC_RTAR; | 334 | ticnt_save = readl(RTC_RTAR); |
335 | puv3_rtc_enable(pdev, 0); | 335 | puv3_rtc_enable(pdev, 0); |
336 | return 0; | 336 | return 0; |
337 | } | 337 | } |
@@ -339,7 +339,7 @@ static int puv3_rtc_suspend(struct platform_device *pdev, pm_message_t state) | |||
339 | static int puv3_rtc_resume(struct platform_device *pdev) | 339 | static int puv3_rtc_resume(struct platform_device *pdev) |
340 | { | 340 | { |
341 | puv3_rtc_enable(pdev, 1); | 341 | puv3_rtc_enable(pdev, 1); |
342 | RTC_RTAR = ticnt_save; | 342 | writel(ticnt_save, RTC_RTAR); |
343 | return 0; | 343 | return 0; |
344 | } | 344 | } |
345 | #else | 345 | #else |
diff --git a/arch/unicore32/kernel/time.c b/arch/unicore32/kernel/time.c index 8bb4b815bce9..080710c09241 100644 --- a/arch/unicore32/kernel/time.c +++ b/arch/unicore32/kernel/time.c | |||
@@ -26,8 +26,8 @@ static irqreturn_t puv3_ost0_interrupt(int irq, void *dev_id) | |||
26 | struct clock_event_device *c = dev_id; | 26 | struct clock_event_device *c = dev_id; |
27 | 27 | ||
28 | /* Disarm the compare/match, signal the event. */ | 28 | /* Disarm the compare/match, signal the event. */ |
29 | OST_OIER &= ~OST_OIER_E0; | 29 | writel(readl(OST_OIER) & ~OST_OIER_E0, OST_OIER); |
30 | OST_OSSR &= ~OST_OSSR_M0; | 30 | writel(readl(OST_OSSR) & ~OST_OSSR_M0, OST_OSSR); |
31 | c->event_handler(c); | 31 | c->event_handler(c); |
32 | 32 | ||
33 | return IRQ_HANDLED; | 33 | return IRQ_HANDLED; |
@@ -38,10 +38,10 @@ puv3_osmr0_set_next_event(unsigned long delta, struct clock_event_device *c) | |||
38 | { | 38 | { |
39 | unsigned long next, oscr; | 39 | unsigned long next, oscr; |
40 | 40 | ||
41 | OST_OIER |= OST_OIER_E0; | 41 | writel(readl(OST_OIER) | OST_OIER_E0, OST_OIER); |
42 | next = OST_OSCR + delta; | 42 | next = readl(OST_OSCR) + delta; |
43 | OST_OSMR0 = next; | 43 | writel(next, OST_OSMR0); |
44 | oscr = OST_OSCR; | 44 | oscr = readl(OST_OSCR); |
45 | 45 | ||
46 | return (signed)(next - oscr) <= MIN_OSCR_DELTA ? -ETIME : 0; | 46 | return (signed)(next - oscr) <= MIN_OSCR_DELTA ? -ETIME : 0; |
47 | } | 47 | } |
@@ -53,8 +53,8 @@ puv3_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *c) | |||
53 | case CLOCK_EVT_MODE_ONESHOT: | 53 | case CLOCK_EVT_MODE_ONESHOT: |
54 | case CLOCK_EVT_MODE_UNUSED: | 54 | case CLOCK_EVT_MODE_UNUSED: |
55 | case CLOCK_EVT_MODE_SHUTDOWN: | 55 | case CLOCK_EVT_MODE_SHUTDOWN: |
56 | OST_OIER &= ~OST_OIER_E0; | 56 | writel(readl(OST_OIER) & ~OST_OIER_E0, OST_OIER); |
57 | OST_OSSR &= ~OST_OSSR_M0; | 57 | writel(readl(OST_OSSR) & ~OST_OSSR_M0, OST_OSSR); |
58 | break; | 58 | break; |
59 | 59 | ||
60 | case CLOCK_EVT_MODE_RESUME: | 60 | case CLOCK_EVT_MODE_RESUME: |
@@ -73,7 +73,7 @@ static struct clock_event_device ckevt_puv3_osmr0 = { | |||
73 | 73 | ||
74 | static cycle_t puv3_read_oscr(struct clocksource *cs) | 74 | static cycle_t puv3_read_oscr(struct clocksource *cs) |
75 | { | 75 | { |
76 | return OST_OSCR; | 76 | return readl(OST_OSCR); |
77 | } | 77 | } |
78 | 78 | ||
79 | static struct clocksource cksrc_puv3_oscr = { | 79 | static struct clocksource cksrc_puv3_oscr = { |
@@ -93,8 +93,8 @@ static struct irqaction puv3_timer_irq = { | |||
93 | 93 | ||
94 | void __init time_init(void) | 94 | void __init time_init(void) |
95 | { | 95 | { |
96 | OST_OIER = 0; /* disable any timer interrupts */ | 96 | writel(0, OST_OIER); /* disable any timer interrupts */ |
97 | OST_OSSR = 0; /* clear status on all timers */ | 97 | writel(0, OST_OSSR); /* clear status on all timers */ |
98 | 98 | ||
99 | clockevents_calc_mult_shift(&ckevt_puv3_osmr0, CLOCK_TICK_RATE, 5); | 99 | clockevents_calc_mult_shift(&ckevt_puv3_osmr0, CLOCK_TICK_RATE, 5); |
100 | 100 | ||
@@ -115,26 +115,26 @@ unsigned long osmr[4], oier; | |||
115 | 115 | ||
116 | void puv3_timer_suspend(void) | 116 | void puv3_timer_suspend(void) |
117 | { | 117 | { |
118 | osmr[0] = OST_OSMR0; | 118 | osmr[0] = readl(OST_OSMR0); |
119 | osmr[1] = OST_OSMR1; | 119 | osmr[1] = readl(OST_OSMR1); |
120 | osmr[2] = OST_OSMR2; | 120 | osmr[2] = readl(OST_OSMR2); |
121 | osmr[3] = OST_OSMR3; | 121 | osmr[3] = readl(OST_OSMR3); |
122 | oier = OST_OIER; | 122 | oier = readl(OST_OIER); |
123 | } | 123 | } |
124 | 124 | ||
125 | void puv3_timer_resume(void) | 125 | void puv3_timer_resume(void) |
126 | { | 126 | { |
127 | OST_OSSR = 0; | 127 | writel(0, OST_OSSR); |
128 | OST_OSMR0 = osmr[0]; | 128 | writel(osmr[0], OST_OSMR0); |
129 | OST_OSMR1 = osmr[1]; | 129 | writel(osmr[1], OST_OSMR1); |
130 | OST_OSMR2 = osmr[2]; | 130 | writel(osmr[2], OST_OSMR2); |
131 | OST_OSMR3 = osmr[3]; | 131 | writel(osmr[3], OST_OSMR3); |
132 | OST_OIER = oier; | 132 | writel(oier, OST_OIER); |
133 | 133 | ||
134 | /* | 134 | /* |
135 | * OSMR0 is the system timer: make sure OSCR is sufficiently behind | 135 | * OSMR0 is the system timer: make sure OSCR is sufficiently behind |
136 | */ | 136 | */ |
137 | OST_OSCR = OST_OSMR0 - LATCH; | 137 | writel(readl(OST_OSMR0) - LATCH, OST_OSCR); |
138 | } | 138 | } |
139 | #else | 139 | #else |
140 | void puv3_timer_suspend(void) { }; | 140 | void puv3_timer_suspend(void) { }; |