diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
| commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
| tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /arch/m68k/platform/528x | |
| parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) | |
Diffstat (limited to 'arch/m68k/platform/528x')
| -rw-r--r-- | arch/m68k/platform/528x/Makefile | 18 | ||||
| -rw-r--r-- | arch/m68k/platform/528x/config.c | 320 | ||||
| -rw-r--r-- | arch/m68k/platform/528x/gpio.c | 438 |
3 files changed, 776 insertions, 0 deletions
diff --git a/arch/m68k/platform/528x/Makefile b/arch/m68k/platform/528x/Makefile new file mode 100644 index 00000000000..6ac4b57370e --- /dev/null +++ b/arch/m68k/platform/528x/Makefile | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | # | ||
| 2 | # Makefile for the linux kernel. | ||
| 3 | # | ||
| 4 | |||
| 5 | # | ||
| 6 | # If you want to play with the HW breakpoints then you will | ||
| 7 | # need to add define this, which will give you a stack backtrace | ||
| 8 | # on the console port whenever a DBG interrupt occurs. You have to | ||
| 9 | # set up you HW breakpoints to trigger a DBG interrupt: | ||
| 10 | # | ||
| 11 | # ccflags-y := -DTRAP_DBG_INTERRUPT | ||
| 12 | # asflags-y := -DTRAP_DBG_INTERRUPT | ||
| 13 | # | ||
| 14 | |||
| 15 | asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1 | ||
| 16 | |||
| 17 | obj-y := config.o gpio.o | ||
| 18 | |||
diff --git a/arch/m68k/platform/528x/config.c b/arch/m68k/platform/528x/config.c new file mode 100644 index 00000000000..7abe77a2f3e --- /dev/null +++ b/arch/m68k/platform/528x/config.c | |||
| @@ -0,0 +1,320 @@ | |||
| 1 | /***************************************************************************/ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * linux/arch/m68knommu/platform/528x/config.c | ||
| 5 | * | ||
| 6 | * Sub-architcture dependent initialization code for the Freescale | ||
| 7 | * 5280, 5281 and 5282 CPUs. | ||
| 8 | * | ||
| 9 | * Copyright (C) 1999-2003, Greg Ungerer (gerg@snapgear.com) | ||
| 10 | * Copyright (C) 2001-2003, SnapGear Inc. (www.snapgear.com) | ||
| 11 | */ | ||
| 12 | |||
| 13 | /***************************************************************************/ | ||
| 14 | |||
| 15 | #include <linux/kernel.h> | ||
| 16 | #include <linux/param.h> | ||
| 17 | #include <linux/init.h> | ||
| 18 | #include <linux/platform_device.h> | ||
| 19 | #include <linux/io.h> | ||
| 20 | #include <linux/spi/spi.h> | ||
| 21 | #include <linux/gpio.h> | ||
| 22 | #include <asm/machdep.h> | ||
| 23 | #include <asm/coldfire.h> | ||
| 24 | #include <asm/mcfsim.h> | ||
| 25 | #include <asm/mcfuart.h> | ||
| 26 | #include <asm/mcfqspi.h> | ||
| 27 | |||
| 28 | /***************************************************************************/ | ||
| 29 | |||
| 30 | static struct mcf_platform_uart m528x_uart_platform[] = { | ||
| 31 | { | ||
| 32 | .mapbase = MCFUART_BASE1, | ||
| 33 | .irq = MCFINT_VECBASE + MCFINT_UART0, | ||
| 34 | }, | ||
| 35 | { | ||
| 36 | .mapbase = MCFUART_BASE2, | ||
| 37 | .irq = MCFINT_VECBASE + MCFINT_UART0 + 1, | ||
| 38 | }, | ||
| 39 | { | ||
| 40 | .mapbase = MCFUART_BASE3, | ||
| 41 | .irq = MCFINT_VECBASE + MCFINT_UART0 + 2, | ||
| 42 | }, | ||
| 43 | { }, | ||
| 44 | }; | ||
| 45 | |||
| 46 | static struct platform_device m528x_uart = { | ||
| 47 | .name = "mcfuart", | ||
| 48 | .id = 0, | ||
| 49 | .dev.platform_data = m528x_uart_platform, | ||
| 50 | }; | ||
| 51 | |||
| 52 | static struct resource m528x_fec_resources[] = { | ||
| 53 | { | ||
| 54 | .start = MCFFEC_BASE, | ||
| 55 | .end = MCFFEC_BASE + MCFFEC_SIZE - 1, | ||
| 56 | .flags = IORESOURCE_MEM, | ||
| 57 | }, | ||
| 58 | { | ||
| 59 | .start = 64 + 23, | ||
| 60 | .end = 64 + 23, | ||
| 61 | .flags = IORESOURCE_IRQ, | ||
| 62 | }, | ||
| 63 | { | ||
| 64 | .start = 64 + 27, | ||
| 65 | .end = 64 + 27, | ||
| 66 | .flags = IORESOURCE_IRQ, | ||
| 67 | }, | ||
| 68 | { | ||
| 69 | .start = 64 + 29, | ||
| 70 | .end = 64 + 29, | ||
| 71 | .flags = IORESOURCE_IRQ, | ||
| 72 | }, | ||
| 73 | }; | ||
| 74 | |||
| 75 | static struct platform_device m528x_fec = { | ||
| 76 | .name = "fec", | ||
| 77 | .id = 0, | ||
| 78 | .num_resources = ARRAY_SIZE(m528x_fec_resources), | ||
| 79 | .resource = m528x_fec_resources, | ||
| 80 | }; | ||
| 81 | |||
| 82 | #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) | ||
| 83 | static struct resource m528x_qspi_resources[] = { | ||
| 84 | { | ||
| 85 | .start = MCFQSPI_IOBASE, | ||
| 86 | .end = MCFQSPI_IOBASE + MCFQSPI_IOSIZE - 1, | ||
| 87 | .flags = IORESOURCE_MEM, | ||
| 88 | }, | ||
| 89 | { | ||
| 90 | .start = MCFINT_VECBASE + MCFINT_QSPI, | ||
| 91 | .end = MCFINT_VECBASE + MCFINT_QSPI, | ||
| 92 | .flags = IORESOURCE_IRQ, | ||
| 93 | }, | ||
| 94 | }; | ||
| 95 | |||
| 96 | #define MCFQSPI_CS0 147 | ||
| 97 | #define MCFQSPI_CS1 148 | ||
| 98 | #define MCFQSPI_CS2 149 | ||
| 99 | #define MCFQSPI_CS3 150 | ||
| 100 | |||
| 101 | static int m528x_cs_setup(struct mcfqspi_cs_control *cs_control) | ||
| 102 | { | ||
| 103 | int status; | ||
| 104 | |||
| 105 | status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0"); | ||
| 106 | if (status) { | ||
| 107 | pr_debug("gpio_request for MCFQSPI_CS0 failed\n"); | ||
| 108 | goto fail0; | ||
| 109 | } | ||
| 110 | status = gpio_direction_output(MCFQSPI_CS0, 1); | ||
| 111 | if (status) { | ||
| 112 | pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n"); | ||
| 113 | goto fail1; | ||
| 114 | } | ||
| 115 | |||
| 116 | status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1"); | ||
| 117 | if (status) { | ||
| 118 | pr_debug("gpio_request for MCFQSPI_CS1 failed\n"); | ||
| 119 | goto fail1; | ||
| 120 | } | ||
| 121 | status = gpio_direction_output(MCFQSPI_CS1, 1); | ||
| 122 | if (status) { | ||
| 123 | pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n"); | ||
| 124 | goto fail2; | ||
| 125 | } | ||
| 126 | |||
| 127 | status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2"); | ||
| 128 | if (status) { | ||
| 129 | pr_debug("gpio_request for MCFQSPI_CS2 failed\n"); | ||
| 130 | goto fail2; | ||
| 131 | } | ||
| 132 | status = gpio_direction_output(MCFQSPI_CS2, 1); | ||
| 133 | if (status) { | ||
| 134 | pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n"); | ||
| 135 | goto fail3; | ||
| 136 | } | ||
| 137 | |||
| 138 | status = gpio_request(MCFQSPI_CS3, "MCFQSPI_CS3"); | ||
| 139 | if (status) { | ||
| 140 | pr_debug("gpio_request for MCFQSPI_CS3 failed\n"); | ||
| 141 | goto fail3; | ||
| 142 | } | ||
| 143 | status = gpio_direction_output(MCFQSPI_CS3, 1); | ||
| 144 | if (status) { | ||
| 145 | pr_debug("gpio_direction_output for MCFQSPI_CS3 failed\n"); | ||
| 146 | goto fail4; | ||
| 147 | } | ||
| 148 | |||
| 149 | return 0; | ||
| 150 | |||
| 151 | fail4: | ||
| 152 | gpio_free(MCFQSPI_CS3); | ||
| 153 | fail3: | ||
| 154 | gpio_free(MCFQSPI_CS2); | ||
| 155 | fail2: | ||
| 156 | gpio_free(MCFQSPI_CS1); | ||
| 157 | fail1: | ||
| 158 | gpio_free(MCFQSPI_CS0); | ||
| 159 | fail0: | ||
| 160 | return status; | ||
| 161 | } | ||
| 162 | |||
| 163 | static void m528x_cs_teardown(struct mcfqspi_cs_control *cs_control) | ||
| 164 | { | ||
| 165 | gpio_free(MCFQSPI_CS3); | ||
| 166 | gpio_free(MCFQSPI_CS2); | ||
| 167 | gpio_free(MCFQSPI_CS1); | ||
| 168 | gpio_free(MCFQSPI_CS0); | ||
| 169 | } | ||
| 170 | |||
| 171 | static void m528x_cs_select(struct mcfqspi_cs_control *cs_control, | ||
| 172 | u8 chip_select, bool cs_high) | ||
| 173 | { | ||
| 174 | gpio_set_value(MCFQSPI_CS0 + chip_select, cs_high); | ||
| 175 | } | ||
| 176 | |||
| 177 | static void m528x_cs_deselect(struct mcfqspi_cs_control *cs_control, | ||
| 178 | u8 chip_select, bool cs_high) | ||
| 179 | { | ||
| 180 | gpio_set_value(MCFQSPI_CS0 + chip_select, !cs_high); | ||
| 181 | } | ||
| 182 | |||
| 183 | static struct mcfqspi_cs_control m528x_cs_control = { | ||
| 184 | .setup = m528x_cs_setup, | ||
| 185 | .teardown = m528x_cs_teardown, | ||
| 186 | .select = m528x_cs_select, | ||
| 187 | .deselect = m528x_cs_deselect, | ||
| 188 | }; | ||
| 189 | |||
| 190 | static struct mcfqspi_platform_data m528x_qspi_data = { | ||
| 191 | .bus_num = 0, | ||
| 192 | .num_chipselect = 4, | ||
| 193 | .cs_control = &m528x_cs_control, | ||
| 194 | }; | ||
| 195 | |||
| 196 | static struct platform_device m528x_qspi = { | ||
| 197 | .name = "mcfqspi", | ||
| 198 | .id = 0, | ||
| 199 | .num_resources = ARRAY_SIZE(m528x_qspi_resources), | ||
| 200 | .resource = m528x_qspi_resources, | ||
| 201 | .dev.platform_data = &m528x_qspi_data, | ||
| 202 | }; | ||
| 203 | |||
| 204 | static void __init m528x_qspi_init(void) | ||
| 205 | { | ||
| 206 | /* setup Port QS for QSPI with gpio CS control */ | ||
| 207 | __raw_writeb(0x07, MCFGPIO_PQSPAR); | ||
| 208 | } | ||
| 209 | #endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */ | ||
| 210 | |||
| 211 | static struct platform_device *m528x_devices[] __initdata = { | ||
| 212 | &m528x_uart, | ||
| 213 | &m528x_fec, | ||
| 214 | #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) | ||
| 215 | &m528x_qspi, | ||
| 216 | #endif | ||
| 217 | }; | ||
| 218 | |||
| 219 | /***************************************************************************/ | ||
| 220 | |||
| 221 | static void __init m528x_uart_init_line(int line, int irq) | ||
| 222 | { | ||
| 223 | u8 port; | ||
| 224 | |||
| 225 | if ((line < 0) || (line > 2)) | ||
| 226 | return; | ||
| 227 | |||
| 228 | /* make sure PUAPAR is set for UART0 and UART1 */ | ||
| 229 | if (line < 2) { | ||
| 230 | port = readb(MCF5282_GPIO_PUAPAR); | ||
| 231 | port |= (0x03 << (line * 2)); | ||
| 232 | writeb(port, MCF5282_GPIO_PUAPAR); | ||
| 233 | } | ||
| 234 | } | ||
| 235 | |||
| 236 | static void __init m528x_uarts_init(void) | ||
| 237 | { | ||
| 238 | const int nrlines = ARRAY_SIZE(m528x_uart_platform); | ||
| 239 | int line; | ||
| 240 | |||
| 241 | for (line = 0; (line < nrlines); line++) | ||
| 242 | m528x_uart_init_line(line, m528x_uart_platform[line].irq); | ||
| 243 | } | ||
| 244 | |||
| 245 | /***************************************************************************/ | ||
| 246 | |||
| 247 | static void __init m528x_fec_init(void) | ||
| 248 | { | ||
| 249 | u16 v16; | ||
| 250 | |||
| 251 | /* Set multi-function pins to ethernet mode for fec0 */ | ||
| 252 | v16 = readw(MCF_IPSBAR + 0x100056); | ||
| 253 | writew(v16 | 0xf00, MCF_IPSBAR + 0x100056); | ||
| 254 | writeb(0xc0, MCF_IPSBAR + 0x100058); | ||
| 255 | } | ||
| 256 | |||
| 257 | /***************************************************************************/ | ||
| 258 | |||
| 259 | static void m528x_cpu_reset(void) | ||
| 260 | { | ||
| 261 | local_irq_disable(); | ||
| 262 | __raw_writeb(MCF_RCR_SWRESET, MCF_IPSBAR + MCF_RCR); | ||
| 263 | } | ||
| 264 | |||
| 265 | /***************************************************************************/ | ||
| 266 | |||
| 267 | #ifdef CONFIG_WILDFIRE | ||
| 268 | void wildfire_halt(void) | ||
| 269 | { | ||
| 270 | writeb(0, 0x30000007); | ||
| 271 | writeb(0x2, 0x30000007); | ||
| 272 | } | ||
| 273 | #endif | ||
| 274 | |||
| 275 | #ifdef CONFIG_WILDFIREMOD | ||
| 276 | void wildfiremod_halt(void) | ||
| 277 | { | ||
| 278 | printk(KERN_INFO "WildFireMod hibernating...\n"); | ||
| 279 | |||
| 280 | /* Set portE.5 to Digital IO */ | ||
| 281 | MCF5282_GPIO_PEPAR &= ~(1 << (5 * 2)); | ||
| 282 | |||
| 283 | /* Make portE.5 an output */ | ||
| 284 | MCF5282_GPIO_DDRE |= (1 << 5); | ||
| 285 | |||
| 286 | /* Now toggle portE.5 from low to high */ | ||
| 287 | MCF5282_GPIO_PORTE &= ~(1 << 5); | ||
| 288 | MCF5282_GPIO_PORTE |= (1 << 5); | ||
| 289 | |||
| 290 | printk(KERN_EMERG "Failed to hibernate. Halting!\n"); | ||
| 291 | } | ||
| 292 | #endif | ||
| 293 | |||
| 294 | void __init config_BSP(char *commandp, int size) | ||
| 295 | { | ||
| 296 | #ifdef CONFIG_WILDFIRE | ||
| 297 | mach_halt = wildfire_halt; | ||
| 298 | #endif | ||
| 299 | #ifdef CONFIG_WILDFIREMOD | ||
| 300 | mach_halt = wildfiremod_halt; | ||
| 301 | #endif | ||
| 302 | } | ||
| 303 | |||
| 304 | /***************************************************************************/ | ||
| 305 | |||
| 306 | static int __init init_BSP(void) | ||
| 307 | { | ||
| 308 | mach_reset = m528x_cpu_reset; | ||
| 309 | m528x_uarts_init(); | ||
| 310 | m528x_fec_init(); | ||
| 311 | #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) | ||
| 312 | m528x_qspi_init(); | ||
| 313 | #endif | ||
| 314 | platform_add_devices(m528x_devices, ARRAY_SIZE(m528x_devices)); | ||
| 315 | return 0; | ||
| 316 | } | ||
| 317 | |||
| 318 | arch_initcall(init_BSP); | ||
| 319 | |||
| 320 | /***************************************************************************/ | ||
diff --git a/arch/m68k/platform/528x/gpio.c b/arch/m68k/platform/528x/gpio.c new file mode 100644 index 00000000000..526db665d87 --- /dev/null +++ b/arch/m68k/platform/528x/gpio.c | |||
| @@ -0,0 +1,438 @@ | |||
| 1 | /* | ||
| 2 | * Coldfire generic GPIO support | ||
| 3 | * | ||
| 4 | * (C) Copyright 2009, Steven King <sfking@fdwdc.com> | ||
| 5 | * | ||
| 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. | ||
| 9 | * | ||
| 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. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <linux/kernel.h> | ||
| 17 | #include <linux/init.h> | ||
| 18 | |||
| 19 | #include <asm/coldfire.h> | ||
| 20 | #include <asm/mcfsim.h> | ||
| 21 | #include <asm/mcfgpio.h> | ||
| 22 | |||
| 23 | static struct mcf_gpio_chip mcf_gpio_chips[] = { | ||
| 24 | { | ||
| 25 | .gpio_chip = { | ||
| 26 | .label = "NQ", | ||
| 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, | ||
| 33 | .base = 1, | ||
| 34 | .ngpio = 7, | ||
| 35 | }, | ||
| 36 | .pddr = (void __iomem *)MCFEPORT_EPDDR, | ||
| 37 | .podr = (void __iomem *)MCFEPORT_EPDR, | ||
| 38 | .ppdr = (void __iomem *)MCFEPORT_EPPDR, | ||
| 39 | }, | ||
| 40 | { | ||
| 41 | .gpio_chip = { | ||
| 42 | .label = "TA", | ||
| 43 | .request = mcf_gpio_request, | ||
| 44 | .free = mcf_gpio_free, | ||
| 45 | .direction_input = mcf_gpio_direction_input, | ||
| 46 | .direction_output = mcf_gpio_direction_output, | ||
| 47 | .get = mcf_gpio_get_value, | ||
| 48 | .set = mcf_gpio_set_value_fast, | ||
| 49 | .base = 8, | ||
| 50 | .ngpio = 4, | ||
| 51 | }, | ||
| 52 | .pddr = (void __iomem *)MCFGPTA_GPTDDR, | ||
| 53 | .podr = (void __iomem *)MCFGPTA_GPTPORT, | ||
| 54 | .ppdr = (void __iomem *)MCFGPTB_GPTPORT, | ||
| 55 | }, | ||
| 56 | { | ||
| 57 | .gpio_chip = { | ||
| 58 | .label = "TB", | ||
| 59 | .request = mcf_gpio_request, | ||
| 60 | .free = mcf_gpio_free, | ||
| 61 | .direction_input = mcf_gpio_direction_input, | ||
| 62 | .direction_output = mcf_gpio_direction_output, | ||
| 63 | .get = mcf_gpio_get_value, | ||
| 64 | .set = mcf_gpio_set_value_fast, | ||
| 65 | .base = 16, | ||
| 66 | .ngpio = 4, | ||
| 67 | }, | ||
| 68 | .pddr = (void __iomem *)MCFGPTB_GPTDDR, | ||
| 69 | .podr = (void __iomem *)MCFGPTB_GPTPORT, | ||
| 70 | .ppdr = (void __iomem *)MCFGPTB_GPTPORT, | ||
| 71 | }, | ||
| 72 | { | ||
| 73 | .gpio_chip = { | ||
| 74 | .label = "QA", | ||
| 75 | .request = mcf_gpio_request, | ||
| 76 | .free = mcf_gpio_free, | ||
| 77 | .direction_input = mcf_gpio_direction_input, | ||
| 78 | .direction_output = mcf_gpio_direction_output, | ||
| 79 | .get = mcf_gpio_get_value, | ||
| 80 | .set = mcf_gpio_set_value_fast, | ||
| 81 | .base = 24, | ||
| 82 | .ngpio = 4, | ||
| 83 | }, | ||
| 84 | .pddr = (void __iomem *)MCFQADC_DDRQA, | ||
| 85 | .podr = (void __iomem *)MCFQADC_PORTQA, | ||
| 86 | .ppdr = (void __iomem *)MCFQADC_PORTQA, | ||
| 87 | }, | ||
| 88 | { | ||
| 89 | .gpio_chip = { | ||
| 90 | .label = "QB", | ||
| 91 | .request = mcf_gpio_request, | ||
| 92 | .free = mcf_gpio_free, | ||
| 93 | .direction_input = mcf_gpio_direction_input, | ||
| 94 | .direction_output = mcf_gpio_direction_output, | ||
| 95 | .get = mcf_gpio_get_value, | ||
| 96 | .set = mcf_gpio_set_value_fast, | ||
| 97 | .base = 32, | ||
| 98 | .ngpio = 4, | ||
| 99 | }, | ||
| 100 | .pddr = (void __iomem *)MCFQADC_DDRQB, | ||
| 101 | .podr = (void __iomem *)MCFQADC_PORTQB, | ||
| 102 | .ppdr = (void __iomem *)MCFQADC_PORTQB, | ||
| 103 | }, | ||
| 104 | { | ||
| 105 | .gpio_chip = { | ||
| 106 | .label = "A", | ||
| 107 | .request = mcf_gpio_request, | ||
| 108 | .free = mcf_gpio_free, | ||
| 109 | .direction_input = mcf_gpio_direction_input, | ||
| 110 | .direction_output = mcf_gpio_direction_output, | ||
| 111 | .get = mcf_gpio_get_value, | ||
| 112 | .set = mcf_gpio_set_value_fast, | ||
| 113 | .base = 40, | ||
| 114 | .ngpio = 8, | ||
| 115 | }, | ||
| 116 | .pddr = (void __iomem *)MCFGPIO_DDRA, | ||
| 117 | .podr = (void __iomem *)MCFGPIO_PORTA, | ||
| 118 | .ppdr = (void __iomem *)MCFGPIO_PORTAP, | ||
| 119 | .setr = (void __iomem *)MCFGPIO_SETA, | ||
| 120 | .clrr = (void __iomem *)MCFGPIO_CLRA, | ||
| 121 | }, | ||
| 122 | { | ||
| 123 | .gpio_chip = { | ||
| 124 | .label = "B", | ||
| 125 | .request = mcf_gpio_request, | ||
| 126 | .free = mcf_gpio_free, | ||
| 127 | .direction_input = mcf_gpio_direction_input, | ||
| 128 | .direction_output = mcf_gpio_direction_output, | ||
| 129 | .get = mcf_gpio_get_value, | ||
| 130 | .set = mcf_gpio_set_value_fast, | ||
| 131 | .base = 48, | ||
| 132 | .ngpio = 8, | ||
| 133 | }, | ||
| 134 | .pddr = (void __iomem *)MCFGPIO_DDRB, | ||
| 135 | .podr = (void __iomem *)MCFGPIO_PORTB, | ||
| 136 | .ppdr = (void __iomem *)MCFGPIO_PORTBP, | ||
| 137 | .setr = (void __iomem *)MCFGPIO_SETB, | ||
| 138 | .clrr = (void __iomem *)MCFGPIO_CLRB, | ||
| 139 | }, | ||
| 140 | { | ||
| 141 | .gpio_chip = { | ||
| 142 | .label = "C", | ||
| 143 | .request = mcf_gpio_request, | ||
| 144 | .free = mcf_gpio_free, | ||
| 145 | .direction_input = mcf_gpio_direction_input, | ||
| 146 | .direction_output = mcf_gpio_direction_output, | ||
| 147 | .get = mcf_gpio_get_value, | ||
| 148 | .set = mcf_gpio_set_value_fast, | ||
| 149 | .base = 56, | ||
| 150 | .ngpio = 8, | ||
| 151 | }, | ||
| 152 | .pddr = (void __iomem *)MCFGPIO_DDRC, | ||
| 153 | .podr = (void __iomem *)MCFGPIO_PORTC, | ||
| 154 | .ppdr = (void __iomem *)MCFGPIO_PORTCP, | ||
| 155 | .setr = (void __iomem *)MCFGPIO_SETC, | ||
| 156 | .clrr = (void __iomem *)MCFGPIO_CLRC, | ||
| 157 | }, | ||
| 158 | { | ||
| 159 | .gpio_chip = { | ||
| 160 | .label = "D", | ||
| 161 | .request = mcf_gpio_request, | ||
| 162 | .free = mcf_gpio_free, | ||
| 163 | .direction_input = mcf_gpio_direction_input, | ||
| 164 | .direction_output = mcf_gpio_direction_output, | ||
| 165 | .get = mcf_gpio_get_value, | ||
| 166 | .set = mcf_gpio_set_value_fast, | ||
| 167 | .base = 64, | ||
| 168 | .ngpio = 8, | ||
| 169 | }, | ||
| 170 | .pddr = (void __iomem *)MCFGPIO_DDRD, | ||
| 171 | .podr = (void __iomem *)MCFGPIO_PORTD, | ||
| 172 | .ppdr = (void __iomem *)MCFGPIO_PORTDP, | ||
| 173 | .setr = (void __iomem *)MCFGPIO_SETD, | ||
| 174 | .clrr = (void __iomem *)MCFGPIO_CLRD, | ||
| 175 | }, | ||
| 176 | { | ||
| 177 | .gpio_chip = { | ||
| 178 | .label = "E", | ||
| 179 | .request = mcf_gpio_request, | ||
| 180 | .free = mcf_gpio_free, | ||
| 181 | .direction_input = mcf_gpio_direction_input, | ||
| 182 | .direction_output = mcf_gpio_direction_output, | ||
| 183 | .get = mcf_gpio_get_value, | ||
| 184 | .set = mcf_gpio_set_value_fast, | ||
| 185 | .base = 72, | ||
| 186 | .ngpio = 8, | ||
| 187 | }, | ||
| 188 | .pddr = (void __iomem *)MCFGPIO_DDRE, | ||
| 189 | .podr = (void __iomem *)MCFGPIO_PORTE, | ||
| 190 | .ppdr = (void __iomem *)MCFGPIO_PORTEP, | ||
| 191 | .setr = (void __iomem *)MCFGPIO_SETE, | ||
| 192 | .clrr = (void __iomem *)MCFGPIO_CLRE, | ||
| 193 | }, | ||
| 194 | { | ||
| 195 | .gpio_chip = { | ||
| 196 | .label = "F", | ||
| 197 | .request = mcf_gpio_request, | ||
| 198 | .free = mcf_gpio_free, | ||
| 199 | .direction_input = mcf_gpio_direction_input, | ||
| 200 | .direction_output = mcf_gpio_direction_output, | ||
| 201 | .get = mcf_gpio_get_value, | ||
| 202 | .set = mcf_gpio_set_value_fast, | ||
| 203 | .base = 80, | ||
| 204 | .ngpio = 8, | ||
| 205 | }, | ||
| 206 | .pddr = (void __iomem *)MCFGPIO_DDRF, | ||
| 207 | .podr = (void __iomem *)MCFGPIO_PORTF, | ||
| 208 | .ppdr = (void __iomem *)MCFGPIO_PORTFP, | ||
| 209 | .setr = (void __iomem *)MCFGPIO_SETF, | ||
| 210 | .clrr = (void __iomem *)MCFGPIO_CLRF, | ||
| 211 | }, | ||
| 212 | { | ||
| 213 | .gpio_chip = { | ||
| 214 | .label = "G", | ||
| 215 | .request = mcf_gpio_request, | ||
| 216 | .free = mcf_gpio_free, | ||
| 217 | .direction_input = mcf_gpio_direction_input, | ||
| 218 | .direction_output = mcf_gpio_direction_output, | ||
| 219 | .get = mcf_gpio_get_value, | ||
| 220 | .set = mcf_gpio_set_value_fast, | ||
| 221 | .base = 88, | ||
| 222 | .ngpio = 8, | ||
| 223 | }, | ||
| 224 | .pddr = (void __iomem *)MCFGPIO_DDRG, | ||
| 225 | .podr = (void __iomem *)MCFGPIO_PORTG, | ||
| 226 | .ppdr = (void __iomem *)MCFGPIO_PORTGP, | ||
| 227 | .setr = (void __iomem *)MCFGPIO_SETG, | ||
| 228 | .clrr = (void __iomem *)MCFGPIO_CLRG, | ||
| 229 | }, | ||
| 230 | { | ||
| 231 | .gpio_chip = { | ||
| 232 | .label = "H", | ||
| 233 | .request = mcf_gpio_request, | ||
| 234 | .free = mcf_gpio_free, | ||
| 235 | .direction_input = mcf_gpio_direction_input, | ||
| 236 | .direction_output = mcf_gpio_direction_output, | ||
| 237 | .get = mcf_gpio_get_value, | ||
| 238 | .set = mcf_gpio_set_value_fast, | ||
| 239 | .base = 96, | ||
| 240 | .ngpio = 8, | ||
| 241 | }, | ||
| 242 | .pddr = (void __iomem *)MCFGPIO_DDRH, | ||
| 243 | .podr = (void __iomem *)MCFGPIO_PORTH, | ||
| 244 | .ppdr = (void __iomem *)MCFGPIO_PORTHP, | ||
| 245 | .setr = (void __iomem *)MCFGPIO_SETH, | ||
| 246 | .clrr = (void __iomem *)MCFGPIO_CLRH, | ||
| 247 | }, | ||
| 248 | { | ||
| 249 | .gpio_chip = { | ||
| 250 | .label = "J", | ||
| 251 | .request = mcf_gpio_request, | ||
| 252 | .free = mcf_gpio_free, | ||
| 253 | .direction_input = mcf_gpio_direction_input, | ||
| 254 | .direction_output = mcf_gpio_direction_output, | ||
| 255 | .get = mcf_gpio_get_value, | ||
| 256 | .set = mcf_gpio_set_value_fast, | ||
| 257 | .base = 104, | ||
| 258 | .ngpio = 8, | ||
| 259 | }, | ||
| 260 | .pddr = (void __iomem *)MCFGPIO_DDRJ, | ||
| 261 | .podr = (void __iomem *)MCFGPIO_PORTJ, | ||
| 262 | .ppdr = (void __iomem *)MCFGPIO_PORTJP, | ||
| 263 | .setr = (void __iomem *)MCFGPIO_SETJ, | ||
| 264 | .clrr = (void __iomem *)MCFGPIO_CLRJ, | ||
| 265 | }, | ||
| 266 | { | ||
| 267 | .gpio_chip = { | ||
| 268 | .label = "DD", | ||
| 269 | .request = mcf_gpio_request, | ||
| 270 | .free = mcf_gpio_free, | ||
| 271 | .direction_input = mcf_gpio_direction_input, | ||
| 272 | .direction_output = mcf_gpio_direction_output, | ||
| 273 | .get = mcf_gpio_get_value, | ||
| 274 | .set = mcf_gpio_set_value_fast, | ||
| 275 | .base = 112, | ||
| 276 | .ngpio = 8, | ||
| 277 | }, | ||
| 278 | .pddr = (void __iomem *)MCFGPIO_DDRDD, | ||
| 279 | .podr = (void __iomem *)MCFGPIO_PORTDD, | ||
| 280 | .ppdr = (void __iomem *)MCFGPIO_PORTDDP, | ||
| 281 | .setr = (void __iomem *)MCFGPIO_SETDD, | ||
| 282 | .clrr = (void __iomem *)MCFGPIO_CLRDD, | ||
| 283 | }, | ||
| 284 | { | ||
| 285 | .gpio_chip = { | ||
| 286 | .label = "EH", | ||
| 287 | .request = mcf_gpio_request, | ||
| 288 | .free = mcf_gpio_free, | ||
| 289 | .direction_input = mcf_gpio_direction_input, | ||
| 290 | .direction_output = mcf_gpio_direction_output, | ||
| 291 | .get = mcf_gpio_get_value, | ||
| 292 | .set = mcf_gpio_set_value_fast, | ||
| 293 | .base = 120, | ||
| 294 | .ngpio = 8, | ||
| 295 | }, | ||
| 296 | .pddr = (void __iomem *)MCFGPIO_DDREH, | ||
| 297 | .podr = (void __iomem *)MCFGPIO_PORTEH, | ||
| 298 | .ppdr = (void __iomem *)MCFGPIO_PORTEHP, | ||
| 299 | .setr = (void __iomem *)MCFGPIO_SETEH, | ||
| 300 | .clrr = (void __iomem *)MCFGPIO_CLREH, | ||
| 301 | }, | ||
| 302 | { | ||
| 303 | .gpio_chip = { | ||
| 304 | .label = "EL", | ||
| 305 | .request = mcf_gpio_request, | ||
| 306 | .free = mcf_gpio_free, | ||
| 307 | .direction_input = mcf_gpio_direction_input, | ||
| 308 | .direction_output = mcf_gpio_direction_output, | ||
| 309 | .get = mcf_gpio_get_value, | ||
| 310 | .set = mcf_gpio_set_value_fast, | ||
| 311 | .base = 128, | ||
| 312 | .ngpio = 8, | ||
| 313 | }, | ||
| 314 | .pddr = (void __iomem *)MCFGPIO_DDREL, | ||
| 315 | .podr = (void __iomem *)MCFGPIO_PORTEL, | ||
| 316 | .ppdr = (void __iomem *)MCFGPIO_PORTELP, | ||
| 317 | .setr = (void __iomem *)MCFGPIO_SETEL, | ||
| 318 | .clrr = (void __iomem *)MCFGPIO_CLREL, | ||
| 319 | }, | ||
| 320 | { | ||
| 321 | .gpio_chip = { | ||
| 322 | .label = "AS", | ||
| 323 | .request = mcf_gpio_request, | ||
| 324 | .free = mcf_gpio_free, | ||
| 325 | .direction_input = mcf_gpio_direction_input, | ||
| 326 | .direction_output = mcf_gpio_direction_output, | ||
| 327 | .get = mcf_gpio_get_value, | ||
| 328 | .set = mcf_gpio_set_value_fast, | ||
| 329 | .base = 136, | ||
| 330 | .ngpio = 6, | ||
| 331 | }, | ||
| 332 | .pddr = (void __iomem *)MCFGPIO_DDRAS, | ||
| 333 | .podr = (void __iomem *)MCFGPIO_PORTAS, | ||
| 334 | .ppdr = (void __iomem *)MCFGPIO_PORTASP, | ||
| 335 | .setr = (void __iomem *)MCFGPIO_SETAS, | ||
| 336 | .clrr = (void __iomem *)MCFGPIO_CLRAS, | ||
| 337 | }, | ||
| 338 | { | ||
| 339 | .gpio_chip = { | ||
| 340 | .label = "QS", | ||
| 341 | .request = mcf_gpio_request, | ||
| 342 | .free = mcf_gpio_free, | ||
| 343 | .direction_input = mcf_gpio_direction_input, | ||
| 344 | .direction_output = mcf_gpio_direction_output, | ||
| 345 | .get = mcf_gpio_get_value, | ||
| 346 | .set = mcf_gpio_set_value_fast, | ||
| 347 | .base = 144, | ||
| 348 | .ngpio = 7, | ||
| 349 | }, | ||
| 350 | .pddr = (void __iomem *)MCFGPIO_DDRQS, | ||
| 351 | .podr = (void __iomem *)MCFGPIO_PORTQS, | ||
| 352 | .ppdr = (void __iomem *)MCFGPIO_PORTQSP, | ||
| 353 | .setr = (void __iomem *)MCFGPIO_SETQS, | ||
| 354 | .clrr = (void __iomem *)MCFGPIO_CLRQS, | ||
| 355 | }, | ||
| 356 | { | ||
| 357 | .gpio_chip = { | ||
| 358 | .label = "SD", | ||
| 359 | .request = mcf_gpio_request, | ||
| 360 | .free = mcf_gpio_free, | ||
| 361 | .direction_input = mcf_gpio_direction_input, | ||
| 362 | .direction_output = mcf_gpio_direction_output, | ||
| 363 | .get = mcf_gpio_get_value, | ||
| 364 | .set = mcf_gpio_set_value_fast, | ||
| 365 | .base = 152, | ||
| 366 | .ngpio = 6, | ||
| 367 | }, | ||
| 368 | .pddr = (void __iomem *)MCFGPIO_DDRSD, | ||
| 369 | .podr = (void __iomem *)MCFGPIO_PORTSD, | ||
| 370 | .ppdr = (void __iomem *)MCFGPIO_PORTSDP, | ||
| 371 | .setr = (void __iomem *)MCFGPIO_SETSD, | ||
| 372 | .clrr = (void __iomem *)MCFGPIO_CLRSD, | ||
| 373 | }, | ||
| 374 | { | ||
| 375 | .gpio_chip = { | ||
| 376 | .label = "TC", | ||
| 377 | .request = mcf_gpio_request, | ||
| 378 | .free = mcf_gpio_free, | ||
| 379 | .direction_input = mcf_gpio_direction_input, | ||
| 380 | .direction_output = mcf_gpio_direction_output, | ||
| 381 | .get = mcf_gpio_get_value, | ||
| 382 | .set = mcf_gpio_set_value_fast, | ||
| 383 | .base = 160, | ||
| 384 | .ngpio = 4, | ||
| 385 | }, | ||
| 386 | .pddr = (void __iomem *)MCFGPIO_DDRTC, | ||
| 387 | .podr = (void __iomem *)MCFGPIO_PORTTC, | ||
| 388 | .ppdr = (void __iomem *)MCFGPIO_PORTTCP, | ||
| 389 | .setr = (void __iomem *)MCFGPIO_SETTC, | ||
| 390 | .clrr = (void __iomem *)MCFGPIO_CLRTC, | ||
| 391 | }, | ||
| 392 | { | ||
| 393 | .gpio_chip = { | ||
| 394 | .label = "TD", | ||
| 395 | .request = mcf_gpio_request, | ||
| 396 | .free = mcf_gpio_free, | ||
| 397 | .direction_input = mcf_gpio_direction_input, | ||
| 398 | .direction_output = mcf_gpio_direction_output, | ||
| 399 | .get = mcf_gpio_get_value, | ||
| 400 | .set = mcf_gpio_set_value_fast, | ||
| 401 | .base = 168, | ||
| 402 | .ngpio = 4, | ||
| 403 | }, | ||
| 404 | .pddr = (void __iomem *)MCFGPIO_DDRTD, | ||
| 405 | .podr = (void __iomem *)MCFGPIO_PORTTD, | ||
| 406 | .ppdr = (void __iomem *)MCFGPIO_PORTTDP, | ||
| 407 | .setr = (void __iomem *)MCFGPIO_SETTD, | ||
| 408 | .clrr = (void __iomem *)MCFGPIO_CLRTD, | ||
| 409 | }, | ||
| 410 | { | ||
| 411 | .gpio_chip = { | ||
| 412 | .label = "UA", | ||
| 413 | .request = mcf_gpio_request, | ||
| 414 | .free = mcf_gpio_free, | ||
| 415 | .direction_input = mcf_gpio_direction_input, | ||
| 416 | .direction_output = mcf_gpio_direction_output, | ||
| 417 | .get = mcf_gpio_get_value, | ||
| 418 | .set = mcf_gpio_set_value_fast, | ||
| 419 | .base = 176, | ||
| 420 | .ngpio = 4, | ||
| 421 | }, | ||
| 422 | .pddr = (void __iomem *)MCFGPIO_DDRUA, | ||
| 423 | .podr = (void __iomem *)MCFGPIO_PORTUA, | ||
| 424 | .ppdr = (void __iomem *)MCFGPIO_PORTUAP, | ||
| 425 | .setr = (void __iomem *)MCFGPIO_SETUA, | ||
| 426 | .clrr = (void __iomem *)MCFGPIO_CLRUA, | ||
| 427 | }, | ||
| 428 | }; | ||
| 429 | |||
| 430 | static int __init mcf_gpio_init(void) | ||
| 431 | { | ||
| 432 | unsigned i = 0; | ||
| 433 | while (i < ARRAY_SIZE(mcf_gpio_chips)) | ||
| 434 | (void)gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]); | ||
| 435 | return 0; | ||
| 436 | } | ||
| 437 | |||
| 438 | core_initcall(mcf_gpio_init); | ||
