[OpenWrt-Devel,v2] brcm63xx: Add support for the Inventel DV4210.
diff mbox series

Message ID 120944314.P3RYrjzPQu@tool
State Changes Requested
Delegated to: Petr Štetiar
Headers show
Series
  • [OpenWrt-Devel,v2] brcm63xx: Add support for the Inventel DV4210.
Related show

Commit Message

Daniel Gonzalez Cabanelas Oct. 27, 2019, 1:35 p.m. UTC
Add support for the Inventel DV4210 router.

This is an Inventel Livebox 1 board. The patch supports the board with a CFE bootloader, and
a RAM mod (64 MB, tested).  The board originally comes with 8 MB flash.  Under this conditions
this old BCM6348 based board still runs quite fine with current snapshots.

Signed-off-by: Daniel Gonzalez Cabanelas <dgcbueu@gmail.com>
---
Changes in v2: 
- Added missing target (brcm63xx) to the subjet.

 .../brcm63xx/base-files/etc/board.d/01_leds   |   1 +
 .../base-files/etc/board.d/02_network         |   2 +-
 target/linux/brcm63xx/base-files/etc/diag.sh  |   1 +
 .../linux/brcm63xx/base-files/lib/brcm63xx.sh |   3 +
 target/linux/brcm63xx/dts/dv4210.dts          | 102 ++++++++++++++++++
 target/linux/brcm63xx/image/bcm63xx.mk        |  13 +++
 .../patches-4.14/599-board_DV4210.patch       |  50 +++++++++
 7 files changed, 171 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/brcm63xx/dts/dv4210.dts
 create mode 100644 target/linux/brcm63xx/patches-4.14/599-board_DV4210.patch

Comments

Petr Štetiar Feb. 11, 2020, 1:40 p.m. UTC | #1
Daniel Gonzalez Cabanelas <dgcbueu@gmail.com> [2019-10-27 14:35:54]:

Hi,

> This is an Inventel Livebox 1 board. The patch supports the board with a CFE bootloader, and
> a RAM mod (64 MB, tested).

So it works on the stock 32M RAM confguration as well?

> The board originally comes with 8 MB flash.  Under this conditions
> this old BCM6348 based board still runs quite fine with current snapshots.

From https://openwrt.org/submitting-patches

 * commit description
   * must have less than 75 characters per line
   * If you add support for new hardware: Include in your commit message a
     short description of the hardware and how to install OpenWrt on it. Have a
     look at the recent additions for some examples.

> +++ b/target/linux/brcm63xx/dts/dv4210.dts
> @@ -0,0 +1,102 @@

From https://openwrt.org/submitting-patches#dts_checklist

Don't forget to add proper license, consider adding SPDX-License-Identifier: GPL-2.0-or-later OR MIT (details)

