[U-Boot] [PATCH v2 0/3] gpio: at91_gpio: Add option and clock support

The CONFIG_AT91_GPIO option is added in Kconfig to be used to select the AT91 PIO GPIO driver, and the clock is supported.
Changes in v2: - Add Reviewed-by tag.
Wenyou Yang (3): gpio: Kconfig: Add CONFIG_AT91_GPIO option gpio: at91_gpio: Add the device tree support gpio: at91_gpio: Add the clock support
drivers/gpio/Kconfig | 13 +++++++++++++ drivers/gpio/at91_gpio.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+)

The CONFIG_AT91_GPIO option is used to select AT91 PIO GPIO driver.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com Reviewed-by: Simon Glass sjg@chromium.org ---
Changes in v2: None
drivers/gpio/Kconfig | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 8d9ab52..c065342 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -28,6 +28,19 @@ config DWAPB_GPIO help Support for the Designware APB GPIO driver.
+config AT91_GPIO + bool "AT91 PIO GPIO driver" + depends on DM_GPIO + default n + help + Say yes here to select AT91 PIO GPIO driver. AT91 PIO + controller manages up to 32 fully programmable input/output + lines. Each I/O line may be dedicated as a general-purpose + I/O or be assigned to a function of an embedded peripheral. + The assignment to a function of an embedded peripheral is + the responsibility of AT91 Pinctrl driver. This driver is + responsible for the general-purpose I/O. + config ATMEL_PIO4 bool "ATMEL PIO4 driver" depends on DM_GPIO

On Fri, Oct 28, 2016 at 02:16:27PM +0800, Wenyou Yang wrote:
The CONFIG_AT91_GPIO option is used to select AT91 PIO GPIO driver.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com Reviewed-by: Simon Glass sjg@chromium.org
Reviewed-by: Andreas Bießmann andreas@biessmann.org
Changes in v2: None
drivers/gpio/Kconfig | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 8d9ab52..c065342 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -28,6 +28,19 @@ config DWAPB_GPIO help Support for the Designware APB GPIO driver.
+config AT91_GPIO
- bool "AT91 PIO GPIO driver"
- depends on DM_GPIO
- default n
- help
Say yes here to select AT91 PIO GPIO driver. AT91 PIO
controller manages up to 32 fully programmable input/output
lines. Each I/O line may be dedicated as a general-purpose
I/O or be assigned to a function of an embedded peripheral.
The assignment to a function of an embedded peripheral is
the responsibility of AT91 Pinctrl driver. This driver is
responsible for the general-purpose I/O.
config ATMEL_PIO4 bool "ATMEL PIO4 driver" depends on DM_GPIO

Add the device tree support.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com Reviewed-by: Simon Glass sjg@chromium.org ---
Changes in v2: None
drivers/gpio/at91_gpio.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c index 8e52e3d..23b2dc3 100644 --- a/drivers/gpio/at91_gpio.c +++ b/drivers/gpio/at91_gpio.c @@ -520,14 +520,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),

On Fri, Oct 28, 2016 at 02:16:28PM +0800, Wenyou Yang wrote:
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
Changes in v2: None
drivers/gpio/at91_gpio.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c index 8e52e3d..23b2dc3 100644 --- a/drivers/gpio/at91_gpio.c +++ b/drivers/gpio/at91_gpio.c @@ -520,14 +520,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),

Add the clock support.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com Reviewed-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Add Reviewed-by tag.
drivers/gpio/at91_gpio.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c index 23b2dc3..bd5c8c4 100644 --- a/drivers/gpio/at91_gpio.c +++ b/drivers/gpio/at91_gpio.c @@ -10,6 +10,7 @@
#include <config.h> #include <common.h> +#include <clk.h> #include <dm.h> #include <asm/io.h> #include <linux/sizes.h> @@ -517,6 +518,18 @@ static int at91_gpio_probe(struct udevice *dev) struct at91_port_priv *port = dev_get_priv(dev); struct at91_port_platdata *plat = dev_get_platdata(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); + struct clk clk; + int ret; + + ret = clk_get_by_index(dev, 0, &clk); + if (ret) + return ret; + + ret = clk_enable(&clk); + if (ret) + return ret; + + clk_free(&clk);
uc_priv->bank_name = plat->bank_name; uc_priv->gpio_count = GPIO_PER_BANK;

On Fri, Oct 28, 2016 at 02:16:29PM +0800, Wenyou Yang wrote:
Add the clock 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
Changes in v2:
- Add Reviewed-by tag.
drivers/gpio/at91_gpio.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c index 23b2dc3..bd5c8c4 100644 --- a/drivers/gpio/at91_gpio.c +++ b/drivers/gpio/at91_gpio.c @@ -10,6 +10,7 @@
#include <config.h> #include <common.h> +#include <clk.h> #include <dm.h> #include <asm/io.h> #include <linux/sizes.h> @@ -517,6 +518,18 @@ static int at91_gpio_probe(struct udevice *dev) struct at91_port_priv *port = dev_get_priv(dev); struct at91_port_platdata *plat = dev_get_platdata(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
struct clk clk;
int ret;
ret = clk_get_by_index(dev, 0, &clk);
if (ret)
return ret;
ret = clk_enable(&clk);
if (ret)
return ret;
clk_free(&clk);
uc_priv->bank_name = plat->bank_name; uc_priv->gpio_count = GPIO_PER_BANK;
participants (2)
-
Andreas Bießmann
-
Wenyou Yang