[RFC PATCH 14/18] OMAP: GPIO: Remove CONFIG_ARCH_OMAP16XX/OMAP2+ defines
Suspend/resume/wakeup capabilities are supported only in OMAP16xx and OMAP2PLUS SoCs. Handle this by using a flag suspend_resume_support in pdata. This requires calling omap_gpio_sysinit() as part of probe instead of having this function as an arch_initcall Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap1/gpio16xx.c |5 ++ arch/arm/mach-omap2/gpio.c |1 + arch/arm/plat-omap/gpio.c | 96 ++-- arch/arm/plat-omap/include/plat/gpio.h |1 + 4 files changed, 48 insertions(+), 55 deletions(-) diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c index 6a99b01..cbac063 100644 --- a/arch/arm/mach-omap1/gpio16xx.c +++ b/arch/arm/mach-omap1/gpio16xx.c @@ -76,6 +76,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = { .bank_type = METHOD_MPUIO, .bank_width = OMAP1610_GPIO_WIDTH, .bank_stride= 1, + .suspend_resume_support = true, }; static struct __initdata platform_device omap16xx_mpu_gpio = { @@ -105,6 +106,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = { .virtual_irq_start = IH_GPIO_BASE, .bank_type = METHOD_GPIO_1610, .bank_width = OMAP1610_GPIO_WIDTH, + .suspend_resume_support = true, }; static struct __initdata platform_device omap16xx_gpio1 = { @@ -134,6 +136,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = { .virtual_irq_start = IH_GPIO_BASE + 16, .bank_type = METHOD_GPIO_1610, .bank_width = OMAP1610_GPIO_WIDTH, + .suspend_resume_support = true, }; static struct __initdata platform_device omap16xx_gpio2 = { @@ -163,6 +166,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = { .virtual_irq_start = IH_GPIO_BASE + 32, .bank_type = METHOD_GPIO_1610, .bank_width = OMAP1610_GPIO_WIDTH, + .suspend_resume_support = true, }; static struct __initdata platform_device omap16xx_gpio3 = { @@ -192,6 +196,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_gpio4_config = { .virtual_irq_start = IH_GPIO_BASE + 48, .bank_type = METHOD_GPIO_1610, .bank_width = OMAP1610_GPIO_WIDTH, + .suspend_resume_support = true, }; static struct __initdata platform_device omap16xx_gpio4 = { diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c index a7bb005..73b5705 100644 --- a/arch/arm/mach-omap2/gpio.c +++ b/arch/arm/mach-omap2/gpio.c @@ -467,6 +467,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) pdata-dbck_flag = dev_attr-dbck_flag; pdata-virtual_irq_start = IH_GPIO_BASE + 32 * (id - 1); pdata-gpio_fn = gpio_fn; + pdata-suspend_resume_support = true; switch (oh-class-rev) { case 0: diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index fd710cd..0f48364 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -158,11 +158,13 @@ struct gpio_bank { struct device *dev; bool dbck_flag; int stride; + bool suspend_resume_support; }; static struct omap_gpio_func gpio_fn; static int bank_width; +static int omap_gpio_sysinit(void); static int check_gpio(int gpio) { if (unlikely(gpio_fn.gpio_valid(gpio) 0)) { @@ -829,8 +831,6 @@ static struct irq_chip gpio_irq_chip = { /*-*/ -#ifdef CONFIG_ARCH_OMAP1 - /* MPUIO uses the always-on 32k clock */ static void mpuio_ack_irq(struct irq_data *d) @@ -860,20 +860,8 @@ static struct irq_chip mpuio_irq_chip = { .irq_mask = mpuio_mask_irq, .irq_unmask = mpuio_unmask_irq, .irq_set_type = gpio_irq_type, -#ifdef CONFIG_ARCH_OMAP16XX - /* REVISIT: assuming only 16xx supports MPUIO wake events */ - .irq_set_wake = gpio_wake_enable, -#endif }; - -#define bank_is_mpuio(bank)((bank)-method == METHOD_MPUIO) - - -#ifdef CONFIG_ARCH_OMAP16XX - -#include linux/platform_device.h - static int omap_mpuio_suspend_noirq(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); @@ -944,19 +932,6 @@ static inline void mpuio_init(struct gpio_bank *bank) mpuio_init_done = 1; } -#else -static inline void mpuio_init(struct gpio_bank *bank) {} -#endif /* 16xx */ - -#else - -extern struct irq_chip mpuio_irq_chip; - -#define bank_is_mpuio(bank)0 -static inline void mpuio_init(struct gpio_bank *bank) {} - -#endif - /*-*/ /* REVISIT these are stupid implementations! replace by ones that @@ -1104,7 +1079,7 @@ static void omap_gpio_mod_init(struct gpio_bank *bank
[RFC PATCH 10/18] OMAP: GPIO: cleanup set wakeup/suspend/resume funcs
Avoid the usage of cpu_is* checks and CONFIG_ARCH_OMAP* checks from _set_gpio_wakeup and gpio suspend/resume functions. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/plat-omap/gpio.c | 109 ++--- 1 files changed, 33 insertions(+), 76 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 5fe6dbf..df2414d 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -30,6 +30,7 @@ #include mach/gpio.h #include asm/mach/irq.h +#define OMAP_GPIO_WAKE_SET_CLR_ALL 0x #defineMPUIO_GPIO_IRQENA_MASK 0x /* * OMAP1510 GPIO registers @@ -140,10 +141,8 @@ struct gpio_bank { u16 irq; u16 virtual_irq_start; int method; -#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2PLUS) u32 suspend_wakeup; u32 saved_wakeup; -#endif u32 non_wakeup_gpios; u32 enabled_non_wakeup_gpios; @@ -630,18 +629,6 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) unsigned long uninitialized_var(flags); switch (bank-method) { -#ifdef CONFIG_ARCH_OMAP16XX - case METHOD_MPUIO: - case METHOD_GPIO_1610: - spin_lock_irqsave(bank-lock, flags); - if (enable) - bank-suspend_wakeup |= (1 gpio); - else - bank-suspend_wakeup = ~(1 gpio); - spin_unlock_irqrestore(bank-lock, flags); - return 0; -#endif -#ifdef CONFIG_ARCH_OMAP2PLUS case METHOD_GPIO_24XX: case METHOD_GPIO_44XX: if (bank-non_wakeup_gpios (1 gpio)) { @@ -650,6 +637,8 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) (bank - gpio_bank) * 32 + gpio); return -EINVAL; } + case METHOD_MPUIO: + case METHOD_GPIO_1610: spin_lock_irqsave(bank-lock, flags); if (enable) bank-suspend_wakeup |= (1 gpio); @@ -657,7 +646,6 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) bank-suspend_wakeup = ~(1 gpio); spin_unlock_irqrestore(bank-lock, flags); return 0; -#endif default: printk(KERN_ERR Can't enable GPIO wakeup for method %i\n, bank-method); @@ -1347,51 +1335,35 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev) return 0; } -#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2PLUS) static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg) { int i; - if (!cpu_class_is_omap2() !cpu_is_omap16xx()) - return 0; - for (i = 0; i gpio_bank_count; i++) { struct gpio_bank *bank = gpio_bank[i]; - void __iomem *wake_status; - void __iomem *wake_clear; - void __iomem *wake_set; + u32 wake_status; + u32 wake_clear; + u32 wake_set; unsigned long flags; - switch (bank-method) { -#ifdef CONFIG_ARCH_OMAP16XX - case METHOD_GPIO_1610: - wake_status = bank-base + OMAP1610_GPIO_WAKEUPENABLE; - wake_clear = bank-base + OMAP1610_GPIO_CLEAR_WAKEUPENA; - wake_set = bank-base + OMAP1610_GPIO_SET_WAKEUPENA; + if ((bank-method = METHOD_GPIO_1510) || + (bank-method == METHOD_GPIO_7XX)) { break; -#endif -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) - case METHOD_GPIO_24XX: - wake_status = bank-base + OMAP24XX_GPIO_WAKE_EN; - wake_clear = bank-base + OMAP24XX_GPIO_CLEARWKUENA; - wake_set = bank-base + OMAP24XX_GPIO_SETWKUENA; - break; -#endif -#ifdef CONFIG_ARCH_OMAP4 - case METHOD_GPIO_44XX: - wake_status = bank-base + OMAP4_GPIO_IRQWAKEN0; - wake_clear = bank-base + OMAP4_GPIO_IRQWAKEN0; - wake_set = bank-base + OMAP4_GPIO_IRQWAKEN0; - break; -#endif - default: - continue; + } else if (bank-method == METHOD_GPIO_44XX) { + wake_status = IRQWAKEN0; + wake_clear = IRQWAKEN0; + wake_set = IRQWAKEN0; + } else { + wake_status = WAKE_EN; + wake_clear = CLEARWKUENA; + wake_set = SETWKUENA; } spin_lock_irqsave(bank-lock, flags); - bank-saved_wakeup = __raw_readl(wake_status); - __raw_writel(0x
[RFC PATCH 03/18] OMAP: GPIO: Move gpio_get_index() to mach-omap
gpio_get_index() uses cpu_is* checks. Move this function from plat-omap/gpio.c to SoC specific GPIO files in mach-omap*/ and use pdata to pass the function pointer. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap1/gpio15xx.c | 14 ++ arch/arm/mach-omap1/gpio16xx.c | 18 +- arch/arm/mach-omap1/gpio7xx.c | 18 +- arch/arm/mach-omap2/gpio.c | 12 + arch/arm/plat-omap/gpio.c | 42 +--- arch/arm/plat-omap/include/plat/gpio.h |5 6 files changed, 82 insertions(+), 27 deletions(-) diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c index 04c4b04..eb2727a 100644 --- a/arch/arm/mach-omap1/gpio15xx.c +++ b/arch/arm/mach-omap1/gpio15xx.c @@ -21,6 +21,8 @@ #define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE #define OMAP1510_GPIO_BASE 0xFFFCE000 +#define OMAP1510_GPIO_INDEX_MASK 0x0f + /* gpio1 */ static struct __initdata resource omap15xx_mpu_gpio_resources[] = { { @@ -80,6 +82,15 @@ static struct __initdata platform_device omap15xx_gpio = { .resource = omap15xx_gpio_resources, }; +static int get_gpio_index(int gpio) +{ + return gpio OMAP1510_GPIO_INDEX_MASK; +} + +static struct omap_gpio_func gpio_fn = { + .get_index = get_gpio_index, +}; + /* * omap15xx_gpio_init needs to be done before * machine_init functions access gpio APIs. @@ -90,7 +101,10 @@ static int __init omap15xx_gpio_init(void) if (!cpu_is_omap15xx()) return -EINVAL; + omap15xx_gpio_config.gpio_fn = gpio_fn; platform_device_register(omap15xx_mpu_gpio); + + omap15xx_mpu_gpio_config.gpio_fn = gpio_fn; platform_device_register(omap15xx_gpio); gpio_bank_count = 2; diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c index 5dd0d4c..9d8aabc 100644 --- a/arch/arm/mach-omap1/gpio16xx.c +++ b/arch/arm/mach-omap1/gpio16xx.c @@ -24,6 +24,8 @@ #define OMAP1610_GPIO4_BASE0xfffbbc00 #define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE +#define OMAP1610_GPIO_INDEX_MASK 0x0f + /* mpu gpio */ static struct __initdata resource omap16xx_mpu_gpio_resources[] = { { @@ -178,6 +180,15 @@ static struct __initdata platform_device * omap16xx_gpio_dev[] = { omap16xx_gpio4, }; +static int get_gpio_index(int gpio) +{ + return gpio OMAP1610_GPIO_INDEX_MASK; +} + +static struct omap_gpio_func gpio_fn = { + .get_index = get_gpio_index, +}; + /* * omap16xx_gpio_init needs to be done before * machine_init functions access gpio APIs. @@ -190,8 +201,13 @@ static int __init omap16xx_gpio_init(void) if (!cpu_is_omap16xx()) return -EINVAL; - for (i = 0; i ARRAY_SIZE(omap16xx_gpio_dev); i++) + for (i = 0; i ARRAY_SIZE(omap16xx_gpio_dev); i++) { + struct omap_gpio_platform_data *pdata; + + pdata = omap16xx_gpio_dev[i]-dev.platform_data; + pdata-gpio_fn = gpio_fn; platform_device_register(omap16xx_gpio_dev[i]); + } gpio_bank_count = ARRAY_SIZE(omap16xx_gpio_dev); diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c index 1204c8b..74456a9 100644 --- a/arch/arm/mach-omap1/gpio7xx.c +++ b/arch/arm/mach-omap1/gpio7xx.c @@ -26,6 +26,8 @@ #define OMAP7XX_GPIO6_BASE 0xfffbe800 #define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE +#define OMAP7XX_GPIO_INDEX_MASK0x1f + /* mpu gpio */ static struct __initdata resource omap7xx_mpu_gpio_resources[] = { { @@ -240,6 +242,15 @@ static struct __initdata platform_device * omap7xx_gpio_dev[] = { omap7xx_gpio6, }; +static int get_gpio_index(int gpio) +{ + return gpio OMAP7XX_GPIO_INDEX_MASK; +} + +static struct omap_gpio_func gpio_fn = { + .get_index = get_gpio_index, +}; + /* * omap7xx_gpio_init needs to be done before * machine_init functions access gpio APIs. @@ -252,8 +263,13 @@ static int __init omap7xx_gpio_init(void) if (!cpu_is_omap7xx()) return -EINVAL; - for (i = 0; i ARRAY_SIZE(omap7xx_gpio_dev); i++) + for (i = 0; i ARRAY_SIZE(omap7xx_gpio_dev); i++) { + struct omap_gpio_platform_data *pdata; + + pdata = omap7xx_gpio_dev[i]-dev.platform_data; + pdata-gpio_fn = gpio_fn; platform_device_register(omap7xx_gpio_dev[i]); + } gpio_bank_count = ARRAY_SIZE(omap7xx_gpio_dev); diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c index 9529842..498ab92 100644 --- a/arch/arm/mach-omap2/gpio.c +++ b/arch/arm/mach-omap2/gpio.c @@ -24,6 +24,8 @@ #include plat/omap_hwmod.h #include plat/omap_device.h +#define OMAP2_GPIO_INDEX_MASK 0x1f + static struct omap_device_pm_latency omap_gpio_latency[] = { [0
[RFC PATCH 16/18] OMAP: GPIO: move omap_gpio_mod_init to mach-omap
Move omap_gpio_mod_init() from plat-omap/ to mach-omap*/ as this function handles architecture specific GPIO module initialization. Provide non_wakeup_gpios information through pdata. With this change all the cpu_is* checks #ifdef CONFIG_ARCH_OMAP* will be removed from OMAP GPIO driver. Also remove all the unsused register offset macros. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap1/gpio15xx.c |7 ++ arch/arm/mach-omap1/gpio16xx.c | 24 + arch/arm/mach-omap1/gpio7xx.c |7 ++ arch/arm/mach-omap2/gpio.c | 31 +- arch/arm/plat-omap/gpio.c | 172 ++-- arch/arm/plat-omap/include/plat/gpio.h |2 + 6 files changed, 74 insertions(+), 169 deletions(-) diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c index 3763db3..f8303e6 100644 --- a/arch/arm/mach-omap1/gpio15xx.c +++ b/arch/arm/mach-omap1/gpio15xx.c @@ -163,6 +163,12 @@ static void gpio_enable_irq(void __iomem *base, int gpio_mask, int enable) gpio_write(l, base, IRQENABLE1); } +static void gpio_init(void __iomem *base, u32 id) +{ + gpio_write(0x, base, INT_CTRL); + gpio_write(0, base, IRQSTATUS_REG0); +} + static struct omap_gpio_func gpio_fn = { .get_index = get_gpio_index, .gpio_valid = gpio_valid, @@ -171,6 +177,7 @@ static struct omap_gpio_func gpio_fn = { .gpio_set_trigger = gpio_set_trigger, .gpio_is_irqena = gpio_is_irqena, .gpio_enable_irq = gpio_enable_irq, + .gpio_init = gpio_init, }; /* diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c index cbac063..37820ba 100644 --- a/arch/arm/mach-omap1/gpio16xx.c +++ b/arch/arm/mach-omap1/gpio16xx.c @@ -291,6 +291,29 @@ static void gpio_enable_irq(void __iomem *base, int gpio_mask, int enable) gpio_write(gpio_mask, base, CLEARIRQENA1); } +/* + * GPIO SYSCONFIG needs to be set expicitly in + * the driver code only for OMAP16xx. For OMAP2plus + * this is taken care by PM runtime framework. + * Hence no specific field is required to defined in + * omap_gpio_reg_offsets. + */ +#define OMAP1610_GPIO_SYSCONFIG0x0010 + +static void gpio_init(void __iomem *base, u32 id) +{ + gpio_write(0, base, IRQENABLE1); + gpio_write(0x, base, IRQSTATUS_REG0); + __raw_writew(0x0014, base + OMAP1610_GPIO_SYSCONFIG); + + /* +* Enable system clock for GPIO module. +* The CAM_CLK_CTRL *is* really the right place. +*/ + omap_writel(omap_readl(ULPD_CAM_CLK_CTRL) | 0x04, + ULPD_CAM_CLK_CTRL); +} + static struct omap_gpio_func gpio_fn = { .get_index = get_gpio_index, .gpio_valid = gpio_valid, @@ -299,6 +322,7 @@ static struct omap_gpio_func gpio_fn = { .gpio_set_trigger = gpio_set_trigger, .gpio_is_irqena = gpio_is_irqena, .gpio_enable_irq = gpio_enable_irq, + .gpio_init = gpio_init, }; /* diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c index cd6bad7..792156c 100644 --- a/arch/arm/mach-omap1/gpio7xx.c +++ b/arch/arm/mach-omap1/gpio7xx.c @@ -325,6 +325,12 @@ static void gpio_enable_irq(void __iomem *base, int gpio_mask, int enable) gpio_write(l, base, IRQENABLE1); } +static void gpio_init(void __iomem *base, u32 id) +{ + gpio_write(0x, base, INT_CTRL); + gpio_write(0, base, IRQSTATUS_REG0); +} + static struct omap_gpio_func gpio_fn = { .get_index = get_gpio_index, .gpio_valid = gpio_valid, @@ -333,6 +339,7 @@ static struct omap_gpio_func gpio_fn = { .gpio_set_trigger = gpio_set_trigger, .gpio_is_irqena = gpio_is_irqena, .gpio_enable_irq = gpio_enable_irq, + .gpio_init = gpio_init, }; /* diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c index 73b5705..f5615a7 100644 --- a/arch/arm/mach-omap2/gpio.c +++ b/arch/arm/mach-omap2/gpio.c @@ -421,6 +421,22 @@ static void gpio_restore_ctx(void __iomem *base, u32 id) } } +static void gpio_init(void __iomem *base, u32 id) +{ + if (cpu_is_omap44xx()) { + gpio_write(0x, base, IRQSTATUSCLR0); + gpio_write(0x, base, DEBOUNCE_EN); + /* Initialize interface clk ungated, module enabled */ + gpio_write(0, base, CTRL); + } else if (cpu_is_omap34xx()) { + gpio_write(0x, base, IRQENABLE1); + gpio_write(0x, base, IRQSTATUS_REG0); + gpio_write(0x, base, DEBOUNCE_EN); + /* Initialize interface clk ungated, module enabled */ + gpio_write(0, base, CTRL); + } +} + static struct omap_gpio_func gpio_fn = { .get_index = get_gpio_index, .gpio_valid = gpio_valid, @@ -434,6 +450,7 @@ static struct omap_gpio_func gpio_fn = { .gpio_resume_after_idle
[RFC PATCH 06/18] OMAP: GPIO: cleanup set trigger func
Cleanup GPIO set trigger and toggle edge triggering functions by removing the cpu_is checks and the CONFIG_ARCH_* checks . Some part of the code access the gpio_bank structure which is specific to the OMAP GPIO driver. Therefore such part of the code are handled by means of gpio-method. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap1/gpio15xx.c | 17 ++ arch/arm/mach-omap1/gpio16xx.c | 37 + arch/arm/mach-omap1/gpio7xx.c | 19 +++ arch/arm/mach-omap2/gpio.c | 31 arch/arm/plat-omap/gpio.c | 264 arch/arm/plat-omap/include/plat/gpio.h |1 + 6 files changed, 201 insertions(+), 168 deletions(-) diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c index 26c6c25..3c64e69 100644 --- a/arch/arm/mach-omap1/gpio15xx.c +++ b/arch/arm/mach-omap1/gpio15xx.c @@ -17,6 +17,7 @@ */ #include linux/gpio.h +#include linux/irq.h #define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE #define OMAP1510_GPIO_BASE 0xFFFCE000 @@ -128,11 +129,27 @@ static int gpio_valid(int gpio) return -EINVAL; } +static int gpio_set_trigger(void __iomem *base, int gpio, int trigger) +{ + u32 l = gpio_read(base, INT_CTRL); + + if (trigger IRQ_TYPE_EDGE_RISING) + l |= 1 gpio; + else if (trigger IRQ_TYPE_EDGE_FALLING) + l = ~(1 gpio); + else + return -EINVAL; + + gpio_write(l, base, INT_CTRL); + return 0; +} + static struct omap_gpio_func gpio_fn = { .get_index = get_gpio_index, .gpio_valid = gpio_valid, .gpio_read = gpio_read, .gpio_write = gpio_write, + .gpio_set_trigger = gpio_set_trigger, }; /* diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c index 473c889..6b4afa2 100644 --- a/arch/arm/mach-omap1/gpio16xx.c +++ b/arch/arm/mach-omap1/gpio16xx.c @@ -17,6 +17,7 @@ */ #include linux/gpio.h +#include linux/irq.h #define OMAP1610_GPIO1_BASE0xfffbe400 #define OMAP1610_GPIO2_BASE0xfffbec00 @@ -30,6 +31,12 @@ #define OMAP1610_NON_MPUIO_GPIO_VALID ((OMAP1610_GPIO_BANK_CNT - 1) *\ OMAP1610_GPIO_WIDTH) +#defineOMAP1610_GPIO_USE_EDGE_CTRL2_REG0x08 +#defineOMAP1610_GPIO_SET_FALLING_EDGE 0x01 +#defineOMAP1610_GPIO_SET_RISING_EDGE 0x02 +#defineOMAP1610_GPIO_BOTH_EDGE_SET 0x03 +#defineOMAP1610_GPIO_EDGE_MASK 0x07 + static u16 reg_map[] = { [REV] = 0x00, [SYS_CFG] = 0x10, @@ -236,11 +243,41 @@ static int gpio_valid(int gpio) return -EINVAL; } +static int gpio_set_trigger(void __iomem *base, int gpio, int trigger) +{ + u32 offset; + u32 l = 0; + + if (gpio OMAP1610_GPIO_USE_EDGE_CTRL2_REG) + offset = EDGE_CTRL2; + else + offset = EDGE_CTRL1; + + l = gpio_read(base, offset); + gpio = OMAP1610_GPIO_EDGE_MASK; + l = ~(OMAP1610_GPIO_BOTH_EDGE_SET (gpio 1)); + + if (trigger IRQ_TYPE_EDGE_RISING) + l |= OMAP1610_GPIO_SET_RISING_EDGE (gpio 1); + if (trigger IRQ_TYPE_EDGE_FALLING) + l |= OMAP1610_GPIO_SET_FALLING_EDGE (gpio 1); + + if (trigger) + /* Enable wake-up during idle for dynamic tick */ + gpio_write(1 gpio, base, SETWKUENA); + else + gpio_write(1 gpio, base, CLEARWKUENA); + + gpio_write(l, base, offset); + return 0; +} + static struct omap_gpio_func gpio_fn = { .get_index = get_gpio_index, .gpio_valid = gpio_valid, .gpio_read = gpio_read, .gpio_write = gpio_write, + .gpio_set_trigger = gpio_set_trigger, }; /* diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c index a6c2397..599067d 100644 --- a/arch/arm/mach-omap1/gpio7xx.c +++ b/arch/arm/mach-omap1/gpio7xx.c @@ -17,6 +17,7 @@ */ #include linux/gpio.h +#include linux/irq.h #define OMAP7XX_GPIO1_BASE 0xfffbc000 #define OMAP7XX_GPIO2_BASE 0xfffbc800 @@ -289,11 +290,29 @@ static int gpio_valid(int gpio) return -EINVAL; } +static int gpio_set_trigger(void __iomem *base, int gpio, int trigger) +{ + u32 l = 0; + + l = gpio_read(base, INT_CTRL); + + if (trigger IRQ_TYPE_EDGE_RISING) + l |= 1 gpio; + else if (trigger IRQ_TYPE_EDGE_FALLING) + l = ~(1 gpio); + else + return -EINVAL; + + gpio_write(l, base, INT_CTRL); + return 0; +} + static struct omap_gpio_func gpio_fn = { .get_index = get_gpio_index, .gpio_valid = gpio_valid, .gpio_read = gpio_read, .gpio_write = gpio_write, + .gpio_set_trigger = gpio_set_trigger, }; /* diff --git
[RFC PATCH 11/18] OMAP: GPIO: Remove dependency on gpio_bank_count
gpio_bank_count is the count of number of GPIO devices in a SoC. Remove this dependency from the driver. Also remove the dependency on array of pointers to gpio_bank struct of all GPIO devices. The cpu_is*() checks used in omap2_gpio_prepare_for_idle() and omap2_gpio_resume_after_idle() would be removed in one of the patches in this series Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap1/gpio15xx.c |1 - arch/arm/mach-omap1/gpio16xx.c |2 - arch/arm/mach-omap1/gpio7xx.c |2 - arch/arm/mach-omap2/gpio.c |1 + arch/arm/plat-omap/gpio.c | 165 arch/arm/plat-omap/include/plat/gpio.h |3 - 6 files changed, 83 insertions(+), 91 deletions(-) diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c index 7a7a123..3763db3 100644 --- a/arch/arm/mach-omap1/gpio15xx.c +++ b/arch/arm/mach-omap1/gpio15xx.c @@ -189,7 +189,6 @@ static int __init omap15xx_gpio_init(void) omap15xx_mpu_gpio_config.gpio_fn = gpio_fn; platform_device_register(omap15xx_gpio); - gpio_bank_count = 2; return 0; } postcore_initcall(omap15xx_gpio_init); diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c index f05e0c7..6a99b01 100644 --- a/arch/arm/mach-omap1/gpio16xx.c +++ b/arch/arm/mach-omap1/gpio16xx.c @@ -316,8 +316,6 @@ static int __init omap16xx_gpio_init(void) platform_device_register(omap16xx_gpio_dev[i]); } - gpio_bank_count = ARRAY_SIZE(omap16xx_gpio_dev); - return 0; } postcore_initcall(omap16xx_gpio_init); diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c index 1103efc..cd6bad7 100644 --- a/arch/arm/mach-omap1/gpio7xx.c +++ b/arch/arm/mach-omap1/gpio7xx.c @@ -355,8 +355,6 @@ static int __init omap7xx_gpio_init(void) platform_device_register(omap7xx_gpio_dev[i]); } - gpio_bank_count = ARRAY_SIZE(omap7xx_gpio_dev); - return 0; } postcore_initcall(omap7xx_gpio_init); diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c index 25fe8a4..a46f4a5 100644 --- a/arch/arm/mach-omap2/gpio.c +++ b/arch/arm/mach-omap2/gpio.c @@ -28,6 +28,7 @@ #define OMAP2_GPIO_INDEX_MASK 0x1f #define OMAP2_GPIO_IRQENA_MASK 0x +int gpio_bank_count; int bank_width; static u16 *reg_map; static u16 omap2_gpio_reg_offsets[] = { diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index df2414d..f2cd2dd 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -14,6 +14,7 @@ * published by the Free Software Foundation. */ +#include linux/kernel.h #include linux/init.h #include linux/module.h #include linux/interrupt.h @@ -135,7 +136,10 @@ #define OMAP4_GPIO_CLEARDATAOUT0x0190 #define OMAP4_GPIO_SETDATAOUT 0x0194 +static LIST_HEAD(omap_gpio_list); + struct gpio_bank { + struct list_head node; unsigned long pbase; void __iomem *base; u16 irq; @@ -145,7 +149,7 @@ struct gpio_bank { u32 saved_wakeup; u32 non_wakeup_gpios; u32 enabled_non_wakeup_gpios; - + u16 id; u32 saved_datain; u32 saved_fallingdetect; u32 saved_risingdetect; @@ -178,18 +182,10 @@ struct omap3_gpio_regs { static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS]; #endif -/* - * TODO: Cleanup gpio_bank usage as it is having information - * related to all instances of the device - */ -static struct gpio_bank *gpio_bank; static struct omap_gpio_func gpio_fn; static int bank_width; -/* TODO: Analyze removing gpio_bank_count usage from driver code */ -int gpio_bank_count; - static int check_gpio(int gpio) { if (unlikely(gpio_fn.gpio_valid(gpio) 0)) { @@ -634,7 +630,7 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) if (bank-non_wakeup_gpios (1 gpio)) { printk(KERN_ERR Unable to modify wakeup on non-wakeup GPIO%d\n, - (bank - gpio_bank) * 32 + gpio); + bank-id * 32 + gpio); return -EINVAL; } case METHOD_MPUIO: @@ -991,17 +987,23 @@ static struct platform_device omap_mpuio_device = { /* could list the /proc/iomem resources */ }; -static inline void mpuio_init(void) +static inline void mpuio_init(struct gpio_bank *bank) { - struct gpio_bank *bank = gpio_bank[0]; + static int mpuio_init_done; + + if (mpuio_init_done || (bank-method != METHOD_MPUIO)) + return; + platform_set_drvdata(omap_mpuio_device, bank); - if (platform_driver_register(omap_mpuio_driver) == 0) - (void) platform_device_register(omap_mpuio_device); + if (!platform_driver_register(omap_mpuio_driver
[RFC PATCH 17/18] OMAP: GPIO: use dev_err* instead of printk
Use dev_info()/dev_err() instead of printk in OMAP GPIO driver Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/plat-omap/gpio.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 9c3e865..7ae9f6f 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -66,7 +66,7 @@ static int omap_gpio_sysinit(void); static int check_gpio(int gpio) { if (unlikely(gpio_fn.gpio_valid(gpio) 0)) { - printk(KERN_ERR omap-gpio: invalid GPIO %d\n, gpio); + pr_err(omap-gpio: invalid GPIO %d\n, gpio); dump_stack(); return -1; } @@ -470,7 +470,7 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) case METHOD_GPIO_24XX: case METHOD_GPIO_44XX: if (bank-non_wakeup_gpios (1 gpio)) { - printk(KERN_ERR Unable to modify wakeup on + dev_err(bank-dev, Unable to modify wakeup on non-wakeup GPIO%d\n, bank-id * 32 + gpio); return -EINVAL; @@ -485,7 +485,7 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) spin_unlock_irqrestore(bank-lock, flags); return 0; default: - printk(KERN_ERR Can't enable GPIO wakeup for method %i\n, + dev_err(bank-dev, Can't enable GPIO wakeup for method %i\n, bank-method); return -EINVAL; } -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 02/18] OMAP: GPIO: remove get_gpio_bank()
use chip info to get the pointer to the struct gpio_bank for a given GPIO bank and remove get_gpio_bank(). Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/plat-omap/gpio.c | 29 ++--- 1 files changed, 2 insertions(+), 27 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 9164bd4..498e1df 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -189,31 +189,6 @@ static int bank_width; /* TODO: Analyze removing gpio_bank_count usage from driver code */ int gpio_bank_count; -static inline struct gpio_bank *get_gpio_bank(int gpio) -{ - if (cpu_is_omap15xx()) { - if (OMAP_GPIO_IS_MPUIO(gpio)) - return gpio_bank[0]; - return gpio_bank[1]; - } - if (cpu_is_omap16xx()) { - if (OMAP_GPIO_IS_MPUIO(gpio)) - return gpio_bank[0]; - return gpio_bank[1 + (gpio 4)]; - } - if (cpu_is_omap7xx()) { - if (OMAP_GPIO_IS_MPUIO(gpio)) - return gpio_bank[0]; - return gpio_bank[1 + (gpio 5)]; - } - if (cpu_is_omap24xx()) - return gpio_bank[gpio 5]; - if (cpu_is_omap34xx() || cpu_is_omap44xx()) - return gpio_bank[gpio 5]; - BUG(); - return NULL; -} - static inline int get_gpio_index(int gpio) { if (cpu_is_omap7xx()) @@ -1393,7 +1368,7 @@ static struct platform_device omap_mpuio_device = { static inline void mpuio_init(void) { - struct gpio_bank *bank = get_gpio_bank(OMAP_MPUIO(0)); + struct gpio_bank *bank = gpio_bank[0]; platform_set_drvdata(omap_mpuio_device, bank); if (platform_driver_register(omap_mpuio_driver) == 0) @@ -1469,7 +1444,7 @@ static int gpio_get(struct gpio_chip *chip, unsigned offset) u32 mask; gpio = chip-base + offset; - bank = get_gpio_bank(gpio); + bank = container_of(chip, struct gpio_bank, chip); reg = bank-base; mask = 1 get_gpio_index(gpio); -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 18/18] OMAP: GPIO: Remove usage of bank method
Remove usage of bank-method to identify CPU specific OMAP GPIO bank. Instead identify specific features using flags and accordingly manage. bank-type MPUIO is common for all OMAP1 SoCs. Use bank-stride to identify the MPUIO type bank Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap1/gpio15xx.c |2 - arch/arm/mach-omap1/gpio16xx.c | 24 ++-- arch/arm/mach-omap1/gpio7xx.c |7 - arch/arm/mach-omap2/gpio.c | 11 ++- arch/arm/plat-omap/gpio.c | 228 +-- arch/arm/plat-omap/include/plat/gpio.h | 46 ++- 6 files changed, 155 insertions(+), 163 deletions(-) diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c index f8303e6..aa08ebf 100644 --- a/arch/arm/mach-omap1/gpio15xx.c +++ b/arch/arm/mach-omap1/gpio15xx.c @@ -54,7 +54,6 @@ static struct __initdata resource omap15xx_mpu_gpio_resources[] = { static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = { .virtual_irq_start = IH_MPUIO_BASE, - .bank_type = METHOD_MPUIO, .bank_width = OMAP1510_GPIO_WIDTH, .bank_stride= 1, }; @@ -84,7 +83,6 @@ static struct __initdata resource omap15xx_gpio_resources[] = { static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = { .virtual_irq_start = IH_GPIO_BASE, - .bank_type = METHOD_GPIO_1510, .bank_width = OMAP1510_GPIO_WIDTH, }; diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c index 37820ba..5f116f6 100644 --- a/arch/arm/mach-omap1/gpio16xx.c +++ b/arch/arm/mach-omap1/gpio16xx.c @@ -38,6 +38,13 @@ #defineOMAP1610_GPIO_BOTH_EDGE_SET 0x03 #defineOMAP1610_GPIO_EDGE_MASK 0x07 +#define OMAP16XX_SPECIFIC_SUPPORT\ + .bank_width = 16,\ + .suspend_resume_support = true,\ + .features = BIT(OMAP_GPIO_REV_SHOW_FLAG) |\ + BIT(OMAP_GPIO_DATAOUT_SET_CLR_REGS_FLAG) |\ + BIT(OMAP_GPIO_DUAL_EDGE_TRIG_FLAG)\ + static u16 reg_map[] = { [REV] = 0x00, [SYS_CFG] = 0x10, @@ -73,7 +80,6 @@ static struct __initdata resource omap16xx_mpu_gpio_resources[] = { static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = { .virtual_irq_start = IH_MPUIO_BASE, - .bank_type = METHOD_MPUIO, .bank_width = OMAP1610_GPIO_WIDTH, .bank_stride= 1, .suspend_resume_support = true, @@ -104,9 +110,7 @@ static struct __initdata resource omap16xx_gpio1_resources[] = { static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = { .virtual_irq_start = IH_GPIO_BASE, - .bank_type = METHOD_GPIO_1610, - .bank_width = OMAP1610_GPIO_WIDTH, - .suspend_resume_support = true, + OMAP16XX_SPECIFIC_SUPPORT, }; static struct __initdata platform_device omap16xx_gpio1 = { @@ -134,9 +138,7 @@ static struct __initdata resource omap16xx_gpio2_resources[] = { static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = { .virtual_irq_start = IH_GPIO_BASE + 16, - .bank_type = METHOD_GPIO_1610, - .bank_width = OMAP1610_GPIO_WIDTH, - .suspend_resume_support = true, + OMAP16XX_SPECIFIC_SUPPORT, }; static struct __initdata platform_device omap16xx_gpio2 = { @@ -164,9 +166,7 @@ static struct __initdata resource omap16xx_gpio3_resources[] = { static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = { .virtual_irq_start = IH_GPIO_BASE + 32, - .bank_type = METHOD_GPIO_1610, - .bank_width = OMAP1610_GPIO_WIDTH, - .suspend_resume_support = true, + OMAP16XX_SPECIFIC_SUPPORT, }; static struct __initdata platform_device omap16xx_gpio3 = { @@ -194,9 +194,7 @@ static struct __initdata resource omap16xx_gpio4_resources[] = { static struct __initdata omap_gpio_platform_data omap16xx_gpio4_config = { .virtual_irq_start = IH_GPIO_BASE + 48, - .bank_type = METHOD_GPIO_1610, - .bank_width = OMAP1610_GPIO_WIDTH, - .suspend_resume_support = true, + OMAP16XX_SPECIFIC_SUPPORT, }; static struct __initdata platform_device omap16xx_gpio4 = { diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c index 792156c..28d5917 100644 --- a/arch/arm/mach-omap1/gpio7xx.c +++ b/arch/arm/mach-omap1/gpio7xx.c @@ -60,7 +60,6 @@ static struct __initdata resource omap7xx_mpu_gpio_resources[] = { static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = { .virtual_irq_start = IH_MPUIO_BASE, - .bank_type = METHOD_MPUIO, .bank_width
[RFC PATCH 15/18] OMAP: GPIO: cleanup gpio_show_rev
Remove cpu_is* checks from omap_gpio_show_rev. Also display GPIO IP version only once as it is not required to print the IP version of all the banks as they are the same. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/plat-omap/gpio.c | 17 ++--- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 0f48364..637db76 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -1032,12 +1032,10 @@ static void __init omap_gpio_show_rev(struct gpio_bank *bank) { u32 rev; - if (cpu_is_omap16xx() !(bank-method != METHOD_MPUIO)) - rev = __raw_readw(bank-base + OMAP1610_GPIO_REVISION); - else if (cpu_is_omap24xx() || cpu_is_omap34xx()) - rev = __raw_readl(bank-base + OMAP24XX_GPIO_REVISION); - else if (cpu_is_omap44xx()) - rev = __raw_readl(bank-base + OMAP4_GPIO_REVISION); + if ((bank-method == METHOD_GPIO_24XX) || + (bank-method == METHOD_GPIO_44XX) || + (bank-method == METHOD_GPIO_1610)) + rev = gpio_fn.gpio_read(bank-base, REV); else return; @@ -1170,6 +1168,7 @@ static void __init omap_gpio_chip_init(struct gpio_bank *bank) static int __devinit omap_gpio_probe(struct platform_device *pdev) { static int gpio_init_done; + static int show_rev; struct omap_gpio_platform_data *pdata; struct resource *res; struct gpio_bank *bank; @@ -1238,7 +1237,6 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev) omap_gpio_mod_init(bank, pdev-id); omap_gpio_chip_init(bank); - omap_gpio_show_rev(bank); list_add_tail(bank-node, omap_gpio_list); @@ -1259,6 +1257,11 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev) gpio_init_done = 1; } + if ((bank-method != METHOD_MPUIO) (!show_rev)) { + omap_gpio_show_rev(bank); + show_rev = 1; + } + return 0; } -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 12/18] OMAP: GPIO: cleanup set_debounce, idle/resume_after_idle
gpio_set_debounce(), gpio_prepare_for_idle() and gpio_resume_after_idle() are specific to OMAP2PLUS CPUs. These functions rely on dbck_enable_mask which is part of GPIO bank structure. The above mentioned functions are moved to mach-omap2/gpio.c and the required information is passed from the OMAP GPIO driver. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap2/gpio.c | 201 - arch/arm/plat-omap/gpio.c | 223 +++- arch/arm/plat-omap/include/plat/gpio.h |6 + 3 files changed, 222 insertions(+), 208 deletions(-) diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c index a46f4a5..a0edaeb 100644 --- a/arch/arm/mach-omap2/gpio.c +++ b/arch/arm/mach-omap2/gpio.c @@ -21,13 +21,31 @@ #include linux/err.h #include linux/slab.h #include linux/interrupt.h +#include linux/clk.h #include plat/omap_hwmod.h #include plat/omap_device.h #define OMAP2_GPIO_INDEX_MASK 0x1f #define OMAP2_GPIO_IRQENA_MASK 0x +#define OMAP2_GPIO_DEBOUNCE_MIN_CHK32 +#define OMAP2_GPIO_DEBOUNCE_MAX_CHK7936 +#define OMAP2_GPIO_DEBOUNCE_MIN_VAL0x01 +#define OMAP2_GPIO_DEBOUNCE_MAX_VAL0xff +#define OMAP2_GPIO_DEBOUNCE_VAL_DIV0x1f +struct gpio_state { + struct list_head node; + u32 saved_datain; + u32 saved_fallingdetect; + u32 saved_risingdetect; + u32 dbck_enable_mask; + struct clk *dbck; + u16 id; +}; + +static int workaround_enabled; +static LIST_HEAD(omap_gpio_ctx_list); int gpio_bank_count; int bank_width; static u16 *reg_map; @@ -172,6 +190,161 @@ static void gpio_enable_irq(void __iomem *base, int gpio_mask, int enable) } } +static void gpio_debounce_set(void __iomem *base, unsigned gpio, + unsigned debounce, u16 id) +{ + u32 val; + u32 l = 0; + struct gpio_state *gpio_dev_state; + + if (debounce OMAP2_GPIO_DEBOUNCE_MIN_CHK) + debounce = OMAP2_GPIO_DEBOUNCE_MIN_VAL; + else if (debounce OMAP2_GPIO_DEBOUNCE_MAX_CHK) + debounce = OMAP2_GPIO_DEBOUNCE_MAX_VAL; + else + debounce = (debounce / OMAP2_GPIO_DEBOUNCE_VAL_DIV) - 1; + + gpio_write(debounce, base, DEBOUNCE_VAL); + + val = gpio_read(base, DEBOUNCE_EN); + l = 1 get_gpio_index(gpio); + + list_for_each_entry(gpio_dev_state, omap_gpio_ctx_list, node) { + if (gpio_dev_state-id == id) { + if (debounce) { + val |= l; + clk_enable(gpio_dev_state-dbck); + } else { + val = ~l; + clk_disable(gpio_dev_state-dbck); + } + gpio_dev_state-dbck_enable_mask = val; + gpio_write(val, base, DEBOUNCE_EN); + } + } +} + +static void gpio_prepare_for_idle(u32 enabled_non_wakeup_gpios, u16 id, + void __iomem *base, int off_mode) +{ + int c = 0; + struct gpio_state *gpio_dev_state; + + list_for_each_entry(gpio_dev_state, omap_gpio_ctx_list, node) { + u32 l1 = 0, l2 = 0; + int j; + + if (!gpio_dev_state-id == id) + continue; + + if ((cpu_is_omap34xx()) (id == 0)) + continue; + + for (j = 0; j hweight_long(gpio_dev_state-dbck_enable_mask); + j++) + clk_disable(gpio_dev_state-dbck); + + if (!off_mode) + continue; + + /* +* If going to OFF, remove triggering for all +* non-wakeup GPIOs. Otherwise spurious IRQs will be +* generated. See OMAP2420 Errata item 1.101. +*/ + if (!enabled_non_wakeup_gpios) + continue; + + gpio_dev_state-saved_datain = gpio_read(base, DATAIN); + l1 = gpio_read(base, FALLINGDETECT); + l2 = gpio_read(base, RISINGDETECT); + + gpio_dev_state-saved_fallingdetect = l1; + gpio_dev_state-saved_risingdetect = l2; + l1 = ~enabled_non_wakeup_gpios; + l2 = ~enabled_non_wakeup_gpios; + + gpio_write(l1, base, FALLINGDETECT); + gpio_write(l2, base, RISINGDETECT); + + c++; + } + if (!c) { + workaround_enabled = 0; + return; + } + workaround_enabled = 1; +} + +static void gpio_resume_after_idle(u32 enabled_non_wakeup_gpios, u16 id, + void __iomem *base) +{ + struct gpio_state *gpio_dev_state; + + list_for_each_entry(gpio_dev_state, omap_gpio_ctx_list, node) { + u32 l = 0, gen, gen0, gen1; + int j
[RFC PATCH 13/18] OMAP: GPIO: cleanup save/restore context
Move GPIO save/restore context to SoC specific file. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap2/gpio.c | 78 +++ arch/arm/plat-omap/gpio.c | 91 --- arch/arm/plat-omap/include/plat/gpio.h |2 + 3 files changed, 92 insertions(+), 79 deletions(-) diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c index a0edaeb..a7bb005 100644 --- a/arch/arm/mach-omap2/gpio.c +++ b/arch/arm/mach-omap2/gpio.c @@ -34,6 +34,19 @@ #define OMAP2_GPIO_DEBOUNCE_MAX_VAL0xff #define OMAP2_GPIO_DEBOUNCE_VAL_DIV0x1f +struct omap_gpio_regs { + u32 irqenable1; + u32 irqenable2; + u32 wake_en; + u32 ctrl; + u32 oe; + u32 leveldetect0; + u32 leveldetect1; + u32 risingdetect; + u32 fallingdetect; + u32 dataout; +}; + struct gpio_state { struct list_head node; u32 saved_datain; @@ -42,6 +55,7 @@ struct gpio_state { u32 dbck_enable_mask; struct clk *dbck; u16 id; + struct omap_gpio_regs gpio_ctx; }; static int workaround_enabled; @@ -345,6 +359,68 @@ static void gpio_resume_after_idle(u32 enabled_non_wakeup_gpios, u16 id, } } +static void gpio_save_ctx(void __iomem *base, u32 id) +{ + struct gpio_state *gpio_dev_state; + + if (!cpu_is_omap34xx()) + return; + + list_for_each_entry(gpio_dev_state, omap_gpio_ctx_list, node) { + /* saving banks from 2-6 only since GPIO1 is in WKUP */ + if ((gpio_dev_state-id == 0) || (gpio_dev_state-id != id)) + continue; + + gpio_dev_state-gpio_ctx.irqenable1 = gpio_read(base, + IRQENABLE1); + gpio_dev_state-gpio_ctx.irqenable2 = gpio_read(base, + IRQENABLE2); + gpio_dev_state-gpio_ctx.wake_en = gpio_read(base, WAKE_EN); + gpio_dev_state-gpio_ctx.ctrl = gpio_read(base, CTRL); + gpio_dev_state-gpio_ctx.oe = gpio_read(base, OE); + gpio_dev_state-gpio_ctx.leveldetect0 = gpio_read(base, + LEVELDETECT0); + gpio_dev_state-gpio_ctx.leveldetect1 = gpio_read(base, + LEVELDETECT1); + gpio_dev_state-gpio_ctx.risingdetect = gpio_read(base, + RISINGDETECT); + gpio_dev_state-gpio_ctx.fallingdetect = gpio_read(base, + FALLINGDETECT); + gpio_dev_state-gpio_ctx.dataout = gpio_read(base, DATAOUT); + } +} + +static void gpio_restore_ctx(void __iomem *base, u32 id) +{ + struct gpio_state *gpio_dev_state; + + if (!cpu_is_omap34xx()) + return; + + list_for_each_entry(gpio_dev_state, omap_gpio_ctx_list, node) { + /* restore the required registers of bank 2-6 */ + if ((gpio_dev_state-id == 0) || (gpio_dev_state-id != id)) + continue; + + gpio_write(gpio_dev_state-gpio_ctx.irqenable1, base, + IRQENABLE1); + gpio_write(gpio_dev_state-gpio_ctx.irqenable2, base, + IRQENABLE2); + gpio_write(gpio_dev_state-gpio_ctx.wake_en, base, WAKE_EN); + gpio_write(gpio_dev_state-gpio_ctx.ctrl, base, CTRL); + gpio_write(gpio_dev_state-gpio_ctx.oe, base, OE); + gpio_write(gpio_dev_state-gpio_ctx.leveldetect0, base, + LEVELDETECT0); + gpio_write(gpio_dev_state-gpio_ctx.leveldetect1, base, + LEVELDETECT1); + gpio_write(gpio_dev_state-gpio_ctx.risingdetect, base, + RISINGDETECT); + gpio_write(gpio_dev_state-gpio_ctx.fallingdetect, base, + FALLINGDETECT); + gpio_write(gpio_dev_state-gpio_ctx.dataout, base, DATAOUT); + } +} + static struct omap_gpio_func gpio_fn = { .get_index = get_gpio_index, .gpio_valid = gpio_valid, @@ -356,6 +432,8 @@ static struct omap_gpio_func gpio_fn = { .gpio_debounce_set = gpio_debounce_set, .gpio_idle = gpio_prepare_for_idle, .gpio_resume_after_idle = gpio_resume_after_idle, + .gpio_save_ctx = gpio_save_ctx, + .gpio_restore_ctx = gpio_restore_ctx, }; static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 55115df..fd710cd 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -160,25 +160,7 @@ struct gpio_bank { int
[RFC PATCH 08/18] OMAP: GPIO: req/free: Remove reg offset macros usage
Remove the usage of register offset macros from gpio_request/free() APIs. Instead use the enum omap_gpio_reg_offsets and SoC specific gpio_read/write functions to access the GPIO registers. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/plat-omap/gpio.c | 65 +--- 1 files changed, 19 insertions(+), 46 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 115916d..28f58c6 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -700,28 +700,17 @@ static int omap_gpio_request(struct gpio_chip *chip, unsigned offset) */ _set_gpio_triggering(bank, offset, IRQ_TYPE_NONE); -#ifdef CONFIG_ARCH_OMAP15XX if (bank-method == METHOD_GPIO_1510) { - void __iomem *reg; - /* Claim the pin for MPU */ - reg = bank-base + OMAP1510_GPIO_PIN_CONTROL; - __raw_writel(__raw_readl(reg) | (1 offset), reg); + u32 ctrl = gpio_fn.gpio_read(bank-base, CTRL); + gpio_fn.gpio_write(ctrl | (1 offset), bank-base, CTRL); } -#endif - if (!cpu_class_is_omap1()) { + + if (bank-method = METHOD_GPIO_24XX) { if (!bank-mod_usage) { - void __iomem *reg = bank-base; - u32 ctrl; - - if (cpu_is_omap24xx() || cpu_is_omap34xx()) - reg += OMAP24XX_GPIO_CTRL; - else if (cpu_is_omap44xx()) - reg += OMAP4_GPIO_CTRL; - ctrl = __raw_readl(reg); + u32 ctrl = gpio_fn.gpio_read(bank-base, CTRL); /* Module is enabled, clocks are not gated */ - ctrl = 0xFFFE; - __raw_writel(ctrl, reg); + gpio_fn.gpio_write(ctrl ~0x1, bank-base, CTRL); } bank-mod_usage |= 1 offset; } @@ -736,43 +725,27 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) unsigned long flags; spin_lock_irqsave(bank-lock, flags); -#ifdef CONFIG_ARCH_OMAP16XX - if (bank-method == METHOD_GPIO_1610) { - /* Disable wake-up during idle for dynamic tick */ - void __iomem *reg = bank-base + OMAP1610_GPIO_CLEAR_WAKEUPENA; - __raw_writel(1 offset, reg); - } -#endif -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) - if (bank-method == METHOD_GPIO_24XX) { + + if ((bank-method == METHOD_GPIO_1610) || + (bank-method == METHOD_GPIO_24XX)) { /* Disable wake-up during idle for dynamic tick */ - void __iomem *reg = bank-base + OMAP24XX_GPIO_CLEARWKUENA; - __raw_writel(1 offset, reg); - } -#endif -#ifdef CONFIG_ARCH_OMAP4 - if (bank-method == METHOD_GPIO_44XX) { + gpio_fn.gpio_write(1 offset, bank-base, CLEARWKUENA); + } else if (bank-method == METHOD_GPIO_44XX) { /* Disable wake-up during idle for dynamic tick */ - void __iomem *reg = bank-base + OMAP4_GPIO_IRQWAKEN0; - __raw_writel(1 offset, reg); + gpio_fn.gpio_write(1 offset, bank-base, IRQWAKEN0); } -#endif - if (!cpu_class_is_omap1()) { + + + if (bank-method = METHOD_GPIO_24XX) { bank-mod_usage = ~(1 offset); + if (!bank-mod_usage) { - void __iomem *reg = bank-base; - u32 ctrl; - - if (cpu_is_omap24xx() || cpu_is_omap34xx()) - reg += OMAP24XX_GPIO_CTRL; - else if (cpu_is_omap44xx()) - reg += OMAP4_GPIO_CTRL; - ctrl = __raw_readl(reg); + u32 ctrl = gpio_fn.gpio_read(bank-base, CTRL); /* Module is disabled, clocks are gated */ - ctrl |= 1; - __raw_writel(ctrl, reg); + gpio_fn.gpio_write(ctrl | 1, bank-base, CTRL); } } + _reset_gpio(bank, bank-chip.base + offset); spin_unlock_irqrestore(bank-lock, flags); } -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 09/18] OMAP: GPIO: cleanup gpio_irq_handler
Remove CONFIG_ARCH_OMAP* checks from gpio_irq_handler. Also correct the multi-line comment style in the gpio_irq_handler. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/plat-omap/gpio.c | 70 +--- 1 files changed, 27 insertions(+), 43 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 28f58c6..5fe6dbf 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -761,7 +761,7 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) */ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) { - void __iomem *isr_reg = NULL; + u32 isr_val; u32 isr; unsigned int gpio_irq, gpio_index; struct gpio_bank *bank; @@ -771,58 +771,41 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) desc-irq_data.chip-irq_ack(desc-irq_data); bank = irq_get_handler_data(irq); -#ifdef CONFIG_ARCH_OMAP1 - if (bank-method == METHOD_MPUIO) - isr_reg = bank-base + - OMAP_MPUIO_GPIO_INT / bank-stride; -#endif -#ifdef CONFIG_ARCH_OMAP15XX - if (bank-method == METHOD_GPIO_1510) - isr_reg = bank-base + OMAP1510_GPIO_INT_STATUS; -#endif -#if defined(CONFIG_ARCH_OMAP16XX) - if (bank-method == METHOD_GPIO_1610) - isr_reg = bank-base + OMAP1610_GPIO_IRQSTATUS1; -#endif -#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) - if (bank-method == METHOD_GPIO_7XX) - isr_reg = bank-base + OMAP7XX_GPIO_INT_STATUS; -#endif -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) - if (bank-method == METHOD_GPIO_24XX) - isr_reg = bank-base + OMAP24XX_GPIO_IRQSTATUS1; -#endif -#if defined(CONFIG_ARCH_OMAP4) - if (bank-method == METHOD_GPIO_44XX) - isr_reg = bank-base + OMAP4_GPIO_IRQSTATUS0; -#endif - - if (WARN_ON(!isr_reg)) - goto exit; while(1) { u32 isr_saved, level_mask = 0; u32 enabled; + if (bank-method == METHOD_MPUIO) + isr_val = gpio_mpuio_read(bank-base, + OMAP_MPUIO_GPIO_INT / bank-stride); + else + isr_val = gpio_fn.gpio_read(bank-base, IRQSTATUS_REG0); + enabled = _get_gpio_irqbank_mask(bank); - isr_saved = isr = __raw_readl(isr_reg) enabled; + isr = isr_val enabled; + isr_saved = isr; - if (cpu_is_omap15xx() (bank-method == METHOD_MPUIO)) + /* Common for all MPUIO banks */ + if (bank-method == METHOD_MPUIO) isr = 0x; - if (cpu_class_is_omap2()) { + if (bank-method = METHOD_GPIO_24XX) level_mask = bank-level_mask enabled; - } - /* clear edge sensitive interrupts before handler(s) are - called so that we don't miss any interrupt occurred while - executing them */ + /* +* clear edge sensitive interrupts before handler(s) are +* called so that we don't miss any interrupt occurred +* while executing them +*/ _enable_gpio_irqbank(bank, isr_saved ~level_mask, 0); _clear_gpio_irqbank(bank, isr_saved ~level_mask); _enable_gpio_irqbank(bank, isr_saved ~level_mask, 1); - /* if there is only edge sensitive GPIO pin interrupts - configured, we could unmask GPIO bank interrupt immediately */ + /* +* if there is only edge sensitive GPIO pin interrupts +* configured, we could unmask GPIO bank interrupt immediately +*/ if (!level_mask !unmasked) { unmasked = 1; desc-irq_data.chip-irq_unmask(desc-irq_data); @@ -853,11 +836,12 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) generic_handle_irq(gpio_irq); } } - /* if bank has any level sensitive GPIO pin interrupt - configured, we must unmask the bank interrupt only after - handler(s) are executed in order to avoid spurious bank - interrupt */ -exit: + /* +* if bank has any level sensitive GPIO pin interrupt +* configured, we must unmask the bank interrupt only after +* handler(s) are executed in order to avoid spurious bank +* interrupt +*/ if (!unmasked) desc-irq_data.chip-irq_unmask(desc-irq_data); } -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http
[RFC PATCH 00/18] OMAP: GPIO: cleanup GPIO driver
Modifies the OMAP GPIO driver to avoid usage of cpu_is* checks for different OMAP architectures. This is done by moving some architecture specific code to mach-omap* and call them from plat-omap* using function pointers. Also remove the register offset macros from OMAP GPIO driver and handle the same in mach-omap*. Avoid usage of gpio_bank_count and gpio_bank pointer array by means of maintaining a list. Removes the bank-method flag from the GPIO driver. All OMAP1 SoCs has one MPUIO type GPIO bank. OMAP2+ does not have any MPUIO type GPIO bank. Since MPUIO type GPIO bank is the same for all OMAP1 CPUs, they are handled in plat-omap/ itself as there is no common gpio.c file for all cpu types in mach-omap1. They are identified by using bank-stride flag as it is '0' for other than MPUIO type banks. Patch series is based on mainline rc4 following commit: 91e8549bde9e5cc88c5a2e8c8114389279e240b5 Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block Compile tested for: - omap1_defconfig - omap2plus_defconfig Boot test (success on the following boards): - OMAP1710-H3 - OMAP2420-H4 - OMAP3430-SDP - OMAP3430-Zoom2 - OMAP3630-Zoom3 - OMAP4430-SDP - OMAP4430-Blaze GPIO module functionality testing (success on the following boards): - OMAP2420-H4 - OMAP3430-SDP - OMAP3430-Zoom2 - OMAP3630-Zoom3 - OMAP4430-SDP - OMAP4430-Blaze PM Testing (success as given below): OMAP3430-SDP: retention, off_mode, system_wide suspend, gpio wakeup OMAP3630-Zoom3: retention, system_wide suspend using the following: echo 5 /sys/devices/platform/omap/omap_uart.0/sleep_timeout echo 5 /sys/devices/platform/omap/omap_uart.1/sleep_timeout echo 5 /sys/devices/platform/omap/omap_uart.2/sleep_timeout echo 5 /sys/devices/platform/omap/omap_uart.3/sleep_timeout echo '5' /debug/pm_debug/wakeup_timer_seconds echo 1 /debug/pm_debug/sleep_while_idle echo 1 /debug/pm_debug/enable_off_mode Charulatha V (18): OMAP1: GPIO: Fix mpuio_init() call OMAP: GPIO: remove get_gpio_bank() OMAP: GPIO: Move gpio_get_index() to mach-omap OMAP: GPIO: Move gpio_valid() to SoC specific files OMAP: GPIO: cleanup datain,dataout,set dir funcs OMAP: GPIO: cleanup set trigger func OMAP: GPIO: cleanup set/get IRQ, clr irqstatus funcs OMAP: GPIO: req/free: Remove reg offset macros usage OMAP: GPIO: cleanup gpio_irq_handler OMAP: GPIO: cleanup set wakeup/suspend/resume funcs OMAP: GPIO: Remove dependency on gpio_bank_count OMAP: GPIO: cleanup set_debounce, idle/resume_after_idle OMAP: GPIO: cleanup save/restore context OMAP: GPIO: Remove CONFIG_ARCH_OMAP16XX/OMAP2+ defines OMAP: GPIO: cleanup gpio_show_rev OMAP: GPIO: move omap_gpio_mod_init to mach-omap OMAP: GPIO: use dev_err* instead of printk OMAP: GPIO: Remove usage of bank method arch/arm/mach-omap1/gpio15xx.c | 110 ++- arch/arm/mach-omap1/gpio16xx.c | 174 +++- arch/arm/mach-omap1/gpio7xx.c | 132 ++- arch/arm/mach-omap2/gpio.c | 476 +- arch/arm/plat-omap/gpio.c | 1770 arch/arm/plat-omap/include/plat/gpio.h | 108 ++- 6 files changed, 1380 insertions(+), 1390 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 04/18] OMAP: GPIO: Move gpio_valid() to SoC specific files
gpio_valid() implementation is different for different SoCs. Hence handle them in SoC specific gpio files. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap1/gpio15xx.c | 26 - arch/arm/mach-omap1/gpio16xx.c | 32 ++ arch/arm/mach-omap1/gpio7xx.c | 38 ++-- arch/arm/mach-omap2/gpio.c | 14 +++- arch/arm/plat-omap/gpio.c | 27 +- arch/arm/plat-omap/include/plat/gpio.h |1 + 6 files changed, 98 insertions(+), 40 deletions(-) diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c index eb2727a..9d7a3fa 100644 --- a/arch/arm/mach-omap1/gpio15xx.c +++ b/arch/arm/mach-omap1/gpio15xx.c @@ -22,6 +22,10 @@ #define OMAP1510_GPIO_BASE 0xFFFCE000 #define OMAP1510_GPIO_INDEX_MASK 0x0f +#define OMAP1510_GPIO_WIDTH16 +#define OMAP1510_GPIO_BANK_CNT 2 +#define OMAP1510_NON_MPUIO_GPIO_VALID ((OMAP1510_GPIO_BANK_CNT - 1) *\ + OMAP1510_GPIO_WIDTH) /* gpio1 */ static struct __initdata resource omap15xx_mpu_gpio_resources[] = { @@ -39,7 +43,7 @@ static struct __initdata resource omap15xx_mpu_gpio_resources[] = { static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = { .virtual_irq_start = IH_MPUIO_BASE, .bank_type = METHOD_MPUIO, - .bank_width = 16, + .bank_width = OMAP1510_GPIO_WIDTH, .bank_stride= 1, }; @@ -69,7 +73,7 @@ static struct __initdata resource omap15xx_gpio_resources[] = { static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = { .virtual_irq_start = IH_GPIO_BASE, .bank_type = METHOD_GPIO_1510, - .bank_width = 16, + .bank_width = OMAP1510_GPIO_WIDTH, }; static struct __initdata platform_device omap15xx_gpio = { @@ -87,8 +91,26 @@ static int get_gpio_index(int gpio) return gpio OMAP1510_GPIO_INDEX_MASK; } +static int gpio_valid(int gpio) +{ + if (gpio 0) + return -EINVAL; + + if (OMAP_GPIO_IS_MPUIO(gpio)) { + if (gpio = OMAP_MAX_GPIO_LINES + OMAP1510_GPIO_WIDTH) + return -EINVAL; + return 0; + } + + if (gpio OMAP1510_NON_MPUIO_GPIO_VALID) + return 0; + + return -EINVAL; +} + static struct omap_gpio_func gpio_fn = { .get_index = get_gpio_index, + .gpio_valid = gpio_valid, }; /* diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c index 9d8aabc..e6bb080 100644 --- a/arch/arm/mach-omap1/gpio16xx.c +++ b/arch/arm/mach-omap1/gpio16xx.c @@ -25,6 +25,10 @@ #define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE #define OMAP1610_GPIO_INDEX_MASK 0x0f +#define OMAP1610_GPIO_WIDTH16 +#define OMAP1610_GPIO_BANK_CNT 5 +#define OMAP1610_NON_MPUIO_GPIO_VALID ((OMAP1610_GPIO_BANK_CNT - 1) *\ + OMAP1610_GPIO_WIDTH) /* mpu gpio */ static struct __initdata resource omap16xx_mpu_gpio_resources[] = { @@ -42,7 +46,7 @@ static struct __initdata resource omap16xx_mpu_gpio_resources[] = { static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = { .virtual_irq_start = IH_MPUIO_BASE, .bank_type = METHOD_MPUIO, - .bank_width = 16, + .bank_width = OMAP1610_GPIO_WIDTH, .bank_stride= 1, }; @@ -72,7 +76,7 @@ static struct __initdata resource omap16xx_gpio1_resources[] = { static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = { .virtual_irq_start = IH_GPIO_BASE, .bank_type = METHOD_GPIO_1610, - .bank_width = 16, + .bank_width = OMAP1610_GPIO_WIDTH, }; static struct __initdata platform_device omap16xx_gpio1 = { @@ -101,7 +105,7 @@ static struct __initdata resource omap16xx_gpio2_resources[] = { static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = { .virtual_irq_start = IH_GPIO_BASE + 16, .bank_type = METHOD_GPIO_1610, - .bank_width = 16, + .bank_width = OMAP1610_GPIO_WIDTH, }; static struct __initdata platform_device omap16xx_gpio2 = { @@ -130,7 +134,7 @@ static struct __initdata resource omap16xx_gpio3_resources[] = { static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = { .virtual_irq_start = IH_GPIO_BASE + 32, .bank_type = METHOD_GPIO_1610, - .bank_width = 16, + .bank_width = OMAP1610_GPIO_WIDTH, }; static struct __initdata platform_device omap16xx_gpio3 = { @@ -159,7 +163,7 @@ static struct __initdata resource
[PATCH 0/5] OMAP: GPIO: use PM runtime framework
Use PM runtime framework in OMAP GPIO driver. Patch series is based on LO Kernel omap_for_linus branch. Dependency patches to test system wide suspend on omap_for_linus branch: https://patchwork.kernel.org/patch/550551/ https://patchwork.kernel.org/patch/513481/ Compile tested for: - omap1_defconfig - omap2plus_defconfig Boot test (success on the following boards): - OMAP1710-H3 - OMAP2420-H4 - OMAP2430-SDP (Tested-by: Tarun Kanti DebBarma tarun.ka...@ti.com) - OMAP3430-SDP - OMAP3630-Zoom3 - OMAP4430-Blaze - OMAP4430-SDP GPIO module functionality testing (success on the following boards): - OMAP2420-H4 - OMAP2430-SDP (Tested-by: Tarun Kanti DebBarma tarun.ka...@ti.com) - OMAP3430-SDP - OMAP3630-Zoom3 - OMAP4430-Blaze - OMAP4430-SDP PM Testing: OMAP3430-SDP(success): - retention - off_mode - system_wide suspend OMAP3630-Zoom3(success): - retention - off_mode - system_wide suspend - wakeup test using the following: echo 5 /sys/devices/platform/omap/omap_uart.0/sleep_timeout echo 5 /sys/devices/platform/omap/omap_uart.1/sleep_timeout echo 5 /sys/devices/platform/omap/omap_uart.2/sleep_timeout echo '3' /debug/pm_debug/wakeup_timer_seconds echo 1 /debug/pm_debug/sleep_while_idle echo 1 /debug/pm_debug/enable_off_mode echo mem /sys/power/state cat /debug/pm_debug/count Link to previous patch series for GPIO PM runtime framework adaptation as part of GPIO hwmod adaptation series: http://www.mail-archive.com/linux-omap@vger.kernel.org/msg35123.html https://patchwork.kernel.org/patch/189832/ Charulatha V (5): OMAP: GPIO: Make gpio_context part of gpio_bank structure OMAP: GPIO: Use pwrdmn name to find wkup dmn GPIO OMAP4: GPIO: Save/restore context OMAP: GPIO: handle save/restore ctxt in GPIO driver OMAP: GPIO: Use PM runtime framework arch/arm/mach-omap2/gpio.c |6 + arch/arm/mach-omap2/pm24xx.c |2 +- arch/arm/mach-omap2/pm34xx.c | 20 +- arch/arm/plat-omap/gpio.c | 563 ++-- arch/arm/plat-omap/include/plat/gpio.h |5 +- 5 files changed, 330 insertions(+), 266 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/5] OMAP: GPIO: make gpio_context part of gpio_bank structure
gpio_context array, which is used to save gpio bank's context, is used only for OMAP3 architecture. Move gpio_context as part of gpio_bank structure so that it can be specific to each gpio bank and can be used for any OMAP architecture Signed-off-by: Charulatha V ch...@ti.com Tested-by: Tarun Kanti DebBarma tarun.ka...@ti.com (2430-SDP testing) --- TODO: extend the gpio save/restore context function for OMAP4 architecture. This is done in one of the next patches in this series arch/arm/plat-omap/gpio.c | 72 +--- 1 files changed, 34 insertions(+), 38 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 971d186..c6ab0ff 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -133,6 +133,19 @@ #define OMAP4_GPIO_CLEARDATAOUT0x0190 #define OMAP4_GPIO_SETDATAOUT 0x0194 +struct gpio_regs { + u32 irqenable1; + u32 irqenable2; + u32 wake_en; + u32 ctrl; + u32 oe; + u32 leveldetect0; + u32 leveldetect1; + u32 risingdetect; + u32 fallingdetect; + u32 dataout; +}; + struct gpio_bank { unsigned long pbase; void __iomem *base; @@ -145,7 +158,7 @@ struct gpio_bank { #endif u32 non_wakeup_gpios; u32 enabled_non_wakeup_gpios; - + struct gpio_regs context; u32 saved_datain; u32 saved_fallingdetect; u32 saved_risingdetect; @@ -161,23 +174,6 @@ struct gpio_bank { int stride; }; -#ifdef CONFIG_ARCH_OMAP3 -struct omap3_gpio_regs { - u32 irqenable1; - u32 irqenable2; - u32 wake_en; - u32 ctrl; - u32 oe; - u32 leveldetect0; - u32 leveldetect1; - u32 risingdetect; - u32 fallingdetect; - u32 dataout; -}; - -static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS]; -#endif - /* * TODO: Cleanup gpio_bank usage as it is having information * related to all instances of the device @@ -2043,25 +2039,25 @@ void omap_gpio_save_context(void) /* saving banks from 2-6 only since GPIO1 is in WKUP */ for (i = 1; i gpio_bank_count; i++) { struct gpio_bank *bank = gpio_bank[i]; - gpio_context[i].irqenable1 = + bank-context.irqenable1 = __raw_readl(bank-base + OMAP24XX_GPIO_IRQENABLE1); - gpio_context[i].irqenable2 = + bank-context.irqenable2 = __raw_readl(bank-base + OMAP24XX_GPIO_IRQENABLE2); - gpio_context[i].wake_en = + bank-context.wake_en = __raw_readl(bank-base + OMAP24XX_GPIO_WAKE_EN); - gpio_context[i].ctrl = + bank-context.ctrl = __raw_readl(bank-base + OMAP24XX_GPIO_CTRL); - gpio_context[i].oe = + bank-context.oe = __raw_readl(bank-base + OMAP24XX_GPIO_OE); - gpio_context[i].leveldetect0 = + bank-context.leveldetect0 = __raw_readl(bank-base + OMAP24XX_GPIO_LEVELDETECT0); - gpio_context[i].leveldetect1 = + bank-context.leveldetect1 = __raw_readl(bank-base + OMAP24XX_GPIO_LEVELDETECT1); - gpio_context[i].risingdetect = + bank-context.risingdetect = __raw_readl(bank-base + OMAP24XX_GPIO_RISINGDETECT); - gpio_context[i].fallingdetect = + bank-context.fallingdetect = __raw_readl(bank-base + OMAP24XX_GPIO_FALLINGDETECT); - gpio_context[i].dataout = + bank-context.dataout = __raw_readl(bank-base + OMAP24XX_GPIO_DATAOUT); } } @@ -2073,25 +2069,25 @@ void omap_gpio_restore_context(void) for (i = 1; i gpio_bank_count; i++) { struct gpio_bank *bank = gpio_bank[i]; - __raw_writel(gpio_context[i].irqenable1, + __raw_writel(bank-context.irqenable1, bank-base + OMAP24XX_GPIO_IRQENABLE1); - __raw_writel(gpio_context[i].irqenable2, + __raw_writel(bank-context.irqenable2, bank-base + OMAP24XX_GPIO_IRQENABLE2); - __raw_writel(gpio_context[i].wake_en, + __raw_writel(bank-context.wake_en, bank-base + OMAP24XX_GPIO_WAKE_EN); - __raw_writel(gpio_context[i].ctrl, + __raw_writel(bank-context.ctrl, bank-base + OMAP24XX_GPIO_CTRL); - __raw_writel(gpio_context[i].oe, + __raw_writel(bank-context.oe, bank-base + OMAP24XX_GPIO_OE); - __raw_writel(gpio_context[i].leveldetect0, + __raw_writel(bank-context.leveldetect0
[PATCH 3/5] OMAP4: GPIO: save/restore context
Modify the omap_gpio_save/restore_context to support OMAP4 architecture so that the GPIO driver need not be modified when OMAP4 off mode support is available. Signed-off-by: Charulatha V ch...@ti.com Tested-by: Tarun Kanti DebBarma tarun.ka...@ti.com (2430-SDP testing) --- arch/arm/plat-omap/gpio.c | 131 +--- 1 files changed, 86 insertions(+), 45 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index ff341ec..1da3233 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -2031,43 +2031,62 @@ void omap2_gpio_resume_after_idle(void) #endif -#ifdef CONFIG_ARCH_OMAP3 -/* save the registers of bank 2-6 */ void omap_gpio_save_context(void) { int i; - /* saving banks from 2-6 only since GPIO1 is in WKUP */ for (i = 0; i gpio_bank_count; i++) { struct gpio_bank *bank = gpio_bank[i]; if (!strcmp(bank-pwrdm_name, wkup_pwrdm)) continue; - bank-context.irqenable1 = - __raw_readl(bank-base + OMAP24XX_GPIO_IRQENABLE1); - bank-context.irqenable2 = - __raw_readl(bank-base + OMAP24XX_GPIO_IRQENABLE2); - bank-context.wake_en = - __raw_readl(bank-base + OMAP24XX_GPIO_WAKE_EN); - bank-context.ctrl = - __raw_readl(bank-base + OMAP24XX_GPIO_CTRL); - bank-context.oe = - __raw_readl(bank-base + OMAP24XX_GPIO_OE); - bank-context.leveldetect0 = - __raw_readl(bank-base + OMAP24XX_GPIO_LEVELDETECT0); - bank-context.leveldetect1 = - __raw_readl(bank-base + OMAP24XX_GPIO_LEVELDETECT1); - bank-context.risingdetect = - __raw_readl(bank-base + OMAP24XX_GPIO_RISINGDETECT); - bank-context.fallingdetect = - __raw_readl(bank-base + OMAP24XX_GPIO_FALLINGDETECT); - bank-context.dataout = - __raw_readl(bank-base + OMAP24XX_GPIO_DATAOUT); + if (bank-method == METHOD_GPIO_24XX) { + bank-context.irqenable1 = __raw_readl( + bank-base + OMAP24XX_GPIO_IRQENABLE1); + bank-context.irqenable2 = __raw_readl( + bank-base + OMAP24XX_GPIO_IRQENABLE2); + bank-context.wake_en = __raw_readl( + bank-base + OMAP24XX_GPIO_WAKE_EN); + bank-context.ctrl = __raw_readl( + bank-base + OMAP24XX_GPIO_CTRL); + bank-context.oe = __raw_readl( + bank-base + OMAP24XX_GPIO_OE); + bank-context.leveldetect0 = __raw_readl(bank-base + + OMAP24XX_GPIO_LEVELDETECT0); + bank-context.leveldetect1 = __raw_readl(bank-base + + OMAP24XX_GPIO_LEVELDETECT1); + bank-context.risingdetect = __raw_readl(bank-base + + OMAP24XX_GPIO_RISINGDETECT); + bank-context.fallingdetect = __raw_readl(bank-base + + OMAP24XX_GPIO_FALLINGDETECT); + bank-context.dataout = __raw_readl( + bank-base + OMAP24XX_GPIO_DATAOUT); + } else if (bank-method == METHOD_GPIO_44XX) { + bank-context.irqenable1 = __raw_readl( + bank-base + OMAP4_GPIO_IRQSTATUSSET0); + bank-context.irqenable2 = __raw_readl( + bank-base + OMAP4_GPIO_IRQSTATUSSET1); + bank-context.wake_en = __raw_readl( + bank-base + OMAP4_GPIO_IRQWAKEN0); + bank-context.ctrl = __raw_readl( + bank-base + OMAP4_GPIO_CTRL); + bank-context.oe = __raw_readl( + bank-base + OMAP24XX_GPIO_OE); + bank-context.leveldetect0 = __raw_readl(bank-base + + OMAP4_GPIO_LEVELDETECT0); + bank-context.leveldetect1 = __raw_readl(bank-base + + OMAP4_GPIO_LEVELDETECT1); + bank-context.risingdetect = __raw_readl(bank-base + + OMAP4_GPIO_RISINGDETECT); + bank-context.fallingdetect = __raw_readl(bank-base + + OMAP4_GPIO_FALLINGDETECT); + bank-context.dataout = __raw_readl
[PATCH 2/5] OMAP: GPIO: use pwrdmn name to find wkup dmn GPIO
In omap3, save/restore context is implemented for GPIO banks 2-6 as GPIO bank1 is in wakeup domain. Instead of identifying bank's power domain by bank id, make use of powerdomain name itself. For this, omap_hwmod_get_pwrdm() is used. omap_device_get_pwrdm() could not be used as the pwrdm information needs to be filled in pdata. But omap_device_get_pwrdm() can be used only after omap_device_build() call. Signed-off-by: Charulatha V ch...@ti.com Tested-by: Tarun Kanti DebBarma tarun.ka...@ti.com (2430-SDP testing) --- arch/arm/mach-omap2/gpio.c |6 ++ arch/arm/plat-omap/gpio.c | 31 --- arch/arm/plat-omap/include/plat/gpio.h |1 + 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c index 413de18..39b0d96 100644 --- a/arch/arm/mach-omap2/gpio.c +++ b/arch/arm/mach-omap2/gpio.c @@ -24,6 +24,8 @@ #include plat/omap_hwmod.h #include plat/omap_device.h +#include powerdomain.h + static struct omap_device_pm_latency omap_gpio_latency[] = { [0] = { .deactivate_func = omap_device_idle_hwmods, @@ -39,6 +41,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) struct omap_gpio_dev_attr *dev_attr; char *name = omap_gpio; int id; + struct powerdomain *pwrdm; /* * extract the device id from name field available in the @@ -75,6 +78,9 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) return -EINVAL; } + pwrdm = omap_hwmod_get_pwrdm(oh); + strcpy(pdata-pwrdm_name, pwrdm-name); + od = omap_device_build(name, id - 1, oh, pdata, sizeof(*pdata), omap_gpio_latency, ARRAY_SIZE(omap_gpio_latency), diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index c6ab0ff..ff341ec 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -172,6 +172,7 @@ struct gpio_bank { struct device *dev; bool dbck_flag; int stride; + const char *pwrdm_name; }; /* @@ -1720,6 +1721,7 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev) bank-dbck_flag = pdata-dbck_flag; bank-stride = pdata-bank_stride; bank_width = pdata-bank_width; + bank-pwrdm_name = pdata-pwrdm_name; spin_lock_init(bank-lock); @@ -1865,16 +1867,15 @@ static int workaround_enabled; void omap2_gpio_prepare_for_idle(int off_mode) { int i, c = 0; - int min = 0; - if (cpu_is_omap34xx()) - min = 1; - - for (i = min; i gpio_bank_count; i++) { + for (i = 0; i gpio_bank_count; i++) { struct gpio_bank *bank = gpio_bank[i]; u32 l1 = 0, l2 = 0; int j; + if (!strcmp(bank-pwrdm_name, wkup_pwrdm)) + continue; + for (j = 0; j hweight_long(bank-dbck_enable_mask); j++) clk_disable(bank-dbck); @@ -1934,15 +1935,15 @@ void omap2_gpio_prepare_for_idle(int off_mode) void omap2_gpio_resume_after_idle(void) { int i; - int min = 0; - if (cpu_is_omap34xx()) - min = 1; - for (i = min; i gpio_bank_count; i++) { + for (i = 0; i gpio_bank_count; i++) { struct gpio_bank *bank = gpio_bank[i]; u32 l = 0, gen, gen0, gen1; int j; + if (!strcmp(bank-pwrdm_name, wkup_pwrdm)) + continue; + for (j = 0; j hweight_long(bank-dbck_enable_mask); j++) clk_enable(bank-dbck); @@ -2037,8 +2038,12 @@ void omap_gpio_save_context(void) int i; /* saving banks from 2-6 only since GPIO1 is in WKUP */ - for (i = 1; i gpio_bank_count; i++) { + for (i = 0; i gpio_bank_count; i++) { struct gpio_bank *bank = gpio_bank[i]; + + if (!strcmp(bank-pwrdm_name, wkup_pwrdm)) + continue; + bank-context.irqenable1 = __raw_readl(bank-base + OMAP24XX_GPIO_IRQENABLE1); bank-context.irqenable2 = @@ -2067,8 +2072,12 @@ void omap_gpio_restore_context(void) { int i; - for (i = 1; i gpio_bank_count; i++) { + for (i = 0; i gpio_bank_count; i++) { struct gpio_bank *bank = gpio_bank[i]; + + if (!strcmp(bank-pwrdm_name, wkup_pwrdm)) + continue; + __raw_writel(bank-context.irqenable1, bank-base + OMAP24XX_GPIO_IRQENABLE1); __raw_writel(bank-context.irqenable2, diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h index d6f9fa0..2c46caa 100644 --- a/arch/arm/plat-omap/include/plat/gpio.h +++ b/arch/arm/plat-omap
[PATCH 0/5 v3] OMAP2PLUS: WDT: Implement WDT in HWMOD way
This patch series makes OMAP2PLUS Watchdog Timer Module implemented in HWMOD FW way. It also implements Watchdog timer driver to use the runtime PM layer. This patch series is created on origin/pm-wip/hwmods-omap4. This patch series is tested on OMAP3430 SDP and OMAP4430 SDP. It would be of great help if someone could test the same on OMAP1 and OMAP2 boards. Version History: --- Vesrion v3: Fix Minor comments like renaming omap1 watchdog structures with an omap1_ prefix Version v2: Rebase to latest kernel Some of the v2 links: http://www.spinics.net/lists/linux-omap/msg34741.html http://www.spinics.net/lists/linux-omap/msg34673.html Version v1: Initial series Some of the v1 links: http://www.spinics.net/lists/linux-omap/msg30628.html http://www.spinics.net/lists/linux-omap/msg30625.html Benoit Cousson (1): OMAP4 HWMOD: Add watchdog hwmods. Charulatha V (4): OMAP3: WDT: Add watchdog timer HWMOD data for OMAP3 OMAP2420: WDT: Add watchdog timer HWMOD data for OMAP2420 OMAP2430: WDT: Add watchdog timer HWMOD data for OMAP2430 OMAP2PLUS: WDT: Conversion to runtime PM arch/arm/mach-omap2/omap_hwmod_2420_data.c | 59 arch/arm/mach-omap2/omap_hwmod_2430_data.c | 59 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 61 + arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 68 arch/arm/mach-omap2/prcm-common.h |4 ++ arch/arm/plat-omap/devices.c | 64 ++ drivers/watchdog/omap_wdt.c| 43 +++-- 7 files changed, 303 insertions(+), 55 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/5 v3] OMAP2420: WDT: Add watchdog timer HWMOD data for OMAP2420
Add hwmod structures for Watchdog module on OMAP2420 HWMOD database Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 59 1 files changed, 59 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c index 3cc768e..73a516e 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c @@ -33,6 +33,7 @@ static struct omap_hwmod omap2420_mpu_hwmod; static struct omap_hwmod omap2420_iva_hwmod; static struct omap_hwmod omap2420_l3_main_hwmod; static struct omap_hwmod omap2420_l4_core_hwmod; +static struct omap_hwmod omap2420_wd_timer2_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = { @@ -165,12 +166,70 @@ static struct omap_hwmod omap2420_iva_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420) }; +/* WDTIMER2 - L4_WKUP interface */ +static struct omap_hwmod_addr_space omap2420_wd_timer2_addrs[] = { + { + .pa_start = 0x48022000, + .pa_end = 0x4802207f, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__wd_timer2 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_wd_timer2_hwmod, + .clk= mpu_wdt_ick, + .addr = omap2420_wd_timer2_addrs, + .addr_cnt = ARRAY_SIZE(omap2420_wd_timer2_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* WDTIMER common */ + +static struct omap_hwmod_class_sysconfig omap2420_wd_timer_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap2420_wd_timer_hwmod_class = { + .name = wd_timer, + .sysc = omap2420_wd_timer_sysc, +}; + +/* WDTIMER2 */ +static struct omap_hwmod_ocp_if *omap2420_wd_timer2_slaves[] = { + omap2420_l4_wkup__wd_timer2, +}; + +static struct omap_hwmod omap2420_wd_timer2_hwmod = { + .name = wd_timer2, + .class = omap2420_wd_timer_hwmod_class, + .main_clk = mpu_wdt_fck, + .prcm = { + .omap2 = { + .prcm_reg_id = 1, + .module_bit = OMAP24XX_EN_WDT2_SHIFT, + .module_offs = WKUP_MOD, + .idlest_reg_id = 1, + .idlest_idle_bit = OMAP24XX_EN_WDT2_SHIFT, + }, + }, + .slaves = omap2420_wd_timer2_slaves, + .slaves_cnt = ARRAY_SIZE(omap2420_wd_timer2_slaves), + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), +}; + static __initdata struct omap_hwmod *omap2420_hwmods[] = { omap2420_l3_main_hwmod, omap2420_l4_core_hwmod, omap2420_l4_wkup_hwmod, omap2420_mpu_hwmod, omap2420_iva_hwmod, + omap2420_wd_timer2_hwmod, NULL, }; -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/5 v3] OMAP3: WDT: Add watchdog timer HWMOD data for OMAP3
Add hwmod structures for Watchdog module on OMAP3 HWMOD database Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 61 arch/arm/mach-omap2/prcm-common.h |4 ++ 2 files changed, 65 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 5d8eb58..a9812a8 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -36,6 +36,7 @@ static struct omap_hwmod omap3xxx_iva_hwmod; static struct omap_hwmod omap3xxx_l3_main_hwmod; static struct omap_hwmod omap3xxx_l4_core_hwmod; static struct omap_hwmod omap3xxx_l4_per_hwmod; +static struct omap_hwmod omap3xxx_wd_timer2_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = { @@ -197,6 +198,65 @@ static struct omap_hwmod omap3xxx_iva_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) }; +/* WDTIMER2 - L4_WKUP interface */ +static struct omap_hwmod_addr_space omap3xxx_wd_timer2_addrs[] = { + { + .pa_start = 0x48314000, + .pa_end = 0x4831407f, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__wd_timer2 = { + .master = omap3xxx_l4_wkup_hwmod, + .slave = omap3xxx_wd_timer2_hwmod, + .clk= wdt2_ick, + .addr = omap3xxx_wd_timer2_addrs, + .addr_cnt = ARRAY_SIZE(omap3xxx_wd_timer2_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* WDTIMER common */ + +static struct omap_hwmod_class_sysconfig omap3xxx_wd_timer_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_EMUFREE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap3xxx_wd_timer_hwmod_class = { + .name = wd_timer, + .sysc = omap3xxx_wd_timer_sysc, +}; + +/* WDTIMER2 */ +static struct omap_hwmod_ocp_if *omap3xxx_wd_timer2_slaves[] = { + omap3xxx_l4_wkup__wd_timer2, +}; + +static struct omap_hwmod omap3xxx_wd_timer2_hwmod = { + .name = wd_timer2, + .class = omap3xxx_wd_timer_hwmod_class, + .main_clk = wdt2_fck, + .prcm = { + .omap2 = { + .prcm_reg_id = 1, + .module_bit = OMAP3430_EN_WDT2_SHIFT, + .module_offs = WKUP_MOD, + .idlest_reg_id = 1, + .idlest_idle_bit = OMAP3430_EN_WDT2_SHIFT, + }, + }, + .slaves = omap3xxx_wd_timer2_slaves, + .slaves_cnt = ARRAY_SIZE(omap3xxx_wd_timer2_slaves), + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), +}; + static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { omap3xxx_l3_main_hwmod, omap3xxx_l4_core_hwmod, @@ -204,6 +264,7 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { omap3xxx_l4_wkup_hwmod, omap3xxx_mpu_hwmod, omap3xxx_iva_hwmod, + omap3xxx_wd_timer2_hwmod, NULL, }; diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h index 995b7ed..e190c64 100644 --- a/arch/arm/mach-omap2/prcm-common.h +++ b/arch/arm/mach-omap2/prcm-common.h @@ -237,6 +237,8 @@ #define OMAP24XX_ST_USB_MASK (1 0) /* CM_FCLKEN_WKUP, CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits */ +#define OMAP24XX_EN_WDT2_SHIFT 3 +#define OMAP24XX_EN_WDT2_MASK (1 3) #define OMAP24XX_EN_GPIOS_SHIFT2 #define OMAP24XX_EN_GPIOS_MASK (1 2) #define OMAP24XX_EN_GPT1_SHIFT 0 @@ -344,6 +346,8 @@ #define OMAP3430_ST_D2D_MASK (1 3) /* CM_FCLKEN_WKUP, CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits */ +#define OMAP3430_EN_WDT2_SHIFT 5 +#define OMAP3430_EN_WDT2_MASK (1 5) #define OMAP3430_EN_GPIO1_MASK (1 3) #define OMAP3430_EN_GPIO1_SHIFT3 #define OMAP3430_EN_GPT12_MASK (1 1) -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/5 v3] OMAP2PLUS: WDT: Conversion to runtime PM
This patch converts the OMAP Watchdog timer driver to get adapted to HWMOD FW and to use the runtime PM APIs. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/plat-omap/devices.c | 64 - drivers/watchdog/omap_wdt.c | 43 +--- 2 files changed, 52 insertions(+), 55 deletions(-) diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c index d1920be..6885f4f 100644 --- a/arch/arm/plat-omap/devices.c +++ b/arch/arm/plat-omap/devices.c @@ -15,6 +15,7 @@ #include linux/platform_device.h #include linux/io.h #include linux/slab.h +#include linux/err.h #include mach/hardware.h #include asm/mach-types.h @@ -28,6 +29,8 @@ #include plat/menelaus.h #include plat/mcbsp.h #include plat/omap44xx.h +#include plat/omap_hwmod.h +#include plat/omap_device.h /*-*/ @@ -236,37 +239,58 @@ static inline void omap_init_uwire(void) {} #ifdefined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE) -static struct resource wdt_resources[] = { +struct omap_device_pm_latency omap2_wdt_latency[] = { + [0] = { + .deactivate_func = omap_device_idle_hwmods, + .activate_func = omap_device_enable_hwmods, + .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, + }, +}; + +static void omap2_init_wdt(void) +{ + int id = -1; + struct omap_device *od; + struct omap_hwmod *oh; + char *oh_name = wd_timer2; + char *name = omap_wdt; + + oh = omap_hwmod_lookup(oh_name); + if (!oh) { + pr_err(Could not look up %s\n, oh_name); + return; + } + + od = omap_device_build(name, id, oh, NULL, 0, + omap2_wdt_latency, + ARRAY_SIZE(omap2_wdt_latency), 0); + WARN(IS_ERR(od), Cant build omap_device for %s:%s.\n, + name, oh-name); + return; +} + +static struct resource omap1_wdt_resources[] = { { + .start = 0xfffeb000, + .end= 0xfffeb07F, .flags = IORESOURCE_MEM, }, }; -static struct platform_device omap_wdt_device = { +static struct platform_device omap1_wdt_device = { .name = omap_wdt, .id = -1, - .num_resources = ARRAY_SIZE(wdt_resources), - .resource = wdt_resources, + .num_resources = ARRAY_SIZE(omap1_wdt_resources), + .resource = omap1_wdt_resources, }; static void omap_init_wdt(void) { - if (cpu_is_omap16xx()) - wdt_resources[0].start = 0xfffeb000; - else if (cpu_is_omap2420()) - wdt_resources[0].start = 0x48022000; /* WDT2 */ - else if (cpu_is_omap2430()) - wdt_resources[0].start = 0x49016000; /* WDT2 */ - else if (cpu_is_omap343x()) - wdt_resources[0].start = 0x48314000; /* WDT2 */ - else if (cpu_is_omap44xx()) - wdt_resources[0].start = 0x4a314000; - else - return; - - wdt_resources[0].end = wdt_resources[0].start + 0x4f; - - (void) platform_device_register(omap_wdt_device); + if (cpu_class_is_omap2()) + omap2_init_wdt(); + else if (cpu_is_omap16xx()) + (void) platform_device_register(omap1_wdt_device); + return; } #else static inline void omap_init_wdt(void) {} diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 76b58ab..7645ca3 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c @@ -38,13 +38,14 @@ #include linux/err.h #include linux/platform_device.h #include linux/moduleparam.h -#include linux/clk.h #include linux/bitops.h #include linux/io.h #include linux/uaccess.h #include linux/slab.h +#include linux/pm_runtime.h #include mach/hardware.h #include plat/prcm.h +#include plat/omap_device.h #include omap_wdt.h @@ -61,8 +62,6 @@ struct omap_wdt_dev { void __iomem*base; /* physical */ struct device *dev; int omap_wdt_users; - struct clk *ick; - struct clk *fck; struct resource *mem; struct miscdevice omap_wdt_miscdev; }; @@ -146,8 +145,7 @@ static int omap_wdt_open(struct inode *inode, struct file *file) if (test_and_set_bit(1, (unsigned long *)(wdev-omap_wdt_users))) return -EBUSY; - clk_enable(wdev-ick);/* Enable the interface clock */ - clk_enable(wdev-fck);/* Enable the functional clock */ + pm_runtime_get_sync(wdev-dev); /* initialize prescaler */ while (__raw_readl(base + OMAP_WATCHDOG_WPS) 0x01) @@ -177,8 +175,7 @@ static int omap_wdt_release(struct inode *inode, struct file *file) omap_wdt_disable(wdev
[PATCH 3/5 v3] OMAP2430: WDT: Add watchdog timer HWMOD data for OMAP2430
Add hwmod structures for Watchdog module on OMAP2430 HWMOD Databse Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 59 1 files changed, 59 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index 4526628..f74fca0 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -33,6 +33,7 @@ static struct omap_hwmod omap2430_mpu_hwmod; static struct omap_hwmod omap2430_iva_hwmod; static struct omap_hwmod omap2430_l3_main_hwmod; static struct omap_hwmod omap2430_l4_core_hwmod; +static struct omap_hwmod omap2430_wd_timer2_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = { @@ -165,12 +166,70 @@ static struct omap_hwmod omap2430_iva_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430) }; +/* WDTIMER2 - L4_WKUP interface */ +static struct omap_hwmod_addr_space omap2430_wd_timer2_addrs[] = { + { + .pa_start = 0x49016000, + .pa_end = 0x4901607f, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__wd_timer2 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_wd_timer2_hwmod, + .clk= mpu_wdt_ick, + .addr = omap2430_wd_timer2_addrs, + .addr_cnt = ARRAY_SIZE(omap2430_wd_timer2_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* WDTIMER common */ + +static struct omap_hwmod_class_sysconfig omap2430_wd_timer_sysc = { + .rev_offs = 0x0, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap2430_wd_timer_hwmod_class = { + .name = wd_timer, + .sysc = omap2430_wd_timer_sysc, +}; + +/* WDTIMER2 */ +static struct omap_hwmod_ocp_if *omap2430_wd_timer2_slaves[] = { + omap2430_l4_wkup__wd_timer2, +}; + +static struct omap_hwmod omap2430_wd_timer2_hwmod = { + .name = wd_timer2, + .class = omap2430_wd_timer_hwmod_class, + .main_clk = mpu_wdt_fck, + .prcm = { + .omap2 = { + .prcm_reg_id = 1, + .module_bit = OMAP24XX_EN_WDT2_SHIFT, + .module_offs = WKUP_MOD, + .idlest_reg_id = 1, + .idlest_idle_bit = OMAP24XX_EN_WDT2_SHIFT, + }, + }, + .slaves = omap2430_wd_timer2_slaves, + .slaves_cnt = ARRAY_SIZE(omap2430_wd_timer2_slaves), + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430), +}; + static __initdata struct omap_hwmod *omap2430_hwmods[] = { omap2430_l3_main_hwmod, omap2430_l4_core_hwmod, omap2430_l4_wkup_hwmod, omap2430_mpu_hwmod, omap2430_iva_hwmod, + omap2430_wd_timer2_hwmod, NULL, }; -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/5 v3] OMAP4 HWMOD: Add watchdog hwmods.
From: Benoit Cousson b-cous...@ti.com Update omap4 hwmod file with watchdog info. This patch is extracted from the below patch sent by Benoit OMAP4: hwmod: Add partial hwmod support for OMAP4430 ES1.0 https://patchwork.kernel.org/patch/99052/ Signed-off-by: Benoit Cousson b-cous...@ti.com Signed-off-by: Charulatha V ch...@ti.com Cc: Paul Walmsley p...@pwsan.com Cc: Kevin Hilman khil...@deeprootsystems.com Cc: Rajendra Nayak rna...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 68 1 files changed, 68 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index e20b0ee..06851f7 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -452,6 +452,72 @@ static struct omap_hwmod omap44xx_mpu_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), }; +/* + * 'wd_timer' class + * 32-bit watchdog upward counter that generates a pulse on the reset pin on + * overflow condition + */ + +static struct omap_hwmod_class_sysconfig omap44xx_wd_timer_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_EMUFREE | + SYSC_HAS_SOFTRESET), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap44xx_wd_timer_hwmod_class = { + .name = wd_timer, + .sysc = omap44xx_wd_timer_sysc, +}; + +/* wd_timer2 */ +static struct omap_hwmod omap44xx_wd_timer2_hwmod; +static struct omap_hwmod_irq_info omap44xx_wd_timer2_irqs[] = { + { .irq = 80 + OMAP44XX_IRQ_GIC_START }, +}; + +static struct omap_hwmod_addr_space omap44xx_wd_timer2_addrs[] = { + { + .pa_start = 0x4a314000, + .pa_end = 0x4a31407f, + .flags = ADDR_TYPE_RT + }, +}; + +/* l4_wkup - wd_timer2 */ +static struct omap_hwmod_ocp_if omap44xx_l4_wkup__wd_timer2 = { + .master = omap44xx_l4_wkup_hwmod, + .slave = omap44xx_wd_timer2_hwmod, + .clk= l4_wkup_clk_mux_ck, + .addr = omap44xx_wd_timer2_addrs, + .addr_cnt = ARRAY_SIZE(omap44xx_wd_timer2_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* wd_timer2 slave ports */ +static struct omap_hwmod_ocp_if *omap44xx_wd_timer2_slaves[] = { + omap44xx_l4_wkup__wd_timer2, +}; + +static struct omap_hwmod omap44xx_wd_timer2_hwmod = { + .name = wd_timer2, + .class = omap44xx_wd_timer_hwmod_class, + .mpu_irqs = omap44xx_wd_timer2_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_wd_timer2_irqs), + .main_clk = wd_timer2_fck, + .prcm = { + .omap4 = { + .clkctrl_reg = OMAP4430_CM_WKUP_WDT2_CLKCTRL, + }, + }, + .slaves = omap44xx_wd_timer2_slaves, + .slaves_cnt = ARRAY_SIZE(omap44xx_wd_timer2_slaves), + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), +}; + static __initdata struct omap_hwmod *omap44xx_hwmods[] = { /* dmm class */ omap44xx_dmm_hwmod, @@ -472,6 +538,8 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = { /* mpu class */ omap44xx_mpu_hwmod, + /* wd_timer class */ + omap44xx_wd_timer2_hwmod, NULL, }; -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/5] OMAP: McSPI: Implement McSPI in HWMOD way
This patch series implements McSPI Module in HWMOD FW way and use the runtime PM layer. This patch series is created on origin/pm-wip/hwmods-omap4 with McSPI slave mode patches (url given below) on top of it. https://patchwork.kernel.org/patch/79677/ Updated McSPI slave mode patches will be posted shortly by Govindraj. McSPI slave mode patches were already discussed on open source mailing list and they are almost towards the end of final rebased version. Hence hwmod patches are created on top of McSPI slave mode patch series to avoid major rework later on. Benoit Cousson (1): OMAP4 HWMOD: Add mcspi hwmods. Charulatha V (3): OMAP2420: McSPI: Add mcspi hwmod OMAP2430 : McSPI: Add mcspi hwmod data OMAP3 HWMOD: Add mcspi hwmods. Govindraj.R (1): OMAP McSPI: Adapt McSPI driver to use omap hwmod arch/arm/mach-omap2/clock3xxx_data.c |4 + arch/arm/mach-omap2/devices.c | 233 +--- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 138 ++ arch/arm/mach-omap2/omap_hwmod_2430_data.c | 196 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 252 + arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 244 + arch/arm/plat-omap/include/plat/mcspi.h| 27 +++ drivers/spi/omap2_mcspi.c | 273 +--- 8 files changed, 1034 insertions(+), 333 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/5] OMAP2420: McSPI: Add mcspi hwmod
This patch updates the omap2420 hwmod data with the McSPI info. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Partha Basak p-bas...@ti.com Signed-off-by: Govindraj.R govindraj.r...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 138 1 files changed, 138 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c index 3cc768e..7d1a0ff 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c @@ -15,6 +15,7 @@ #include mach/irqs.h #include plat/cpu.h #include plat/dma.h +#include plat/mcspi.h #include omap_hwmod_common_data.h @@ -33,6 +34,8 @@ static struct omap_hwmod omap2420_mpu_hwmod; static struct omap_hwmod omap2420_iva_hwmod; static struct omap_hwmod omap2420_l3_main_hwmod; static struct omap_hwmod omap2420_l4_core_hwmod; +static struct omap_hwmod omap2420_mcspi1_hwmod; +static struct omap_hwmod omap2420_mcspi2_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = { @@ -72,6 +75,42 @@ static struct omap_hwmod omap2420_l3_main_hwmod = { static struct omap_hwmod omap2420_l4_wkup_hwmod; +/* L4 CORE - MCSPI1 interface */ +static struct omap_hwmod_addr_space omap2420_mcspi1_addr_space[] = { + { + .pa_start = 0x48098000, + .pa_end = 0x480980ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_core__mcspi1 = { + .master = omap2420_l4_core_hwmod, + .slave = omap2420_mcspi1_hwmod, + .clk= mcspi1_ick, + .addr = omap2420_mcspi1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_mcspi1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 CORE - MCSPI2 interface */ +static struct omap_hwmod_addr_space omap2420_mcspi2_addr_space[] = { + { + .pa_start = 0x4809a000, + .pa_end = 0x4809a0ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_core__mcspi2 = { + .master = omap2420_l4_core_hwmod, + .slave = omap2420_mcspi2_hwmod, + .clk= mcspi2_ick, + .addr = omap2420_mcspi2_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_mcspi2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* L4_CORE - L4_WKUP interface */ static struct omap_hwmod_ocp_if omap2420_l4_core__l4_wkup = { .master = omap2420_l4_core_hwmod, @@ -165,12 +204,111 @@ static struct omap_hwmod omap2420_iva_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420) }; +/* SPI common */ +static struct omap_hwmod_class_sysconfig omap2420_mcspi_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap2420_mcspi_class = { + .name = mcspi, + .sysc = omap2420_mcspi_sysc, +}; + +/* SPI1 */ +static struct omap_hwmod_irq_info omap2420_mcspi1_mpu_irqs[] = { + { .irq = INT_24XX_SPI1_IRQ }, /* 65 */ +}; + +static struct omap_hwmod_dma_info omap2420_mcspi1_sdma_reqs[] = { + { .name = rx0, .dma_req = OMAP24XX_DMA_SPI1_RX0 }, /* 35 */ + { .name = rx1, .dma_req = OMAP24XX_DMA_SPI1_RX1 }, /* 37 */ + { .name = rx2, .dma_req = OMAP24XX_DMA_SPI1_RX2 }, /* 39 */ + { .name = rx3, .dma_req = OMAP24XX_DMA_SPI1_RX3 }, /* 41 */ + { .name = tx0, .dma_req = OMAP24XX_DMA_SPI1_TX0 }, /* 34 */ + { .name = tx1, .dma_req = OMAP24XX_DMA_SPI1_TX1 }, /* 36 */ + { .name = tx2, .dma_req = OMAP24XX_DMA_SPI1_TX2 }, /* 38 */ + { .name = tx3, .dma_req = OMAP24XX_DMA_SPI1_TX3 }, /* 40 */ +}; + +static struct omap_hwmod_ocp_if *omap2420_mcspi1_slaves[] = { + omap2420_l4_core__mcspi1, +}; + +static struct omap_hwmod omap2420_mcspi1_hwmod = { + .name = mcspi1_hwmod, + .mpu_irqs = omap2420_mcspi1_mpu_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(omap2420_mcspi1_mpu_irqs), + .sdma_reqs = omap2420_mcspi1_sdma_reqs, + .sdma_reqs_cnt = ARRAY_SIZE(omap2420_mcspi1_sdma_reqs), + .main_clk = mcspi1_fck, + .prcm = { + .omap2 = { + .module_offs = CORE_MOD, + .prcm_reg_id = 1, + .module_bit = OMAP24XX_EN_MCSPI1_SHIFT, + .idlest_reg_id = 1, + .idlest_idle_bit = OMAP24XX_EN_MCSPI1_SHIFT
[PATCH 2/5] OMAP2430 : McSPI: Add mcspi hwmod data
Update the 2430 hwmod dat file with McSPI info. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Partha Basak p-bas...@ti.com Signed-off-by: Govindraj.R govindraj.r...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 196 1 files changed, 196 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index 4526628..52eeadd 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -15,6 +15,7 @@ #include mach/irqs.h #include plat/cpu.h #include plat/dma.h +#include plat/mcspi.h #include omap_hwmod_common_data.h @@ -71,6 +72,9 @@ static struct omap_hwmod omap2430_l3_main_hwmod = { }; static struct omap_hwmod omap2430_l4_wkup_hwmod; +static struct omap_hwmod omap2430_mcspi1_hwmod; +static struct omap_hwmod omap2430_mcspi2_hwmod; +static struct omap_hwmod omap2430_mcspi3_hwmod; /* L4_CORE - L4_WKUP interface */ static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = { @@ -110,6 +114,60 @@ static struct omap_hwmod_ocp_if *omap2430_l4_wkup_slaves[] = { static struct omap_hwmod_ocp_if *omap2430_l4_wkup_masters[] = { }; +/* L4 CORE - MCSPI1 interface */ +static struct omap_hwmod_addr_space omap2430_mcspi1_addr_space[] = { + { + .pa_start = 0x48098000, + .pa_end = 0x480980ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__mcspi1 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_mcspi1_hwmod, + .clk= mcspi1_ick, + .addr = omap2430_mcspi1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_mcspi1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 CORE - MCSPI2 interface */ +static struct omap_hwmod_addr_space omap2430_mcspi2_addr_space[] = { + { + .pa_start = 0x4809a000, + .pa_end = 0x4809a0ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__mcspi2 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_mcspi2_hwmod, + .clk= mcspi2_ick, + .addr = omap2430_mcspi2_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_mcspi2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 CORE - MCSPI3 interface */ +static struct omap_hwmod_addr_space omap2430_mcspi3_addr_space[] = { + { + .pa_start = 0x480b8000, + .pa_end = 0x480b80ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__mcspi3 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_mcspi3_hwmod, + .clk= mcspi3_ick, + .addr = omap2430_mcspi3_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_mcspi3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* L4 WKUP */ static struct omap_hwmod omap2430_l4_wkup_hwmod = { .name = l4_wkup, @@ -165,12 +223,150 @@ static struct omap_hwmod omap2430_iva_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430) }; +/* SPI common */ +static struct omap_hwmod_class_sysconfig omap2430_mcspi_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap2430_mcspi_class = { + .name = mcspi, + .sysc = omap2430_mcspi_sysc, +}; + +/* SPI1 */ +static struct omap_hwmod_irq_info omap2430_mcspi1_mpu_irqs[] = { + { .irq = INT_24XX_SPI1_IRQ }, /* 65 */ +}; + +static struct omap_hwmod_dma_info omap2430_mcspi1_sdma_reqs[] = { + { .name = rx0, .dma_req = OMAP24XX_DMA_SPI1_RX0 }, /* 35 */ + { .name = rx1, .dma_req = OMAP24XX_DMA_SPI1_RX1 }, /* 37 */ + { .name = rx2, .dma_req = OMAP24XX_DMA_SPI1_RX2 }, /* 39 */ + { .name = rx3, .dma_req = OMAP24XX_DMA_SPI1_RX3 }, /* 41 */ + { .name = tx0, .dma_req = OMAP24XX_DMA_SPI1_TX0 }, /* 34 */ + { .name = tx1, .dma_req = OMAP24XX_DMA_SPI1_TX1 }, /* 36 */ + { .name = tx2, .dma_req = OMAP24XX_DMA_SPI1_TX2 }, /* 38 */ + { .name = tx3, .dma_req = OMAP24XX_DMA_SPI1_TX3 }, /* 40 */ +}; + +static struct omap_hwmod_ocp_if *omap2430_mcspi1_slaves[] = { + omap2430_l4_core__mcspi1, +}; + +static struct omap_hwmod omap2430_mcspi1_hwmod = { + .name = mcspi1_hwmod
[PATCH 3/5] OMAP3 HWMOD: Add mcspi hwmods.
Update omap3 hwmod file with mcspi info. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Partha Basak p-bas...@ti.com Signed-off-by: Govindraj.R govindraj.r...@ti.com --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 252 1 files changed, 252 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 5d8eb58..88ba29e 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -17,6 +17,7 @@ #include mach/irqs.h #include plat/cpu.h #include plat/dma.h +#include plat/mcspi.h #include omap_hwmod_common_data.h @@ -36,6 +37,10 @@ static struct omap_hwmod omap3xxx_iva_hwmod; static struct omap_hwmod omap3xxx_l3_main_hwmod; static struct omap_hwmod omap3xxx_l4_core_hwmod; static struct omap_hwmod omap3xxx_l4_per_hwmod; +static struct omap_hwmod omap34xx_mcspi1; +static struct omap_hwmod omap34xx_mcspi2; +static struct omap_hwmod omap34xx_mcspi3; +static struct omap_hwmod omap34xx_mcspi4; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = { @@ -197,6 +202,249 @@ static struct omap_hwmod omap3xxx_iva_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) }; +/* L4 CORE - MCSPI1 interface */ +static struct omap_hwmod_addr_space omap34xx_mcspi1_addr_space[] = { + { + .pa_start = 0x48098000, + .pa_end = 0x480980ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap34xx_l4_core__mcspi1 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap34xx_mcspi1, + .clk= mcspi1_ick, + .addr = omap34xx_mcspi1_addr_space, + .addr_cnt = ARRAY_SIZE(omap34xx_mcspi1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 CORE - MCSPI2 interface */ +static struct omap_hwmod_addr_space omap34xx_mcspi2_addr_space[] = { + { + .pa_start = 0x4809a000, + .pa_end = 0x4809a0ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap34xx_l4_core__mcspi2 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap34xx_mcspi2, + .clk= mcspi2_ick, + .addr = omap34xx_mcspi2_addr_space, + .addr_cnt = ARRAY_SIZE(omap34xx_mcspi2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 CORE - MCSPI3 interface */ +static struct omap_hwmod_addr_space omap34xx_mcspi3_addr_space[] = { + { + .pa_start = 0x480b8000, + .pa_end = 0x480b80ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap34xx_l4_core__mcspi3 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap34xx_mcspi3, + .clk= mcspi3_ick, + .addr = omap34xx_mcspi3_addr_space, + .addr_cnt = ARRAY_SIZE(omap34xx_mcspi3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 CORE - MCSPI4 interface */ +static struct omap_hwmod_addr_space omap34xx_mcspi4_addr_space[] = { + { + .pa_start = 0x480ba000, + .pa_end = 0x480ba0ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap34xx_l4_core__mcspi4 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap34xx_mcspi4, + .clk= mcspi4_ick, + .addr = omap34xx_mcspi4_addr_space, + .addr_cnt = ARRAY_SIZE(omap34xx_mcspi4_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* SPI common */ +static struct omap_hwmod_class_sysconfig omap34xx_mcspi_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap34xx_mcspi_class = { + .name = mcspi, + .sysc = omap34xx_mcspi_sysc, +}; + +/* SPI1 */ +static struct omap_hwmod_irq_info omap34xx_mcspi1_mpu_irqs[] = { + { .name = irq, .irq = INT_24XX_SPI1_IRQ }, /* 65 */ +}; + +static struct omap_hwmod_dma_info omap34xx_mcspi1_sdma_reqs[] = { + { .name = tx0, .dma_req = OMAP24XX_DMA_SPI1_TX0 }, /* 34 */ + { .name = tx2, .dma_req = OMAP24XX_DMA_SPI1_TX2 }, /* 38 */ + { .name = rx1, .dma_req = OMAP24XX_DMA_SPI1_RX1 }, /* 37 */ + { .name = tx1, .dma_req = OMAP24XX_DMA_SPI1_TX1 }, /* 36
[PATCH 5/5] OMAP McSPI: Adapt McSPI driver to use omap hwmod
From: Govindraj.R govindraj.r...@ti.com This patch converts the McSPI driver to use pm_runtime apis while implementing it in HWMOD FW way. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Partha Basak p-bas...@ti.com Signed-off-by: Govindraj.R govindraj.r...@ti.com --- arch/arm/mach-omap2/clock3xxx_data.c|4 + arch/arm/mach-omap2/devices.c | 233 ++- arch/arm/plat-omap/include/plat/mcspi.h | 27 +++ drivers/spi/omap2_mcspi.c | 273 ++- 4 files changed, 204 insertions(+), 333 deletions(-) diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c index 138646d..9482e4d 100644 --- a/arch/arm/mach-omap2/clock3xxx_data.c +++ b/arch/arm/mach-omap2/clock3xxx_data.c @@ -1558,6 +1558,7 @@ static struct clk mcspi4_fck = { .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), .enable_bit = OMAP3430_EN_MCSPI4_SHIFT, .recalc = followparent_recalc, + .clkdm_name = core_l4_clkdm, }; static struct clk mcspi3_fck = { @@ -1567,6 +1568,7 @@ static struct clk mcspi3_fck = { .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), .enable_bit = OMAP3430_EN_MCSPI3_SHIFT, .recalc = followparent_recalc, + .clkdm_name = core_l4_clkdm, }; static struct clk mcspi2_fck = { @@ -1576,6 +1578,7 @@ static struct clk mcspi2_fck = { .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), .enable_bit = OMAP3430_EN_MCSPI2_SHIFT, .recalc = followparent_recalc, + .clkdm_name = core_l4_clkdm, }; static struct clk mcspi1_fck = { @@ -1585,6 +1588,7 @@ static struct clk mcspi1_fck = { .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), .enable_bit = OMAP3430_EN_MCSPI1_SHIFT, .recalc = followparent_recalc, + .clkdm_name = core_l4_clkdm, }; static struct clk uart2_fck = { diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index fa99da1..a869c35 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -15,6 +15,8 @@ #include linux/platform_device.h #include linux/io.h #include linux/clk.h +#include linux/err.h +#include linux/slab.h #include mach/hardware.h #include mach/irqs.h @@ -239,170 +241,103 @@ static inline void omap_init_sti(void) {} #include plat/mcspi.h -#define OMAP2_MCSPI1_BASE 0x48098000 -#define OMAP2_MCSPI2_BASE 0x4809a000 -#define OMAP2_MCSPI3_BASE 0x480b8000 -#define OMAP2_MCSPI4_BASE 0x480ba000 - -#define OMAP4_MCSPI1_BASE 0x48098100 -#define OMAP4_MCSPI2_BASE 0x4809a100 -#define OMAP4_MCSPI3_BASE 0x480b8100 -#define OMAP4_MCSPI4_BASE 0x480ba100 - -static struct omap2_mcspi_platform_config omap2_mcspi1_config = { - .num_cs = 4, - .force_cs_mode = 1, -}; - -static struct resource omap2_mcspi1_resources[] = { - { - .start = OMAP2_MCSPI1_BASE, - .end= OMAP2_MCSPI1_BASE + 0xff, - .flags = IORESOURCE_MEM, - }, -}; - -static struct platform_device omap2_mcspi1 = { - .name = omap2_mcspi, - .id = 1, - .num_resources = ARRAY_SIZE(omap2_mcspi1_resources), - .resource = omap2_mcspi1_resources, - .dev= { - .platform_data = omap2_mcspi1_config, - }, -}; - -static struct omap2_mcspi_platform_config omap2_mcspi2_config = { - .num_cs = 2, - .mode = OMAP2_MCSPI_MASTER, - .dma_mode = 0, - .force_cs_mode = 0, - .fifo_depth = 0, -}; - -static struct resource omap2_mcspi2_resources[] = { - { - .start = OMAP2_MCSPI2_BASE, - .end= OMAP2_MCSPI2_BASE + 0xff, - .flags = IORESOURCE_MEM, - }, -}; - -static struct platform_device omap2_mcspi2 = { - .name = omap2_mcspi, - .id = 2, - .num_resources = ARRAY_SIZE(omap2_mcspi2_resources), - .resource = omap2_mcspi2_resources, - .dev= { - .platform_data = omap2_mcspi2_config, - }, -}; - -#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \ - defined(CONFIG_ARCH_OMAP4) -static struct omap2_mcspi_platform_config omap2_mcspi3_config = { - .num_cs = 2, -}; - -static struct resource omap2_mcspi3_resources[] = { - { - .start = OMAP2_MCSPI3_BASE, - .end= OMAP2_MCSPI3_BASE + 0xff, - .flags = IORESOURCE_MEM, - }, -}; - -static struct platform_device omap2_mcspi3 = { - .name = omap2_mcspi, - .id = 3, - .num_resources = ARRAY_SIZE(omap2_mcspi3_resources), - .resource
[PATCH 4/5] OMAP4 HWMOD: Add mcspi hwmods.
From: Benoit Cousson b-cous...@ti.com Update omap4 hwmod file with mcspi info. This patch is extracted from the below patch sent by Benoit OMAP4: hwmod: Add partial hwmod support for OMAP4430 ES1.0 https://patchwork.kernel.org/patch/99052/ Signed-off-by: Benoit Cousson b-cous...@ti.com Signed-off-by: Charulatha V ch...@ti.com Cc: Paul Walmsley p...@pwsan.com Cc: Kevin Hilman khil...@deeprootsystems.com Cc: Rajendra Nayak rna...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 244 1 files changed, 244 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index e20b0ee..dd31cc1 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -452,6 +452,245 @@ static struct omap_hwmod omap44xx_mpu_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), }; +/* + * 'mcspi' class + * multichannel serial port interface (mcspi) / master/slave synchronous serial + * bus + */ + +static struct omap_hwmod_class_sysconfig omap44xx_mcspi_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0114, + .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_EMUFREE | + SYSC_HAS_SOFTRESET), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type2, +}; + +static struct omap_hwmod_class omap44xx_mcspi_hwmod_class = { + .name = mcspi, + .sysc = omap44xx_mcspi_sysc, +}; + +/* mcspi1 */ +static struct omap_hwmod omap44xx_mcspi1_hwmod; +static struct omap_hwmod_irq_info omap44xx_mcspi1_irqs[] = { + { .irq = 65 + OMAP44XX_IRQ_GIC_START }, +}; + +static struct omap_hwmod_dma_info omap44xx_mcspi1_sdma_reqs[] = { + { .name = tx0, .dma_req = 34 + OMAP44XX_DMA_REQ_START }, + { .name = rx0, .dma_req = 35 + OMAP44XX_DMA_REQ_START }, + { .name = tx1, .dma_req = 36 + OMAP44XX_DMA_REQ_START }, + { .name = rx1, .dma_req = 37 + OMAP44XX_DMA_REQ_START }, + { .name = tx2, .dma_req = 38 + OMAP44XX_DMA_REQ_START }, + { .name = rx2, .dma_req = 39 + OMAP44XX_DMA_REQ_START }, + { .name = tx3, .dma_req = 40 + OMAP44XX_DMA_REQ_START }, + { .name = rx3, .dma_req = 41 + OMAP44XX_DMA_REQ_START }, +}; + +static struct omap_hwmod_addr_space omap44xx_mcspi1_addrs[] = { + { + .pa_start = 0x48098000, + .pa_end = 0x480981ff, + .flags = ADDR_TYPE_RT + }, +}; + +/* l4_per - mcspi1 */ +static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi1 = { + .master = omap44xx_l4_per_hwmod, + .slave = omap44xx_mcspi1_hwmod, + .clk= l4_div_ck, + .addr = omap44xx_mcspi1_addrs, + .addr_cnt = ARRAY_SIZE(omap44xx_mcspi1_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* mcspi1 slave ports */ +static struct omap_hwmod_ocp_if *omap44xx_mcspi1_slaves[] = { + omap44xx_l4_per__mcspi1, +}; + +static struct omap_hwmod omap44xx_mcspi1_hwmod = { + .name = mcspi1, + .class = omap44xx_mcspi_hwmod_class, + .mpu_irqs = omap44xx_mcspi1_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_mcspi1_irqs), + .sdma_reqs = omap44xx_mcspi1_sdma_reqs, + .sdma_reqs_cnt = ARRAY_SIZE(omap44xx_mcspi1_sdma_reqs), + .main_clk = mcspi1_fck, + .prcm = { + .omap4 = { + .clkctrl_reg = OMAP4430_CM_L4PER_MCSPI1_CLKCTRL, + }, + }, + .slaves = omap44xx_mcspi1_slaves, + .slaves_cnt = ARRAY_SIZE(omap44xx_mcspi1_slaves), + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), +}; + +/* mcspi2 */ +static struct omap_hwmod omap44xx_mcspi2_hwmod; +static struct omap_hwmod_irq_info omap44xx_mcspi2_irqs[] = { + { .irq = 66 + OMAP44XX_IRQ_GIC_START }, +}; + +static struct omap_hwmod_dma_info omap44xx_mcspi2_sdma_reqs[] = { + { .name = tx0, .dma_req = 42 + OMAP44XX_DMA_REQ_START }, + { .name = rx0, .dma_req = 43 + OMAP44XX_DMA_REQ_START }, + { .name = tx1, .dma_req = 44 + OMAP44XX_DMA_REQ_START }, + { .name = rx1, .dma_req = 45 + OMAP44XX_DMA_REQ_START }, +}; + +static struct omap_hwmod_addr_space omap44xx_mcspi2_addrs[] = { + { + .pa_start = 0x4809a000, + .pa_end = 0x4809a1ff, + .flags = ADDR_TYPE_RT + }, +}; + +/* l4_per - mcspi2 */ +static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi2 = { + .master = omap44xx_l4_per_hwmod, + .slave = omap44xx_mcspi2_hwmod, + .clk= l4_div_ck, + .addr = omap44xx_mcspi2_addrs, + .addr_cnt = ARRAY_SIZE(omap44xx_mcspi2_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* mcspi2 slave
[PATCH 0/6 v2] OMAP2PLUS: WDT: Implement WDT in HWMOD way
This patch series makes OMAP2PLUS Watchdog Timer Module implemented in HWMOD FW way. It also implements OMAP2/3 Watchdog timer driver to use the runtime PM layer. This patch series is created on origin/pm-wip/hwmods-omap4. This patch series is tested on OMAP3430 SDP and OMAP4430 SDP. It would be of great help if someone could test the same on OMAP1 and OMAP2 boards. Version History: --- Version v2: Rebase to latest kernel Version v1: Some of the v1 links: http://www.spinics.net/lists/linux-omap/msg30628.html http://www.spinics.net/lists/linux-omap/msg30625.html Charulatha V (6): OMAP2PLUS: WDT: Add ICLKEN, FCLKEN, WKEN shared bits for WDT OMAP3: WDT: Add watchdog timer HWMOD data for OMAP3 OMAP2420: WDT: Add watchdog timer HWMOD data for OMAP2420 OMAP2430: WDT: Add watchdog timer HWMOD data for OMAP2430 OMAP4: WDT: Enable watchdog timer2 hwmod structure OMAP2PLUS: WDT: Conversion to runtime PM arch/arm/mach-omap2/omap_hwmod_2420_data.c | 59 +++ arch/arm/mach-omap2/omap_hwmod_2430_data.c | 59 +++ arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 61 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |2 +- arch/arm/mach-omap2/prcm-common.h |4 ++ arch/arm/plat-omap/devices.c | 52 +-- drivers/watchdog/omap_wdt.c| 43 7 files changed, 230 insertions(+), 50 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/6 v2] OMAP2PLUS: WDT: Add ICLKEN, FCLKEN, WKEN shared bits for WDT
This patch adds the CM_FCLKEN_WKUP, CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits for OMAP2PLUS watchdog timer module Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/prcm-common.h |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h index 995b7ed..e190c64 100644 --- a/arch/arm/mach-omap2/prcm-common.h +++ b/arch/arm/mach-omap2/prcm-common.h @@ -237,6 +237,8 @@ #define OMAP24XX_ST_USB_MASK (1 0) /* CM_FCLKEN_WKUP, CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits */ +#define OMAP24XX_EN_WDT2_SHIFT 3 +#define OMAP24XX_EN_WDT2_MASK (1 3) #define OMAP24XX_EN_GPIOS_SHIFT2 #define OMAP24XX_EN_GPIOS_MASK (1 2) #define OMAP24XX_EN_GPT1_SHIFT 0 @@ -344,6 +346,8 @@ #define OMAP3430_ST_D2D_MASK (1 3) /* CM_FCLKEN_WKUP, CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits */ +#define OMAP3430_EN_WDT2_SHIFT 5 +#define OMAP3430_EN_WDT2_MASK (1 5) #define OMAP3430_EN_GPIO1_MASK (1 3) #define OMAP3430_EN_GPIO1_SHIFT3 #define OMAP3430_EN_GPT12_MASK (1 1) -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/6 v2] OMAP4: WDT: Enable watchdog timer2 hwmod structure
This patch enables the watchdog timer2 hwmod structure Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 9736a49..929d458 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -5789,7 +5789,7 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = { /* usb_tll_hs class */ /* omap44xx_usb_tll_hs_hwmod, */ /* wd_timer class */ -/* omap44xx_wd_timer2_hwmod, */ + omap44xx_wd_timer2_hwmod, /* omap44xx_wd_timer3_hwmod, */ NULL, }; -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/6 v2] OMAP2420: WDT: Add watchdog timer HWMOD data for OMAP2420
Add hwmod structures for Watchdog module on OMAP2420 Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 59 1 files changed, 59 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c index 3cc768e..3ec5bc9 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c @@ -33,6 +33,7 @@ static struct omap_hwmod omap2420_mpu_hwmod; static struct omap_hwmod omap2420_iva_hwmod; static struct omap_hwmod omap2420_l3_main_hwmod; static struct omap_hwmod omap2420_l4_core_hwmod; +static struct omap_hwmod omap2420_wd_timer2_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = { @@ -165,12 +166,70 @@ static struct omap_hwmod omap2420_iva_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420) }; +/* WDTIMER2 - L4_WKUP interface */ +static struct omap_hwmod_addr_space omap2420_wd_timer2_addrs[] = { + { + .pa_start = 0x48022000, + .pa_end = 0x48022000 + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__wd_timer2 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_wd_timer2_hwmod, + .clk= mpu_wdt_ick, + .addr = omap2420_wd_timer2_addrs, + .addr_cnt = ARRAY_SIZE(omap2420_wd_timer2_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* WDTIMER common */ + +static struct omap_hwmod_class_sysconfig omap2420_wd_timer_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap2420_wd_timer_hwmod_class = { + .name = wd_timer, + .sysc = omap2420_wd_timer_sysc, +}; + +/* WDTIMER2 */ +static struct omap_hwmod_ocp_if *omap2420_wd_timer2_slaves[] = { + omap2420_l4_wkup__wd_timer2, +}; + +static struct omap_hwmod omap2420_wd_timer2_hwmod = { + .name = wd_timer2, + .class = omap2420_wd_timer_hwmod_class, + .main_clk = mpu_wdt_fck, + .prcm = { + .omap2 = { + .prcm_reg_id = 1, + .module_bit = OMAP24XX_EN_WDT2_SHIFT, + .module_offs = WKUP_MOD, + .idlest_reg_id = 1, + .idlest_idle_bit = OMAP24XX_EN_WDT2_SHIFT, + }, + }, + .slaves = omap2420_wd_timer2_slaves, + .slaves_cnt = ARRAY_SIZE(omap2420_wd_timer2_slaves), + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), +}; + static __initdata struct omap_hwmod *omap2420_hwmods[] = { omap2420_l3_main_hwmod, omap2420_l4_core_hwmod, omap2420_l4_wkup_hwmod, omap2420_mpu_hwmod, omap2420_iva_hwmod, + omap2420_wd_timer2_hwmod, NULL, }; -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/6 v2] OMAP2430: WDT: Add watchdog timer HWMOD data for OMAP2430
Add hwmod structures for Watchdog module on OMAP2430 Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 59 1 files changed, 59 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index 4526628..a22e0e1 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -33,6 +33,7 @@ static struct omap_hwmod omap2430_mpu_hwmod; static struct omap_hwmod omap2430_iva_hwmod; static struct omap_hwmod omap2430_l3_main_hwmod; static struct omap_hwmod omap2430_l4_core_hwmod; +static struct omap_hwmod omap2430_wd_timer2_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = { @@ -165,12 +166,70 @@ static struct omap_hwmod omap2430_iva_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430) }; +/* WDTIMER2 - L4_WKUP interface */ +static struct omap_hwmod_addr_space omap2430_wd_timer2_addrs[] = { + { + .pa_start = 0x49016000, + .pa_end = 0x49016000 + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__wd_timer2 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_wd_timer2_hwmod, + .clk= mpu_wdt_ick, + .addr = omap2430_wd_timer2_addrs, + .addr_cnt = ARRAY_SIZE(omap2430_wd_timer2_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* WDTIMER common */ + +static struct omap_hwmod_class_sysconfig omap2430_wd_timer_sysc = { + .rev_offs = 0x0, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap2430_wd_timer_hwmod_class = { + .name = wd_timer, + .sysc = omap2430_wd_timer_sysc, +}; + +/* WDTIMER2 */ +static struct omap_hwmod_ocp_if *omap2430_wd_timer2_slaves[] = { + omap2430_l4_wkup__wd_timer2, +}; + +static struct omap_hwmod omap2430_wd_timer2_hwmod = { + .name = wd_timer2, + .class = omap2430_wd_timer_hwmod_class, + .main_clk = mpu_wdt_fck, + .prcm = { + .omap2 = { + .prcm_reg_id = 1, + .module_bit = OMAP24XX_EN_WDT2_SHIFT, + .module_offs = WKUP_MOD, + .idlest_reg_id = 1, + .idlest_idle_bit = OMAP24XX_EN_WDT2_SHIFT, + }, + }, + .slaves = omap2430_wd_timer2_slaves, + .slaves_cnt = ARRAY_SIZE(omap2430_wd_timer2_slaves), + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430), +}; + static __initdata struct omap_hwmod *omap2430_hwmods[] = { omap2430_l3_main_hwmod, omap2430_l4_core_hwmod, omap2430_l4_wkup_hwmod, omap2430_mpu_hwmod, omap2430_iva_hwmod, + omap2430_wd_timer2_hwmod, NULL, }; -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/6 v2] OMAP3: WDT: Add watchdog timer HWMOD data for OMAP3
Add hwmod structures for Watchdog module on OMAP3 Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 61 1 files changed, 61 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 5d8eb58..4ea323b 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -36,6 +36,7 @@ static struct omap_hwmod omap3xxx_iva_hwmod; static struct omap_hwmod omap3xxx_l3_main_hwmod; static struct omap_hwmod omap3xxx_l4_core_hwmod; static struct omap_hwmod omap3xxx_l4_per_hwmod; +static struct omap_hwmod omap3xxx_wd_timer2_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = { @@ -197,6 +198,65 @@ static struct omap_hwmod omap3xxx_iva_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) }; +/* WDTIMER2 - L4_WKUP interface */ +static struct omap_hwmod_addr_space omap3xxx_wd_timer2_addrs[] = { + { + .pa_start = 0x48314000, + .pa_end = 0x48314000 + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__wd_timer2 = { + .master = omap3xxx_l4_wkup_hwmod, + .slave = omap3xxx_wd_timer2_hwmod, + .clk= wdt2_ick, + .addr = omap3xxx_wd_timer2_addrs, + .addr_cnt = ARRAY_SIZE(omap3xxx_wd_timer2_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* WDTIMER common */ + +static struct omap_hwmod_class_sysconfig omap3xxx_wd_timer_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_EMUFREE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap3xxx_wd_timer_hwmod_class = { + .name = wd_timer, + .sysc = omap3xxx_wd_timer_sysc, +}; + +/* WDTIMER2 */ +static struct omap_hwmod_ocp_if *omap3xxx_wd_timer2_slaves[] = { + omap3xxx_l4_wkup__wd_timer2, +}; + +static struct omap_hwmod omap3xxx_wd_timer2_hwmod = { + .name = wd_timer2, + .class = omap3xxx_wd_timer_hwmod_class, + .main_clk = wdt2_fck, + .prcm = { + .omap2 = { + .prcm_reg_id = 1, + .module_bit = OMAP3430_EN_WDT2_SHIFT, + .module_offs = WKUP_MOD, + .idlest_reg_id = 1, + .idlest_idle_bit = OMAP3430_EN_WDT2_SHIFT, + }, + }, + .slaves = omap3xxx_wd_timer2_slaves, + .slaves_cnt = ARRAY_SIZE(omap3xxx_wd_timer2_slaves), + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), +}; + static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { omap3xxx_l3_main_hwmod, omap3xxx_l4_core_hwmod, @@ -204,6 +264,7 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { omap3xxx_l4_wkup_hwmod, omap3xxx_mpu_hwmod, omap3xxx_iva_hwmod, + omap3xxx_wd_timer2_hwmod, NULL, }; -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/6 v2] OMAP2PLUS: WDT: Conversion to runtime PM
This patch converts the OMAP Watchdog timer driver to get adapted to HWMOD FW and to use the runtime PM APIs. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/plat-omap/devices.c | 52 ++--- drivers/watchdog/omap_wdt.c | 43 ++ 2 files changed, 46 insertions(+), 49 deletions(-) diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c index d1920be..efe2aff 100644 --- a/arch/arm/plat-omap/devices.c +++ b/arch/arm/plat-omap/devices.c @@ -15,6 +15,7 @@ #include linux/platform_device.h #include linux/io.h #include linux/slab.h +#include linux/err.h #include mach/hardware.h #include asm/mach-types.h @@ -28,6 +29,8 @@ #include plat/menelaus.h #include plat/mcbsp.h #include plat/omap44xx.h +#include plat/omap_hwmod.h +#include plat/omap_device.h /*-*/ @@ -238,6 +241,8 @@ static inline void omap_init_uwire(void) {} static struct resource wdt_resources[] = { { + .start = 0xfffeb000, + .end= 0xfffeb07F, .flags = IORESOURCE_MEM, }, }; @@ -249,24 +254,43 @@ static struct platform_device omap_wdt_device = { .resource = wdt_resources, }; -static void omap_init_wdt(void) +struct omap_device_pm_latency omap_wdt_latency[] = { + [0] = { + .deactivate_func = omap_device_idle_hwmods, + .activate_func = omap_device_enable_hwmods, + .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, + }, +}; + +static void omap2_init_wdt() { - if (cpu_is_omap16xx()) - wdt_resources[0].start = 0xfffeb000; - else if (cpu_is_omap2420()) - wdt_resources[0].start = 0x48022000; /* WDT2 */ - else if (cpu_is_omap2430()) - wdt_resources[0].start = 0x49016000; /* WDT2 */ - else if (cpu_is_omap343x()) - wdt_resources[0].start = 0x48314000; /* WDT2 */ - else if (cpu_is_omap44xx()) - wdt_resources[0].start = 0x4a314000; - else + int id = -1; + struct omap_device *od; + struct omap_hwmod *oh; + char *oh_name = wd_timer2; + char *name = omap_wdt; + + oh = omap_hwmod_lookup(oh_name); + if (!oh) { + pr_err(Could not look up %s\n, oh_name); return; + } - wdt_resources[0].end = wdt_resources[0].start + 0x4f; + od = omap_device_build(name, id, oh, NULL, 0, + omap_wdt_latency, + ARRAY_SIZE(omap_wdt_latency), 0); + WARN(IS_ERR(od), Cant build omap_device for %s:%s.\n, + name, oh-name); + return 0; +} - (void) platform_device_register(omap_wdt_device); +static void omap_init_wdt(void) +{ + if (cpu_class_is_omap2()) + omap2_init_wdt(); + else if (cpu_is_omap16xx()) + (void) platform_device_register(omap_wdt_device); + return; } #else static inline void omap_init_wdt(void) {} diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 76b58ab..7645ca3 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c @@ -38,13 +38,14 @@ #include linux/err.h #include linux/platform_device.h #include linux/moduleparam.h -#include linux/clk.h #include linux/bitops.h #include linux/io.h #include linux/uaccess.h #include linux/slab.h +#include linux/pm_runtime.h #include mach/hardware.h #include plat/prcm.h +#include plat/omap_device.h #include omap_wdt.h @@ -61,8 +62,6 @@ struct omap_wdt_dev { void __iomem*base; /* physical */ struct device *dev; int omap_wdt_users; - struct clk *ick; - struct clk *fck; struct resource *mem; struct miscdevice omap_wdt_miscdev; }; @@ -146,8 +145,7 @@ static int omap_wdt_open(struct inode *inode, struct file *file) if (test_and_set_bit(1, (unsigned long *)(wdev-omap_wdt_users))) return -EBUSY; - clk_enable(wdev-ick);/* Enable the interface clock */ - clk_enable(wdev-fck);/* Enable the functional clock */ + pm_runtime_get_sync(wdev-dev); /* initialize prescaler */ while (__raw_readl(base + OMAP_WATCHDOG_WPS) 0x01) @@ -177,8 +175,7 @@ static int omap_wdt_release(struct inode *inode, struct file *file) omap_wdt_disable(wdev); - clk_disable(wdev-ick); - clk_disable(wdev-fck); + pm_runtime_put_sync(wdev-dev); #else printk(KERN_CRIT omap_wdt: Unexpected close, not stopping!\n); #endif @@ -292,19 +289,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev) wdev-omap_wdt_users = 0; wdev-mem = mem; - - wdev-ick = clk_get(pdev-dev
[PATCH] OMAP4: HWMOD: Do omap_hwmod_late_init for OMAP4
This patch includes cpu_is check for omap44xx cpu inorder to do omap_hwmod_late_init() without which hwmods initialization does not happen for omap4. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/io.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index b89e678..9b15f46 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c @@ -345,7 +345,7 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0, #ifndef CONFIG_PM_RUNTIME skip_setup_idle = 1; #endif - if (cpu_is_omap24xx() || cpu_is_omap34xx()) /* FIXME: OMAP4 */ + if (cpu_is_omap24xx() || cpu_is_omap34xx() || cpu_is_omap44xx()) omap_hwmod_late_init(skip_setup_idle); if (cpu_is_omap24xx() || cpu_is_omap34xx()) { -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 02/13 v5] OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init
This patch introduces platform_data structure for GPIO so that GPIO module can be implemented in platform device model. This patch also adds support for handling OMAP15xx specific gpio_init by providing platform device data and doing device registration. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap1/gpio15xx.c | 101 arch/arm/plat-omap/gpio.c |7 -- arch/arm/plat-omap/include/plat/gpio.h | 20 ++ 3 files changed, 121 insertions(+), 7 deletions(-) create mode 100644 arch/arm/mach-omap1/gpio15xx.c diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c new file mode 100644 index 000..b2daa66 --- /dev/null +++ b/arch/arm/mach-omap1/gpio15xx.c @@ -0,0 +1,101 @@ +/* + * OMAP15XX-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/gpio.h + +#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE +#define OMAP1510_GPIO_BASE 0xfffce000 + +static struct omap_gpio_dev_attr omap15xx_gpio_attr = { + .bank_width = 16, +}; + +/* + * OMAP15XX GPIO1 interface data + */ +static struct __initdata resource omap15xx_mpu_gpio_resources[] = { + { + .start = OMAP1_MPUIO_VBASE, + .end= OMAP1_MPUIO_VBASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_MPUIO, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = { + .virtual_irq_start = IH_MPUIO_BASE, + .bank_type = METHOD_MPUIO, + .gpio_attr = omap15xx_gpio_attr, +}; + +static struct __initdata platform_device omap15xx_mpu_gpio = { + .name = omap-gpio, + .id = 0, + .dev= { + .platform_data = omap15xx_mpu_gpio_config, + }, + .num_resources = ARRAY_SIZE(omap15xx_mpu_gpio_resources), + .resource = omap15xx_mpu_gpio_resources, +}; + +/* + * OMAP15XX GPIO2 interface data + */ +static struct __initdata resource omap15xx_gpio_resources[] = { + { + .start = OMAP1510_GPIO_BASE, + .end= OMAP1510_GPIO_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_GPIO_BANK1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = { + .virtual_irq_start = IH_GPIO_BASE, + .bank_type = METHOD_GPIO_1510, + .gpio_attr = omap15xx_gpio_attr, +}; + +static struct __initdata platform_device omap15xx_gpio = { + .name = omap-gpio, + .id = 1, + .dev= { + .platform_data = omap15xx_gpio_config, + }, + .num_resources = ARRAY_SIZE(omap15xx_gpio_resources), + .resource = omap15xx_gpio_resources, +}; + +/* + * omap15xx_gpio_init needs to be done before + * machine_init functions access gpio APIs. + * Hence omap15xx_gpio_init is a postcore_initcall. + */ +static int __init omap15xx_gpio_init(void) +{ + if (!cpu_is_omap15xx()) + return -EINVAL; + + platform_device_register(omap15xx_mpu_gpio); + platform_device_register(omap15xx_gpio); + + gpio_bank_count = 2, + return 0; +} +postcore_initcall(omap15xx_gpio_init); diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index d013b45..dfe4b9e 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -205,13 +205,6 @@ struct gpio_bank { u32 dbck_enable_mask; }; -#define METHOD_MPUIO 0 -#define METHOD_GPIO_1510 1 -#define METHOD_GPIO_1610 2 -#define METHOD_GPIO_7XX3 -#define METHOD_GPIO_24XX 5 -#define METHOD_GPIO_44XX 6 - #ifdef CONFIG_ARCH_OMAP16XX static struct gpio_bank gpio_bank_1610[5] = { { OMAP1_MPUIO_VBASE, NULL, INT_MPUIO, IH_MPUIO_BASE, diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h index de1c604..67d0086 100644 --- a/arch/arm/plat-omap/include/plat/gpio.h +++ b/arch/arm/plat-omap/include/plat/gpio.h @@ -28,6 +28,7 @@ #include linux/io.h #include mach/irqs.h +#include linux/platform_device.h #define OMAP1_MPUIO_BASE 0xfffb5000 @@ -71,6 +72,25 @@ IH_MPUIO_BASE + ((nr) 0x0f) : \ IH_GPIO_BASE + (nr)) +#define METHOD_MPUIO 0 +#define METHOD_GPIO_1510 1 +#define METHOD_GPIO_1610 2 +#define
[PATCH 00/13 v5] OMAP: GPIO: Implement GPIO in HWMOD way
This patch series makes OMAP2PLUS specific GPIO implemented in HWMOD FW way. This is done by implementing GPIO module in platform device model. This patch series is generated on origin/pm-wip/hwmods-omap4. This patch series is created on top of the following two patches: - OMAP4: HWMOD: Do omap_hwmod_late_init for OMAP4 - musb: Kill board specific pinmux from driver file http://marc.info/?l=linux-usbm=127858711304301w=2 - Revert the following patch: OMAP: bus-level PM: enable use of runtime PM API for suspend/resume http://dev.omapzoom.org/?p=swarch/linux-omap-adv.git;a=commitdiff;h=8041359e18e49bf8a3d41f15894db9e476f3a8fc (or) Remove the locking in the omap_hwmod_for_each* function This patch series is tested on OMAP4430 SDP board and OMAP3430 SDP board. It would be of great help if someone could test the same on OMAP1 and OMAP2 boards. Links to related discussions: http://www.mail-archive.com/linux-omap@vger.kernel.org/msg32833.html Version History: --- Comments Fixed in V5: - Use dev_pm_ops instead of sys_dev_class - Use runtime suspend/resume hooks for GPIO device - extend the usage of mod_usage flag to all cpu classes.( Earlier it was used only for OMAP2PLUS) - Make gpio_context as part of gpio_bank structure v4 Series: Some link for v4 series: https://patchwork.kernel.org/patch/107411/ Comments Fixed in v4: - Remove gpio_bank_count from dev_attr field and derive it from hwmod class iteration count - Add TODOs for future omap gpio code cleanup related activity - Rename gpio's platform_data 'method' to 'bank_type' - Rename gpio's platform_data 'gpio_bank_bits' to 'gpio_bank_width' - Add 'rev' field to gpio class in hwmod datbase and get 'bank_type' based on 'rev' field - Filename removed from file description when a new file is created Comments Fixed in v3: - .module_offs populated in hwmod structures - If not defined CONFIG_PM_RUNTIME is not handled in GPIO driver - No changes to mach-omap2/clock-data.c to handle clocks by dev ptr as it is taken care using clock get by name in hwmod omap_device layer - Using ick instead of arm_gpio_ck for OMAP15xx clock - SoC base addresses moved to plat-omap/omap.h that should be used only by the omap_hwmod__data.c file - OMAP2/3 hwmod structures naming convention changed as it is followed in OMAP4 - omap24xx_gpio_init() uses cpu_is_omap24xx() instead of separate checks for 2420 2430 in OMAP2 specific init call (mach-omap layer) - Reason for using postcore_initcall is added to patch description for the patch OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init - Comments added for usage of dbck_flag and other elements in dev_attr structure - Uses dev_dbg() and dev_err() instead of pr_dbg() and pr_err() - Corrects the gpio clock details in OMAP4 hwmod database v2 series: Some important links to patch v2 series and comments: http://www.mail-archive.com/linux-omap@vger.kernel.org/msg30262.html http://www.mail-archive.com/linux-omap@vger.kernel.org/msg28787.html http://www.mail-archive.com/linux-omap@vger.kernel.org/msg30263.html http://www.mail-archive.com/linux-omap@vger.kernel.org/msg30295.html http://www.mail-archive.com/linux-omap@vger.kernel.org/msg30259.html http://www.mail-archive.com/linux-omap@vger.kernel.org/msg28933.html Comments Fixed in V2: - GPIO dev attr was added for SoC specific chip info (eg., gpio bank count) - Removed omap_gpio_init() usage from board files - platform_get_resource() used instead of pdata-base for OMAP2+ base addresses - postcore_initcall used for gpio init instead of making GPIO as an early platform device. SoC specific gpio_init needs to be done before machine_init functions access gpio APIs. Hence making SoC specific gpio_init as postcore_initcall. - getting gpio dbck is moved to omap_set_gpio_debounce() instead of doing it in probe v1 series: Some important links to patch v1 series and comments: http://www.mail-archive.com/linux-omap@vger.kernel.org/msg26934.html http://www.mail-archive.com/linux-omap@vger.kernel.org/msg27860.html http://www.mail-archive.com/linux-omap@vger.kernel.org/msg28183.html Highlights in v1: - Introduces SoC specific functions at mach-omap layer - Implements GPIO as a platform device - Make gpio an early device and make it implemented in HWMOD FW adapted way for OMAP2PLUS Charulatha V (13): OMAP: GPIO: Modify init() in preparation for platform device implementation OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init OMAP: GPIO: Introduce support for OMAP16xx chip GPIO init OMAP: GPIO: Introduce support for OMAP7xx chip GPIO init OMAP: GPIO: add GPIO hwmods structures for OMAP3 OMAP: GPIO: add GPIO hwmods structures for OMAP242X OMAP: GPIO: add GPIO hwmods structures for OMAP243X OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init OMAP: GPIO: Implement GPIO
[PATCH 08/13 v5] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct
This patch adds gpio_dev_attr to OMAP4 gpio hwmod structure. This patch also corrects the gpio .main_clk and .clk fields in gpio hwmod structures. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 40 +++ 1 files changed, 28 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 20f5f8c..1b066df 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -22,6 +22,7 @@ #include plat/omap_hwmod.h #include plat/cpu.h +#include plat/gpio.h #include omap_hwmod_common_data.h @@ -1272,6 +1273,20 @@ static struct omap_hwmod omap44xx_fdif_hwmod = { * general purpose io module */ +/* gpio_dev_attr common for gpio2-6*/ +static struct omap_gpio_dev_attr gpio_dev_attr = { + .bank_width = 32, + .dbck_flag = true, + .off_mode_support = true, +}; + +/* gpio_dev_attr for gpio1*/ +static struct omap_gpio_dev_attr gpio1_dev_attr = { + .bank_width = 32, + .dbck_flag = true, + .off_mode_support = false, +}; + static struct omap_hwmod_class_sysconfig omap44xx_gpio_sysc = { .rev_offs = 0x, .sysc_offs = 0x0010, @@ -1285,6 +1300,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_gpio_sysc = { static struct omap_hwmod_class omap44xx_gpio_hwmod_class = { .name = gpio, .sysc = omap44xx_gpio_sysc, + .rev = 2, }; /* gpio1 */ @@ -1305,7 +1321,7 @@ static struct omap_hwmod_addr_space omap44xx_gpio1_addrs[] = { static struct omap_hwmod_ocp_if omap44xx_l4_wkup__gpio1 = { .master = omap44xx_l4_wkup_hwmod, .slave = omap44xx_gpio1_hwmod, - .clk= l4_wkup_clk_mux_ck, + .clk= gpio1_ick, .addr = omap44xx_gpio1_addrs, .addr_cnt = ARRAY_SIZE(omap44xx_gpio1_addrs), .user = OCP_USER_MPU | OCP_USER_SDMA, @@ -1325,7 +1341,6 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = { .class = omap44xx_gpio_hwmod_class, .mpu_irqs = omap44xx_gpio1_irqs, .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_gpio1_irqs), - .main_clk = gpio1_ick, .prcm = { .omap4 = { .clkctrl_reg = OMAP4430_CM_WKUP_GPIO1_CLKCTRL, @@ -1333,6 +1348,7 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = { }, .opt_clks = gpio1_opt_clks, .opt_clks_cnt = ARRAY_SIZE(gpio1_opt_clks), + .dev_attr = gpio1_dev_attr, .slaves = omap44xx_gpio1_slaves, .slaves_cnt = ARRAY_SIZE(omap44xx_gpio1_slaves), .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), @@ -1356,7 +1372,7 @@ static struct omap_hwmod_addr_space omap44xx_gpio2_addrs[] = { static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio2 = { .master = omap44xx_l4_per_hwmod, .slave = omap44xx_gpio2_hwmod, - .clk= l4_div_ck, + .clk= gpio2_ick, .addr = omap44xx_gpio2_addrs, .addr_cnt = ARRAY_SIZE(omap44xx_gpio2_addrs), .user = OCP_USER_MPU | OCP_USER_SDMA, @@ -1376,7 +1392,6 @@ static struct omap_hwmod omap44xx_gpio2_hwmod = { .class = omap44xx_gpio_hwmod_class, .mpu_irqs = omap44xx_gpio2_irqs, .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_gpio2_irqs), - .main_clk = gpio2_ick, .prcm = { .omap4 = { .clkctrl_reg = OMAP4430_CM_L4PER_GPIO2_CLKCTRL, @@ -1384,6 +1399,7 @@ static struct omap_hwmod omap44xx_gpio2_hwmod = { }, .opt_clks = gpio2_opt_clks, .opt_clks_cnt = ARRAY_SIZE(gpio2_opt_clks), + .dev_attr = gpio_dev_attr, .slaves = omap44xx_gpio2_slaves, .slaves_cnt = ARRAY_SIZE(omap44xx_gpio2_slaves), .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), @@ -1407,7 +1423,7 @@ static struct omap_hwmod_addr_space omap44xx_gpio3_addrs[] = { static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio3 = { .master = omap44xx_l4_per_hwmod, .slave = omap44xx_gpio3_hwmod, - .clk= l4_div_ck, + .clk= gpio3_ick, .addr = omap44xx_gpio3_addrs, .addr_cnt = ARRAY_SIZE(omap44xx_gpio3_addrs), .user = OCP_USER_MPU | OCP_USER_SDMA, @@ -1427,7 +1443,6 @@ static struct omap_hwmod omap44xx_gpio3_hwmod = { .class = omap44xx_gpio_hwmod_class, .mpu_irqs = omap44xx_gpio3_irqs, .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_gpio3_irqs), - .main_clk = gpio3_ick, .prcm = { .omap4 = { .clkctrl_reg = OMAP4430_CM_L4PER_GPIO3_CLKCTRL, @@ -1435,6 +1450,7 @@ static struct
[PATCH 11/13 v5] OMAP: GPIO: Make gpio_context as part of gpio_bank structure
gpio_context array, which is used to save gpio bank's context, is used only for OMAP3 architecture. This patch moves gpio_context as part of gpio_bank structure so that it can be specific to each gpio bank and can be used for any OMAP architecture Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/plat-omap/gpio.c | 70 ++--- 1 files changed, 34 insertions(+), 36 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index a377d40..6a5cf43 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -132,6 +132,19 @@ #define OMAP4_GPIO_CLEARDATAOUT0x0190 #define OMAP4_GPIO_SETDATAOUT 0x0194 +struct omap_gpio_regs { + u32 irqenable1; + u32 irqenable2; + u32 wake_en; + u32 ctrl; + u32 oe; + u32 leveldetect0; + u32 leveldetect1; + u32 risingdetect; + u32 fallingdetect; + u32 dataout; +}; + struct gpio_bank { unsigned long pbase; void __iomem *base; @@ -156,27 +169,11 @@ struct gpio_bank { u32 mod_usage; u32 dbck_enable_mask; struct device *dev; + struct omap_gpio_regs gpio_context; bool dbck_flag; bool off_mode_support; }; -#ifdef CONFIG_ARCH_OMAP3 -struct omap3_gpio_regs { - u32 irqenable1; - u32 irqenable2; - u32 wake_en; - u32 ctrl; - u32 oe; - u32 leveldetect0; - u32 leveldetect1; - u32 risingdetect; - u32 fallingdetect; - u32 dataout; -}; - -static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS]; -#endif - /* * TODO: Cleanup gpio_bank usage as it is having information * related to all instances of the device @@ -2032,25 +2029,25 @@ void omap_gpio_save_context(void) /* saving banks from 2-6 only since GPIO1 is in WKUP */ for (i = 1; i gpio_bank_count; i++) { struct gpio_bank *bank = gpio_bank[i]; - gpio_context[i].irqenable1 = + bank-gpio_context.irqenable1 = __raw_readl(bank-base + OMAP24XX_GPIO_IRQENABLE1); - gpio_context[i].irqenable2 = + bank-gpio_context.irqenable2 = __raw_readl(bank-base + OMAP24XX_GPIO_IRQENABLE2); - gpio_context[i].wake_en = + bank-gpio_context.wake_en = __raw_readl(bank-base + OMAP24XX_GPIO_WAKE_EN); - gpio_context[i].ctrl = + bank-gpio_context.ctrl = __raw_readl(bank-base + OMAP24XX_GPIO_CTRL); - gpio_context[i].oe = + bank-gpio_context.oe = __raw_readl(bank-base + OMAP24XX_GPIO_OE); - gpio_context[i].leveldetect0 = + bank-gpio_context.leveldetect0 = __raw_readl(bank-base + OMAP24XX_GPIO_LEVELDETECT0); - gpio_context[i].leveldetect1 = + bank-gpio_context.leveldetect1 = __raw_readl(bank-base + OMAP24XX_GPIO_LEVELDETECT1); - gpio_context[i].risingdetect = + bank-gpio_context.risingdetect = __raw_readl(bank-base + OMAP24XX_GPIO_RISINGDETECT); - gpio_context[i].fallingdetect = + bank-gpio_context.fallingdetect = __raw_readl(bank-base + OMAP24XX_GPIO_FALLINGDETECT); - gpio_context[i].dataout = + bank-gpio_context.dataout = __raw_readl(bank-base + OMAP24XX_GPIO_DATAOUT); } } @@ -2063,24 +2060,25 @@ void omap_gpio_restore_context(void) for (i = 1; i gpio_bank_count; i++) { struct gpio_bank *bank = gpio_bank[i]; __raw_writel(gpio_context[i].irqenable1, + __raw_writel(bank-gpio_context.irqenable1, bank-base + OMAP24XX_GPIO_IRQENABLE1); - __raw_writel(gpio_context[i].irqenable2, + __raw_writel(bank-gpio_context.irqenable2, bank-base + OMAP24XX_GPIO_IRQENABLE2); - __raw_writel(gpio_context[i].wake_en, + __raw_writel(bank-gpio_context.wake_en, bank-base + OMAP24XX_GPIO_WAKE_EN); - __raw_writel(gpio_context[i].ctrl, + __raw_writel(bank-gpio_context.ctrl, bank-base + OMAP24XX_GPIO_CTRL); - __raw_writel(gpio_context[i].oe, + __raw_writel(bank-gpio_context.oe, bank-base + OMAP24XX_GPIO_OE); - __raw_writel(gpio_context[i].leveldetect0, + __raw_writel(bank-gpio_context.leveldetect0, bank-base + OMAP24XX_GPIO_LEVELDETECT0); - __raw_writel(gpio_context[i].leveldetect1, + __raw_writel
[PATCH 09/13 v5] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init
This patch adds support for handling GPIO as a HWMOD FW adapted platform device for OMAP2PLUS chips. gpio_init needs to be done before machine_init functions access gpio APIs.Hence gpio_init is made as a postcore_initcall. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/gpio.c | 120 1 files changed, 120 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/gpio.c diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c new file mode 100644 index 000..30aeef9 --- /dev/null +++ b/arch/arm/mach-omap2/gpio.c @@ -0,0 +1,120 @@ +/* + * gpio.c - OMAP2PLUS-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/gpio.h +#include linux/err.h +#include linux/slab.h +#include linux/interrupt.h + +#include plat/omap_hwmod.h +#include plat/omap_device.h + +/* + * For GPIO, it is a must to relinquish clocks in the Idle-path + * as it is possible to have a GPIO bank requested and still + * allow PER domain to go to OFF. In the idle path (interrupt + * disabled context), omap_device APIs cannot be used as they + * are not mutex-free functions. Hence the below wrappers are + * required to handle interrupts disabled context and interrupts + * enabled context. + */ +static int gpio_enable_hwmod(struct omap_device *od) +{ + struct omap_hwmod *oh = *od-hwmods; + + if (irqs_disabled()) + _omap_hwmod_enable(oh); + else + omap_device_enable_hwmods(od); + return 0; +} + +static int gpio_idle_hwmod(struct omap_device *od) +{ + struct omap_hwmod *oh = *od-hwmods; + + if (irqs_disabled()) + _omap_hwmod_idle(oh); + else + omap_device_idle_hwmods(od); + return 0; +} + +static struct omap_device_pm_latency omap_gpio_latency[] = { + [0] = { + .deactivate_func = gpio_idle_hwmod, + .activate_func = gpio_enable_hwmod, + .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, + }, +}; + +static int omap2_init_gpio(struct omap_hwmod *oh, void *user) +{ + struct omap_device *od; + struct omap_gpio_platform_data *pdata; + char *name = omap-gpio; + static int id; + struct omap_gpio_dev_attr *gpio_dev_data; + + if (!oh) { + pr_err(Could not look up omap gpio %d\n, id + 1); + return -EINVAL; + } + + pdata = kzalloc(sizeof(struct omap_gpio_platform_data), + GFP_KERNEL); + if (!pdata) { + pr_err(Memory allocation failed gpio%d\n, id + 1); + return -ENOMEM; + } + + gpio_dev_data = (struct omap_gpio_dev_attr *)oh-dev_attr; + + pdata-gpio_attr = gpio_dev_data; + pdata-virtual_irq_start = IH_GPIO_BASE + 32 * id; + switch (oh-class-rev) { + case 0: + case 1: + pdata-bank_type = METHOD_GPIO_24XX; + break; + case 2: + pdata-bank_type = METHOD_GPIO_44XX; + break; + default: + WARN(1, Invalid gpio bank_type\n); + break; + } + gpio_bank_count++; + + od = omap_device_build(name, id, oh, pdata, + sizeof(*pdata), omap_gpio_latency, + ARRAY_SIZE(omap_gpio_latency), + false); + WARN(IS_ERR(od), Cant build omap_device for %s:%s.\n, + name, oh-name); + + id++; + return 0; +} + +/* + * gpio_init needs to be done before + * machine_init functions access gpio APIs. + * Hence gpio_init is a postcore_initcall. + */ +static int __init omap2_gpio_init(void) +{ + return omap_hwmod_for_each_by_class(gpio, omap2_init_gpio, + NULL); +} +postcore_initcall(omap2_gpio_init); -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/13 v5] OMAP: GPIO: Implement GPIO as a platform device
This patch implements GPIO as a platform device. Also it implements OMAP2PLUS specific GPIO as HWMOD FW adapted device. This patch makes GPIO to use runtime APIs. GPIO APIs are used in machine_init functions. Hence it is required to complete GPIO probe before machine_init. Therefore GPIO device register and driver register are implemented as postcore_initcalls. Inorder to convert GPIO as platform device, modifications are required in clock_data.c file for OMAP1 so that device names can be used to obtain clock instead of getting clocks by name/NULL ptr. omap_gpio_init() does nothing now and this function would be removed in the next patch as it's usage is spread across most of the board files. TODO: 1. Cleanup the GPIO driver. Use function pointers and register offest pointers instead of using hardcoded values 2. Remove all cpu_is_ checks and OMAP specific macros 3. Remove usage of gpio_bank array so that only instance specific information is used in driver code 4. Rename 'method'/ avoid it's usage Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap1/Makefile |6 + arch/arm/mach-omap1/clock_data.c |4 +- arch/arm/mach-omap2/Makefile |2 +- arch/arm/plat-omap/gpio.c | 428 arch/arm/plat-omap/include/plat/gpio.h |3 + 5 files changed, 121 insertions(+), 322 deletions(-) diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile index 9a304d8..b014bb1 100644 --- a/arch/arm/mach-omap1/Makefile +++ b/arch/arm/mach-omap1/Makefile @@ -49,6 +49,12 @@ ifeq ($(CONFIG_ARCH_OMAP15XX),y) obj-$(CONFIG_MACH_OMAP_INNOVATOR) += fpga.o endif +# GPIO +obj-$(CONFIG_ARCH_OMAP730) += gpio7xx.o +obj-$(CONFIG_ARCH_OMAP850) += gpio7xx.o +obj-$(CONFIG_ARCH_OMAP15XX)+= gpio15xx.o +obj-$(CONFIG_ARCH_OMAP16XX)+= gpio16xx.o + # LEDs support led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o led-$(CONFIG_MACH_OMAP_H3) += leds-h2p2-debug.o diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c index af54114..cbdcf9c 100644 --- a/arch/arm/mach-omap1/clock_data.c +++ b/arch/arm/mach-omap1/clock_data.c @@ -143,7 +143,7 @@ static struct arm_idlect1_clk armper_ck = { * activation. [ GPIO code for 1510 ] */ static struct clk arm_gpio_ck = { - .name = arm_gpio_ck, + .name = ick, .ops= clkops_generic, .parent = ck_dpll1, .flags = ENABLE_ON_INIT, @@ -684,7 +684,7 @@ static struct omap_clk omap_clks[] = { CLK(NULL, ck_sossi, sossi_ck, CK_16XX), CLK(NULL, arm_ck, arm_ck,CK_16XX | CK_1510 | CK_310), CLK(NULL, armper_ck,armper_ck.clk, CK_16XX | CK_1510 | CK_310), - CLK(NULL, arm_gpio_ck, arm_gpio_ck, CK_1510 | CK_310), + CLK(omap-gpio.0, ick, arm_gpio_ck, CK_1510 | CK_310), CLK(NULL, armxor_ck,armxor_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX), CLK(NULL, armtim_ck,armtim_ck.clk, CK_16XX | CK_1510 | CK_310), CLK(omap_wdt, fck, armwdt_ck.clk, CK_16XX | CK_1510 | CK_310), diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 800b430..9dcc4b5 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -3,7 +3,7 @@ # # Common support -obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o +obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o gpio.o omap-2-3-common= irq.o sdrc.o hwmod-common = omap_hwmod.o \ diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index dfe4b9e..a377d40 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -21,7 +21,10 @@ #include linux/err.h #include linux/clk.h #include linux/io.h +#include linux/slab.h +#include linux/pm_runtime.h +#include plat/omap_device.h #include mach/hardware.h #include asm/irq.h #include mach/irqs.h @@ -32,7 +35,6 @@ /* * OMAP1510 GPIO registers */ -#define OMAP1510_GPIO_BASE 0xfffce000 #define OMAP1510_GPIO_DATA_INPUT 0x00 #define OMAP1510_GPIO_DATA_OUTPUT 0x04 #define OMAP1510_GPIO_DIR_CONTROL 0x08 @@ -46,10 +48,6 @@ /* * OMAP1610 specific GPIO registers */ -#define OMAP1610_GPIO1_BASE0xfffbe400 -#define OMAP1610_GPIO2_BASE0xfffbec00 -#define OMAP1610_GPIO3_BASE0xfffbb400 -#define OMAP1610_GPIO4_BASE0xfffbbc00 #define OMAP1610_GPIO_REVISION 0x #define OMAP1610_GPIO_SYSCONFIG0x0010 #define OMAP1610_GPIO_SYSSTATUS0x0014 @@ -71,12 +69,6 @@ /* * OMAP7XX specific GPIO registers */ -#define OMAP7XX_GPIO1_BASE
[PATCH 12/13 v5] OMAP: GPIO: Use dev_pm_ops instead of sys_dev_class
This patch makes GPIO driver to use dev_pm_ops instead of sysdev_class. With this approach, gpio_bank_suspend gpio_bank_resume are not part of sys_dev_class. According to this patch, a GPIO bank relinquishes the clock using PM runtime APIs when all the gpios in that bank are freed. It also relinquishes the clocks in the idle-path too, as it is possible to have a GPIO bank requested and still allow PER domain to go to OFF state. In the idle path (interrupt disabled context), PM runtime APIs cannot be used as they are not mutex-free functions. Hence omap_device APIs are used in the idle and resume after idle path. To summarize, 1. pm_runtime_get_sync() for any gpio bank is called when one of the gpios is requested on the bank, in which, no other gpio is being used (when mod_usage becomes non-zero) 2. omap_device_enable() is called during gpio resume after idle, only if the particular bank is being used (if mod_usage is non-zero) 3. pm_runtime_put_sync() is called when the last used gpio in that gpio bank is freed (when mod_usage becomes zero) 4. omap_device_idle() is called during idle, if the particular bank is being used (if mod_usage is non-zero) With this patch, GPIO's prepare_for_idle and resume_after_idle APIs makes use of the parameter save_context and restore_context respectively inorder to identify if save context/restore context needs to be done. Links to related discussion: http://www.mail-archive.com/linux-omap@vger.kernel.org/msg32833.html For suspend/resume path to work, this patch has dependency of 1. reverting the following patch: OMAP: bus-level PM: enable use of runtime PM API for suspend/resume http://dev.omapzoom.org/?p=swarch/linux-omap-adv.git;a=commitdiff; h=8041359e18e49bf8a3d41f15894db9e476f3a8fc (or) 2. Remove the locking in the omap_hwmod_for_each* function Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/pm24xx.c |4 +- arch/arm/mach-omap2/pm34xx.c | 23 +- arch/arm/plat-omap/gpio.c | 561 arch/arm/plat-omap/include/plat/gpio.h |6 +- 4 files changed, 297 insertions(+), 297 deletions(-) diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c index 6aeedea..c01e156 100644 --- a/arch/arm/mach-omap2/pm24xx.c +++ b/arch/arm/mach-omap2/pm24xx.c @@ -106,7 +106,7 @@ static void omap2_enter_full_retention(void) l = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0) | OMAP24XX_USBSTANDBYCTRL; omap_ctrl_writel(l, OMAP2_CONTROL_DEVCONF0); - omap2_gpio_prepare_for_idle(PWRDM_POWER_RET); + omap2_gpio_prepare_for_idle(false); if (omap2_pm_debug) { omap2_pm_dump(0, 0, 0); @@ -140,7 +140,7 @@ no_sleep: tmp = timespec_to_ns(ts_idle) * NSEC_PER_USEC; omap2_pm_dump(0, 1, tmp); } - omap2_gpio_resume_after_idle(); + omap2_gpio_resume_after_idle(false); clk_enable(osc_ck); diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index fb4994a..66c7e11 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -79,16 +79,6 @@ static struct powerdomain *mpu_pwrdm, *neon_pwrdm; static struct powerdomain *core_pwrdm, *per_pwrdm; static struct powerdomain *cam_pwrdm; -static inline void omap3_per_save_context(void) -{ - omap_gpio_save_context(); -} - -static inline void omap3_per_restore_context(void) -{ - omap_gpio_restore_context(); -} - static void omap3_enable_io_chain(void) { int timeout = 0; @@ -395,15 +385,17 @@ void omap_sram_idle(void) /* PER */ if (per_next_state PWRDM_POWER_ON) { omap_uart_prepare_idle(2); - omap2_gpio_prepare_for_idle(per_next_state); if (per_next_state == PWRDM_POWER_OFF) { if (core_next_state == PWRDM_POWER_ON) { per_next_state = PWRDM_POWER_RET; pwrdm_set_next_pwrst(per_pwrdm, per_next_state); per_state_modified = 1; - } else - omap3_per_save_context(); + } } + if (per_next_state == PWRDM_POWER_OFF) + omap2_gpio_prepare_for_idle(true); + else + omap2_gpio_prepare_for_idle(false); } if (pwrdm_read_pwrst(cam_pwrdm) == PWRDM_POWER_ON) @@ -471,9 +463,10 @@ void omap_sram_idle(void) /* PER */ if (per_next_state PWRDM_POWER_ON) { per_prev_state = pwrdm_read_prev_pwrst(per_pwrdm); - omap2_gpio_resume_after_idle(); if (per_prev_state == PWRDM_POWER_OFF) - omap3_per_restore_context(); + omap2_gpio_resume_after_idle(true); + else
[PATCH 13/13 v5] OMAP: GPIO: Remove omap_gpio_init()
This patch removes the usage of omap_gpio_init() from all omap board files since omap_gpio_init() does nothing, after gpio is implemented as a platform device. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap1/board-ams-delta.c |1 - arch/arm/mach-omap1/board-fsample.c|1 - arch/arm/mach-omap1/board-h2.c |1 - arch/arm/mach-omap1/board-h3.c |1 - arch/arm/mach-omap1/board-htcherald.c |1 - arch/arm/mach-omap1/board-innovator.c |1 - arch/arm/mach-omap1/board-nokia770.c |1 - arch/arm/mach-omap1/board-osk.c|1 - arch/arm/mach-omap1/board-palmte.c |1 - arch/arm/mach-omap1/board-palmz71.c|1 - arch/arm/mach-omap1/board-perseus2.c |1 - arch/arm/mach-omap1/board-sx1.c|1 - arch/arm/mach-omap1/board-voiceblue.c |1 - arch/arm/mach-omap2/board-2430sdp.c|1 - arch/arm/mach-omap2/board-3430sdp.c|1 - arch/arm/mach-omap2/board-3630sdp.c|1 - arch/arm/mach-omap2/board-4430sdp.c|1 - arch/arm/mach-omap2/board-am3517evm.c |1 - arch/arm/mach-omap2/board-apollon.c|1 - arch/arm/mach-omap2/board-cm-t35.c |1 - arch/arm/mach-omap2/board-devkit8000.c |1 - arch/arm/mach-omap2/board-h4.c |1 - arch/arm/mach-omap2/board-igep0020.c |1 - arch/arm/mach-omap2/board-ldp.c|1 - arch/arm/mach-omap2/board-n8x0.c |1 - arch/arm/mach-omap2/board-omap3beagle.c|1 - arch/arm/mach-omap2/board-omap3evm.c |1 - arch/arm/mach-omap2/board-omap3pandora.c |1 - arch/arm/mach-omap2/board-omap3stalker.c |1 - arch/arm/mach-omap2/board-omap3touchbook.c |1 - arch/arm/mach-omap2/board-omap4panda.c |1 - arch/arm/mach-omap2/board-overo.c |1 - arch/arm/mach-omap2/board-rx51.c |1 - arch/arm/mach-omap2/board-zoom2.c |1 - arch/arm/mach-omap2/board-zoom3.c |1 - 35 files changed, 0 insertions(+), 35 deletions(-) diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 41992ab..774867f 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -136,7 +136,6 @@ static void __init ams_delta_init_irq(void) { omap1_init_common_hw(); omap_init_irq(); - omap_gpio_init(); } static struct map_desc ams_delta_io_desc[] __initdata = { diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c index 180ce79..09b6165 100644 --- a/arch/arm/mach-omap1/board-fsample.c +++ b/arch/arm/mach-omap1/board-fsample.c @@ -325,7 +325,6 @@ static void __init omap_fsample_init_irq(void) { omap1_init_common_hw(); omap_init_irq(); - omap_gpio_init(); fsample_init_smc91x(); } diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c index d2cda58..cf9aaff 100644 --- a/arch/arm/mach-omap1/board-h2.c +++ b/arch/arm/mach-omap1/board-h2.c @@ -374,7 +374,6 @@ static void __init h2_init_irq(void) { omap1_init_common_hw(); omap_init_irq(); - omap_gpio_init(); h2_init_smc91x(); } diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c index c2ef4ff..423b45e 100644 --- a/arch/arm/mach-omap1/board-h3.c +++ b/arch/arm/mach-omap1/board-h3.c @@ -435,7 +435,6 @@ static void __init h3_init_irq(void) { omap1_init_common_hw(); omap_init_irq(); - omap_gpio_init(); h3_init_smc91x(); } diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c index 311899f..bc8f56f 100644 --- a/arch/arm/mach-omap1/board-htcherald.c +++ b/arch/arm/mach-omap1/board-htcherald.c @@ -278,7 +278,6 @@ static void __init htcherald_init(void) { printk(KERN_INFO HTC Herald init.\n); - omap_gpio_init(); omap_board_config = htcherald_config; omap_board_config_size = ARRAY_SIZE(htcherald_config); diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c index 3daf87a..27c283d 100644 --- a/arch/arm/mach-omap1/board-innovator.c +++ b/arch/arm/mach-omap1/board-innovator.c @@ -290,7 +290,6 @@ static void __init innovator_init_irq(void) { omap1_init_common_hw(); omap_init_irq(); - omap_gpio_init(); #ifdef CONFIG_ARCH_OMAP15XX if (cpu_is_omap1510()) { omap1510_fpga_init_irq(); diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c index 51a4539..397febe 100644 --- a/arch/arm/mach-omap1/board-nokia770.c +++ b/arch/arm/mach-omap1/board-nokia770.c @@ -246,7 +246,6 @@ static void __init omap_nokia770_init(void) platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices)); spi_register_board_info
[PATCH 04/13 v5] OMAP: GPIO: Introduce support for OMAP7xx chip GPIO init
This patch adds support for handling OMAP7xx specific gpio_init by providing platform device data and doing device registration. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap1/gpio7xx.c | 274 + 1 files changed, 274 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap1/gpio7xx.c diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c new file mode 100644 index 000..c8cebc4 --- /dev/null +++ b/arch/arm/mach-omap1/gpio7xx.c @@ -0,0 +1,274 @@ +/* + * OMAP7XX-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/gpio.h + +#define OMAP7XX_GPIO1_BASE 0xfffbc000 +#define OMAP7XX_GPIO2_BASE 0xfffbc800 +#define OMAP7XX_GPIO3_BASE 0xfffbd000 +#define OMAP7XX_GPIO4_BASE 0xfffbd800 +#define OMAP7XX_GPIO5_BASE 0xfffbe000 +#define OMAP7XX_GPIO6_BASE 0xfffbe800 +#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE + +static struct omap_gpio_dev_attr omap7xx_gpio_attr = { + .bank_width = 32, +}; + +/* + * OMAP7XX MPU GPIO interface data + */ +static struct __initdata resource omap7xx_mpu_gpio_resources[] = { + { + .start = OMAP1_MPUIO_VBASE, + .end= OMAP1_MPUIO_VBASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_MPUIO, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = { + .virtual_irq_start = IH_MPUIO_BASE, + .bank_type = METHOD_MPUIO, + .gpio_attr = omap7xx_gpio_attr, +}; + +static struct __initdata platform_device omap7xx_mpu_gpio = { + .name = omap-gpio, + .id = 0, + .dev= { + .platform_data = omap7xx_mpu_gpio_config, + }, + .num_resources = ARRAY_SIZE(omap7xx_mpu_gpio_resources), + .resource = omap7xx_mpu_gpio_resources, +}; + +/* + * OMAP7XX GPIO1 interface data + */ +static struct __initdata resource omap7xx_gpio1_resources[] = { + { + .start = OMAP7XX_GPIO1_BASE, + .end= OMAP7XX_GPIO1_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_GPIO_BANK1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = { + .virtual_irq_start = IH_GPIO_BASE, + .bank_type = METHOD_GPIO_7XX, + .gpio_attr = omap7xx_gpio_attr, +}; + +static struct __initdata platform_device omap7xx_gpio1 = { + .name = omap-gpio, + .id = 1, + .dev= { + .platform_data = omap7xx_gpio1_config, + }, + .num_resources = ARRAY_SIZE(omap7xx_gpio1_resources), + .resource = omap7xx_gpio1_resources, +}; + +/* + * OMAP7XX GPIO2 interface data + */ +static struct __initdata resource omap7xx_gpio2_resources[] = { + { + .start = OMAP7XX_GPIO2_BASE, + .end= OMAP7XX_GPIO2_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_GPIO_BANK2, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config = { + .virtual_irq_start = IH_GPIO_BASE + 32, + .bank_type = METHOD_GPIO_7XX, + .gpio_attr = omap7xx_gpio_attr, +}; + +static struct __initdata platform_device omap7xx_gpio2 = { + .name = omap-gpio, + .id = 2, + .dev= { + .platform_data = omap7xx_gpio2_config, + }, + .num_resources = ARRAY_SIZE(omap7xx_gpio2_resources), + .resource = omap7xx_gpio2_resources, +}; + +/* + * OMAP7XX GPIO3 interface data + */ +static struct __initdata resource omap7xx_gpio3_resources[] = { + { + .start = OMAP7XX_GPIO3_BASE, + .end= OMAP7XX_GPIO3_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_GPIO_BANK3, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config = { + .virtual_irq_start = IH_GPIO_BASE + 64, + .bank_type = METHOD_GPIO_7XX, + .gpio_attr = omap7xx_gpio_attr, +}; + +static struct __initdata platform_device omap7xx_gpio3 = { + .name
[PATCH 05/13 v5] OMAP: GPIO: add GPIO hwmods structures for OMAP3
Add hwmod structures for GPIO module on OMAP3 Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 382 1 files changed, 382 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 5d8eb58..90fb907 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -17,6 +17,7 @@ #include mach/irqs.h #include plat/cpu.h #include plat/dma.h +#include plat/gpio.h #include omap_hwmod_common_data.h @@ -36,6 +37,12 @@ static struct omap_hwmod omap3xxx_iva_hwmod; static struct omap_hwmod omap3xxx_l3_main_hwmod; static struct omap_hwmod omap3xxx_l4_core_hwmod; static struct omap_hwmod omap3xxx_l4_per_hwmod; +static struct omap_hwmod omap3xxx_gpio1_hwmod; +static struct omap_hwmod omap3xxx_gpio2_hwmod; +static struct omap_hwmod omap3xxx_gpio3_hwmod; +static struct omap_hwmod omap3xxx_gpio4_hwmod; +static struct omap_hwmod omap3xxx_gpio5_hwmod; +static struct omap_hwmod omap3xxx_gpio6_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = { @@ -197,6 +204,375 @@ static struct omap_hwmod omap3xxx_iva_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) }; +/* L4 WKUP - GPIO1 interface */ + +static struct omap_hwmod_addr_space omap3xxx_gpio1_addrs[] = { + { + .pa_start = 0x4831, + .pa_end = 0x483101ff, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__gpio1 = { + .master = omap3xxx_l4_wkup_hwmod, + .slave = omap3xxx_gpio1_hwmod, + .clk= gpio1_ick, + .addr = omap3xxx_gpio1_addrs, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio1_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO2 interface */ + +static struct omap_hwmod_addr_space omap3xxx_gpio2_addrs[] = { + { + .pa_start = 0x4905, + .pa_end = 0x490501ff, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio2 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio2_hwmod, + .clk= gpio2_ick, + .addr = omap3xxx_gpio2_addrs, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio2_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO3 interface */ + +static struct omap_hwmod_addr_space omap3xxx_gpio3_addrs[] = { + { + .pa_start = 0x49052000, + .pa_end = 0x490521ff, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio3 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio3_hwmod, + .clk= gpio3_ick, + .addr = omap3xxx_gpio3_addrs, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio3_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO4 interface */ + +static struct omap_hwmod_addr_space omap3xxx_gpio4_addrs[] = { + { + .pa_start = 0x49054000, + .pa_end = 0x490541ff, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio4 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio4_hwmod, + .clk= gpio4_ick, + .addr = omap3xxx_gpio4_addrs, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio4_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO5 interface */ + +static struct omap_hwmod_addr_space omap3xxx_gpio5_addrs[] = { + { + .pa_start = 0x49056000, + .pa_end = 0x490561ff, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio5 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio5_hwmod, + .clk= gpio5_ick, + .addr = omap3xxx_gpio5_addrs, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio5_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO6 interface */ + +static struct omap_hwmod_addr_space omap3xxx_gpio6_addrs[] = { + { + .pa_start = 0x49058000, + .pa_end = 0x490581ff, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio6 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio6_hwmod, + .clk
[PATCH 07/13 v5] OMAP: GPIO: add GPIO hwmods structures for OMAP243X
Add hwmod structures for GPIO module on OMAP243X Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 290 1 files changed, 290 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index 4526628..d3582e1 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -15,6 +15,7 @@ #include mach/irqs.h #include plat/cpu.h #include plat/dma.h +#include plat/gpio.h #include omap_hwmod_common_data.h @@ -33,6 +34,11 @@ static struct omap_hwmod omap2430_mpu_hwmod; static struct omap_hwmod omap2430_iva_hwmod; static struct omap_hwmod omap2430_l3_main_hwmod; static struct omap_hwmod omap2430_l4_core_hwmod; +static struct omap_hwmod omap2430_gpio1_hwmod; +static struct omap_hwmod omap2430_gpio2_hwmod; +static struct omap_hwmod omap2430_gpio3_hwmod; +static struct omap_hwmod omap2430_gpio4_hwmod; +static struct omap_hwmod omap2430_gpio5_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = { @@ -165,12 +171,296 @@ static struct omap_hwmod omap2430_iva_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430) }; +/* L4 WKUP - GPIO1 interface */ + +static struct omap_hwmod_addr_space omap2430_gpio1_addr_space[] = { + { + .pa_start = 0x4900C000, + .pa_end = 0x4900C1ff, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio1 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_gpio1_hwmod, + .clk= gpios_ick, + .addr = omap2430_gpio1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO2 interface */ + +static struct omap_hwmod_addr_space omap2430_gpio2_addr_space[] = { + { + .pa_start = 0x4900E000, + .pa_end = 0x4900E1ff, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio2 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_gpio2_hwmod, + .clk= gpios_ick, + .addr = omap2430_gpio2_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO3 interface */ + +static struct omap_hwmod_addr_space omap2430_gpio3_addr_space[] = { + { + .pa_start = 0x4901, + .pa_end = 0x490101ff, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio3 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_gpio3_hwmod, + .clk= gpios_ick, + .addr = omap2430_gpio3_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO4 interface */ + +static struct omap_hwmod_addr_space omap2430_gpio4_addr_space[] = { + { + .pa_start = 0x49012000, + .pa_end = 0x490121ff, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio4 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_gpio4_hwmod, + .clk= gpios_ick, + .addr = omap2430_gpio4_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio4_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 CORE - GPIO5 interface */ + +static struct omap_hwmod_addr_space omap2430_gpio5_addr_space[] = { + { + .pa_start = 0x480B6000, + .pa_end = 0x480B61ff, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__gpio5 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_gpio5_hwmod, + .clk= gpio5_ick, + .addr = omap2430_gpio5_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio5_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* GPIO common */ + +static struct omap_gpio_dev_attr gpio_dev_attr = { + .bank_width = 32, + .dbck_flag = false, + /* +* off_mode is supported by GPIO, but it is not +* supported by software due to leakage current problem. +* Hence making off_mode_support flag as false +*/ + .off_mode_support = false, +}; + +static struct omap_hwmod_class_sysconfig omap243x_gpio_sysc
[PATCH 06/13 v5] OMAP: GPIO: add GPIO hwmods structures for OMAP242X
Add hwmod structures for GPIO module on OMAP242X Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 234 1 files changed, 234 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c index 3cc768e..228ffe4 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c @@ -15,6 +15,7 @@ #include mach/irqs.h #include plat/cpu.h #include plat/dma.h +#include plat/gpio.h #include omap_hwmod_common_data.h @@ -33,6 +34,10 @@ static struct omap_hwmod omap2420_mpu_hwmod; static struct omap_hwmod omap2420_iva_hwmod; static struct omap_hwmod omap2420_l3_main_hwmod; static struct omap_hwmod omap2420_l4_core_hwmod; +static struct omap_hwmod omap2420_gpio1_hwmod; +static struct omap_hwmod omap2420_gpio2_hwmod; +static struct omap_hwmod omap2420_gpio3_hwmod; +static struct omap_hwmod omap2420_gpio4_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = { @@ -165,12 +170,241 @@ static struct omap_hwmod omap2420_iva_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420) }; +/* L4 WKUP - GPIO1 interface */ +static struct omap_hwmod_addr_space omap2420_gpio1_addr_space[] = { + { + .pa_start = 0x48018000, + .pa_end = 0x480181ff, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio1 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_gpio1_hwmod, + .clk= gpios_ick, + .addr = omap2420_gpio1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_gpio1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO2 interface */ +static struct omap_hwmod_addr_space omap2420_gpio2_addr_space[] = { + { + .pa_start = 0x4801a000, + .pa_end = 0x4801a1ff, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio2 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_gpio2_hwmod, + .clk= gpios_ick, + .addr = omap2420_gpio2_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_gpio2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO3 interface */ +static struct omap_hwmod_addr_space omap2420_gpio3_addr_space[] = { + { + .pa_start = 0x4801c000, + .pa_end = 0x4801c1ff, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio3 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_gpio3_hwmod, + .clk= gpios_ick, + .addr = omap2420_gpio3_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_gpio3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO4 interface */ +static struct omap_hwmod_addr_space omap2420_gpio4_addr_space[] = { + { + .pa_start = 0x4801e000, + .pa_end = 0x4801e1ff, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio4 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_gpio4_hwmod, + .clk= gpios_ick, + .addr = omap2420_gpio4_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_gpio4_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* GPIO common */ + +static struct omap_gpio_dev_attr gpio_dev_attr = { + .bank_width = 32, + .dbck_flag = false, + /* +* off_mode is supported by GPIO, but it is not +* supported by software due to leakage current problem. +* Hence making off_mode_support flag as false +*/ + .off_mode_support = false, +}; + +static struct omap_hwmod_class_sysconfig omap242x_gpio_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE | + SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap242x_gpio_hwmod_class = { + .name = gpio, + .sysc = omap242x_gpio_sysc, + .rev = 0, +}; + +/* GPIO1 */ + +static struct omap_hwmod_irq_info omap242x_gpio1_irqs[] = { + { .name = gpio_mpu_irq, .irq = INT_24XX_GPIO_BANK1 }, +}; + +static struct omap_hwmod_ocp_if *omap2420_gpio1_slaves
[PATCH 03/13 v5] OMAP: GPIO: Introduce support for OMAP16xx chip GPIO init
This patch adds support for handling OMAP16xx specific gpio_init by providing platform device data and doing device registration. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap1/gpio16xx.c | 208 1 files changed, 208 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap1/gpio16xx.c diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c new file mode 100644 index 000..727c52b --- /dev/null +++ b/arch/arm/mach-omap1/gpio16xx.c @@ -0,0 +1,208 @@ +/* + * OMAP16XX-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/gpio.h + +#define OMAP1610_GPIO1_BASE0xfffbe400 +#define OMAP1610_GPIO2_BASE0xfffbec00 +#define OMAP1610_GPIO3_BASE0xfffbb400 +#define OMAP1610_GPIO4_BASE0xfffbbc00 +#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE + +static struct omap_gpio_dev_attr omap16xx_gpio_attr = { + .bank_width = 16, +}; + +/* + * OMAP16XX MPU GPIO interface data + */ +static struct __initdata resource omap16xx_mpu_gpio_resources[] = { + { + .start = OMAP1_MPUIO_VBASE, + .end= OMAP1_MPUIO_VBASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_MPUIO, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = { + .virtual_irq_start = IH_MPUIO_BASE, + .bank_type = METHOD_MPUIO, + .gpio_attr = omap16xx_gpio_attr, +}; + +static struct __initdata platform_device omap16xx_mpu_gpio = { + .name = omap-gpio, + .id = 0, + .dev= { + .platform_data = omap16xx_mpu_gpio_config, + }, + .num_resources = ARRAY_SIZE(omap16xx_mpu_gpio_resources), + .resource = omap16xx_mpu_gpio_resources, +}; + +/* + * OMAP16XX GPIO1 interface data + */ +static struct __initdata resource omap16xx_gpio1_resources[] = { + { + .start = OMAP1610_GPIO1_BASE, + .end= OMAP1610_GPIO1_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_GPIO_BANK1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = { + .virtual_irq_start = IH_GPIO_BASE, + .bank_type = METHOD_GPIO_1610, + .gpio_attr = omap16xx_gpio_attr, +}; + +static struct __initdata platform_device omap16xx_gpio1 = { + .name = omap-gpio, + .id = 1, + .dev= { + .platform_data = omap16xx_gpio1_config, + }, + .num_resources = ARRAY_SIZE(omap16xx_gpio1_resources), + .resource = omap16xx_gpio1_resources, +}; + +/* + * OMAP16XX GPIO2 interface data + */ +static struct __initdata resource omap16xx_gpio2_resources[] = { + { + .start = OMAP1610_GPIO2_BASE, + .end= OMAP1610_GPIO2_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_1610_GPIO_BANK2, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = { + .virtual_irq_start = IH_GPIO_BASE + 16, + .bank_type = METHOD_GPIO_1610, + .gpio_attr = omap16xx_gpio_attr, +}; + +static struct __initdata platform_device omap16xx_gpio2 = { + .name = omap-gpio, + .id = 2, + .dev= { + .platform_data = omap16xx_gpio2_config, + }, + .num_resources = ARRAY_SIZE(omap16xx_gpio2_resources), + .resource = omap16xx_gpio2_resources, +}; + +/* + * OMAP16XX GPIO3 interface data + */ +static struct __initdata resource omap16xx_gpio3_resources[] = { + { + .start = OMAP1610_GPIO3_BASE, + .end= OMAP1610_GPIO3_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_1610_GPIO_BANK3, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = { + .virtual_irq_start = IH_GPIO_BASE + 32, + .bank_type = METHOD_GPIO_1610, + .gpio_attr = omap16xx_gpio_attr, +}; + +static struct __initdata platform_device omap16xx_gpio3 = { + .name = omap-gpio, + .id = 3, + .dev
[PATCH:v4 03/13] OMAP: GPIO: Include platform_data structure for GPIO
This patch introduces platform_data structure for GPIO so that GPIO module can be implemented in platform device model. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/plat-omap/include/plat/gpio.h | 20 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h index de1c604..212ce22 100644 --- a/arch/arm/plat-omap/include/plat/gpio.h +++ b/arch/arm/plat-omap/include/plat/gpio.h @@ -28,6 +28,7 @@ #include linux/io.h #include mach/irqs.h +#include linux/platform_device.h #define OMAP1_MPUIO_BASE 0xfffb5000 @@ -71,6 +72,25 @@ IH_MPUIO_BASE + ((nr) 0x0f) : \ IH_GPIO_BASE + (nr)) +#define METHOD_MPUIO 0 +#define METHOD_GPIO_1510 1 +#define METHOD_GPIO_1610 2 +#define METHOD_GPIO_7XX3 +#define METHOD_GPIO_24XX 5 +#define METHOD_GPIO_44XX 6 + +struct omap_gpio_dev_attr { + int gpio_bank_width;/* GPIO bank width */ + bool dbck_flag; /* dbck validity - True only for OMAP34 */ + bool omap1_ick_flag;/* OMAP1 ick - True only for OMAP15xx */ +}; + +struct omap_gpio_platform_data { + u16 virtual_irq_start; + int bank_type; + struct omap_gpio_dev_attr *gpio_attr; +}; + extern int omap_gpio_init(void); /* Call from board init only */ extern void omap2_gpio_prepare_for_idle(int power_state); extern void omap2_gpio_resume_after_idle(void); -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH:v4 02/13] OMAP: GPIO: Populate GPIO base address in omapxxxx.h
This patch populates omap24xx.h, omap34xx.h and omap44xx.h files with SoC specific GPIO base addresses. This would be later used while creating GPIO hwmod structures. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/plat-omap/include/plat/omap24xx.h | 12 arch/arm/plat-omap/include/plat/omap34xx.h |8 arch/arm/plat-omap/include/plat/omap44xx.h |8 3 files changed, 28 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/omap24xx.h b/arch/arm/plat-omap/include/plat/omap24xx.h index 7055672..4406bbe 100644 --- a/arch/arm/plat-omap/include/plat/omap24xx.h +++ b/arch/arm/plat-omap/include/plat/omap24xx.h @@ -85,5 +85,17 @@ #define OMAP24XX_SEC_AES_BASE (OMAP24XX_SEC_BASE + 0x6000) #define OMAP24XX_SEC_PKA_BASE (OMAP24XX_SEC_BASE + 0x8000) +/* GPIO controller*/ +#define OMAP242X_GPIO1_BASE(L4_24XX_BASE + 0x18000) +#define OMAP242X_GPIO2_BASE(L4_24XX_BASE + 0x1a000) +#define OMAP242X_GPIO3_BASE(L4_24XX_BASE + 0x1c000) +#define OMAP242X_GPIO4_BASE(L4_24XX_BASE + 0x1e000) + +#define OMAP243X_GPIO1_BASE(L4_WK_243X_BASE + 0xC000) +#define OMAP243X_GPIO2_BASE(L4_WK_243X_BASE + 0xE000) +#define OMAP243X_GPIO3_BASE(L4_WK_243X_BASE + 0x1) +#define OMAP243X_GPIO4_BASE(L4_WK_243X_BASE + 0x12000) +#define OMAP243X_GPIO5_BASE(L4_24XX_BASE+ 0xB6000) + #endif /* __ASM_ARCH_OMAP2_H */ diff --git a/arch/arm/plat-omap/include/plat/omap34xx.h b/arch/arm/plat-omap/include/plat/omap34xx.h index 98fc8b4..53279b8 100644 --- a/arch/arm/plat-omap/include/plat/omap34xx.h +++ b/arch/arm/plat-omap/include/plat/omap34xx.h @@ -87,5 +87,13 @@ #define OMAP34XX_SEC_SHA1MD5_BASE (OMAP34XX_SEC_BASE + 0x23000) #define OMAP34XX_SEC_AES_BASE (OMAP34XX_SEC_BASE + 0x25000) +/* GPIO controller*/ +#define OMAP34XX_GPIO1_BASE(L4_WK_34XX_BASE + 0x1) +#define OMAP34XX_GPIO2_BASE(L4_PER_34XX_BASE + 0x5) +#define OMAP34XX_GPIO3_BASE(L4_PER_34XX_BASE + 0x52000) +#define OMAP34XX_GPIO4_BASE(L4_PER_34XX_BASE + 0x54000) +#define OMAP34XX_GPIO5_BASE(L4_PER_34XX_BASE + 0x56000) +#define OMAP34XX_GPIO6_BASE(L4_PER_34XX_BASE + 0x58000) + #endif /* __ASM_ARCH_OMAP3_H */ diff --git a/arch/arm/plat-omap/include/plat/omap44xx.h b/arch/arm/plat-omap/include/plat/omap44xx.h index 8b3f12f..bec7d69 100644 --- a/arch/arm/plat-omap/include/plat/omap44xx.h +++ b/arch/arm/plat-omap/include/plat/omap44xx.h @@ -52,5 +52,13 @@ #define OMAP4_MMU1_BASE0x55082000 #define OMAP4_MMU2_BASE0x4A066000 +/* GPIO controller*/ +#define OMAP44XX_GPIO1_BASE (L4_WK_44XX_BASE + 0x1) +#define OMAP44XX_GPIO2_BASE (L4_PER_44XX_BASE + 0x55000) +#define OMAP44XX_GPIO3_BASE (L4_PER_44XX_BASE + 0x57000) +#define OMAP44XX_GPIO4_BASE (L4_PER_44XX_BASE + 0x59000) +#define OMAP44XX_GPIO5_BASE (L4_PER_44XX_BASE + 0x5B000) +#define OMAP44XX_GPIO6_BASE (L4_PER_44XX_BASE + 0x5D000) + #endif /* __ASM_ARCH_OMAP44XX_H */ -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH:v4 04/13] OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init
This patch adds support for handling OMAP15xx specific gpio_init by providing platform device data and doing device registration. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap1/gpio15xx.c | 105 1 files changed, 105 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap1/gpio15xx.c diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c new file mode 100644 index 000..f3d2bd4 --- /dev/null +++ b/arch/arm/mach-omap1/gpio15xx.c @@ -0,0 +1,102 @@ +/* + * OMAP15XX-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/gpio.h + +#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE +#define OMAP1510_GPIO_BASE 0xfffce000 + +static struct omap_gpio_dev_attr omap15xx_gpio_attr = { + .gpio_bank_width = 16, + .omap1_ick_flag = true, +}; + +/* + * OMAP15XX GPIO1 interface data + */ +static struct __initdata resource omap15xx_mpu_gpio_resources[] = { + { + .start = OMAP1_MPUIO_VBASE, + .end= OMAP1_MPUIO_VBASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_MPUIO, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = { + .virtual_irq_start = IH_MPUIO_BASE, + .bank_type = METHOD_MPUIO, + .gpio_attr = omap15xx_gpio_attr, +}; + +static struct __initdata platform_device omap15xx_mpu_gpio = { + .name = omap-gpio, + .id = 0, + .dev= { + .platform_data = omap15xx_mpu_gpio_config, + }, + .num_resources = ARRAY_SIZE(omap15xx_mpu_gpio_resources), + .resource = omap15xx_mpu_gpio_resources, +}; + +/* + * OMAP15XX GPIO2 interface data + */ +static struct __initdata resource omap15xx_gpio_resources[] = { + { + .start = OMAP1510_GPIO_BASE, + .end= OMAP1510_GPIO_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_GPIO_BANK1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = { + .virtual_irq_start = IH_GPIO_BASE, + .bank_type = METHOD_GPIO_1510, + .gpio_attr = omap15xx_gpio_attr, +}; + +static struct __initdata platform_device omap15xx_gpio = { + .name = omap-gpio, + .id = 1, + .dev= { + .platform_data = omap15xx_gpio_config, + }, + .num_resources = ARRAY_SIZE(omap15xx_gpio_resources), + .resource = omap15xx_gpio_resources, +}; + +/* + * omap15xx_gpio_init needs to be done before + * machine_init functions access gpio APIs. + * Hence omap15xx_gpio_init is a postcore_initcall. + */ +static int __init omap15xx_gpio_init(void) +{ + if (!cpu_is_omap15xx()) + return -EINVAL; + + platform_device_register(omap15xx_mpu_gpio); + platform_device_register(omap15xx_gpio); + + gpio_bank_count = 2, + return 0; +} +postcore_initcall(omap15xx_gpio_init); -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH:v4 01/13] OMAP: GPIO: Modify init() in preparation for platform device implementation
This is in prepartion for implementing GPIO as a platform device. gpio bank's base addresses are moved from gpio.c to plat/gpio.h. This patch also modifies omap_gpio_init() to make use of omap_gpio_chip_init() and omap_gpio_mod_init(). omap_gpio_mod_init() does the module init by clearing the status register and initializing the GPIO control register. omap_gpio_chip_init() initializes the chip request, free, get, set and other function pointers and sets the gpio irq handler. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/plat-omap/gpio.c | 235 +++-- 1 files changed, 120 insertions(+), 115 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 9b7e354..3ea616a 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -190,14 +190,12 @@ struct gpio_bank { u32 suspend_wakeup; u32 saved_wakeup; #endif -#ifdef CONFIG_ARCH_OMAP2PLUS u32 non_wakeup_gpios; u32 enabled_non_wakeup_gpios; u32 saved_datain; u32 saved_fallingdetect; u32 saved_risingdetect; -#endif u32 level_mask; u32 toggle_mask; spinlock_t lock; @@ -1711,6 +1709,124 @@ static void __init omap_gpio_show_rev(void) */ static struct lock_class_key gpio_lock_class; +static void omap_gpio_mod_init(struct gpio_bank *bank, int id) +{ + if (cpu_class_is_omap2()) { + if (cpu_is_omap44xx()) { + __raw_writel(0x, bank-base + + OMAP4_GPIO_IRQSTATUSCLR0); + __raw_writel(0x, bank-base + +OMAP4_GPIO_DEBOUNCENABLE); + /* Initialize interface clk ungated, module enabled */ + __raw_writel(0, bank-base + OMAP4_GPIO_CTRL); + } else if (cpu_is_omap34xx()) { + __raw_writel(0x, bank-base + + OMAP24XX_GPIO_IRQENABLE1); + __raw_writel(0x, bank-base + + OMAP24XX_GPIO_IRQSTATUS1); + __raw_writel(0x, bank-base + + OMAP24XX_GPIO_DEBOUNCE_EN); + + /* Initialize interface clk ungated, module enabled */ + __raw_writel(0, bank-base + OMAP24XX_GPIO_CTRL); + /* Enable autoidle for the OCP interface */ + omap_writel(1 0, 0x48306814); + } else if (cpu_is_omap24xx()) { + static const u32 non_wakeup_gpios[] = { + 0xe203ffc0, 0x08700040 + }; + if (id ARRAY_SIZE(non_wakeup_gpios)) + bank-non_wakeup_gpios = non_wakeup_gpios[id]; + + /* Enable autoidle for the OCP interface */ + omap_writel(1 0, 0x48019010); + } + } else if (cpu_class_is_omap1()) { + if (bank_is_mpuio(bank)) + __raw_writew(0x, bank-base + + OMAP_MPUIO_GPIO_MASKIT); + if (cpu_is_omap15xx() bank-method == METHOD_GPIO_1510) { + __raw_writew(0x, bank-base + + OMAP1510_GPIO_INT_MASK); + __raw_writew(0x, bank-base + + OMAP1510_GPIO_INT_STATUS); + } + if (cpu_is_omap16xx() bank-method == METHOD_GPIO_1610) { + __raw_writew(0x, bank-base + + OMAP1610_GPIO_IRQENABLE1); + __raw_writew(0x, bank-base + + OMAP1610_GPIO_IRQSTATUS1); + __raw_writew(0x0014, bank-base + + OMAP1610_GPIO_SYSCONFIG); + + /* Enable system clock for GPIO module. +* The CAM_CLK_CTRL *is* really the right place. */ + omap_writel(omap_readl(ULPD_CAM_CLK_CTRL) | 0x04, + ULPD_CAM_CLK_CTRL); + } + if (cpu_is_omap7xx() bank-method == METHOD_GPIO_7XX) { + __raw_writel(0x, bank-base + + OMAP7XX_GPIO_INT_MASK); + __raw_writel(0x, bank-base + + OMAP7XX_GPIO_INT_STATUS); + } + } +} + +static void __init omap_gpio_chip_init(struct gpio_bank *bank) +{ + int j, gpio_bank_bits = 16; + static int gpio; + + if (cpu_is_omap7xx() bank-method
[PATCH:v4 06/13] OMAP: GPIO: Introduce support for OMAP7xx chip GPIO init
This patch adds support for handling OMAP7xx specific gpio_init by providing platform device data and doing device registration. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap1/gpio7xx.c | 278 + 1 files changed, 278 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap1/gpio7xx.c diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c new file mode 100644 index 000..6f8d13c --- /dev/null +++ b/arch/arm/mach-omap1/gpio7xx.c @@ -0,0 +1,275 @@ +/* + * OMAP7XX-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/gpio.h + +#define OMAP7XX_GPIO1_BASE 0xfffbc000 +#define OMAP7XX_GPIO2_BASE 0xfffbc800 +#define OMAP7XX_GPIO3_BASE 0xfffbd000 +#define OMAP7XX_GPIO4_BASE 0xfffbd800 +#define OMAP7XX_GPIO5_BASE 0xfffbe000 +#define OMAP7XX_GPIO6_BASE 0xfffbe800 +#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE + +static struct omap_gpio_dev_attr omap7xx_gpio_attr = { + .gpio_bank_width = 32, + .omap1_ick_flag = false, +}; + +/* + * OMAP7XX MPU GPIO interface data + */ +static struct __initdata resource omap7xx_mpu_gpio_resources[] = { + { + .start = OMAP1_MPUIO_VBASE, + .end= OMAP1_MPUIO_VBASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_MPUIO, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = { + .virtual_irq_start = IH_MPUIO_BASE, + .bank_type = METHOD_MPUIO, + .gpio_attr = omap7xx_gpio_attr, +}; + +static struct __initdata platform_device omap7xx_mpu_gpio = { + .name = omap-gpio, + .id = 0, + .dev= { + .platform_data = omap7xx_mpu_gpio_config, + }, + .num_resources = ARRAY_SIZE(omap7xx_mpu_gpio_resources), + .resource = omap7xx_mpu_gpio_resources, +}; + +/* + * OMAP7XX GPIO1 interface data + */ +static struct __initdata resource omap7xx_gpio1_resources[] = { + { + .start = OMAP7XX_GPIO1_BASE, + .end= OMAP7XX_GPIO1_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_GPIO_BANK1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = { + .virtual_irq_start = IH_GPIO_BASE, + .bank_type = METHOD_GPIO_7XX, + .gpio_attr = omap7xx_gpio_attr, +}; + +static struct __initdata platform_device omap7xx_gpio1 = { + .name = omap-gpio, + .id = 1, + .dev= { + .platform_data = omap7xx_gpio1_config, + }, + .num_resources = ARRAY_SIZE(omap7xx_gpio1_resources), + .resource = omap7xx_gpio1_resources, +}; + +/* + * OMAP7XX GPIO2 interface data + */ +static struct __initdata resource omap7xx_gpio2_resources[] = { + { + .start = OMAP7XX_GPIO2_BASE, + .end= OMAP7XX_GPIO2_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_GPIO_BANK2, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config = { + .virtual_irq_start = IH_GPIO_BASE + 32, + .bank_type = METHOD_GPIO_7XX, + .gpio_attr = omap7xx_gpio_attr, +}; + +static struct __initdata platform_device omap7xx_gpio2 = { + .name = omap-gpio, + .id = 2, + .dev= { + .platform_data = omap7xx_gpio2_config, + }, + .num_resources = ARRAY_SIZE(omap7xx_gpio2_resources), + .resource = omap7xx_gpio2_resources, +}; + +/* + * OMAP7XX GPIO3 interface data + */ +static struct __initdata resource omap7xx_gpio3_resources[] = { + { + .start = OMAP7XX_GPIO3_BASE, + .end= OMAP7XX_GPIO3_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_GPIO_BANK3, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config = { + .virtual_irq_start = IH_GPIO_BASE + 64, + .bank_type = METHOD_GPIO_7XX, + .gpio_attr = omap7xx_gpio_attr, +}; + +static struct __initdata platform_device
[PATCH:v4 09/13] OMAP: GPIO: add GPIO hwmods structures for OMAP243X
Add hwmod structures for GPIO module on OMAP243X Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 279 1 files changed, 279 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index b2100cf..b350928 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -15,6 +15,7 @@ #include mach/irqs.h #include plat/cpu.h #include plat/dma.h +#include plat/gpio.h #include omap_hwmod_common_data.h @@ -72,6 +73,11 @@ static struct omap_hwmod omap2430_l3_hwmod = { static struct omap_hwmod omap2430_l4_wkup_hwmod; static struct omap_hwmod omap2430_mmc1_hwmod; static struct omap_hwmod omap2430_mmc2_hwmod; +static struct omap_hwmod omap2430_gpio1_hwmod; +static struct omap_hwmod omap2430_gpio2_hwmod; +static struct omap_hwmod omap2430_gpio3_hwmod; +static struct omap_hwmod omap2430_gpio4_hwmod; +static struct omap_hwmod omap2430_gpio5_hwmod; /* L4_CORE - L4_WKUP interface */ static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = { @@ -80,6 +86,96 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; +/* L4 WKUP - GPIO1 interface */ +static struct omap_hwmod_addr_space omap2430_gpio1_addr_space[] = { + { + .pa_start = OMAP243X_GPIO1_BASE, + .pa_end = OMAP243X_GPIO1_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio1 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_gpio1_hwmod, + .clk= gpios_ick, + .addr = omap2430_gpio1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO2 interface */ +static struct omap_hwmod_addr_space omap2430_gpio2_addr_space[] = { + { + .pa_start = OMAP243X_GPIO2_BASE, + .pa_end = OMAP243X_GPIO2_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio2 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_gpio2_hwmod, + .clk= gpios_ick, + .addr = omap2430_gpio2_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO3 interface */ +static struct omap_hwmod_addr_space omap2430_gpio3_addr_space[] = { + { + .pa_start = OMAP243X_GPIO3_BASE, + .pa_end = OMAP243X_GPIO3_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio3 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_gpio3_hwmod, + .clk= gpios_ick, + .addr = omap2430_gpio3_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO4 interface */ +static struct omap_hwmod_addr_space omap2430_gpio4_addr_space[] = { + { + .pa_start = OMAP243X_GPIO4_BASE, + .pa_end = OMAP243X_GPIO4_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio4 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_gpio4_hwmod, + .clk= gpios_ick, + .addr = omap2430_gpio4_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio4_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 CORE - GPIO5 interface */ +static struct omap_hwmod_addr_space omap2430_gpio5_addr_space[] = { + { + .pa_start = OMAP243X_GPIO5_BASE, + .pa_end = OMAP243X_GPIO5_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__gpio5 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_gpio5_hwmod, + .clk= gpio5_ick, + .addr = omap2430_gpio5_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio5_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* Slave interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = { omap2430_l3__l4_core, @@ -138,11 +234,194 @@ static struct omap_hwmod omap2430_mpu_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430), }; +/* GPIO
[PATCH:v4 11/13] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init
This patch adds support for handling GPIO as a HWMOD FW adapted platform device for OMAP2PLUS chips. gpio_init needs to be done before machine_init functions access gpio APIs. Hence gpio_init is made as a postcore_initcall. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/gpio.c | 86 1 files changed, 86 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/gpio.c diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c new file mode 100644 index 000..a5b0b60 --- /dev/null +++ b/arch/arm/mach-omap2/gpio.c @@ -0,0 +1,86 @@ +/* + * gpio.c - OMAP2PLUS-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/gpio.h +#include linux/err.h +#include linux/slab.h + +#include plat/omap_hwmod.h +#include plat/omap_device.h + +static struct omap_device_pm_latency omap_gpio_latency[] = { + [0] = { + .deactivate_func = omap_device_idle_hwmods, + .activate_func = omap_device_enable_hwmods, + .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, + }, +}; + +static int omap2_init_gpio(struct omap_hwmod *oh, void *user) +{ + struct omap_device *od; + struct omap_gpio_platform_data *pdata; + char *name = omap-gpio; + static int id; + struct omap_gpio_dev_attr *gpio_dev_data; + + if (!oh) + pr_err(Could not look up omap gpio %d\n, id + 1); + + pdata = kzalloc(sizeof(struct omap_gpio_platform_data), + GFP_KERNEL); + if (!pdata) { + pr_err(Memory allocation failed gpio%d\n, id + 1); + return -ENOMEM; + } + + gpio_dev_data = (struct omap_gpio_dev_attr *)oh-dev_attr; + + pdata-gpio_attr = gpio_dev_data; + pdata-virtual_irq_start = IH_GPIO_BASE + 32 * id; + switch (oh-class-rev) { + case 0: + case 1: + pdata-bank_type = METHOD_GPIO_24XX; + break; + case 2: + pdata-bank_type = METHOD_GPIO_44XX; + break; + default: + WARN(1, Invalid gpio bank_type\n); + break; + } + gpio_bank_count++; + + od = omap_device_build(name, id, oh, pdata, + sizeof(*pdata), omap_gpio_latency, + ARRAY_SIZE(omap_gpio_latency), + false); + WARN(IS_ERR(od), Cant build omap_device for %s:%s.\n, + name, oh-name); + + id++; + return 0; +} + +/* + * gpio_init needs to be done before + * machine_init functions access gpio APIs. + * Hence gpio_init is a postcore_initcall. + */ +static int __init omap2_gpio_init(void) +{ + return omap_hwmod_for_each_by_class(gpio, omap2_init_gpio, + NULL); +} +postcore_initcall(omap2_gpio_init); -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH:v4 12/13] OMAP: GPIO: Implement GPIO as a platform device
This patch implements GPIO as a platform device. Also it implements OMAP2PLUS specific GPIO as HWMOD FW adapted device. This patch makes GPIO to use runtime APIs. GPIO APIs are used in machine_init functions. Hence it is required to complete GPIO probe before machine_init. Therefore GPIO device register and driver register are implemented as postcore_initcalls. Inorder to convert GPIO as platform device, modifications are required in clock_data.c file for OMAP1 so that device names can be used to obtain clock instead of getting clocks by name/NULL ptr. omap_gpio_init() does nothing now and this function would be removed in the next patch as it's usage is spread across most of the board files. TODO: 1. Cleanup the GPIO driver. Use function pointers and register offest pointers instead of using hardcoded values 2. Remove all cpu_is_ checks and OMAP specific macros 3. Remove usage of gpio_bank array so that only instance specific information is used in driver code 4. Modify save/restore context, gpio_prepare_for_idle, and gpio_resume_after_idle functions as instance specific function and not for all instances in a single call 5. Rename 'method'/ avoid it's usage Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap1/Makefile |6 + arch/arm/mach-omap1/clock_data.c |4 +- arch/arm/mach-omap2/Makefile |2 +- arch/arm/plat-omap/gpio.c | 430 arch/arm/plat-omap/include/plat/gpio.h |3 + 5 files changed, 122 insertions(+), 323 deletions(-) diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile index fd4df71..69f293d 100644 --- a/arch/arm/mach-omap1/Makefile +++ b/arch/arm/mach-omap1/Makefile @@ -46,6 +46,12 @@ ifeq ($(CONFIG_ARCH_OMAP15XX),y) obj-$(CONFIG_MACH_OMAP_INNOVATOR) += fpga.o endif +# GPIO +obj-$(CONFIG_ARCH_OMAP730) += gpio7xx.o +obj-$(CONFIG_ARCH_OMAP850) += gpio7xx.o +obj-$(CONFIG_ARCH_OMAP15XX)+= gpio15xx.o +obj-$(CONFIG_ARCH_OMAP16XX)+= gpio16xx.o + # LEDs support led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o led-$(CONFIG_MACH_OMAP_H3) += leds-h2p2-debug.o diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c index aa8558a..5c2a0a1 100644 --- a/arch/arm/mach-omap1/clock_data.c +++ b/arch/arm/mach-omap1/clock_data.c @@ -99,7 +99,7 @@ static struct arm_idlect1_clk armper_ck = { * activation. [ GPIO code for 1510 ] */ static struct clk arm_gpio_ck = { - .name = arm_gpio_ck, + .name = ick, .ops= clkops_generic, .parent = ck_dpll1, .flags = ENABLE_ON_INIT, @@ -589,7 +589,7 @@ static struct omap_clk omap_clks[] = { CLK(NULL, ck_sossi, sossi_ck, CK_16XX), CLK(NULL, arm_ck, arm_ck,CK_16XX | CK_1510 | CK_310), CLK(NULL, armper_ck,armper_ck.clk, CK_16XX | CK_1510 | CK_310), - CLK(NULL, arm_gpio_ck, arm_gpio_ck, CK_1510 | CK_310), + CLK(omap-gpio.0, ick, arm_gpio_ck, CK_1510 | CK_310), CLK(NULL, armxor_ck,armxor_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX), CLK(NULL, armtim_ck,armtim_ck.clk, CK_16XX | CK_1510 | CK_310), CLK(omap_wdt, fck, armwdt_ck.clk, CK_16XX | CK_1510 | CK_310), diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index ae5f36f..0756b84 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -3,7 +3,7 @@ # # Common support -obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o +obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o gpio.o omap-2-3-common= irq.o sdrc.o hwmod-common = omap_hwmod.o \ diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 3ea616a..7f8ef27 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -21,7 +21,10 @@ #include linux/err.h #include linux/clk.h #include linux/io.h +#include linux/slab.h +#include linux/pm_runtime.h +#include plat/omap_device.h #include mach/hardware.h #include asm/irq.h #include mach/irqs.h @@ -32,7 +35,6 @@ /* * OMAP1510 GPIO registers */ -#define OMAP1510_GPIO_BASE 0xfffce000 #define OMAP1510_GPIO_DATA_INPUT 0x00 #define OMAP1510_GPIO_DATA_OUTPUT 0x04 #define OMAP1510_GPIO_DIR_CONTROL 0x08 @@ -46,10 +48,6 @@ /* * OMAP1610 specific GPIO registers */ -#define OMAP1610_GPIO1_BASE0xfffbe400 -#define OMAP1610_GPIO2_BASE0xfffbec00 -#define OMAP1610_GPIO3_BASE0xfffbb400 -#define OMAP1610_GPIO4_BASE0xfffbbc00 #define OMAP1610_GPIO_REVISION 0x #define OMAP1610_GPIO_SYSCONFIG0x0010
[PATCH:v4 13/13] OMAP: GPIO: Remove omap_gpio_init()
This patch removes the usage of omap_gpio_init() from all omap board files since omap_gpio_init() does nothing, after gpio is implemented as a platform device. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap1/board-ams-delta.c |1 - arch/arm/mach-omap1/board-fsample.c|1 - arch/arm/mach-omap1/board-h2.c |1 - arch/arm/mach-omap1/board-h3.c |1 - arch/arm/mach-omap1/board-htcherald.c |1 - arch/arm/mach-omap1/board-innovator.c |1 - arch/arm/mach-omap1/board-nokia770.c |1 - arch/arm/mach-omap1/board-osk.c|1 - arch/arm/mach-omap1/board-palmte.c |1 - arch/arm/mach-omap1/board-palmz71.c|1 - arch/arm/mach-omap1/board-perseus2.c |1 - arch/arm/mach-omap1/board-sx1.c|1 - arch/arm/mach-omap1/board-voiceblue.c |1 - arch/arm/mach-omap2/board-2430sdp.c|1 - arch/arm/mach-omap2/board-3430sdp.c|1 - arch/arm/mach-omap2/board-3630sdp.c|1 - arch/arm/mach-omap2/board-4430sdp.c|1 - arch/arm/mach-omap2/board-am3517evm.c |1 - arch/arm/mach-omap2/board-apollon.c|1 - arch/arm/mach-omap2/board-cm-t35.c |1 - arch/arm/mach-omap2/board-devkit8000.c |1 - arch/arm/mach-omap2/board-h4.c |1 - arch/arm/mach-omap2/board-igep0020.c |1 - arch/arm/mach-omap2/board-ldp.c|1 - arch/arm/mach-omap2/board-n8x0.c |1 - arch/arm/mach-omap2/board-omap3beagle.c|1 - arch/arm/mach-omap2/board-omap3evm.c |1 - arch/arm/mach-omap2/board-omap3pandora.c |1 - arch/arm/mach-omap2/board-omap3stalker.c |1 - arch/arm/mach-omap2/board-omap3touchbook.c |1 - arch/arm/mach-omap2/board-overo.c |1 - arch/arm/mach-omap2/board-rx51.c |1 - arch/arm/mach-omap2/board-zoom2.c |1 - arch/arm/mach-omap2/board-zoom3.c |1 - arch/arm/plat-omap/gpio.c |6 -- arch/arm/plat-omap/include/plat/gpio.h |1 - 36 files changed, 0 insertions(+), 41 deletions(-) diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index fdd1dd5..75d1bd0 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -136,7 +136,6 @@ static void __init ams_delta_init_irq(void) { omap1_init_common_hw(); omap_init_irq(); - omap_gpio_init(); } static struct map_desc ams_delta_io_desc[] __initdata = { diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c index 096f2ed..8d9d6e8 100644 --- a/arch/arm/mach-omap1/board-fsample.c +++ b/arch/arm/mach-omap1/board-fsample.c @@ -313,7 +313,6 @@ static void __init omap_fsample_init_irq(void) { omap1_init_common_hw(); omap_init_irq(); - omap_gpio_init(); fsample_init_smc91x(); } diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c index d1100e4..dd04ef5 100644 --- a/arch/arm/mach-omap1/board-h2.c +++ b/arch/arm/mach-omap1/board-h2.c @@ -383,7 +383,6 @@ static void __init h2_init_irq(void) { omap1_init_common_hw(); omap_init_irq(); - omap_gpio_init(); h2_init_smc91x(); } diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c index a53ab82..ac8af4b 100644 --- a/arch/arm/mach-omap1/board-h3.c +++ b/arch/arm/mach-omap1/board-h3.c @@ -422,7 +422,6 @@ static void __init h3_init_irq(void) { omap1_init_common_hw(); omap_init_irq(); - omap_gpio_init(); h3_init_smc91x(); } diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c index 8e313b4..6ff6f30 100644 --- a/arch/arm/mach-omap1/board-htcherald.c +++ b/arch/arm/mach-omap1/board-htcherald.c @@ -278,7 +278,6 @@ static void __init htcherald_init(void) { printk(KERN_INFO HTC Herald init.\n); - omap_gpio_init(); omap_board_config = htcherald_config; omap_board_config_size = ARRAY_SIZE(htcherald_config); diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c index 5d12fd3..28bb2cd 100644 --- a/arch/arm/mach-omap1/board-innovator.c +++ b/arch/arm/mach-omap1/board-innovator.c @@ -290,7 +290,6 @@ static void __init innovator_init_irq(void) { omap1_init_common_hw(); omap_init_irq(); - omap_gpio_init(); #ifdef CONFIG_ARCH_OMAP15XX if (cpu_is_omap1510()) { omap1510_fpga_init_irq(); diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c index 71e1a3f..6ea838c 100644 --- a/arch/arm/mach-omap1/board-nokia770.c +++ b/arch/arm/mach-omap1/board-nokia770.c @@ -379,7 +379,6 @@ static void __init omap_nokia770_init(void) platform_add_devices(nokia770_devices, ARRAY_SIZE
[PATCH:v4 05/13] OMAP: GPIO: Introduce support for OMAP16xx chip GPIO init
This patch adds support for handling OMAP16xx specific gpio_init by providing platform device data and doing device registration. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap1/gpio16xx.c | 212 1 files changed, 212 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap1/gpio16xx.c diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c new file mode 100644 index 000..4f042bf --- /dev/null +++ b/arch/arm/mach-omap1/gpio16xx.c @@ -0,0 +1,209 @@ +/* + * OMAP16XX-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/gpio.h + +#define OMAP1610_GPIO1_BASE0xfffbe400 +#define OMAP1610_GPIO2_BASE0xfffbec00 +#define OMAP1610_GPIO3_BASE0xfffbb400 +#define OMAP1610_GPIO4_BASE0xfffbbc00 +#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE + +static struct omap_gpio_dev_attr omap16xx_gpio_attr = { + .gpio_bank_width = 16, + .omap1_ick_flag = false, +}; + +/* + * OMAP16XX MPU GPIO interface data + */ +static struct __initdata resource omap16xx_mpu_gpio_resources[] = { + { + .start = OMAP1_MPUIO_VBASE, + .end= OMAP1_MPUIO_VBASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_MPUIO, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = { + .virtual_irq_start = IH_MPUIO_BASE, + .bank_type = METHOD_MPUIO, + .gpio_attr = omap16xx_gpio_attr, +}; + +static struct __initdata platform_device omap16xx_mpu_gpio = { + .name = omap-gpio, + .id = 0, + .dev= { + .platform_data = omap16xx_mpu_gpio_config, + }, + .num_resources = ARRAY_SIZE(omap16xx_mpu_gpio_resources), + .resource = omap16xx_mpu_gpio_resources, +}; + +/* + * OMAP16XX GPIO1 interface data + */ +static struct __initdata resource omap16xx_gpio1_resources[] = { + { + .start = OMAP1610_GPIO1_BASE, + .end= OMAP1610_GPIO1_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_GPIO_BANK1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = { + .virtual_irq_start = IH_GPIO_BASE, + .bank_type = METHOD_GPIO_1610, + .gpio_attr = omap16xx_gpio_attr, +}; + +static struct __initdata platform_device omap16xx_gpio1 = { + .name = omap-gpio, + .id = 1, + .dev= { + .platform_data = omap16xx_gpio1_config, + }, + .num_resources = ARRAY_SIZE(omap16xx_gpio1_resources), + .resource = omap16xx_gpio1_resources, +}; + +/* + * OMAP16XX GPIO2 interface data + */ +static struct __initdata resource omap16xx_gpio2_resources[] = { + { + .start = OMAP1610_GPIO2_BASE, + .end= OMAP1610_GPIO2_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_1610_GPIO_BANK2, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = { + .virtual_irq_start = IH_GPIO_BASE + 16, + .bank_type = METHOD_GPIO_1610, + .gpio_attr = omap16xx_gpio_attr, +}; + +static struct __initdata platform_device omap16xx_gpio2 = { + .name = omap-gpio, + .id = 2, + .dev= { + .platform_data = omap16xx_gpio2_config, + }, + .num_resources = ARRAY_SIZE(omap16xx_gpio2_resources), + .resource = omap16xx_gpio2_resources, +}; + +/* + * OMAP16XX GPIO3 interface data + */ +static struct __initdata resource omap16xx_gpio3_resources[] = { + { + .start = OMAP1610_GPIO3_BASE, + .end= OMAP1610_GPIO3_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_1610_GPIO_BANK3, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = { + .virtual_irq_start = IH_GPIO_BASE + 32, + .bank_type = METHOD_GPIO_1610, + .gpio_attr = omap16xx_gpio_attr, +}; + +static struct __initdata platform_device omap16xx_gpio3 = { + .name = omap-gpio, + .id
[PATCH:v4 10/13] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct
This patch adds gpio_dev_attr to OMAP4 gpio hwmod structure. This patch also corrects the gpio .main_clk and .clk fields in gpio hwmod structures. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 31 +-- 1 files changed, 19 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 20f5f8c..003d7b2 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -22,6 +22,7 @@ #include plat/omap_hwmod.h #include plat/cpu.h +#include plat/gpio.h #include omap_hwmod_common_data.h @@ -1272,6 +1273,11 @@ static struct omap_hwmod omap44xx_fdif_hwmod = { * general purpose io module */ +static struct omap_gpio_dev_attr gpio_dev_attr = { + .gpio_bank_width = 32, + .dbck_flag = true, +}; + static struct omap_hwmod_class_sysconfig omap44xx_gpio_sysc = { .rev_offs = 0x, .sysc_offs = 0x0010, @@ -1285,6 +1291,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_gpio_sysc = { static struct omap_hwmod_class omap44xx_gpio_hwmod_class = { .name = gpio, .sysc = omap44xx_gpio_sysc, + .rev = 2, }; /* gpio1 */ @@ -1305,7 +1312,7 @@ static struct omap_hwmod_addr_space omap44xx_gpio1_addrs[] = { static struct omap_hwmod_ocp_if omap44xx_l4_wkup__gpio1 = { .master = omap44xx_l4_wkup_hwmod, .slave = omap44xx_gpio1_hwmod, - .clk= l4_wkup_clk_mux_ck, + .clk= gpio1_ick, .addr = omap44xx_gpio1_addrs, .addr_cnt = ARRAY_SIZE(omap44xx_gpio1_addrs), .user = OCP_USER_MPU | OCP_USER_SDMA, @@ -1325,7 +1332,6 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = { .class = omap44xx_gpio_hwmod_class, .mpu_irqs = omap44xx_gpio1_irqs, .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_gpio1_irqs), - .main_clk = gpio1_ick, .prcm = { .omap4 = { .clkctrl_reg = OMAP4430_CM_WKUP_GPIO1_CLKCTRL, @@ -1333,6 +1339,7 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = { }, .opt_clks = gpio1_opt_clks, .opt_clks_cnt = ARRAY_SIZE(gpio1_opt_clks), + .dev_attr = gpio_dev_attr, .slaves = omap44xx_gpio1_slaves, .slaves_cnt = ARRAY_SIZE(omap44xx_gpio1_slaves), .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), @@ -1356,7 +1363,7 @@ static struct omap_hwmod_addr_space omap44xx_gpio2_addrs[] = { static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio2 = { .master = omap44xx_l4_per_hwmod, .slave = omap44xx_gpio2_hwmod, - .clk= l4_div_ck, + .clk= gpio2_ick, .addr = omap44xx_gpio2_addrs, .addr_cnt = ARRAY_SIZE(omap44xx_gpio2_addrs), .user = OCP_USER_MPU | OCP_USER_SDMA, @@ -1376,7 +1383,6 @@ static struct omap_hwmod omap44xx_gpio2_hwmod = { .class = omap44xx_gpio_hwmod_class, .mpu_irqs = omap44xx_gpio2_irqs, .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_gpio2_irqs), - .main_clk = gpio2_ick, .prcm = { .omap4 = { .clkctrl_reg = OMAP4430_CM_L4PER_GPIO2_CLKCTRL, @@ -1384,6 +1390,7 @@ static struct omap_hwmod omap44xx_gpio2_hwmod = { }, .opt_clks = gpio2_opt_clks, .opt_clks_cnt = ARRAY_SIZE(gpio2_opt_clks), + .dev_attr = gpio_dev_attr, .slaves = omap44xx_gpio2_slaves, .slaves_cnt = ARRAY_SIZE(omap44xx_gpio2_slaves), .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), @@ -1407,7 +1414,7 @@ static struct omap_hwmod_addr_space omap44xx_gpio3_addrs[] = { static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio3 = { .master = omap44xx_l4_per_hwmod, .slave = omap44xx_gpio3_hwmod, - .clk= l4_div_ck, + .clk= gpio3_ick, .addr = omap44xx_gpio3_addrs, .addr_cnt = ARRAY_SIZE(omap44xx_gpio3_addrs), .user = OCP_USER_MPU | OCP_USER_SDMA, @@ -1427,7 +1434,6 @@ static struct omap_hwmod omap44xx_gpio3_hwmod = { .class = omap44xx_gpio_hwmod_class, .mpu_irqs = omap44xx_gpio3_irqs, .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_gpio3_irqs), - .main_clk = gpio3_ick, .prcm = { .omap4 = { .clkctrl_reg = OMAP4430_CM_L4PER_GPIO3_CLKCTRL, @@ -1435,6 +1441,7 @@ static struct omap_hwmod omap44xx_gpio3_hwmod = { }, .opt_clks = gpio3_opt_clks, .opt_clks_cnt = ARRAY_SIZE(gpio3_opt_clks), + .dev_attr = gpio_dev_attr, .slaves = omap44xx_gpio3_slaves
[PATCH:v4 08/13] OMAP: GPIO: add GPIO hwmods structures for OMAP242X
Add hwmod structures for GPIO module on OMAP242X Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 228 1 files changed, 228 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c index 646386c..91c0bd5 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c @@ -15,6 +15,7 @@ #include mach/irqs.h #include plat/cpu.h #include plat/dma.h +#include plat/gpio.h #include omap_hwmod_common_data.h @@ -32,6 +33,10 @@ static struct omap_hwmod omap2420_mpu_hwmod; static struct omap_hwmod omap2420_l3_hwmod; static struct omap_hwmod omap2420_l4_core_hwmod; +static struct omap_hwmod omap2420_gpio1_hwmod; +static struct omap_hwmod omap2420_gpio2_hwmod; +static struct omap_hwmod omap2420_gpio3_hwmod; +static struct omap_hwmod omap2420_gpio4_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2420_l3__l4_core = { @@ -88,6 +93,78 @@ static struct omap_hwmod_ocp_if *omap2420_l4_core_masters[] = { omap2420_l4_core__l4_wkup, }; +/* L4 WKUP - GPIO1 interface */ +static struct omap_hwmod_addr_space omap2420_gpio1_addr_space[] = { + { + .pa_start = OMAP242X_GPIO1_BASE, + .pa_end = OMAP242X_GPIO1_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio1 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_gpio1_hwmod, + .clk= gpios_ick, + .addr = omap2420_gpio1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_gpio1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO2 interface */ +static struct omap_hwmod_addr_space omap2420_gpio2_addr_space[] = { + { + .pa_start = OMAP242X_GPIO2_BASE, + .pa_end = OMAP242X_GPIO2_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio2 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_gpio2_hwmod, + .clk= gpios_ick, + .addr = omap2420_gpio2_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_gpio2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO3 interface */ +static struct omap_hwmod_addr_space omap2420_gpio3_addr_space[] = { + { + .pa_start = OMAP242X_GPIO3_BASE, + .pa_end = OMAP242X_GPIO3_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio3 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_gpio3_hwmod, + .clk= gpios_ick, + .addr = omap2420_gpio3_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_gpio3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO4 interface */ +static struct omap_hwmod_addr_space omap2420_gpio4_addr_space[] = { + { + .pa_start = OMAP242X_GPIO4_BASE, + .pa_end = OMAP242X_GPIO4_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio4 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_gpio4_hwmod, + .clk= gpios_ick, + .addr = omap2420_gpio4_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_gpio4_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* L4 CORE */ static struct omap_hwmod omap2420_l4_core_hwmod = { .name = l4_core, @@ -136,11 +213,162 @@ static struct omap_hwmod omap2420_mpu_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), }; +/* GPIO common */ + +static struct omap_gpio_dev_attr gpio_dev_attr = { + .gpio_bank_width = 32, + .dbck_flag = false, +}; + +static struct omap_hwmod_class_sysconfig omap242x_gpio_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE | + SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap242x_gpio_hwmod_class = { + .name = gpio, + .sysc = omap242x_gpio_sysc, + .rev = 0, +}; + +/* GPIO1 */ + +static struct omap_hwmod_irq_info omap242x_gpio1_irqs[] = { + { .name = gpio_mpu_irq, .irq = INT_24XX_GPIO_BANK1
[PATCH:v4 07/13] OMAP: GPIO: add GPIO hwmods structures for OMAP3
Add hwmod structures for GPIO module on OMAP3 Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Basak, Partha p-bas...@ti.com --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 366 1 files changed, 366 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index fe92b5d..d454ee1 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -17,6 +17,7 @@ #include mach/irqs.h #include plat/cpu.h #include plat/dma.h +#include plat/gpio.h #include omap_hwmod_common_data.h @@ -82,6 +83,12 @@ static struct omap_hwmod omap3xxx_l3_hwmod = { }; static struct omap_hwmod omap3xxx_l4_wkup_hwmod; +static struct omap_hwmod omap3xxx_gpio1_hwmod; +static struct omap_hwmod omap3xxx_gpio2_hwmod; +static struct omap_hwmod omap3xxx_gpio3_hwmod; +static struct omap_hwmod omap3xxx_gpio4_hwmod; +static struct omap_hwmod omap3xxx_gpio5_hwmod; +static struct omap_hwmod omap3xxx_gpio6_hwmod; /* L4_CORE - L4_WKUP interface */ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = { @@ -90,6 +97,114 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; +/* L4 WKUP - GPIO1 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio1_addrs[] = { + { + .pa_start = OMAP34XX_GPIO1_BASE, + .pa_end = OMAP34XX_GPIO1_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__gpio1 = { + .master = omap3xxx_l4_wkup_hwmod, + .slave = omap3xxx_gpio1_hwmod, + .clk= gpio1_ick, + .addr = omap3xxx_gpio1_addrs, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio1_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO2 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio2_addrs[] = { + { + .pa_start = OMAP34XX_GPIO2_BASE, + .pa_end = OMAP34XX_GPIO2_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio2 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio2_hwmod, + .clk= gpio2_ick, + .addr = omap3xxx_gpio2_addrs, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio2_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO3 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio3_addrs[] = { + { + .pa_start = OMAP34XX_GPIO3_BASE, + .pa_end = OMAP34XX_GPIO3_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio3 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio3_hwmod, + .clk= gpio3_ick, + .addr = omap3xxx_gpio3_addrs, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio3_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO4 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio4_addrs[] = { + { + .pa_start = OMAP34XX_GPIO4_BASE, + .pa_end = OMAP34XX_GPIO4_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio4 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio4_hwmod, + .clk= gpio4_ick, + .addr = omap3xxx_gpio4_addrs, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio4_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO5 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio5_addrs[] = { + { + .pa_start = OMAP34XX_GPIO5_BASE, + .pa_end = OMAP34XX_GPIO5_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio5 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio5_hwmod, + .clk= gpio5_ick, + .addr = omap3xxx_gpio5_addrs, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio5_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO6 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio6_addrs[] = { + { + .pa_start = OMAP34XX_GPIO6_BASE, + .pa_end = OMAP34XX_GPIO6_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio6 = { + .master
[PATCH 2/6] OMAP3: WDT: Add watchdog timer HWMOD data for OMAP3
Add hwmod structures for Watchdog module on OMAP3 Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 61 1 files changed, 61 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 39b0c0e..b651461 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -80,6 +80,7 @@ static struct omap_hwmod omap3xxx_l3_hwmod = { }; static struct omap_hwmod omap3xxx_l4_wkup_hwmod; +static struct omap_hwmod omap3xxx_wd_timer2_hwmod; /* L4_CORE - L4_WKUP interface */ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = { @@ -129,6 +130,24 @@ static struct omap_hwmod omap3xxx_l4_per_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) }; +/* WDTIMER2 - L4_WKUP interface */ +static struct omap_hwmod_addr_space omap3xxx_wd_timer2_addrs[] = { + { + .pa_start = 0x48314000, + .pa_end = 0x48314000 + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__wd_timer2 = { + .master = omap3xxx_l4_wkup_hwmod, + .slave = omap3xxx_wd_timer2_hwmod, + .clk= wdt2_ick, + .addr = omap3xxx_wd_timer2_addrs, + .addr_cnt = ARRAY_SIZE(omap3xxx_wd_timer2_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* Slave interfaces on the L4_WKUP interconnect */ static struct omap_hwmod_ocp_if *omap3xxx_l4_wkup_slaves[] = { omap3xxx_l4_core__l4_wkup, @@ -149,6 +168,47 @@ static struct omap_hwmod omap3xxx_l4_wkup_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) }; +/* WDTIMER common */ + +static struct omap_hwmod_class_sysconfig omap3xxx_wd_timer_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_EMUFREE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap3xxx_wd_timer_hwmod_class = { + .name = wd_timer, + .sysc = omap3xxx_wd_timer_sysc, +}; + +/* WDTIMER2 */ +static struct omap_hwmod_ocp_if *omap3xxx_wd_timer2_slaves[] = { + omap3xxx_l4_wkup__wd_timer2, +}; + +static struct omap_hwmod omap3xxx_wd_timer2_hwmod = { + .name = wd_timer2, + .class = omap3xxx_wd_timer_hwmod_class, + .main_clk = wdt2_fck, + .prcm = { + .omap2 = { + .prcm_reg_id = 1, + .module_bit = OMAP3430_EN_WDT2_SHIFT, + .module_offs = WKUP_MOD, + .idlest_reg_id = 1, + .idlest_idle_bit = 5, + }, + }, + .slaves = omap3xxx_wd_timer2_slaves, + .slaves_cnt = ARRAY_SIZE(omap3xxx_wd_timer2_slaves), + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), +}; + /* Master interfaces on the MPU device */ static struct omap_hwmod_ocp_if *omap3xxx_mpu_masters[] = { omap3xxx_mpu__l3, @@ -170,6 +230,7 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { omap3xxx_l4_per_hwmod, omap3xxx_l4_wkup_hwmod, omap3xxx_mpu_hwmod, + omap3xxx_wd_timer2_hwmod, NULL, }; -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/6] OMAP2PLUS: WDT: Implement WDT in HWMOD way
This patch series makes OMAP2PLUS Watchdog Timer Module implemented in HWMOD FW way. It also implements OMAP2/3 Watchdog timer driver to use the runtime PM layer. This patch series is created on origin/pm-wip/hwmod-omap4. This patch series is tested on OMAP3430 SDP, OMAP3630 SDP and OMAP4430 SDP. It would be of great help if someone could test the same on OMAP1 and OMAP2 boards. The same patchset is also tested on origin/pm-wip/runtime. Please note that patch 5/6 OMAP4: WDT: Enable watchdog timer2 hwmod structure is not valid in origin/pm-wip/runtime branch. Charulatha V (6): OMAP2PLUS: WDT: Add ICLKEN, FCLKEN, WKEN shared bits for WDT OMAP3: WDT: Add watchdog timer HWMOD data for OMAP3 OMAP2420: WDT: Add watchdog timer HWMOD data for OMAP2420 OMAP2430: WDT: Add watchdog timer HWMOD data for OMAP2430 OMAP4: WDT: Enable watchdog timer2 hwmod structure OMAP2PLUS: WDT: Conversion to runtime PM arch/arm/mach-omap2/omap_hwmod_2420_data.c | 56 + arch/arm/mach-omap2/omap_hwmod_2430_data.c | 56 + arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 61 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |2 +- arch/arm/mach-omap2/prcm-common.h |4 ++ arch/arm/plat-omap/devices.c | 52 --- drivers/watchdog/omap_wdt.c| 43 +++- 7 files changed, 238insertions(+), 36 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/6] OMAP2420: WDT: Add watchdog timer HWMOD data for OMAP2420
Add hwmod structures for Watchdog module on OMAP2420 Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 56 1 files changed, 56 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c index e5530c5..ceed66e 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c @@ -69,6 +69,7 @@ static struct omap_hwmod omap2420_l3_hwmod = { }; static struct omap_hwmod omap2420_l4_wkup_hwmod; +static struct omap_hwmod omap2420_wd_timer2_hwmod; /* L4_CORE - L4_WKUP interface */ static struct omap_hwmod_ocp_if omap2420_l4_core__l4_wkup = { @@ -118,6 +119,60 @@ static struct omap_hwmod omap2420_l4_wkup_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420) }; +/* WDTIMER2 - L4_WKUP interface */ +static struct omap_hwmod_addr_space omap2420_wd_timer2_addrs[] = { + { + .pa_start = 0x48022000, + .pa_end = 0x48022000 + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__wd_timer2 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_wd_timer2_hwmod, + .clk= mpu_wdt_ick, + .addr = omap2420_wd_timer2_addrs, + .addr_cnt = ARRAY_SIZE(omap2420_wd_timer2_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* WDTIMER common */ + +static struct omap_hwmod_class_sysconfig omap2420_wd_timer_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap2420_wd_timer_hwmod_class = { + .name = wd_timer, + .sysc = omap2420_wd_timer_sysc, +}; + +/* WDTIMER2 */ +static struct omap_hwmod_ocp_if *omap2420_wd_timer2_slaves[] = { + omap2420_l4_wkup__wd_timer2, +}; + +static struct omap_hwmod omap2420_wd_timer2_hwmod = { + .name = wd_timer2, + .class = omap2420_wd_timer_hwmod_class, + .main_clk = mpu_wdt_fck, + .prcm = { + .omap2 = { + .prcm_reg_id = 1, + .module_bit = OMAP24XX_EN_WDT2_SHIFT, + }, + }, + .slaves = omap2420_wd_timer2_slaves, + .slaves_cnt = ARRAY_SIZE(omap2420_wd_timer2_slaves), + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), +}; + /* Master interfaces on the MPU device */ static struct omap_hwmod_ocp_if *omap2420_mpu_masters[] = { omap2420_mpu__l3, @@ -138,6 +193,7 @@ static __initdata struct omap_hwmod *omap2420_hwmods[] = { omap2420_l4_core_hwmod, omap2420_l4_wkup_hwmod, omap2420_mpu_hwmod, + omap2420_wd_timer2_hwmod, NULL, }; -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/6] OMAP2PLUS: WDT: Add ICLKEN, FCLKEN, WKEN shared bits for WDT
This patch adds the CM_FCLKEN_WKUP, CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits for OMAP2PLUS watchdog timer module Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap2/prcm-common.h |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h index 64d1027..3666b63 100644 --- a/arch/arm/mach-omap2/prcm-common.h +++ b/arch/arm/mach-omap2/prcm-common.h @@ -237,6 +237,8 @@ #define OMAP24XX_ST_USB_MASK (1 0) /* CM_FCLKEN_WKUP, CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits */ +#define OMAP24XX_EN_WDT2_SHIFT 3 +#define OMAP24XX_EN_WDT2 (1 3) #define OMAP24XX_EN_GPIOS_SHIFT2 #define OMAP24XX_EN_GPIOS (1 2) #define OMAP24XX_EN_GPT1_SHIFT 0 @@ -344,6 +346,8 @@ #define OMAP3430_ST_D2D_MASK (1 3) /* CM_FCLKEN_WKUP, CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits */ +#define OMAP3430_EN_WDT2 (1 5) +#define OMAP3430_EN_WDT2_SHIFT 5 #define OMAP3430_EN_GPIO1 (1 3) #define OMAP3430_EN_GPIO1_SHIFT3 #define OMAP3430_EN_GPT12 (1 1) -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/6] OMAP4: WDT: Enable watchdog timer2 hwmod structure
This patch enables the watchdog timer2 hwmod structure Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 20f5f8c..87ff332 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -4888,7 +4888,7 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = { /* usb_tll_hs class */ /* omap44xx_usb_tll_hs_hwmod, */ /* wd_timer class */ -/* omap44xx_wd_timer2_hwmod, */ + omap44xx_wd_timer2_hwmod, /* omap44xx_wd_timer3_hwmod, */ NULL, }; -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/11] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init
This patch adds support for handling GPIO as a HWMOD FW adapted platform device for OMAP2PLUS chips. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap2/gpio.c | 113 1 files changed, 113 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/gpio.c diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c new file mode 100644 index 000..bc339ef --- /dev/null +++ b/arch/arm/mach-omap2/gpio.c @@ -0,0 +1,113 @@ +/* + * gpio.c - OMAP2PLUS-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/gpio.h +#include linux/err.h +#include linux/slab.h + +#include plat/omap_hwmod.h +#include plat/omap_device.h + +static struct omap_device_pm_latency omap_gpio_latency[] = { + [0] = { + .deactivate_func = omap_device_idle_hwmods, + .activate_func = omap_device_enable_hwmods, + .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, + }, +}; + +static int omap2_init_gpio(struct omap_hwmod *oh, void *user) +{ + struct omap_device *od; + struct omap_gpio_platform_data *pdata; + char *name = omap-gpio; + static int id; + struct omap_gpio_dev_attr *gpio_dev_data; + + if (!oh) + pr_err(Could not look up omap gpio %d\n, id + 1); + + pdata = kzalloc(sizeof(struct omap_gpio_platform_data), + GFP_KERNEL); + if (!pdata) { + pr_err(Memory allocation failed gpio%d\n, id + 1); + return -ENOMEM; + } + + gpio_dev_data = (struct omap_gpio_dev_attr *)oh-dev_attr; + pdata-gpio_attr = gpio_dev_data; + pdata-method = (int)user; + pdata-virtual_irq_start = IH_GPIO_BASE + 32 * id; + + od = omap_device_build(name, id, oh, pdata, + sizeof(*pdata), omap_gpio_latency, + ARRAY_SIZE(omap_gpio_latency), + false); + WARN(IS_ERR(od), Cant build omap_device for %s:%s.\n, + name, oh-name); + + id++; + return 0; +} + +static int __init gpio_init(int method) +{ + return omap_hwmod_for_each_by_class(gpio, omap2_init_gpio, + (void *)method); +} + +/* + * gpio_init needs to be done before + * machine_init functions access gpio APIs. + * Hence gpio_init is a postcore_initcall. + */ +#ifdef CONFIG_ARCH_OMAP2 +static int __init omap242x_gpio_init(void) +{ if (!cpu_is_omap2420()) + return -EINVAL; + + return gpio_init(METHOD_GPIO_24XX); +} +postcore_initcall(omap242x_gpio_init); + +static int __init omap243x_gpio_init(void) +{ + if (!cpu_is_omap2430()) + return -EINVAL; + + return gpio_init(METHOD_GPIO_24XX); +} +postcore_initcall(omap243x_gpio_init); +#endif + +#ifdef CONFIG_ARCH_OMAP3 +static int __init omap3xxx_gpio_init(void) +{ + if (!cpu_is_omap34xx()) + return -EINVAL; + + return gpio_init(METHOD_GPIO_24XX); +} +postcore_initcall(omap3xxx_gpio_init); +#endif + +#ifdef CONFIG_ARCH_OMAP4 +static int __init omap44xx_gpio_init(void) +{ + if (!cpu_is_omap44xx()) + return -EINVAL; + + return gpio_init(METHOD_GPIO_44XX); +} +postcore_initcall(omap44xx_gpio_init); +#endif -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/11] OMAP: GPIO: add GPIO hwmods structures for OMAP3
Add hwmod structures for GPIO module on OMAP3 Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Rajendra Nayak rna...@ti.com --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 357 +++- 1 files changed, 356 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 5f74c34..499be79 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -20,6 +20,7 @@ #include plat/serial.h #include plat/l4_3xxx.h #include plat/mmc.h +#include plat/gpio.h #include omap_hwmod_common_data.h @@ -89,6 +90,12 @@ static struct omap_hwmod omap3xxx_uart3_hwmod; static struct omap_hwmod omap3xxx_mmc1_hwmod; static struct omap_hwmod omap3xxx_mmc2_hwmod; static struct omap_hwmod omap3xxx_mmc3_hwmod; +static struct omap_hwmod omap3xxx_gpio1_hwmod; +static struct omap_hwmod omap3xxx_gpio2_hwmod; +static struct omap_hwmod omap3xxx_gpio3_hwmod; +static struct omap_hwmod omap3xxx_gpio4_hwmod; +static struct omap_hwmod omap3xxx_gpio5_hwmod; +static struct omap_hwmod omap3xxx_gpio6_hwmod; /* L4_CORE - L4_WKUP interface */ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = { @@ -226,6 +233,114 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = { .flags = OMAP_FIREWALL_L4 }; +/* L4 WKUP - GPIO1 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio1_addr_space[] = { + { + .pa_start = OMAP34XX_GPIO1_BASE, + .pa_end = OMAP34XX_GPIO1_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__gpio1 = { + .master = omap3xxx_l4_wkup_hwmod, + .slave = omap3xxx_gpio1_hwmod, + .clk= gpio1_ick, + .addr = omap3xxx_gpio1_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO2 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio2_addr_space[] = { + { + .pa_start = OMAP34XX_GPIO2_BASE, + .pa_end = OMAP34XX_GPIO2_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio2 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio2_hwmod, + .clk= gpio2_ick, + .addr = omap3xxx_gpio2_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO3 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio3_addr_space[] = { + { + .pa_start = OMAP34XX_GPIO3_BASE, + .pa_end = OMAP34XX_GPIO3_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio3 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio3_hwmod, + .clk= gpio3_ick, + .addr = omap3xxx_gpio3_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO4 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio4_addr_space[] = { + { + .pa_start = OMAP34XX_GPIO4_BASE, + .pa_end = OMAP34XX_GPIO4_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio4 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio4_hwmod, + .clk= gpio4_ick, + .addr = omap3xxx_gpio4_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio4_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO5 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio5_addr_space[] = { + { + .pa_start = OMAP34XX_GPIO5_BASE, + .pa_end = OMAP34XX_GPIO5_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio5 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio5_hwmod, + .clk= gpio5_ick, + .addr = omap3xxx_gpio5_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio5_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO6 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio6_addr_space[] = { + { + .pa_start = OMAP34XX_GPIO6_BASE, + .pa_end = OMAP34XX_GPIO6_BASE + SZ_4K - 1, + .flags
[PATCH 07/11] OMAP: GPIO: add GPIO hwmods structures for OMAP242X
Add hwmod structures for GPIO module on OMAP242X Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 222 1 files changed, 222 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c index eb7ee24..4d05a9a 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c @@ -15,6 +15,7 @@ #include mach/irqs.h #include plat/cpu.h #include plat/dma.h +#include plat/gpio.h #include omap_hwmod_common_data.h @@ -32,6 +33,10 @@ static struct omap_hwmod omap2420_mpu_hwmod; static struct omap_hwmod omap2420_l3_hwmod; static struct omap_hwmod omap2420_l4_core_hwmod; +static struct omap_hwmod omap2420_gpio1_hwmod; +static struct omap_hwmod omap2420_gpio2_hwmod; +static struct omap_hwmod omap2420_gpio3_hwmod; +static struct omap_hwmod omap2420_gpio4_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2420_l3__l4_core = { @@ -87,6 +92,78 @@ static struct omap_hwmod_ocp_if *omap2420_l4_core_masters[] = { omap2420_l4_core__l4_wkup, }; +/* L4 WKUP - GPIO1 interface */ +static struct omap_hwmod_addr_space omap2420_gpio1_addr_space[] = { + { + .pa_start = OMAP242X_GPIO1_BASE, + .pa_end = OMAP242X_GPIO1_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio1 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_gpio1_hwmod, + .clk= gpios_ick, + .addr = omap2420_gpio1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_gpio1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO2 interface */ +static struct omap_hwmod_addr_space omap2420_gpio2_addr_space[] = { + { + .pa_start = OMAP242X_GPIO2_BASE, + .pa_end = OMAP242X_GPIO2_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio2 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_gpio2_hwmod, + .clk= gpios_ick, + .addr = omap2420_gpio2_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_gpio2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO3 interface */ +static struct omap_hwmod_addr_space omap2420_gpio3_addr_space[] = { + { + .pa_start = OMAP242X_GPIO3_BASE, + .pa_end = OMAP242X_GPIO3_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio3 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_gpio3_hwmod, + .clk= gpios_ick, + .addr = omap2420_gpio3_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_gpio3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO4 interface */ +static struct omap_hwmod_addr_space omap2420_gpio4_addr_space[] = { + { + .pa_start = OMAP242X_GPIO4_BASE, + .pa_end = OMAP242X_GPIO4_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio4 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_gpio4_hwmod, + .clk= gpios_ick, + .addr = omap2420_gpio4_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_gpio4_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* L4 CORE */ static struct omap_hwmod omap2420_l4_core_hwmod = { .name = l4_core_hwmod, @@ -101,6 +178,10 @@ static struct omap_hwmod omap2420_l4_core_hwmod = { /* Slave interfaces on the L4_WKUP interconnect */ static struct omap_hwmod_ocp_if *omap2420_l4_wkup_slaves[] = { omap2420_l4_core__l4_wkup, + omap2420_l4_wkup__gpio1, + omap2420_l4_wkup__gpio2, + omap2420_l4_wkup__gpio3, + omap2420_l4_wkup__gpio4, }; /* Master interfaces on the L4_WKUP interconnect */ @@ -133,11 +214,152 @@ static struct omap_hwmod omap2420_mpu_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), }; +/* GPIO common */ + +static struct omap_gpio_dev_attr gpio_dev_attr = { + .gpio_bank_count = 4, + .gpio_bank_bits = 32, + .dbck_flag = false, + .fck_flag = true, +}; + +static struct omap_hwmod_class_sysconfig gpio_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET
[PATCH 02/11] OMAP: GPIO: Include platform_data structure for GPIO
This patch introduces platform_data structure for GPIO so that GPIO module can be implemented in platform device model. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/plat-omap/include/plat/gpio.h | 15 +++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h index a06acb6..d2d310b 100644 --- a/arch/arm/plat-omap/include/plat/gpio.h +++ b/arch/arm/plat-omap/include/plat/gpio.h @@ -28,6 +28,7 @@ #include linux/io.h #include mach/irqs.h +#include linux/platform_device.h #define OMAP1_MPUIO_BASE 0xfffb5000 #define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE @@ -137,6 +138,20 @@ IH_MPUIO_BASE + ((nr) 0x0f) : \ IH_GPIO_BASE + (nr)) +struct omap_gpio_dev_attr { + int gpio_bank_count; + int gpio_bank_bits; + bool dbck_flag; + bool fck_flag; + bool arm_gpio_ck_flag; +}; + +struct omap_gpio_platform_data { + u16 virtual_irq_start; + int method; + struct omap_gpio_dev_attr *gpio_attr; +}; + extern int omap_gpio_init(void); /* Call from board init only */ extern void omap2_gpio_prepare_for_retention(void); extern void omap2_gpio_resume_after_retention(void); -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 00/11] OMAP: GPIO: Implement GPIO in HWMOD way
This patch series implements GPIO module in platform device model. It also makes OMAP2PLUS specific GPIO implemented in HWMOD FW way. This patch series is created on origin/pm-wip/runtime. This patch series is tested on OMAP3430 SDP board. It would be of great help if someone could test the same on OMAP1 and OMAP2 boards. Charulatha V (11): OMAP: GPIO: Modify init() in preparation for platform device implementation OMAP: GPIO: Include platform_data structure for GPIO OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init OMAP: GPIO: Introduce support for OMAP16xx chip GPIO init OMAP: GPIO: Introduce support for OMAP7xx chip GPIO init OMAP: GPIO: add GPIO hwmods structures for OMAP3 OMAP: GPIO: add GPIO hwmods structures for OMAP242X OMAP: GPIO: add GPIO hwmods structures for OMAP243X OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init OMAP: GPIO: Implement GPIO as a platform device OMAP: GPIO: Remove omap_gpio_init() arch/arm/mach-omap1/Makefile |6 + arch/arm/mach-omap1/board-ams-delta.c |1 - arch/arm/mach-omap1/board-fsample.c|1 - arch/arm/mach-omap1/board-h2.c |1 - arch/arm/mach-omap1/board-h3.c |1 - arch/arm/mach-omap1/board-htcherald.c |1 - arch/arm/mach-omap1/board-innovator.c |1 - arch/arm/mach-omap1/board-nokia770.c |1 - arch/arm/mach-omap1/board-osk.c|1 - arch/arm/mach-omap1/board-palmte.c |1 - arch/arm/mach-omap1/board-palmz71.c|1 - arch/arm/mach-omap1/board-perseus2.c |1 - arch/arm/mach-omap1/board-sx1.c|1 - arch/arm/mach-omap1/board-voiceblue.c |1 - arch/arm/mach-omap1/clock_data.c |2 +- arch/arm/mach-omap1/gpio15xx.c | 104 + arch/arm/mach-omap1/gpio16xx.c | 202 + arch/arm/mach-omap1/gpio7xx.c | 266 arch/arm/mach-omap2/Makefile |2 +- arch/arm/mach-omap2/board-2430sdp.c|1 - arch/arm/mach-omap2/board-3430sdp.c|1 - arch/arm/mach-omap2/board-3630sdp.c|1 - arch/arm/mach-omap2/board-4430sdp.c|1 - arch/arm/mach-omap2/board-am3517evm.c |1 - arch/arm/mach-omap2/board-apollon.c|1 - arch/arm/mach-omap2/board-cm-t35.c |1 - arch/arm/mach-omap2/board-devkit8000.c |1 - arch/arm/mach-omap2/board-h4.c |1 - arch/arm/mach-omap2/board-igep0020.c |1 - arch/arm/mach-omap2/board-ldp.c|1 - arch/arm/mach-omap2/board-n8x0.c |1 - arch/arm/mach-omap2/board-omap3beagle.c|1 - arch/arm/mach-omap2/board-omap3evm.c |1 - arch/arm/mach-omap2/board-omap3pandora.c |1 - arch/arm/mach-omap2/board-omap3touchbook.c |1 - arch/arm/mach-omap2/board-overo.c |1 - arch/arm/mach-omap2/board-rx51.c |1 - arch/arm/mach-omap2/board-zoom2.c |1 - arch/arm/mach-omap2/board-zoom3.c |1 - arch/arm/mach-omap2/clock2420_data.c | 10 +- arch/arm/mach-omap2/clock2430_data.c | 14 +- arch/arm/mach-omap2/clock3xxx_data.c | 24 +- arch/arm/mach-omap2/clock44xx_data.c | 24 +- arch/arm/mach-omap2/gpio.c | 113 + arch/arm/mach-omap2/omap_hwmod_2420_data.c | 222 ++ arch/arm/mach-omap2/omap_hwmod_2430_data.c | 270 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 357 - arch/arm/plat-omap/gpio.c | 622 ++-- arch/arm/plat-omap/include/plat/gpio.h | 84 - 49 files changed, 1886 insertions(+), 469 deletions(-) create mode 100644 arch/arm/mach-omap1/gpio15xx.c create mode 100644 arch/arm/mach-omap1/gpio16xx.c create mode 100644 arch/arm/mach-omap1/gpio7xx.c create mode 100644 arch/arm/mach-omap2/gpio.c -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/11] OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init
This patch adds support for handling OMAP15xx specific gpio_init by providing platform device data and doing device registration. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap1/gpio15xx.c | 99 1 files changed, 104 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap1/gpio15xx.c diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c new file mode 100644 index 000..c9082bd --- /dev/null +++ b/arch/arm/mach-omap1/gpio15xx.c @@ -0,0 +1,99 @@ +/* + * gpio15xx.c - OMAP15XX-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/gpio.h + +static struct omap_gpio_dev_attr omap15xx_gpio_attr = { + .gpio_bank_count= 2, + .gpio_bank_bits = 16, + .arm_gpio_ck_flag = true, +}; + +/* + * OMAP15XX GPIO1 interface data + */ +static struct __initdata resource omap15xx_mpu_gpio_resources[] = { + { + .start = OMAP1_MPUIO_VBASE, + .end= OMAP1_MPUIO_VBASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_MPUIO, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = { + .virtual_irq_start = IH_MPUIO_BASE, + .method = METHOD_MPUIO, + .gpio_attr = omap15xx_gpio_attr, +}; + +static struct __initdata platform_device omap15xx_mpu_gpio = { + .name = omap-gpio, + .id = 0, + .dev= { + .platform_data = omap15xx_mpu_gpio_config, + }, + .num_resources = ARRAY_SIZE(omap15xx_mpu_gpio_resources), + .resource = omap15xx_mpu_gpio_resources, +}; + +/* + * OMAP15XX GPIO2 interface data + */ +static struct __initdata resource omap15xx_gpio_resources[] = { + { + .start = OMAP1510_GPIO_BASE, + .end= OMAP1510_GPIO_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_GPIO_BANK1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = { + .virtual_irq_start = IH_GPIO_BASE, + .method = METHOD_GPIO_1510, + .gpio_attr = omap15xx_gpio_attr, +}; + +static struct __initdata platform_device omap15xx_gpio = { + .name = omap-gpio, + .id = 1, + .dev= { + .platform_data = omap15xx_gpio_config, + }, + .num_resources = ARRAY_SIZE(omap15xx_gpio_resources), + .resource = omap15xx_gpio_resources, +}; + +/* + * omap15xx_gpio_init needs to be done before + * machine_init functions access gpio APIs. + * Hence omap15xx_gpio_init is a postcore_initcall. + */ +static int __init omap15xx_gpio_init(void) +{ + if (!cpu_is_omap15xx()) + return -EINVAL; + + platform_device_register(omap15xx_mpu_gpio); + platform_device_register(omap15xx_gpio); + + return 0; +} +postcore_initcall(omap15xx_gpio_init); -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/11] OMAP: GPIO: Implement GPIO as a platform device
This patch implements GPIO as a platform device. Also it implements OMAP2PLUS specific GPIO as HWMOD FW adapted device. GPIO APIs are used in machine_init functions. Hence it is required to complete GPIO probe before machine_init. Therefore GPIO device register and driver register are implemented as postcore_initcalls. Inorder to convert GPIO as platform device, modifications are required in clock_data.c files so that device names can be used to obtain clock instead of getting clocks by name/NULL ptr. GPIO driver uses runtime APIs.Clock FW APIs are used to enable iclk and fclk when CONFIG_PM_RUNTIME is not defined. omap_gpio_init() does nothing now and this function would be removed in the next patch as it's usage is spread across most of the board files. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Rajendra Nayak rna...@ti.com --- arch/arm/mach-omap1/Makefile |6 + arch/arm/mach-omap1/clock_data.c |2 +- arch/arm/mach-omap2/Makefile |2 +- arch/arm/mach-omap2/clock2420_data.c | 10 +- arch/arm/mach-omap2/clock2430_data.c | 14 +- arch/arm/mach-omap2/clock3xxx_data.c | 24 +- arch/arm/mach-omap2/clock44xx_data.c | 24 +- arch/arm/plat-omap/gpio.c| 389 +++--- 8 files changed, 178 insertions(+), 293 deletions(-) diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile index b6a537c..dabd2be 100644 --- a/arch/arm/mach-omap1/Makefile +++ b/arch/arm/mach-omap1/Makefile @@ -45,6 +45,12 @@ ifeq ($(CONFIG_ARCH_OMAP15XX),y) obj-$(CONFIG_MACH_OMAP_INNOVATOR) += fpga.o endif +# GPIO +obj-$(CONFIG_ARCH_OMAP730) += gpio7xx.o +obj-$(CONFIG_ARCH_OMAP850) += gpio7xx.o +obj-$(CONFIG_ARCH_OMAP15XX)+= gpio15xx.o +obj-$(CONFIG_ARCH_OMAP16XX)+= gpio16xx.o + # LEDs support led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o led-$(CONFIG_MACH_OMAP_H3) += leds-h2p2-debug.o diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c index aa8558a..9bc2aa1 100644 --- a/arch/arm/mach-omap1/clock_data.c +++ b/arch/arm/mach-omap1/clock_data.c @@ -589,7 +589,7 @@ static struct omap_clk omap_clks[] = { CLK(NULL, ck_sossi, sossi_ck, CK_16XX), CLK(NULL, arm_ck, arm_ck,CK_16XX | CK_1510 | CK_310), CLK(NULL, armper_ck,armper_ck.clk, CK_16XX | CK_1510 | CK_310), - CLK(NULL, arm_gpio_ck, arm_gpio_ck, CK_1510 | CK_310), + CLK(omap-gpio.0, arm_gpio_ck, arm_gpio_ck, CK_1510 | CK_310), CLK(NULL, armxor_ck,armxor_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX), CLK(NULL, armtim_ck,armtim_ck.clk, CK_16XX | CK_1510 | CK_310), CLK(omap_wdt, fck, armwdt_ck.clk, CK_16XX | CK_1510 | CK_310), diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 58a0474..d2d63ca 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -3,7 +3,7 @@ # # Common support -obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o +obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o gpio.o omap-2-3-common= irq.o sdrc.o hwmod-common = omap_hwmod.o \ diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c index d932b14..a693403 100644 --- a/arch/arm/mach-omap2/clock2420_data.c +++ b/arch/arm/mach-omap2/clock2420_data.c @@ -1802,8 +1802,14 @@ static struct omap_clk omap2420_clks[] = { CLK(NULL, uart2_fck,uart2_fck, CK_242X), CLK(NULL, uart3_ick,uart3_ick, CK_242X), CLK(NULL, uart3_fck,uart3_fck, CK_242X), - CLK(NULL, gpios_ick,gpios_ick, CK_242X), - CLK(NULL, gpios_fck,gpios_fck, CK_242X), + CLK(omap-gpio.0, ick, gpios_ick, CK_242X), + CLK(omap-gpio.1, ick, gpios_ick, CK_242X), + CLK(omap-gpio.2, ick, gpios_ick, CK_242X), + CLK(omap-gpio.3, ick, gpios_ick, CK_242X), + CLK(omap-gpio.0, fck, gpios_fck, CK_242X), + CLK(omap-gpio.1, fck, gpios_fck, CK_242X), + CLK(omap-gpio.2, fck, gpios_fck, CK_242X), + CLK(omap-gpio.3, fck, gpios_fck, CK_242X), CLK(omap_wdt, ick, mpu_wdt_ick, CK_242X), CLK(omap_wdt, fck, mpu_wdt_fck, CK_242X), CLK(NULL, sync_32k_ick, sync_32k_ick, CK_242X), diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c index 0438b6e..56bbcbc 100644 --- a/arch/arm/mach-omap2/clock2430_data.c +++ b/arch/arm/mach-omap2/clock2430_data.c @@ -1896,8 +1896,14 @@ static struct omap_clk omap2430_clks[] = { CLK(NULL, uart2_fck,uart2_fck, CK_243X), CLK(NULL, uart3_ick,uart3_ick, CK_243X
[PATCH 05/11] OMAP: GPIO: Introduce support for OMAP7xx chip GPIO init
This patch adds support for handling OMAP7xx specific gpio_init by providing platform device data and doing device registration. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap1/gpio7xx.c | 266 + 1 files changed, 266 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap1/gpio7xx.c diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c new file mode 100644 index 000..56a482c --- /dev/null +++ b/arch/arm/mach-omap1/gpio7xx.c @@ -0,0 +1,266 @@ +/* + * gpio7xx.c - OMAP7XX-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/gpio.h + +static struct omap_gpio_dev_attr omap7xx_gpio_attr = { + .gpio_bank_count= 7, + .gpio_bank_bits = 32, + .arm_gpio_ck_flag = false, +}; + +/* + * OMAP7XX MPU GPIO interface data + */ +static struct __initdata resource omap7xx_mpu_gpio_resources[] = { + { + .start = OMAP1_MPUIO_VBASE, + .end= OMAP1_MPUIO_VBASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_MPUIO, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = { + .virtual_irq_start = IH_MPUIO_BASE, + .method = METHOD_MPUIO, + .gpio_attr = omap7xx_gpio_attr, +}; + +static struct __initdata platform_device omap7xx_mpu_gpio = { + .name = omap-gpio, + .id = 0, + .dev= { + .platform_data = omap7xx_mpu_gpio_config, + }, + .num_resources = ARRAY_SIZE(omap7xx_mpu_gpio_resources), + .resource = omap7xx_mpu_gpio_resources, +}; + +/* + * OMAP7XX GPIO1 interface data + */ +static struct __initdata resource omap7xx_gpio1_resources[] = { + { + .start = OMAP7XX_GPIO1_BASE, + .end= OMAP7XX_GPIO1_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_GPIO_BANK1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = { + .virtual_irq_start = IH_GPIO_BASE, + .method = METHOD_GPIO_7XX, + .gpio_attr = omap7xx_gpio_attr, +}; + +static struct __initdata platform_device omap7xx_gpio1 = { + .name = omap-gpio, + .id = 1, + .dev= { + .platform_data = omap7xx_gpio1_config, + }, + .num_resources = ARRAY_SIZE(omap7xx_gpio1_resources), + .resource = omap7xx_gpio1_resources, +}; + +/* + * OMAP7XX GPIO2 interface data + */ +static struct __initdata resource omap7xx_gpio2_resources[] = { + { + .start = OMAP7XX_GPIO2_BASE, + .end= OMAP7XX_GPIO2_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_GPIO_BANK2, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config = { + .virtual_irq_start = IH_GPIO_BASE + 32, + .method = METHOD_GPIO_7XX, + .gpio_attr = omap7xx_gpio_attr, +}; + +static struct __initdata platform_device omap7xx_gpio2 = { + .name = omap-gpio, + .id = 2, + .dev= { + .platform_data = omap7xx_gpio2_config, + }, + .num_resources = ARRAY_SIZE(omap7xx_gpio2_resources), + .resource = omap7xx_gpio2_resources, +}; + +/* + * OMAP7XX GPIO3 interface data + */ +static struct __initdata resource omap7xx_gpio3_resources[] = { + { + .start = OMAP7XX_GPIO3_BASE, + .end= OMAP7XX_GPIO3_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_GPIO_BANK3, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config = { + .virtual_irq_start = IH_GPIO_BASE + 64, + .method = METHOD_GPIO_7XX, + .gpio_attr = omap7xx_gpio_attr, +}; + +static struct __initdata platform_device omap7xx_gpio3 = { + .name = omap-gpio, + .id = 3, + .dev= { + .platform_data = omap7xx_gpio3_config, + }, + .num_resources = ARRAY_SIZE(omap7xx_gpio3_resources), + .resource = omap7xx_gpio3_resources, +}; + +/* + * OMAP7XX GPIO4 interface data + */ +static struct
[PATCH 08/11] OMAP: GPIO: add GPIO hwmods structures for OMAP243X
Add hwmod structures for GPIO module on OMAP243X Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 270 1 files changed, 270 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index d9c92aa..57a7d80 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -16,6 +16,7 @@ #include plat/cpu.h #include plat/dma.h #include plat/mmc.h +#include plat/gpio.h #include omap_hwmod_common_data.h @@ -73,6 +74,11 @@ static struct omap_hwmod omap2430_l3_hwmod = { static struct omap_hwmod omap2430_l4_wkup_hwmod; static struct omap_hwmod omap2430_mmc1_hwmod; static struct omap_hwmod omap2430_mmc2_hwmod; +static struct omap_hwmod omap2430_gpio1_hwmod; +static struct omap_hwmod omap2430_gpio2_hwmod; +static struct omap_hwmod omap2430_gpio3_hwmod; +static struct omap_hwmod omap2430_gpio4_hwmod; +static struct omap_hwmod omap2430_gpio5_hwmod; /* L4_CORE - L4_WKUP interface */ static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = { @@ -117,10 +123,100 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; +/* L4 WKUP - GPIO1 interface */ +static struct omap_hwmod_addr_space omap2430_gpio1_addr_space[] = { + { + .pa_start = OMAP243X_GPIO1_BASE, + .pa_end = OMAP243X_GPIO1_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio1 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_gpio1_hwmod, + .clk= gpios_ick, + .addr = omap2430_gpio1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO2 interface */ +static struct omap_hwmod_addr_space omap2430_gpio2_addr_space[] = { + { + .pa_start = OMAP243X_GPIO2_BASE, + .pa_end = OMAP243X_GPIO2_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio2 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_gpio2_hwmod, + .clk= gpios_ick, + .addr = omap2430_gpio2_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO3 interface */ +static struct omap_hwmod_addr_space omap2430_gpio3_addr_space[] = { + { + .pa_start = OMAP243X_GPIO3_BASE, + .pa_end = OMAP243X_GPIO3_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio3 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_gpio3_hwmod, + .clk= gpios_ick, + .addr = omap2430_gpio3_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO4 interface */ +static struct omap_hwmod_addr_space omap2430_gpio4_addr_space[] = { + { + .pa_start = OMAP243X_GPIO4_BASE, + .pa_end = OMAP243X_GPIO4_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio4 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_gpio4_hwmod, + .clk= gpios_ick, + .addr = omap2430_gpio4_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio4_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 CORE - GPIO5 interface */ +static struct omap_hwmod_addr_space omap2430_gpio5_addr_space[] = { + { + .pa_start = OMAP243X_GPIO5_BASE, + .pa_end = OMAP243X_GPIO5_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__gpio5 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_gpio5_hwmod, + .clk= gpio5_ick, + .addr = omap2430_gpio5_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio5_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; /* Slave interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = { omap2430_l3__l4_core, + omap2430_l4_core__gpio5, }; /* Master interfaces on the L4_CORE interconnect */ @@ -144,6 +240,10 @@ static struct omap_hwmod omap2430_l4_core_hwmod = { /* Slave interfaces
[PATCH 11/11] OMAP: GPIO: Remove omap_gpio_init()
This patch removes the usage of omap_gpio_init() in from all omap board files since omap_gpio_init() does nothing, after gpio is implemented as a platform device. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap1/board-ams-delta.c |1 - arch/arm/mach-omap1/board-fsample.c|1 - arch/arm/mach-omap1/board-h2.c |1 - arch/arm/mach-omap1/board-h3.c |1 - arch/arm/mach-omap1/board-htcherald.c |1 - arch/arm/mach-omap1/board-innovator.c |1 - arch/arm/mach-omap1/board-nokia770.c |1 - arch/arm/mach-omap1/board-osk.c|1 - arch/arm/mach-omap1/board-palmte.c |1 - arch/arm/mach-omap1/board-palmz71.c|1 - arch/arm/mach-omap1/board-perseus2.c |1 - arch/arm/mach-omap1/board-sx1.c|1 - arch/arm/mach-omap1/board-voiceblue.c |1 - arch/arm/mach-omap2/board-2430sdp.c|1 - arch/arm/mach-omap2/board-3430sdp.c|1 - arch/arm/mach-omap2/board-3630sdp.c|1 - arch/arm/mach-omap2/board-4430sdp.c|1 - arch/arm/mach-omap2/board-am3517evm.c |1 - arch/arm/mach-omap2/board-apollon.c|1 - arch/arm/mach-omap2/board-cm-t35.c |1 - arch/arm/mach-omap2/board-devkit8000.c |1 - arch/arm/mach-omap2/board-h4.c |1 - arch/arm/mach-omap2/board-igep0020.c |1 - arch/arm/mach-omap2/board-ldp.c|1 - arch/arm/mach-omap2/board-n8x0.c |1 - arch/arm/mach-omap2/board-omap3beagle.c|1 - arch/arm/mach-omap2/board-omap3evm.c |1 - arch/arm/mach-omap2/board-omap3pandora.c |1 - arch/arm/mach-omap2/board-omap3touchbook.c |1 - arch/arm/mach-omap2/board-overo.c |1 - arch/arm/mach-omap2/board-rx51.c |1 - arch/arm/mach-omap2/board-zoom2.c |1 - arch/arm/mach-omap2/board-zoom3.c |1 - arch/arm/plat-omap/gpio.c |6 -- arch/arm/plat-omap/include/plat/gpio.h |1 - 35 files changed, 0 insertions(+), 40 deletions(-) diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 7fc11c3..7c0c812 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -134,7 +134,6 @@ static void __init ams_delta_init_irq(void) { omap1_init_common_hw(); omap_init_irq(); - omap_gpio_init(); } static struct map_desc ams_delta_io_desc[] __initdata = { diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c index 096f2ed..8d9d6e8 100644 --- a/arch/arm/mach-omap1/board-fsample.c +++ b/arch/arm/mach-omap1/board-fsample.c @@ -313,7 +313,6 @@ static void __init omap_fsample_init_irq(void) { omap1_init_common_hw(); omap_init_irq(); - omap_gpio_init(); fsample_init_smc91x(); } diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c index d1100e4..dd04ef5 100644 --- a/arch/arm/mach-omap1/board-h2.c +++ b/arch/arm/mach-omap1/board-h2.c @@ -383,7 +383,6 @@ static void __init h2_init_irq(void) { omap1_init_common_hw(); omap_init_irq(); - omap_gpio_init(); h2_init_smc91x(); } diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c index a53ab82..ac8af4b 100644 --- a/arch/arm/mach-omap1/board-h3.c +++ b/arch/arm/mach-omap1/board-h3.c @@ -422,7 +422,6 @@ static void __init h3_init_irq(void) { omap1_init_common_hw(); omap_init_irq(); - omap_gpio_init(); h3_init_smc91x(); } diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c index e36639f..82a9a59 100644 --- a/arch/arm/mach-omap1/board-htcherald.c +++ b/arch/arm/mach-omap1/board-htcherald.c @@ -279,7 +279,6 @@ static void __init htcherald_init(void) { printk(KERN_INFO HTC Herald init.\n); - omap_gpio_init(); omap_board_config = htcherald_config; omap_board_config_size = ARRAY_SIZE(htcherald_config); diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c index 5d12fd3..28bb2cd 100644 --- a/arch/arm/mach-omap1/board-innovator.c +++ b/arch/arm/mach-omap1/board-innovator.c @@ -290,7 +290,6 @@ static void __init innovator_init_irq(void) { omap1_init_common_hw(); omap_init_irq(); - omap_gpio_init(); #ifdef CONFIG_ARCH_OMAP15XX if (cpu_is_omap1510()) { omap1510_fpga_init_irq(); diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c index 71e1a3f..6ea838c 100644 --- a/arch/arm/mach-omap1/board-nokia770.c +++ b/arch/arm/mach-omap1/board-nokia770.c @@ -379,7 +379,6 @@ static void __init omap_nokia770_init(void) platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices)); spi_register_board_info(nokia770_spi_board_info
[PATCH 01/11] OMAP: GPIO: Modify init() in preparation for platform device implementation
This is in prepartion for implementing GPIO as a platform device. gpio bank's base addresses are moved from gpio.c to plat/gpio.h. This patch also modifies omap_gpio_init() to make use of omap_gpio_chip_init() and omap_gpio_mod_init(). omap_gpio_mod_init() does the module init by clearing the status register and initializing the GPIO control register. omap_gpio_chip_init() initializes the chip request, free, get, set and other function pointers and sets the gpio irq handler. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/plat-omap/gpio.c | 277 ++-- arch/arm/plat-omap/include/plat/gpio.h | 68 - 2 files changed, 185 insertions(+), 160 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 45a225d..70deebc 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -31,7 +31,6 @@ /* * OMAP1510 GPIO registers */ -#define OMAP1510_GPIO_BASE 0xfffce000 #define OMAP1510_GPIO_DATA_INPUT 0x00 #define OMAP1510_GPIO_DATA_OUTPUT 0x04 #define OMAP1510_GPIO_DIR_CONTROL 0x08 @@ -40,15 +39,9 @@ #define OMAP1510_GPIO_INT_STATUS 0x14 #define OMAP1510_GPIO_PIN_CONTROL 0x18 -#define OMAP1510_IH_GPIO_BASE 64 - /* * OMAP1610 specific GPIO registers */ -#define OMAP1610_GPIO1_BASE0xfffbe400 -#define OMAP1610_GPIO2_BASE0xfffbec00 -#define OMAP1610_GPIO3_BASE0xfffbb400 -#define OMAP1610_GPIO4_BASE0xfffbbc00 #define OMAP1610_GPIO_REVISION 0x #define OMAP1610_GPIO_SYSCONFIG0x0010 #define OMAP1610_GPIO_SYSSTATUS0x0014 @@ -70,12 +63,6 @@ /* * OMAP7XX specific GPIO registers */ -#define OMAP7XX_GPIO1_BASE 0xfffbc000 -#define OMAP7XX_GPIO2_BASE 0xfffbc800 -#define OMAP7XX_GPIO3_BASE 0xfffbd000 -#define OMAP7XX_GPIO4_BASE 0xfffbd800 -#define OMAP7XX_GPIO5_BASE 0xfffbe000 -#define OMAP7XX_GPIO6_BASE 0xfffbe800 #define OMAP7XX_GPIO_DATA_INPUT0x00 #define OMAP7XX_GPIO_DATA_OUTPUT 0x04 #define OMAP7XX_GPIO_DIR_CONTROL 0x08 @@ -83,22 +70,9 @@ #define OMAP7XX_GPIO_INT_MASK 0x10 #define OMAP7XX_GPIO_INT_STATUS0x14 -#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE - /* * omap24xx specific GPIO registers */ -#define OMAP242X_GPIO1_BASE0x48018000 -#define OMAP242X_GPIO2_BASE0x4801a000 -#define OMAP242X_GPIO3_BASE0x4801c000 -#define OMAP242X_GPIO4_BASE0x4801e000 - -#define OMAP243X_GPIO1_BASE0x4900C000 -#define OMAP243X_GPIO2_BASE0x4900E000 -#define OMAP243X_GPIO3_BASE0x4901 -#define OMAP243X_GPIO4_BASE0x49012000 -#define OMAP243X_GPIO5_BASE0x480B6000 - #define OMAP24XX_GPIO_REVISION 0x #define OMAP24XX_GPIO_SYSCONFIG0x0010 #define OMAP24XX_GPIO_SYSSTATUS0x0014 @@ -150,26 +124,6 @@ #define OMAP4_GPIO_DEBOUNCINGTIME 0x0154 #define OMAP4_GPIO_CLEARDATAOUT0x0190 #define OMAP4_GPIO_SETDATAOUT 0x0194 -/* - * omap34xx specific GPIO registers - */ - -#define OMAP34XX_GPIO1_BASE0x4831 -#define OMAP34XX_GPIO2_BASE0x4905 -#define OMAP34XX_GPIO3_BASE0x49052000 -#define OMAP34XX_GPIO4_BASE0x49054000 -#define OMAP34XX_GPIO5_BASE0x49056000 -#define OMAP34XX_GPIO6_BASE0x49058000 - -/* - * OMAP44XX specific GPIO registers - */ -#define OMAP44XX_GPIO1_BASE 0x4a31 -#define OMAP44XX_GPIO2_BASE 0x48055000 -#define OMAP44XX_GPIO3_BASE 0x48057000 -#define OMAP44XX_GPIO4_BASE 0x48059000 -#define OMAP44XX_GPIO5_BASE 0x4805B000 -#define OMAP44XX_GPIO6_BASE 0x4805D000 struct gpio_bank { unsigned long pbase; @@ -181,14 +135,12 @@ struct gpio_bank { u32 suspend_wakeup; u32 saved_wakeup; #endif -#ifdef CONFIG_ARCH_OMAP2PLUS u32 non_wakeup_gpios; u32 enabled_non_wakeup_gpios; u32 saved_datain; u32 saved_fallingdetect; u32 saved_risingdetect; -#endif u32 level_mask; u32 toggle_mask; spinlock_t lock; @@ -1669,6 +1621,122 @@ static void __init omap_gpio_show_rev(void) */ static struct lock_class_key gpio_lock_class; +static void omap_gpio_mod_init(struct gpio_bank *bank, int id) +{ + if (cpu_class_is_omap2()) { + static const u32 non_wakeup_gpios[] = { + 0xe203ffc0, 0x08700040 + }; + if (id ARRAY_SIZE(non_wakeup_gpios)) + bank-non_wakeup_gpios = non_wakeup_gpios[id]; + + if (cpu_is_omap44xx()) { + __raw_writel(0x, bank-base + + OMAP4_GPIO_IRQSTATUSCLR0
[PATCH 04/11] OMAP: GPIO: Introduce support for OMAP16xx chip GPIO init
This patch adds support for handling OMAP16xx specific gpio_init by providing platform device data and doing device registration. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap1/gpio16xx.c | 202 1 files changed, 202 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap1/gpio16xx.c diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c new file mode 100644 index 000..07febcc --- /dev/null +++ b/arch/arm/mach-omap1/gpio16xx.c @@ -0,0 +1,202 @@ +/* + * gpio16xx.c - OMAP16XX-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/gpio.h + +static struct omap_gpio_dev_attr omap16xx_gpio_attr = { + .gpio_bank_count= 5, + .gpio_bank_bits = 16, + .arm_gpio_ck_flag = false, +}; + +/* + * OMAP16XX MPU GPIO interface data + */ +static struct __initdata resource omap16xx_mpu_gpio_resources[] = { + { + .start = OMAP1_MPUIO_VBASE, + .end= OMAP1_MPUIO_VBASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_MPUIO, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = { + .virtual_irq_start = IH_MPUIO_BASE, + .method = METHOD_MPUIO, + .gpio_attr = omap16xx_gpio_attr, +}; + +static struct __initdata platform_device omap16xx_mpu_gpio = { + .name = omap-gpio, + .id = 0, + .dev= { + .platform_data = omap16xx_mpu_gpio_config, + }, + .num_resources = ARRAY_SIZE(omap16xx_mpu_gpio_resources), + .resource = omap16xx_mpu_gpio_resources, +}; + +/* + * OMAP16XX GPIO1 interface data + */ +static struct __initdata resource omap16xx_gpio1_resources[] = { + { + .start = OMAP1610_GPIO1_BASE, + .end= OMAP1610_GPIO1_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_GPIO_BANK1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = { + .virtual_irq_start = IH_GPIO_BASE, + .method = METHOD_GPIO_1610, + .gpio_attr = omap16xx_gpio_attr, +}; + +static struct __initdata platform_device omap16xx_gpio1 = { + .name = omap-gpio, + .id = 1, + .dev= { + .platform_data = omap16xx_gpio1_config, + }, + .num_resources = ARRAY_SIZE(omap16xx_gpio1_resources), + .resource = omap16xx_gpio1_resources, +}; + +/* + * OMAP16XX GPIO2 interface data + */ +static struct __initdata resource omap16xx_gpio2_resources[] = { + { + .start = OMAP1610_GPIO2_BASE, + .end= OMAP1610_GPIO2_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_1610_GPIO_BANK2, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = { + .virtual_irq_start = IH_GPIO_BASE + 16, + .method = METHOD_GPIO_1610, + .gpio_attr = omap16xx_gpio_attr, +}; + +static struct __initdata platform_device omap16xx_gpio2 = { + .name = omap-gpio, + .id = 2, + .dev= { + .platform_data = omap16xx_gpio2_config, + }, + .num_resources = ARRAY_SIZE(omap16xx_gpio2_resources), + .resource = omap16xx_gpio2_resources, +}; + +/* + * OMAP16XX GPIO3 interface data + */ +static struct __initdata resource omap16xx_gpio3_resources[] = { + { + .start = OMAP1610_GPIO3_BASE, + .end= OMAP1610_GPIO3_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_1610_GPIO_BANK3, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = { + .virtual_irq_start = IH_GPIO_BASE + 32, + .method = METHOD_GPIO_1610, + .gpio_attr = omap16xx_gpio_attr, +}; + +static struct __initdata platform_device omap16xx_gpio3 = { + .name = omap-gpio, + .id = 3, + .dev= { + .platform_data = omap16xx_gpio3_config, + }, + .num_resources = ARRAY_SIZE(omap16xx_gpio3_resources), + .resource = omap16xx_gpio3_resources, +}; + +/* + * OMAP16XX
[PATCH] OMAP:GPIO:hwmod: Fix mmc compile errors
In origin/pm-wip/runtime branch, compilation errors are observed for OMAP2430. The compilation errors are due to usage of clkdev_dev_id, clkdev_con_id and sysconfig fields in mmc hwmod structures. This patch fixes the same. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 28 +++- 1 files changed, 15 insertions(+), 13 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index ffc5222..d9c92aa 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -93,8 +93,7 @@ static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = { static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = { .master = omap2430_l4_core_hwmod, .slave = omap2430_mmc1_hwmod, - .clkdev_dev_id = mmci-omap-hs.0, - .clkdev_con_id = ick, + .clk= mmchs1_ick, .addr = omap2430_mmc1_addr_space, .addr_cnt = ARRAY_SIZE(omap2430_mmc1_addr_space), .user = OCP_USER_MPU | OCP_USER_SDMA, @@ -112,9 +111,8 @@ static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = { static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = { .master = omap2430_l4_core_hwmod, .slave = omap2430_mmc2_hwmod, - .clkdev_dev_id = mmci-omap-hs.1, - .clkdev_con_id = ick, .addr = omap2430_mmc2_addr_space, + .clk= mmchs1_ick, .addr_cnt = ARRAY_SIZE(omap2430_mmc2_addr_space), .user = OCP_USER_MPU | OCP_USER_SDMA, }; @@ -180,13 +178,19 @@ static struct omap_hwmod omap2430_mpu_hwmod = { /* MMC/SD/SDIO common */ -static struct omap_hwmod_sysconfig mmc_if_ctrl = { +static struct omap_hwmod_class_sysconfig mmc_sysc = { .rev_offs = 0x10, .sysc_offs = 0x14, .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE | SYSS_MISSING), .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class mmc_class = { + .name = mmc, + .sysc = mmc_sysc, }; /* MMC/SD/SDIO1 */ @@ -205,7 +209,7 @@ static struct omap_hwmod_dma_info mmc1_sdma_chs[] = { }; static struct omap_hwmod_opt_clk mmc1_opt_clks[] = { - { .clkdev_dev_id = mmci-omap-hs.0, .clkdev_con_id = mmchsdb_fck }, + { .role = dbck, .clk = mmchsdb_fck }, }; static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = { @@ -220,8 +224,7 @@ static struct omap_hwmod omap2430_mmc1_hwmod = { .sdma_chs_cnt = ARRAY_SIZE(mmc1_sdma_chs), .opt_clks = mmc1_opt_clks, .opt_clks_cnt = ARRAY_SIZE(mmc1_opt_clks), - .clkdev_dev_id = mmci-omap-hs.0, - .clkdev_con_id = fck, + .main_clk = mmchs1_fck, .prcm = { .omap2 = { .prcm_reg_id = 2, @@ -230,7 +233,7 @@ static struct omap_hwmod omap2430_mmc1_hwmod = { }, .slaves = omap2430_mmc1_slaves, .slaves_cnt = ARRAY_SIZE(omap2430_mmc1_slaves), - .sysconfig = mmc_if_ctrl, + .class = mmc_class, .dev_attr = mmc1_dev_attr, .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430), }; @@ -251,7 +254,7 @@ static struct omap_hwmod_dma_info mmc2_sdma_chs[] = { }; static struct omap_hwmod_opt_clk mmc2_opt_clks[] = { - { .clkdev_dev_id = mmci-omap-hs.1, .clkdev_con_id = mmchsdb_fck }, + { .role = dbck, .clk = mmchsdb_fck }, }; static struct omap_hwmod_ocp_if *omap2430_mmc2_slaves[] = { @@ -266,8 +269,7 @@ static struct omap_hwmod omap2430_mmc2_hwmod = { .sdma_chs_cnt = ARRAY_SIZE(mmc2_sdma_chs), .opt_clks = mmc2_opt_clks, .opt_clks_cnt = ARRAY_SIZE(mmc2_opt_clks), - .clkdev_dev_id = mmci-omap-hs.1, - .clkdev_con_id = fck, + .main_clk = mmchs2_fck, .prcm = { .omap2 = { .prcm_reg_id = 2, @@ -276,7 +278,7 @@ static struct omap_hwmod omap2430_mmc2_hwmod = { }, .slaves = omap2430_mmc2_slaves, .slaves_cnt = ARRAY_SIZE(omap2430_mmc2_slaves), - .sysconfig = mmc_if_ctrl, + .class = mmc_class, .dev_attr = mmc2_dev_attr, .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430), }; -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/9] OMAP:GPIO: Introduce support for OMAP15xx chip specific GPIO
This patch adds support for handling OMAP15xx specific gpio_init by providing platform device data and doing device registration. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap1/gpio15xx.c | 102 1 files changed, 102 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap1/gpio15xx.c diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c new file mode 100644 index 000..99c4017 --- /dev/null +++ b/arch/arm/mach-omap1/gpio15xx.c @@ -0,0 +1,102 @@ +/* + * gpio15xx.c - OMAP15XX-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/gpio.h + +/* + * OMAP15XX GPIO1 interface data + */ +static struct __initdata resource omap15xx_mpu_gpio_resources[] = { + { + .start = OMAP1_MPUIO_VBASE, + .end= OMAP1_MPUIO_VBASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_MPUIO, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = { + .virtual_irq_start = IH_MPUIO_BASE, + .method = METHOD_MPUIO, +}; + +static struct __initdata platform_device omap15xx_mpu_gpio = { + .name = omap-gpio, + .id = 0, + .dev= { + .platform_data = omap15xx_mpu_gpio_config, + }, + .num_resources = ARRAY_SIZE(omap15xx_mpu_gpio_resources), + .resource = omap15xx_mpu_gpio_resources, +}; + +/* + * OMAP15XX GPIO2 interface data + */ +static struct __initdata resource omap15xx_gpio_resources[] = { + { + .start = OMAP1510_GPIO_BASE, + .end= OMAP1510_GPIO_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_GPIO_BANK1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = { + .virtual_irq_start = IH_GPIO_BASE, + .method = METHOD_GPIO_1510, +}; + +static struct __initdata platform_device omap15xx_gpio = { + .name = omap-gpio, + .id = 1, + .dev= { + .platform_data = omap15xx_gpio_config, + }, + .num_resources = ARRAY_SIZE(omap15xx_gpio_resources), + .resource = omap15xx_gpio_resources, +}; + +static struct __initdata platform_device * omap15xx_gpio_dev[] = { + omap15xx_mpu_gpio, + omap15xx_gpio, +}; + +int __init omap15xx_gpio_init(void) +{ + if (cpu_is_omap15xx()) { + early_platform_add_devices(omap15xx_gpio_dev, + sizeof(omap15xx_gpio_dev)); + early_platform_driver_register_all(earlygpio); + early_platform_driver_probe(earlygpio, + sizeof(omap15xx_gpio_dev), 0); + } + return 0; +} + +int __init omap15xx_gpio_dev_reg(void) +{ + if (cpu_is_omap15xx()) { + platform_device_register(omap15xx_mpu_gpio); + platform_device_register(omap15xx_gpio); + } + + return 0; +} +arch_initcall(omap15xx_gpio_dev_reg); -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 7/9] OMAP:GPIO:hwmod: add GPIO hwmods for OMAP2420
Add hwmod structures for GPIO module on OMAP2420. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 215 1 files changed, 215 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c index eb7ee24..b3fe521 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c @@ -15,6 +15,7 @@ #include mach/irqs.h #include plat/cpu.h #include plat/dma.h +#include plat/gpio.h #include omap_hwmod_common_data.h @@ -32,6 +33,10 @@ static struct omap_hwmod omap2420_mpu_hwmod; static struct omap_hwmod omap2420_l3_hwmod; static struct omap_hwmod omap2420_l4_core_hwmod; +static struct omap_hwmod omap2420_gpio1_hwmod; +static struct omap_hwmod omap2420_gpio2_hwmod; +static struct omap_hwmod omap2420_gpio3_hwmod; +static struct omap_hwmod omap2420_gpio4_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2420_l3__l4_core = { @@ -87,6 +92,78 @@ static struct omap_hwmod_ocp_if *omap2420_l4_core_masters[] = { omap2420_l4_core__l4_wkup, }; +/* L4 WKUP - GPIO1 interface */ +static struct omap_hwmod_addr_space omap2420_gpio1_addr_space[] = { + { + .pa_start = OMAP242X_GPIO1_BASE, + .pa_end = OMAP242X_GPIO1_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio1 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_gpio1_hwmod, + .clk= gpios_ick, + .addr = omap2420_gpio1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_gpio1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO2 interface */ +static struct omap_hwmod_addr_space omap2420_gpio2_addr_space[] = { + { + .pa_start = OMAP242X_GPIO2_BASE, + .pa_end = OMAP242X_GPIO2_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio2 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_gpio2_hwmod, + .clk= gpios_ick, + .addr = omap2420_gpio2_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_gpio2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO3 interface */ +static struct omap_hwmod_addr_space omap2420_gpio3_addr_space[] = { + { + .pa_start = OMAP242X_GPIO3_BASE, + .pa_end = OMAP242X_GPIO3_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio3 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_gpio3_hwmod, + .clk= gpios_ick, + .addr = omap2420_gpio3_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_gpio3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO4 interface */ +static struct omap_hwmod_addr_space omap2420_gpio4_addr_space[] = { + { + .pa_start = OMAP242X_GPIO4_BASE, + .pa_end = OMAP242X_GPIO4_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio4 = { + .master = omap2420_l4_wkup_hwmod, + .slave = omap2420_gpio4_hwmod, + .clk= gpios_ick, + .addr = omap2420_gpio4_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_gpio4_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* L4 CORE */ static struct omap_hwmod omap2420_l4_core_hwmod = { .name = l4_core_hwmod, @@ -101,10 +178,18 @@ static struct omap_hwmod omap2420_l4_core_hwmod = { /* Slave interfaces on the L4_WKUP interconnect */ static struct omap_hwmod_ocp_if *omap2420_l4_wkup_slaves[] = { omap2420_l4_core__l4_wkup, + omap2420_l4_wkup__gpio1, + omap2420_l4_wkup__gpio2, + omap2420_l4_wkup__gpio3, + omap2420_l4_wkup__gpio4, }; /* Master interfaces on the L4_WKUP interconnect */ static struct omap_hwmod_ocp_if *omap2420_l4_wkup_masters[] = { + omap2420_l4_wkup__gpio1, + omap2420_l4_wkup__gpio2, + omap2420_l4_wkup__gpio3, + omap2420_l4_wkup__gpio4, }; /* L4 WKUP */ @@ -133,11 +218,141 @@ static struct omap_hwmod omap2420_mpu_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), }; +/* GPIO common */ + +static struct omap_hwmod_class_sysconfig gpio_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_SIDLEMODE
[PATCH 5/9] OMAP:GPIO: Introduce support for OMAP2PLUS chip specific GPIO
This patch adds support for handling GPIO as a HWMOD adapted platform device for OMAP2PLUS chips. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap2/gpio.c | 101 1 files changed, 101 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/gpio.c diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c new file mode 100644 index 000..6424050 --- /dev/null +++ b/arch/arm/mach-omap2/gpio.c @@ -0,0 +1,101 @@ +/* + * gpio.c - OMAP2PLUS-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/gpio.h +#include linux/err.h +#include plat/omap_hwmod.h +#include plat/omap_device.h + +static int gpio_bank_count; + +struct omap_device_pm_latency omap_gpio_latency[] = { + [0] = { + .deactivate_func = omap_device_idle_hwmods, + .activate_func = omap_device_enable_hwmods, + .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, + }, +}; + +int __init gpio_init(void) +{ + int i = 0; + static int is_early_device = true; + + do { + struct omap_device *od; + struct omap_hwmod *oh; + int hw_mod_name_len = 16; + int l; + char oh_name[hw_mod_name_len]; + struct omap_gpio_platform_data *pdata; + char *name = omap-gpio; + + l = snprintf(oh_name, hw_mod_name_len, gpio%d_hwmod, i + 1); + WARN(l = hw_mod_name_len, + String buffer overflow in GPIO device setup\n); + + oh = omap_hwmod_lookup(oh_name); + if (!oh) { + pr_err(Could not look up %s\n, oh_name); + i++; + continue; + } + + pdata = kzalloc(sizeof(struct omap_gpio_platform_data), + GFP_KERNEL); + if (!pdata) { + pr_err(Memory allocation failed gpio%d\n, i + 1); + return -ENOMEM; + } + pdata-base = oh-_rt_va; + pdata-irq = oh-mpu_irqs[0].irq; + if (cpu_is_omap24xx() || cpu_is_omap34xx()) + pdata-method = METHOD_GPIO_24XX; + if (cpu_is_omap44xx()) + pdata-method = METHOD_GPIO_44XX; + pdata-virtual_irq_start = IH_GPIO_BASE + 32 * i; + pdata-device_enable = omap_device_enable; + pdata-device_idle = omap_device_idle; + pdata-device_shutdown = omap_device_shutdown; + + od = omap_device_build(name, i, oh, pdata, + sizeof(*pdata), omap_gpio_latency, + ARRAY_SIZE(omap_gpio_latency), + is_early_device); + WARN(IS_ERR(od), Cant build omap_device for %s:%s.\n, + name, oh-name); + + i++; + } while (i gpio_bank_count); + is_early_device = false; + + return 0; +} +arch_initcall(gpio_init); + +int __init omap2_gpio_init(void) +{ + if (cpu_is_omap242x()) + gpio_bank_count = 4; + else if (cpu_is_omap243x()) + gpio_bank_count = 5; + else if (cpu_is_omap34xx() || cpu_is_omap44xx()) + gpio_bank_count = OMAP34XX_NR_GPIOS; + + if (gpio_init()) + return -EINVAL; + + early_platform_driver_register_all(earlygpio); + early_platform_driver_probe(earlygpio, gpio_bank_count, 0); + return 0; +} -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/9] OMAP:GPIO:hwmod: add GPIO hwmods for OMAP3
Add hwmod structures for GPIO module on OMAP3 Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Rajendra Nayak rna...@ti.com --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 346 +++- 1 files changed, 345 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 5f74c34..6124d62 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -20,6 +20,7 @@ #include plat/serial.h #include plat/l4_3xxx.h #include plat/mmc.h +#include plat/gpio.h #include omap_hwmod_common_data.h @@ -89,6 +90,12 @@ static struct omap_hwmod omap3xxx_uart3_hwmod; static struct omap_hwmod omap3xxx_mmc1_hwmod; static struct omap_hwmod omap3xxx_mmc2_hwmod; static struct omap_hwmod omap3xxx_mmc3_hwmod; +static struct omap_hwmod omap3xxx_gpio1_hwmod; +static struct omap_hwmod omap3xxx_gpio2_hwmod; +static struct omap_hwmod omap3xxx_gpio3_hwmod; +static struct omap_hwmod omap3xxx_gpio4_hwmod; +static struct omap_hwmod omap3xxx_gpio5_hwmod; +static struct omap_hwmod omap3xxx_gpio6_hwmod; /* L4_CORE - L4_WKUP interface */ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = { @@ -226,6 +233,114 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = { .flags = OMAP_FIREWALL_L4 }; +/* L4 WKUP - GPIO1 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio1_addr_space[] = { + { + .pa_start = OMAP34XX_GPIO1_BASE, + .pa_end = OMAP34XX_GPIO1_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__gpio1 = { + .master = omap3xxx_l4_wkup_hwmod, + .slave = omap3xxx_gpio1_hwmod, + .clk= gpio1_ick, + .addr = omap3xxx_gpio1_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO2 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio2_addr_space[] = { + { + .pa_start = OMAP34XX_GPIO2_BASE, + .pa_end = OMAP34XX_GPIO2_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio2 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio2_hwmod, + .clk= gpio2_ick, + .addr = omap3xxx_gpio2_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO3 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio3_addr_space[] = { + { + .pa_start = OMAP34XX_GPIO3_BASE, + .pa_end = OMAP34XX_GPIO3_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio3 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio3_hwmod, + .clk= gpio3_ick, + .addr = omap3xxx_gpio3_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO4 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio4_addr_space[] = { + { + .pa_start = OMAP34XX_GPIO4_BASE, + .pa_end = OMAP34XX_GPIO4_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio4 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio4_hwmod, + .clk= gpio4_ick, + .addr = omap3xxx_gpio4_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio4_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO5 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio5_addr_space[] = { + { + .pa_start = OMAP34XX_GPIO5_BASE, + .pa_end = OMAP34XX_GPIO5_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio5 = { + .master = omap3xxx_l4_per_hwmod, + .slave = omap3xxx_gpio5_hwmod, + .clk= gpio5_ick, + .addr = omap3xxx_gpio5_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_gpio5_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 PER - GPIO6 interface */ +static struct omap_hwmod_addr_space omap3xxx_gpio6_addr_space[] = { + { + .pa_start = OMAP34XX_GPIO6_BASE, + .pa_end = OMAP34XX_GPIO6_BASE + SZ_4K - 1, + .flags
[PATCH 3/9] OMAP:GPIO: Introduce support for OMAP16xx chip specific GPIO
This patch adds support for handling OMAP16xx specific gpio_init by providing platform device data and doing device registration. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap1/gpio16xx.c | 196 1 files changed, 196 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap1/gpio16xx.c diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c new file mode 100644 index 000..c047d1d --- /dev/null +++ b/arch/arm/mach-omap1/gpio16xx.c @@ -0,0 +1,196 @@ +/* + * gpio16xx.c - OMAP16XX-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/gpio.h + +/* + * OMAP16XX MPU GPIO interface data + */ +static struct __initdata resource omap16xx_mpu_gpio_resources[] = { + { + .start = OMAP1_MPUIO_VBASE, + .end= OMAP1_MPUIO_VBASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_MPUIO, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = { + .virtual_irq_start = IH_MPUIO_BASE, + .method = METHOD_MPUIO, +}; + +static struct __initdata platform_device omap16xx_mpu_gpio = { + .name = omap-gpio, + .id = 0, + .dev= { + .platform_data = omap16xx_mpu_gpio_config, + }, + .num_resources = ARRAY_SIZE(omap16xx_mpu_gpio_resources), + .resource = omap16xx_mpu_gpio_resources, +}; + +/* + * OMAP16XX GPIO1 interface data + */ +static struct __initdata resource omap16xx_gpio1_resources[] = { + { + .start = OMAP1610_GPIO1_BASE, + .end= OMAP1610_GPIO1_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_GPIO_BANK1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = { + .virtual_irq_start = IH_GPIO_BASE, + .method = METHOD_GPIO_1610, +}; + +static struct __initdata platform_device omap16xx_gpio1 = { + .name = omap-gpio, + .id = 1, + .dev= { + .platform_data = omap16xx_gpio1_config, + }, + .num_resources = ARRAY_SIZE(omap16xx_gpio1_resources), + .resource = omap16xx_gpio1_resources, +}; + +/* + * OMAP16XX GPIO2 interface data + */ +static struct __initdata resource omap16xx_gpio2_resources[] = { + { + .start = OMAP1610_GPIO2_BASE, + .end= OMAP1610_GPIO2_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_1610_GPIO_BANK2, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = { + .virtual_irq_start = IH_GPIO_BASE + 16, + .method = METHOD_GPIO_1610, +}; + +static struct __initdata platform_device omap16xx_gpio2 = { + .name = omap-gpio, + .id = 2, + .dev= { + .platform_data = omap16xx_gpio2_config, + }, + .num_resources = ARRAY_SIZE(omap16xx_gpio2_resources), + .resource = omap16xx_gpio2_resources, +}; + +/* + * OMAP16XX GPIO3 interface data + */ +static struct __initdata resource omap16xx_gpio3_resources[] = { + { + .start = OMAP1610_GPIO3_BASE, + .end= OMAP1610_GPIO3_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_1610_GPIO_BANK3, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = { + .virtual_irq_start = IH_GPIO_BASE + 32, + .method = METHOD_GPIO_1610, +}; + +static struct __initdata platform_device omap16xx_gpio3 = { + .name = omap-gpio, + .id = 3, + .dev= { + .platform_data = omap16xx_gpio3_config, + }, + .num_resources = ARRAY_SIZE(omap16xx_gpio3_resources), + .resource = omap16xx_gpio3_resources, +}; + +/* + * OMAP16XX GPIO4 interface data + */ +static struct __initdata resource omap16xx_gpio4_resources[] = { + { + .start = OMAP1610_GPIO4_BASE, + .end= OMAP1610_GPIO4_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_1610_GPIO_BANK4, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap16xx_gpio4_config
[PATCH 1/9] OMAP:GPIO: Modify init() in preparation for platform device implementation
This is in prepartion for making GPIO an early platform device. For making GPIO an early platform device, gpio bank's base addresses are moved from gpio.c to plat/gpio.h. This patch also modifies omap_gpio_init() to make use of omap_gpio_chip_init() and omap_gpio_mod_init(). omap_gpio_mod_init() does the module init by clearing the status register and initializing the GPIO control register. omap_gpio_chip_init() initializes the chip request, free, get, set and other function pointers and sets the gpio irq handler. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/plat-omap/gpio.c | 277 ++-- arch/arm/plat-omap/include/plat/gpio.h | 68 - 2 files changed, 185 insertions(+), 160 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 76a347b..c8f2c3c 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -31,7 +31,6 @@ /* * OMAP1510 GPIO registers */ -#define OMAP1510_GPIO_BASE 0xfffce000 #define OMAP1510_GPIO_DATA_INPUT 0x00 #define OMAP1510_GPIO_DATA_OUTPUT 0x04 #define OMAP1510_GPIO_DIR_CONTROL 0x08 @@ -40,15 +39,9 @@ #define OMAP1510_GPIO_INT_STATUS 0x14 #define OMAP1510_GPIO_PIN_CONTROL 0x18 -#define OMAP1510_IH_GPIO_BASE 64 - /* * OMAP1610 specific GPIO registers */ -#define OMAP1610_GPIO1_BASE0xfffbe400 -#define OMAP1610_GPIO2_BASE0xfffbec00 -#define OMAP1610_GPIO3_BASE0xfffbb400 -#define OMAP1610_GPIO4_BASE0xfffbbc00 #define OMAP1610_GPIO_REVISION 0x #define OMAP1610_GPIO_SYSCONFIG0x0010 #define OMAP1610_GPIO_SYSSTATUS0x0014 @@ -70,12 +63,6 @@ /* * OMAP7XX specific GPIO registers */ -#define OMAP7XX_GPIO1_BASE 0xfffbc000 -#define OMAP7XX_GPIO2_BASE 0xfffbc800 -#define OMAP7XX_GPIO3_BASE 0xfffbd000 -#define OMAP7XX_GPIO4_BASE 0xfffbd800 -#define OMAP7XX_GPIO5_BASE 0xfffbe000 -#define OMAP7XX_GPIO6_BASE 0xfffbe800 #define OMAP7XX_GPIO_DATA_INPUT0x00 #define OMAP7XX_GPIO_DATA_OUTPUT 0x04 #define OMAP7XX_GPIO_DIR_CONTROL 0x08 @@ -83,22 +70,9 @@ #define OMAP7XX_GPIO_INT_MASK 0x10 #define OMAP7XX_GPIO_INT_STATUS0x14 -#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE - /* * omap24xx specific GPIO registers */ -#define OMAP242X_GPIO1_BASE0x48018000 -#define OMAP242X_GPIO2_BASE0x4801a000 -#define OMAP242X_GPIO3_BASE0x4801c000 -#define OMAP242X_GPIO4_BASE0x4801e000 - -#define OMAP243X_GPIO1_BASE0x4900C000 -#define OMAP243X_GPIO2_BASE0x4900E000 -#define OMAP243X_GPIO3_BASE0x4901 -#define OMAP243X_GPIO4_BASE0x49012000 -#define OMAP243X_GPIO5_BASE0x480B6000 - #define OMAP24XX_GPIO_REVISION 0x #define OMAP24XX_GPIO_SYSCONFIG0x0010 #define OMAP24XX_GPIO_SYSSTATUS0x0014 @@ -150,26 +124,6 @@ #define OMAP4_GPIO_DEBOUNCINGTIME 0x0154 #define OMAP4_GPIO_CLEARDATAOUT0x0190 #define OMAP4_GPIO_SETDATAOUT 0x0194 -/* - * omap34xx specific GPIO registers - */ - -#define OMAP34XX_GPIO1_BASE0x4831 -#define OMAP34XX_GPIO2_BASE0x4905 -#define OMAP34XX_GPIO3_BASE0x49052000 -#define OMAP34XX_GPIO4_BASE0x49054000 -#define OMAP34XX_GPIO5_BASE0x49056000 -#define OMAP34XX_GPIO6_BASE0x49058000 - -/* - * OMAP44XX specific GPIO registers - */ -#define OMAP44XX_GPIO1_BASE 0x4a31 -#define OMAP44XX_GPIO2_BASE 0x48055000 -#define OMAP44XX_GPIO3_BASE 0x48057000 -#define OMAP44XX_GPIO4_BASE 0x48059000 -#define OMAP44XX_GPIO5_BASE 0x4805B000 -#define OMAP44XX_GPIO6_BASE 0x4805D000 struct gpio_bank { unsigned long pbase; @@ -181,14 +135,12 @@ struct gpio_bank { u32 suspend_wakeup; u32 saved_wakeup; #endif -#ifdef CONFIG_ARCH_OMAP2PLUS u32 non_wakeup_gpios; u32 enabled_non_wakeup_gpios; u32 saved_datain; u32 saved_fallingdetect; u32 saved_risingdetect; -#endif u32 level_mask; u32 toggle_mask; spinlock_t lock; @@ -1669,6 +1621,122 @@ static void __init omap_gpio_show_rev(void) */ static struct lock_class_key gpio_lock_class; +static void omap_gpio_mod_init(struct gpio_bank *bank, int id) +{ + if (cpu_class_is_omap2()) { + static const u32 non_wakeup_gpios[] = { + 0xe203ffc0, 0x08700040 + }; + if (id ARRAY_SIZE(non_wakeup_gpios)) + bank-non_wakeup_gpios = non_wakeup_gpios[id]; + + if (cpu_is_omap44xx()) { + __raw_writel(0x, bank-base
[PATCH 4/9] OMAP:GPIO: Introduce support for OMAP7xx chip specific GPIO
This patch adds support for handling OMAP7xx specific gpio_init by providing platform device data and doing device registration. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap1/gpio7xx.c | 258 + 1 files changed, 258 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap1/gpio7xx.c diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c new file mode 100644 index 000..3cf1d54 --- /dev/null +++ b/arch/arm/mach-omap1/gpio7xx.c @@ -0,0 +1,258 @@ +/* + * gpio7xx.c - OMAP7XX-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/gpio.h + +/* + * OMAP7XX MPU GPIO interface data + */ +static struct __initdata resource omap7xx_mpu_gpio_resources[] = { + { + .start = OMAP1_MPUIO_VBASE, + .end= OMAP1_MPUIO_VBASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_MPUIO, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = { + .virtual_irq_start = IH_MPUIO_BASE, + .method = METHOD_MPUIO, +}; + +static struct __initdata platform_device omap7xx_mpu_gpio = { + .name = omap-gpio, + .id = 0, + .dev= { + .platform_data = omap7xx_mpu_gpio_config, + }, + .num_resources = ARRAY_SIZE(omap7xx_mpu_gpio_resources), + .resource = omap7xx_mpu_gpio_resources, +}; + +/* + * OMAP7XX GPIO1 interface data + */ +static struct __initdata resource omap7xx_gpio1_resources[] = { + { + .start = OMAP7XX_GPIO1_BASE, + .end= OMAP7XX_GPIO1_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_GPIO_BANK1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = { + .virtual_irq_start = IH_GPIO_BASE, + .method = METHOD_GPIO_7XX, +}; + +static struct __initdata platform_device omap7xx_gpio1 = { + .name = omap-gpio, + .id = 1, + .dev= { + .platform_data = omap7xx_gpio1_config, + }, + .num_resources = ARRAY_SIZE(omap7xx_gpio1_resources), + .resource = omap7xx_gpio1_resources, +}; + +/* + * OMAP7XX GPIO2 interface data + */ +static struct __initdata resource omap7xx_gpio2_resources[] = { + { + .start = OMAP7XX_GPIO2_BASE, + .end= OMAP7XX_GPIO2_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_GPIO_BANK2, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config = { + .virtual_irq_start = IH_GPIO_BASE + 32, + .method = METHOD_GPIO_7XX, +}; + +static struct __initdata platform_device omap7xx_gpio2 = { + .name = omap-gpio, + .id = 2, + .dev= { + .platform_data = omap7xx_gpio2_config, + }, + .num_resources = ARRAY_SIZE(omap7xx_gpio2_resources), + .resource = omap7xx_gpio2_resources, +}; + +/* + * OMAP7XX GPIO3 interface data + */ +static struct __initdata resource omap7xx_gpio3_resources[] = { + { + .start = OMAP7XX_GPIO3_BASE, + .end= OMAP7XX_GPIO3_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_GPIO_BANK3, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config = { + .virtual_irq_start = IH_GPIO_BASE + 64, + .method = METHOD_GPIO_7XX, +}; + +static struct __initdata platform_device omap7xx_gpio3 = { + .name = omap-gpio, + .id = 3, + .dev= { + .platform_data = omap7xx_gpio3_config, + }, + .num_resources = ARRAY_SIZE(omap7xx_gpio3_resources), + .resource = omap7xx_gpio3_resources, +}; + +/* + * OMAP7XX GPIO4 interface data + */ +static struct __initdata resource omap7xx_gpio4_resources[] = { + { + .start = OMAP7XX_GPIO4_BASE, + .end= OMAP7XX_GPIO4_BASE + SZ_2K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_7XX_GPIO_BANK4, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap7xx_gpio4_config = { + .virtual_irq_start = IH_GPIO_BASE + 96, + .method
[PATCH 00/09] OMAP:GPIO:Implement GPIO in HWMOD way
This patch series implements GPIO as an early platform driver. It makes OMAP2PLUS specific GPIO to get adapted to HWMOD FW. OMAP1 specific GPIO is implemented as early platform device. This patch series is created on origin/pm-wip/hwmods. In addition, the following patches are required to avoid compilation and boottime errors: 1. i2c-omap: Fix reg_shift init (by Tony Lindgren) 2. OMAP:GPIO:hwmod: Fix mmc compile errors (by Charulatha V) 3. OMAP: DSS2: VRAM: Fix early_param for vram (by Thomas Weber) This patch series is tested on OMAP3430 SDP board. It would be of great help if someone could test the same on OMAP1 and OMAP2 boards. Charulatha V (9): OMAP:GPIO: Modify init() in preparation for platform device implementation OMAP:GPIO: Introduce support for OMAP15xx chip specific GPIO OMAP:GPIO: Introduce support for OMAP16xx chip specific GPIO OMAP:GPIO: Introduce support for OMAP7xx chip specific GPIO OMAP:GPIO: Introduce support for OMAP2PLUS chip specific GPIO OMAP:GPIO:hwmod: add GPIO hwmods for OMAP3 OMAP:GPIO:hwmod: add GPIO hwmods for OMAP2420 OMAP:GPIO:hwmod: add GPIO hwmods for OMAP2430 OMAP:GPIO: Implement GPIO as a platform device arch/arm/mach-omap1/Makefile |6 + arch/arm/mach-omap1/clock_data.c |2 +- arch/arm/mach-omap1/gpio15xx.c | 102 + arch/arm/mach-omap1/gpio16xx.c | 196 + arch/arm/mach-omap1/gpio7xx.c | 258 +++ arch/arm/mach-omap2/Makefile |2 +- arch/arm/mach-omap2/clock2420_data.c | 10 +- arch/arm/mach-omap2/clock2430_data.c | 14 +- arch/arm/mach-omap2/clock3xxx_data.c | 24 +- arch/arm/mach-omap2/clock44xx_data.c | 24 +- arch/arm/mach-omap2/gpio.c | 101 + arch/arm/mach-omap2/omap_hwmod_2420_data.c | 215 ++ arch/arm/mach-omap2/omap_hwmod_2430_data.c | 262 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 346 +++- arch/arm/plat-omap/gpio.c | 640 +++- arch/arm/plat-omap/include/plat/gpio.h | 89 - 16 files changed, 1863 insertions(+), 428 deletions(-) create mode 100644 arch/arm/mach-omap1/gpio15xx.c create mode 100644 arch/arm/mach-omap1/gpio16xx.c create mode 100644 arch/arm/mach-omap1/gpio7xx.c create mode 100644 arch/arm/mach-omap2/gpio.c -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 9/9] OMAP:GPIO: Implement GPIO as a platform device
This patch implements GPIO as a early platform device. Also it implements OMAP2PLUS specific GPIO as HWMOD FW adapted driver. Inorder to convert GPIO as platform device, modifications are required in clock_data.c files so that device names can be used to obtain clock instead of getting clocks by name/NULL ptr. Currently early platform device register does not do device_pm_init. Hence pm_runtime functions are not used to enable the GPIO device since gpio is early platform device. Signed-off-by: Charulatha V ch...@ti.com Signed-off-by: Rajendra Nayak rna...@ti.com --- arch/arm/mach-omap1/Makefile |6 + arch/arm/mach-omap1/clock_data.c |2 +- arch/arm/mach-omap2/Makefile |2 +- arch/arm/mach-omap2/clock2420_data.c | 10 +- arch/arm/mach-omap2/clock2430_data.c | 14 +- arch/arm/mach-omap2/clock3xxx_data.c | 24 +- arch/arm/mach-omap2/clock44xx_data.c | 24 +- arch/arm/plat-omap/gpio.c | 405 arch/arm/plat-omap/include/plat/gpio.h | 21 ++ 9 files changed, 220 insertions(+), 288 deletions(-) diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile index b6a537c..dabd2be 100644 --- a/arch/arm/mach-omap1/Makefile +++ b/arch/arm/mach-omap1/Makefile @@ -45,6 +45,12 @@ ifeq ($(CONFIG_ARCH_OMAP15XX),y) obj-$(CONFIG_MACH_OMAP_INNOVATOR) += fpga.o endif +# GPIO +obj-$(CONFIG_ARCH_OMAP730) += gpio7xx.o +obj-$(CONFIG_ARCH_OMAP850) += gpio7xx.o +obj-$(CONFIG_ARCH_OMAP15XX)+= gpio15xx.o +obj-$(CONFIG_ARCH_OMAP16XX)+= gpio16xx.o + # LEDs support led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o led-$(CONFIG_MACH_OMAP_H3) += leds-h2p2-debug.o diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c index aa8558a..9bc2aa1 100644 --- a/arch/arm/mach-omap1/clock_data.c +++ b/arch/arm/mach-omap1/clock_data.c @@ -589,7 +589,7 @@ static struct omap_clk omap_clks[] = { CLK(NULL, ck_sossi, sossi_ck, CK_16XX), CLK(NULL, arm_ck, arm_ck,CK_16XX | CK_1510 | CK_310), CLK(NULL, armper_ck,armper_ck.clk, CK_16XX | CK_1510 | CK_310), - CLK(NULL, arm_gpio_ck, arm_gpio_ck, CK_1510 | CK_310), + CLK(omap-gpio.0, arm_gpio_ck, arm_gpio_ck, CK_1510 | CK_310), CLK(NULL, armxor_ck,armxor_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX), CLK(NULL, armtim_ck,armtim_ck.clk, CK_16XX | CK_1510 | CK_310), CLK(omap_wdt, fck, armwdt_ck.clk, CK_16XX | CK_1510 | CK_310), diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 4b9fc57..6bb8042 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -3,7 +3,7 @@ # # Common support -obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o +obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o gpio.o omap-2-3-common= irq.o sdrc.o hwmod-common = omap_hwmod.o \ diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c index d932b14..a693403 100644 --- a/arch/arm/mach-omap2/clock2420_data.c +++ b/arch/arm/mach-omap2/clock2420_data.c @@ -1802,8 +1802,14 @@ static struct omap_clk omap2420_clks[] = { CLK(NULL, uart2_fck,uart2_fck, CK_242X), CLK(NULL, uart3_ick,uart3_ick, CK_242X), CLK(NULL, uart3_fck,uart3_fck, CK_242X), - CLK(NULL, gpios_ick,gpios_ick, CK_242X), - CLK(NULL, gpios_fck,gpios_fck, CK_242X), + CLK(omap-gpio.0, ick, gpios_ick, CK_242X), + CLK(omap-gpio.1, ick, gpios_ick, CK_242X), + CLK(omap-gpio.2, ick, gpios_ick, CK_242X), + CLK(omap-gpio.3, ick, gpios_ick, CK_242X), + CLK(omap-gpio.0, fck, gpios_fck, CK_242X), + CLK(omap-gpio.1, fck, gpios_fck, CK_242X), + CLK(omap-gpio.2, fck, gpios_fck, CK_242X), + CLK(omap-gpio.3, fck, gpios_fck, CK_242X), CLK(omap_wdt, ick, mpu_wdt_ick, CK_242X), CLK(omap_wdt, fck, mpu_wdt_fck, CK_242X), CLK(NULL, sync_32k_ick, sync_32k_ick, CK_242X), diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c index 0438b6e..56bbcbc 100644 --- a/arch/arm/mach-omap2/clock2430_data.c +++ b/arch/arm/mach-omap2/clock2430_data.c @@ -1896,8 +1896,14 @@ static struct omap_clk omap2430_clks[] = { CLK(NULL, uart2_fck,uart2_fck, CK_243X), CLK(NULL, uart3_ick,uart3_ick, CK_243X), CLK(NULL, uart3_fck,uart3_fck, CK_243X), - CLK(NULL, gpios_ick,gpios_ick, CK_243X), - CLK(NULL, gpios_fck,gpios_fck, CK_243X), + CLK(omap-gpio.0
[PATCH 8/9] OMAP:GPIO:hwmod: add GPIO hwmods for OMAP2430
Add hwmod structures for GPIO module on OMAP2430. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 262 1 files changed, 262 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index d9c92aa..585ff21 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -16,6 +16,7 @@ #include plat/cpu.h #include plat/dma.h #include plat/mmc.h +#include plat/gpio.h #include omap_hwmod_common_data.h @@ -73,6 +74,11 @@ static struct omap_hwmod omap2430_l3_hwmod = { static struct omap_hwmod omap2430_l4_wkup_hwmod; static struct omap_hwmod omap2430_mmc1_hwmod; static struct omap_hwmod omap2430_mmc2_hwmod; +static struct omap_hwmod omap2430_gpio1_hwmod; +static struct omap_hwmod omap2430_gpio2_hwmod; +static struct omap_hwmod omap2430_gpio3_hwmod; +static struct omap_hwmod omap2430_gpio4_hwmod; +static struct omap_hwmod omap2430_gpio5_hwmod; /* L4_CORE - L4_WKUP interface */ static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = { @@ -117,6 +123,95 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; +/* L4 WKUP - GPIO1 interface */ +static struct omap_hwmod_addr_space omap2430_gpio1_addr_space[] = { + { + .pa_start = OMAP243X_GPIO1_BASE, + .pa_end = OMAP243X_GPIO1_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio1 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_gpio1_hwmod, + .clk= gpios_ick, + .addr = omap2430_gpio1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO2 interface */ +static struct omap_hwmod_addr_space omap2430_gpio2_addr_space[] = { + { + .pa_start = OMAP243X_GPIO2_BASE, + .pa_end = OMAP243X_GPIO2_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio2 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_gpio2_hwmod, + .clk= gpios_ick, + .addr = omap2430_gpio2_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO3 interface */ +static struct omap_hwmod_addr_space omap2430_gpio3_addr_space[] = { + { + .pa_start = OMAP243X_GPIO3_BASE, + .pa_end = OMAP243X_GPIO3_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio3 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_gpio3_hwmod, + .clk= gpios_ick, + .addr = omap2430_gpio3_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 WKUP - GPIO4 interface */ +static struct omap_hwmod_addr_space omap2430_gpio4_addr_space[] = { + { + .pa_start = OMAP243X_GPIO4_BASE, + .pa_end = OMAP243X_GPIO4_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio4 = { + .master = omap2430_l4_wkup_hwmod, + .slave = omap2430_gpio4_hwmod, + .clk= gpios_ick, + .addr = omap2430_gpio4_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio4_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 CORE - GPIO5 interface */ +static struct omap_hwmod_addr_space omap2430_gpio5_addr_space[] = { + { + .pa_start = OMAP243X_GPIO5_BASE, + .pa_end = OMAP243X_GPIO5_BASE + SZ_4K - 1, + .flags = ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__gpio5 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_gpio5_hwmod, + .clk= gpio5_ick, + .addr = omap2430_gpio5_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_gpio5_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; /* Slave interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = { @@ -128,6 +223,7 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = { omap2430_l4_core__l4_wkup, omap2430_l4_core__mmc1, omap2430_l4_core__mmc2, + omap2430_l4_core__gpio5
[PATCH V2] OMAP: GPIO: Fix OMAP4 GPIO reg access issues
Access to some of the OMAP4 GPIO registers are not properly handled. This patch fixes it. This patch is tested on 3430SDP and 4430SDP boards Signed-off-by: Charulatha V ch...@ti.com cc: Kevin Hilman khil...@deeprootsystems.com --- arch/arm/plat-omap/gpio.c | 61 +++- 1 files changed, 55 insertions(+), 12 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 76a347b..3a9891c 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -137,7 +137,11 @@ #define OMAP4_GPIO_IRQSTATUSCLR1 0x0040 #define OMAP4_GPIO_IRQWAKEN0 0x0044 #define OMAP4_GPIO_IRQWAKEN1 0x0048 -#define OMAP4_GPIO_SYSSTATUS 0x0104 +#define OMAP4_GPIO_SYSSTATUS 0x0114 +#define OMAP4_GPIO_IRQENABLE1 0x011c +#define OMAP4_GPIO_WAKE_EN 0x0120 +#define OMAP4_GPIO_IRQSTATUS2 0x0128 +#define OMAP4_GPIO_IRQENABLE2 0x012c #define OMAP4_GPIO_CTRL0x0130 #define OMAP4_GPIO_OE 0x0134 #define OMAP4_GPIO_DATAIN 0x0138 @@ -148,6 +152,10 @@ #define OMAP4_GPIO_FALLINGDETECT 0x014c #define OMAP4_GPIO_DEBOUNCENABLE 0x0150 #define OMAP4_GPIO_DEBOUNCINGTIME 0x0154 +#define OMAP4_GPIO_CLEARIRQENABLE1 0x0160 +#define OMAP4_GPIO_SETIRQENABLE1 0x0164 +#define OMAP4_GPIO_CLEARWKUENA 0x0180 +#define OMAP4_GPIO_SETWKUENA 0x0184 #define OMAP4_GPIO_CLEARDATAOUT0x0190 #define OMAP4_GPIO_SETDATAOUT 0x0194 /* @@ -591,12 +599,16 @@ static int _get_gpio_dataout(struct gpio_bank *bank, int gpio) reg += OMAP7XX_GPIO_DATA_OUTPUT; break; #endif -#ifdef CONFIG_ARCH_OMAP2PLUS +#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) case METHOD_GPIO_24XX: - case METHOD_GPIO_44XX: reg += OMAP24XX_GPIO_DATAOUT; break; #endif +#ifdef CONFIG_ARCH_OMAP4 + case METHOD_GPIO_44XX: + reg += OMAP4_GPIO_DATAOUT; + break; +#endif default: return -EINVAL; } @@ -1200,11 +1215,17 @@ static int omap_gpio_request(struct gpio_chip *chip, unsigned offset) #endif if (!cpu_class_is_omap1()) { if (!bank-mod_usage) { + void __iomem *reg = bank-base; u32 ctrl; - ctrl = __raw_readl(bank-base + OMAP24XX_GPIO_CTRL); - ctrl = 0xFFFE; + + if (cpu_is_omap24xx() || cpu_is_omap34xx()) + reg += OMAP24XX_GPIO_CTRL; + else if (cpu_is_omap44xx()) + reg += OMAP4_GPIO_CTRL; + ctrl = __raw_readl(reg); /* Module is enabled, clocks are not gated */ - __raw_writel(ctrl, bank-base + OMAP24XX_GPIO_CTRL); + ctrl = 0xFFFE; + __raw_writel(ctrl, reg); } bank-mod_usage |= 1 offset; } @@ -1226,22 +1247,34 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) __raw_writel(1 offset, reg); } #endif -#ifdef CONFIG_ARCH_OMAP2PLUS - if ((bank-method == METHOD_GPIO_24XX) || - (bank-method == METHOD_GPIO_44XX)) { +#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) + if (bank-method == METHOD_GPIO_24XX) { /* Disable wake-up during idle for dynamic tick */ void __iomem *reg = bank-base + OMAP24XX_GPIO_CLEARWKUENA; __raw_writel(1 offset, reg); } #endif +#ifdef CONFIG_ARCH_OMAP4 + if (bank-method == METHOD_GPIO_44XX) { + /* Disable wake-up during idle for dynamic tick */ + void __iomem *reg = bank-base + OMAP4_GPIO_IRQWAKEN0; + __raw_writel(1 offset, reg); + } +#endif if (!cpu_class_is_omap1()) { bank-mod_usage = ~(1 offset); if (!bank-mod_usage) { + void __iomem *reg = bank-base; u32 ctrl; - ctrl = __raw_readl(bank-base + OMAP24XX_GPIO_CTRL); + + if (cpu_is_omap24xx() || cpu_is_omap34xx()) + reg += OMAP24XX_GPIO_CTRL; + else if (cpu_is_omap44xx()) + reg += OMAP4_GPIO_CTRL; + ctrl = __raw_readl(reg); /* Module is disabled, clocks are gated */ ctrl |= 1; - __raw_writel(ctrl, bank-base + OMAP24XX_GPIO_CTRL); + __raw_writel(ctrl, reg); } } _reset_gpio(bank, bank-chip.base + offset); @@ -1570,9 +1603,14 @@ static int gpio_is_input(struct gpio_bank *bank, int mask
[PATCH 1/8] OMAP:GPIO:Move architecture specific macros to specific header
This patch moves architecture specific defines to the corresponding architecture specific header files. In gpio.c, #ifdef's CONFIG_ARCH_OMAPX are added to avoid compilation errors due to movement of macros to mach-omap layer. These architecture specific codes is only temporary as they will be removed at the end of this patch series when plat-omap/gpio.c handles only common APIs. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap1/include/mach/gpio.h | 88 arch/arm/mach-omap2/include/mach/gpio.h | 99 + arch/arm/plat-omap/gpio.c | 238 --- arch/arm/plat-omap/include/plat/gpio.h | 159 - 4 files changed, 339 insertions(+), 245 deletions(-) diff --git a/arch/arm/mach-omap1/include/mach/gpio.h b/arch/arm/mach-omap1/include/mach/gpio.h index e737706..c4945d7 100644 --- a/arch/arm/mach-omap1/include/mach/gpio.h +++ b/arch/arm/mach-omap1/include/mach/gpio.h @@ -3,3 +3,91 @@ */ #include plat/gpio.h + +/* + * OMAP1510 GPIO registers + */ +#define OMAP1510_GPIO_BASE 0xfffce000 +#define OMAP1510_GPIO_DATA_INPUT 0x00 +#define OMAP1510_GPIO_DATA_OUTPUT 0x04 +#define OMAP1510_GPIO_DIR_CONTROL 0x08 +#define OMAP1510_GPIO_INT_CONTROL 0x0c +#define OMAP1510_GPIO_INT_MASK 0x10 +#define OMAP1510_GPIO_INT_STATUS 0x14 +#define OMAP1510_GPIO_PIN_CONTROL 0x18 + +#define OMAP1510_IH_GPIO_BASE 64 + +/* + * OMAP1610 specific GPIO registers + */ +#define OMAP1610_GPIO1_BASE0xfffbe400 +#define OMAP1610_GPIO2_BASE0xfffbec00 +#define OMAP1610_GPIO3_BASE0xfffbb400 +#define OMAP1610_GPIO4_BASE0xfffbbc00 +#define OMAP1610_GPIO_REVISION 0x +#define OMAP1610_GPIO_SYSCONFIG0x0010 +#define OMAP1610_GPIO_SYSSTATUS0x0014 +#define OMAP1610_GPIO_IRQSTATUS1 0x0018 +#define OMAP1610_GPIO_IRQENABLE1 0x001c +#define OMAP1610_GPIO_WAKEUPENABLE 0x0028 +#define OMAP1610_GPIO_DATAIN 0x002c +#define OMAP1610_GPIO_DATAOUT 0x0030 +#define OMAP1610_GPIO_DIRECTION0x0034 +#define OMAP1610_GPIO_EDGE_CTRL1 0x0038 +#define OMAP1610_GPIO_EDGE_CTRL2 0x003c +#define OMAP1610_GPIO_CLEAR_IRQENABLE1 0x009c +#define OMAP1610_GPIO_CLEAR_WAKEUPENA 0x00a8 +#define OMAP1610_GPIO_CLEAR_DATAOUT0x00b0 +#define OMAP1610_GPIO_SET_IRQENABLE1 0x00dc +#define OMAP1610_GPIO_SET_WAKEUPENA0x00e8 +#define OMAP1610_GPIO_SET_DATAOUT 0x00f0 + +/* + * OMAP7XX specific GPIO registers + */ +#define OMAP7XX_GPIO1_BASE 0xfffbc000 +#define OMAP7XX_GPIO2_BASE 0xfffbc800 +#define OMAP7XX_GPIO3_BASE 0xfffbd000 +#define OMAP7XX_GPIO4_BASE 0xfffbd800 +#define OMAP7XX_GPIO5_BASE 0xfffbe000 +#define OMAP7XX_GPIO6_BASE 0xfffbe800 +#define OMAP7XX_GPIO_DATA_INPUT0x00 +#define OMAP7XX_GPIO_DATA_OUTPUT 0x04 +#define OMAP7XX_GPIO_DIR_CONTROL 0x08 +#define OMAP7XX_GPIO_INT_CONTROL 0x0c +#define OMAP7XX_GPIO_INT_MASK 0x10 +#define OMAP7XX_GPIO_INT_STATUS0x14 + +#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE +#define OMAP1_MPUIO_BASE 0xfffb5000 + +#if (defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)) +#define OMAP_MPUIO_INPUT_LATCH 0x00 +#define OMAP_MPUIO_OUTPUT 0x02 +#define OMAP_MPUIO_IO_CNTL 0x04 +#define OMAP_MPUIO_KBR_LATCH 0x08 +#define OMAP_MPUIO_KBC 0x0a +#define OMAP_MPUIO_GPIO_EVENT_MODE 0x0c +#define OMAP_MPUIO_GPIO_INT_EDGE 0x0e +#define OMAP_MPUIO_KBD_INT 0x10 +#define OMAP_MPUIO_GPIO_INT0x12 +#define OMAP_MPUIO_KBD_MASKIT 0x14 +#define OMAP_MPUIO_GPIO_MASKIT 0x16 +#define OMAP_MPUIO_GPIO_DEBOUNCING 0x18 +#define OMAP_MPUIO_LATCH 0x1a +#else +#define OMAP_MPUIO_INPUT_LATCH 0x00 +#define OMAP_MPUIO_OUTPUT 0x04 +#define OMAP_MPUIO_IO_CNTL 0x08 +#define OMAP_MPUIO_KBR_LATCH 0x10 +#define OMAP_MPUIO_KBC 0x14 +#define OMAP_MPUIO_GPIO_EVENT_MODE 0x18 +#define OMAP_MPUIO_GPIO_INT_EDGE 0x1c +#define OMAP_MPUIO_KBD_INT 0x20 +#define OMAP_MPUIO_GPIO_INT0x24 +#define OMAP_MPUIO_KBD_MASKIT 0x28 +#define OMAP_MPUIO_GPIO_MASKIT 0x2c +#define OMAP_MPUIO_GPIO_DEBOUNCING 0x30 +#define OMAP_MPUIO_LATCH 0x34 +#endif diff --git a/arch/arm/mach-omap2/include/mach/gpio.h b/arch/arm/mach-omap2/include/mach/gpio.h index be4d290..0b90a72 100644 --- a/arch/arm/mach-omap2/include/mach/gpio.h +++ b/arch/arm/mach-omap2/include/mach/gpio.h @@ -3,3 +3,102 @@ */ #include plat/gpio.h + +/* + * omap24xx specific GPIO registers + */ +#define OMAP242X_GPIO1_BASE0x48018000 +#define OMAP242X_GPIO2_BASE0x4801a000 +#define OMAP242X_GPIO3_BASE
[PATCH 2/8] OMAP3:GPIO:Add support for early platform gpio device
This patch adds support for implementing OMAP3 GPIO as an early platform device and adds gpio_init specific to OMAP3 This patch adds device structures for each GPIO device in OMAP3 architecture. These strutures are not created in a separate *_data.c file because these structures would be removed once the driver gets adapted to HWMOD way. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap2/gpio3xxx.c | 351 +++ arch/arm/mach-omap2/include/mach/gpio.h | 13 +- 2 files changed, 363 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-omap2/gpio3xxx.c diff --git a/arch/arm/mach-omap2/gpio3xxx.c b/arch/arm/mach-omap2/gpio3xxx.c new file mode 100644 index 000..8f404e7 --- /dev/null +++ b/arch/arm/mach-omap2/gpio3xxx.c @@ -0,0 +1,351 @@ +/* + * gpio3xxx.c - OMAP3-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include plat/gpio.h + +/* + * OMAP3 GPIO reg offsets + */ +static struct gpio_reg_offset omap3_gpio_reg = { + .data_in= OMAP24XX_GPIO_DATAIN, + .data_out = OMAP24XX_GPIO_DATAOUT, + .data_out_set = OMAP24XX_GPIO_SETDATAOUT, + .data_out_clear = OMAP24XX_GPIO_CLEARDATAOUT, + .dir_ctrl = OMAP24XX_GPIO_OE, + .irq_status0= OMAP24XX_GPIO_IRQSTATUS1, + .irq_status1= OMAP24XX_GPIO_IRQSTATUS2, + .irq_mask = OMAP24XX_GPIO_IRQENABLE1, + .irq_set= OMAP24XX_GPIO_SETIRQENABLE1, + .irq_clear = OMAP24XX_GPIO_CLEARIRQENABLE1, + .irq_mask_bits = 0x, + .irq_inv= 0, + .wkup_enable= OMAP24XX_GPIO_WAKE_EN, + .wkup_clear = OMAP24XX_GPIO_CLEARWKUENA, + .wkup_set = OMAP24XX_GPIO_SETWKUENA, + .debounce_ena = OMAP24XX_GPIO_DEBOUNCE_EN, + .debounce_val = OMAP24XX_GPIO_DEBOUNCE_VAL, + .ctrl = OMAP24XX_GPIO_CTRL, + .syscfg = OMAP24XX_GPIO_SYSCONFIG, + .leveldetect0 = OMAP24XX_GPIO_LEVELDETECT0, + .leveldetect1 = OMAP24XX_GPIO_LEVELDETECT1, + .rise_detect= OMAP24XX_GPIO_RISINGDETECT, + .fall_detect= OMAP24XX_GPIO_FALLINGDETECT, + .rev_reg= OMAP24XX_GPIO_REVISION, +}; + +/* + * OMAP3 GPIO1 interface data + */ +static struct __initdata resource omap3_gpio1_resources[] = { + { + .start = OMAP34XX_GPIO1_BASE, + .end= OMAP34XX_GPIO1_BASE + OMAP3_GPIO_AS_LEN - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_34XX_GPIO_BANK1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap3_gpio1_config = { + .ick_name = gpio1_ick, + .dbck_name = gpio1_dbck, + .virtual_irq_start = IH_GPIO_BASE, + .method = METHOD_GPIO_OMAP2PLUS, +}; + +static struct __initdata platform_device omap3_gpio1 = { + .name = omap-gpio, + .id = 0, + .dev= { + .platform_data = omap3_gpio1_config, + }, + .num_resources = ARRAY_SIZE(omap3_gpio1_resources), + .resource = omap3_gpio1_resources, +}; + +/* + * OMAP3 GPIO2 interface data + */ +static struct __initdata resource omap3_gpio2_resources[] = { + { + .start = OMAP34XX_GPIO2_BASE, + .end= OMAP34XX_GPIO2_BASE + OMAP3_GPIO_AS_LEN - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_34XX_GPIO_BANK2, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap3_gpio2_config = { + .ick_name = gpio2_ick, + .dbck_name = gpio2_dbck, + .virtual_irq_start = IH_GPIO_BASE + 32, + .method = METHOD_GPIO_OMAP2PLUS, +}; + +static struct __initdata platform_device omap3_gpio2 = { + .name = omap-gpio, + .id = 1, + .dev= { + .platform_data = omap3_gpio2_config, + }, + .num_resources = ARRAY_SIZE(omap3_gpio2_resources), + .resource = omap3_gpio2_resources, +}; + +/* + * OMAP3 GPIO3 interface data + */ +static struct __initdata resource omap3_gpio3_resources[] = { + { + .start = OMAP34XX_GPIO3_BASE, + .end= OMAP34XX_GPIO3_BASE + OMAP3_GPIO_AS_LEN - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = INT_34XX_GPIO_BANK3, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap3_gpio3_config = { + .ick_name = gpio3_ick, + .dbck_name = gpio3_dbck, + .virtual_irq_start = IH_GPIO_BASE + 64, + .method
[PATCH 4/8] OMAP4:GPIO:Add support for early platform gpio device
This patch adds support for implementing OMAP4 GPIO as an early platform device and adds gpio_init specific to OMAP4 This patch adds device structures for each GPIO device in OMAP4 architecture. These strutures are not created in a separate *_data.c file because these structures would be removed once the driver gets adapted to HWMOD way. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap2/gpio44xx.c | 350 +++ arch/arm/mach-omap2/include/mach/gpio.h |3 +- 2 files changed, 352 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-omap2/gpio44xx.c diff --git a/arch/arm/mach-omap2/gpio44xx.c b/arch/arm/mach-omap2/gpio44xx.c new file mode 100644 index 000..6133251 --- /dev/null +++ b/arch/arm/mach-omap2/gpio44xx.c @@ -0,0 +1,350 @@ +/* + * gpio44xx.c - OMAP4-specific gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include plat/gpio.h + +/* + * OMAP4 GPIO reg offsets + */ +static struct gpio_reg_offset omap4_gpio_reg = { + .data_in= OMAP4_GPIO_DATAIN, + .data_out = OMAP4_GPIO_DATAOUT, + .data_out_set = OMAP4_GPIO_SETDATAOUT, + .data_out_clear = OMAP4_GPIO_CLEARDATAOUT, + .dir_ctrl = OMAP4_GPIO_OE, + .irq_status0= OMAP4_GPIO_IRQSTATUS0, + .irq_status1= OMAP4_GPIO_IRQSTATUS1, + .irq_mask = OMAP4_GPIO_IRQSTATUSSET0, + .irq_set= OMAP4_GPIO_IRQSTATUSSET0, + .irq_clear = OMAP4_GPIO_IRQSTATUSCLR0, + .irq_mask_bits = 0x, + .irq_inv= 0, + .wkup_enable= OMAP4_GPIO_IRQWAKEN0, + .wkup_clear = OMAP4_GPIO_IRQWAKEN0, + .wkup_set = OMAP4_GPIO_IRQWAKEN0, + .debounce_ena = OMAP4_GPIO_DEBOUNCENABLE, + .debounce_val = OMAP4_GPIO_DEBOUNCINGTIME, + .ctrl = OMAP4_GPIO_CTRL, + .syscfg = OMAP4_GPIO_SYSCONFIG, + .leveldetect0 = OMAP4_GPIO_LEVELDETECT0, + .leveldetect1 = OMAP4_GPIO_LEVELDETECT1, + .rise_detect= OMAP4_GPIO_RISINGDETECT, + .fall_detect= OMAP4_GPIO_FALLINGDETECT, + .rev_reg= OMAP4_GPIO_REVISION, +}; + +/* + * OMAP4 GPIO1 interface data + */ +static struct __initdata resource omap4_gpio1_resources[] = { + { + .start = OMAP44XX_GPIO1_BASE, + .end= OMAP44XX_GPIO1_BASE + OMAP4_GPIO_AS_LEN - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = OMAP44XX_IRQ_GPIO1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap4_gpio1_config = { + .ick_name = gpio1_ick, + .dbck_name = gpio1_dbck, + .virtual_irq_start = IH_GPIO_BASE, + .method = METHOD_GPIO_OMAP2PLUS, +}; + +static struct __initdata platform_device omap4_gpio1 = { + .name = omap-gpio, + .id = 0, + .dev= { + .platform_data = omap4_gpio1_config, + }, + .num_resources = ARRAY_SIZE(omap4_gpio1_resources), + .resource = omap4_gpio1_resources, +}; + +/* + * OMAP4 GPIO2 interface data + */ +static struct __initdata resource omap4_gpio2_resources[] = { + { + .start = OMAP44XX_GPIO2_BASE, + .end= OMAP44XX_GPIO2_BASE + OMAP4_GPIO_AS_LEN - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = OMAP44XX_IRQ_GPIO2, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap4_gpio2_config = { + .ick_name = gpio2_ick, + .dbck_name = gpio2_dbck, + .virtual_irq_start = IH_GPIO_BASE + 32, + .method = METHOD_GPIO_OMAP2PLUS, +}; + +static struct __initdata platform_device omap4_gpio2 = { + .name = omap-gpio, + .id = 1, + .dev= { + .platform_data = omap4_gpio2_config, + }, + .num_resources = ARRAY_SIZE(omap4_gpio2_resources), + .resource = omap4_gpio2_resources, +}; + +/* + * OMAP4 GPIO3 interface data + */ +static struct __initdata resource omap4_gpio3_resources[] = { + { + .start = OMAP44XX_GPIO3_BASE, + .end= OMAP44XX_GPIO3_BASE + OMAP4_GPIO_AS_LEN - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = OMAP44XX_IRQ_GPIO3, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct __initdata omap_gpio_platform_data omap4_gpio3_config = { + .ick_name = gpio3_ick, + .dbck_name = gpio3_dbck, + .virtual_irq_start = IH_GPIO_BASE + 64, + .method = METHOD_GPIO_OMAP2PLUS, +}; + +static struct __initdata
[PATCH 5/8] OMAP2PLUS:GPIO:Add OMAP2PLUS specific gpio support
This patch adds support for handling code common to OMAP2PLUS architecture. OMAP2PLUS gpio is one of the early platform devices and this patch adds support to implement the initialization of OMAP2PLUS architecture GPIO as early platform device. Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap2/gpio.c | 36 +++ arch/arm/mach-omap2/include/mach/gpio.h |1 + 2 files changed, 37 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/gpio.c diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c new file mode 100644 index 000..341cdd5 --- /dev/null +++ b/arch/arm/mach-omap2/gpio.c @@ -0,0 +1,36 @@ +/* + * gpio.c - OMAP2PLUS architecture specific common gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include mach/gpio.h + +void __init omap_gpio_early_init(void) +{ + struct platform_device **pdev; + int no_of_dev; + + if (cpu_is_omap24xx()) { + omap2_gpio_init_data(); + no_of_dev = omap2_early_init_gpio(pdev); + } else if (cpu_is_omap34xx()) { + omap3_gpio_init_data(); + no_of_dev = omap3_early_init_gpio(pdev); + } else if (cpu_is_omap44xx()) { + omap4_gpio_init_data(); + no_of_dev = omap4_early_init_gpio(pdev); + } else + return; + + early_platform_add_devices(pdev, no_of_dev); + early_platform_driver_register_all(earlygpio); + early_platform_driver_probe(earlygpio, no_of_dev, 0); +} diff --git a/arch/arm/mach-omap2/include/mach/gpio.h b/arch/arm/mach-omap2/include/mach/gpio.h index d2d9d17..3a0fcb1 100644 --- a/arch/arm/mach-omap2/include/mach/gpio.h +++ b/arch/arm/mach-omap2/include/mach/gpio.h @@ -115,4 +115,5 @@ extern void omap4_gpio_init_data(void); extern int omap2_early_init_gpio(struct platform_device ***pdev); extern int omap3_early_init_gpio(struct platform_device ***pdev); extern int omap4_early_init_gpio(struct platform_device ***pdev); +extern void __init omap_gpio_early_init(void); #endif -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/8] OMAP1:GPIO:Support for OMAP1 specific gpio
This patch adds support for handling OMAP1 specific GPIO operations including gpio_init Signed-off-by: Charulatha V ch...@ti.com --- arch/arm/mach-omap1/gpio.c | 404 1 files changed, 404 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap1/gpio.c diff --git a/arch/arm/mach-omap1/gpio.c b/arch/arm/mach-omap1/gpio.c new file mode 100644 index 000..e54ce07 --- /dev/null +++ b/arch/arm/mach-omap1/gpio.c @@ -0,0 +1,404 @@ +/* + * gpio.c - OMAP1 architecture specific common gpio code + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Author: + * Charulatha V ch...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include plat/gpio.h + +static struct gpio_bank omap1610_gpio_bank[5] = { + { OMAP1_MPUIO_VBASE, NULL, INT_MPUIO, IH_MPUIO_BASE, + METHOD_MPUIO }, + { OMAP1610_GPIO1_BASE, NULL, INT_GPIO_BANK1, IH_GPIO_BASE, + METHOD_GPIO_1610 }, + { OMAP1610_GPIO2_BASE, NULL, INT_1610_GPIO_BANK2, IH_GPIO_BASE + 16, + METHOD_GPIO_1610 }, + { OMAP1610_GPIO3_BASE, NULL, INT_1610_GPIO_BANK3, IH_GPIO_BASE + 32, + METHOD_GPIO_1610 }, + { OMAP1610_GPIO4_BASE, NULL, INT_1610_GPIO_BANK4, IH_GPIO_BASE + 48, + METHOD_GPIO_1610 }, +}; + +static struct gpio_bank omap1510_gpio_bank[2] = { + { OMAP1_MPUIO_VBASE, NULL, INT_MPUIO, IH_MPUIO_BASE, + METHOD_MPUIO }, + { OMAP1510_GPIO_BASE, NULL, INT_GPIO_BANK1, IH_GPIO_BASE, + METHOD_GPIO_1510 } +}; + +static struct gpio_bank omap7xx_gpio_bank[7] = { + { OMAP1_MPUIO_VBASE, NULL, INT_7XX_MPUIO, IH_MPUIO_BASE, + METHOD_MPUIO }, + { OMAP7XX_GPIO1_BASE, NULL, INT_7XX_GPIO_BANK1, IH_GPIO_BASE, + METHOD_GPIO_7XX }, + { OMAP7XX_GPIO2_BASE, NULL, INT_7XX_GPIO_BANK2, IH_GPIO_BASE + 32, + METHOD_GPIO_7XX }, + { OMAP7XX_GPIO3_BASE, NULL, INT_7XX_GPIO_BANK3, IH_GPIO_BASE + 64, + METHOD_GPIO_7XX }, + { OMAP7XX_GPIO4_BASE, NULL, INT_7XX_GPIO_BANK4, IH_GPIO_BASE + 96, + METHOD_GPIO_7XX }, + { OMAP7XX_GPIO5_BASE, NULL, INT_7XX_GPIO_BANK5, IH_GPIO_BASE + 128, + METHOD_GPIO_7XX }, + { OMAP7XX_GPIO6_BASE, NULL, INT_7XX_GPIO_BANK6, IH_GPIO_BASE + 160, + METHOD_GPIO_7XX }, +}; + +static struct gpio_reg_offset omap1610_gpio_reg = { + .data_in= OMAP1610_GPIO_DATAIN, + .data_out = OMAP1610_GPIO_DATAOUT, + .data_out_set = OMAP1610_GPIO_SET_DATAOUT, + .data_out_clear = OMAP1610_GPIO_CLEAR_DATAOUT, + .dir_ctrl = OMAP1610_GPIO_DIRECTION, + .irq_status0= OMAP1610_GPIO_IRQSTATUS1, + .irq_mask = OMAP1610_GPIO_IRQENABLE1, + .irq_set= OMAP1610_GPIO_SET_IRQENABLE1, + .irq_clear = OMAP1610_GPIO_CLEAR_IRQENABLE1, + .irq_mask_bits = 0x, + .irq_inv= 0, + .wkup_enable= OMAP1610_GPIO_WAKEUPENABLE, + .wkup_clear = OMAP1610_GPIO_CLEAR_WAKEUPENA, + .wkup_set = OMAP1610_GPIO_SET_WAKEUPENA, + .syscfg = OMAP1610_GPIO_SYSCONFIG, +}; + +static struct gpio_reg_offset omap1510_gpio_reg = { + .data_in= OMAP1510_GPIO_DATA_INPUT, + .data_out = OMAP1510_GPIO_DATA_OUTPUT, + .dir_ctrl = OMAP1510_GPIO_DIR_CONTROL, + .irq_status0= OMAP1510_GPIO_INT_STATUS, + .irq_mask = OMAP1510_GPIO_INT_MASK, + .irq_mask_bits = 0x, + .irq_inv= 1, + .ctrl = OMAP1510_GPIO_PIN_CONTROL, +}; + +static struct gpio_reg_offset omap7xx_gpio_reg = { + .data_in= OMAP7XX_GPIO_DATA_INPUT, + .data_out = OMAP7XX_GPIO_DATA_OUTPUT, + .dir_ctrl = OMAP7XX_GPIO_DIR_CONTROL, + .irq_status0= OMAP7XX_GPIO_INT_STATUS, + .irq_mask = OMAP7XX_GPIO_INT_MASK, + .irq_mask_bits = 0x, + .irq_inv= 1, +}; + +static struct mpu_gpio_reg_off omap1_gpio_mpureg = { + .mpu_io_ctrl= OMAP_MPUIO_IO_CNTL, + .mpu_data_out = OMAP_MPUIO_OUTPUT, + .mpu_data_in= OMAP_MPUIO_INPUT_LATCH, + .mpu_isr= OMAP_MPUIO_GPIO_INT, + .mpu_irq_mask = OMAP_MPUIO_GPIO_MASKIT, + .mpu_irq_mask_bits = 0x, + .mpu_irq_inv= 1, +}; + +static struct gpio_bank *omap1_get_gpio_bank(int gpio, + struct gpio_bank *gpio_bank) +{ + if (cpu_is_omap15xx()) { + if (OMAP_GPIO_IS_MPUIO(gpio)) + return gpio_bank[0]; + return gpio_bank[1]; + } else if (cpu_is_omap16xx()) { + if (OMAP_GPIO_IS_MPUIO(gpio)) + return gpio_bank[0