summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-08-06 20:10:20 +0200
committerHans de Goede <hdegoede@redhat.com>2015-08-14 08:37:38 +0200
commitfbf10ae98657f1a888b670078f4eb18f9172c834 (patch)
treec80bc4afab428ecc58a82d89a81bf923da355193 /drivers/gpio
parentf00e8207c372b079b920b0d86cd03d6be06d2ff4 (diff)
downloadblackbird-obmc-uboot-fbf10ae98657f1a888b670078f4eb18f9172c834.tar.gz
blackbird-obmc-uboot-fbf10ae98657f1a888b670078f4eb18f9172c834.zip
sunxi: gpio: Add support for the gpio banks which are part of the R-io cluster
sun6i and later have a couple of io-blocks which are shared between the main CPU core and the "R" cpu which is small embedded cpu which can be active while the main system is suspended. These gpio banks sit at a different mmio address then the normal banks, and have a separate devicetree node and compatible, this adds support for these banks to the sunxi-gpio code when built with device-model support. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Ian Campbell <ijc@hellion.org.uk>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/sunxi_gpio.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c
index afa165ab78..57b78e55e2 100644
--- a/drivers/gpio/sunxi_gpio.c
+++ b/drivers/gpio/sunxi_gpio.c
@@ -266,16 +266,28 @@ static int gpio_sunxi_bind(struct udevice *parent)
{
struct sunxi_gpio_platdata *plat = parent->platdata;
struct sunxi_gpio_reg *ctlr;
- int bank;
- int ret;
+ int bank, no_banks, ret, start;
/* If this is a child device, there is nothing to do here */
if (plat)
return 0;
+ if (fdt_node_check_compatible(gd->fdt_blob, parent->of_offset,
+ "allwinner,sun6i-a31-r-pinctrl") == 0) {
+ start = 'L' - 'A';
+ no_banks = 2; /* L & M */
+ } else if (fdt_node_check_compatible(gd->fdt_blob, parent->of_offset,
+ "allwinner,sun8i-a23-r-pinctrl") == 0) {
+ start = 'L' - 'A';
+ no_banks = 1; /* L only */
+ } else {
+ start = 0;
+ no_banks = SUNXI_GPIO_BANKS;
+ }
+
ctlr = (struct sunxi_gpio_reg *)fdtdec_get_addr(gd->fdt_blob,
parent->of_offset, "reg");
- for (bank = 0; bank < SUNXI_GPIO_BANKS; bank++) {
+ for (bank = 0; bank < no_banks; bank++) {
struct sunxi_gpio_platdata *plat;
struct udevice *dev;
@@ -283,7 +295,7 @@ static int gpio_sunxi_bind(struct udevice *parent)
if (!plat)
return -ENOMEM;
plat->regs = &ctlr->gpio_bank[bank];
- plat->bank_name = gpio_bank_name(bank);
+ plat->bank_name = gpio_bank_name(start + bank);
plat->gpio_count = SUNXI_GPIOS_PER_BANK;
ret = device_bind(parent, parent->driver,
@@ -306,6 +318,8 @@ static const struct udevice_id sunxi_gpio_ids[] = {
{ .compatible = "allwinner,sun8i-a23-pinctrl" },
{ .compatible = "allwinner,sun8i-a33-pinctrl" },
{ .compatible = "allwinner,sun9i-a80-pinctrl" },
+ { .compatible = "allwinner,sun6i-a31-r-pinctrl" },
+ { .compatible = "allwinner,sun8i-a23-r-pinctrl" },
{ }
};
OpenPOWER on IntegriCloud