Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2016 |
Mario Six | b489358 | 2018-03-06 08:04:58 +0100 | [diff] [blame] | 4 | * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 5 | * |
| 6 | * based on arch/powerpc/include/asm/mpc85xx_gpio.h, which is |
| 7 | * |
| 8 | * Copyright 2010 eXMeritus, A Boeing Company |
Biwen Li | db5d53b | 2021-02-05 19:01:47 +0800 | [diff] [blame^] | 9 | * Copyright 2020-2021 NXP |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #include <common.h> |
| 13 | #include <dm.h> |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 14 | #include <mapmem.h> |
Mario Six | d7c6f71 | 2018-01-15 11:07:49 +0100 | [diff] [blame] | 15 | #include <asm/gpio.h> |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 16 | #include <asm/io.h> |
| 17 | #include <dm/of_access.h> |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 18 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 19 | struct mpc8xxx_gpio_data { |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 20 | /* The bank's register base in memory */ |
| 21 | struct ccsr_gpio __iomem *base; |
| 22 | /* The address of the registers; used to identify the bank */ |
| 23 | ulong addr; |
| 24 | /* The GPIO count of the bank */ |
| 25 | uint gpio_count; |
| 26 | /* The GPDAT register cannot be used to determine the value of output |
| 27 | * pins on MPC8572/MPC8536, so we shadow it and use the shadowed value |
Mario Six | cc94b17 | 2018-01-15 11:07:46 +0100 | [diff] [blame] | 28 | * for output pins |
| 29 | */ |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 30 | u32 dat_shadow; |
Mario Six | d7c6f71 | 2018-01-15 11:07:49 +0100 | [diff] [blame] | 31 | ulong type; |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 32 | bool little_endian; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 33 | }; |
| 34 | |
Mario Six | d7c6f71 | 2018-01-15 11:07:49 +0100 | [diff] [blame] | 35 | enum { |
| 36 | MPC8XXX_GPIO_TYPE, |
| 37 | MPC5121_GPIO_TYPE, |
| 38 | }; |
| 39 | |
Mario Six | cc94b17 | 2018-01-15 11:07:46 +0100 | [diff] [blame] | 40 | inline u32 gpio_mask(uint gpio) |
| 41 | { |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 42 | return (1U << (31 - (gpio))); |
| 43 | } |
| 44 | |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 45 | static inline u32 mpc8xxx_gpio_get_val(struct udevice *dev, u32 mask) |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 46 | { |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 47 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
| 48 | |
| 49 | if (data->little_endian) |
| 50 | return in_le32(&data->base->gpdat) & mask; |
| 51 | else |
| 52 | return in_be32(&data->base->gpdat) & mask; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 53 | } |
| 54 | |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 55 | static inline u32 mpc8xxx_gpio_get_dir(struct udevice *dev, u32 mask) |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 56 | { |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 57 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
| 58 | |
| 59 | if (data->little_endian) |
| 60 | return in_le32(&data->base->gpdir) & mask; |
| 61 | else |
| 62 | return in_be32(&data->base->gpdir) & mask; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 63 | } |
| 64 | |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 65 | static inline int mpc8xxx_gpio_open_drain_val(struct udevice *dev, u32 mask) |
mario.six@gdsys.cc | 7b4cf8b | 2016-05-25 15:15:22 +0200 | [diff] [blame] | 66 | { |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 67 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
| 68 | |
| 69 | if (data->little_endian) |
| 70 | return in_le32(&data->base->gpodr) & mask; |
| 71 | else |
| 72 | return in_be32(&data->base->gpodr) & mask; |
mario.six@gdsys.cc | 7b4cf8b | 2016-05-25 15:15:22 +0200 | [diff] [blame] | 73 | } |
| 74 | |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 75 | static inline void mpc8xxx_gpio_open_drain_on(struct udevice *dev, u32 |
mario.six@gdsys.cc | 7b4cf8b | 2016-05-25 15:15:22 +0200 | [diff] [blame] | 76 | gpios) |
| 77 | { |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 78 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
mario.six@gdsys.cc | 7b4cf8b | 2016-05-25 15:15:22 +0200 | [diff] [blame] | 79 | /* GPODR register 1 -> open drain on */ |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 80 | if (data->little_endian) |
| 81 | setbits_le32(&data->base->gpodr, gpios); |
| 82 | else |
| 83 | setbits_be32(&data->base->gpodr, gpios); |
mario.six@gdsys.cc | 7b4cf8b | 2016-05-25 15:15:22 +0200 | [diff] [blame] | 84 | } |
| 85 | |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 86 | static inline void mpc8xxx_gpio_open_drain_off(struct udevice *dev, |
mario.six@gdsys.cc | 7b4cf8b | 2016-05-25 15:15:22 +0200 | [diff] [blame] | 87 | u32 gpios) |
| 88 | { |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 89 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
mario.six@gdsys.cc | 7b4cf8b | 2016-05-25 15:15:22 +0200 | [diff] [blame] | 90 | /* GPODR register 0 -> open drain off (actively driven) */ |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 91 | if (data->little_endian) |
| 92 | clrbits_le32(&data->base->gpodr, gpios); |
| 93 | else |
| 94 | clrbits_be32(&data->base->gpodr, gpios); |
mario.six@gdsys.cc | 7b4cf8b | 2016-05-25 15:15:22 +0200 | [diff] [blame] | 95 | } |
| 96 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 97 | static int mpc8xxx_gpio_direction_input(struct udevice *dev, uint gpio) |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 98 | { |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 99 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
Rasmus Villemoes | bb36b0d | 2020-01-28 12:04:33 +0000 | [diff] [blame] | 100 | u32 mask = gpio_mask(gpio); |
| 101 | |
| 102 | /* GPDIR register 0 -> input */ |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 103 | if (data->little_endian) |
| 104 | clrbits_le32(&data->base->gpdir, mask); |
| 105 | else |
| 106 | clrbits_be32(&data->base->gpdir, mask); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 107 | |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 108 | return 0; |
| 109 | } |
| 110 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 111 | static int mpc8xxx_gpio_set_value(struct udevice *dev, uint gpio, int value) |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 112 | { |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 113 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
Rasmus Villemoes | 6298529 | 2020-01-28 12:04:34 +0000 | [diff] [blame] | 114 | struct ccsr_gpio *base = data->base; |
| 115 | u32 mask = gpio_mask(gpio); |
| 116 | u32 gpdir; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 117 | |
| 118 | if (value) { |
Rasmus Villemoes | 6298529 | 2020-01-28 12:04:34 +0000 | [diff] [blame] | 119 | data->dat_shadow |= mask; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 120 | } else { |
Rasmus Villemoes | 6298529 | 2020-01-28 12:04:34 +0000 | [diff] [blame] | 121 | data->dat_shadow &= ~mask; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 122 | } |
Rasmus Villemoes | 6298529 | 2020-01-28 12:04:34 +0000 | [diff] [blame] | 123 | |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 124 | if (data->little_endian) |
| 125 | gpdir = in_le32(&base->gpdir); |
| 126 | else |
| 127 | gpdir = in_be32(&base->gpdir); |
| 128 | |
Rasmus Villemoes | 6298529 | 2020-01-28 12:04:34 +0000 | [diff] [blame] | 129 | gpdir |= gpio_mask(gpio); |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 130 | |
| 131 | if (data->little_endian) { |
| 132 | out_le32(&base->gpdat, gpdir & data->dat_shadow); |
| 133 | out_le32(&base->gpdir, gpdir); |
| 134 | } else { |
| 135 | out_be32(&base->gpdat, gpdir & data->dat_shadow); |
| 136 | out_be32(&base->gpdir, gpdir); |
| 137 | } |
Rasmus Villemoes | 6298529 | 2020-01-28 12:04:34 +0000 | [diff] [blame] | 138 | |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 139 | return 0; |
| 140 | } |
| 141 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 142 | static int mpc8xxx_gpio_direction_output(struct udevice *dev, uint gpio, |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 143 | int value) |
| 144 | { |
Mario Six | d7c6f71 | 2018-01-15 11:07:49 +0100 | [diff] [blame] | 145 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
| 146 | |
| 147 | /* GPIO 28..31 are input only on MPC5121 */ |
| 148 | if (data->type == MPC5121_GPIO_TYPE && gpio >= 28) |
| 149 | return -EINVAL; |
| 150 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 151 | return mpc8xxx_gpio_set_value(dev, gpio, value); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 152 | } |
| 153 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 154 | static int mpc8xxx_gpio_get_value(struct udevice *dev, uint gpio) |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 155 | { |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 156 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 157 | |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 158 | if (!!mpc8xxx_gpio_get_dir(dev, gpio_mask(gpio))) { |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 159 | /* Output -> use shadowed value */ |
| 160 | return !!(data->dat_shadow & gpio_mask(gpio)); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 161 | } |
Mario Six | cc94b17 | 2018-01-15 11:07:46 +0100 | [diff] [blame] | 162 | |
| 163 | /* Input -> read value from GPDAT register */ |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 164 | return !!mpc8xxx_gpio_get_val(dev, gpio_mask(gpio)); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 165 | } |
| 166 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 167 | static int mpc8xxx_gpio_get_function(struct udevice *dev, uint gpio) |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 168 | { |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 169 | int dir; |
| 170 | |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 171 | dir = !!mpc8xxx_gpio_get_dir(dev, gpio_mask(gpio)); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 172 | return dir ? GPIOF_OUTPUT : GPIOF_INPUT; |
| 173 | } |
| 174 | |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 175 | #if CONFIG_IS_ENABLED(OF_CONTROL) |
Simon Glass | aad29ae | 2020-12-03 16:55:21 -0700 | [diff] [blame] | 176 | static int mpc8xxx_gpio_of_to_plat(struct udevice *dev) |
Mario Six | cc94b17 | 2018-01-15 11:07:46 +0100 | [diff] [blame] | 177 | { |
Simon Glass | fa20e93 | 2020-12-03 16:55:20 -0700 | [diff] [blame] | 178 | struct mpc8xxx_gpio_plat *plat = dev_get_plat(dev); |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 179 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 180 | |
Biwen Li | db5d53b | 2021-02-05 19:01:47 +0800 | [diff] [blame^] | 181 | if (dev_read_bool(dev, "little-endian")) |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 182 | data->little_endian = true; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 183 | |
Biwen Li | db5d53b | 2021-02-05 19:01:47 +0800 | [diff] [blame^] | 184 | plat->addr = (ulong)dev_read_addr_size_index(dev, 0, (fdt_size_t *)&plat->size); |
Mario Six | f99b6bf | 2018-01-15 11:07:50 +0100 | [diff] [blame] | 185 | plat->ngpios = dev_read_u32_default(dev, "ngpios", 32); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 186 | |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 187 | return 0; |
| 188 | } |
| 189 | #endif |
| 190 | |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 191 | static int mpc8xxx_gpio_plat_to_priv(struct udevice *dev) |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 192 | { |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 193 | struct mpc8xxx_gpio_data *priv = dev_get_priv(dev); |
Simon Glass | fa20e93 | 2020-12-03 16:55:20 -0700 | [diff] [blame] | 194 | struct mpc8xxx_gpio_plat *plat = dev_get_plat(dev); |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 195 | unsigned long size = plat->size; |
Mario Six | d7c6f71 | 2018-01-15 11:07:49 +0100 | [diff] [blame] | 196 | ulong driver_data = dev_get_driver_data(dev); |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 197 | |
| 198 | if (size == 0) |
| 199 | size = 0x100; |
| 200 | |
| 201 | priv->addr = plat->addr; |
Mario Six | f99b6bf | 2018-01-15 11:07:50 +0100 | [diff] [blame] | 202 | priv->base = map_sysmem(plat->addr, size); |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 203 | |
| 204 | if (!priv->base) |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 205 | return -ENOMEM; |
| 206 | |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 207 | priv->gpio_count = plat->ngpios; |
| 208 | priv->dat_shadow = 0; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 209 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 210 | priv->type = driver_data; |
| 211 | |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 212 | return 0; |
| 213 | } |
| 214 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 215 | static int mpc8xxx_gpio_probe(struct udevice *dev) |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 216 | { |
| 217 | struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 218 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 219 | char name[32], *str; |
| 220 | |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 221 | mpc8xxx_gpio_plat_to_priv(dev); |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 222 | |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 223 | snprintf(name, sizeof(name), "MPC@%lx_", data->addr); |
| 224 | str = strdup(name); |
| 225 | |
| 226 | if (!str) |
| 227 | return -ENOMEM; |
| 228 | |
Biwen Li | db5d53b | 2021-02-05 19:01:47 +0800 | [diff] [blame^] | 229 | if (device_is_compatible(dev, "fsl,qoriq-gpio")) { |
| 230 | if (data->little_endian) |
| 231 | out_le32(&data->base->gpibe, 0xffffffff); |
| 232 | else |
| 233 | out_be32(&data->base->gpibe, 0xffffffff); |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 234 | } |
| 235 | |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 236 | uc_priv->bank_name = str; |
| 237 | uc_priv->gpio_count = data->gpio_count; |
| 238 | |
| 239 | return 0; |
| 240 | } |
| 241 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 242 | static const struct dm_gpio_ops gpio_mpc8xxx_ops = { |
| 243 | .direction_input = mpc8xxx_gpio_direction_input, |
| 244 | .direction_output = mpc8xxx_gpio_direction_output, |
| 245 | .get_value = mpc8xxx_gpio_get_value, |
| 246 | .set_value = mpc8xxx_gpio_set_value, |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 247 | .get_function = mpc8xxx_gpio_get_function, |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 248 | }; |
| 249 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 250 | static const struct udevice_id mpc8xxx_gpio_ids[] = { |
Mario Six | d7c6f71 | 2018-01-15 11:07:49 +0100 | [diff] [blame] | 251 | { .compatible = "fsl,pq3-gpio", .data = MPC8XXX_GPIO_TYPE }, |
| 252 | { .compatible = "fsl,mpc8308-gpio", .data = MPC8XXX_GPIO_TYPE }, |
| 253 | { .compatible = "fsl,mpc8349-gpio", .data = MPC8XXX_GPIO_TYPE }, |
| 254 | { .compatible = "fsl,mpc8572-gpio", .data = MPC8XXX_GPIO_TYPE}, |
| 255 | { .compatible = "fsl,mpc8610-gpio", .data = MPC8XXX_GPIO_TYPE}, |
| 256 | { .compatible = "fsl,mpc5121-gpio", .data = MPC5121_GPIO_TYPE, }, |
| 257 | { .compatible = "fsl,qoriq-gpio", .data = MPC8XXX_GPIO_TYPE }, |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 258 | { /* sentinel */ } |
| 259 | }; |
| 260 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 261 | U_BOOT_DRIVER(gpio_mpc8xxx) = { |
| 262 | .name = "gpio_mpc8xxx", |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 263 | .id = UCLASS_GPIO, |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 264 | .ops = &gpio_mpc8xxx_ops, |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 265 | #if CONFIG_IS_ENABLED(OF_CONTROL) |
Simon Glass | aad29ae | 2020-12-03 16:55:21 -0700 | [diff] [blame] | 266 | .of_to_plat = mpc8xxx_gpio_of_to_plat, |
Simon Glass | 71fa5b4 | 2020-12-03 16:55:18 -0700 | [diff] [blame] | 267 | .plat_auto = sizeof(struct mpc8xxx_gpio_plat), |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 268 | .of_match = mpc8xxx_gpio_ids, |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 269 | #endif |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 270 | .probe = mpc8xxx_gpio_probe, |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 271 | .priv_auto = sizeof(struct mpc8xxx_gpio_data), |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 272 | }; |