From 23d3b705df405e36b07253f9d16f2fb7757f03f0 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Thu, 1 Aug 2013 14:30:53 +0000 Subject: [PATCH] ramips: add Poray M3 support Signed-off-by: Felix Kaechele SVN-Revision: 37636 --- target/linux/ramips/base-files/etc/diag.sh | 3 + .../base-files/etc/uci-defaults/02_network | 5 + .../base-files/lib/preinit/06_set_iface_mac | 5 + target/linux/ramips/base-files/lib/ramips.sh | 3 + .../ramips/base-files/lib/upgrade/platform.sh | 1 + target/linux/ramips/dts/M3.dts | 106 ++++++++++++++++++ target/linux/ramips/image/Makefile | 3 + target/linux/ramips/rt305x/profiles/poray.mk | 10 ++ 8 files changed, 136 insertions(+) create mode 100644 target/linux/ramips/dts/M3.dts diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index f8e97875aa..a68538b2f7 100755 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -52,6 +52,9 @@ get_status_led() { hw550-3g) status_led="hw550-3g:green:status" ;; + m3) + status_led="m3:blue:status" + ;; mofi3500-3gn) status_led="mofi3500-3gn:green:status" ;; 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 6877588a45..307330b063 100755 --- a/target/linux/ramips/base-files/etc/uci-defaults/02_network +++ b/target/linux/ramips/base-files/etc/uci-defaults/02_network @@ -226,6 +226,11 @@ ramips_setup_macs() wan_mac=$(macaddr_add "$lan_mac" 1) ;; + m3) + lan_mac=$(mtd_get_mac_binary factory 4) + lan_mac=$(macaddr_add "$lan_mac" -1) + ;; + nbg-419n | \ wcr-150gn) lan_mac=$(mtd_get_mac_binary factory 4) 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 aacec25fe3..86c19b0b81 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 @@ -75,6 +75,11 @@ preinit_set_mac_address() { mac=$(mtd_get_mac_binary factory 40) ifconfig eth0 hw ether $mac 2>/dev/null ;; + m3) + mac=$(mtd_get_mac_binary factory 4) + mac=$(macaddr_add "$mac" -1) + ifconfig eth0 hw ether $mac 2>/dev/null + ;; wl341v3) mac=$(mtd_get_mac_binary board-nvram 65440) ifconfig eth0 hw ether $mac 2>/dev/null diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index b1ecc8dfb9..7afa707363 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -148,6 +148,9 @@ ramips_board_detect() { *"Planex MZK-W300NH2"*) name="mzk-w300nh2" ;; + *"Poray M3") + name="m3" + ;; *"PWH2004") name="pwh2004" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index 1d867a73f5..4ac86e97e0 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -44,6 +44,7 @@ platform_check_image() { freestation5 | \ hw550-3g | \ hg255d | \ + m3 | \ mofi3500-3gn | \ mpr-a1 | \ mpr-a2 | \ diff --git a/target/linux/ramips/dts/M3.dts b/target/linux/ramips/dts/M3.dts new file mode 100644 index 0000000000..3e391b3d62 --- /dev/null +++ b/target/linux/ramips/dts/M3.dts @@ -0,0 +1,106 @@ +/dts-v1/; + +/include/ "rt5350.dtsi" + +/ { + compatible = "M3", "ralink,rt5350-soc"; + model = "Poray M3"; + + palmbus@10000000 { + sysc@0 { + ralink,pinmux = "i2c", "spi", "uartlite", "mdio", "sdram", "rgmii"; + ralink,gpiomux = "jtag"; + ralink,uartmux = "gpio"; + ralink,wdtmux = <1>; + }; + + gpio0: gpio@600 { + status = "okay"; + }; + + spi@b00 { + status = "okay"; + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "w25q32"; + reg = <0 0>; + linux,modalias = "m25p80", "w25q32"; + 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>; + }; + }; + }; + }; + + ethernet@10100000 { + status = "okay"; + }; + + esw@10110000 { + status = "okay"; + ralink,portmap = <0x2f>; + ralink,led_polarity = <1>; + }; + + gpio-leds { + compatible = "gpio-leds"; + status { + label = "m3:blue:status"; + gpios = <&gpio0 9 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = <0x198>; + }; + mode { + label = "mode"; + gpios = <&gpio0 17 1>; + linux,code = <0x100>; + linux,input-type = <5>; + }; + }; + + wmac@10180000 { + status = "okay"; + ralink,mtd-eeprom = <&factory 0>; + ralink,led-polarity = <1>; + }; + + ehci@101c0000 { + status = "okay"; + }; + + ohci@101c1000 { + status = "okay"; + }; +}; diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index 1a134e6ba2..b626bec7c4 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -374,6 +374,8 @@ Image/Build/Profile/RT-N13U=$(call BuildFirmware/Default8M/$(1),$(1),rt-n13u,RT- Image/Build/Profile/FREESTATION5=$(call BuildFirmware/Default8M/$(1),$(1),freestation5,FREESTATION5) +Image/Build/Profile/M3=$(call BuildFirmware/Poray4M/$(1),$(1),m3,M3) + Image/Build/Profile/MOFI3500-3GN=$(call BuildFirmware/Default8M/$(1),$(1),mofi3500-3gn,MOFI3500-3GN) # Kernel name should be "Linux Kernel Image" to make the OpenWrt image installable from factory Web UI @@ -508,6 +510,7 @@ define Image/Build/Profile/Default $(call Image/Build/Profile/FREESTATION5,$(1)) # $(call Image/Build/Profile/HG255D,$(1)) $(call Image/Build/Profile/HW550-3G,$(1)) + $(call Image/Build/Profile/M3,$(1)) $(call Image/Build/Profile/MOFI3500-3GN,$(1)) $(call Image/Build/Profile/MPRA2,$(1)) $(call Image/Build/Profile/MZKW300NH2,$(1)) diff --git a/target/linux/ramips/rt305x/profiles/poray.mk b/target/linux/ramips/rt305x/profiles/poray.mk index 2122ca1a80..972d7fdbd6 100644 --- a/target/linux/ramips/rt305x/profiles/poray.mk +++ b/target/linux/ramips/rt305x/profiles/poray.mk @@ -5,3 +5,13 @@ # See /LICENSE for more information. # +define Profile/M3 + NAME:=Poray M3 + PACKAGES:=kmod-usb-core kmod-usb2 kmod-ledtrig-netdev kmod-ledtrig-timer +endef + +define Profile/M3/Description + Package set for Poray M3 board +endef + +$(eval $(call Profile,M3)) -- 2.30.2