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