6eb1bd02849c35e52045e1e3ae3763bd12b2f022
[oweals/openwrt.git] / target / linux / bcm63xx / patches-4.14 / 378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.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: do not register gpio-controller if
5 present in dtb
6
7 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
8 ---
9  arch/mips/bcm63xx/gpio.c |   7 +++++--
10  1 file changed, 5 insertions(+), 2 deletions(-)
11
12 --- a/arch/mips/bcm63xx/gpio.c
13 +++ b/arch/mips/bcm63xx/gpio.c
14 @@ -20,6 +20,8 @@
15  #include <bcm63xx_gpio.h>
16  #include <bcm63xx_regs.h>
17  
18 +#include "boards/board_common.h"
19 +
20  static const char * const gpio_chip_labels[] = {
21         "bcm63xx-gpio.0",
22         "bcm63xx-gpio.1",
23 @@ -48,8 +50,10 @@ static void __init bcm63xx_gpio_init_one
24         pdata.base = id * 32;
25         pdata.ngpio = ngpio;
26  
27 -       platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2,
28 -                                         &pdata, sizeof(pdata));
29 +       if (!board_of_device_present("gpio0") &&
30 +           !board_of_device_present("pinctrl"))
31 +               platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res,
32 +                                                 2, &pdata, sizeof(pdata));
33  }
34  
35  int __init bcm63xx_gpio_init(void)