Skip to content
Snippets Groups Projects
Commit fbf10ae9 authored by Hans de Goede's avatar Hans de Goede
Browse files

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: default avatarHans de Goede <hdegoede@redhat.com>
Acked-by: default avatarIan Campbell <ijc@hellion.org.uk>
parent f00e8207
No related branches found
No related tags found
No related merge requests found
...@@ -266,16 +266,28 @@ static int gpio_sunxi_bind(struct udevice *parent) ...@@ -266,16 +266,28 @@ static int gpio_sunxi_bind(struct udevice *parent)
{ {
struct sunxi_gpio_platdata *plat = parent->platdata; struct sunxi_gpio_platdata *plat = parent->platdata;
struct sunxi_gpio_reg *ctlr; struct sunxi_gpio_reg *ctlr;
int bank; int bank, no_banks, ret, start;
int ret;
/* If this is a child device, there is nothing to do here */ /* If this is a child device, there is nothing to do here */
if (plat) if (plat)
return 0; 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, ctlr = (struct sunxi_gpio_reg *)fdtdec_get_addr(gd->fdt_blob,
parent->of_offset, "reg"); 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 sunxi_gpio_platdata *plat;
struct udevice *dev; struct udevice *dev;
...@@ -283,7 +295,7 @@ static int gpio_sunxi_bind(struct udevice *parent) ...@@ -283,7 +295,7 @@ static int gpio_sunxi_bind(struct udevice *parent)
if (!plat) if (!plat)
return -ENOMEM; return -ENOMEM;
plat->regs = &ctlr->gpio_bank[bank]; 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; plat->gpio_count = SUNXI_GPIOS_PER_BANK;
ret = device_bind(parent, parent->driver, ret = device_bind(parent, parent->driver,
...@@ -306,6 +318,8 @@ static const struct udevice_id sunxi_gpio_ids[] = { ...@@ -306,6 +318,8 @@ static const struct udevice_id sunxi_gpio_ids[] = {
{ .compatible = "allwinner,sun8i-a23-pinctrl" }, { .compatible = "allwinner,sun8i-a23-pinctrl" },
{ .compatible = "allwinner,sun8i-a33-pinctrl" }, { .compatible = "allwinner,sun8i-a33-pinctrl" },
{ .compatible = "allwinner,sun9i-a80-pinctrl" }, { .compatible = "allwinner,sun9i-a80-pinctrl" },
{ .compatible = "allwinner,sun6i-a31-r-pinctrl" },
{ .compatible = "allwinner,sun8i-a23-r-pinctrl" },
{ } { }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment