ltq-adsl-mei: fix bugs in linux 3.18 compatiblity change
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / patches-3.18 / 378-MIPS-BCM63XX-calculate-labels-for-DT-registered-cont.patch
1 From e55892aac9d5508a000647ca66f0e678e02be3bb Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Sat, 21 Feb 2015 17:26:50 +0100
4 Subject: [PATCH 5/6] MIPS: BCM63XX: calculate labels for DT registered
5 controllers
6
7
8 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
9 ---
10 arch/mips/bcm63xx/gpio.c | 16 +++++++++++++---
11 1 file changed, 13 insertions(+), 3 deletions(-)
12
13 --- a/arch/mips/bcm63xx/gpio.c
14 +++ b/arch/mips/bcm63xx/gpio.c
15 @@ -20,6 +20,8 @@
16 #include <bcm63xx_gpio.h>
17 #include <bcm63xx_regs.h>
18
19 +#include "boards/board_common.h"
20 +
21 /* for registering lookups; make them large enough to hold OF names */
22 static char *gpio_chip_labels[] = {
23 "xxxxxxxx.gpio-controller",
24 @@ -49,9 +51,17 @@ static void __init bcm63xx_gpio_init_one
25 pdata.base = id * 32;
26 pdata.ngpio = ngpio;
27
28 - sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
29 - platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2,
30 - &pdata, sizeof(pdata));
31 + if (board_of_device_present("gpio0")) {
32 + unsigned long base = res[0].start;
33 +
34 + if (base < 0xf0000000U)
35 + base = CPHYSADDR(base);
36 + sprintf(gpio_chip_labels[id], "%lx.gpio-controller", base);
37 + } else {
38 + sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
39 + platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res,
40 + 2, &pdata, sizeof(pdata));
41 + }
42 }
43
44 int __init bcm63xx_gpio_init(void)