blob: 28176e15b7d63579ea99799beaaa7248c7ea9043 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +01002/*
3 * Copyright (C) 2009
4 * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de>
5 *
Stefano Babic7faee912011-08-21 10:45:44 +02006 * Copyright (C) 2011
7 * Stefano Babic, DENX Software Engineering, <sbabic@denx.de>
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +01008 */
Simon Glass2772b4d2014-10-01 19:57:26 -06009#include <errno.h>
10#include <dm.h>
11#include <malloc.h>
Stefano Babicd77fe992010-07-06 17:05:06 +020012#include <asm/arch/imx-regs.h>
Stefano Babic7faee912011-08-21 10:45:44 +020013#include <asm/gpio.h>
Stefano Babicd77fe992010-07-06 17:05:06 +020014#include <asm/io.h>
Walter Lozanoe58c4f52020-07-29 12:31:18 -030015#include <dt-structs.h>
16#include <mapmem.h>
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +010017
Stefano Babic7faee912011-08-21 10:45:44 +020018enum mxc_gpio_direction {
19 MXC_GPIO_DIRECTION_IN,
20 MXC_GPIO_DIRECTION_OUT,
21};
22
Simon Glass2772b4d2014-10-01 19:57:26 -060023#define GPIO_PER_BANK 32
24
25struct mxc_gpio_plat {
Walter Lozanoe58c4f52020-07-29 12:31:18 -030026#if CONFIG_IS_ENABLED(OF_PLATDATA)
27 /* Put this first since driver model will copy the data here */
28 struct dtd_gpio_mxc dtplat;
29#endif
Peng Fan86be4262015-02-10 14:46:33 +080030 int bank_index;
Simon Glass2772b4d2014-10-01 19:57:26 -060031 struct gpio_regs *regs;
32};
33
34struct mxc_bank_info {
Simon Glass2772b4d2014-10-01 19:57:26 -060035 struct gpio_regs *regs;
36};
37
Simon Glassfa4689a2019-12-06 21:41:35 -070038#if !CONFIG_IS_ENABLED(DM_GPIO)
Lukasz Majewskic00b0932019-06-09 22:54:40 +020039#define GPIO_TO_PORT(n) ((n) / 32)
Stefano Babic7faee912011-08-21 10:45:44 +020040
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +010041/* GPIO port description */
42static unsigned long gpio_ports[] = {
Stefano Babicd77fe992010-07-06 17:05:06 +020043 [0] = GPIO1_BASE_ADDR,
44 [1] = GPIO2_BASE_ADDR,
45 [2] = GPIO3_BASE_ADDR,
Tom Rini31df83b2022-11-19 18:45:27 -050046#if defined(CONFIG_MX51) || \
Adrian Alonso840d2e32015-08-11 11:19:51 -050047 defined(CONFIG_MX53) || defined(CONFIG_MX6) || \
Peng Fan39945c12018-11-20 10:19:25 +000048 defined(CONFIG_MX7) || defined(CONFIG_IMX8M) || \
Giulio Benettia82cd872020-01-10 15:47:03 +010049 defined(CONFIG_ARCH_IMX8) || defined(CONFIG_IMXRT1050)
Stefano Babicd77fe992010-07-06 17:05:06 +020050 [3] = GPIO4_BASE_ADDR,
51#endif
Tom Rini31df83b2022-11-19 18:45:27 -050052#if defined(CONFIG_MX53) || defined(CONFIG_MX6) || \
Peng Fan39945c12018-11-20 10:19:25 +000053 defined(CONFIG_MX7) || defined(CONFIG_IMX8M) || \
Giulio Benettia82cd872020-01-10 15:47:03 +010054 defined(CONFIG_ARCH_IMX8) || defined(CONFIG_IMXRT1050)
Liu Hui-R64343a71164c2011-01-03 22:27:38 +000055 [4] = GPIO5_BASE_ADDR,
Giulio Benettia82cd872020-01-10 15:47:03 +010056#if !(defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL) || \
57 defined(CONFIG_IMX8M) || defined(CONFIG_IMXRT1050))
Liu Hui-R64343a71164c2011-01-03 22:27:38 +000058 [5] = GPIO6_BASE_ADDR,
tremcf233ed2012-08-25 05:30:33 +000059#endif
Peng Fanf5dd87e2015-07-20 19:28:31 +080060#endif
Peng Fanb2242e12018-10-18 14:28:27 +020061#if defined(CONFIG_MX53) || defined(CONFIG_MX6) || defined(CONFIG_MX7) || \
62 defined(CONFIG_ARCH_IMX8)
Fabio Estevam1b691df2018-01-03 12:33:05 -020063#if !(defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL))
Liu Hui-R64343a71164c2011-01-03 22:27:38 +000064 [6] = GPIO7_BASE_ADDR,
65#endif
Peng Fanf5dd87e2015-07-20 19:28:31 +080066#endif
Peng Fanb2242e12018-10-18 14:28:27 +020067#if defined(CONFIG_ARCH_IMX8)
68 [7] = GPIO8_BASE_ADDR,
69#endif
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +010070};
71
Stefano Babic7faee912011-08-21 10:45:44 +020072static int mxc_gpio_direction(unsigned int gpio,
73 enum mxc_gpio_direction direction)
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +010074{
Vikram Narayananfbdf6bc2012-04-10 04:26:20 +000075 unsigned int port = GPIO_TO_PORT(gpio);
Stefano Babicd77fe992010-07-06 17:05:06 +020076 struct gpio_regs *regs;
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +010077 u32 l;
78
79 if (port >= ARRAY_SIZE(gpio_ports))
Joe Hershbergerf8928f12011-11-11 15:55:36 -060080 return -1;
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +010081
82 gpio &= 0x1f;
83
Stefano Babicd77fe992010-07-06 17:05:06 +020084 regs = (struct gpio_regs *)gpio_ports[port];
85
86 l = readl(&regs->gpio_dir);
87
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +010088 switch (direction) {
Stefano Babicd77fe992010-07-06 17:05:06 +020089 case MXC_GPIO_DIRECTION_OUT:
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +010090 l |= 1 << gpio;
91 break;
Stefano Babicd77fe992010-07-06 17:05:06 +020092 case MXC_GPIO_DIRECTION_IN:
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +010093 l &= ~(1 << gpio);
94 }
Stefano Babicd77fe992010-07-06 17:05:06 +020095 writel(l, &regs->gpio_dir);
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +010096
97 return 0;
98}
99
Joe Hershbergerf8928f12011-11-11 15:55:36 -0600100int gpio_set_value(unsigned gpio, int value)
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +0100101{
Vikram Narayananfbdf6bc2012-04-10 04:26:20 +0000102 unsigned int port = GPIO_TO_PORT(gpio);
Stefano Babicd77fe992010-07-06 17:05:06 +0200103 struct gpio_regs *regs;
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +0100104 u32 l;
105
106 if (port >= ARRAY_SIZE(gpio_ports))
Joe Hershbergerf8928f12011-11-11 15:55:36 -0600107 return -1;
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +0100108
109 gpio &= 0x1f;
110
Stefano Babicd77fe992010-07-06 17:05:06 +0200111 regs = (struct gpio_regs *)gpio_ports[port];
112
113 l = readl(&regs->gpio_dr);
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +0100114 if (value)
115 l |= 1 << gpio;
116 else
117 l &= ~(1 << gpio);
Stefano Babicd77fe992010-07-06 17:05:06 +0200118 writel(l, &regs->gpio_dr);
Joe Hershbergerf8928f12011-11-11 15:55:36 -0600119
120 return 0;
Guennadi Liakhovetski7c6a8562009-02-07 01:18:07 +0100121}
Stefano Babica44d2a52010-04-13 12:07:00 +0200122
Joe Hershbergerf8928f12011-11-11 15:55:36 -0600123int gpio_get_value(unsigned gpio)
Stefano Babica44d2a52010-04-13 12:07:00 +0200124{
Vikram Narayananfbdf6bc2012-04-10 04:26:20 +0000125 unsigned int port = GPIO_TO_PORT(gpio);
Stefano Babicd77fe992010-07-06 17:05:06 +0200126 struct gpio_regs *regs;
Joe Hershbergerf8928f12011-11-11 15:55:36 -0600127 u32 val;
Stefano Babica44d2a52010-04-13 12:07:00 +0200128
129 if (port >= ARRAY_SIZE(gpio_ports))
Joe Hershbergerf8928f12011-11-11 15:55:36 -0600130 return -1;
Stefano Babica44d2a52010-04-13 12:07:00 +0200131
132 gpio &= 0x1f;
133
Stefano Babicd77fe992010-07-06 17:05:06 +0200134 regs = (struct gpio_regs *)gpio_ports[port];
135
Tomas Paukrte0906f62024-08-28 15:09:48 +0200136 if ((readl(&regs->gpio_dir) >> gpio) & 0x01)
137 val = (readl(&regs->gpio_dr) >> gpio) & 0x01;
138 else
139 val = (readl(&regs->gpio_psr) >> gpio) & 0x01;
Stefano Babica44d2a52010-04-13 12:07:00 +0200140
Joe Hershbergerf8928f12011-11-11 15:55:36 -0600141 return val;
Stefano Babica44d2a52010-04-13 12:07:00 +0200142}
Stefano Babic7faee912011-08-21 10:45:44 +0200143
Joe Hershbergerf8928f12011-11-11 15:55:36 -0600144int gpio_request(unsigned gpio, const char *label)
Stefano Babic7faee912011-08-21 10:45:44 +0200145{
Vikram Narayananfbdf6bc2012-04-10 04:26:20 +0000146 unsigned int port = GPIO_TO_PORT(gpio);
Stefano Babic7faee912011-08-21 10:45:44 +0200147 if (port >= ARRAY_SIZE(gpio_ports))
Joe Hershbergerf8928f12011-11-11 15:55:36 -0600148 return -1;
Stefano Babic7faee912011-08-21 10:45:44 +0200149 return 0;
150}
151
Joe Hershbergerf8928f12011-11-11 15:55:36 -0600152int gpio_free(unsigned gpio)
Stefano Babic7faee912011-08-21 10:45:44 +0200153{
Joe Hershbergerf8928f12011-11-11 15:55:36 -0600154 return 0;
Stefano Babic7faee912011-08-21 10:45:44 +0200155}
156
Joe Hershbergerf8928f12011-11-11 15:55:36 -0600157int gpio_direction_input(unsigned gpio)
Stefano Babic7faee912011-08-21 10:45:44 +0200158{
Joe Hershbergerf8928f12011-11-11 15:55:36 -0600159 return mxc_gpio_direction(gpio, MXC_GPIO_DIRECTION_IN);
Stefano Babic7faee912011-08-21 10:45:44 +0200160}
161
Joe Hershbergerf8928f12011-11-11 15:55:36 -0600162int gpio_direction_output(unsigned gpio, int value)
Stefano Babic7faee912011-08-21 10:45:44 +0200163{
Dirk Behme1e0803f2013-07-15 15:58:27 +0200164 int ret = gpio_set_value(gpio, value);
Stefano Babic7faee912011-08-21 10:45:44 +0200165
166 if (ret < 0)
167 return ret;
168
Dirk Behme1e0803f2013-07-15 15:58:27 +0200169 return mxc_gpio_direction(gpio, MXC_GPIO_DIRECTION_OUT);
Stefano Babic7faee912011-08-21 10:45:44 +0200170}
Simon Glass2772b4d2014-10-01 19:57:26 -0600171#endif
172
Simon Glassfa4689a2019-12-06 21:41:35 -0700173#if CONFIG_IS_ENABLED(DM_GPIO)
Peng Fan0ed2cb12015-02-10 14:46:34 +0800174#include <fdtdec.h>
Simon Glass2772b4d2014-10-01 19:57:26 -0600175static int mxc_gpio_is_output(struct gpio_regs *regs, int offset)
176{
177 u32 val;
178
179 val = readl(&regs->gpio_dir);
180
181 return val & (1 << offset) ? 1 : 0;
182}
183
184static void mxc_gpio_bank_direction(struct gpio_regs *regs, int offset,
185 enum mxc_gpio_direction direction)
186{
187 u32 l;
188
189 l = readl(&regs->gpio_dir);
190
191 switch (direction) {
192 case MXC_GPIO_DIRECTION_OUT:
193 l |= 1 << offset;
194 break;
195 case MXC_GPIO_DIRECTION_IN:
196 l &= ~(1 << offset);
197 }
198 writel(l, &regs->gpio_dir);
199}
200
201static void mxc_gpio_bank_set_value(struct gpio_regs *regs, int offset,
202 int value)
203{
204 u32 l;
205
206 l = readl(&regs->gpio_dr);
207 if (value)
208 l |= 1 << offset;
209 else
210 l &= ~(1 << offset);
211 writel(l, &regs->gpio_dr);
212}
213
214static int mxc_gpio_bank_get_value(struct gpio_regs *regs, int offset)
215{
Tomas Paukrte0906f62024-08-28 15:09:48 +0200216 if ((readl(&regs->gpio_dir) >> offset) & 0x01)
217 return (readl(&regs->gpio_dr) >> offset) & 0x01;
218 else
219 return (readl(&regs->gpio_psr) >> offset) & 0x01;
Simon Glass2772b4d2014-10-01 19:57:26 -0600220}
221
Simon Glass2772b4d2014-10-01 19:57:26 -0600222/* set GPIO pin 'gpio' as an input */
223static int mxc_gpio_direction_input(struct udevice *dev, unsigned offset)
224{
225 struct mxc_bank_info *bank = dev_get_priv(dev);
Simon Glass2772b4d2014-10-01 19:57:26 -0600226
227 /* Configure GPIO direction as input. */
228 mxc_gpio_bank_direction(bank->regs, offset, MXC_GPIO_DIRECTION_IN);
229
230 return 0;
231}
232
233/* set GPIO pin 'gpio' as an output, with polarity 'value' */
234static int mxc_gpio_direction_output(struct udevice *dev, unsigned offset,
235 int value)
236{
237 struct mxc_bank_info *bank = dev_get_priv(dev);
Simon Glass2772b4d2014-10-01 19:57:26 -0600238
239 /* Configure GPIO output value. */
240 mxc_gpio_bank_set_value(bank->regs, offset, value);
241
242 /* Configure GPIO direction as output. */
243 mxc_gpio_bank_direction(bank->regs, offset, MXC_GPIO_DIRECTION_OUT);
244
245 return 0;
246}
247
248/* read GPIO IN value of pin 'gpio' */
249static int mxc_gpio_get_value(struct udevice *dev, unsigned offset)
250{
251 struct mxc_bank_info *bank = dev_get_priv(dev);
Simon Glass2772b4d2014-10-01 19:57:26 -0600252
253 return mxc_gpio_bank_get_value(bank->regs, offset);
254}
255
256/* write GPIO OUT value to pin 'gpio' */
257static int mxc_gpio_set_value(struct udevice *dev, unsigned offset,
258 int value)
259{
260 struct mxc_bank_info *bank = dev_get_priv(dev);
Simon Glass2772b4d2014-10-01 19:57:26 -0600261
262 mxc_gpio_bank_set_value(bank->regs, offset, value);
263
264 return 0;
265}
266
Simon Glass2772b4d2014-10-01 19:57:26 -0600267static int mxc_gpio_get_function(struct udevice *dev, unsigned offset)
268{
269 struct mxc_bank_info *bank = dev_get_priv(dev);
270
Simon Glass2772b4d2014-10-01 19:57:26 -0600271 /* GPIOF_FUNC is not implemented yet */
272 if (mxc_gpio_is_output(bank->regs, offset))
273 return GPIOF_OUTPUT;
274 else
275 return GPIOF_INPUT;
276}
277
278static const struct dm_gpio_ops gpio_mxc_ops = {
Simon Glass2772b4d2014-10-01 19:57:26 -0600279 .direction_input = mxc_gpio_direction_input,
280 .direction_output = mxc_gpio_direction_output,
281 .get_value = mxc_gpio_get_value,
282 .set_value = mxc_gpio_set_value,
283 .get_function = mxc_gpio_get_function,
Simon Glass2772b4d2014-10-01 19:57:26 -0600284};
285
Simon Glass2772b4d2014-10-01 19:57:26 -0600286static int mxc_gpio_probe(struct udevice *dev)
287{
288 struct mxc_bank_info *bank = dev_get_priv(dev);
Simon Glassfa20e932020-12-03 16:55:20 -0700289 struct mxc_gpio_plat *plat = dev_get_plat(dev);
Simon Glassde0977b2015-03-05 12:25:20 -0700290 struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
Simon Glass2772b4d2014-10-01 19:57:26 -0600291 int banknum;
292 char name[18], *str;
293
Walter Lozanoe58c4f52020-07-29 12:31:18 -0300294#if CONFIG_IS_ENABLED(OF_PLATDATA)
295 struct dtd_gpio_mxc *dtplat = &plat->dtplat;
296
297 plat->regs = map_sysmem(dtplat->reg[0], dtplat->reg[1]);
298#endif
299
Peng Fan86be4262015-02-10 14:46:33 +0800300 banknum = plat->bank_index;
Ye Li81a44212020-06-09 20:28:02 -0700301 if (IS_ENABLED(CONFIG_ARCH_IMX8))
302 sprintf(name, "GPIO%d_", banknum);
303 else
304 sprintf(name, "GPIO%d_", banknum + 1);
Simon Glass2772b4d2014-10-01 19:57:26 -0600305 str = strdup(name);
306 if (!str)
307 return -ENOMEM;
308 uc_priv->bank_name = str;
309 uc_priv->gpio_count = GPIO_PER_BANK;
310 bank->regs = plat->regs;
311
312 return 0;
313}
314
Simon Glassaad29ae2020-12-03 16:55:21 -0700315static int mxc_gpio_of_to_plat(struct udevice *dev)
Peng Fan0ed2cb12015-02-10 14:46:34 +0800316{
Simon Glassfa20e932020-12-03 16:55:20 -0700317 struct mxc_gpio_plat *plat = dev_get_plat(dev);
Walter Lozanoe58c4f52020-07-29 12:31:18 -0300318 if (!CONFIG_IS_ENABLED(OF_PLATDATA)) {
319 fdt_addr_t addr;
Tom Rini322ebe92020-08-04 11:11:02 -0400320 addr = dev_read_addr(dev);
Walter Lozanoe58c4f52020-07-29 12:31:18 -0300321 if (addr == FDT_ADDR_T_NONE)
322 return -EINVAL;
Peng Fan0ed2cb12015-02-10 14:46:34 +0800323
Walter Lozanoe58c4f52020-07-29 12:31:18 -0300324 plat->regs = (struct gpio_regs *)addr;
325 }
Simon Glassb4db3722020-12-16 21:20:24 -0700326 plat->bank_index = dev_seq(dev);
Ye Li755f3ee2020-06-09 20:29:51 -0700327
328 return 0;
329}
Peng Fan0ed2cb12015-02-10 14:46:34 +0800330
Ye Li755f3ee2020-06-09 20:29:51 -0700331static int mxc_gpio_bind(struct udevice *dev)
332{
Peng Fan0ed2cb12015-02-10 14:46:34 +0800333 return 0;
334}
335
336static const struct udevice_id mxc_gpio_ids[] = {
337 { .compatible = "fsl,imx35-gpio" },
338 { }
339};
340
Simon Glass2772b4d2014-10-01 19:57:26 -0600341U_BOOT_DRIVER(gpio_mxc) = {
342 .name = "gpio_mxc",
343 .id = UCLASS_GPIO,
344 .ops = &gpio_mxc_ops,
345 .probe = mxc_gpio_probe,
Simon Glassaad29ae2020-12-03 16:55:21 -0700346 .of_to_plat = mxc_gpio_of_to_plat,
Simon Glass71fa5b42020-12-03 16:55:18 -0700347 .plat_auto = sizeof(struct mxc_gpio_plat),
Simon Glass8a2b47f2020-12-03 16:55:17 -0700348 .priv_auto = sizeof(struct mxc_bank_info),
Peng Fan0ed2cb12015-02-10 14:46:34 +0800349 .of_match = mxc_gpio_ids,
350 .bind = mxc_gpio_bind,
351};
352
Simon Glassdf65db82020-12-28 20:34:57 -0700353DM_DRIVER_ALIAS(gpio_mxc, fsl_imx6q_gpio)
Walter Lozanoe58c4f52020-07-29 12:31:18 -0300354
Masahiro Yamada366b24f2015-08-12 07:31:55 +0900355#if !CONFIG_IS_ENABLED(OF_CONTROL)
Peng Fan0ed2cb12015-02-10 14:46:34 +0800356static const struct mxc_gpio_plat mxc_plat[] = {
357 { 0, (struct gpio_regs *)GPIO1_BASE_ADDR },
358 { 1, (struct gpio_regs *)GPIO2_BASE_ADDR },
359 { 2, (struct gpio_regs *)GPIO3_BASE_ADDR },
Tom Rini31df83b2022-11-19 18:45:27 -0500360#if defined(CONFIG_MX51) || \
Peng Fanfa94fb42018-01-10 13:20:42 +0800361 defined(CONFIG_MX53) || defined(CONFIG_MX6) || \
Peng Fan39945c12018-11-20 10:19:25 +0000362 defined(CONFIG_IMX8M) || defined(CONFIG_ARCH_IMX8)
Peng Fan0ed2cb12015-02-10 14:46:34 +0800363 { 3, (struct gpio_regs *)GPIO4_BASE_ADDR },
364#endif
Tom Rini31df83b2022-11-19 18:45:27 -0500365#if defined(CONFIG_MX53) || defined(CONFIG_MX6) || \
Peng Fan39945c12018-11-20 10:19:25 +0000366 defined(CONFIG_IMX8M) || defined(CONFIG_ARCH_IMX8)
Peng Fan0ed2cb12015-02-10 14:46:34 +0800367 { 4, (struct gpio_regs *)GPIO5_BASE_ADDR },
Peng Fan39945c12018-11-20 10:19:25 +0000368#ifndef CONFIG_IMX8M
Peng Fan0ed2cb12015-02-10 14:46:34 +0800369 { 5, (struct gpio_regs *)GPIO6_BASE_ADDR },
370#endif
Peng Fanfa94fb42018-01-10 13:20:42 +0800371#endif
Peng Fanb2242e12018-10-18 14:28:27 +0200372#if defined(CONFIG_MX53) || defined(CONFIG_MX6) || defined(CONFIG_ARCH_IMX8)
Peng Fan0ed2cb12015-02-10 14:46:34 +0800373 { 6, (struct gpio_regs *)GPIO7_BASE_ADDR },
374#endif
Peng Fanb2242e12018-10-18 14:28:27 +0200375#if defined(CONFIG_ARCH_IMX8)
376 { 7, (struct gpio_regs *)GPIO8_BASE_ADDR },
377#endif
Simon Glass2772b4d2014-10-01 19:57:26 -0600378};
379
Simon Glass1d8364a2020-12-28 20:34:54 -0700380U_BOOT_DRVINFOS(mxc_gpios) = {
Simon Glass2772b4d2014-10-01 19:57:26 -0600381 { "gpio_mxc", &mxc_plat[0] },
382 { "gpio_mxc", &mxc_plat[1] },
383 { "gpio_mxc", &mxc_plat[2] },
Tom Rini31df83b2022-11-19 18:45:27 -0500384#if defined(CONFIG_MX51) || \
Peng Fanfa94fb42018-01-10 13:20:42 +0800385 defined(CONFIG_MX53) || defined(CONFIG_MX6) || \
Peng Fan39945c12018-11-20 10:19:25 +0000386 defined(CONFIG_IMX8M) || defined(CONFIG_ARCH_IMX8)
Simon Glass2772b4d2014-10-01 19:57:26 -0600387 { "gpio_mxc", &mxc_plat[3] },
388#endif
Tom Rini31df83b2022-11-19 18:45:27 -0500389#if defined(CONFIG_MX53) || defined(CONFIG_MX6) || \
Peng Fan39945c12018-11-20 10:19:25 +0000390 defined(CONFIG_IMX8M) || defined(CONFIG_ARCH_IMX8)
Simon Glass2772b4d2014-10-01 19:57:26 -0600391 { "gpio_mxc", &mxc_plat[4] },
Peng Fan39945c12018-11-20 10:19:25 +0000392#ifndef CONFIG_IMX8M
Simon Glass2772b4d2014-10-01 19:57:26 -0600393 { "gpio_mxc", &mxc_plat[5] },
394#endif
Peng Fanfa94fb42018-01-10 13:20:42 +0800395#endif
Peng Fanb2242e12018-10-18 14:28:27 +0200396#if defined(CONFIG_MX53) || defined(CONFIG_MX6) || defined(CONFIG_ARCH_IMX8)
Simon Glass2772b4d2014-10-01 19:57:26 -0600397 { "gpio_mxc", &mxc_plat[6] },
398#endif
Peng Fanb2242e12018-10-18 14:28:27 +0200399#if defined(CONFIG_ARCH_IMX8)
400 { "gpio_mxc", &mxc_plat[7] },
401#endif
Simon Glass2772b4d2014-10-01 19:57:26 -0600402};
403#endif
Peng Fan0ed2cb12015-02-10 14:46:34 +0800404#endif