Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2009 Wind River Systems, Inc. |
| 3 | * Tom Rix <Tom.Rix@windriver.com> |
| 4 | * |
Wolfgang Denk | 5064ca4 | 2013-07-28 22:12:44 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0 |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 6 | * |
| 7 | * This work is derived from the linux 2.6.27 kernel source |
| 8 | * To fetch, use the kernel repository |
| 9 | * git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git |
| 10 | * Use the v2.6.27 tag. |
| 11 | * |
| 12 | * Below is the original's header including its copyright |
| 13 | * |
| 14 | * linux/arch/arm/plat-omap/gpio.c |
| 15 | * |
| 16 | * Support functions for OMAP GPIO |
| 17 | * |
| 18 | * Copyright (C) 2003-2005 Nokia Corporation |
| 19 | * Written by Juha Yrjölä <juha.yrjola@nokia.com> |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 20 | */ |
| 21 | #include <common.h> |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 22 | #include <dm.h> |
Tom Rini | 7bc2bca | 2015-07-31 19:55:09 -0400 | [diff] [blame] | 23 | #include <fdtdec.h> |
Joe Hershberger | f8928f1 | 2011-11-11 15:55:36 -0600 | [diff] [blame] | 24 | #include <asm/gpio.h> |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 25 | #include <asm/io.h> |
| 26 | #include <asm/errno.h> |
Tom Rini | 7bc2bca | 2015-07-31 19:55:09 -0400 | [diff] [blame] | 27 | #include <malloc.h> |
Mugunthan V N | 3722482 | 2015-10-13 13:57:16 +0530 | [diff] [blame] | 28 | #include <dt-bindings/gpio/gpio.h> |
Tom Rini | 7bc2bca | 2015-07-31 19:55:09 -0400 | [diff] [blame] | 29 | |
| 30 | DECLARE_GLOBAL_DATA_PTR; |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 31 | |
Sanjeev Premi | ea2cf55 | 2011-09-08 10:47:25 -0400 | [diff] [blame] | 32 | #define OMAP_GPIO_DIR_OUT 0 |
| 33 | #define OMAP_GPIO_DIR_IN 1 |
| 34 | |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 35 | #ifdef CONFIG_DM_GPIO |
| 36 | |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 37 | #define GPIO_PER_BANK 32 |
| 38 | |
| 39 | struct gpio_bank { |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 40 | /* TODO(sjg@chromium.org): Can we use a struct here? */ |
| 41 | void *base; /* address of registers in physical memory */ |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | #endif |
| 45 | |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 46 | static inline int get_gpio_index(int gpio) |
| 47 | { |
| 48 | return gpio & 0x1f; |
| 49 | } |
| 50 | |
Nikita Kiryanov | e3cb9c1 | 2012-11-27 22:40:57 +0000 | [diff] [blame] | 51 | int gpio_is_valid(int gpio) |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 52 | { |
Axel Lin | 01a461f | 2013-06-21 18:54:25 +0800 | [diff] [blame] | 53 | return (gpio >= 0) && (gpio < OMAP_MAX_GPIO); |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 54 | } |
| 55 | |
Aneesh V | 9a39088 | 2011-07-21 09:29:29 -0400 | [diff] [blame] | 56 | static void _set_gpio_direction(const struct gpio_bank *bank, int gpio, |
| 57 | int is_input) |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 58 | { |
| 59 | void *reg = bank->base; |
| 60 | u32 l; |
| 61 | |
Tom Rini | 7bc2bca | 2015-07-31 19:55:09 -0400 | [diff] [blame] | 62 | reg += OMAP_GPIO_OE; |
| 63 | |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 64 | l = __raw_readl(reg); |
| 65 | if (is_input) |
| 66 | l |= 1 << gpio; |
| 67 | else |
| 68 | l &= ~(1 << gpio); |
| 69 | __raw_writel(l, reg); |
| 70 | } |
| 71 | |
Sanjeev Premi | ea2cf55 | 2011-09-08 10:47:25 -0400 | [diff] [blame] | 72 | /** |
| 73 | * Get the direction of the GPIO by reading the GPIO_OE register |
| 74 | * corresponding to the specified bank. |
| 75 | */ |
| 76 | static int _get_gpio_direction(const struct gpio_bank *bank, int gpio) |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 77 | { |
Sanjeev Premi | ea2cf55 | 2011-09-08 10:47:25 -0400 | [diff] [blame] | 78 | void *reg = bank->base; |
| 79 | u32 v; |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 80 | |
Tom Rini | 7bc2bca | 2015-07-31 19:55:09 -0400 | [diff] [blame] | 81 | reg += OMAP_GPIO_OE; |
Sanjeev Premi | ea2cf55 | 2011-09-08 10:47:25 -0400 | [diff] [blame] | 82 | |
| 83 | v = __raw_readl(reg); |
| 84 | |
| 85 | if (v & (1 << gpio)) |
| 86 | return OMAP_GPIO_DIR_IN; |
| 87 | else |
| 88 | return OMAP_GPIO_DIR_OUT; |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 89 | } |
| 90 | |
Aneesh V | 9a39088 | 2011-07-21 09:29:29 -0400 | [diff] [blame] | 91 | static void _set_gpio_dataout(const struct gpio_bank *bank, int gpio, |
| 92 | int enable) |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 93 | { |
| 94 | void *reg = bank->base; |
| 95 | u32 l = 0; |
| 96 | |
Tom Rini | 7bc2bca | 2015-07-31 19:55:09 -0400 | [diff] [blame] | 97 | if (enable) |
| 98 | reg += OMAP_GPIO_SETDATAOUT; |
| 99 | else |
| 100 | reg += OMAP_GPIO_CLEARDATAOUT; |
| 101 | |
| 102 | l = 1 << gpio; |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 103 | __raw_writel(l, reg); |
| 104 | } |
| 105 | |
Simon Glass | ba33a3f | 2014-10-22 21:37:08 -0600 | [diff] [blame] | 106 | static int _get_gpio_value(const struct gpio_bank *bank, int gpio) |
| 107 | { |
| 108 | void *reg = bank->base; |
| 109 | int input; |
| 110 | |
Tom Rini | 7bc2bca | 2015-07-31 19:55:09 -0400 | [diff] [blame] | 111 | input = _get_gpio_direction(bank, gpio); |
| 112 | switch (input) { |
| 113 | case OMAP_GPIO_DIR_IN: |
| 114 | reg += OMAP_GPIO_DATAIN; |
| 115 | break; |
| 116 | case OMAP_GPIO_DIR_OUT: |
| 117 | reg += OMAP_GPIO_DATAOUT; |
Simon Glass | ba33a3f | 2014-10-22 21:37:08 -0600 | [diff] [blame] | 118 | break; |
| 119 | default: |
| 120 | return -1; |
| 121 | } |
| 122 | |
| 123 | return (__raw_readl(reg) & (1 << gpio)) != 0; |
| 124 | } |
| 125 | |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 126 | #ifndef CONFIG_DM_GPIO |
| 127 | |
Simon Glass | ba33a3f | 2014-10-22 21:37:08 -0600 | [diff] [blame] | 128 | static inline const struct gpio_bank *get_gpio_bank(int gpio) |
| 129 | { |
| 130 | return &omap_gpio_bank[gpio >> 5]; |
| 131 | } |
| 132 | |
| 133 | static int check_gpio(int gpio) |
| 134 | { |
| 135 | if (!gpio_is_valid(gpio)) { |
| 136 | printf("ERROR : check_gpio: invalid GPIO %d\n", gpio); |
| 137 | return -1; |
| 138 | } |
| 139 | return 0; |
| 140 | } |
| 141 | |
Sanjeev Premi | ea2cf55 | 2011-09-08 10:47:25 -0400 | [diff] [blame] | 142 | /** |
| 143 | * Set value of the specified gpio |
| 144 | */ |
Joe Hershberger | f8928f1 | 2011-11-11 15:55:36 -0600 | [diff] [blame] | 145 | int gpio_set_value(unsigned gpio, int value) |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 146 | { |
Aneesh V | 9a39088 | 2011-07-21 09:29:29 -0400 | [diff] [blame] | 147 | const struct gpio_bank *bank; |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 148 | |
| 149 | if (check_gpio(gpio) < 0) |
Joe Hershberger | f8928f1 | 2011-11-11 15:55:36 -0600 | [diff] [blame] | 150 | return -1; |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 151 | bank = get_gpio_bank(gpio); |
Sanjeev Premi | ea2cf55 | 2011-09-08 10:47:25 -0400 | [diff] [blame] | 152 | _set_gpio_dataout(bank, get_gpio_index(gpio), value); |
Joe Hershberger | f8928f1 | 2011-11-11 15:55:36 -0600 | [diff] [blame] | 153 | |
| 154 | return 0; |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 155 | } |
| 156 | |
Sanjeev Premi | ea2cf55 | 2011-09-08 10:47:25 -0400 | [diff] [blame] | 157 | /** |
| 158 | * Get value of the specified gpio |
| 159 | */ |
Joe Hershberger | f8928f1 | 2011-11-11 15:55:36 -0600 | [diff] [blame] | 160 | int gpio_get_value(unsigned gpio) |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 161 | { |
Aneesh V | 9a39088 | 2011-07-21 09:29:29 -0400 | [diff] [blame] | 162 | const struct gpio_bank *bank; |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 163 | |
| 164 | if (check_gpio(gpio) < 0) |
Joe Hershberger | f8928f1 | 2011-11-11 15:55:36 -0600 | [diff] [blame] | 165 | return -1; |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 166 | bank = get_gpio_bank(gpio); |
Simon Glass | ba33a3f | 2014-10-22 21:37:08 -0600 | [diff] [blame] | 167 | |
| 168 | return _get_gpio_value(bank, get_gpio_index(gpio)); |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 169 | } |
| 170 | |
Sanjeev Premi | ea2cf55 | 2011-09-08 10:47:25 -0400 | [diff] [blame] | 171 | /** |
| 172 | * Set gpio direction as input |
| 173 | */ |
| 174 | int gpio_direction_input(unsigned gpio) |
Joel A Fernandes | 46b9c20 | 2011-09-04 11:10:03 -0500 | [diff] [blame] | 175 | { |
Sanjeev Premi | ea2cf55 | 2011-09-08 10:47:25 -0400 | [diff] [blame] | 176 | const struct gpio_bank *bank; |
Joel A Fernandes | 46b9c20 | 2011-09-04 11:10:03 -0500 | [diff] [blame] | 177 | |
| 178 | if (check_gpio(gpio) < 0) |
Joe Hershberger | f8928f1 | 2011-11-11 15:55:36 -0600 | [diff] [blame] | 179 | return -1; |
Sanjeev Premi | ea2cf55 | 2011-09-08 10:47:25 -0400 | [diff] [blame] | 180 | |
Joel A Fernandes | 46b9c20 | 2011-09-04 11:10:03 -0500 | [diff] [blame] | 181 | bank = get_gpio_bank(gpio); |
Sanjeev Premi | ea2cf55 | 2011-09-08 10:47:25 -0400 | [diff] [blame] | 182 | _set_gpio_direction(bank, get_gpio_index(gpio), 1); |
| 183 | |
| 184 | return 0; |
Joel A Fernandes | 46b9c20 | 2011-09-04 11:10:03 -0500 | [diff] [blame] | 185 | } |
| 186 | |
Sanjeev Premi | ea2cf55 | 2011-09-08 10:47:25 -0400 | [diff] [blame] | 187 | /** |
| 188 | * Set gpio direction as output |
| 189 | */ |
| 190 | int gpio_direction_output(unsigned gpio, int value) |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 191 | { |
Sanjeev Premi | ea2cf55 | 2011-09-08 10:47:25 -0400 | [diff] [blame] | 192 | const struct gpio_bank *bank; |
| 193 | |
| 194 | if (check_gpio(gpio) < 0) |
Joe Hershberger | f8928f1 | 2011-11-11 15:55:36 -0600 | [diff] [blame] | 195 | return -1; |
Sanjeev Premi | ea2cf55 | 2011-09-08 10:47:25 -0400 | [diff] [blame] | 196 | |
| 197 | bank = get_gpio_bank(gpio); |
| 198 | _set_gpio_dataout(bank, get_gpio_index(gpio), value); |
| 199 | _set_gpio_direction(bank, get_gpio_index(gpio), 0); |
| 200 | |
| 201 | return 0; |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 202 | } |
| 203 | |
Sanjeev Premi | ea2cf55 | 2011-09-08 10:47:25 -0400 | [diff] [blame] | 204 | /** |
| 205 | * Request a gpio before using it. |
| 206 | * |
| 207 | * NOTE: Argument 'label' is unused. |
| 208 | */ |
Joe Hershberger | f8928f1 | 2011-11-11 15:55:36 -0600 | [diff] [blame] | 209 | int gpio_request(unsigned gpio, const char *label) |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 210 | { |
| 211 | if (check_gpio(gpio) < 0) |
Joe Hershberger | f8928f1 | 2011-11-11 15:55:36 -0600 | [diff] [blame] | 212 | return -1; |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 213 | |
| 214 | return 0; |
| 215 | } |
| 216 | |
Sanjeev Premi | ea2cf55 | 2011-09-08 10:47:25 -0400 | [diff] [blame] | 217 | /** |
| 218 | * Reset and free the gpio after using it. |
| 219 | */ |
Joe Hershberger | f8928f1 | 2011-11-11 15:55:36 -0600 | [diff] [blame] | 220 | int gpio_free(unsigned gpio) |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 221 | { |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 222 | return 0; |
| 223 | } |
| 224 | |
| 225 | #else /* new driver model interface CONFIG_DM_GPIO */ |
| 226 | |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 227 | /* set GPIO pin 'gpio' as an input */ |
| 228 | static int omap_gpio_direction_input(struct udevice *dev, unsigned offset) |
| 229 | { |
| 230 | struct gpio_bank *bank = dev_get_priv(dev); |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 231 | |
| 232 | /* Configure GPIO direction as input. */ |
| 233 | _set_gpio_direction(bank, offset, 1); |
| 234 | |
| 235 | return 0; |
| 236 | } |
| 237 | |
| 238 | /* set GPIO pin 'gpio' as an output, with polarity 'value' */ |
| 239 | static int omap_gpio_direction_output(struct udevice *dev, unsigned offset, |
| 240 | int value) |
| 241 | { |
| 242 | struct gpio_bank *bank = dev_get_priv(dev); |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 243 | |
| 244 | _set_gpio_dataout(bank, offset, value); |
| 245 | _set_gpio_direction(bank, offset, 0); |
| 246 | |
| 247 | return 0; |
| 248 | } |
| 249 | |
| 250 | /* read GPIO IN value of pin 'gpio' */ |
| 251 | static int omap_gpio_get_value(struct udevice *dev, unsigned offset) |
| 252 | { |
| 253 | struct gpio_bank *bank = dev_get_priv(dev); |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 254 | |
| 255 | return _get_gpio_value(bank, offset); |
| 256 | } |
| 257 | |
| 258 | /* write GPIO OUT value to pin 'gpio' */ |
| 259 | static int omap_gpio_set_value(struct udevice *dev, unsigned offset, |
| 260 | int value) |
| 261 | { |
| 262 | struct gpio_bank *bank = dev_get_priv(dev); |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 263 | |
| 264 | _set_gpio_dataout(bank, offset, value); |
| 265 | |
Joe Hershberger | f8928f1 | 2011-11-11 15:55:36 -0600 | [diff] [blame] | 266 | return 0; |
Tom Rix | dd2d1cc | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 267 | } |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 268 | |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 269 | static int omap_gpio_get_function(struct udevice *dev, unsigned offset) |
| 270 | { |
| 271 | struct gpio_bank *bank = dev_get_priv(dev); |
| 272 | |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 273 | /* GPIOF_FUNC is not implemented yet */ |
Axel Lin | bb4ab58 | 2015-01-31 22:23:38 +0800 | [diff] [blame] | 274 | if (_get_gpio_direction(bank, offset) == OMAP_GPIO_DIR_OUT) |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 275 | return GPIOF_OUTPUT; |
| 276 | else |
| 277 | return GPIOF_INPUT; |
| 278 | } |
| 279 | |
Mugunthan V N | 3722482 | 2015-10-13 13:57:16 +0530 | [diff] [blame] | 280 | static int omap_gpio_xlate(struct udevice *dev, struct gpio_desc *desc, |
| 281 | struct fdtdec_phandle_args *args) |
| 282 | { |
| 283 | desc->offset = args->args[0]; |
| 284 | desc->flags = args->args[1] & GPIO_ACTIVE_LOW ? GPIOD_ACTIVE_LOW : 0; |
| 285 | |
| 286 | return 0; |
| 287 | } |
| 288 | |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 289 | static const struct dm_gpio_ops gpio_omap_ops = { |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 290 | .direction_input = omap_gpio_direction_input, |
| 291 | .direction_output = omap_gpio_direction_output, |
| 292 | .get_value = omap_gpio_get_value, |
| 293 | .set_value = omap_gpio_set_value, |
| 294 | .get_function = omap_gpio_get_function, |
Mugunthan V N | 3722482 | 2015-10-13 13:57:16 +0530 | [diff] [blame] | 295 | .xlate = omap_gpio_xlate, |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 296 | }; |
| 297 | |
| 298 | static int omap_gpio_probe(struct udevice *dev) |
| 299 | { |
| 300 | struct gpio_bank *bank = dev_get_priv(dev); |
| 301 | struct omap_gpio_platdata *plat = dev_get_platdata(dev); |
Simon Glass | de0977b | 2015-03-05 12:25:20 -0700 | [diff] [blame] | 302 | struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 303 | |
Tom Rini | 7bc2bca | 2015-07-31 19:55:09 -0400 | [diff] [blame] | 304 | uc_priv->bank_name = plat->port_name; |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 305 | uc_priv->gpio_count = GPIO_PER_BANK; |
| 306 | bank->base = (void *)plat->base; |
Tom Rini | 7bc2bca | 2015-07-31 19:55:09 -0400 | [diff] [blame] | 307 | |
| 308 | return 0; |
| 309 | } |
| 310 | |
| 311 | static int omap_gpio_bind(struct udevice *dev) |
| 312 | { |
| 313 | struct omap_gpio_platdata *plat = dev->platdata; |
| 314 | fdt_addr_t base_addr; |
| 315 | |
| 316 | if (plat) |
| 317 | return 0; |
| 318 | |
| 319 | base_addr = dev_get_addr(dev); |
| 320 | if (base_addr == FDT_ADDR_T_NONE) |
| 321 | return -ENODEV; |
| 322 | |
| 323 | /* |
| 324 | * TODO: |
| 325 | * When every board is converted to driver model and DT is |
| 326 | * supported, this can be done by auto-alloc feature, but |
| 327 | * not using calloc to alloc memory for platdata. |
| 328 | */ |
| 329 | plat = calloc(1, sizeof(*plat)); |
| 330 | if (!plat) |
| 331 | return -ENOMEM; |
| 332 | |
| 333 | plat->base = base_addr; |
| 334 | plat->port_name = fdt_get_name(gd->fdt_blob, dev->of_offset, NULL); |
| 335 | dev->platdata = plat; |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 336 | |
| 337 | return 0; |
| 338 | } |
| 339 | |
Tom Rini | 7bc2bca | 2015-07-31 19:55:09 -0400 | [diff] [blame] | 340 | static const struct udevice_id omap_gpio_ids[] = { |
| 341 | { .compatible = "ti,omap3-gpio" }, |
| 342 | { .compatible = "ti,omap4-gpio" }, |
| 343 | { .compatible = "ti,am4372-gpio" }, |
| 344 | { } |
| 345 | }; |
| 346 | |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 347 | U_BOOT_DRIVER(gpio_omap) = { |
| 348 | .name = "gpio_omap", |
| 349 | .id = UCLASS_GPIO, |
| 350 | .ops = &gpio_omap_ops, |
Tom Rini | 7bc2bca | 2015-07-31 19:55:09 -0400 | [diff] [blame] | 351 | .of_match = omap_gpio_ids, |
| 352 | .bind = omap_gpio_bind, |
Simon Glass | 1a96d7f | 2014-10-22 21:37:09 -0600 | [diff] [blame] | 353 | .probe = omap_gpio_probe, |
| 354 | .priv_auto_alloc_size = sizeof(struct gpio_bank), |
| 355 | }; |
| 356 | |
| 357 | #endif /* CONFIG_DM_GPIO */ |