---
drivers/gpio/Kconfig | 8 +++
drivers/gpio/Makefile | 1 +
- drivers/gpio/gpio-bcm63xx.c | 117 +++++++++++++++++++++++++++++++++++++++++++
- 3 files changed, 126 insertions(+)
+ drivers/gpio/gpio-bcm63xx.c | 122 +++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 131 insertions(+)
create mode 100644 drivers/gpio/gpio-bcm63xx.c
--- a/drivers/gpio/Kconfig
obj-$(CONFIG_GPIO_CS5535) += gpio-cs5535.o
--- /dev/null
+++ b/drivers/gpio/gpio-bcm63xx.c
-@@ -0,0 +1,117 @@
+@@ -0,0 +1,122 @@
+/*
+ * Driver for BCM63XX memory-mapped GPIO controllers, based on
+ * Generic driver for memory-mapped GPIO controllers.
+ platform_set_drvdata(pdev, bgc);
+
+ if (dev->of_node) {
++ int id = of_alias_get_id(dev->of_node, "gpio");
+ u32 ngpios;
+
++ if (id >= 0)
++ bgc->gc.label = devm_kasprintf(dev, GFP_KERNEL,
++ "bcm63xx-gpio.%d", id);
++
+ if (!of_property_read_u32(dev->of_node, "ngpios", &ngpios))
+ bgc->gc.ngpio = ngpios;
+
+++ /dev/null
-From e55892aac9d5508a000647ca66f0e678e02be3bb Mon Sep 17 00:00:00 2001
-From: Jonas Gorski <jogo@openwrt.org>
-Date: Sat, 21 Feb 2015 17:26:50 +0100
-Subject: [PATCH 5/6] MIPS: BCM63XX: calculate labels for DT registered
- controllers
-
-
-Signed-off-by: Jonas Gorski <jogo@openwrt.org>
----
- arch/mips/bcm63xx/gpio.c | 16 +++++++++++++---
- 1 file changed, 13 insertions(+), 3 deletions(-)
-
---- a/arch/mips/bcm63xx/gpio.c
-+++ b/arch/mips/bcm63xx/gpio.c
-@@ -20,6 +20,8 @@
- #include <bcm63xx_gpio.h>
- #include <bcm63xx_regs.h>
-
-+#include "boards/board_common.h"
-+
- /* for registering lookups; make them large enough to hold OF names */
- static char *gpio_chip_labels[] = {
- "xxxxxxxx.gpio-controller",
-@@ -49,9 +51,17 @@ static void __init bcm63xx_gpio_init_one
- pdata.base = id * 32;
- pdata.ngpio = ngpio;
-
-- sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
-- platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2,
-- &pdata, sizeof(pdata));
-+ if (board_of_device_present("gpio0")) {
-+ unsigned long base = res[0].start;
-+
-+ if (base < 0xf0000000U)
-+ base = CPHYSADDR(base);
-+ sprintf(gpio_chip_labels[id], "%lx.gpio-controller", base);
-+ } else {
-+ sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
-+ platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res,
-+ 2, &pdata, sizeof(pdata));
-+ }
- }
-
- int __init bcm63xx_gpio_init(void)
--- /dev/null
+From e55892aac9d5508a000647ca66f0e678e02be3bb Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Sat, 21 Feb 2015 17:26:50 +0100
+Subject: [PATCH 5/6] MIPS: BCM63XX: do not register gpio-controller if
+present in dtb
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ arch/mips/bcm63xx/gpio.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/arch/mips/bcm63xx/gpio.c
++++ b/arch/mips/bcm63xx/gpio.c
+@@ -20,6 +20,8 @@
+ #include <bcm63xx_gpio.h>
+ #include <bcm63xx_regs.h>
+
++#include "boards/board_common.h"
++
+ /* for registering lookups; make them large enough to hold OF names */
+ static char *gpio_chip_labels[] = {
+ "xxxxxxxx.gpio-controller",
+@@ -50,8 +52,9 @@ static void __init bcm63xx_gpio_init_one
+ pdata.ngpio = ngpio;
+
+ sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
+- platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2,
+- &pdata, sizeof(pdata));
++ if (!board_of_device_present("gpio0"))
++ platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res,
++ 2, &pdata, sizeof(pdata));
+ }
+
+ int __init bcm63xx_gpio_init(void)
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -2132,6 +2132,48 @@
+@@ -2132,6 +2132,48 @@ static struct board_info __initdata boar
.has_ehci0 = 1,
};
static struct sprom_fixup __initdata vr3025u_fixups[] = {
{ .offset = 97, .value = 0xfeb3 },
{ .offset = 98, .value = 0x1618 },
-@@ -2723,6 +2765,7 @@
+@@ -2723,6 +2765,7 @@ static const struct board_info __initcon
#ifdef CONFIG_BCM63XX_CPU_6368
&board_96368mvwg,
&board_96368mvngr,
&board_P870HW51A_V2,
&board_VR3025u,
&board_VR3025un,
-@@ -2813,6 +2856,7 @@
+@@ -2813,6 +2856,7 @@ static struct of_device_id const bcm963x
{ .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, },
{ .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, },
{ .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, },
---
drivers/gpio/Kconfig | 8 +++
drivers/gpio/Makefile | 1 +
- drivers/gpio/gpio-bcm63xx.c | 117 +++++++++++++++++++++++++++++++++++++++++++
- 3 files changed, 126 insertions(+)
+ drivers/gpio/gpio-bcm63xx.c | 122 +++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 131 insertions(+)
create mode 100644 drivers/gpio/gpio-bcm63xx.c
--- a/drivers/gpio/Kconfig
obj-$(CONFIG_GPIO_CS5535) += gpio-cs5535.o
--- /dev/null
+++ b/drivers/gpio/gpio-bcm63xx.c
-@@ -0,0 +1,117 @@
+@@ -0,0 +1,122 @@
+/*
+ * Driver for BCM63XX memory-mapped GPIO controllers, based on
+ * Generic driver for memory-mapped GPIO controllers.
+ platform_set_drvdata(pdev, bgc);
+
+ if (dev->of_node) {
++ int id = of_alias_get_id(dev->of_node, "gpio");
+ u32 ngpios;
+
++ if (id >= 0)
++ bgc->gc.label = devm_kasprintf(dev, GFP_KERNEL,
++ "bcm63xx-gpio.%d", id);
++
+ if (!of_property_read_u32(dev->of_node, "ngpios", &ngpios))
+ bgc->gc.ngpio = ngpios;
+
+++ /dev/null
-From e55892aac9d5508a000647ca66f0e678e02be3bb Mon Sep 17 00:00:00 2001
-From: Jonas Gorski <jogo@openwrt.org>
-Date: Sat, 21 Feb 2015 17:26:50 +0100
-Subject: [PATCH 5/6] MIPS: BCM63XX: calculate labels for DT registered
- controllers
-
-
-Signed-off-by: Jonas Gorski <jogo@openwrt.org>
----
- arch/mips/bcm63xx/gpio.c | 16 +++++++++++++---
- 1 file changed, 13 insertions(+), 3 deletions(-)
-
---- a/arch/mips/bcm63xx/gpio.c
-+++ b/arch/mips/bcm63xx/gpio.c
-@@ -20,6 +20,8 @@
- #include <bcm63xx_gpio.h>
- #include <bcm63xx_regs.h>
-
-+#include "boards/board_common.h"
-+
- /* for registering lookups; make them large enough to hold OF names */
- static char *gpio_chip_labels[] = {
- "xxxxxxxx.gpio-controller",
-@@ -49,9 +51,17 @@ static void __init bcm63xx_gpio_init_one
- pdata.base = id * 32;
- pdata.ngpio = ngpio;
-
-- sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
-- platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2,
-- &pdata, sizeof(pdata));
-+ if (board_of_device_present("gpio0")) {
-+ unsigned long base = res[0].start;
-+
-+ if (base < 0xf0000000U)
-+ base = CPHYSADDR(base);
-+ sprintf(gpio_chip_labels[id], "%lx.gpio-controller", base);
-+ } else {
-+ sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
-+ platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res,
-+ 2, &pdata, sizeof(pdata));
-+ }
- }
-
- int __init bcm63xx_gpio_init(void)
--- /dev/null
+From e55892aac9d5508a000647ca66f0e678e02be3bb Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Sat, 21 Feb 2015 17:26:50 +0100
+Subject: [PATCH 5/6] MIPS: BCM63XX: do not register gpio-controller if
+present in dtb
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ arch/mips/bcm63xx/gpio.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/arch/mips/bcm63xx/gpio.c
++++ b/arch/mips/bcm63xx/gpio.c
+@@ -20,6 +20,8 @@
+ #include <bcm63xx_gpio.h>
+ #include <bcm63xx_regs.h>
+
++#include "boards/board_common.h"
++
+ /* for registering lookups; make them large enough to hold OF names */
+ static char *gpio_chip_labels[] = {
+ "xxxxxxxx.gpio-controller",
+@@ -50,8 +52,9 @@ static void __init bcm63xx_gpio_init_one
+ pdata.ngpio = ngpio;
+
+ sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
+- platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2,
+- &pdata, sizeof(pdata));
++ if (!board_of_device_present("gpio0"))
++ platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res,
++ 2, &pdata, sizeof(pdata));
+ }
+
+ int __init bcm63xx_gpio_init(void)
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -2132,6 +2132,48 @@
+@@ -2132,6 +2132,48 @@ static struct board_info __initdata boar
.has_ehci0 = 1,
};
static struct sprom_fixup __initdata vr3025u_fixups[] = {
{ .offset = 97, .value = 0xfeb3 },
{ .offset = 98, .value = 0x1618 },
-@@ -2723,6 +2765,7 @@
+@@ -2723,6 +2765,7 @@ static const struct board_info __initcon
#ifdef CONFIG_BCM63XX_CPU_6368
&board_96368mvwg,
&board_96368mvngr,
&board_P870HW51A_V2,
&board_VR3025u,
&board_VR3025un,
-@@ -2813,6 +2856,7 @@
+@@ -2813,6 +2856,7 @@ static struct of_device_id const bcm963x
{ .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, },
{ .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, },
{ .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, },