1 // SPDX-License-Identifier: GPL-2.0-only
3 * OMAP15xx specific gpio init
5 * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/
8 * Charulatha V <charu@ti.com>
11 #include <linux/platform_data/gpio-omap.h>
12 #include <linux/soc/ti/omap1-soc.h>
17 #define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE
18 #define OMAP1510_GPIO_BASE 0xFFFCE000
21 static struct resource omap15xx_mpu_gpio_resources
[] = {
23 .start
= OMAP1_MPUIO_VBASE
,
24 .end
= OMAP1_MPUIO_VBASE
+ SZ_2K
- 1,
25 .flags
= IORESOURCE_MEM
,
29 .flags
= IORESOURCE_IRQ
,
33 static struct omap_gpio_reg_offs omap15xx_mpuio_regs
= {
34 .revision
= USHRT_MAX
,
35 .direction
= OMAP_MPUIO_IO_CNTL
,
36 .datain
= OMAP_MPUIO_INPUT_LATCH
,
37 .dataout
= OMAP_MPUIO_OUTPUT
,
38 .irqstatus
= OMAP_MPUIO_GPIO_INT
,
39 .irqenable
= OMAP_MPUIO_GPIO_MASKIT
,
40 .irqenable_inv
= true,
41 .irqctrl
= OMAP_MPUIO_GPIO_INT_EDGE
,
44 static struct omap_gpio_platform_data omap15xx_mpu_gpio_config
= {
48 .regs
= &omap15xx_mpuio_regs
,
51 static struct platform_device omap15xx_mpu_gpio
= {
55 .platform_data
= &omap15xx_mpu_gpio_config
,
57 .num_resources
= ARRAY_SIZE(omap15xx_mpu_gpio_resources
),
58 .resource
= omap15xx_mpu_gpio_resources
,
62 static struct resource omap15xx_gpio_resources
[] = {
64 .start
= OMAP1510_GPIO_BASE
,
65 .end
= OMAP1510_GPIO_BASE
+ SZ_2K
- 1,
66 .flags
= IORESOURCE_MEM
,
69 .start
= INT_GPIO_BANK1
,
70 .flags
= IORESOURCE_IRQ
,
74 static struct omap_gpio_reg_offs omap15xx_gpio_regs
= {
75 .revision
= USHRT_MAX
,
76 .direction
= OMAP1510_GPIO_DIR_CONTROL
,
77 .datain
= OMAP1510_GPIO_DATA_INPUT
,
78 .dataout
= OMAP1510_GPIO_DATA_OUTPUT
,
79 .irqstatus
= OMAP1510_GPIO_INT_STATUS
,
80 .irqenable
= OMAP1510_GPIO_INT_MASK
,
81 .irqenable_inv
= true,
82 .irqctrl
= OMAP1510_GPIO_INT_CONTROL
,
83 .pinctrl
= OMAP1510_GPIO_PIN_CONTROL
,
86 static struct omap_gpio_platform_data omap15xx_gpio_config
= {
88 .regs
= &omap15xx_gpio_regs
,
91 static struct platform_device omap15xx_gpio
= {
95 .platform_data
= &omap15xx_gpio_config
,
97 .num_resources
= ARRAY_SIZE(omap15xx_gpio_resources
),
98 .resource
= omap15xx_gpio_resources
,
102 * omap15xx_gpio_init needs to be done before
103 * machine_init functions access gpio APIs.
104 * Hence omap15xx_gpio_init is a postcore_initcall.
106 static int __init
omap15xx_gpio_init(void)
108 if (!cpu_is_omap15xx())
111 platform_device_register(&omap15xx_mpu_gpio
);
112 platform_device_register(&omap15xx_gpio
);
116 postcore_initcall(omap15xx_gpio_init
);