diff mbox

[OpenWrt-Devel,3/3] brcm63xx: configure pinmux for Serial LEDs.

Message ID 1441457918-9494-3-git-send-email-noltari@gmail.com
State Deferred
Delegated to: Jonas Gorski
Headers show

Commit Message

Álvaro Fernández Rojas Sept. 5, 2015, 12:58 p.m. UTC
This is a temporary hack until a proper pinmux driver for bcm63xx is added

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 .../805-BCM63XX-pinmux-serial-leds.patch           | 49 ++++++++++++++++++++++
 .../805-BCM63XX-pinmux-serial-leds.patch           | 49 ++++++++++++++++++++++
 2 files changed, 98 insertions(+)
 create mode 100644 target/linux/brcm63xx/patches-3.18/805-BCM63XX-pinmux-serial-leds.patch
 create mode 100644 target/linux/brcm63xx/patches-4.1/805-BCM63XX-pinmux-serial-leds.patch
diff mbox

Patch

diff --git a/target/linux/brcm63xx/patches-3.18/805-BCM63XX-pinmux-serial-leds.patch b/target/linux/brcm63xx/patches-3.18/805-BCM63XX-pinmux-serial-leds.patch
new file mode 100644
index 0000000..0af0ac9
--- /dev/null
+++ b/target/linux/brcm63xx/patches-3.18/805-BCM63XX-pinmux-serial-leds.patch
@@ -0,0 +1,49 @@ 
+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	2015-03-16 16:07:28.171114109 +0100
++++ b/arch/mips/bcm63xx/boards/board_common.c	2015-05-18 22:53:49.967864529 +0200
+@@ -222,6 +222,45 @@ int __init board_register_devices(void)
+ 	}
+ #endif
+ 
++	/* Serial LEDs pinmux */
++	if (board_of_device_present("leds0")) {
++		u32 val, val2;
++
++		val = bcm_gpio_readl(GPIO_MODE_REG);
++		if (BCMCPU_IS_6318()) {
++			val |= BIT(6) | BIT(7);
++
++			#define PINMUX_EPHY2_ACT_LED (1 << (6 << 1))
++			#define PINMUX_EPHY3_ACT_LED (1 << (7 << 1))
++			#define PINMUX_SERIAL_LED_DATA (3 << (6 << 1))
++			#define PINMUX_SERIAL_LED_CLK (3 << (7 << 1))
++
++			val2 = bcm_gpio_readl(GPIO_PINMUX_SEL0_6318);
++			val2 &= ~(PINMUX_EPHY2_ACT_LED | PINMUX_EPHY3_ACT_LED);
++			val2 |= (PINMUX_SERIAL_LED_DATA | PINMUX_SERIAL_LED_CLK);
++			bcm_gpio_writel(val2, GPIO_PINMUX_SEL0_6318);
++		} else if (BCMCPU_IS_6328()) {
++			val |= BIT(6) | BIT(7);
++		} else if (BCMCPU_IS_63268()) {
++			val |= BIT(0) | BIT(1);
++		} else if (BCMCPU_IS_6358()) {
++			val |= BIT(10);
++
++			val2 = bcm_gpio_readl(GPIO_CTL_LO_REG);
++			val2 |= BIT(6) | BIT(7);
++			bcm_gpio_writel(val2, GPIO_CTL_LO_REG);
++		} else if (BCMCPU_IS_6362()) {
++			val |= BIT(2) | BIT(3);
++		} else if (BCMCPU_IS_6368()) {
++			val |= BIT(3) | BIT(4);
++
++			val2 = bcm_gpio_readl(GPIO_CTL_LO_REG);
++			val2 |= BIT(3) | BIT(4);
++			bcm_gpio_writel(val2, GPIO_CTL_LO_REG);
++		}
++		bcm_gpio_writel(val, GPIO_MODE_REG);
++	}
++
+ 	bcm63xx_gpio_init();
+ 
+ 	if (board.has_uart0)
diff --git a/target/linux/brcm63xx/patches-4.1/805-BCM63XX-pinmux-serial-leds.patch b/target/linux/brcm63xx/patches-4.1/805-BCM63XX-pinmux-serial-leds.patch
new file mode 100644
index 0000000..0af0ac9
--- /dev/null
+++ b/target/linux/brcm63xx/patches-4.1/805-BCM63XX-pinmux-serial-leds.patch
@@ -0,0 +1,49 @@ 
+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	2015-03-16 16:07:28.171114109 +0100
++++ b/arch/mips/bcm63xx/boards/board_common.c	2015-05-18 22:53:49.967864529 +0200
+@@ -222,6 +222,45 @@ int __init board_register_devices(void)
+ 	}
+ #endif
+ 
++	/* Serial LEDs pinmux */
++	if (board_of_device_present("leds0")) {
++		u32 val, val2;
++
++		val = bcm_gpio_readl(GPIO_MODE_REG);
++		if (BCMCPU_IS_6318()) {
++			val |= BIT(6) | BIT(7);
++
++			#define PINMUX_EPHY2_ACT_LED (1 << (6 << 1))
++			#define PINMUX_EPHY3_ACT_LED (1 << (7 << 1))
++			#define PINMUX_SERIAL_LED_DATA (3 << (6 << 1))
++			#define PINMUX_SERIAL_LED_CLK (3 << (7 << 1))
++
++			val2 = bcm_gpio_readl(GPIO_PINMUX_SEL0_6318);
++			val2 &= ~(PINMUX_EPHY2_ACT_LED | PINMUX_EPHY3_ACT_LED);
++			val2 |= (PINMUX_SERIAL_LED_DATA | PINMUX_SERIAL_LED_CLK);
++			bcm_gpio_writel(val2, GPIO_PINMUX_SEL0_6318);
++		} else if (BCMCPU_IS_6328()) {
++			val |= BIT(6) | BIT(7);
++		} else if (BCMCPU_IS_63268()) {
++			val |= BIT(0) | BIT(1);
++		} else if (BCMCPU_IS_6358()) {
++			val |= BIT(10);
++
++			val2 = bcm_gpio_readl(GPIO_CTL_LO_REG);
++			val2 |= BIT(6) | BIT(7);
++			bcm_gpio_writel(val2, GPIO_CTL_LO_REG);
++		} else if (BCMCPU_IS_6362()) {
++			val |= BIT(2) | BIT(3);
++		} else if (BCMCPU_IS_6368()) {
++			val |= BIT(3) | BIT(4);
++
++			val2 = bcm_gpio_readl(GPIO_CTL_LO_REG);
++			val2 |= BIT(3) | BIT(4);
++			bcm_gpio_writel(val2, GPIO_CTL_LO_REG);
++		}
++		bcm_gpio_writel(val, GPIO_MODE_REG);
++	}
++
+ 	bcm63xx_gpio_init();
+ 
+ 	if (board.has_uart0)