gpio/omap: debounce remove SoC specific registers, use pdata
[deliverable/linux.git] / arch / arm / mach-omap1 / gpio15xx.c
CommitLineData
c95d10bc
VC
1/*
2 * OMAP15xx specific gpio init
3 *
4 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * Author:
7 * Charulatha V <charu@ti.com>
8 *
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.
12 *
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.
17 */
18
19#include <linux/gpio.h>
20
21#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE
22#define OMAP1510_GPIO_BASE 0xFFFCE000
23
24/* gpio1 */
25static struct __initdata resource omap15xx_mpu_gpio_resources[] = {
26 {
27 .start = OMAP1_MPUIO_VBASE,
28 .end = OMAP1_MPUIO_VBASE + SZ_2K - 1,
29 .flags = IORESOURCE_MEM,
30 },
31 {
32 .start = INT_MPUIO,
33 .flags = IORESOURCE_IRQ,
34 },
35};
36
fa87931a
KH
37static struct omap_gpio_reg_offs omap15xx_mpuio_regs = {
38 .direction = OMAP_MPUIO_IO_CNTL,
39 .datain = OMAP_MPUIO_INPUT_LATCH,
40 .dataout = OMAP_MPUIO_OUTPUT,
eef4bec7 41 .irqstatus = OMAP_MPUIO_GPIO_INT,
28f3b5a0
KH
42 .irqenable = OMAP_MPUIO_GPIO_MASKIT,
43 .irqenable_inv = true,
fa87931a
KH
44};
45
c95d10bc
VC
46static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = {
47 .virtual_irq_start = IH_MPUIO_BASE,
48 .bank_type = METHOD_MPUIO,
49 .bank_width = 16,
5de62b86 50 .bank_stride = 1,
fa87931a 51 .regs = &omap15xx_mpuio_regs,
c95d10bc
VC
52};
53
54static struct __initdata platform_device omap15xx_mpu_gpio = {
55 .name = "omap_gpio",
56 .id = 0,
57 .dev = {
58 .platform_data = &omap15xx_mpu_gpio_config,
59 },
60 .num_resources = ARRAY_SIZE(omap15xx_mpu_gpio_resources),
61 .resource = omap15xx_mpu_gpio_resources,
62};
63
64/* gpio2 */
65static struct __initdata resource omap15xx_gpio_resources[] = {
66 {
67 .start = OMAP1510_GPIO_BASE,
68 .end = OMAP1510_GPIO_BASE + SZ_2K - 1,
69 .flags = IORESOURCE_MEM,
70 },
71 {
72 .start = INT_GPIO_BANK1,
73 .flags = IORESOURCE_IRQ,
74 },
75};
76
fa87931a
KH
77static struct omap_gpio_reg_offs omap15xx_gpio_regs = {
78 .direction = OMAP1510_GPIO_DIR_CONTROL,
79 .datain = OMAP1510_GPIO_DATA_INPUT,
80 .dataout = OMAP1510_GPIO_DATA_OUTPUT,
eef4bec7 81 .irqstatus = OMAP1510_GPIO_INT_STATUS,
28f3b5a0
KH
82 .irqenable = OMAP1510_GPIO_INT_MASK,
83 .irqenable_inv = true,
fa87931a
KH
84};
85
c95d10bc
VC
86static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = {
87 .virtual_irq_start = IH_GPIO_BASE,
88 .bank_type = METHOD_GPIO_1510,
89 .bank_width = 16,
fa87931a 90 .regs = &omap15xx_gpio_regs,
c95d10bc
VC
91};
92
93static struct __initdata platform_device omap15xx_gpio = {
94 .name = "omap_gpio",
95 .id = 1,
96 .dev = {
97 .platform_data = &omap15xx_gpio_config,
98 },
99 .num_resources = ARRAY_SIZE(omap15xx_gpio_resources),
100 .resource = omap15xx_gpio_resources,
101};
102
103/*
104 * omap15xx_gpio_init needs to be done before
105 * machine_init functions access gpio APIs.
106 * Hence omap15xx_gpio_init is a postcore_initcall.
107 */
108static int __init omap15xx_gpio_init(void)
109{
110 if (!cpu_is_omap15xx())
111 return -EINVAL;
112
113 platform_device_register(&omap15xx_mpu_gpio);
114 platform_device_register(&omap15xx_gpio);
115
116 gpio_bank_count = 2;
117 return 0;
118}
119postcore_initcall(omap15xx_gpio_init);
This page took 0.06522 seconds and 5 git commands to generate.