[OpenWrt-Devel] [PATCH] [ramips] HiWiFi HC5661 Support for Openwrt

Yousong Zhou yszhou4tech at gmail.com
Sat Apr 18 09:47:03 EDT 2015


Hi, Yunhao

The patch is not in plaintext format and is whitespace broken.  You
can work around this by generating a patch with git-format-patch, then
send it with git-send-email.

On 18 April 2015 at 19:39, 田韵豪 <tianyh2000 at 163.com> wrote:
> HiWiFi HC5661 (Ji 1s) support.
>
> Signed-off-by: B Tian < tianyh2000 at 163.com>

Real name is more preferable :)

> ---
>
> diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds
> b/target/linux/ramips/base-files/etc/board.d/01_leds
> index 56ba3b7..292859d 100755
> --- a/target/linux/ramips/base-files/etc/board.d/01_leds
> +++ b/target/linux/ramips/base-files/etc/board.d/01_leds
> @@ -237,6 +237,11 @@ case $board in
>    set_usb_led "lenovo:blue:usb"
>    set_wifi_led "lenovo:blue:wifi"
>    ;;
> + hc5661)
> +  ucidef_set_led_default "power" "power" "hiwifi:blue:power" "1"
> +  set_wifi_led "hiwifi:blue:wifi"
> +  ucidef_set_led_interface "br-lan" "hiwifi:blue:network"

"hiwifi:blue:network" should be better named as "hiwifi:blue:wan" and
the interface name should be "wan".

> +  ;;
>   zte-q7)
>    set_wifi_led "zte:blue:status"
>    ;;
> diff --git a/target/linux/ramips/base-files/etc/board.d/02_network
> b/target/linux/ramips/base-files/etc/board.d/02_network
> index 24e1ba8..505f7d9 100755
> --- a/target/linux/ramips/base-files/etc/board.d/02_network
> +++ b/target/linux/ramips/base-files/etc/board.d/02_network
> @@ -229,6 +229,14 @@ ramips_setup_interfaces()
>    ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
>    ucidef_add_switch_vlan "switch0" "2" "0 6t"
>    ;;
> +
> + hc5661)
> +  ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
> +  ucidef_add_switch "switch0" "1" "1"
> +  ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
> +  ucidef_add_switch_vlan "switch0" "2" "0 6t"
> +  ;;
> +
>   d105 | \
>   na930 | \
>   omni-emb-hpm|\
> @@ -310,6 +318,7 @@ ramips_setup_macs()
>   dir-320-b1 | \
>   psr-680w |\
>   sl-r7205 |\
> + hc5661 |\
>   y1 |\
>   y1s)
>    lan_mac=$(cat /sys/class/net/eth0/address)
> diff --git a/target/linux/ramips/base-files/etc/diag.sh
> b/target/linux/ramips/base-files/etc/diag.sh
> index 5301593..02b3ee0 100644
> --- a/target/linux/ramips/base-files/etc/diag.sh
> +++ b/target/linux/ramips/base-files/etc/diag.sh
> @@ -224,6 +224,9 @@ get_status_led() {
>   y1s)
>    status_led="lenovo:blue:power"
>    ;;
> + hc5661)
> +  status_led="hiwifi:blue:power"
> +  ;;
>   zte-q7)
>    status_led="zte:red:status"
>    ;;
> diff --git a/target/linux/ramips/base-files/lib/ramips.sh
> b/target/linux/ramips/base-files/lib/ramips.sh
> index 616f4a1..8311a5f 100755
> --- a/target/linux/ramips/base-files/lib/ramips.sh
> +++ b/target/linux/ramips/base-files/lib/ramips.sh
> @@ -391,6 +391,9 @@ ramips_board_detect() {
>   *"Lenovo Y1S")
>    name="y1s"
>    ;;
> + *"HiWiFi HC5661")
> +  name="hc5661"

We already have hiwifi-hc6361 as the board name for HiWiFi HC6361 in
ar71xx target, so it's better we stick to that naming convention and
use hiwifi-hc5661 here.

