diff options
author | Wenyou Yang <wenyou.yang@atmel.com> | 2017-03-23 12:46:20 +0800 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2017-04-13 14:44:50 -0600 |
commit | cf468880c37be1a7fea0a842a14ba1e1e388147c (patch) | |
tree | 1ba275ee90ff5b4b170ac9c3b60fb906379bf07b | |
parent | 5a07a5f9224d792a27ac9894f86239bc7b3298ba (diff) | |
download | u-boot-cf468880c37be1a7fea0a842a14ba1e1e388147c.zip u-boot-cf468880c37be1a7fea0a842a14ba1e1e388147c.tar.gz u-boot-cf468880c37be1a7fea0a842a14ba1e1e388147c.tar.bz2 |
gpio: at91_gpio: add the device tree support
Add the device tree support.
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andreas Bießmann <andreas@biessmann.org>
-rw-r--r-- | drivers/gpio/at91_gpio.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c index 2f9e44b..37955cc 100644 --- a/drivers/gpio/at91_gpio.c +++ b/drivers/gpio/at91_gpio.c @@ -572,14 +572,29 @@ static int at91_gpio_probe(struct udevice *dev) uc_priv->bank_name = plat->bank_name; uc_priv->gpio_count = GPIO_PER_BANK; + +#if CONFIG_IS_ENABLED(OF_CONTROL) + plat->base_addr = (uint32_t)dev_get_addr_ptr(dev); +#endif port->regs = (struct at91_port *)plat->base_addr; return 0; } +#if CONFIG_IS_ENABLED(OF_CONTROL) +static const struct udevice_id at91_gpio_ids[] = { + { .compatible = "atmel,at91rm9200-gpio" }, + { } +}; +#endif + U_BOOT_DRIVER(gpio_at91) = { .name = "gpio_at91", .id = UCLASS_GPIO, +#if CONFIG_IS_ENABLED(OF_CONTROL) + .of_match = at91_gpio_ids, + .platdata_auto_alloc_size = sizeof(struct at91_port_platdata), +#endif .ops = &gpio_at91_ops, .probe = at91_gpio_probe, .priv_auto_alloc_size = sizeof(struct at91_port_priv), |