@ -1,14 +1,13 @@
From e55892aac9d5508a000647ca66f0e678e02be3bb Mon Sep 17 00:00:00 2001
From e55892aac9d5508a000647ca66f0e678e02be3bb Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jogo@openwrt.org>
From: Jonas Gorski <jogo@openwrt.org>
Date: Sat, 21 Feb 2015 17:26:50 +0100
Date: Sat, 21 Feb 2015 17:26:50 +0100
Subject: [PATCH 5/6] MIPS: BCM63XX: calculate labels for DT registered
Subject: [PATCH 5/6] MIPS: BCM63XX: do not register gpio-controller if
controllers
present in dtb
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
---
arch/mips/bcm63xx/gpio.c | 16 +++++++++++++- --
arch/mips/bcm63xx/gpio.c | 7 +++++ --
1 file changed, 13 insertions(+), 3 deletions(-)
1 file changed, 5 insertions(+), 2 deletions(-)
--- a/arch/mips/bcm63xx/gpio.c
--- a/arch/mips/bcm63xx/gpio.c
+++ b/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 */
/* for registering lookups; make them large enough to hold OF names */
static char *gpio_chip_labels[] = {
static char *gpio_chip_labels[] = {
"xxxxxxxx.gpio-controller",
"xxxxxxxx.gpio-controller",
@@ -49,9 +51,17 @@ static void __init bcm63xx_gpio_init_one
@@ -50,8 +52,9 @@ static void __init bcm63xx_gpio_init_one
pdata.base = id * 32;
pdata.ngpio = ngpio;
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,
- platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2,
- &pdata, sizeof(pdata));
- &pdata, sizeof(pdata));
+ if (board_of_device_present("gpio0")) {
+ 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,
+ platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res,
+ 2, &pdata, sizeof(pdata));
+ 2, &pdata, sizeof(pdata));
+ }
}
}
int __init bcm63xx_gpio_init(void)
int __init bcm63xx_gpio_init(void)