> +  ;;
>   *"Mediatek MT7621 evaluation board")
>    name="mt7621"
>    ;;
> diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh
> b/target/linux/ramips/base-files/lib/upgrade/platform.sh
> index 17b456b..a913c41 100755
> --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
> @@ -115,6 +115,7 @@ platform_check_image() {
>   xiaomi-miwifi-mini |\
>   y1 |\
>   y1s |\
> + hc5661 |\
>   zte-q7 |\
>   zbt-wa05)
>    [ "$magic" != "27051956" ] && {
> diff --git a/target/linux/ramips/dts/HC5661.dts
> b/target/linux/ramips/dts/HC5661.dts
> new file mode 100644
> index 0000000..873b83c
> --- /dev/null
> +++ b/target/linux/ramips/dts/HC5661.dts
> @@ -0,0 +1,137 @@
> +/dts-v1/;
> +
> +/include/ "mt7620a.dtsi"
> +
> +/ {
> + compatible = "hiwifi,HC5661", "ralink,mt7620a-soc";

The first compatible string is better be HiWiFi-HC5661.

> + model = "HiWiFi HC5661";
> +
> + chosen {
> +  bootargs = "console=ttyS0,115200";
> + };
> +
> + palmbus at 10000000 {
> +  sysc at 0 {
> +   ralink,gpiomux = "i2c", "jtag";
> +   ralink,uartmux = "gpio";
> +   ralink,wdtmux = <1>;
> +  };
> +
> +  gpio0: gpio at 600 {
> +   status = "okay";
> +  };
> +
> +  gpio2: gpio at 660 {
> +   status = "okay";
> +  };
> +
> +  gpio3: gpio at 688 {
> +   status = "okay";
> +  };
> +
> +
> +  spi at b00 {
> +   status = "okay";
> +
> +   m25p80 at 0 {
> +    #address-cells = <1>;
> +    #size-cells = <1>;
> +    compatible = "w25q128";
> +    reg = <0 0>;
> +    linux,modalias = "m25p80", "w25q128";
> +    spi-max-frequency = <10000000>;
> +
> +    partition at 0 {
> +     label = "u-boot";
> +     reg = <0x0 0x30000>;
> +     read-only;
> +    };
> +
> +    partition at 30000 {
> +     label = "u-boot-env";
> +     reg = <0x30000 0x10000>;
> +     read-only;
> +    };

This area is named 'hw_panic' in OEM firmware.

> +
> +    factory: partition at 40000 {
> +     label = "factory";
> +     reg = <0x40000 0x10000>;
> +     read-only;
> +    };
> +
> +    partition at 50000 {
> +     label = "firmware";
> +     reg = <0x50000 0xfb0000>;
> +    };

"firmware" partition only has 0xf90000 bytes.  There is another
0x10000 bytes for "bdinfo" which stores at least mac address and other
warranty information.  IMHO, this should not be overwritten without
users' being aware of.  In original OEM firmware, there is also
another 0x10000 bytes with the name "backup" the functionality of
which i am currently not sure about.

> +   };
> +  };
> + };
> +
> + ehci at 101c0000 {
> +  status = "okay";
> + };
> +
> + ohci at 101c1000 {
> +  status = "okay";
> + };
> +
> + sdhci at 10130000 {
> +  status = "okay";
> + };
> +
> + pcie at 10140000 {
> +  status = "okay";
> + };
> +
> + wmac at 10180000 {
> +  ralink,mtd-eeprom = <&factory 0>;
> + };
> +
> + ethernet at 10100000 {
> +  pinctrl-names = "default";
> +  pinctrl-0 = <&ephy_pins>;
> +  mtd-mac-address = <&factory 0x4>;

Well, as with HiWiFi HC6361, MAC address of HC5661 is in bdinfo
partion in ascii format.   This directive alone here is not enough.
Something like target/linux/ramips/patches-3.18/0034-NET-add-of_get_mac_address_mtd.patch
has to be done.

Cheers.

                yousong
_______________________________________________
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