aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 01:50:46 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 01:50:46 -0500
commitc2d33069915d1f9b3b1dcc2199af11d4e072b037 (patch)
tree2664fd3c41c2f3223cfbb64793c2ddb8e9087ded /arch
parent8a5dc585d50015af9c079ae2d182dc4c1cd22914 (diff)
parent993571273275bfecb5161806796eb368db234106 (diff)
Merge tag 'gpio-v3.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO changes from Linus Walleij: "Here is the bulk of GPIO changes for the v3.13 development cycle. I've got ACKs for the things that affect other subsystems (or it's my own subsystem, like pinctrl). Most of that pertain to an attempt from my side to consolidate and get rid of custom GPIO implementations in the ARM tree. I will continue doing this. The main change this time is the new GPIO descriptor API, background for this can be found in Corbet's summary from this january in LWN: http://lwn.net/Articles/533632/ Summary: - Merged the GPIO descriptor API from Alexandre Courbot. This is a first step toward trying to get rid of the global GPIO numberspace for the future. - Add an API so that driver can flag that a certain GPIO line is being used by a irqchip backend for generating IRQs, so that we can enforce checks, like not allowing users to switch that line to an output at runtime, since this makes no sense. Implemented corresponding calls in a few select drivers. - ACPI GPIO cleanups, refactorings and switch to using the descriptor-based interface. - Support for the TPS80036 Palmas GPIO variant. - A new driver for the Broadcom Kona GPIO SoC IP block. - Device tree support for the PCF857x driver. - A set of ARM GPIO refactorings with the goal of getting rid of a bunch of custom GPIO implementations from the arch/arm/* tree: * Move the IOP GPIO driver to the GPIO subsystem and fix all users to use the gpiolib API for accessing GPIOs. Delete the old custom GPIO implementation. * Delete the unused custom PXA GPIO implemention. * Convert all users of the IXP4 custom GPIO implementation to use gpiolib and delete the custom implementation. * Delete the custom Gemini GPIO implementation, also completely unused. - Various cleanups and renamings" * tag 'gpio-v3.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (85 commits) gpio: gpio-mxs: Remove unneeded dt checks gpio: pl061: don't depend on CONFIG_ARM gpio: bcm-kona: add missing .owner to struct gpio_chip gpiolib: provide a declaration of seq_file in gpio/driver.h gpiolib: include gpio/consumer.h in of_gpio.h for desc_to_gpio() gpio: provide stubs for devres gpio functions gpiolib: devres: add missing headers gpiolib: make GPIO_DEVRES depend on GPIOLIB gpiolib: devres: fix devm_gpiod_get_index() gpiolib / ACPI: document the GPIO descriptor based interface gpiolib / ACPI: allow passing GPIOF_ACTIVE_LOW for GpioInt resources gpiolib / ACPI: add ACPI support for gpiod_get_index() gpiolib / ACPI: convert to gpiod interfaces gpiolib: add gpiod_get() and gpiod_put() functions gpiolib: port of_ functions to use gpiod gpiolib: export descriptor-based GPIO interface Fixup "MAINTAINERS: GPIO-INTEL-MID: add maintainer" gpio: bcm281xx: Don't print addresses of GPIO area in probe() gpio: tegra: use new gpio_lock_as_irq() API gpio: rcar: Include linux/of.h header ...
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig7
-rw-r--r--arch/arm/include/asm/hardware/iop3xx-gpio.h75
-rw-r--r--arch/arm/include/asm/hardware/iop3xx.h12
-rw-r--r--arch/arm/mach-gemini/gpio.c2
-rw-r--r--arch/arm/mach-gemini/include/mach/gpio.h20
-rw-r--r--arch/arm/mach-iop32x/em7210.c2
-rw-r--r--arch/arm/mach-iop32x/glantank.c2
-rw-r--r--arch/arm/mach-iop32x/gpio-iop32x.h10
-rw-r--r--arch/arm/mach-iop32x/include/mach/gpio.h6
-rw-r--r--arch/arm/mach-iop32x/include/mach/iop32x.h1
-rw-r--r--arch/arm/mach-iop32x/iq31244.c2
-rw-r--r--arch/arm/mach-iop32x/iq80321.c2
-rw-r--r--arch/arm/mach-iop32x/n2100.c47
-rw-r--r--arch/arm/mach-iop33x/include/mach/gpio.h6
-rw-r--r--arch/arm/mach-iop33x/include/mach/iop33x.h1
-rw-r--r--arch/arm/mach-iop33x/iq80331.c7
-rw-r--r--arch/arm/mach-iop33x/iq80332.c7
-rw-r--r--arch/arm/mach-ixp4xx/common.c49
-rw-r--r--arch/arm/mach-ixp4xx/dsmg600-setup.c65
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/platform.h39
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-setup.c8
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-setup.c49
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-setup.c17
-rw-r--r--arch/arm/mach-mmp/include/mach/gpio.h8
-rw-r--r--arch/arm/mach-pxa/include/mach/gpio.h32
-rw-r--r--arch/arm/mach-w90x900/include/mach/gpio.h30
-rw-r--r--arch/arm/plat-iop/Makefile2
-rw-r--r--arch/arm/plat-iop/gpio.c93
28 files changed, 197 insertions, 404 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index aa8300333bc5..acb80708accd 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -389,7 +389,6 @@ config ARCH_GEMINI
389 select CLKSRC_MMIO 389 select CLKSRC_MMIO
390 select CPU_FA526 390 select CPU_FA526
391 select GENERIC_CLOCKEVENTS 391 select GENERIC_CLOCKEVENTS
392 select NEED_MACH_GPIO_H
393 help 392 help
394 Support for the Cortina Systems Gemini family SoCs 393 Support for the Cortina Systems Gemini family SoCs
395 394
@@ -458,7 +457,7 @@ config ARCH_IOP32X
458 depends on MMU 457 depends on MMU
459 select ARCH_REQUIRE_GPIOLIB 458 select ARCH_REQUIRE_GPIOLIB
460 select CPU_XSCALE 459 select CPU_XSCALE
461 select NEED_MACH_GPIO_H 460 select GPIO_IOP
462 select NEED_RET_TO_USER 461 select NEED_RET_TO_USER
463 select PCI 462 select PCI
464 select PLAT_IOP 463 select PLAT_IOP
@@ -471,7 +470,7 @@ config ARCH_IOP33X
471 depends on MMU 470 depends on MMU
472 select ARCH_REQUIRE_GPIOLIB 471 select ARCH_REQUIRE_GPIOLIB
473 select CPU_XSCALE 472 select CPU_XSCALE
474 select NEED_MACH_GPIO_H 473 select GPIO_IOP
475 select NEED_RET_TO_USER 474 select NEED_RET_TO_USER
476 select PCI 475 select PCI
477 select PLAT_IOP 476 select PLAT_IOP
@@ -560,7 +559,6 @@ config ARCH_MMP
560 select GPIO_PXA 559 select GPIO_PXA
561 select IRQ_DOMAIN 560 select IRQ_DOMAIN
562 select MULTI_IRQ_HANDLER 561 select MULTI_IRQ_HANDLER
563 select NEED_MACH_GPIO_H
564 select PINCTRL 562 select PINCTRL
565 select PLAT_PXA 563 select PLAT_PXA
566 select SPARSE_IRQ 564 select SPARSE_IRQ
@@ -623,7 +621,6 @@ config ARCH_PXA
623 select GPIO_PXA 621 select GPIO_PXA
624 select HAVE_IDE 622 select HAVE_IDE
625 select MULTI_IRQ_HANDLER 623 select MULTI_IRQ_HANDLER
626 select NEED_MACH_GPIO_H
627 select PLAT_PXA 624 select PLAT_PXA
628 select SPARSE_IRQ 625 select SPARSE_IRQ
629 help 626 help
diff --git a/arch/arm/include/asm/hardware/iop3xx-gpio.h b/arch/arm/include/asm/hardware/iop3xx-gpio.h
deleted file mode 100644
index 9eda7dc92ad8..000000000000
--- a/arch/arm/include/asm/hardware/iop3xx-gpio.h
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * arch/arm/include/asm/hardware/iop3xx-gpio.h
3 *
4 * IOP3xx GPIO wrappers
5 *
6 * Copyright (c) 2008 Arnaud Patard <arnaud.patard@rtp-net.org>
7 * Based on IXP4XX gpio.h file
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#ifndef __ASM_ARM_HARDWARE_IOP3XX_GPIO_H
26#define __ASM_ARM_HARDWARE_IOP3XX_GPIO_H
27
28#include <mach/hardware.h>
29#include <asm-generic/gpio.h>
30
31#define __ARM_GPIOLIB_COMPLEX
32
33#define IOP3XX_N_GPIOS 8
34
35static inline int gpio_get_value(unsigned gpio)
36{
37 if (gpio > IOP3XX_N_GPIOS)
38 return __gpio_get_value(gpio);
39
40 return gpio_line_get(gpio);
41}
42
43static inline void gpio_set_value(unsigned gpio, int value)
44{
45 if (gpio > IOP3XX_N_GPIOS) {
46 __gpio_set_value(gpio, value);
47 return;
48 }
49 gpio_line_set(gpio, value);
50}
51
52static inline int gpio_cansleep(unsigned gpio)
53{
54 if (gpio < IOP3XX_N_GPIOS)
55 return 0;
56 else
57 return __gpio_cansleep(gpio);
58}
59
60/*
61 * The GPIOs are not generating any interrupt
62 * Note : manuals are not clear about this
63 */
64static inline int gpio_to_irq(int gpio)
65{
66 return -EINVAL;
67}
68
69static inline int irq_to_gpio(int gpio)
70{
71 return -EINVAL;
72}
73
74#endif
75
diff --git a/arch/arm/include/asm/hardware/iop3xx.h b/arch/arm/include/asm/hardware/iop3xx.h
index 423744bf18eb..2594a95ff19a 100644
--- a/arch/arm/include/asm/hardware/iop3xx.h
+++ b/arch/arm/include/asm/hardware/iop3xx.h
@@ -18,16 +18,9 @@
18/* 18/*
19 * IOP3XX GPIO handling 19 * IOP3XX GPIO handling
20 */ 20 */
21#define GPIO_IN 0
22#define GPIO_OUT 1
23#define GPIO_LOW 0
24#define GPIO_HIGH 1
25#define IOP3XX_GPIO_LINE(x) (x) 21#define IOP3XX_GPIO_LINE(x) (x)
26 22
27#ifndef __ASSEMBLY__ 23#ifndef __ASSEMBLY__
28extern void gpio_line_config(int line, int direction);
29extern int gpio_line_get(int line);
30extern void gpio_line_set(int line, int value);
31extern int init_atu; 24extern int init_atu;
32extern int iop3xx_get_init_atu(void); 25extern int iop3xx_get_init_atu(void);
33#endif 26#endif
@@ -168,11 +161,6 @@ extern int iop3xx_get_init_atu(void);
168/* PERCR0 DOESN'T EXIST - index from 1! */ 161/* PERCR0 DOESN'T EXIST - index from 1! */
169#define IOP3XX_PERCR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0710) 162#define IOP3XX_PERCR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0710)
170 163
171/* General Purpose I/O */
172#define IOP3XX_GPOE (volatile u32 *)IOP3XX_GPIO_REG(0x0000)
173#define IOP3XX_GPID (volatile u32 *)IOP3XX_GPIO_REG(0x0004)
174#define IOP3XX_GPOD (volatile u32 *)IOP3XX_GPIO_REG(0x0008)
175
176/* Timers */ 164/* Timers */
177#define IOP3XX_TU_TMR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0000) 165#define IOP3XX_TU_TMR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0000)
178#define IOP3XX_TU_TMR1 (volatile u32 *)IOP3XX_TIMER_REG(0x0004) 166#define IOP3XX_TU_TMR1 (volatile u32 *)IOP3XX_TIMER_REG(0x0004)
diff --git a/arch/arm/mach-gemini/gpio.c b/arch/arm/mach-gemini/gpio.c
index 70bfa571b24b..f8cb5710d6ee 100644
--- a/arch/arm/mach-gemini/gpio.c
+++ b/arch/arm/mach-gemini/gpio.c
@@ -21,9 +21,9 @@
21 21
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23#include <mach/irqs.h> 23#include <mach/irqs.h>
24#include <mach/gpio.h>
25 24
26#define GPIO_BASE(x) IO_ADDRESS(GEMINI_GPIO_BASE(x)) 25#define GPIO_BASE(x) IO_ADDRESS(GEMINI_GPIO_BASE(x))
26#define irq_to_gpio(x) ((x) - GPIO_IRQ_BASE)
27 27
28/* GPIO registers definition */ 28/* GPIO registers definition */
29#define GPIO_DATA_OUT 0x0 29#define GPIO_DATA_OUT 0x0
diff --git a/arch/arm/mach-gemini/include/mach/gpio.h b/arch/arm/mach-gemini/include/mach/gpio.h
deleted file mode 100644
index 40a0527bada7..000000000000
--- a/arch/arm/mach-gemini/include/mach/gpio.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Gemini gpiolib specific defines
3 *
4 * Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef __MACH_GPIO_H__
13#define __MACH_GPIO_H__
14
15#include <mach/irqs.h>
16
17#define gpio_to_irq(x) ((x) + GPIO_IRQ_BASE)
18#define irq_to_gpio(x) ((x) - GPIO_IRQ_BASE)
19
20#endif /* __MACH_GPIO_H__ */
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
36static void __init em7210_timer_init(void) 37static void __init em7210_timer_init(void)
37{ 38{
@@ -183,6 +184,7 @@ void em7210_power_off(void)
183 184
184static void __init em7210_init_machine(void) 185static 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
188static void __init glantank_init_machine(void) 189static 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 @@
1static struct resource iop32x_gpio_res[] = {
2 DEFINE_RES_MEM((IOP3XX_PERIPHERAL_PHYS_BASE + 0x07c4), 0x10),
3};
4
5static 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
284static void __init iq31244_init_machine(void) 285static 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
171static void __init iq80321_init_machine(void) 172static 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
289static void n2100_restart(enum reboot_mode mode, const char *cmd) 291static 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
300static void power_button_poll(unsigned long dummy) 308static 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
319static 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}
345device_initcall(n2100_request_gpios);
311 346
312static void __init n2100_init_machine(void) 347static 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
331MACHINE_START(N2100, "Thecus N2100") 362MACHINE_START(N2100, "Thecus N2100")
diff --git a/arch/arm/mach-iop33x/include/mach/gpio.h b/arch/arm/mach-iop33x/include/mach/gpio.h
deleted file mode 100644
index ddd55bba9bb9..000000000000
--- a/arch/arm/mach-iop33x/include/mach/gpio.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_ARCH_IOP33X_GPIO_H
2#define __ASM_ARCH_IOP33X_GPIO_H
3
4#include <asm/hardware/iop3xx-gpio.h>
5
6#endif
diff --git a/arch/arm/mach-iop33x/include/mach/iop33x.h b/arch/arm/mach-iop33x/include/mach/iop33x.h
index a89c0a234bff..c95122653094 100644
--- a/arch/arm/mach-iop33x/include/mach/iop33x.h
+++ b/arch/arm/mach-iop33x/include/mach/iop33x.h
@@ -18,7 +18,6 @@
18 * Peripherals that are shared between the iop32x and iop33x but 18 * Peripherals that are shared between the iop32x and iop33x but
19 * located at different addresses. 19 * located at different addresses.
20 */ 20 */
21#define IOP3XX_GPIO_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x1780 + (reg))
22#define IOP3XX_TIMER_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x07d0 + (reg)) 21#define IOP3XX_TIMER_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x07d0 + (reg))
23 22
24#include <asm/hardware/iop3xx.h> 23#include <asm/hardware/iop3xx.h>
diff --git a/arch/arm/mach-iop33x/iq80331.c b/arch/arm/mach-iop33x/iq80331.c
index c43304a10fa7..e2cb65cfbe23 100644
--- a/arch/arm/mach-iop33x/iq80331.c
+++ b/arch/arm/mach-iop33x/iq80331.c
@@ -122,8 +122,15 @@ static struct platform_device iq80331_flash_device = {
122 .resource = &iq80331_flash_resource, 122 .resource = &iq80331_flash_resource,
123}; 123};
124 124
125static struct resource iq80331_gpio_res[] = {
126 DEFINE_RES_MEM((IOP3XX_PERIPHERAL_PHYS_BASE + 0x1780), 0x10),
127};
128
125static void __init iq80331_init_machine(void) 129static void __init iq80331_init_machine(void)
126{ 130{
131 platform_device_register_simple("gpio-iop", 0,
132 iq80331_gpio_res,
133 ARRAY_SIZE(iq80331_gpio_res));
127 platform_device_register(&iop3xx_i2c0_device); 134 platform_device_register(&iop3xx_i2c0_device);
128 platform_device_register(&iop3xx_i2c1_device); 135 platform_device_register(&iop3xx_i2c1_device);
129 platform_device_register(&iop33x_uart0_device); 136 platform_device_register(&iop33x_uart0_device);
diff --git a/arch/arm/mach-iop33x/iq80332.c b/arch/arm/mach-iop33x/iq80332.c
index 8192987e78e5..0b6269d94f89 100644
--- a/arch/arm/mach-iop33x/iq80332.c
+++ b/arch/arm/mach-iop33x/iq80332.c
@@ -122,8 +122,15 @@ static struct platform_device iq80332_flash_device = {
122 .resource = &iq80332_flash_resource, 122 .resource = &iq80332_flash_resource,
123}; 123};
124 124
125static struct resource iq80332_gpio_res[] = {
126 DEFINE_RES_MEM((IOP3XX_PERIPHERAL_PHYS_BASE + 0x1780), 0x10),
127};
128
125static void __init iq80332_init_machine(void) 129static void __init iq80332_init_machine(void)
126{ 130{
131 platform_device_register_simple("gpio-iop", 0,
132 iq80332_gpio_res,
133 ARRAY_SIZE(iq80332_gpio_res));
127 platform_device_register(&iop3xx_i2c0_device); 134 platform_device_register(&iop3xx_i2c0_device);
128 platform_device_register(&iop3xx_i2c1_device); 135 platform_device_register(&iop3xx_i2c1_device);
129 platform_device_register(&iop33x_uart0_device); 136 platform_device_register(&iop33x_uart0_device);
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 5327decde5a0..9edaf4734fa8 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -81,6 +81,44 @@ void __init ixp4xx_map_io(void)
81 iotable_init(ixp4xx_io_desc, ARRAY_SIZE(ixp4xx_io_desc)); 81 iotable_init(ixp4xx_io_desc, ARRAY_SIZE(ixp4xx_io_desc));
82} 82}
83 83
84/*
85 * GPIO-functions
86 */
87/*
88 * The following converted to the real HW bits the gpio_line_config
89 */
90/* GPIO pin types */
91#define IXP4XX_GPIO_OUT 0x1
92#define IXP4XX_GPIO_IN 0x2
93
94/* GPIO signal types */
95#define IXP4XX_GPIO_LOW 0
96#define IXP4XX_GPIO_HIGH 1
97
98/* GPIO Clocks */
99#define IXP4XX_GPIO_CLK_0 14
100#define IXP4XX_GPIO_CLK_1 15
101
102static void gpio_line_config(u8 line, u32 direction)
103{
104 if (direction == IXP4XX_GPIO_IN)
105 *IXP4XX_GPIO_GPOER |= (1 << line);
106 else
107 *IXP4XX_GPIO_GPOER &= ~(1 << line);
108}
109
110static void gpio_line_get(u8 line, int *value)
111{
112 *value = (*IXP4XX_GPIO_GPINR >> line) & 0x1;
113}
114
115static void gpio_line_set(u8 line, int value)
116{
117 if (value == IXP4XX_GPIO_HIGH)
118 *IXP4XX_GPIO_GPOUTR |= (1 << line);
119 else if (value == IXP4XX_GPIO_LOW)
120 *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
121}
84 122
85/************************************************************************* 123/*************************************************************************
86 * IXP4xx chipset IRQ handling 124 * IXP4xx chipset IRQ handling
@@ -117,17 +155,6 @@ static int ixp4xx_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
117 return -EINVAL; 155 return -EINVAL;
118} 156}
119 157
120int irq_to_gpio(unsigned int irq)
121{
122 int gpio = (irq < 32) ? irq2gpio[irq] : -EINVAL;
123
124 if (gpio == -1)
125 return -EINVAL;
126
127 return gpio;
128}
129EXPORT_SYMBOL(irq_to_gpio);
130
131static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type) 158static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type)
132{ 159{
133 int line = irq2gpio[d->irq]; 160 int line = irq2gpio[d->irq];
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index 63de1b3fd06b..736dc692d540 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -26,6 +26,7 @@
26#include <linux/reboot.h> 26#include <linux/reboot.h>
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/i2c-gpio.h> 28#include <linux/i2c-gpio.h>
29#include <linux/gpio.h>
29 30
30#include <mach/hardware.h> 31#include <mach/hardware.h>
31 32
@@ -161,11 +162,8 @@ static struct platform_device *dsmg600_devices[] __initdata = {
161 162
162static void dsmg600_power_off(void) 163static void dsmg600_power_off(void)
163{ 164{
164 /* enable the pwr cntl gpio */ 165 /* enable the pwr cntl and drive it high */
165 gpio_line_config(DSMG600_PO_GPIO, IXP4XX_GPIO_OUT); 166 gpio_direction_output(DSMG600_PO_GPIO, 1);
166
167 /* poweroff */
168 gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH);
169} 167}
170 168
171/* This is used to make sure the power-button pusher is serious. The button 169/* This is used to make sure the power-button pusher is serious. The button
@@ -202,7 +200,7 @@ static void dsmg600_power_handler(unsigned long data)
202 ctrl_alt_del(); 200 ctrl_alt_del();
203 201
204 /* Change the state of the power LED to "blink" */ 202 /* Change the state of the power LED to "blink" */
205 gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW); 203 gpio_set_value(DSMG600_LED_PWR_GPIO, 0);
206 } else { 204 } else {
207 power_button_countdown = PBUTTON_HOLDDOWN_COUNT; 205 power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
208 } 206 }
@@ -228,6 +226,40 @@ static void __init dsmg600_timer_init(void)
228 ixp4xx_timer_init(); 226 ixp4xx_timer_init();
229} 227}
230 228
229static int __init dsmg600_gpio_init(void)
230{
231 if (!machine_is_dsmg600())
232 return 0;
233
234 gpio_request(DSMG600_RB_GPIO, "reset button");
235 if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler,
236 IRQF_DISABLED | IRQF_TRIGGER_LOW,
237 "DSM-G600 reset button", NULL) < 0) {
238
239 printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
240 gpio_to_irq(DSMG600_RB_GPIO));
241 }
242
243 /*
244 * The power button on the D-Link DSM-G600 is on GPIO 15, but
245 * it cannot handle interrupts on that GPIO line. So we'll
246 * have to poll it with a kernel timer.
247 */
248
249 /* Make sure that the power button GPIO is set up as an input */
250 gpio_request(DSMG600_PB_GPIO, "power button");
251 gpio_direction_input(DSMG600_PB_GPIO);
252 /* Request poweroff GPIO line */
253 gpio_request(DSMG600_PO_GPIO, "power off button");
254
255 /* Set the initial value for the power button IRQ handler */
256 power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
257
258 mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500));
259 return 0;
260}
261device_initcall(dsmg600_gpio_init);
262
231static void __init dsmg600_init(void) 263static void __init dsmg600_init(void)
232{ 264{
233 ixp4xx_sys_init(); 265 ixp4xx_sys_init();
@@ -251,27 +283,6 @@ static void __init dsmg600_init(void)
251 platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices)); 283 platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));
252 284
253 pm_power_off = dsmg600_power_off; 285 pm_power_off = dsmg600_power_off;
254
255 if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler,
256 IRQF_DISABLED | IRQF_TRIGGER_LOW,
257 "DSM-G600 reset button", NULL) < 0) {
258
259 printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
260 gpio_to_irq(DSMG600_RB_GPIO));
261 }
262
263 /* The power button on the D-Link DSM-G600 is on GPIO 15, but
264 * it cannot handle interrupts on that GPIO line. So we'll
265 * have to poll it with a kernel timer.
266 */
267
268 /* Make sure that the power button GPIO is set up as an input */
269 gpio_line_config(DSMG600_PB_GPIO, IXP4XX_GPIO_IN);
270
271 /* Set the initial value for the power button IRQ handler */
272 power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
273
274 mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500));
275} 286}
276 287
277MACHINE_START(DSMG600, "D-Link DSM-G600 RevA") 288MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
diff --git a/arch/arm/mach-ixp4xx/include/mach/platform.h b/arch/arm/mach-ixp4xx/include/mach/platform.h
index 4c4c6a6f4526..75c4c6572ad0 100644
--- a/arch/arm/mach-ixp4xx/include/mach/platform.h
+++ b/arch/arm/mach-ixp4xx/include/mach/platform.h
@@ -131,44 +131,5 @@ struct pci_sys_data;
131extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); 131extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
132extern struct pci_ops ixp4xx_ops; 132extern struct pci_ops ixp4xx_ops;
133 133
134/*
135 * GPIO-functions
136 */
137/*
138 * The following converted to the real HW bits the gpio_line_config
139 */
140/* GPIO pin types */
141#define IXP4XX_GPIO_OUT 0x1
142#define IXP4XX_GPIO_IN 0x2
143
144/* GPIO signal types */
145#define IXP4XX_GPIO_LOW 0
146#define IXP4XX_GPIO_HIGH 1
147
148/* GPIO Clocks */
149#define IXP4XX_GPIO_CLK_0 14
150#define IXP4XX_GPIO_CLK_1 15
151
152static inline void gpio_line_config(u8 line, u32 direction)
153{
154 if (direction == IXP4XX_GPIO_IN)
155 *IXP4XX_GPIO_GPOER |= (1 << line);
156 else
157 *IXP4XX_GPIO_GPOER &= ~(1 << line);
158}
159
160static inline void gpio_line_get(u8 line, int *value)
161{
162 *value = (*IXP4XX_GPIO_GPINR >> line) & 0x1;
163}
164
165static inline void gpio_line_set(u8 line, int value)
166{
167 if (value == IXP4XX_GPIO_HIGH)
168 *IXP4XX_GPIO_GPOUTR |= (1 << line);
169 else if (value == IXP4XX_GPIO_LOW)
170 *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
171}
172
173#endif // __ASSEMBLY__ 134#endif // __ASSEMBLY__
174 135
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index 22d688b7d513..e7b8befa8729 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -20,6 +20,7 @@
20#include <linux/mtd/nand.h> 20#include <linux/mtd/nand.h>
21#include <linux/mtd/partitions.h> 21#include <linux/mtd/partitions.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/gpio.h>
23#include <asm/types.h> 24#include <asm/types.h>
24#include <asm/setup.h> 25#include <asm/setup.h>
25#include <asm/memory.h> 26#include <asm/memory.h>
@@ -80,10 +81,10 @@ ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
80 81
81 if (ctrl & NAND_CTRL_CHANGE) { 82 if (ctrl & NAND_CTRL_CHANGE) {
82 if (ctrl & NAND_NCE) { 83 if (ctrl & NAND_NCE) {
83 gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_LOW); 84 gpio_set_value(IXDP425_NAND_NCE_PIN, 0);
84 udelay(5); 85 udelay(5);
85 } else 86 } else
86 gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_HIGH); 87 gpio_set_value(IXDP425_NAND_NCE_PIN, 1);
87 88
88 offset = (ctrl & NAND_CLE) ? IXDP425_NAND_CMD_BYTE : 0; 89 offset = (ctrl & NAND_CLE) ? IXDP425_NAND_CMD_BYTE : 0;
89 offset |= (ctrl & NAND_ALE) ? IXDP425_NAND_ADDR_BYTE : 0; 90 offset |= (ctrl & NAND_ALE) ? IXDP425_NAND_ADDR_BYTE : 0;
@@ -227,7 +228,8 @@ static void __init ixdp425_init(void)
227 ixdp425_flash_nand_resource.start = IXP4XX_EXP_BUS_BASE(3), 228 ixdp425_flash_nand_resource.start = IXP4XX_EXP_BUS_BASE(3),
228 ixdp425_flash_nand_resource.end = IXP4XX_EXP_BUS_BASE(3) + 0x10 - 1; 229 ixdp425_flash_nand_resource.end = IXP4XX_EXP_BUS_BASE(3) + 0x10 - 1;
229 230
230 gpio_line_config(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_OUT); 231 gpio_request(IXDP425_NAND_NCE_PIN, "NAND NCE pin");
232 gpio_direction_output(IXDP425_NAND_NCE_PIN, 0);
231 233
232 /* Configure expansion bus for NAND Flash */ 234 /* Configure expansion bus for NAND Flash */
233 *IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN | 235 *IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN |
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index ed667ce9f576..507cb5233537 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -184,11 +184,8 @@ static void nas100d_power_off(void)
184{ 184{
185 /* This causes the box to drop the power and go dead. */ 185 /* This causes the box to drop the power and go dead. */
186 186
187 /* enable the pwr cntl gpio */ 187 /* enable the pwr cntl gpio and assert power off */
188 gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT); 188 gpio_direction_output(NAS100D_PO_GPIO, 1);
189
190 /* do the deed */
191 gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
192} 189}
193 190
194/* This is used to make sure the power-button pusher is serious. The button 191/* This is used to make sure the power-button pusher is serious. The button
@@ -225,7 +222,7 @@ static void nas100d_power_handler(unsigned long data)
225 ctrl_alt_del(); 222 ctrl_alt_del();
226 223
227 /* Change the state of the power LED to "blink" */ 224 /* Change the state of the power LED to "blink" */
228 gpio_line_set(NAS100D_LED_PWR_GPIO, IXP4XX_GPIO_LOW); 225 gpio_set_value(NAS100D_LED_PWR_GPIO, 0);
229 } else { 226 } else {
230 power_button_countdown = PBUTTON_HOLDDOWN_COUNT; 227 power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
231 } 228 }
@@ -242,6 +239,33 @@ static irqreturn_t nas100d_reset_handler(int irq, void *dev_id)
242 return IRQ_HANDLED; 239 return IRQ_HANDLED;
243} 240}
244 241
242static int __init nas100d_gpio_init(void)
243{
244 if (!machine_is_nas100d())
245 return 0;
246
247 /*
248 * The power button on the Iomega NAS100d is on GPIO 14, but
249 * it cannot handle interrupts on that GPIO line. So we'll
250 * have to poll it with a kernel timer.
251 */
252
253 /* Request the power off GPIO */
254 gpio_request(NAS100D_PO_GPIO, "power off");
255
256 /* Make sure that the power button GPIO is set up as an input */
257 gpio_request(NAS100D_PB_GPIO, "power button");
258 gpio_direction_input(NAS100D_PB_GPIO);
259
260 /* Set the initial value for the power button IRQ handler */
261 power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
262
263 mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500));
264
265 return 0;
266}
267device_initcall(nas100d_gpio_init);
268
245static void __init nas100d_init(void) 269static void __init nas100d_init(void)
246{ 270{
247 uint8_t __iomem *f; 271 uint8_t __iomem *f;
@@ -278,19 +302,6 @@ static void __init nas100d_init(void)
278 gpio_to_irq(NAS100D_RB_GPIO)); 302 gpio_to_irq(NAS100D_RB_GPIO));
279 } 303 }
280 304
281 /* The power button on the Iomega NAS100d is on GPIO 14, but
282 * it cannot handle interrupts on that GPIO line. So we'll
283 * have to poll it with a kernel timer.
284 */
285
286 /* Make sure that the power button GPIO is set up as an input */
287 gpio_line_config(NAS100D_PB_GPIO, IXP4XX_GPIO_IN);
288
289 /* Set the initial value for the power button IRQ handler */
290 power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
291
292 mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500));
293
294 /* 305 /*
295 * Map in a portion of the flash and read the MAC address. 306 * Map in a portion of the flash and read the MAC address.
296 * Since it is stored in BE in the flash itself, we need to 307 * Since it is stored in BE in the flash itself, we need to
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index 7e55236c26ea..ba5f1cda2a9d 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -197,11 +197,8 @@ static void nslu2_power_off(void)
197{ 197{
198 /* This causes the box to drop the power and go dead. */ 198 /* This causes the box to drop the power and go dead. */
199 199
200 /* enable the pwr cntl gpio */ 200 /* enable the pwr cntl gpio and assert power off */
201 gpio_line_config(NSLU2_PO_GPIO, IXP4XX_GPIO_OUT); 201 gpio_direction_output(NSLU2_PO_GPIO, 1);
202
203 /* do the deed */
204 gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH);
205} 202}
206 203
207static irqreturn_t nslu2_power_handler(int irq, void *dev_id) 204static irqreturn_t nslu2_power_handler(int irq, void *dev_id)
@@ -223,6 +220,16 @@ static irqreturn_t nslu2_reset_handler(int irq, void *dev_id)
223 return IRQ_HANDLED; 220 return IRQ_HANDLED;
224} 221}
225 222
223static int __init nslu2_gpio_init(void)
224{
225 if (!machine_is_nslu2())
226 return 0;
227
228 /* Request the power off GPIO */
229 return gpio_request(NSLU2_PO_GPIO, "power off");
230}
231device_initcall(nslu2_gpio_init);
232
226static void __init nslu2_timer_init(void) 233static void __init nslu2_timer_init(void)
227{ 234{
228 /* The xtal on this machine is non-standard. */ 235 /* The xtal on this machine is non-standard. */
diff --git a/arch/arm/mach-mmp/include/mach/gpio.h b/arch/arm/mach-mmp/include/mach/gpio.h
deleted file mode 100644
index 13219ebf5128..000000000000
--- a/arch/arm/mach-mmp/include/mach/gpio.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef __ASM_MACH_GPIO_H
2#define __ASM_MACH_GPIO_H
3
4#include <asm-generic/gpio.h>
5
6#include <mach/cputype.h>
7
8#endif /* __ASM_MACH_GPIO_H */
diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h
deleted file mode 100644
index 0248e433bc98..000000000000
--- a/arch/arm/mach-pxa/include/mach/gpio.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * arch/arm/mach-pxa/include/mach/gpio.h
3 *
4 * PXA GPIO wrappers for arch-neutral GPIO calls
5 *
6 * Written by Philipp Zabel <philipp.zabel@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#ifndef __ASM_ARCH_PXA_GPIO_H
25#define __ASM_ARCH_PXA_GPIO_H
26
27#include <asm-generic/gpio.h>
28
29#include <mach/irqs.h>
30#include <mach/hardware.h>
31
32#endif
diff --git a/arch/arm/mach-w90x900/include/mach/gpio.h b/arch/arm/mach-w90x900/include/mach/gpio.h
deleted file mode 100644
index 5385a4203277..000000000000
--- a/arch/arm/mach-w90x900/include/mach/gpio.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * linux/arch/arm/mach-w90p910/include/mach/gpio.h
3 *
4 * Generic w90p910 GPIO handling
5 *
6 * Wan ZongShun <mcuos.com@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __ASM_ARCH_W90P910_GPIO_H
14#define __ASM_ARCH_W90P910_GPIO_H
15
16#include <mach/hardware.h>
17#include <asm/irq.h>
18
19static inline int gpio_to_irq(unsigned gpio)
20{
21 return gpio;
22}
23#define gpio_to_irq gpio_to_irq
24
25static inline int irq_to_gpio(unsigned irq)
26{
27 return irq;
28}
29
30#endif
diff --git a/arch/arm/plat-iop/Makefile b/arch/arm/plat-iop/Makefile
index a99dc15a70f7..224e56c6049b 100644
--- a/arch/arm/plat-iop/Makefile
+++ b/arch/arm/plat-iop/Makefile
@@ -5,7 +5,6 @@
5obj-y := 5obj-y :=
6 6
7# IOP32X 7# IOP32X
8obj-$(CONFIG_ARCH_IOP32X) += gpio.o
9obj-$(CONFIG_ARCH_IOP32X) += i2c.o 8obj-$(CONFIG_ARCH_IOP32X) += i2c.o
10obj-$(CONFIG_ARCH_IOP32X) += pci.o 9obj-$(CONFIG_ARCH_IOP32X) += pci.o
11obj-$(CONFIG_ARCH_IOP32X) += setup.o 10obj-$(CONFIG_ARCH_IOP32X) += setup.o
@@ -16,7 +15,6 @@ obj-$(CONFIG_ARCH_IOP32X) += pmu.o
16obj-$(CONFIG_ARCH_IOP32X) += restart.o 15obj-$(CONFIG_ARCH_IOP32X) += restart.o
17 16
18# IOP33X 17# IOP33X
19obj-$(CONFIG_ARCH_IOP33X) += gpio.o
20obj-$(CONFIG_ARCH_IOP33X) += i2c.o 18obj-$(CONFIG_ARCH_IOP33X) += i2c.o
21obj-$(CONFIG_ARCH_IOP33X) += pci.o 19obj-$(CONFIG_ARCH_IOP33X) += pci.o
22obj-$(CONFIG_ARCH_IOP33X) += setup.o 20obj-$(CONFIG_ARCH_IOP33X) += setup.o
diff --git a/arch/arm/plat-iop/gpio.c b/arch/arm/plat-iop/gpio.c
deleted file mode 100644
index 697de6dc4936..000000000000
--- a/arch/arm/plat-iop/gpio.c
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * arch/arm/plat-iop/gpio.c
3 * GPIO handling for Intel IOP3xx processors.
4 *
5 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
11 */
12
13#include <linux/device.h>
14#include <linux/init.h>
15#include <linux/types.h>
16#include <linux/errno.h>
17#include <linux/gpio.h>
18#include <linux/export.h>
19#include <asm/hardware/iop3xx.h>
20#include <mach/gpio.h>
21
22void gpio_line_config(int line, int direction)
23{
24 unsigned long flags;
25
26 local_irq_save(flags);
27 if (direction == GPIO_IN) {
28 *IOP3XX_GPOE |= 1 << line;
29 } else if (direction == GPIO_OUT) {
30 *IOP3XX_GPOE &= ~(1 << line);
31 }
32 local_irq_restore(flags);
33}
34EXPORT_SYMBOL(gpio_line_config);
35
36int gpio_line_get(int line)
37{
38 return !!(*IOP3XX_GPID & (1 << line));
39}
40EXPORT_SYMBOL(gpio_line_get);
41
42void gpio_line_set(int line, int value)
43{
44 unsigned long flags;
45
46 local_irq_save(flags);
47 if (value == GPIO_LOW) {
48 *IOP3XX_GPOD &= ~(1 << line);
49 } else if (value == GPIO_HIGH) {
50 *IOP3XX_GPOD |= 1 << line;
51 }
52 local_irq_restore(flags);
53}
54EXPORT_SYMBOL(gpio_line_set);
55
56static int iop3xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
57{
58 gpio_line_config(gpio, GPIO_IN);
59 return 0;
60}
61
62static int iop3xx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int level)
63{
64 gpio_line_set(gpio, level);
65 gpio_line_config(gpio, GPIO_OUT);
66 return 0;
67}
68
69static int iop3xx_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
70{
71 return gpio_line_get(gpio);
72}
73
74static void iop3xx_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value)
75{
76 gpio_line_set(gpio, value);
77}
78
79static struct gpio_chip iop3xx_chip = {
80 .label = "iop3xx",
81 .direction_input = iop3xx_gpio_direction_input,
82 .get = iop3xx_gpio_get_value,
83 .direction_output = iop3xx_gpio_direction_output,
84 .set = iop3xx_gpio_set_value,
85 .base = 0,
86 .ngpio = IOP3XX_N_GPIOS,
87};
88
89static int __init iop3xx_gpio_setup(void)
90{
91 return gpiochip_add(&iop3xx_chip);
92}
93arch_initcall(iop3xx_gpio_setup);