aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-ux500/include/mach
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2010-03-15 13:54:49 +0530
committerJohn Rigby <john.rigby@linaro.org>2010-09-02 22:44:45 -0600
commitde601d55733ab12bb6eace42326695f7bcdc8ffe (patch)
tree4dd1eeba430fee15026ae7ba1445db6e0ed66680 /arch/arm/mach-ux500/include/mach
parentfec7f54996849ec74e5c57c6647883d54bea7d5a (diff)
ux500: switch to nomadik-gpio
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Diffstat (limited to 'arch/arm/mach-ux500/include/mach')
-rw-r--r--arch/arm/mach-ux500/include/mach/db5500-regs.h9
-rw-r--r--arch/arm/mach-ux500/include/mach/db8500-regs.h10
-rw-r--r--arch/arm/mach-ux500/include/mach/devices.h12
-rwxr-xr-xarch/arm/mach-ux500/include/mach/gpio.h143
-rwxr-xr-xarch/arm/mach-ux500/include/mach/irqs.h4
5 files changed, 90 insertions, 88 deletions
diff --git a/arch/arm/mach-ux500/include/mach/db5500-regs.h b/arch/arm/mach-ux500/include/mach/db5500-regs.h
index 474f6d3d968..c65aedffdca 100644
--- a/arch/arm/mach-ux500/include/mach/db5500-regs.h
+++ b/arch/arm/mach-ux500/include/mach/db5500-regs.h
@@ -93,4 +93,13 @@
#define U5500_CRYP1_BASE (U5500_PER6_BASE + 0xB000)
#define U5500_CLKRST6_BASE (U5500_PER6_BASE + 0xF000)
+#define U5500_GPIOBANK0_BASE U5500_GPIO0_BASE
+#define U5500_GPIOBANK1_BASE (U5500_GPIO0_BASE + 0x80)
+#define U5500_GPIOBANK2_BASE U5500_GPIO1_BASE
+#define U5500_GPIOBANK3_BASE U5500_GPIO2_BASE
+#define U5500_GPIOBANK4_BASE U5500_GPIO3_BASE
+#define U5500_GPIOBANK5_BASE U5500_GPIO4_BASE
+#define U5500_GPIOBANK6_BASE (U5500_GPIO4_BASE + 0x80)
+#define U5500_GPIOBANK7_BASE (U5500_GPIO4_BASE + 0x100)
+
#endif
diff --git a/arch/arm/mach-ux500/include/mach/db8500-regs.h b/arch/arm/mach-ux500/include/mach/db8500-regs.h
index f0dcaa0cee3..5576aa2236f 100644
--- a/arch/arm/mach-ux500/include/mach/db8500-regs.h
+++ b/arch/arm/mach-ux500/include/mach/db8500-regs.h
@@ -114,4 +114,14 @@
#define U8500_SHRM_GOP_INTERRUPT_BASE 0xB7C00040
+#define U8500_GPIOBANK0_BASE U8500_GPIO0_BASE
+#define U8500_GPIOBANK1_BASE (U8500_GPIO0_BASE + 0x80)
+#define U8500_GPIOBANK2_BASE U8500_GPIO1_BASE
+#define U8500_GPIOBANK3_BASE (U8500_GPIO1_BASE + 0x80)
+#define U8500_GPIOBANK4_BASE (U8500_GPIO1_BASE + 0x100)
+#define U8500_GPIOBANK5_BASE (U8500_GPIO1_BASE + 0x180)
+#define U8500_GPIOBANK6_BASE U8500_GPIO2_BASE
+#define U8500_GPIOBANK7_BASE (U8500_GPIO2_BASE + 0x80)
+#define U8500_GPIOBANK8_BASE U8500_GPIO3_BASE
+
#endif
diff --git a/arch/arm/mach-ux500/include/mach/devices.h b/arch/arm/mach-ux500/include/mach/devices.h
index 0ffc1a05c3d..d7d82720451 100644
--- a/arch/arm/mach-ux500/include/mach/devices.h
+++ b/arch/arm/mach-ux500/include/mach/devices.h
@@ -15,16 +15,8 @@ struct amba_device;
void __init u8500_register_device(struct platform_device *dev, void *data);
void __init u8500_register_amba_device(struct amba_device *dev, void *data);
-extern struct amba_device u5500_gpio0_device;
-extern struct amba_device u5500_gpio1_device;
-extern struct amba_device u5500_gpio2_device;
-extern struct amba_device u5500_gpio3_device;
-extern struct amba_device u5500_gpio4_device;
-
-extern struct amba_device u8500_gpio0_device;
-extern struct amba_device u8500_gpio1_device;
-extern struct amba_device u8500_gpio2_device;
-extern struct amba_device u8500_gpio3_device;
+extern struct platform_device u8500_gpio_devs[];
+extern struct platform_device u5500_gpio_devs[];
extern struct platform_device u8500_msp0_device;
extern struct platform_device u8500_msp1_device;
diff --git a/arch/arm/mach-ux500/include/mach/gpio.h b/arch/arm/mach-ux500/include/mach/gpio.h
index ec119af7cc0..dc098ea370f 100755
--- a/arch/arm/mach-ux500/include/mach/gpio.h
+++ b/arch/arm/mach-ux500/include/mach/gpio.h
@@ -1,43 +1,29 @@
-/*----------------------------------------------------------------------------------*/
-/* copyright STMicroelectronics, 2007. */
-/* */
-/* This program is free software; you can redistribute it and/or modify it under */
-/* the terms of the GNU General Public License as published by the Free */
-/* Software Foundation; either version 2.1 of the License, or (at your option) */
-/* any later version. */
-/* */
-/* This program is distributed in the hope that it will be useful, but WITHOUT */
-/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS */
-/* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */
-/* */
-/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
-/*----------------------------------------------------------------------------------*/
+/*
+ * Copyright (C) 2007 ST Microelectronics
+ * Copyright (C) 2010 ST-Ericsson
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
#ifndef __MACH_GPIO_H
#define __MACH_GPIO_H
-#ifndef __LINUX_GPIO_H
-#error "Do not include this file directly, include <linux/gpio.h> instead."
-#endif
+/*
+ * 288 (#267 is the highest one actually hooked up) onchip GPIOs, plus enough
+ * room for a couple of GPIO expanders.
+ */
+#define ARCH_NR_GPIOS 350
-#define ARCH_NR_GPIOS 309 /* 292+17 for STMPE1601*/
+#include <plat/gpio.h>
/* Used by test applications */
#define GPIO_TOTAL_PINS 267
#include <mach/hardware.h>
-#include <asm-generic/gpio.h>
#include <mach/irqs.h>
-/*
- * Macro to decorate plain GPIO numbers
- */
-#define GPIO(x) (x)
-#define stm_get_gpio_base(base, offset) base
-
-/*
- * Standard GPIOLIB APIs (additional APIs in include/asm-generic/gpio.h)
- */
static inline int gpio_to_irq(unsigned int gpio)
{
if (gpio_is_valid(gpio))
@@ -54,28 +40,9 @@ static inline int irq_to_gpio(unsigned int irq)
return -EINVAL;
}
-static inline int gpio_get_value(unsigned int gpio)
-{
- return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
- __gpio_set_value(gpio, value);
-}
-
-/*
- * Special values for gpio_set_value() to enable platform-specific
- * GPIO configurations, in addition to named values for 0 and 1
- */
-#define GPIO_LOW 0
-#define GPIO_HIGH 1
-#define GPIO_PULLUP_DIS 0xA
-#define GPIO_PULLUP_EN 0xB
-#define GPIO_ALTF_A 0xAFA /* Alternate function A */
-#define GPIO_ALTF_B 0xAFB /* Alternate function B */
-#define GPIO_ALTF_C 0xAFC /* Alternate function C */
-#define GPIO_RESET 0xAFD /* Input with pull-up/down */
+#define GPIO_ALTF_A NMK_GPIO_ALT_A
+#define GPIO_ALTF_B NMK_GPIO_ALT_B
+#define GPIO_ALTF_C NMK_GPIO_ALT_C
/*
* Alternate Function:
@@ -146,16 +113,8 @@ typedef enum {
GPIO_ALT_SDMMC2,
GPIO_ALT_TP_SET_EXT_CLK,
GPIO_ALT_FUNMAX /* Add new alt func before this */
-
-
} gpio_alt_function;
-/* GPIO pin data*/
-typedef enum {
- GPIO_DATA_LOW, /* GPIO pin status is low. */
- GPIO_DATA_HIGH /* GPIO pin status is high. */
-} gpio_data;
-
struct gpio_altfun_data {
gpio_alt_function altfun;
int start;
@@ -165,25 +124,55 @@ struct gpio_altfun_data {
char dev_name[20];
};
-struct clk;
-struct gpio_platform_data {
- struct gpio_block_data *gpio_data;
- int gpio_block_size;
- struct gpio_altfun_data *altfun_table;
- int altfun_table_size;
- struct clk *clk; /* FIXME put this somewhere more appropriate */
-};
-
-struct gpio_block_data {
- u32 block_base;
- u32 block_size;
- u32 base_offset;
- int blocks_per_irq;
- int irq;
-};
-
extern int stm_gpio_set_altfunctable(struct gpio_altfun_data *table, int size);
extern int stm_gpio_altfuncenable(gpio_alt_function alt_func);
extern int stm_gpio_altfuncdisable(gpio_alt_function alt_func);
-#endif /* __INC_GPIO_H */
+#define __GPIO_ALT(_fun, _start, _end, _cont, _type, _name) { \
+ .altfun = _fun, \
+ .start = _start, \
+ .end = _end, \
+ .cont = _cont, \
+ .type = _type, \
+ .dev_name = _name }
+
+#define __GPIO_RESOURCE(soc, block) \
+ { \
+ .start = soc##_GPIOBANK##block##_BASE, \
+ .end = soc##_GPIOBANK##block##_BASE + 127, \
+ .flags = IORESOURCE_MEM, \
+ }, \
+ { \
+ .start = IRQ_GPIO##block, \
+ .end = IRQ_GPIO##block, \
+ .flags = IORESOURCE_IRQ, \
+ }
+
+#define __GPIO_DEVICE(soc, block) \
+ { \
+ .name = "gpio", \
+ .id = block, \
+ .num_resources = 2, \
+ .resource = &soc##_gpio_resources[block * 2], \
+ .dev = { \
+ .platform_data = &soc##_gpio_data[block], \
+ }, \
+ }
+
+#define GPIO_DATA(_name, first, num) \
+ { \
+ .name = _name, \
+ .first_gpio = first, \
+ .first_irq = NOMADIK_GPIO_TO_IRQ(first), \
+ .num_gpio = num, \
+ }
+
+#ifdef CONFIG_UX500_SOC_DB8500
+#define GPIO_RESOURCE(block) __GPIO_RESOURCE(U8500, block)
+#define GPIO_DEVICE(block) __GPIO_DEVICE(u8500, block)
+#elif defined(CONFIG_UX500_SOC_DB5500)
+#define GPIO_RESOURCE(block) __GPIO_RESOURCE(U5500, block)
+#define GPIO_DEVICE(block) __GPIO_DEVICE(u5500, block)
+#endif
+
+#endif /* __MACH_GPIO_H */
diff --git a/arch/arm/mach-ux500/include/mach/irqs.h b/arch/arm/mach-ux500/include/mach/irqs.h
index 919326596aa..cfd18d0a9b3 100755
--- a/arch/arm/mach-ux500/include/mach/irqs.h
+++ b/arch/arm/mach-ux500/include/mach/irqs.h
@@ -90,11 +90,13 @@
#define U8500_SOC_NR_IRQS 161
/* After chip-specific IRQ numbers we have the GPIO ones */
-#define U8500_NR_GPIO 268
+#define U8500_NR_GPIO 288
#define GPIO_TO_IRQ(gpio) (gpio + U8500_SOC_NR_IRQS)
#define IRQ_TO_GPIO(irq) (irq - U8500_SOC_NR_IRQS)
#define NR_IRQS GPIO_TO_IRQ(U8500_NR_GPIO)
+#define NOMADIK_GPIO_TO_IRQ GPIO_TO_IRQ
+#define NOMADIK_IRQ_TO_GPIO IRQ_TO_GPIO
#endif /* ASM_ARCH_IRQS_H */