Earlier i’ve written a post on how to install OpenWrt on that router, now it’s time to start fixing broken stuff, especially the reset button and the usb port, along with default switch/network configuration.
After some work i’ve managed to reverse engineer the GPIOs of that router, GPIO0 is used on the wps button on top of the case which is the only button the router has , so we’ll be using it as reset/failsafe button.
Also who has tried installing openwrt on that router may have noticed that the usb port has no power, turns out that GPIO6 is the one which enables the DC-DC converter on the board ( probably they did that to allow resetting the 3G modem without physically removing it from the port ).
So i’ve created a new dts file for that router finally, instead of using the WR5123ng image, below there’s the patch to apply on openwrt source tree
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
From 73a975a826f2ca8af93411de7f9a0a48cf847938 Mon Sep 17 00:00:00 2001 From: Tiziano Bacocco <tizbac2@gmail.com> Date: Thu, 8 Oct 2015 00:37:06 +0200 Subject: Added Sitecom WL-326 support Signed-off-by: Tiziano Bacocco <tizbac2@gmail.com> diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network index 94d69b9..8cb53a9 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -119,6 +119,7 @@ ramips_setup_interfaces() ur-326n4g|\ wrtnode|\ wt3020|\ + wl-326|\ zbt-wa05) ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_add_switch "switch0" "1" "1" diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index b89a88c..b092173 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -406,6 +406,9 @@ ramips_board_detect() { *"WR512-3GN-like"*) name="wr512-3gn" ;; + *"WL-326") + name="wl-326" + ;; *"WR6202") name="wr6202" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index 44d41c1..ca52345 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -110,6 +110,7 @@ platform_check_image() { whr-600d|\ whr-g300n|\ wizfi630a|\ + wl-326|\ wl-330n|\ wl-330n3g|\ wl-341v3|\ diff --git a/target/linux/ramips/dts/WL-326.dts b/target/linux/ramips/dts/WL-326.dts new file mode 100644 index 0000000..b9da889 --- /dev/null +++ b/target/linux/ramips/dts/WL-326.dts @@ -0,0 +1,111 @@ +/dts-v1/; + +/include/ "rt3050.dtsi" + +/ { + compatible = "WL-326", "ralink,rt3052-soc"; + model = "Sitecom WL-326"; + + pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,function = "gpio"; + }; + }; + }; + + cfi@1f000000 { + compatible = "cfi-flash"; + reg = <0x1f000000 0x800000>; + bank-width = <2>; + device-width = <2>; + #address-cells = <1>; + #size-cells = <1>; + + 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 0x3c8000>; + }; + }; + + esw@10110000 { + ralink,portmap = <0x2f>; + }; + + wmac@10180000 { + ralink,mtd-eeprom = <&factory 0>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + 3g { + label = "wl-326:green:3g"; + gpios = <&gpio0 9 1>; + }; + + gateway { + label = "wl-326:green:gateway"; + gpios = <&gpio0 11 1>; + }; + + ap { + label = "wl-326:green:ap"; + gpios = <&gpio0 12 1>; + }; + + wps { + label = "wl-326:green:wps"; + gpios = <&gpio0 14 1>; + }; + + station { + label = "wl-326:green:station"; + gpios = <&gpio0 13 1>; + }; + + usbpower { + label = "wl-326:nocolor:usbpower"; + gpios = <&gpio0 6 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 0 1>; + linux,code = <0x198>; + }; + + }; + + otg@101c0000 { + status = "okay"; + }; + +}; diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index 117e07d..39fda3a 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -682,6 +682,8 @@ endef BuildFirmware/WNCE2001/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3)) Image/Build/Profile/WNCE2001=$(call BuildFirmware/WNCE2001/$(1),$(1),wnce2001,WNCE2001) +Image/Build/Profile/WL-326=$(call BuildFirmware/Default4M/$(1),$(1),wl-326,WL-326) + Image/Build/Profile/WR512-3GN=$(call BuildFirmware/DefaultDualSize/$(1),$(1),wr512-3ng,WR512-3GN) Image/Build/Profile/WT1520=$(call BuildFirmware/PorayDualSize/$(1),$(1),wt1520,WT1520) @@ -775,6 +777,7 @@ define Image/Build/Profile/Default $(call Image/Build/Profile/WHRG300N,$(1)) $(call Image/Build/Profile/WIZARD8800,$(1)) $(call Image/Build/Profile/WIZFI630A,$(1)) + $(call Image/Build/Profile/WL-326,$(1)) $(call Image/Build/Profile/WL-330N,$(1)) $(call Image/Build/Profile/WL-330N3G,$(1)) $(call Image/Build/Profile/WL-341V3,$(1)) |
After that work, reset button works ok ( to get into failsafe mode wait for an udp packet from the router then shortly press the button once ), usb port power is tied to a dummy usbpower led, set brightness to 0 to power on, brightes to 1 to power off
Like:
1 2 3 |
root@OpenWrt:~# echo 1 > /sys/devices/gpio-leds/leds/wl-326:nocolor:usbpower/brightness root@OpenWrt:~# echo 0 > /sys/devices/gpio-leds/leds/wl-326:nocolor:usbpower/brightness root@OpenWrt:~# |
1 2 3 4 5 6 7 8 9 10 |
[ 144.250000] dwc2 101c0000.otg: Overcurrent change detected [ 144.300000] dwc2 101c0000.otg: Overcurrent change detected [ 144.350000] dwc2 101c0000.otg: Overcurrent change detected [ 144.360000] dwc2 101c0000.otg: Overcurrent change detected [ 144.670000] dwc2 101c0000.otg: Overcurrent change detected [ 144.720000] dwc2 101c0000.otg: Overcurrent change detected [ 144.770000] dwc2 101c0000.otg: Overcurrent change detected [ 144.820000] dwc2 101c0000.otg: Overcurrent change detected [ 144.870000] dwc2 101c0000.otg: Overcurrent change detected [ 144.880000] dwc2 101c0000.otg: Overcurrent change detected |
Still usb is not working, on dmesg dwc2 driver is constantly reporting an overcurrent condition that i think it is caused by VBUS being supplied from an external power supply instead of the SoC, so it thinks that there’s a short circuit, probably some driver work is still needed, so more updates are likely to follow