> +/dts-v1/;
> +
> +#include "bcm6348.dtsi"
> +
> +#include <dt-bindings/input/input.h>
> +
> +/ {
> +       model = "Inventel DV4210";
> +       compatible = "inventel,dv4210", "brcm,bcm6348";

You've a lot of common with Livebox1 DTS, so please use a DTSI to share the
common bits.

> +       keys {
> +               compatible = "gpio-keys-polled";
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +               poll-interval = <20>;

Drop `#address-cells = <1>;` and `#size-cells = <0>;` properties, it's a
copy&paste probably, needed by child node with reg property.

> +&pflash {
> +       reg = <0x1f400000 0x800000>;
> +       status = "ok";
> +
> +       partitions {
> +               compatible = "fixed-partitions";
> +               #address-cells = <1>;
> +               #size-cells = <1>;
> +
> +               cfe@0 {
> +                       reg = <0x000000 0x010000>;
> +                       label = "cfe";

                          read-only; ?

> +  DEVICE_DESCRIPTION = Build firmware images for the Inventel DV4210. Board with CFE bootloader and >32MB RAM

FLASH_MB := 8 ?

> +  DEVICE_DTS := dv4210
> +  CFE_BOARD_ID := DV4210
> +  CFE_CHIP_ID := 6348
> +  DEVICE_PACKAGES := \
> +    $(B43_PACKAGES) $(USB1_PACKAGES)
> +  DEFAULT := y

you can drop this as DEFAULT:=y is default

> +endef
> +TARGET_DEVICES += DV4210
> +
>  ### Netgear ###
>  define Device/CVG834G
>    $(Device/bcm33xx)
> diff --git a/target/linux/brcm63xx/patches-4.14/599-board_DV4210.patch b/target/linux/brcm63xx/patches-4.14/599-board_DV4210.patch
> new file mode 100644
> index 0000000000..618a214d63
> --- /dev/null
> +++ b/target/linux/brcm63xx/patches-4.14/599-board_DV4210.patch

If I were you, I would wait some time, how the current 4.19/5.4 situation pans
out and update the patch for the next kernel accordingly. It makes no sense to
add support for kernel 4.14 (and 4.19 as well, but who knows) at this point of
time.

-- ynezz

Patch
diff mbox series

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 d25d37e847..00109ba112 100755
--- a/target/linux/brcm63xx/base-files/etc/board.d/01_leds
+++ b/target/linux/brcm63xx/base-files/etc/board.d/01_leds
@@ -69,6 +69,7 @@  homehub2a)
        ucidef_set_led_usbdev "usb1" "USB1" "HOMEHUB2A:blue:phone" "1-1"
        ucidef_set_led_usbdev "usb2" "USB2" "HOMEHUB2A:green:phone" "2-1"
        ;;
+dv4210|\
 livebox1)
        ucidef_set_led_netdev "lan" "LAN" "Livebox1:red:traffic" "eth0"
        ucidef_set_led_netdev "wan" "WAN" "Livebox1:red:adsl" "eth1"
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 a2ca5a37b3..0e384f82f6 100755
--- a/target/linux/brcm63xx/base-files/etc/board.d/02_network
+++ b/target/linux/brcm63xx/base-files/etc/board.d/02_network
@@ -145,8 +145,8 @@  bcm963268bu_p300)
        ucidef_add_switch "switch0" \
                "0:lan" "3:lan" "4:lan" "5:lan" "6:lan" "7:lan" "8t@eth0"
        ;;
-
 cpva502p |\
+dv4210 |\
 livebox1)
        ucidef_set_interfaces_lan_wan "eth0" "eth1"
        ;;
diff --git a/target/linux/brcm63xx/base-files/etc/diag.sh b/target/linux/brcm63xx/base-files/etc/diag.sh
index 34464ec44a..c673a75e40 100644
--- a/target/linux/brcm63xx/base-files/etc/diag.sh
+++ b/target/linux/brcm63xx/base-files/etc/diag.sh
@@ -114,6 +114,7 @@  set_state() {
        hg655b)
                status_led="HW65x:green:power"
                ;;
+       dv4210|\
        livebox1)
                status_led="Livebox1:red:adsl-fail-power"
                ;;
diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
index 1676ae0abb..9c0c33cc31 100755
--- a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
+++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
@@ -177,6 +177,9 @@  brcm63xx_dt_detect() {
        "Inteno VG50")
                board_name="vg50"
                ;;
+       "Inventel DV4210")
+               board_name="dv4210"
+               ;;
        "Inventel Livebox 1")
                board_name="livebox1"
                ;;
