2
* Coldfire generic GPIO support
4
* (C) Copyright 2009, Steven King <sfking@fdwdc.com>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
16
#include <linux/kernel.h>
17
#include <linux/init.h>
19
#include <asm/coldfire.h>
20
#include <asm/mcfsim.h>
21
#include <asm/mcfgpio.h>
23
static struct mcf_gpio_chip mcf_gpio_chips[] = {
27
.request = mcf_gpio_request,
28
.free = mcf_gpio_free,
29
.direction_input = mcf_gpio_direction_input,
30
.direction_output = mcf_gpio_direction_output,
31
.get = mcf_gpio_get_value,
32
.set = mcf_gpio_set_value,
35
.pddr = (void __iomem *) MCFEPORT_EPDDR,
36
.podr = (void __iomem *) MCFEPORT_EPDR,
37
.ppdr = (void __iomem *) MCFEPORT_EPPDR,
42
.request = mcf_gpio_request,
43
.free = mcf_gpio_free,
44
.direction_input = mcf_gpio_direction_input,
45
.direction_output = mcf_gpio_direction_output,
46
.get = mcf_gpio_get_value,
47
.set = mcf_gpio_set_value_fast,
51
.pddr = (void __iomem *) MCFGPIO_PDDR_CS,
52
.podr = (void __iomem *) MCFGPIO_PODR_CS,
53
.ppdr = (void __iomem *) MCFGPIO_PPDSDR_CS,
54
.setr = (void __iomem *) MCFGPIO_PPDSDR_CS,
55
.clrr = (void __iomem *) MCFGPIO_PCLRR_CS,
60
.request = mcf_gpio_request,
61
.free = mcf_gpio_free,
62
.direction_input = mcf_gpio_direction_input,
63
.direction_output = mcf_gpio_direction_output,
64
.get = mcf_gpio_get_value,
65
.set = mcf_gpio_set_value_fast,
69
.pddr = (void __iomem *) MCFGPIO_PDDR_FECI2C,
70
.podr = (void __iomem *) MCFGPIO_PODR_FECI2C,
71
.ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
72
.setr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
73
.clrr = (void __iomem *) MCFGPIO_PCLRR_FECI2C,
78
.request = mcf_gpio_request,
79
.free = mcf_gpio_free,
80
.direction_input = mcf_gpio_direction_input,
81
.direction_output = mcf_gpio_direction_output,
82
.get = mcf_gpio_get_value,
83
.set = mcf_gpio_set_value_fast,
87
.pddr = (void __iomem *) MCFGPIO_PDDR_QSPI,
88
.podr = (void __iomem *) MCFGPIO_PODR_QSPI,
89
.ppdr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
90
.setr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
91
.clrr = (void __iomem *) MCFGPIO_PCLRR_QSPI,
96
.request = mcf_gpio_request,
97
.free = mcf_gpio_free,
98
.direction_input = mcf_gpio_direction_input,
99
.direction_output = mcf_gpio_direction_output,
100
.get = mcf_gpio_get_value,
101
.set = mcf_gpio_set_value_fast,
105
.pddr = (void __iomem *) MCFGPIO_PDDR_TIMER,
106
.podr = (void __iomem *) MCFGPIO_PODR_TIMER,
107
.ppdr = (void __iomem *) MCFGPIO_PPDSDR_TIMER,
108
.setr = (void __iomem *) MCFGPIO_PPDSDR_TIMER,
109
.clrr = (void __iomem *) MCFGPIO_PCLRR_TIMER,
114
.request = mcf_gpio_request,
115
.free = mcf_gpio_free,
116
.direction_input = mcf_gpio_direction_input,
117
.direction_output = mcf_gpio_direction_output,
118
.get = mcf_gpio_get_value,
119
.set = mcf_gpio_set_value_fast,
123
.pddr = (void __iomem *) MCFGPIO_PDDR_UART,
124
.podr = (void __iomem *) MCFGPIO_PODR_UART,
125
.ppdr = (void __iomem *) MCFGPIO_PPDSDR_UART,
126
.setr = (void __iomem *) MCFGPIO_PPDSDR_UART,
127
.clrr = (void __iomem *) MCFGPIO_PCLRR_UART,
132
.request = mcf_gpio_request,
133
.free = mcf_gpio_free,
134
.direction_input = mcf_gpio_direction_input,
135
.direction_output = mcf_gpio_direction_output,
136
.get = mcf_gpio_get_value,
137
.set = mcf_gpio_set_value_fast,
141
.pddr = (void __iomem *) MCFGPIO_PDDR_FECH,
142
.podr = (void __iomem *) MCFGPIO_PODR_FECH,
143
.ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECH,
144
.setr = (void __iomem *) MCFGPIO_PPDSDR_FECH,
145
.clrr = (void __iomem *) MCFGPIO_PCLRR_FECH,
150
.request = mcf_gpio_request,
151
.free = mcf_gpio_free,
152
.direction_input = mcf_gpio_direction_input,
153
.direction_output = mcf_gpio_direction_output,
154
.get = mcf_gpio_get_value,
155
.set = mcf_gpio_set_value_fast,
159
.pddr = (void __iomem *) MCFGPIO_PDDR_FECL,
160
.podr = (void __iomem *) MCFGPIO_PODR_FECL,
161
.ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECL,
162
.setr = (void __iomem *) MCFGPIO_PPDSDR_FECL,
163
.clrr = (void __iomem *) MCFGPIO_PCLRR_FECL,
167
static int __init mcf_gpio_init(void)
170
while (i < ARRAY_SIZE(mcf_gpio_chips))
171
(void)gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]);
175
core_initcall(mcf_gpio_init);