[OpenWrt-Devel] [PATCH]ramips:support Lenovo AC1200 Wireless router

2014-07-24 Thread Lintel Huang
Today, Lenovo released a new product,an 11ac wireless router base MTK's
mt7620a + mt7612e evaluation board.
It has Two GE ports(RTL8211E) and 4 FE ports(Internal switch),256MByte
DDR2, 3xUSB 2.0.
This patch will make openwrt support it.

Sorry for my pool english,tks at all.

Regards, Lintel

Signed-off-by:Lintel

diff --git a/target/linux/ramips/base-files/etc/diag.sh
b/target/linux/ramips/base-files/etc/diag.sh
index 908547e..edebed8 100755
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -182,6 +182,9 @@ get_status_led() {
 na930)
 status_led="na930:blue:power"
 ;;
+ac1200)
+status_led="lenovo:blue:power"
+;;
 esac
 }

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 b372893..b862d9c 100755
--- a/target/linux/ramips/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ramips/base-files/etc/uci-defaults/02_network
@@ -172,6 +172,12 @@ ramips_setup_interfaces()
 ucidef_add_switch_vlan "switch0" "2" "4 6t"
 ;;

+ac1200)
+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 5 6t"
+ucidef_add_switch_vlan "switch0" "2" "0 6t"
+;;
 d105 | \
 na930 | \
 omni-emb-hpm|\
@@ -254,7 +260,8 @@ ramips_setup_macs()
 wan_mac=$(macaddr_add "$lan_mac" 1)
 ;;

-wr8305rt)
+wr8305rt | \
+ac1200)
 lan_mac=$(mtd_get_mac_binary factory 4)
 wan_mac=$(macaddr_add "$lan_mac" 1)
 ;;
diff --git a/target/linux/ramips/base-files/lib/ramips.sh
b/target/linux/ramips/base-files/lib/ramips.sh
index f9ab1e3..9a339b1 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -313,6 +313,9 @@ ramips_board_detect() {
 *"ZBT WR8305RT")
 name="wr8305rt"
 ;;
+*"Lenovo AC1200")
+name="ac1200"
+;;
 *)
 name="generic"
 ;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 8ada58b..a5a63ae 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -93,7 +93,8 @@ platform_check_image() {
 wrtnode |\
 x5 |\
 x8 |\
-zbt-wa05)
+zbt-wa05 |\
+ac1200)
 [ "$magic" != "27051956" ] && {
 echo "Invalid image type."
 return 1
diff --git a/target/linux/ramips/image/Makefile
b/target/linux/ramips/image/Makefile
index ef019ef..79e1787 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -716,6 +716,7 @@ Image/Build/Profile/DIR-810L=$(call
BuildFirmware/CustomFlash/$(1),$(1),dir-810l
 na930_mtd_size=20971520
 Image/Build/Profile/NA930=$(call
BuildFirmware/CustomFlash/$(1),$(1),na930,NA930,$(na930_mtd_size))
 Image/Build/Profile/MZK-750DHP=$(call
BuildFirmware/Default8M/$(1),$(1),mzk-750dhp,MZK-750DHP)
+Image/Build/Profile/AC1200=$(call
BuildFirmware/Default16M/$(1),$(1),ac1200,AC1200)

 ifeq ($(SUBTARGET),mt7620a)
 define Image/Build/Profile/Default
@@ -730,6 +731,7 @@ define Image/Build/Profile/Default
 $(call Image/Build/Profile/WHR1166D,$(1))
 $(call Image/Build/Profile/MZK-750DHP,$(1))
 $(call Image/Build/Profile/NA930,$(1))
+$(call Image/Build/Profile/AC1200,$(1))
 endef
 endif

diff --git a/target/linux/ramips/mt7620a/config-3.10
b/target/linux/ramips/mt7620a/config-3.10
index 6805dd9..50e0a55 100644
--- a/target/linux/ramips/mt7620a/config-3.10
+++ b/target/linux/ramips/mt7620a/config-3.10
@@ -1,6 +1,7 @@
 CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
 CONFIG_ARCH_DISCARD_MEMBLOCK=y
 CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
+CONFIG_ARCH_HAS_RESET_CONTROLLER=y
 CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
 CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
@@ -78,6 +79,7 @@ CONFIG_HAVE_PERF_EVENTS=y
 CONFIG_HW_HAS_PCI=y
 CONFIG_HW_RANDOM=m
 CONFIG_HZ_PERIODIC=y
+CONFIG_ICPLUS_PHY=y
 CONFIG_IMAGE_CMDLINE_HACK=y
 CONFIG_INET_LRO=y
 CONFIG_INITRAMFS_SOURCE=""
@@ -88,6 +90,7 @@ CONFIG_IRQ_FORCED_THREADING=y
 CONFIG_IRQ_INTC=y
 CONFIG_IRQ_WORK=y
 CONFIG_M25PXX_USE_FAST_READ=y
+CONFIG_MARVELL_PHY=y
 CONFIG_MDIO_BOARDINFO=y
 # CONFIG_MII is not set
 CONFIG_MIPS=y
@@ -138,7 +141,9 @@ CONFIG_PINMUX=y
 CONFIG_RALINK=y
 CONFIG_RALINK_USBPHY=y
 CONFIG_RALINK_WDT=y
+CONFIG_RA_NAT_NONE=y
 # CONFIG_RCU_STALL_COMMON is not set
+CONFIG_REALTEK_PHY=y
 CONFIG_RESET_CONTROLLER=y
 # CONFIG_SAMSUNG_USB2PHY is not set
 # CONFIG_SAMSUNG_USB3PHY is not set
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 908547e..edebed8 100755
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -182,6 +182,9 @@ get_status_led() {
 	na930)
 

Re: [OpenWrt-Devel] [PATCH]ramips:support Lenovo AC1200 Wireless router

2014-07-24 Thread Lintel Huang
No problem,why not? please give me address then I express it.

to Roman:
My  boards 's GiGa Phy has three type,ICplus IP10001+, Marvell 88E5211
,RealTek RTL8211E,so I select it.


2014-07-24 23:14 GMT+08:00 Roman Yeryomin :

> On 24 July 2014 17:04, Lintel Huang  wrote:
> >
> > Today, Lenovo released a new product,an 11ac wireless router base MTK's
> > mt7620a + mt7612e evaluation board.
> > It has Two GE ports(RTL8211E) and 4 FE ports(Internal switch),256MByte
> DDR2,
> > 3xUSB 2.0.
> > This patch will make openwrt support it.
>
> sounds interesting
>
> > @@ -254,7 +260,8 @@ ramips_setup_macs()
> >  wan_mac=$(macaddr_add "$lan_mac" 1)
> >  ;;
> >
> > -wr8305rt)
> > +wr8305rt | \
> > +ac1200)
> >  lan_mac=$(mtd_get_mac_binary factory 4)
> >  wan_mac=$(macaddr_add "$lan_mac" 1)
> >  ;;
>
> Could you define ethernet mtd-mac-address in dts?
> Then it would be covered by default case here.
> I'm trying to cleanup ramips target a bit...
>
> > +CONFIG_ICPLUS_PHY=y
> > +CONFIG_MARVELL_PHY=y
> > +CONFIG_RA_NAT_NONE=y
>
> what are these for?
>
>
> Regards,
> Roman
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH]ramips:support Lenovo AC1200 Wireless router

