ralink: add HLK-RM04 support
authorJohn Crispin <john@openwrt.org>
Sun, 12 Jan 2014 12:07:40 +0000 (12:07 +0000)
committerJohn Crispin <john@openwrt.org>
Sun, 12 Jan 2014 12:07:40 +0000 (12:07 +0000)
https://github.com/JiapengLi/OpenWrt-HiLink-HLK-RM04

Signed-off-by: John Crispin <blogic@openwrt.org>
SVN-Revision: 39237

target/linux/ramips/base-files/etc/diag.sh
target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
target/linux/ramips/base-files/etc/uci-defaults/01_leds
target/linux/ramips/base-files/etc/uci-defaults/02_network
target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
target/linux/ramips/base-files/lib/ramips.sh
target/linux/ramips/base-files/lib/upgrade/platform.sh
target/linux/ramips/dts/HLKRM04.dts [new file with mode: 0644]
target/linux/ramips/dts/rt5350.dtsi
target/linux/ramips/image/Makefile
target/linux/ramips/rt305x/profiles/hilink.mk [new file with mode: 0644]

index a236fdf9211479e91c2fa96d57817c6bf82bfcd7..1d8bef1603dba4077a6802de4beec837dc972e05 100755 (executable)
@@ -51,6 +51,9 @@ get_status_led() {
        rt-n13u)
                status_led="rt-n13u:power"
                ;;
+       hlk-rm04)
+               status_led="hlk-rm04:red:power"
+               ;;
        all0239-3g|\
        hw550-3g)
                status_led="hw550-3g:green:status"
index d3e024235544c09d8e6d452cd76ea07b6a5d0d06..4b13c18c95e64fd69a575c2d620cdb31d190ec64 100644 (file)
@@ -81,6 +81,7 @@ case "$FIRMWARE" in
        fonera20n | \
        rt-n13u | \
        freestation5 | \
+       hlk-rm04 | \
        hw550-3g | \
        mofi3500-3gn | \
        mpr-a1 | \
index fe22875596d471bee62d7aa14726a86d60caf54e..0c54cdefb1ec93ae887fb539fb86dadb521bce54 100755 (executable)
@@ -93,6 +93,9 @@ case $board in
                set_usb_led "fonera20n:orange:usb"
                set_wifi_led "fonera20n:orange:wifi"
                ;;
+       hlk-rm04)
+               set_wifi_led "rt2800pci-phy0::radio"
+               ;;
        all0239-3g|\
        hw550-3g)
                set_usb_led "hw550-3g:green:usb"
index a9914fdb872d77c8e691e3d73fbf07cb7d132ff4..7c14ad3a2445f1db4ee207f6fc4f7a74e162989b 100755 (executable)
@@ -75,6 +75,7 @@ ramips_setup_interfaces()
        dir-300-b7 | \
        dir-320-b1 | \
        dir-615-h1 | \
+       hlk-rm04 | \
        mzk-w300nh2)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
                ucidef_add_switch "switch0" "1" "1"
index 0c4ee139303799defb08f61e0a2a8fa63ca25aa9..96665bdf7fe674b60233035385e2f7590340e572 100644 (file)
@@ -27,6 +27,7 @@ preinit_set_mac_address() {
        dir-620-a1 |\
        esr-9753 |\
        freestation5 |\
+       hlk-rm04 | \
        mpr-a1 | \
        mpr-a2 | \
        dir-300-b7 | \
index d62002ea7cf235dc7c0e4669f7f7fad83148c0a7..24aad1f1749f058d35b7503ac704b194c2dd7cf4 100755 (executable)
@@ -136,6 +136,9 @@ ramips_board_detect() {
        *"MoFi Network MOFI3500-3GN")
                name="mofi3500-3gn"
                ;;
+       *"HILINK HLK-RM04")
+               name="hlk-rm04"
+               ;;
        *"HAME MPR-A1")
                name="mpr-a1"
                ;;
