aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2016-01-18 10:46:50 +0000
committerJonas Gorski <jogo@openwrt.org>2016-01-18 10:46:50 +0000
commitf05fe6d2d3bede4b4e2e86197c5bc56406847869 (patch)
tree44e4fb4c560eaf492eed28f62ea334dcf5fada86 /target/linux/brcm63xx
parentafc6775e00a135748eb430de79edea4d8bd957c2 (diff)
downloadmaster-187ad058-f05fe6d2d3bede4b4e2e86197c5bc56406847869.tar.gz
master-187ad058-f05fe6d2d3bede4b4e2e86197c5bc56406847869.tar.bz2
master-187ad058-f05fe6d2d3bede4b4e2e86197c5bc56406847869.zip
brcm63xx: fix platform gpio lookups for gpios < 32
Overwriting static strings is never a good idea, especially expecting identical strings to be stored in different memory locations. This caused the lookups to always return the second chip's name. Fix this by just initializing the lookup with the right values, so we don't need to modify the strings at all. Signed-off-by: Jonas Gorski <jogo@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@48303 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/brcm63xx')
-rw-r--r--target/linux/brcm63xx/patches-4.1/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch19
-rw-r--r--target/linux/brcm63xx/patches-4.1/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch10
-rw-r--r--target/linux/brcm63xx/patches-4.4/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch19
-rw-r--r--target/linux/brcm63xx/patches-4.4/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch10
4 files changed, 20 insertions, 38 deletions
diff --git a/target/linux/brcm63xx/patches-4.1/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch b/target/linux/brcm63xx/patches-4.1/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch
index 0cbb4f52ab..15a714bfd5 100644
--- a/target/linux/brcm63xx/patches-4.1/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch
+++ b/target/linux/brcm63xx/patches-4.1/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch
@@ -42,7 +42,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
}
--- a/arch/mips/bcm63xx/gpio.c
+++ b/arch/mips/bcm63xx/gpio.c
-@@ -8,15 +8,24 @@
+@@ -8,15 +8,23 @@
* Copyright (C) Jonas Gorski <jogo@openwrt.org>
*/
@@ -58,24 +58,15 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
#include <bcm63xx_gpio.h>
#include <bcm63xx_regs.h>
-+/* for registering lookups; make them large enough to hold OF names */
-+static char *gpio_chip_labels[] = {
-+ "xxxxxxxx.gpio-controller",
-+ "xxxxxxxx.gpio-controller",
++static const char * const gpio_chip_labels[] = {
++ "bcm63xx-gpio.0",
++ "bcm63xx-gpio.1",
+};
+
static void __init bcm63xx_gpio_init_one(int id, int dir, int data, int ngpio)
{
struct resource res[2];
-@@ -40,6 +49,7 @@ 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));
- }
-@@ -64,3 +74,25 @@ int __init bcm63xx_gpio_init(void)
+@@ -64,3 +72,25 @@ int __init bcm63xx_gpio_init(void)
return 0;
}
diff --git a/target/linux/brcm63xx/patches-4.1/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch b/target/linux/brcm63xx/patches-4.1/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch
index 2faf0dea29..af6eaff075 100644
--- a/target/linux/brcm63xx/patches-4.1/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch
+++ b/target/linux/brcm63xx/patches-4.1/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch
@@ -17,13 +17,13 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+#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
+ static const char * const gpio_chip_labels[] = {
+ "bcm63xx-gpio.0",
+ "bcm63xx-gpio.1",
+@@ -48,8 +50,9 @@ 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"))
diff --git a/target/linux/brcm63xx/patches-4.4/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch b/target/linux/brcm63xx/patches-4.4/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch
index bd5f5e8f47..61a6056ed2 100644
--- a/target/linux/brcm63xx/patches-4.4/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch
+++ b/target/linux/brcm63xx/patches-4.4/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch
@@ -42,7 +42,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
}
--- a/arch/mips/bcm63xx/gpio.c
+++ b/arch/mips/bcm63xx/gpio.c
-@@ -8,15 +8,24 @@
+@@ -8,15 +8,23 @@
* Copyright (C) Jonas Gorski <jogo@openwrt.org>
*/
@@ -58,24 +58,15 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
#include <bcm63xx_gpio.h>
#include <bcm63xx_regs.h>
-+/* for registering lookups; make them large enough to hold OF names */
-+static char *gpio_chip_labels[] = {
-+ "xxxxxxxx.gpio-controller",
-+ "xxxxxxxx.gpio-controller",
++static const char * const gpio_chip_labels[] = {
++ "bcm63xx-gpio.0",
++ "bcm63xx-gpio.1",
+};
+
static void __init bcm63xx_gpio_init_one(int id, int dir, int data, int ngpio)
{
struct resource res[2];
-@@ -40,6 +49,7 @@ 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));
- }
-@@ -64,3 +74,25 @@ int __init bcm63xx_gpio_init(void)
+@@ -64,3 +72,25 @@ int __init bcm63xx_gpio_init(void)
return 0;
}
diff --git a/target/linux/brcm63xx/patches-4.4/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch b/target/linux/brcm63xx/patches-4.4/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch
index 2faf0dea29..af6eaff075 100644
--- a/target/linux/brcm63xx/patches-4.4/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch
+++ b/target/linux/brcm63xx/patches-4.4/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch
@@ -17,13 +17,13 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+#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
+ static const char * const gpio_chip_labels[] = {
+ "bcm63xx-gpio.0",
+ "bcm63xx-gpio.1",
+@@ -48,8 +50,9 @@ 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"))