2014-07-31 Thread Lintel Huang
Dear John:
   I'm sorry for replying so late,
   I will make a new patch for Lenovo AC1200 series product later.

Regards,
Lintel


2014-07-29 1:24 GMT+08:00 John Crispin :

>
>
> On 28/07/2014 19:22, Weedy wrote:
> >
> > On 28 Jul 2014 12:45, "John Crispin"  > > wrote:
> >>
> >> Hi,
> >>
> >> where is the DTS file ?
> >>
> >> John
> >
> > Attached to the first mail.
> >
>
> i am marking the patch as rejected in patchwork. please send the whole
> code as one self contained patch. this way it becomes merge-able
>
> John
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH]ramips:support Lenovo AC1200 Wireless router

2014-07-31 Thread Lintel Huang
Dear Roman:
 I have three mt7621a board,they has different giga PHY.
 you can vist my google photo:

https://plus.google.com/photos/106054345863098360212/albums/6042078871461598481


2014-07-25 16:30 GMT+08:00 Roman Yeryomin :

> On 25 July 2014 04:20, Lintel Huang  wrote:
> > No problem,why not? please give me address then I express it.
>
> You've put it into the case with
> lan_mac=$(mtd_get_mac_binary factory 4)
> This means
> mtd-mac-address = <&factory 0x4>;
> in dts will do the job.
>
> > to Roman:
> > My  boards 's GiGa Phy has three type,ICplus IP10001+, Marvell 88E5211
> > ,RealTek RTL8211E,so I select it.
>
> Your board has all 3 PHYs? That sounds... unbelievable.
>
> Regards,
> Roman
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH]ramips:support Lenovo AC1200 Wireless router