index babeaf21800bbad28e5db6b7e665447918cd3ae2..0230a1829baa5dece41a1c60ac1a005255b7af83 100755 (executable)
@@ -48,6 +48,7 @@ platform_check_image() {
        freestation5 | \
        hw550-3g | \
        hg255d | \
+       hlk-rm04 | \
        ip2202 | \
        m3 | \
        m4 | \
diff --git a/target/linux/ramips/dts/HLKRM04.dts b/target/linux/ramips/dts/HLKRM04.dts
new file mode 100644 (file)
index 0000000..13597dc
--- /dev/null
@@ -0,0 +1,103 @@
+/dts-v1/;
+
+/include/ "rt5350.dtsi"
+
+/ {
+       compatible = "HLKRM04", "ralink,rt5350-soc";
+       model = "HILINK HLK-RM04";
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x1000000>;
+       };
+
+       chosen {
+               bootargs = "console=ttyS1,57600";
+       };
+
+       palmbus@10000000 {
+               uart@500 {
+                       status = "okay";
+               };
+
+               spi@b00 {
+                       status = "okay";
+                       m25p80@0 {
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               compatible = "gd25q64";
+                               reg = <0 0>;
+                               linux,modalias = "m25p80", "s25fl064k";
+                               spi-max-frequency = <10000000>;
+
+                               partition@0 {
+                                       label = "u-boot";
+                                       reg = <0x0 0x30000>;
+                                       read-only;
+                               };
+
+                               partition@30000 {
+                                       label = "u-boot-env";
+                                       reg = <0x30000 0x10000>;
+                                       read-only;
+                               };
+
+                               factory: partition@40000 {
+                                       label = "factory";
+                                       reg = <0x40000 0x10000>;
+                                       read-only;
+                               };
+
+                               partition@50000 {
+                                       label = "firmware";
+                                       reg = <0x50000 0x3b0000>;
+                               };
+                       };
+               };
+       };
+
+       pinctrl {
+               state_default: pinctrl0 {
+                       gpio {
+                               ralink,group = "jtag";
+                               ralink,function = "gpio";
+                       };
+               };
+       };
+
+       ethernet@10100000 {
+               mtd-mac-address = <&factory 0x4>;
+       };
+
+       wmac@10180000 {
+               ralink,mtd-eeprom = <&factory 0>;
+       };
+
+       ehci@101c0000 {
+               status = "okay";
+       };
+
+       ohci@101c1000 {
+               status = "okay";
+       };
+
+       gpio-keys-polled {
+               compatible = "gpio-keys-polled";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               poll-interval = <20>;
+               wps {
+                       label = "reset";
+                       gpios = <&gpio0 14 1>;
+                       linux,code = <0x198>;
+               };
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+               power {
+                       label = "hlk-rm04:red:power";
+                       gpios = <&gpio0 0 1>;
+               };
+       };
+};
index cb9077f7b4a1f01f11e807096b79ad904bae23c9..7353c82f85cd617ff1a7e4129a2fc72dcbfd0302 100644 (file)
@@ -89,6 +89,9 @@
 
                        reg-shift = <2>;
 
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&uartf_pins>;
+
                        status = "disabled";
                };
 
                                ralink,function = "uartlite";
                        };
                };
+               uartf_pins: uartf {
+                       uartf {
+                               ralink,group = "uartf";
+                               ralink,function = "uartf";
+                       };
+               };
        };
 
        rstctrl: rstctrl {
index 2d4395dca41fcdaea390898ee6731c31f442abee..d523236b8e2a4b7034ae131ed0e326e9ecd5c90d 100644 (file)
@@ -108,8 +108,8 @@ endef
 # $(2) = lowercase board name
 # $(3) = dts file
 ralink_default_fw_size_4M=3866624
-BuildFirmware/Default4M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_4M))
-BuildFirmware/Default4M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
+BuildFirmware/Default4M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_4M),$(4))
+BuildFirmware/Default4M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
 
 # Build images for default ralink layout for 8MB flash
 # kernel + roots = 0x7b0000
@@ -402,6 +402,13 @@ Image/Build/Profile/FREESTATION5=$(call BuildFirmware/Default8M/$(1),$(1),freest
 
 Image/Build/Profile/IP2202=$(call BuildFirmware/Default8M/$(1),$(1),ip2202,IP2202)
 
+BuildFirmware/HLKRM04/squashfs=$(call BuildFirmware/Default4M/squashfs,$(1),$(2),$(3),$(4))
+define BuildFirmware/HLKRM04/initramfs
+       $(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
+       mkhilinkfw -e -i$(call imgname,$(1),$(2))-uImage.bin -o $(call imgname,$(1),$(2))-factory.bin;
+endef
+Image/Build/Profile/HLKRM04=$(call BuildFirmware/HLKRM04/$(1),$(1),hlk-rm04,HLKRM04,HLK-RM02)
+
 Image/Build/Profile/M3=$(call BuildFirmware/Poray4M/$(1),$(1),m3,M3)
 
 Image/Build/Profile/M4=$(call BuildFirmware/PorayDualSize/$(1),$(1),m4,M4)
@@ -550,6 +557,7 @@ define Image/Build/Profile/Default
        $(call Image/Build/Profile/FONERA20N,$(1))
        $(call Image/Build/Profile/FREESTATION5,$(1))
 #      $(call Image/Build/Profile/HG255D,$(1))
+       $(call Image/Build/Profile/HLKRM04,$(1))
        $(call Image/Build/Profile/HW550-3G,$(1))
        $(call Image/Build/Profile/IP2202,$(1))
        $(call Image/Build/Profile/M3,$(1))
diff --git a/target/linux/ramips/rt305x/profiles/hilink.mk b/target/linux/ramips/rt305x/profiles/hilink.mk
new file mode 100644 (file)
index 0000000..d978303
--- /dev/null
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/HLKRM04
+       NAME:=HILINK HLK-RM04
+endef
+
+define Profile/HLKRM04/Description
+       Package set for HiLink RM04 Module
+endef
+
+$(eval $(call Profile,HLKRM04))
+