2 * OMAP15xx specific gpio init
4 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
7 * Charulatha V <charu@ti.com>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
19 #include <linux/gpio.h>
20 #include <linux/platform_data/gpio-omap.h>
22 #define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE
23 #define OMAP1510_GPIO_BASE 0xFFFCE000
26 static struct __initdata resource omap15xx_mpu_gpio_resources[] = {
28 .start = OMAP1_MPUIO_VBASE,
29 .end = OMAP1_MPUIO_VBASE + SZ_2K - 1,
30 .flags = IORESOURCE_MEM,
34 .flags = IORESOURCE_IRQ,
38 static struct omap_gpio_reg_offs omap15xx_mpuio_regs = {
39 .revision = USHRT_MAX,
40 .direction = OMAP_MPUIO_IO_CNTL,
41 .datain = OMAP_MPUIO_INPUT_LATCH,
42 .dataout = OMAP_MPUIO_OUTPUT,
43 .irqstatus = OMAP_MPUIO_GPIO_INT,
44 .irqenable = OMAP_MPUIO_GPIO_MASKIT,
45 .irqenable_inv = true,
46 .irqctrl = OMAP_MPUIO_GPIO_INT_EDGE,
49 static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = {
53 .regs = &omap15xx_mpuio_regs,
56 static struct platform_device omap15xx_mpu_gpio = {
60 .platform_data = &omap15xx_mpu_gpio_config,
62 .num_resources = ARRAY_SIZE(omap15xx_mpu_gpio_resources),
63 .resource = omap15xx_mpu_gpio_resources,
67 static struct __initdata resource omap15xx_gpio_resources[] = {
69 .start = OMAP1510_GPIO_BASE,
70 .end = OMAP1510_GPIO_BASE + SZ_2K - 1,
71 .flags = IORESOURCE_MEM,
74 .start = INT_GPIO_BANK1,
75 .flags = IORESOURCE_IRQ,
79 static struct omap_gpio_reg_offs omap15xx_gpio_regs = {
80 .revision = USHRT_MAX,
81 .direction = OMAP1510_GPIO_DIR_CONTROL,
82 .datain = OMAP1510_GPIO_DATA_INPUT,
83 .dataout = OMAP1510_GPIO_DATA_OUTPUT,
84 .irqstatus = OMAP1510_GPIO_INT_STATUS,
85 .irqenable = OMAP1510_GPIO_INT_MASK,
86 .irqenable_inv = true,
87 .irqctrl = OMAP1510_GPIO_INT_CONTROL,
88 .pinctrl = OMAP1510_GPIO_PIN_CONTROL,
91 static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = {
93 .regs = &omap15xx_gpio_regs,
96 static struct platform_device omap15xx_gpio = {
100 .platform_data = &omap15xx_gpio_config,
102 .num_resources = ARRAY_SIZE(omap15xx_gpio_resources),
103 .resource = omap15xx_gpio_resources,
107 * omap15xx_gpio_init needs to be done before
108 * machine_init functions access gpio APIs.
109 * Hence omap15xx_gpio_init is a postcore_initcall.
111 static int __init omap15xx_gpio_init(void)
113 if (!cpu_is_omap15xx())
116 platform_device_register(&omap15xx_mpu_gpio);
117 platform_device_register(&omap15xx_gpio);
121 postcore_initcall(omap15xx_gpio_init);