diff --git a/target/linux/brcm63xx/dts/dv4210.dts b/target/linux/brcm63xx/dts/dv4210.dts
new file mode 100644
index 0000000000..02975fe3b6
--- /dev/null
+++ b/target/linux/brcm63xx/dts/dv4210.dts
@@ -0,0 +1,102 @@ 
+/dts-v1/;
+
+#include "bcm6348.dtsi"
+
+#include <dt-bindings/input/input.h>
+
+/ {
+       model = "Inventel DV4210";
+       compatible = "inventel,dv4210", "brcm,bcm6348";
+
+       chosen {
+               bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200";
+               stdout-path = "serial0:115200n8";
+       };
+
+       keys {
+               compatible = "gpio-keys-polled";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               poll-interval = <20>;
+
+               button1 {
+                       label = "1";
+                       gpios = <&pinctrl 36 1>;
+                       linux,code = <KEY_RESTART>;
+                       debounce-interval = <60>;
+               };
+
+               button2 {
+                       label = "2";
+                       gpios = <&pinctrl 7 1>;
+                       linux,code = <BTN_2>;
+                       debounce-interval = <60>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               red_adsl_fail {
+                       label = "Livebox1:red:adsl-fail-power";
+                       gpios = <&pinctrl 0 0>;
+                       default-state = "on";
+               };
+
+               red_adsl {
+                       label = "Livebox1:red:adsl";
+                       gpios = <&pinctrl 1 0>;
+               };
+
+               red_traffic {
+                       label = "Livebox1:red:traffic";
+                       gpios = <&pinctrl 2 0>;
+               };
+
+               red_phone {
+                       label = "Livebox1:red:phone";
+                       gpios = <&pinctrl 3 0>;
+               };
+
+               red_wifi {
+                       label = "Livebox1:red:wifi";
+                       gpios = <&pinctrl 4 0>;
+               };
+       };
+};
+
+&pflash {
+       reg = <0x1f400000 0x800000>;
+       status = "ok";
+
+       partitions {
+               compatible = "fixed-partitions";
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               cfe@0 {
+                       reg = <0x000000 0x010000>;
+                       label = "cfe";
+               };
+
+               linux@10000 {
+                       reg = <0x010000 0x7e0000>;
+                       label = "linux";
+                       compatible = "brcm,bcm963xx-imagetag";
+               };
+
+               nvram@7f0000 {
+                       reg = <0x7f0000 0x010000>;
+                       label = "nvram";
+               };
+       };
+};
+
+&pinctrl {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii &pinctrl_mii_pccard>;
+};
+
+&uart0 {
+       status = "ok";
+};
diff --git a/target/linux/brcm63xx/image/bcm63xx.mk b/target/linux/brcm63xx/image/bcm63xx.mk
index 212960e972..690ffb49fa 100644
--- a/target/linux/brcm63xx/image/bcm63xx.mk
+++ b/target/linux/brcm63xx/image/bcm63xx.mk
@@ -769,6 +769,19 @@  define Device/livebox
 endef
 TARGET_DEVICES += livebox
 
+define Device/DV4210
+  $(Device/bcm63xx)
+  DEVICE_TITLE := Inventel DV4210
+  DEVICE_DESCRIPTION = Build firmware images for the Inventel DV4210. Board with CFE bootloader and >32MB RAM
+  DEVICE_DTS := dv4210
+  CFE_BOARD_ID := DV4210
+  CFE_CHIP_ID := 6348
+  DEVICE_PACKAGES := \
+    $(B43_PACKAGES) $(USB1_PACKAGES)
+  DEFAULT := y
+endef
+TARGET_DEVICES += DV4210
+
 ### Netgear ###
 define Device/CVG834G
   $(Device/bcm33xx)
diff --git a/target/linux/brcm63xx/patches-4.14/599-board_DV4210.patch b/target/linux/brcm63xx/patches-4.14/599-board_DV4210.patch
new file mode 100644
index 0000000000..618a214d63
--- /dev/null
+++ b/target/linux/brcm63xx/patches-4.14/599-board_DV4210.patch
@@ -0,0 +1,50 @@ 
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -1058,6 +1058,31 @@
+       },
+ };
+ 
++static struct board_info __initdata board_DV4210 = {
++      .name                           = "DV4210",
++      .expected_cpu_id                = 0x6348,
++
++      .has_enet0                      = 1,
++      .has_enet1                      = 1,
++      .has_pci                        = 1,
++
++      .enet0 = {
++              .has_phy                = 1,
++              .use_internal_phy       = 1,
++      },
++
++      .enet1 = {
++                .has_phy              = 1,
++                .phy_id               = 31,
++      },
++
++      .ephy_reset_gpio                = 6,
++      .ephy_reset_gpio_flags  = GPIO_ACTIVE_LOW,
++
++      .has_ohci0                      = 1,
++      .has_pccard                     = 0,
++};
++
+ static struct board_info __initdata board_96348A_122 = {
+       .name                           = "96348A-122",
+       .expected_cpu_id                = 0x6348,
+@@ -2746,6 +2771,7 @@
+       &board_FAST2404,
+       &board_FAST2604,
+       &board_DV201AMR,
++      &board_DV4210,
+       &board_96348gw_a,
+       &board_rta1025w_16,
+       &board_96348_D4PW,
+@@ -2859,6 +2885,7 @@
+       { .compatible = "d-link,dsl-2640b-b", .data = &board_96348_D4PW, },
+       { .compatible = "davolink,dv-201amr", .data = &board_DV201AMR, },
+       { .compatible = "dynalink,rta1025w", .data = &board_rta1025w_16, },
++      { .compatible = "inventel,dv4210", .data = &board_DV4210, },
+       { .compatible = "netgear,dg834gtpn", .data = &board_96348gw_10, },
+       { .compatible = "netgear,dg834g-v4", .data = &board_96348W3, },
+       { .compatible = "sagem,f@st2404", .data = &board_FAST2404, },