Openwrt/target/linux/brcm63xx/patches-4.4/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch
Jonas Gorski 74aca7d913 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>

SVN-Revision: 48303
2016-01-18 10:46:50 +00:00

35 lines
1.0 KiB
Diff

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: do not register gpio-controller if
present in dtb
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
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
@@ -20,6 +20,8 @@
#include <bcm63xx_gpio.h>
#include <bcm63xx_regs.h>
+#include "boards/board_common.h"
+
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;
- platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2,
- &pdata, sizeof(pdata));
+ 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)