1 From patchwork Fri Jan 4 15:30:38 2013
2 Content-Type: text/plain; charset="utf-8"
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
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.
20 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
23 (retransmitted because the original was rejected by linux-arm-kernel)
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
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
51 Support for the Cortina Systems Gemini family SoCs
52 --- a/arch/arm/mach-gemini/Makefile
53 +++ b/arch/arm/mach-gemini/Makefile
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
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,
71 --- a/arch/arm/mach-gemini/board-rut1xx.c
72 +++ b/arch/arm/mach-gemini/board-rut1xx.c
74 #include <linux/leds.h>
75 #include <linux/input.h>
76 #include <linux/gpio_keys.h>
77 +#include <linux/sizes.h>
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,
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,
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,
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);
109 +extern void gemini_restart(char mode, const char *cmd);
111 #endif /* __GEMINI_COMMON_H__ */
112 --- a/arch/arm/mach-gemini/gpio.c
113 +++ b/arch/arm/mach-gemini/gpio.c
116 #include <mach/hardware.h>
117 #include <mach/irqs.h>
118 +#include <mach/gpio.h>
120 #define GPIO_BASE(x) IO_ADDRESS(GEMINI_GPIO_BASE(x))
124 #define GPIO_PORT_NUM 3
126 -static void _set_gpio_irqenable(unsigned int base, unsigned int index,
127 +static void _set_gpio_irqenable(void __iomem *base, unsigned int index,
131 @@ -57,7 +58,7 @@ static void _set_gpio_irqenable(unsigned
132 static void gpio_ack_irq(struct irq_data *d)
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);
138 __raw_writel(1 << (gpio % 32), base + GPIO_INT_CLR);
140 @@ -65,7 +66,7 @@ static void gpio_ack_irq(struct irq_data
141 static void gpio_mask_irq(struct irq_data *d)
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);
147 _set_gpio_irqenable(base, gpio % 32, 0);
149 @@ -73,7 +74,7 @@ static void gpio_mask_irq(struct irq_dat
150 static void gpio_unmask_irq(struct irq_data *d)
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);
156 _set_gpio_irqenable(base, gpio % 32, 1);
158 @@ -82,7 +83,7 @@ static int gpio_set_irq_type(struct irq_
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;
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);
171 - gpio_ack_irq(d->irq);
176 @@ -153,7 +154,7 @@ static struct irq_chip gpio_irq_chip = {
177 static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset,
180 - unsigned int base = GPIO_BASE(offset / 32);
181 + void __iomem *base = GPIO_BASE(offset / 32);
184 reg = __raw_readl(base + GPIO_DIR);
185 @@ -166,7 +167,7 @@ static void _set_gpio_direction(struct g
187 static void gemini_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
189 - unsigned int base = GPIO_BASE(offset / 32);
190 + void __iomem *base = GPIO_BASE(offset / 32);
193 __raw_writel(1 << (offset % 32), base + GPIO_DATA_SET);
194 @@ -176,7 +177,7 @@ static void gemini_gpio_set(struct gpio_
196 static int gemini_gpio_get(struct gpio_chip *chip, unsigned offset)
198 - unsigned int base = GPIO_BASE(offset / 32);
199 + void __iomem *base = GPIO_BASE(offset / 32);
201 return (__raw_readl(base + GPIO_DATA_IN) >> (offset % 32)) & 1;
203 --- a/arch/arm/mach-gemini/include/mach/hardware.h
204 +++ b/arch/arm/mach-gemini/include/mach/hardware.h
207 * macro to get at IO space when running virtually
209 -#define IO_ADDRESS(x) ((((x) & 0xFFF00000) >> 4) | ((x) & 0x000FFFFF) | 0xF0000000)
210 +#define IO_ADDRESS(x) IOMEM((((x) & 0xFFF00000) >> 4) | ((x) & 0x000FFFFF) | 0xF0000000)
213 --- a/arch/arm/mach-gemini/include/mach/system.h
217 - * Copyright (C) 2001-2006 Storlink, Corp.
218 - * Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
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.
225 -#ifndef __MACH_SYSTEM_H
226 -#define __MACH_SYSTEM_H
228 -#include <linux/io.h>
229 -#include <mach/hardware.h>
230 -#include <mach/global_reg.h>
232 -static inline void arch_reset(char mode, const char *cmd)
234 - __raw_writel(RESET_GLOBAL | RESET_CPU1,
235 - IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_RESET);
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 =
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,
251 void __init gemini_init_irq(void)
252 --- a/arch/arm/mach-gemini/mm.c
253 +++ b/arch/arm/mach-gemini/mm.c
255 /* Page table mapping for I/O region */
256 static struct map_desc gemini_io_desc[] __initdata = {
258 - .virtual = IO_ADDRESS(GEMINI_GLOBAL_BASE),
259 + .virtual = (unsigned long)IO_ADDRESS(GEMINI_GLOBAL_BASE),
260 .pfn =__phys_to_pfn(GEMINI_GLOBAL_BASE),
264 - .virtual = IO_ADDRESS(GEMINI_UART_BASE),
265 + .virtual = (unsigned long)IO_ADDRESS(GEMINI_UART_BASE),
266 .pfn = __phys_to_pfn(GEMINI_UART_BASE),
270 - .virtual = IO_ADDRESS(GEMINI_TIMER_BASE),
271 + .virtual = (unsigned long)IO_ADDRESS(GEMINI_TIMER_BASE),
272 .pfn = __phys_to_pfn(GEMINI_TIMER_BASE),
276 - .virtual = IO_ADDRESS(GEMINI_INTERRUPT_BASE),
277 + .virtual = (unsigned long)IO_ADDRESS(GEMINI_INTERRUPT_BASE),
278 .pfn = __phys_to_pfn(GEMINI_INTERRUPT_BASE),
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),
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)),
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)),
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)),
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),
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),
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),
324 +++ b/arch/arm/mach-gemini/reset.c
327 + * Copyright (C) 2001-2006 Storlink, Corp.
328 + * Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
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.
335 +#ifndef __MACH_SYSTEM_H
336 +#define __MACH_SYSTEM_H
338 +#include <linux/io.h>
339 +#include <mach/hardware.h>
340 +#include <mach/global_reg.h>
342 +void gemini_restart(char mode, const char *cmd)
344 + __raw_writel(RESET_GLOBAL | RESET_CPU1,
345 + IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_RESET);
348 +#endif /* __MACH_SYSTEM_H */