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 /arch/arm/mach-ns9xxx/gpio.c | |
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>
Diffstat (limited to 'arch/arm/mach-ns9xxx/gpio.c')
-rw-r--r-- | arch/arm/mach-ns9xxx/gpio.c | 44 |
1 files changed, 25 insertions, 19 deletions
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 | } |