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 | |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 12 | #include <dm.h> |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 13 | #include <mapmem.h> |
Mario Six | d7c6f71 | 2018-01-15 11:07:49 +0100 | [diff] [blame] | 14 | #include <asm/gpio.h> |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 15 | #include <asm/io.h> |
| 16 | #include <dm/of_access.h> |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 17 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 18 | struct mpc8xxx_gpio_data { |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 19 | /* The bank's register base in memory */ |
| 20 | struct ccsr_gpio __iomem *base; |
| 21 | /* The address of the registers; used to identify the bank */ |
Bin Meng | 09fb76d | 2021-02-25 17:22:50 +0800 | [diff] [blame] | 22 | phys_addr_t addr; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 23 | /* The GPIO count of the bank */ |
| 24 | uint gpio_count; |
| 25 | /* The GPDAT register cannot be used to determine the value of output |
| 26 | * 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] | 27 | * for output pins |
| 28 | */ |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 29 | u32 dat_shadow; |
Mario Six | d7c6f71 | 2018-01-15 11:07:49 +0100 | [diff] [blame] | 30 | ulong type; |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 31 | bool little_endian; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 32 | }; |
| 33 | |
Mario Six | d7c6f71 | 2018-01-15 11:07:49 +0100 | [diff] [blame] | 34 | enum { |
| 35 | MPC8XXX_GPIO_TYPE, |
| 36 | MPC5121_GPIO_TYPE, |
| 37 | }; |
| 38 | |
Mario Six | cc94b17 | 2018-01-15 11:07:46 +0100 | [diff] [blame] | 39 | inline u32 gpio_mask(uint gpio) |
| 40 | { |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 41 | return (1U << (31 - (gpio))); |
| 42 | } |
| 43 | |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 44 | 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] | 45 | { |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 46 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
| 47 | |
| 48 | if (data->little_endian) |
| 49 | return in_le32(&data->base->gpdat) & mask; |
| 50 | else |
| 51 | return in_be32(&data->base->gpdat) & mask; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 52 | } |
| 53 | |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 54 | 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] | 55 | { |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 56 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
| 57 | |
| 58 | if (data->little_endian) |
| 59 | return in_le32(&data->base->gpdir) & mask; |
| 60 | else |
| 61 | return in_be32(&data->base->gpdir) & mask; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 62 | } |
| 63 | |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 64 | 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] | 65 | { |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 66 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
| 67 | |
| 68 | if (data->little_endian) |
| 69 | return in_le32(&data->base->gpodr) & mask; |
| 70 | else |
| 71 | return in_be32(&data->base->gpodr) & mask; |
mario.six@gdsys.cc | 7b4cf8b | 2016-05-25 15:15:22 +0200 | [diff] [blame] | 72 | } |
| 73 | |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 74 | 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] | 75 | gpios) |
| 76 | { |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 77 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
mario.six@gdsys.cc | 7b4cf8b | 2016-05-25 15:15:22 +0200 | [diff] [blame] | 78 | /* GPODR register 1 -> open drain on */ |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 79 | if (data->little_endian) |
| 80 | setbits_le32(&data->base->gpodr, gpios); |
| 81 | else |
| 82 | setbits_be32(&data->base->gpodr, gpios); |
mario.six@gdsys.cc | 7b4cf8b | 2016-05-25 15:15:22 +0200 | [diff] [blame] | 83 | } |
| 84 | |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 85 | 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] | 86 | u32 gpios) |
| 87 | { |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 88 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
mario.six@gdsys.cc | 7b4cf8b | 2016-05-25 15:15:22 +0200 | [diff] [blame] | 89 | /* GPODR register 0 -> open drain off (actively driven) */ |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 90 | if (data->little_endian) |
| 91 | clrbits_le32(&data->base->gpodr, gpios); |
| 92 | else |
| 93 | clrbits_be32(&data->base->gpodr, gpios); |
mario.six@gdsys.cc | 7b4cf8b | 2016-05-25 15:15:22 +0200 | [diff] [blame] | 94 | } |
| 95 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 96 | 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] | 97 | { |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 98 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
Rasmus Villemoes | bb36b0d | 2020-01-28 12:04:33 +0000 | [diff] [blame] | 99 | u32 mask = gpio_mask(gpio); |
| 100 | |
| 101 | /* GPDIR register 0 -> input */ |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 102 | if (data->little_endian) |
| 103 | clrbits_le32(&data->base->gpdir, mask); |
| 104 | else |
| 105 | clrbits_be32(&data->base->gpdir, mask); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 106 | |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 107 | return 0; |
| 108 | } |
| 109 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 110 | 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] | 111 | { |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 112 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
Rasmus Villemoes | 6298529 | 2020-01-28 12:04:34 +0000 | [diff] [blame] | 113 | struct ccsr_gpio *base = data->base; |
| 114 | u32 mask = gpio_mask(gpio); |
| 115 | u32 gpdir; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 116 | |
| 117 | if (value) { |
Rasmus Villemoes | 6298529 | 2020-01-28 12:04:34 +0000 | [diff] [blame] | 118 | data->dat_shadow |= mask; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 119 | } else { |
Rasmus Villemoes | 6298529 | 2020-01-28 12:04:34 +0000 | [diff] [blame] | 120 | data->dat_shadow &= ~mask; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 121 | } |
Rasmus Villemoes | 6298529 | 2020-01-28 12:04:34 +0000 | [diff] [blame] | 122 | |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 123 | if (data->little_endian) |
| 124 | gpdir = in_le32(&base->gpdir); |
| 125 | else |
| 126 | gpdir = in_be32(&base->gpdir); |
| 127 | |
Rasmus Villemoes | 6298529 | 2020-01-28 12:04:34 +0000 | [diff] [blame] | 128 | gpdir |= gpio_mask(gpio); |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 129 | |
| 130 | if (data->little_endian) { |
| 131 | out_le32(&base->gpdat, gpdir & data->dat_shadow); |
| 132 | out_le32(&base->gpdir, gpdir); |
| 133 | } else { |
| 134 | out_be32(&base->gpdat, gpdir & data->dat_shadow); |
| 135 | out_be32(&base->gpdir, gpdir); |
| 136 | } |
Rasmus Villemoes | 6298529 | 2020-01-28 12:04:34 +0000 | [diff] [blame] | 137 | |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 138 | return 0; |
| 139 | } |
| 140 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 141 | 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] | 142 | int value) |
| 143 | { |
Mario Six | d7c6f71 | 2018-01-15 11:07:49 +0100 | [diff] [blame] | 144 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
| 145 | |
| 146 | /* GPIO 28..31 are input only on MPC5121 */ |
| 147 | if (data->type == MPC5121_GPIO_TYPE && gpio >= 28) |
| 148 | return -EINVAL; |
| 149 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 150 | return mpc8xxx_gpio_set_value(dev, gpio, value); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 151 | } |
| 152 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 153 | 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] | 154 | { |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 155 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 156 | |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 157 | if (!!mpc8xxx_gpio_get_dir(dev, gpio_mask(gpio))) { |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 158 | /* Output -> use shadowed value */ |
| 159 | return !!(data->dat_shadow & gpio_mask(gpio)); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 160 | } |
Mario Six | cc94b17 | 2018-01-15 11:07:46 +0100 | [diff] [blame] | 161 | |
| 162 | /* Input -> read value from GPDAT register */ |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 163 | return !!mpc8xxx_gpio_get_val(dev, gpio_mask(gpio)); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 164 | } |
| 165 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 166 | 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] | 167 | { |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 168 | int dir; |
| 169 | |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 170 | dir = !!mpc8xxx_gpio_get_dir(dev, gpio_mask(gpio)); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 171 | return dir ? GPIOF_OUTPUT : GPIOF_INPUT; |
| 172 | } |
| 173 | |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 174 | #if CONFIG_IS_ENABLED(OF_CONTROL) |
Simon Glass | aad29ae | 2020-12-03 16:55:21 -0700 | [diff] [blame] | 175 | static int mpc8xxx_gpio_of_to_plat(struct udevice *dev) |
Mario Six | cc94b17 | 2018-01-15 11:07:46 +0100 | [diff] [blame] | 176 | { |
Simon Glass | fa20e93 | 2020-12-03 16:55:20 -0700 | [diff] [blame] | 177 | struct mpc8xxx_gpio_plat *plat = dev_get_plat(dev); |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 178 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 179 | |
Biwen Li | db5d53b | 2021-02-05 19:01:47 +0800 | [diff] [blame] | 180 | if (dev_read_bool(dev, "little-endian")) |
hui.song | c615d0c | 2020-09-24 21:40:50 +0800 | [diff] [blame] | 181 | data->little_endian = true; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 182 | |
Bin Meng | 09fb76d | 2021-02-25 17:22:50 +0800 | [diff] [blame] | 183 | plat->addr = dev_read_addr_size_index(dev, 0, (fdt_size_t *)&plat->size); |
Mario Six | f99b6bf | 2018-01-15 11:07:50 +0100 | [diff] [blame] | 184 | plat->ngpios = dev_read_u32_default(dev, "ngpios", 32); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 185 | |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 186 | return 0; |
| 187 | } |
| 188 | #endif |
| 189 | |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 190 | static int mpc8xxx_gpio_plat_to_priv(struct udevice *dev) |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 191 | { |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 192 | struct mpc8xxx_gpio_data *priv = dev_get_priv(dev); |
Simon Glass | fa20e93 | 2020-12-03 16:55:20 -0700 | [diff] [blame] | 193 | struct mpc8xxx_gpio_plat *plat = dev_get_plat(dev); |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 194 | unsigned long size = plat->size; |
Mario Six | d7c6f71 | 2018-01-15 11:07:49 +0100 | [diff] [blame] | 195 | ulong driver_data = dev_get_driver_data(dev); |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 196 | |
| 197 | if (size == 0) |
| 198 | size = 0x100; |
| 199 | |
| 200 | priv->addr = plat->addr; |
Mario Six | f99b6bf | 2018-01-15 11:07:50 +0100 | [diff] [blame] | 201 | priv->base = map_sysmem(plat->addr, size); |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 202 | |
| 203 | if (!priv->base) |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 204 | return -ENOMEM; |
| 205 | |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 206 | priv->gpio_count = plat->ngpios; |
| 207 | priv->dat_shadow = 0; |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 208 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 209 | priv->type = driver_data; |
| 210 | |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 211 | return 0; |
| 212 | } |
| 213 | |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 214 | static int mpc8xxx_gpio_probe(struct udevice *dev) |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 215 | { |
| 216 | struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); |
Mario Six | d006f68 | 2018-01-15 11:07:48 +0100 | [diff] [blame] | 217 | struct mpc8xxx_gpio_data *data = dev_get_priv(dev); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 218 | char name[32], *str; |
| 219 | |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 220 | mpc8xxx_gpio_plat_to_priv(dev); |
Hamish Martin | 47ca9fc | 2016-06-14 10:17:05 +1200 | [diff] [blame] | 221 | |
Bin Meng | 09fb76d | 2021-02-25 17:22:50 +0800 | [diff] [blame] | 222 | snprintf(name, sizeof(name), "MPC@%.8llx", |
| 223 | (unsigned long long)data->addr); |
mario.six@gdsys.cc | 5b59a35 | 2016-05-25 15:15:20 +0200 | [diff] [blame] | 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 | }; |