aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2015-03-16 13:37:38 +0000
committerJonas Gorski <jogo@openwrt.org>2015-03-16 13:37:38 +0000
commit343ec8d6452059e3f45f74acfc9ae26cae26446a (patch)
treedffec8cc466ac9b1a0bc7936bc866fa3cd5573fe /target/linux
parente1a8e41287337b9cccd7758ee5d0372d6ebc3210 (diff)
downloadupstream-343ec8d6452059e3f45f74acfc9ae26cae26446a.tar.gz
upstream-343ec8d6452059e3f45f74acfc9ae26cae26446a.tar.bz2
upstream-343ec8d6452059e3f45f74acfc9ae26cae26446a.zip
brcm63xx: use consistent gpio chip labeling for OF/non-OF
Ensure gpio chips are always labeled the same; this allows simplifying any arch setup gpio lookups. Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 44846
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/brcm63xx/patches-3.14/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch11
-rw-r--r--target/linux/brcm63xx/patches-3.14/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch (renamed from target/linux/brcm63xx/patches-3.14/378-MIPS-BCM63XX-calculate-labels-for-DT-registered-cont.patch)24
-rw-r--r--target/linux/brcm63xx/patches-3.14/568-board_DGND3700v1_3800B.patch6
-rw-r--r--target/linux/brcm63xx/patches-3.18/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch11
-rw-r--r--target/linux/brcm63xx/patches-3.18/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch (renamed from target/linux/brcm63xx/patches-3.18/378-MIPS-BCM63XX-calculate-labels-for-DT-registered-cont.patch)24
-rw-r--r--target/linux/brcm63xx/patches-3.18/568-board_DGND3700v1_3800B.patch6
6 files changed, 36 insertions, 46 deletions
diff --git a/target/linux/brcm63xx/patches-3.14/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch b/target/linux/brcm63xx/patches-3.14/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch
index 2a07e735ca..6f74d027f9 100644
--- a/target/linux/brcm63xx/patches-3.14/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch
+++ b/target/linux/brcm63xx/patches-3.14/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch
@@ -8,8 +8,8 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
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
@@ -41,7 +41,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
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.
@@ -117,8 +117,13 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+ 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;
+
diff --git a/target/linux/brcm63xx/patches-3.14/378-MIPS-BCM63XX-calculate-labels-for-DT-registered-cont.patch b/target/linux/brcm63xx/patches-3.14/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch
index 40f9e6dc7f..2faf0dea29 100644
--- a/target/linux/brcm63xx/patches-3.14/378-MIPS-BCM63XX-calculate-labels-for-DT-registered-cont.patch
+++ b/target/linux/brcm63xx/patches-3.14/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch
@@ -1,14 +1,13 @@
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
-
+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 | 16 +++++++++++++---
- 1 file changed, 13 insertions(+), 3 deletions(-)
+ 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
@@ -21,24 +20,15 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
/* 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;
+@@ -50,8 +52,9 @@ static void __init bcm63xx_gpio_init_one
pdata.ngpio = ngpio;
-- sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
+ 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);
++ 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)
diff --git a/target/linux/brcm63xx/patches-3.14/568-board_DGND3700v1_3800B.patch b/target/linux/brcm63xx/patches-3.14/568-board_DGND3700v1_3800B.patch
index b4013bbd4a..3a203c2409 100644
--- a/target/linux/brcm63xx/patches-3.14/568-board_DGND3700v1_3800B.patch
+++ b/target/linux/brcm63xx/patches-3.14/568-board_DGND3700v1_3800B.patch
@@ -1,6 +1,6 @@
--- 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,
};
@@ -49,7 +49,7 @@
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,
@@ -57,7 +57,7 @@
&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, },
diff --git a/target/linux/brcm63xx/patches-3.18/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch b/target/linux/brcm63xx/patches-3.18/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch
index 53fcb8a3f5..3e53c80606 100644
--- a/target/linux/brcm63xx/patches-3.18/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch
+++ b/target/linux/brcm63xx/patches-3.18/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch
@@ -8,8 +8,8 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
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
@@ -41,7 +41,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
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.
@@ -117,8 +117,13 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+ 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;
+
diff --git a/target/linux/brcm63xx/patches-3.18/378-MIPS-BCM63XX-calculate-labels-for-DT-registered-cont.patch b/target/linux/brcm63xx/patches-3.18/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch
index 40f9e6dc7f..2faf0dea29 100644
--- a/target/linux/brcm63xx/patches-3.18/378-MIPS-BCM63XX-calculate-labels-for-DT-registered-cont.patch
+++ b/target/linux/brcm63xx/patches-3.18/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch
@@ -1,14 +1,13 @@
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
-
+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 | 16 +++++++++++++---
- 1 file changed, 13 insertions(+), 3 deletions(-)
+ 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
@@ -21,24 +20,15 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
/* 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;
+@@ -50,8 +52,9 @@ static void __init bcm63xx_gpio_init_one
pdata.ngpio = ngpio;
-- sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
+ 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);
++ 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)
diff --git a/target/linux/brcm63xx/patches-3.18/568-board_DGND3700v1_3800B.patch b/target/linux/brcm63xx/patches-3.18/568-board_DGND3700v1_3800B.patch
index b4013bbd4a..3a203c2409 100644
--- a/target/linux/brcm63xx/patches-3.18/568-board_DGND3700v1_3800B.patch
+++ b/target/linux/brcm63xx/patches-3.18/568-board_DGND3700v1_3800B.patch
@@ -1,6 +1,6 @@
--- 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,
};
@@ -49,7 +49,7 @@
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,
@@ -57,7 +57,7 @@
&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, },