[OpenWrt-Devel] [PATCH] brcm63xx: fix Livebox1 support

dani dgcbueu at gmail.com
Sun Mar 6 13:55:21 EST 2016


Livebox firmware is totally broken, fix it and make specific firmware
for the DV4210 model.

- Added relocate stuff to allow boot the kernel
- Fix RAM firmware
- Rename dts file, now specific for the DV4210 model
- Fix leds in the dts file
- Add status led
- Set button 1 as failsafe button
- Disable dts flash detection, because physmap dts stuff seems to be 
broken for detecting Redboot partitions
- Set eth0 as the LAN port, for coherence and comfortability.
- Add led triggers
- Make board data in the kernel file specific for DV4210. Add also DV4410
for future use or reference

Signed-off-by: Daniel Gonzalez <dgcbueu at gmail.com>
diff --git a/target/linux/brcm63xx/base-files/etc/board.d/01_leds b/target/linux/brcm63xx/base-files/etc/board.d/01_leds
index 8339254..209ebb9 100755
--- a/target/linux/brcm63xx/base-files/etc/board.d/01_leds
+++ b/target/linux/brcm63xx/base-files/etc/board.d/01_leds
@@ -51,6 +51,11 @@ homehub2a)
 	ucidef_set_led_usbdev "usb1" "USB1" "HOMEHUB2A:blue:phone" "1-1"
 	ucidef_set_led_usbdev "usb2" "USB2" "HOMEHUB2A:green:phone" "2-1"
 	;;
+livebox1)
+	ucidef_set_led_netdev "lan" "LAN" "Livebox1:red:traffic" "eth0"
+	ucidef_set_led_netdev "wan" "WAN" "Livebox1:red:adsl" "eth1"
+	ucidef_set_led_netdev "wlan0" "WIFI" "Livebox1:red:wifi" "wlan0"
+	;;
 r5010un_v2)
 	ucidef_set_led_usbdev "usb" "USB" "R5010UNv2:green:usb" "1-1"
 	;;
diff --git a/target/linux/brcm63xx/base-files/etc/board.d/02_network b/target/linux/brcm63xx/base-files/etc/board.d/02_network
index f96da08..ffab119 100755
--- a/target/linux/brcm63xx/base-files/etc/board.d/02_network
+++ b/target/linux/brcm63xx/base-files/etc/board.d/02_network
@@ -128,6 +128,10 @@ bcm963268bu_p300)
 		"0:lan" "3:lan" "4:lan" "5:lan" "6:lan" "7:lan" "8t at eth0"
 	;;
 
+livebox1)
+	ucidef_set_interfaces_lan_wan "eth0" "eth1"
+	;;
+
 *)
 	ucidef_set_interfaces_lan_wan "eth1" "eth0"
 	;;
diff --git a/target/linux/brcm63xx/base-files/etc/diag.sh b/target/linux/brcm63xx/base-files/etc/diag.sh
index b864964..2dd668d 100644
--- a/target/linux/brcm63xx/base-files/etc/diag.sh
+++ b/target/linux/brcm63xx/base-files/etc/diag.sh
@@ -99,6 +99,9 @@ set_state() {
 	hg655b)
 		status_led="HW65x:green:power"
 		;;
+	livebox1)
+		status_led="Livebox1:red:adsl-fail-power"
+		;;
 	p870hw-51a_v2)
 		status_led="P870HW-51a:green:power"
 		;;
