diff mbox

[OpenWrt-Devel,v2,2/4] brcm63xx: use bcm6345-gpio over legacy

Message ID 548EF4A9.6000208@gmail.com
State Changes Requested
Delegated to: Jonas Gorski
Headers show

Commit Message

Álvaro Fernández Rojas Dec. 15, 2014, 2:48 p.m. UTC
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
v2: keep changes minimal as suggested by Jonas
diff mbox

Patch

diff --git a/target/linux/brcm63xx/patches-3.14/375-DT-GPIO-over-legacy.patch b/target/linux/brcm63xx/patches-3.14/375-DT-GPIO-over-legacy.patch
new file mode 100644
index 0000000..8c9bfc8
--- /dev/null
+++ b/target/linux/brcm63xx/patches-3.14/375-DT-GPIO-over-legacy.patch
@@ -0,0 +1,45 @@ 
+diff -uprN a/arch/mips/bcm63xx/boards/board_common.c b/arch/mips/bcm63xx/boards/board_common.c
+--- a/arch/mips/bcm63xx/boards/board_common.c	2014-12-10 13:14:58.299519952 +0100
++++ b/arch/mips/bcm63xx/boards/board_common.c	2014-12-13 02:24:59.308489309 +0100
+@@ -222,6 +222,10 @@ int __init board_register_devices(void)
+ 	}
+ #endif
+ 
++	if (!board_of_device_present("gpio0")) {
++		bcm63xx_gpio_init();
++	}
++
+ 	if (board.has_uart0)
+ 		bcm63xx_uart_register(0);
+ 
+@@ -287,7 +291,7 @@ int __init board_register_devices(void)
+ 	while (led_count < ARRAY_SIZE(board.leds) && board.leds[led_count].name)
+ 		led_count++;
+ 
+-	if (led_count) {
++	if (led_count && !board_of_device_present("gpio0")) {
+ 		bcm63xx_led_data.num_leds = led_count;
+ 		bcm63xx_led_data.leds = board.leds;
+ 
+@@ -302,7 +306,7 @@ int __init board_register_devices(void)
+ 	while (button_count < ARRAY_SIZE(board.buttons) && board.buttons[button_count].desc)
+ 		button_count++;
+ 
+-	if (button_count) {
++	if (button_count && !board_of_device_present("gpio0")) {
+ 		bcm63xx_gpio_keys_data.nbuttons = button_count;
+ 		bcm63xx_gpio_keys_data.buttons = board.buttons;
+ 
+diff -uprN a/arch/mips/bcm63xx/prom.c b/arch/mips/bcm63xx/prom.c
+--- a/arch/mips/bcm63xx/prom.c	2014-12-10 13:14:58.299519952 +0100
++++ b/arch/mips/bcm63xx/prom.c	2014-12-10 13:16:13.879516528 +0100
+@@ -54,9 +54,6 @@ void __init prom_init(void)
+ 	reg &= ~mask;
+ 	bcm_perf_writel(reg, PERF_CKCTL_REG);
+ 
+-	/* register gpiochip */
+-	bcm63xx_gpio_init();
+-
+ 	/* detect and setup flash access */
+ 	bcm63xx_flash_detect();
+ 
diff --git a/target/linux/brcm63xx/patches-3.18/375-DT-GPIO-over-legacy.patch b/target/linux/brcm63xx/patches-3.18/375-DT-GPIO-over-legacy.patch
new file mode 100644
index 0000000..8c9bfc8
--- /dev/null
+++ b/target/linux/brcm63xx/patches-3.18/375-DT-GPIO-over-legacy.patch
@@ -0,0 +1,45 @@ 
+diff -uprN a/arch/mips/bcm63xx/boards/board_common.c b/arch/mips/bcm63xx/boards/board_common.c
+--- a/arch/mips/bcm63xx/boards/board_common.c	2014-12-10 13:14:58.299519952 +0100
++++ b/arch/mips/bcm63xx/boards/board_common.c	2014-12-13 02:24:59.308489309 +0100
+@@ -222,6 +222,10 @@ int __init board_register_devices(void)
+ 	}
+ #endif
+ 
++	if (!board_of_device_present("gpio0")) {
++		bcm63xx_gpio_init();
++	}
++
+ 	if (board.has_uart0)
+ 		bcm63xx_uart_register(0);
+ 
+@@ -287,7 +291,7 @@ int __init board_register_devices(void)
+ 	while (led_count < ARRAY_SIZE(board.leds) && board.leds[led_count].name)
+ 		led_count++;
+ 
+-	if (led_count) {
++	if (led_count && !board_of_device_present("gpio0")) {
+ 		bcm63xx_led_data.num_leds = led_count;
+ 		bcm63xx_led_data.leds = board.leds;
+ 
+@@ -302,7 +306,7 @@ int __init board_register_devices(void)
+ 	while (button_count < ARRAY_SIZE(board.buttons) && board.buttons[button_count].desc)
+ 		button_count++;
+ 
+-	if (button_count) {
++	if (button_count && !board_of_device_present("gpio0")) {
+ 		bcm63xx_gpio_keys_data.nbuttons = button_count;
+ 		bcm63xx_gpio_keys_data.buttons = board.buttons;
+ 
+diff -uprN a/arch/mips/bcm63xx/prom.c b/arch/mips/bcm63xx/prom.c
+--- a/arch/mips/bcm63xx/prom.c	2014-12-10 13:14:58.299519952 +0100
++++ b/arch/mips/bcm63xx/prom.c	2014-12-10 13:16:13.879516528 +0100
+@@ -54,9 +54,6 @@ void __init prom_init(void)
+ 	reg &= ~mask;
+ 	bcm_perf_writel(reg, PERF_CKCTL_REG);
+ 
+-	/* register gpiochip */
+-	bcm63xx_gpio_init();
+-
+ 	/* detect and setup flash access */
+ 	bcm63xx_flash_detect();
+