2014-07-31 Thread Lintel Huang
label = "firmware";
+reg = <0x5 0xfb>;
+};
+};
+};
+};
+
+ehci@101c {
+status = "okay";
+};
+
+ohci@101c1000 {
+status = "okay";
+};
+
+ethernet@1010 {
+status = "okay";
+mtd-mac-address = <&factory 0x4>;
+pinctrl-names = "default";
+pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;
+
+ralink,port-map = "w";
+
+port@4 {
+status = "okay";
+phy-handle = <&phy4>;
+phy-mode = "rgmii";
+};
+
+port@5 {
+status = "okay";
+phy-handle = <&phy5>;
+phy-mode = "rgmii";
+};
+
+mdio-bus {
+status = "okay";
+
+phy4: ethernet-phy@4 {
+reg = <4>;
+phy-mode = "rgmii";
+};
+
+phy5: ethernet-phy@5 {
+reg = <5>;
+phy-mode = "rgmii";
+};
+};
+};
+
+gsw@1011 {
+ralink,port4 = "gmac";
+};
+
+pcie@1014 {
+status = "okay";
+};
+
+wmac@1018 {
+ralink,mtd-eeprom = <&factory 0>;
+};
+
+pinctrl {
+state_default: pinctrl0 {
+gpio {
+ralink,group = "uartf", "wled", "nd_sd";
+ralink,function = "gpio";
+};
+pa {
+ralink,group = "pa";
+ralink,function = "pa";
+};
+};
+};
+
+gpio-leds {
+compatible = "gpio-leds";
+power1 {
+label = "lenovo:yellow:power";
+gpios = <&gpio0 14 1>;
+};
+power2 {
+label = "lenovo:blue:power";
+gpios = <&gpio0 9 1>;
+};
+wlan1 {
+label = "lenovo:yellow:wifi";
+gpios = <&gpio3 0 1>;
+};
+wlan2 {
+label = "lenovo:blue:wifi";
+gpios = <&gpio2 10 1>;
+};
+usb1 {
+label = "lenovo:yellow:usb";
+gpios = <&gpio2 13 1>;
+};
+usb2 {
+label = "lenovo:blue:usb";
+gpios = <&gpio2 12 1>;
+};
+internet {
+label = "lenovo:blue:internet";
+gpios = <&gpio2 11 1>;
+};
+};
+
+gpio-keys-polled {
+compatible = "gpio-keys-polled";
+#address-cells = <1>;
+#size-cells = <0>;
+poll-interval = <20>;
+reset {
+label = "reset";
+gpios = <&gpio0 11 1>;
+linux,code = <0x198>;
+};
+};
+};
Index: target/linux/ramips/image/Makefile
===
--- target/linux/ramips/image/Makefile(revision 41906)
+++ target/linux/ramips/image/Makefile(working copy)
@@ -716,6 +716,8 @@
 na930_mtd_size=20971520
 Image/Build/Profile/NA930=$(call
BuildFirmware/CustomFlash/$(1),$(1),na930,NA930,$(na930_mtd_size))
 Image/Build/Profile/MZK-750DHP=$(call
BuildFirmware/Default8M/$(1),$(1),mzk-750dhp,MZK-750DHP)
+Image/Build/Profile/Y1=$(call
BuildFirmware/Default16M/$(1),$(1),Lenovo-y1,Y1)
+Image/Build/Profile/Y1S=$(call
BuildFirmware/Default16M/$(1),$(1),Lenovo-y1s,Y1S)

 ifeq ($(SUBTARGET),mt7620a)
 define Image/Build/Profile/Default
@@ -730,6 +732,8 @@
 $(call Image/Build/Profile/WHR1166D,$(1))
 $(call Image/Build/Profile/MZK-750DHP,$(1))
 $(call Image/Build/Profile/NA930,$(1))
+$(call Image/Build/Profile/Y1,$(1))
+$(call Image/Build/Profile/Y1S,$(1))
 endef
 endif

Index: target/linux/ramips/mt7620a/config-3.10
===
--- target/linux/ramips/mt7620a/config-3.10(revision 41906)
+++ target/linux/ramips/mt7620a/config-3.10(working copy)
@@ -1,6 +1,7 @@
 CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
 CONFIG_ARCH_DISCARD_MEMBLOCK=y
 CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
+CONFIG_ARCH_HAS_RESET_CONTROLLER=y
 CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
 CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
@@ -78,6 +79,7 @@
 CONFIG_HW_HAS_PCI=y
 CONFIG_HW_RANDOM=m
 CONFIG_HZ_PERIODIC=y
+CONFIG_ICPLUS_PHY=y
 CONFIG_IMAGE_CMDLINE_HACK=y
 CONFIG_INET_LRO=y
 CONFIG_INITRAMFS_SOURCE=""
@@ -88,6 +90,7 @@
 CONFIG_IRQ_INTC=y
 CONFIG_IRQ_WORK=y
 CONFIG_M25PXX_USE_FAST_READ=y
+CONFIG_MARVELL_PHY=y
 CONFIG_MDIO_BOARDINFO=y
 # CONFIG_MII is not set
 CONFIG_MIPS=y
@@