diff --git a/target/linux/brcm63xx/dts/livebox-blue-5g.dts b/target/linux/brcm63xx/dts/livebox-blue-5g.dts
deleted file mode 100644
index bc3d403..0000000
--- a/target/linux/brcm63xx/dts/livebox-blue-5g.dts
+++ /dev/null
@@ -1,68 +0,0 @@
-/dts-v1/;
-
-#include "bcm6348.dtsi"
-
-#include <dt-bindings/input/input.h>
-
-/ {
-	model = "Inventel Livebox 1";
-	compatible = "inventel,livebox-blue-5g", "brcm,bcm6348";
-
-	gpio-keys-polled {
-		compatible = "gpio-keys-polled";
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		poll-interval = <20>;
-		debounce-interval = <60>;
-
-		button1 {
-			label = "BTN_1";
-			gpios = <&gpio1 4 1>;
-			linux,code = <BTN_1>;
-		};
-
-		button2 {
-			label = "BTN_2";
-			gpios = <&gpio0 7 1>;
-			linux,code = <BTN_2>;
-		};
-	};
-
-	gpio-leds {
-		compatible = "gpio-leds";
-
-		red_adsl_fail {
-			label = "Livebox-blue-5g:red:adsl-fail";
-			gpios = <&gpio0 0 0>;
-			default-state = "on";
-		};
-
-		red_adsl {
-			label = "Livebox-blue-5g:red:adsl-fail";
-			gpios = <&gpio0 1 0>;
-		};
-
-		red_traffic {
-			label = "Livebox-blue-5g:red:adsl-fail";
-			gpios = <&gpio0 2 0>;
-		};
-
-		red_phone {
-			label = "Livebox-blue-5g:red:adsl-fail";
-			gpios = <&gpio0 3 0>;
-		};
-
-		red_wifi {
-			label = "Livebox-blue-5g:red:adsl-fail";
-			gpios = <&gpio0 4 0>;
-		};
-	};
-};
-
-&pflash {
-	reg = <0x1e400000 0x800000>;
-	status = "ok";
-
-	linux,part-probe = "redboot";
-};
diff --git a/target/linux/brcm63xx/dts/livebox-dv4210.dts b/target/linux/brcm63xx/dts/livebox-dv4210.dts
new file mode 100644
index 0000000..b4570ca
--- /dev/null
+++ b/target/linux/brcm63xx/dts/livebox-dv4210.dts
@@ -0,0 +1,68 @@
+/dts-v1/;
+
+#include "bcm6348.dtsi"
+
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "Inventel Livebox 1";
+	compatible = "inventel,livebox-dv4210", "brcm,bcm6348";
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		poll-interval = <20>;
+		debounce-interval = <60>;
+
+		button1 {
+			label = "BTN_1";
+			gpios = <&gpio1 4 1>;
+			linux,code = <KEY_RESTART>;
+		};
+
+		button2 {
+			label = "BTN_2";
+			gpios = <&gpio0 7 1>;
+			linux,code = <BTN_2>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		red_adsl_fail {
+			label = "Livebox1:red:adsl-fail-power";
+			gpios = <&gpio0 0 0>;
+			default-state = "on";
+		};
+
+		red_adsl {
+			label = "Livebox1:red:adsl";
+			gpios = <&gpio0 1 0>;
+		};
+
+		red_traffic {
+			label = "Livebox1:red:traffic";
+			gpios = <&gpio0 2 0>;
+		};
+
+		red_phone {
+			label = "Livebox1:red:phone";
+			gpios = <&gpio0 3 0>;
+		};
+
+		red_wifi {
+			label = "Livebox1:red:wifi";
+			gpios = <&gpio0 4 0>;
+		};
+	};
+};
+
+&pflash {
+	reg = <0x1e400000 0x800000>;
+	status = "disabled";
+
+	linux,part-probe = "RedBoot";
+};
diff --git a/target/linux/brcm63xx/image/Makefile b/target/linux/brcm63xx/image/Makefile
index e00b6fb..da5bbbf 100644
--- a/target/linux/brcm63xx/image/Makefile
+++ b/target/linux/brcm63xx/image/Makefile
@@ -155,7 +155,7 @@ define Build/redboot-bin
 	$(TOPDIR)/scripts/redboot-script.pl \
 		-k $(BIN_DIR)/$(REDBOOT_PREFIX)-vmlinux.gz \
 		-r $(BIN_DIR)/$(REDBOOT_PREFIX)-$(notdir $(word 2,$^)) \
-		-a $(strip $(LOADADDR)) -f 0xbe430000 -l 0x7c0000 \
+		-a $(strip $(LOADER_ENTRY)) -f 0xbe430000 -l 0x7c0000 \
 		-s 0x1000 -t 20 -o $@.redbootscript
 	dd if="$@.redbootscript" of="$@.redbootscript.padded" bs=4096 conv=sync
 	cat \
@@ -290,10 +290,11 @@ endef
 # Generates images compatible with RedBoot bootloader
 define Device/bcm63xxRedBoot
   FILESYSTEMS := squashfs
