diff options
Diffstat (limited to 'arch/arm/mach-iop32x')
-rw-r--r-- | arch/arm/mach-iop32x/em7210.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-iop32x/glantank.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-iop32x/gpio-iop32x.h | 10 | ||||
-rw-r--r-- | arch/arm/mach-iop32x/include/mach/gpio.h | 6 | ||||
-rw-r--r-- | arch/arm/mach-iop32x/include/mach/iop32x.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-iop32x/iq31244.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-iop32x/iq80321.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-iop32x/n2100.c | 47 |
8 files changed, 57 insertions, 15 deletions
diff --git a/arch/arm/mach-iop32x/em7210.c b/arch/arm/mach-iop32x/em7210.c index 31fbb6c61b25..177cd073a83b 100644 --- a/arch/arm/mach-iop32x/em7210.c +++ b/arch/arm/mach-iop32x/em7210.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/mach/time.h> | 32 | #include <asm/mach/time.h> |
33 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
34 | #include <mach/time.h> | 34 | #include <mach/time.h> |
35 | #include "gpio-iop32x.h" | ||
35 | 36 | ||
36 | static void __init em7210_timer_init(void) | 37 | static void __init em7210_timer_init(void) |
37 | { | 38 | { |
@@ -183,6 +184,7 @@ void em7210_power_off(void) | |||
183 | 184 | ||
184 | static void __init em7210_init_machine(void) | 185 | static void __init em7210_init_machine(void) |
185 | { | 186 | { |
187 | register_iop32x_gpio(); | ||
186 | platform_device_register(&em7210_serial_device); | 188 | platform_device_register(&em7210_serial_device); |
187 | platform_device_register(&iop3xx_i2c0_device); | 189 | platform_device_register(&iop3xx_i2c0_device); |
188 | platform_device_register(&iop3xx_i2c1_device); | 190 | platform_device_register(&iop3xx_i2c1_device); |
diff --git a/arch/arm/mach-iop32x/glantank.c b/arch/arm/mach-iop32x/glantank.c index ac304705fe68..547b2342d61a 100644 --- a/arch/arm/mach-iop32x/glantank.c +++ b/arch/arm/mach-iop32x/glantank.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <asm/mach-types.h> | 34 | #include <asm/mach-types.h> |
35 | #include <asm/page.h> | 35 | #include <asm/page.h> |
36 | #include <mach/time.h> | 36 | #include <mach/time.h> |
37 | #include "gpio-iop32x.h" | ||
37 | 38 | ||
38 | /* | 39 | /* |
39 | * GLAN Tank timer tick configuration. | 40 | * GLAN Tank timer tick configuration. |
@@ -187,6 +188,7 @@ static void glantank_power_off(void) | |||
187 | 188 | ||
188 | static void __init glantank_init_machine(void) | 189 | static void __init glantank_init_machine(void) |
189 | { | 190 | { |
191 | register_iop32x_gpio(); | ||
190 | platform_device_register(&iop3xx_i2c0_device); | 192 | platform_device_register(&iop3xx_i2c0_device); |
191 | platform_device_register(&iop3xx_i2c1_device); | 193 | platform_device_register(&iop3xx_i2c1_device); |
192 | platform_device_register(&glantank_flash_device); | 194 | platform_device_register(&glantank_flash_device); |
diff --git a/arch/arm/mach-iop32x/gpio-iop32x.h b/arch/arm/mach-iop32x/gpio-iop32x.h new file mode 100644 index 000000000000..3c7309c02029 --- /dev/null +++ b/arch/arm/mach-iop32x/gpio-iop32x.h | |||
@@ -0,0 +1,10 @@ | |||
1 | static struct resource iop32x_gpio_res[] = { | ||
2 | DEFINE_RES_MEM((IOP3XX_PERIPHERAL_PHYS_BASE + 0x07c4), 0x10), | ||
3 | }; | ||
4 | |||
5 | static inline void register_iop32x_gpio(void) | ||
6 | { | ||
7 | platform_device_register_simple("gpio-iop", 0, | ||
8 | iop32x_gpio_res, | ||
9 | ARRAY_SIZE(iop32x_gpio_res)); | ||
10 | } | ||
diff --git a/arch/arm/mach-iop32x/include/mach/gpio.h b/arch/arm/mach-iop32x/include/mach/gpio.h deleted file mode 100644 index 708f4ec9db1d..000000000000 --- a/arch/arm/mach-iop32x/include/mach/gpio.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __ASM_ARCH_IOP32X_GPIO_H | ||
2 | #define __ASM_ARCH_IOP32X_GPIO_H | ||
3 | |||
4 | #include <asm/hardware/iop3xx-gpio.h> | ||
5 | |||
6 | #endif | ||
diff --git a/arch/arm/mach-iop32x/include/mach/iop32x.h b/arch/arm/mach-iop32x/include/mach/iop32x.h index 941f363aca56..56ec864ec313 100644 --- a/arch/arm/mach-iop32x/include/mach/iop32x.h +++ b/arch/arm/mach-iop32x/include/mach/iop32x.h | |||
@@ -19,7 +19,6 @@ | |||
19 | * Peripherals that are shared between the iop32x and iop33x but | 19 | * Peripherals that are shared between the iop32x and iop33x but |
20 | * located at different addresses. | 20 | * located at different addresses. |
21 | */ | 21 | */ |
22 | #define IOP3XX_GPIO_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x07c4 + (reg)) | ||
23 | #define IOP3XX_TIMER_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x07e0 + (reg)) | 22 | #define IOP3XX_TIMER_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x07e0 + (reg)) |
24 | 23 | ||
25 | #include <asm/hardware/iop3xx.h> | 24 | #include <asm/hardware/iop3xx.h> |
diff --git a/arch/arm/mach-iop32x/iq31244.c b/arch/arm/mach-iop32x/iq31244.c index f2cd2966212d..0e1392b20d18 100644 --- a/arch/arm/mach-iop32x/iq31244.c +++ b/arch/arm/mach-iop32x/iq31244.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <asm/page.h> | 37 | #include <asm/page.h> |
38 | #include <asm/pgtable.h> | 38 | #include <asm/pgtable.h> |
39 | #include <mach/time.h> | 39 | #include <mach/time.h> |
40 | #include "gpio-iop32x.h" | ||
40 | 41 | ||
41 | /* | 42 | /* |
42 | * Until March of 2007 iq31244 platforms and ep80219 platforms shared the | 43 | * Until March of 2007 iq31244 platforms and ep80219 platforms shared the |
@@ -283,6 +284,7 @@ void ep80219_power_off(void) | |||
283 | 284 | ||
284 | static void __init iq31244_init_machine(void) | 285 | static void __init iq31244_init_machine(void) |
285 | { | 286 | { |
287 | register_iop32x_gpio(); | ||
286 | platform_device_register(&iop3xx_i2c0_device); | 288 | platform_device_register(&iop3xx_i2c0_device); |
287 | platform_device_register(&iop3xx_i2c1_device); | 289 | platform_device_register(&iop3xx_i2c1_device); |
288 | platform_device_register(&iq31244_flash_device); | 290 | platform_device_register(&iq31244_flash_device); |
diff --git a/arch/arm/mach-iop32x/iq80321.c b/arch/arm/mach-iop32x/iq80321.c index 015435de90dd..66782ff1f46a 100644 --- a/arch/arm/mach-iop32x/iq80321.c +++ b/arch/arm/mach-iop32x/iq80321.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <asm/page.h> | 33 | #include <asm/page.h> |
34 | #include <asm/pgtable.h> | 34 | #include <asm/pgtable.h> |
35 | #include <mach/time.h> | 35 | #include <mach/time.h> |
36 | #include "gpio-iop32x.h" | ||
36 | 37 | ||
37 | /* | 38 | /* |
38 | * IQ80321 timer tick configuration. | 39 | * IQ80321 timer tick configuration. |
@@ -170,6 +171,7 @@ static struct platform_device iq80321_serial_device = { | |||
170 | 171 | ||
171 | static void __init iq80321_init_machine(void) | 172 | static void __init iq80321_init_machine(void) |
172 | { | 173 | { |
174 | register_iop32x_gpio(); | ||
173 | platform_device_register(&iop3xx_i2c0_device); | 175 | platform_device_register(&iop3xx_i2c0_device); |
174 | platform_device_register(&iop3xx_i2c1_device); | 176 | platform_device_register(&iop3xx_i2c1_device); |
175 | platform_device_register(&iq80321_flash_device); | 177 | platform_device_register(&iq80321_flash_device); |
diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c index 069144300b77..c1cd80ecc219 100644 --- a/arch/arm/mach-iop32x/n2100.c +++ b/arch/arm/mach-iop32x/n2100.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
31 | #include <linux/reboot.h> | 31 | #include <linux/reboot.h> |
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | #include <linux/gpio.h> | ||
33 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
34 | #include <asm/irq.h> | 35 | #include <asm/irq.h> |
35 | #include <asm/mach/arch.h> | 36 | #include <asm/mach/arch.h> |
@@ -40,6 +41,7 @@ | |||
40 | #include <asm/page.h> | 41 | #include <asm/page.h> |
41 | #include <asm/pgtable.h> | 42 | #include <asm/pgtable.h> |
42 | #include <mach/time.h> | 43 | #include <mach/time.h> |
44 | #include "gpio-iop32x.h" | ||
43 | 45 | ||
44 | /* | 46 | /* |
45 | * N2100 timer tick configuration. | 47 | * N2100 timer tick configuration. |
@@ -288,8 +290,14 @@ static void n2100_power_off(void) | |||
288 | 290 | ||
289 | static void n2100_restart(enum reboot_mode mode, const char *cmd) | 291 | static void n2100_restart(enum reboot_mode mode, const char *cmd) |
290 | { | 292 | { |
291 | gpio_line_set(N2100_HARDWARE_RESET, GPIO_LOW); | 293 | int ret; |
292 | gpio_line_config(N2100_HARDWARE_RESET, GPIO_OUT); | 294 | |
295 | ret = gpio_direction_output(N2100_HARDWARE_RESET, 0); | ||
296 | if (ret) { | ||
297 | pr_crit("could not drive reset GPIO low\n"); | ||
298 | return; | ||
299 | } | ||
300 | /* Wait for reset to happen */ | ||
293 | while (1) | 301 | while (1) |
294 | ; | 302 | ; |
295 | } | 303 | } |
@@ -299,7 +307,7 @@ static struct timer_list power_button_poll_timer; | |||
299 | 307 | ||
300 | static void power_button_poll(unsigned long dummy) | 308 | static void power_button_poll(unsigned long dummy) |
301 | { | 309 | { |
302 | if (gpio_line_get(N2100_POWER_BUTTON) == 0) { | 310 | if (gpio_get_value(N2100_POWER_BUTTON) == 0) { |
303 | ctrl_alt_del(); | 311 | ctrl_alt_del(); |
304 | return; | 312 | return; |
305 | } | 313 | } |
@@ -308,9 +316,37 @@ static void power_button_poll(unsigned long dummy) | |||
308 | add_timer(&power_button_poll_timer); | 316 | add_timer(&power_button_poll_timer); |
309 | } | 317 | } |
310 | 318 | ||
319 | static int __init n2100_request_gpios(void) | ||
320 | { | ||
321 | int ret; | ||
322 | |||
323 | if (!machine_is_n2100()) | ||
324 | return 0; | ||
325 | |||
326 | ret = gpio_request(N2100_HARDWARE_RESET, "reset"); | ||
327 | if (ret) | ||
328 | pr_err("could not request reset GPIO\n"); | ||
329 | |||
330 | ret = gpio_request(N2100_POWER_BUTTON, "power"); | ||
331 | if (ret) | ||
332 | pr_err("could not request power GPIO\n"); | ||
333 | else { | ||
334 | ret = gpio_direction_input(N2100_POWER_BUTTON); | ||
335 | if (ret) | ||
336 | pr_err("could not set power GPIO as input\n"); | ||
337 | } | ||
338 | /* Set up power button poll timer */ | ||
339 | init_timer(&power_button_poll_timer); | ||
340 | power_button_poll_timer.function = power_button_poll; | ||
341 | power_button_poll_timer.expires = jiffies + (HZ / 10); | ||
342 | add_timer(&power_button_poll_timer); | ||
343 | return 0; | ||
344 | } | ||
345 | device_initcall(n2100_request_gpios); | ||
311 | 346 | ||
312 | static void __init n2100_init_machine(void) | 347 | static void __init n2100_init_machine(void) |
313 | { | 348 | { |
349 | register_iop32x_gpio(); | ||
314 | platform_device_register(&iop3xx_i2c0_device); | 350 | platform_device_register(&iop3xx_i2c0_device); |
315 | platform_device_register(&n2100_flash_device); | 351 | platform_device_register(&n2100_flash_device); |
316 | platform_device_register(&n2100_serial_device); | 352 | platform_device_register(&n2100_serial_device); |
@@ -321,11 +357,6 @@ static void __init n2100_init_machine(void) | |||
321 | ARRAY_SIZE(n2100_i2c_devices)); | 357 | ARRAY_SIZE(n2100_i2c_devices)); |
322 | 358 | ||
323 | pm_power_off = n2100_power_off; | 359 | pm_power_off = n2100_power_off; |
324 | |||
325 | init_timer(&power_button_poll_timer); | ||
326 | power_button_poll_timer.function = power_button_poll; | ||
327 | power_button_poll_timer.expires = jiffies + (HZ / 10); | ||
328 | add_timer(&power_button_poll_timer); | ||
329 | } | 360 | } |
330 | 361 | ||
331 | MACHINE_START(N2100, "Thecus N2100") | 362 | MACHINE_START(N2100, "Thecus N2100") |