Skip to content

Commit

Permalink
add target gl-mt300n-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
dengxinfa committed Nov 1, 2018
1 parent a35cd45 commit 8b18129
Show file tree
Hide file tree
Showing 7 changed files with 188 additions and 2 deletions.
3 changes: 3 additions & 0 deletions target/linux/ramips/base-files/etc/board.d/01_leds
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ case $board in
gl-mt750)
set_wifi_led "gl-mt750:wlan"
;;
gl-mt300n-v2)
set_wifi_led "gl-mt300n-v2:wlan"
;;
mpr-a1)
set_wifi_led "hame:blue:system"
;;
Expand Down
13 changes: 11 additions & 2 deletions target/linux/ramips/base-files/etc/board.d/02_network
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,18 @@ ramips_setup_interfaces()
ucidef_add_switch_vlan "switch0" "2" "0 6t"
ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
;;

gl-mt300n-v2)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
ucidef_add_switch_vlan "switch0" "1" "1 6t"
ucidef_add_switch_vlan "switch0" "2" "0 6t"
;;
gl-mt750)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
ucidef_add_switch_vlan "switch0" "2" "0 6t"
ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
;;

whr-1166d)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
Expand Down Expand Up @@ -375,6 +379,11 @@ ramips_setup_macs()
wan_mac=$(mtd_get_mac_binary factory 40)
;;

gl-mt300n-v2)
lan_mac=$(mtd_get_mac_binary factory 4)
wan_mac=$(mtd_get_mac_binary factory 4)
;;

rt-n56u)
lan_mac=$(cat /sys/class/net/eth0/address)
lan_mac=$(macaddr_setbit_la "$lan_mac")
Expand Down
3 changes: 3 additions & 0 deletions target/linux/ramips/base-files/lib/ramips.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ ramips_board_detect() {
*"GL-MT300N")
name="gl-mt300n"
;;
*"GL-MT300N-V2")
name="gl-mt300n-v2"
;;
*"GL-MT750")
name="gl-mt750"
;;
Expand Down
1 change: 1 addition & 0 deletions target/linux/ramips/base-files/lib/upgrade/platform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ platform_check_image() {
firewrt |\
gl-mt300a |\
gl-mt300n |\
gl-mt300n-v2 |\
gl-mt750 |\
pbr-m1 |\
hg255d | \
Expand Down
150 changes: 150 additions & 0 deletions target/linux/ramips/dts/GL-MT300N-V2.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
/dts-v1/;

/include/ "mt7628an.dtsi"

/ {
compatible = "gl-inet,gl-mt300n-v2", "mediatek,mt7628an-soc";
model = "GL-MT300N-V2";

chosen {
bootargs = "console=ttyS0,115200";
};

memory@0 {
device_type = "memory";
reg = <0x0 0x8000000>;
};

palmbus@10000000 {
spi@b00 {
status = "okay";

m25p80@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "en25q64";
reg = <0 0>;
linux,modalias = "m25p80", "en25q64";
spi-max-frequency = <10000000>;
m25p,chunked-io = <32>;

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 0xfb0000>;
};
};
};
};

ethernet@10100000 {
status = "okay";
mtd-mac-address = <&factory 0x4>;
};

esw@10110000 {
status = "okay";
ralink,portmap = "llllw";
};


sdhc@10130000 {
status = "okay";
};

wmac@10180000 {
status = "okay";
ralink,mtd-eeprom = <&factory 0x4>;
};

ehci@101c0000 {
status = "okay";
};

ohci@101c1000 {
status = "okay";
};

pinctrl {
state_default: pinctrl0 {
gpio {
ralink,group = "wdt", "gpio", "wled_an", "p0led_an", "p1led_an", "i2c", "i2s", "uart1";
ralink,function = "gpio";
};
};
};

gpio-leds {
compatible = "gpio-leds";

power {
label = "gl-mt300n-v2:power";
default-state = "on";
gpios = <&gpio1 10 1>;
};

wan {
label = "gl-mt300n-v2:wan";
gpios = <&gpio1 11 1>;
};

wlan {
label = "gl-mt300n-v2:wlan";
gpios = <&gpio1 12 1>;
};
};

gpio-keys {
compatible = "gpio-keys-polled";
#address-cells = <1>;
#size-cells = <0>;
poll-interval = <20>;

reset {
label = "reset";
gpios = <&gpio1 6 1>;
linux,code = <0x198>;
};

BTN_0 {
label = "BTN_0";
gpios = <&gpio0 0 1>;
linux,code = <0x100>;
};

BTN_1 {
label = "BTN_1";
gpios = <&gpio0 3 1>;
linux,code = <0x101>;
};
};

gpio_export {
compatible = "gpio-export";
#size-cells = <0>;

usbpow {
gpio-export,name = "usbpow";
gpio-export,output = <1>;
gpios = <&gpio0 11 1>;
};
};

};
2 changes: 2 additions & 0 deletions target/linux/ramips/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1023,10 +1023,12 @@ endef
#

Image/Build/Profile/MT7628=$(call BuildFirmware/Default4M/$(1),$(1),mt7628,MT7628)
Image/Build/Profile/GL-MT300N-V2=$(call BuildFirmware/Default16M/$(1),$(1),gl-mt300n-v2,GL-MT300N-V2)

ifeq ($(SUBTARGET),mt7628)
define Image/Build/Profile/Default
$(call Image/Build/Profile/MT7628,$(1))
$(call Image/Build/Profile/GL-MT300N-V2,$(1))
endef
endif

Expand Down
18 changes: 18 additions & 0 deletions target/linux/ramips/mt7628/profiles/gl-mt300n-v2.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

define Profile/GL-MT300N-V2
NAME:=GL-iNet GL-MT300N-V2
PACKAGES:=\
kmod-usb-core kmod-usb2 kmod-usb-ohci \
kmod-ledtrig-usbdev
endef

define Profile/GL-MT300N-V2/Description
Support for GL-iNet GL-MT300N-V2 routers
endef
$(eval $(call Profile,GL-MT300N-V2))

0 comments on commit 8b18129

Please sign in to comment.