-  KERNEL := kernel-bin | append-dtb | gzip
+  KERNEL := kernel-bin | append-dtb | relocate-kernel | gzip
   IMAGES := redboot.bin
   IMAGE/redboot.bin := redboot-bin
   REDBOOT_PREFIX := $$(IMAGE_PREFIX)
+  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-lzma elf
 endef
 DEVICE_VARS += REDBOOT_PREFIX
 
@@ -582,7 +583,7 @@ $(eval $(call bcm63xxCfe,HG655b,HG655b,hg655b,HW65x,6368,--image-offset 0x20000
 # Inteno VG50
 $(eval $(call bcm63xxCfeRamdisk,VG50,vg50,vg50,VW6339GU,63268))
 # Inventel Livebox 1
-$(eval $(call bcm63xxRedBoot,Livebox,livebox,livebox-blue-5g))
+$(eval $(call bcm63xxRedBoot,Livebox,livebox_DV4210,livebox-dv4210))
 # Netgear CVG834G
 $(eval $(call bcm33xxHcsRamdisk,CVG834G,cvg834g,cvg834g,0xa020,0001,0022))
 # Netgear DG834GT/PN
diff --git a/target/linux/brcm63xx/patches-4.1/513-MIPS-BCM63XX-add-inventel-Livebox-support.patch b/target/linux/brcm63xx/patches-4.1/513-MIPS-BCM63XX-add-inventel-Livebox-support.patch
index 962f040..647530a 100644
--- a/target/linux/brcm63xx/patches-4.1/513-MIPS-BCM63XX-add-inventel-Livebox-support.patch
+++ b/target/linux/brcm63xx/patches-4.1/513-MIPS-BCM63XX-add-inventel-Livebox-support.patch
@@ -57,7 +57,7 @@ Subject: [PATCH] MIPS: BCM63XX: add inventel Livebox support
  #endif /* __BOARD_COMMON_H */
 --- /dev/null
 +++ b/arch/mips/bcm63xx/boards/board_livebox.c
-@@ -0,0 +1,164 @@
+@@ -0,0 +1,194 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -88,8 +88,9 @@ Subject: [PATCH] MIPS: BCM63XX: add inventel Livebox support
 + * known 6348 boards
 + */
 +#ifdef CONFIG_BCM63XX_CPU_6348
-+static struct board_info __initdata board_livebox_blue5g = {
-+	.name				= "Livebox-blue-5g",
++/*Livebox 1 - DV4210*/
++static struct board_info __initdata board_livebox_dv4210 = {
++	.name				= "DV4210",
 +	.expected_cpu_id		= 0x6348,
 +
 +	.has_uart0			= 1,
@@ -111,9 +112,37 @@ Subject: [PATCH] MIPS: BCM63XX: add inventel Livebox support
 +	.ephy_reset_gpio_flags		= GPIO_ACTIVE_LOW,
 +
 +	.has_ohci0			= 1,
++};
++
++/*Livebox Pro v1 - DV4410*/
++static struct board_info __initdata board_livebox_dv4410 = {
++	.name				= "DV4410",
++	.expected_cpu_id		= 0x6348,
++
++	.has_uart0			= 1,
++	.has_enet0			= 1,
++	.has_enet1			= 1,
++	.has_pci			= 1,
++
++	.enet0 = {
++		.has_phy		= 1,
++		.use_internal_phy	= 1,
++	},
++
++	.enet1 = {
++		.has_phy		= 1,
++		.phy_id			= 0,
++		.force_speed_100	= 1,
++		.force_duplex_full	= 1,
++	},
++
++	.ephy_reset_gpio		= 29, /*keep SS1# HIGH*/
++	.ephy_reset_gpio_flags		= GPIO_ACTIVE_LOW,
++
++	.has_ohci0			= 1,
 +	.has_pccard			= 1,
 +
-+	.has_dsp			= 0, /*TODO some Liveboxes have dsp*/
++	.has_dsp			= 1,
 +	.dsp = {
 +		.gpio_rst		= 6,
 +		.gpio_int		= 35,
@@ -128,12 +157,13 @@ Subject: [PATCH] MIPS: BCM63XX: add inventel Livebox support
 + */
 +static const struct board_info __initdata *bcm963xx_boards[] = {
 +#ifdef CONFIG_BCM63XX_CPU_6348
-+	&board_livebox_blue5g
++	&board_livebox_dv4210,
++	&board_livebox_dv4410,
 +#endif
 +};
 +
 +static struct of_device_id const livebox_boards_dt[] = {
-+	{ .compatible = "inventel,livebox-blue-5g", .data = &board_livebox_blue5g, },
++	{ .compatible = "inventel,livebox-dv4210", .data = &board_livebox_dv4210, },
 +	{ }
 +};
 +
diff --git a/target/linux/brcm63xx/patches-4.4/513-MIPS-BCM63XX-add-inventel-Livebox-support.patch b/target/linux/brcm63xx/patches-4.4/513-MIPS-BCM63XX-add-inventel-Livebox-support.patch
index e63ac5c..34da3d2 100644
--- a/target/linux/brcm63xx/patches-4.4/513-MIPS-BCM63XX-add-inventel-Livebox-support.patch
+++ b/target/linux/brcm63xx/patches-4.4/513-MIPS-BCM63XX-add-inventel-Livebox-support.patch
@@ -57,7 +57,7 @@ Subject: [PATCH] MIPS: BCM63XX: add inventel Livebox support
  #endif /* __BOARD_COMMON_H */
 --- /dev/null
 +++ b/arch/mips/bcm63xx/boards/board_livebox.c
-@@ -0,0 +1,164 @@
+@@ -0,0 +1,194 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -88,8 +88,9 @@ Subject: [PATCH] MIPS: BCM63XX: add inventel Livebox support
 + * known 6348 boards
 + */
 +#ifdef CONFIG_BCM63XX_CPU_6348
-+static struct board_info __initdata board_livebox_blue5g = {
-+	.name				= "Livebox-blue-5g",
++/*Livebox 1 - DV4210*/
++static struct board_info __initdata board_livebox_dv4210 = {
++	.name				= "DV4210",
 +	.expected_cpu_id		= 0x6348,
 +
 +	.has_uart0			= 1,
@@ -111,9 +112,37 @@ Subject: [PATCH] MIPS: BCM63XX: add inventel Livebox support
 +	.ephy_reset_gpio_flags		= GPIO_ACTIVE_LOW,
 +
 +	.has_ohci0			= 1,
++};
++
++/*Livebox Pro v1 - DV4410*/
++static struct board_info __initdata board_livebox_dv4410 = {
++	.name				= "DV4410",
++	.expected_cpu_id		= 0x6348,
++
++	.has_uart0			= 1,
++	.has_enet0			= 1,
++	.has_enet1			= 1,
++	.has_pci			= 1,
++
++	.enet0 = {
++		.has_phy		= 1,
++		.use_internal_phy	= 1,
++	},
++
++	.enet1 = {
++		.has_phy		= 1,
++		.phy_id			= 0,
++		.force_speed_100	= 1,
++		.force_duplex_full	= 1,
++	},
++
++	.ephy_reset_gpio		= 29, /*keep SS1# HIGH*/
++	.ephy_reset_gpio_flags		= GPIO_ACTIVE_LOW,
++
++	.has_ohci0			= 1,
 +	.has_pccard			= 1,
 +
-+	.has_dsp			= 0, /*TODO some Liveboxes have dsp*/
++	.has_dsp			= 1,
 +	.dsp = {
 +		.gpio_rst		= 6,
 +		.gpio_int		= 35,
@@ -128,12 +157,13 @@ Subject: [PATCH] MIPS: BCM63XX: add inventel Livebox support
 + */
 +static const struct board_info __initdata *bcm963xx_boards[] = {
 +#ifdef CONFIG_BCM63XX_CPU_6348
-+	&board_livebox_blue5g
++	&board_livebox_dv4210,
++	&board_livebox_dv4410,
 +#endif
 +};
 +
 +static struct of_device_id const livebox_boards_dt[] = {
-+	{ .compatible = "inventel,livebox-blue-5g", .data = &board_livebox_blue5g, },
++	{ .compatible = "inventel,livebox-dv4210", .data = &board_livebox_dv4210, },
 +	{ }
 +};
 +
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list