aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-09-09 10:39:51 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-09-20 17:04:50 -0400
commit7b85b867b99044da93f83851c806d1e324d49ed5 (patch)
tree22fd6412f7d986b1d3720badd4d5fe60f3fd9a45 /arch/arm
parent51a97d829e32b7a1b960d3365e4c2546c9c792aa (diff)
ARM: plat-iop: instantiate GPIO from platform device
This converts the IOP32x and IOP33x platforms to pass their base address offset by a resource attached to a platform device instead of using static offset macros implicitly passed through <linux/gpio.h> including <mach/gpio.h>. Delete the local <mach/gpio.h> and <asm/hardware/iop3xx-gpio.h> headers and remove the selection of NEED_MACH_GPIO_H. Pass the virtual address as a resource in the platform device at this point for bisectability, next patch will pass the physical address as is custom. Cc: Lennert Buytenhek <kernel@wantstofly.org> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Mikael Pettersson <mikpe@it.uu.se> Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/arm/include/asm/hardware/iop3xx-gpio.h32
-rw-r--r--arch/arm/include/asm/hardware/iop3xx.h9
-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.c2
-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
15 files changed, 34 insertions, 57 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index fc8c0928bfaf..e83529b42ac6 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -458,7 +458,6 @@ config ARCH_IOP32X
458 select ARCH_REQUIRE_GPIOLIB 458 select ARCH_REQUIRE_GPIOLIB
459 select CPU_XSCALE 459 select CPU_XSCALE
460 select GPIO_IOP 460 select GPIO_IOP
461 select NEED_MACH_GPIO_H
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
@@ -472,7 +471,6 @@ config ARCH_IOP33X
472 select ARCH_REQUIRE_GPIOLIB 471 select ARCH_REQUIRE_GPIOLIB
473 select CPU_XSCALE 472 select CPU_XSCALE
474 select GPIO_IOP 473 select GPIO_IOP
475 select NEED_MACH_GPIO_H
476 select NEED_RET_TO_USER 474 select NEED_RET_TO_USER
477 select PCI 475 select PCI
478 select PLAT_IOP 476 select PLAT_IOP
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 e2a097078a06..000000000000
--- a/arch/arm/include/asm/hardware/iop3xx-gpio.h
+++ /dev/null
@@ -1,32 +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#endif
32
diff --git a/arch/arm/include/asm/hardware/iop3xx.h b/arch/arm/include/asm/hardware/iop3xx.h
index 6af9c2841fcb..2594a95ff19a 100644
--- a/arch/arm/include/asm/hardware/iop3xx.h
+++ b/arch/arm/include/asm/hardware/iop3xx.h
@@ -18,10 +18,6 @@
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__
@@ -165,11 +161,6 @@ extern int iop3xx_get_init_atu(void);
165/* PERCR0 DOESN'T EXIST - index from 1! */ 161/* PERCR0 DOESN'T EXIST - index from 1! */
166#define IOP3XX_PERCR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0710) 162#define IOP3XX_PERCR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0710)
167 163
168/* General Purpose I/O */
169#define IOP3XX_GPOE (volatile u32 *)IOP3XX_GPIO_REG(0x0000)
170#define IOP3XX_GPID (volatile u32 *)IOP3XX_GPIO_REG(0x0004)
171#define IOP3XX_GPOD (volatile u32 *)IOP3XX_GPIO_REG(0x0008)
172
173/* Timers */ 164/* Timers */
174#define IOP3XX_TU_TMR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0000) 165#define IOP3XX_TU_TMR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0000)
175#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-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..b8710a63a13e
--- /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_VIRT_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 bc40a97050a1..c1cd80ecc219 100644
--- a/arch/arm/mach-iop32x/n2100.c
+++ b/arch/arm/mach-iop32x/n2100.c
@@ -41,6 +41,7 @@
41#include <asm/page.h> 41#include <asm/page.h>
42#include <asm/pgtable.h> 42#include <asm/pgtable.h>
43#include <mach/time.h> 43#include <mach/time.h>
44#include "gpio-iop32x.h"
44 45
45/* 46/*
46 * N2100 timer tick configuration. 47 * N2100 timer tick configuration.
@@ -345,6 +346,7 @@ device_initcall(n2100_request_gpios);
345 346
346static void __init n2100_init_machine(void) 347static void __init n2100_init_machine(void)
347{ 348{
349 register_iop32x_gpio();
348 platform_device_register(&iop3xx_i2c0_device); 350 platform_device_register(&iop3xx_i2c0_device);
349 platform_device_register(&n2100_flash_device); 351 platform_device_register(&n2100_flash_device);
350 platform_device_register(&n2100_serial_device); 352 platform_device_register(&n2100_serial_device);
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..25741c4c92de 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_VIRT_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..a3b56e1c2ad4 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_VIRT_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);