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