[LEDE-DEV] [PATCH] brcm63xx: Add Sercomm AD1018 support

Jonas Gorski jonas.gorski at gmail.com
Sat Aug 26 03:26:45 PDT 2017


Hi,

On 20 August 2017 at 17:32, Daniel Gonzalez Cabanelas <dgcbueu at gmail.com> wrote:
> Add support for the Sercomm AD1018 router
>
> This a BCM6328 based board, 128 MB RAM, 128 MiB NAND flash,
> with an onboard BCM43217 wifi, 4 ethernet ports and 1 USB
> host port (not soldered).
>
> Since NAND flash chips aren't still supported in brcm63xx, the
> support is for now added to work only with SPI flash chips. Therefore
> hardware modding for soldering a new SPI flash chip is required
> to make the board work with LEDE (tested and working OK).
>
> Signed-off-by: Daniel Gonzalez Cabanelas <dgcbueu at gmail.com>
> ---
>  .../linux/brcm63xx/base-files/etc/board.d/01_leds  |   3 +
>  .../brcm63xx/base-files/etc/board.d/02_network     |   1 +
>  target/linux/brcm63xx/base-files/etc/diag.sh       |   3 +
>  target/linux/brcm63xx/base-files/lib/brcm63xx.sh   |   3 +
>  target/linux/brcm63xx/dts/ad1018.dts               | 132 +++++++++++++++++++++
>  target/linux/brcm63xx/image/bcm63xx.mk             |  12 ++
>  .../brcm63xx/patches-4.4/580-board_AD1018.patch    |  99 ++++++++++++++++
>  7 files changed, 253 insertions(+)
>  create mode 100644 target/linux/brcm63xx/dts/ad1018.dts
>  create mode 100644 target/linux/brcm63xx/patches-4.4/580-board_AD1018.patch
>
> 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 ef70cde..5503328 100755
> --- a/target/linux/brcm63xx/base-files/etc/board.d/01_leds
> +++ b/target/linux/brcm63xx/base-files/etc/board.d/01_leds
> @@ -15,6 +15,9 @@ a4001n1)
>  a4001n)
>         ucidef_set_led_usbdev "usb" "USB" "A4001N:green:usb" "1-1"
>         ;;
> +ad1018)
> +       ucidef_set_led_netdev "wlan0" "WLAN" "AD1018:green:wifi" "wlan0"
> +       ;;
>  ar-5315u)
>         ucidef_set_led_usbdev "usb" "USB" "AR-5315u: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 9addba6..826d271 100755
> --- a/target/linux/brcm63xx/base-files/etc/board.d/02_network
> +++ b/target/linux/brcm63xx/base-files/etc/board.d/02_network
> @@ -98,6 +98,7 @@ vr-3026e)
>                 "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "8t at eth0"
>         ;;
>
> +ad1018 |\
>  ar-5315u |\
>  vh4032n)
>         ucidef_add_switch "switch0" \
> diff --git a/target/linux/brcm63xx/base-files/etc/diag.sh b/target/linux/brcm63xx/base-files/etc/diag.sh
> index 700c9ea..2663a2c 100644
> --- a/target/linux/brcm63xx/base-files/etc/diag.sh
> +++ b/target/linux/brcm63xx/base-files/etc/diag.sh
> @@ -12,6 +12,9 @@ set_state() {
>         a4001n)
>                 status_led="A4001N:green:power"
>                 ;;
> +       ad1018)
> +               status_led="AD1018:green:power"
> +               ;;
>         ar-5315u)
>                 status_led="AR-5315u:green:power"
>                 ;;
> diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
> index 3f46633..ae67d9b 100755
> --- a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
> +++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
> @@ -228,6 +228,9 @@ brcm63xx_dt_detect() {
>         "Sagem F at ST2704V2")
>                 board_name="fast2704v2"
>                 ;;
> +       "Sercomm AD1018")
> +               board_name="ad1018"
> +               ;;
>         "SFR Neuf Box 4"*)
>                 board_name="neufbox4"
>                 ;;
> diff --git a/target/linux/brcm63xx/dts/ad1018.dts b/target/linux/brcm63xx/dts/ad1018.dts
> new file mode 100644
> index 0000000..b2c8654
> --- /dev/null
> +++ b/target/linux/brcm63xx/dts/ad1018.dts
> @@ -0,0 +1,132 @@
> +/dts-v1/;
> +
> +#include "bcm6328.dtsi"
> +
> +#include <dt-bindings/input/input.h>
> +
> +/ {
> +       model = "Sercomm AD1018";
> +       compatible = "sercomm,ad1018", "brcm,bcm6328";

Since this is a modified version, I would suggest naming it ad1018-nor
/ "Sercomm AD1018 (NOR)", in case we ever support the NAND variant to
tell them apart. Or "Sercomm AD1018 (SPI flash mod)" as you used in
the device definition.

This doesn't need to be reflected i the led naming, so we can just
move the common part into a .dtsi file when adding support for the
original NAND variant.

> +
> +       chosen {
> +               bootargs = "root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200";
> +       };
> +
> +       gpio-keys-polled {
> +               compatible = "gpio-keys-polled";
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +               poll-interval = <20>;
> +               debounce-interval = <60>;
> +
> +               wps {
> +                       label = "wps";
> +                       gpios = <&pinctrl 24 1>;
> +                       linux,code = <KEY_WPS_BUTTON>;
> +               };
> +               wifi {
> +                       label = "wifi";
> +                       gpios = <&pinctrl 25 1>;
> +                       linux,code = <KEY_WLAN>;
> +               };
> +               reset {
> +                       label = "reset";
> +                       gpios = <&pinctrl 31 1>;
> +                       linux,code = <KEY_RESTART>;
> +               };
> +       };
> +};
> +
> +&pinctrl {
> +       pinctrl_led0: led0 {
> +               function = "led";
> +               pins = "gpio0";
> +       };
> +       pinctrl_led1: led1 {
> +               function = "led";
> +               pins = "gpio1";
> +       };

You can specify multiple pins in one node, like

pinctrl_leds: leds {
       function = "led";
       pins = "gpio0", "gpio1";
};

> +};
> +
> +&leds {
> +       status = "ok";
> +
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&pinctrl_led0 &pinctrl_led1 &pinctrl_serial_led
> +                    &pinctrl_ephy0_spd_led &pinctrl_ephy1_act_led
> +                    &pinctrl_ephy2_act_led &pinctrl_ephy3_act_led>;

What's up with ephy1~3 using act, but 0 using the spd led? is this intentional?

> +
> +       brcm,serial-leds;
> +       brcm,serial-shift-inv;
> +       brcm,serial-dat-low;
> +
> +       inet_red at 0 {
> +               reg = <0>;
> +               active-low;
> +               label = "AD1018:red:internet";
> +       };
> +
> +       inet_green at 1 {
> +               reg = <1>;
> +               active-low;
> +               label = "AD1018:green:internet";
> +       };
> +
> +       power_green at 8 {
> +               reg = <8>;
> +               active-low;
> +               label = "AD1018:green:power";
> +               default-state = "on";
> +       };
> +
> +       adsl_green at 10 {
> +               reg = <10>;
> +               active-low;
> +               label = "AD1018:green:adsl";
> +       };
> +
> +       adsl_red at 11 {
> +               reg = <11>;
> +               active-low;
> +               label = "AD1018:red:adsl";
> +       };
> +       phone_green at 12 {
> +               reg = <12>;
> +               active-low;
> +               label = "AD1018:green:phone";
> +       };
> +
> +       wps_green at 13 {
> +               reg = <13>;
> +               active-low;
> +               label = "AD1018:green:wps";
> +       };
> +
> +       wifi_green at 14 {
> +               reg = <14>;
> +               active-low;
> +               label = "AD1018:green:wifi";
> +       };
> +
> +       ephy0_spd at 17 {
> +               reg = <17>;
> +               brcm,hardware-controlled;
> +       };
> +};
> +
> +&hsspi {
> +       status = "ok";
> +
> +       flash at 0 {
> +               compatible = "jedec,spi-nor";
> +               spi-max-frequency = <16666667>;
> +               spi-tx-bus-width = <2>;
> +               spi-rx-bus-width = <2>;
> +               reg = <0>;
> +
> +               #address-cells = <1>;
> +               #size-cells = <1>;
> +
> +               linux,part-probe = "bcm63xxpart";

Partitions please.

> +       };
> +};
> \ No newline at end of file

^ please fix this

Rest looks fine.


Regards
Jonas



More information about the Lede-dev mailing list