[generic/3.9]: refresh patches against -rc4
[openwrt.git] / target / linux / gemini / patches-3.8 / 000-ARM-gemini-get-platform-to-build-again.patch
1 From patchwork Fri Jan  4 15:30:38 2013
2 Content-Type: text/plain; charset="utf-8"
3 MIME-Version: 1.0
4 Content-Transfer-Encoding: 7bit
5 Subject: [RFC,1/3] ARM: gemini: get platform to build again
6 Date: Fri, 04 Jan 2013 15:30:38 -0000
7 From: Arnd Bergmann <arnd@arndb.de>
8 X-Patchwork-Id: 1933501
9 Message-Id: <1357313440-20092-1-git-send-email-arnd@arndb.de>
10 To: Hans Ulli Kroll <ulli.kroll@googlemail.com>
11 Cc: Russell King <rmk+kernel@arm.linux.org.uk>, Arnd Bergmann <arnd@arndb.de>, 
12  Florian Fainelli <florian@openwrt.org>,
13  linux-arm-kernel@lists.infradead.org
14
15 There is no defconfig file for gemini, which has lead to a lot
16 of bitrot. This makes the broken board files, the gpio implementation
17 and the reset logic work again, and fixes the build warnings
18 that got introduced with the changes to the readl/writel prototypes.
19
20 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
21
22 ---
23 (retransmitted because the original was rejected by linux-arm-kernel)
24
25  arch/arm/Kconfig                             |    1 +
26  arch/arm/mach-gemini/Makefile                |    2 +-
27  arch/arm/mach-gemini/board-nas4220b.c        |    1 +
28  arch/arm/mach-gemini/board-rut1xx.c          |    2 ++
29  arch/arm/mach-gemini/board-wbd111.c          |    1 +
30  arch/arm/mach-gemini/board-wbd222.c          |    1 +
31  arch/arm/mach-gemini/common.h                |    2 ++
32  arch/arm/mach-gemini/gpio.c                  |   19 ++++++++++---------
33  arch/arm/mach-gemini/include/mach/hardware.h |    2 +-
34  arch/arm/mach-gemini/include/mach/system.h   |   23 -----------------------
35  arch/arm/mach-gemini/irq.c                   |    4 ++--
36  arch/arm/mach-gemini/mm.c                    |   22 +++++++++++-----------
37  arch/arm/mach-gemini/reset.c                 |   23 +++++++++++++++++++++++
38  13 files changed, 56 insertions(+), 47 deletions(-)
39  delete mode 100644 arch/arm/mach-gemini/include/mach/system.h
40  create mode 100644 arch/arm/mach-gemini/reset.c
41
42 --- a/arch/arm/Kconfig
43 +++ b/arch/arm/Kconfig
44 @@ -386,6 +386,7 @@ config ARCH_GEMINI
45         bool "Cortina Systems Gemini"
46         select ARCH_REQUIRE_GPIOLIB
47         select ARCH_USES_GETTIMEOFFSET
48 +       select NEED_MACH_GPIO_H
49         select CPU_FA526
50         help
51           Support for the Cortina Systems Gemini family SoCs
52 --- a/arch/arm/mach-gemini/Makefile
53 +++ b/arch/arm/mach-gemini/Makefile
54 @@ -4,7 +4,7 @@
55  
56  # Object file lists.
57  
58 -obj-y                  := irq.o mm.o time.o devices.o gpio.o idle.o
59 +obj-y                  := irq.o mm.o time.o devices.o gpio.o idle.o reset.o
60  
61  # Board-specific support
62  obj-$(CONFIG_MACH_NAS4220B)    += board-nas4220b.o
63 --- a/arch/arm/mach-gemini/board-nas4220b.c
64 +++ b/arch/arm/mach-gemini/board-nas4220b.c
65 @@ -107,4 +107,5 @@ MACHINE_START(NAS4220B, "Raidsonic NAS I
66         .init_irq       = gemini_init_irq,
67         .timer          = &ib4220b_timer,
68         .init_machine   = ib4220b_init,
69 +       .restart        = gemini_restart,
70  MACHINE_END
71 --- a/arch/arm/mach-gemini/board-rut1xx.c
72 +++ b/arch/arm/mach-gemini/board-rut1xx.c
73 @@ -14,6 +14,7 @@
74  #include <linux/leds.h>
75  #include <linux/input.h>
76  #include <linux/gpio_keys.h>
77 +#include <linux/sizes.h>
78  
79  #include <asm/mach-types.h>
80  #include <asm/mach/arch.h>
81 @@ -91,4 +92,5 @@ MACHINE_START(RUT100, "Teltonika RUT100"
82         .init_irq       = gemini_init_irq,
83         .timer          = &rut1xx_timer,
84         .init_machine   = rut1xx_init,
85 +       .restart        = gemini_restart,
86  MACHINE_END
87 --- a/arch/arm/mach-gemini/board-wbd111.c
88 +++ b/arch/arm/mach-gemini/board-wbd111.c
89 @@ -134,4 +134,5 @@ MACHINE_START(WBD111, "Wiliboard WBD-111
90         .init_irq       = gemini_init_irq,
91         .timer          = &wbd111_timer,
92         .init_machine   = wbd111_init,
93 +       .restart        = gemini_restart,
94  MACHINE_END
95 --- a/arch/arm/mach-gemini/board-wbd222.c
96 +++ b/arch/arm/mach-gemini/board-wbd222.c
97 @@ -134,4 +134,5 @@ MACHINE_START(WBD222, "Wiliboard WBD-222
98         .init_irq       = gemini_init_irq,
99         .timer          = &wbd222_timer,
100         .init_machine   = wbd222_init,
101 +       .restart        = gemini_restart,
102  MACHINE_END
103 --- a/arch/arm/mach-gemini/common.h
104 +++ b/arch/arm/mach-gemini/common.h
105 @@ -26,4 +26,6 @@ extern int platform_register_pflash(unsi
106                                     struct mtd_partition *parts,
107                                     unsigned int nr_parts);
108  
109 +extern void gemini_restart(char mode, const char *cmd);
110 +
111  #endif /* __GEMINI_COMMON_H__ */
112 --- a/arch/arm/mach-gemini/gpio.c
113 +++ b/arch/arm/mach-gemini/gpio.c
114 @@ -21,6 +21,7 @@
115  
116  #include <mach/hardware.h>
117  #include <mach/irqs.h>
118 +#include <mach/gpio.h>
119  
120  #define GPIO_BASE(x)           IO_ADDRESS(GEMINI_GPIO_BASE(x))
121  
122 @@ -44,7 +45,7 @@
123  
124  #define GPIO_PORT_NUM          3
125  
126 -static void _set_gpio_irqenable(unsigned int base, unsigned int index,
127 +static void _set_gpio_irqenable(void __iomem *base, unsigned int index,
128                                 int enable)
129  {
130         unsigned int reg;
131 @@ -57,7 +58,7 @@ static void _set_gpio_irqenable(unsigned
132  static void gpio_ack_irq(struct irq_data *d)
133  {
134         unsigned int gpio = irq_to_gpio(d->irq);
135 -       unsigned int base = GPIO_BASE(gpio / 32);
136 +       void __iomem *base = GPIO_BASE(gpio / 32);
137  
138         __raw_writel(1 << (gpio % 32), base + GPIO_INT_CLR);
139  }
140 @@ -65,7 +66,7 @@ static void gpio_ack_irq(struct irq_data
141  static void gpio_mask_irq(struct irq_data *d)
142  {
143         unsigned int gpio = irq_to_gpio(d->irq);
144 -       unsigned int base = GPIO_BASE(gpio / 32);
145 +       void __iomem *base = GPIO_BASE(gpio / 32);
146  
147         _set_gpio_irqenable(base, gpio % 32, 0);
148  }
149 @@ -73,7 +74,7 @@ static void gpio_mask_irq(struct irq_dat
150  static void gpio_unmask_irq(struct irq_data *d)
151  {
152         unsigned int gpio = irq_to_gpio(d->irq);
153 -       unsigned int base = GPIO_BASE(gpio / 32);
154 +       void __iomem *base = GPIO_BASE(gpio / 32);
155  
156         _set_gpio_irqenable(base, gpio % 32, 1);
157  }
158 @@ -82,7 +83,7 @@ static int gpio_set_irq_type(struct irq_
159  {
160         unsigned int gpio = irq_to_gpio(d->irq);
161         unsigned int gpio_mask = 1 << (gpio % 32);
162 -       unsigned int base = GPIO_BASE(gpio / 32);
163 +       void __iomem *base = GPIO_BASE(gpio / 32);
164         unsigned int reg_both, reg_level, reg_type;
165  
166         reg_type = __raw_readl(base + GPIO_INT_TYPE);
167 @@ -120,7 +121,7 @@ static int gpio_set_irq_type(struct irq_
168         __raw_writel(reg_level, base + GPIO_INT_LEVEL);
169         __raw_writel(reg_both, base + GPIO_INT_BOTH_EDGE);
170  
171 -       gpio_ack_irq(d->irq);
172 +       gpio_ack_irq(d);
173  
174         return 0;
175  }
176 @@ -153,7 +154,7 @@ static struct irq_chip gpio_irq_chip = {
177  static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset,
178                                 int dir)
179  {
180 -       unsigned int base = GPIO_BASE(offset / 32);
181 +       void __iomem *base = GPIO_BASE(offset / 32);
182         unsigned int reg;
183  
184         reg = __raw_readl(base + GPIO_DIR);
185 @@ -166,7 +167,7 @@ static void _set_gpio_direction(struct g
186  
187  static void gemini_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
188  {
189 -       unsigned int base = GPIO_BASE(offset / 32);
190 +       void __iomem *base = GPIO_BASE(offset / 32);
191  
192         if (value)
193                 __raw_writel(1 << (offset % 32), base + GPIO_DATA_SET);
194 @@ -176,7 +177,7 @@ static void gemini_gpio_set(struct gpio_
195  
196  static int gemini_gpio_get(struct gpio_chip *chip, unsigned offset)
197  {
198 -       unsigned int base = GPIO_BASE(offset / 32);
199 +       void __iomem *base = GPIO_BASE(offset / 32);
200  
201         return (__raw_readl(base + GPIO_DATA_IN) >> (offset % 32)) & 1;
202  }
203 --- a/arch/arm/mach-gemini/include/mach/hardware.h
204 +++ b/arch/arm/mach-gemini/include/mach/hardware.h
205 @@ -69,6 +69,6 @@
206  /*
207   * macro to get at IO space when running virtually
208   */
209 -#define IO_ADDRESS(x)  ((((x) & 0xFFF00000) >> 4) | ((x) & 0x000FFFFF) | 0xF0000000)
210 +#define IO_ADDRESS(x)  IOMEM((((x) & 0xFFF00000) >> 4) | ((x) & 0x000FFFFF) | 0xF0000000)
211  
212  #endif
213 --- a/arch/arm/mach-gemini/include/mach/system.h
214 +++ /dev/null
215 @@ -1,23 +0,0 @@
216 -/*
217 - *  Copyright (C) 2001-2006 Storlink, Corp.
218 - *  Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
219 - *
220 - * This program is free software; you can redistribute it and/or modify
221 - * it under the terms of the GNU General Public License as published by
222 - * the Free Software Foundation; either version 2 of the License, or
223 - * (at your option) any later version.
224 - */
225 -#ifndef __MACH_SYSTEM_H
226 -#define __MACH_SYSTEM_H
227 -
228 -#include <linux/io.h>
229 -#include <mach/hardware.h>
230 -#include <mach/global_reg.h>
231 -
232 -static inline void arch_reset(char mode, const char *cmd)
233 -{
234 -       __raw_writel(RESET_GLOBAL | RESET_CPU1,
235 -                    IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_RESET);
236 -}
237 -
238 -#endif /* __MACH_SYSTEM_H */
239 --- a/arch/arm/mach-gemini/irq.c
240 +++ b/arch/arm/mach-gemini/irq.c
241 @@ -65,8 +65,8 @@ static struct irq_chip gemini_irq_chip =
242  
243  static struct resource irq_resource = {
244         .name   = "irq_handler",
245 -       .start  = IO_ADDRESS(GEMINI_INTERRUPT_BASE),
246 -       .end    = IO_ADDRESS(FIQ_STATUS(GEMINI_INTERRUPT_BASE)) + 4,
247 +       .start  = GEMINI_INTERRUPT_BASE,
248 +       .end    = FIQ_STATUS(GEMINI_INTERRUPT_BASE) + 4,
249  };
250  
251  void __init gemini_init_irq(void)
252 --- a/arch/arm/mach-gemini/mm.c
253 +++ b/arch/arm/mach-gemini/mm.c
254 @@ -19,57 +19,57 @@
255  /* Page table mapping for I/O region */
256  static struct map_desc gemini_io_desc[] __initdata = {
257         {
258 -               .virtual        = IO_ADDRESS(GEMINI_GLOBAL_BASE),
259 +               .virtual        = (unsigned long)IO_ADDRESS(GEMINI_GLOBAL_BASE),
260                 .pfn            =__phys_to_pfn(GEMINI_GLOBAL_BASE),
261                 .length         = SZ_512K,
262                 .type           = MT_DEVICE,
263         }, {
264 -               .virtual        = IO_ADDRESS(GEMINI_UART_BASE),
265 +               .virtual        = (unsigned long)IO_ADDRESS(GEMINI_UART_BASE),
266                 .pfn            = __phys_to_pfn(GEMINI_UART_BASE),
267                 .length         = SZ_512K,
268                 .type           = MT_DEVICE,
269         }, {
270 -               .virtual        = IO_ADDRESS(GEMINI_TIMER_BASE),
271 +               .virtual        = (unsigned long)IO_ADDRESS(GEMINI_TIMER_BASE),
272                 .pfn            = __phys_to_pfn(GEMINI_TIMER_BASE),
273                 .length         = SZ_512K,
274                 .type           = MT_DEVICE,
275         }, {
276 -               .virtual        = IO_ADDRESS(GEMINI_INTERRUPT_BASE),
277 +               .virtual        = (unsigned long)IO_ADDRESS(GEMINI_INTERRUPT_BASE),
278                 .pfn            = __phys_to_pfn(GEMINI_INTERRUPT_BASE),
279                 .length         = SZ_512K,
280                 .type           = MT_DEVICE,
281         }, {
282 -               .virtual        = IO_ADDRESS(GEMINI_POWER_CTRL_BASE),
283 +               .virtual        = (unsigned long)IO_ADDRESS(GEMINI_POWER_CTRL_BASE),
284                 .pfn            = __phys_to_pfn(GEMINI_POWER_CTRL_BASE),
285                 .length         = SZ_512K,
286                 .type           = MT_DEVICE,
287         }, {
288 -               .virtual        = IO_ADDRESS(GEMINI_GPIO_BASE(0)),
289 +               .virtual        = (unsigned long)IO_ADDRESS(GEMINI_GPIO_BASE(0)),
290                 .pfn            = __phys_to_pfn(GEMINI_GPIO_BASE(0)),
291                 .length         = SZ_512K,
292                 .type           = MT_DEVICE,
293         }, {
294 -               .virtual        = IO_ADDRESS(GEMINI_GPIO_BASE(1)),
295 +               .virtual        = (unsigned long)IO_ADDRESS(GEMINI_GPIO_BASE(1)),
296                 .pfn            = __phys_to_pfn(GEMINI_GPIO_BASE(1)),
297                 .length         = SZ_512K,
298                 .type           = MT_DEVICE,
299         }, {
300 -               .virtual        = IO_ADDRESS(GEMINI_GPIO_BASE(2)),
301 +               .virtual        = (unsigned long)IO_ADDRESS(GEMINI_GPIO_BASE(2)),
302                 .pfn            = __phys_to_pfn(GEMINI_GPIO_BASE(2)),
303                 .length         = SZ_512K,
304                 .type           = MT_DEVICE,
305         }, {
306 -               .virtual        = IO_ADDRESS(GEMINI_FLASH_CTRL_BASE),
307 +               .virtual        = (unsigned long)IO_ADDRESS(GEMINI_FLASH_CTRL_BASE),
308                 .pfn            = __phys_to_pfn(GEMINI_FLASH_CTRL_BASE),
309                 .length         = SZ_512K,
310                 .type           = MT_DEVICE,
311         }, {
312 -               .virtual        = IO_ADDRESS(GEMINI_DRAM_CTRL_BASE),
313 +               .virtual        = (unsigned long)IO_ADDRESS(GEMINI_DRAM_CTRL_BASE),
314                 .pfn            = __phys_to_pfn(GEMINI_DRAM_CTRL_BASE),
315                 .length         = SZ_512K,
316                 .type           = MT_DEVICE,
317         }, {
318 -               .virtual        = IO_ADDRESS(GEMINI_GENERAL_DMA_BASE),
319 +               .virtual        = (unsigned long)IO_ADDRESS(GEMINI_GENERAL_DMA_BASE),
320                 .pfn            = __phys_to_pfn(GEMINI_GENERAL_DMA_BASE),
321                 .length         = SZ_512K,
322                 .type           = MT_DEVICE,
323 --- /dev/null
324 +++ b/arch/arm/mach-gemini/reset.c
325 @@ -0,0 +1,23 @@
326 +/*
327 + *  Copyright (C) 2001-2006 Storlink, Corp.
328 + *  Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
329 + *
330 + * This program is free software; you can redistribute it and/or modify
331 + * it under the terms of the GNU General Public License as published by
332 + * the Free Software Foundation; either version 2 of the License, or
333 + * (at your option) any later version.
334 + */
335 +#ifndef __MACH_SYSTEM_H
336 +#define __MACH_SYSTEM_H
337 +
338 +#include <linux/io.h>
339 +#include <mach/hardware.h>
340 +#include <mach/global_reg.h>
341 +
342 +void gemini_restart(char mode, const char *cmd)
343 +{
344 +       __raw_writel(RESET_GLOBAL | RESET_CPU1,
345 +                    IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_RESET);
346 +}
347 +
348 +#endif /* __MACH_SYSTEM_H */