From: John Crispin Date: Sun, 12 Jan 2014 12:07:40 +0000 (+0000) Subject: ralink: add HLK-RM04 support X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3a64ddd0a18efe3c8fbf65579dca58672bf04fb1;p=openwrt%2Fstaging%2Fblocktrron.git ralink: add HLK-RM04 support https://github.com/JiapengLi/OpenWrt-HiLink-HLK-RM04 Signed-off-by: John Crispin SVN-Revision: 39237 --- diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index a236fdf921..1d8bef1603 100755 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -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" diff --git a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom index d3e0242355..4b13c18c95 100644 --- a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom +++ b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom @@ -81,6 +81,7 @@ case "$FIRMWARE" in fonera20n | \ rt-n13u | \ freestation5 | \ + hlk-rm04 | \ hw550-3g | \ mofi3500-3gn | \ mpr-a1 | \ diff --git a/target/linux/ramips/base-files/etc/uci-defaults/01_leds b/target/linux/ramips/base-files/etc/uci-defaults/01_leds index fe22875596..0c54cdefb1 100755 --- a/target/linux/ramips/base-files/etc/uci-defaults/01_leds +++ b/target/linux/ramips/base-files/etc/uci-defaults/01_leds @@ -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" diff --git a/target/linux/ramips/base-files/etc/uci-defaults/02_network b/target/linux/ramips/base-files/etc/uci-defaults/02_network index a9914fdb87..7c14ad3a24 100755 --- a/target/linux/ramips/base-files/etc/uci-defaults/02_network +++ b/target/linux/ramips/base-files/etc/uci-defaults/02_network @@ -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" diff --git a/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac b/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac index 0c4ee13930..96665bdf7f 100644 --- a/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac +++ b/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac @@ -27,6 +27,7 @@ preinit_set_mac_address() { dir-620-a1 |\ esr-9753 |\ freestation5 |\ + hlk-rm04 | \ mpr-a1 | \ mpr-a2 | \ dir-300-b7 | \ diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index d62002ea7c..24aad1f174 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -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" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index babeaf2180..0230a1829b 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -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 index 0000000000..13597dc7d5 --- /dev/null +++ b/target/linux/ramips/dts/HLKRM04.dts @@ -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>; + }; + }; +}; diff --git a/target/linux/ramips/dts/rt5350.dtsi b/target/linux/ramips/dts/rt5350.dtsi index cb9077f7b4..7353c82f85 100644 --- a/target/linux/ramips/dts/rt5350.dtsi +++ b/target/linux/ramips/dts/rt5350.dtsi @@ -89,6 +89,9 @@ reg-shift = <2>; + pinctrl-names = "default"; + pinctrl-0 = <&uartf_pins>; + status = "disabled"; }; @@ -240,6 +243,12 @@ ralink,function = "uartlite"; }; }; + uartf_pins: uartf { + uartf { + ralink,group = "uartf"; + ralink,function = "uartf"; + }; + }; }; rstctrl: rstctrl { diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index 2d4395dca4..d523236b8e 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -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 index 0000000000..d9783031db --- /dev/null +++ b/target/linux/ramips/rt305x/profiles/hilink.mk @@ -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)) +