OpenWrt Forum Archive

Topic: WL-351 adding USB port(WIP) - OpenWRT on a Sitecom WL-351(WIP)

The content of this topic has been archived between 4 Mar 2018 and 8 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Does nobody have an asnwer?
I would really like to have it working again.

I managed to get OpenWRT working. But how can I flash the stock firmware back? (the Apps and Kernel dlf files?)

(Last edited by reynard80 on 14 Nov 2015, 11:43)

Its been a long time since I've worked on this unit. And since it does not have a accessible USB host interface I lost intrest in this device. Maybe I can find some time to compile a working image with the right network configuration later.

And about flashing the old firmware back then you need to take a look in the Engenius firmware. If you flash that one you can use their recovery path to flash the sitecom firmware again. You need to change some binary data in the firmware so that the Engenious firmware accepts a Sitecom image. There are some topics which you can find using google. See this link

(Last edited by Timeless on 14 Nov 2015, 14:23)

Timeless wrote:

And about flashing the old firmware back then you need to take a look in the Engenius firmware. If you flash that one you can use their recovery path to flash the sitecom firmware again. You need to change some binary data in the firmware so that the Engenious firmware accepts a Sitecom image. There are some topics which you can find using google. See this link

Thanks! I read about the Engenius firmware, but those are also two DLF's. How can I flash these? Do you perhaps have link as well?

I have spended couple of hours on the 15.05 version but without succes.
I have installed a fresh 12.09 image.
Installed the 4 packets by hand and used the config of langerak post #9 and now it is working :-)

I don't know why 15.05 is not working. It looks like the communication between openwrt and the rtl8366rb is not working correctly. It can read statusses but sending information from openwrt to the device doesn't work.

I will use version 12.09 for now.

jackorobot wrote:
wuxeon wrote:

the same as you. the openwrt couldn't work on wl-351 except 12.09.
also 14.07,15.05 and trunk couldn't work .and i have installed and loaded the driver(4 ipk files:swconfig rtl8366rb and then) ,the wl351 could recogize the switch 1 as rtl8366rb,and it could work in the router .

when i get in wl 351 with ssh, it shows the right status when the cable pluged to the port.
i will post the img later.sorry,my english is poor.

Thanks for the reply.
As far as I understood I tried all you said.
I used 15.05, 14.07 and 12.09.
With all of those the rt305x switch was found without needing to update the module.
But even after installing all modules concerning the rtl8366 it still did not find the device.
I can access wireless no problem, but the switching part is still not working.
The WAN connection is also not working.

I recently build 4 images. 12.09 with and without ipv6 (both with USB) and 15.05 with and without USB(because potential lack of space). All include the rtl8366 kernel module. I will post the results when I find the time.

I like to get 15.05 working because of the native ipv6 support. But time will tell.

Offtopic: great to see that there are still people interested in this device.

(Last edited by Timeless on 9 Feb 2016, 19:05)

Nice @Timeless
I played around yesterday and got it working for now.
I still have one problem. I didn't succeed to move the WAN port. If I leave it at port 4 everything works. OpenWRT will obtain a valid IP-Adress from the DHCP server.
But if I move the port in the /etc/config/network to a different port and replug the cable to that new port it won't work.
I see in the OpenWRT uci that a cable is plugged in, but the DHCP request is never send.
When I use udhcpc at command line I see that it tries to send 3 requests and that it won't get a response (it hangs after 3 requests). The other end (my second router) doesn't log any DHCP request. If I move everything back to port 4 it works and udhcpc also gives results.....

Strange, behaviour... But at version 12.09 at least 1 port work as WAN port. In 15.05 I couldn't get any port to act as WAN port.

@Timeless: I'm curious if you get the WAN port working in 15.05

(Last edited by jan.saris on 10 Feb 2016, 17:28)

Ah thats still strange. You're saying that you're unable to get the wan port working in 12.09? I remembered from my previous 12.09 experiment that all the ports were working.

[UPDATE]

Ok... I tried 15.05 today. and the results are both positive and negative. With the switch package installed by default I was able to get both the switches detected by default. Also when I change the network configuration and reboot the device I noticed that all the switch LEDs light up for a second during boot. This also happends during a /etc/init.d/network restart.

Last time I checked BB this LED blinking thing wasn't happening. So this is a good sign.
But after applying the possible 'right?' VLAN configuration I'm still unable to get an IP adress on any of the LAN or WAN ports. but I can see that the router tries to send packages on eth0.1 and eth0.2 according to IFCONFIG, but still receives non in return. But when I check swconfig it does receive packages when I enter the swconfig dev switch1 list command. but no packages are leaving the switch itself. I only see IfINOctets in this log.

[INFO]
I also noticed another topic: link
Where I found this post:

moroboshi wrote:

Patch needed to get the WL-351 image to work again:

[PATCH] Fix up switch settings for Sitecom WL-351 v1 002

Pinmux for rgmii needs to be set to rgmii, not gpio.
Hide the ESW switch on boot (using new rgmii esw devicetree attribute).
Also add a Sitecom-specific profile, since the image needs to include
the rtl8366 kernel driver.

Signed-off-by: Tobias Diedrich <ranma+openwrt@tdiedrich.de>
---
 target/linux/ramips/dts/WL-351.dts                     |  7 ++++++-
 .../files/drivers/net/ethernet/ralink/esw_rt3052.c     | 13 +++++++++++++
 target/linux/ramips/image/Makefile                     |  1 -
 target/linux/ramips/rt305x/profiles/sitecom.mk         | 18 ++++++++++++++++++
 4 files changed, 37 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ramips/rt305x/profiles/sitecom.mk

diff --git a/target/linux/ramips/dts/WL-351.dts b/target/linux/ramips/dts/WL-351.dts
index 81c963b..89c1ae5 100644
--- a/target/linux/ramips/dts/WL-351.dts
+++ b/target/linux/ramips/dts/WL-351.dts
@@ -9,9 +9,13 @@
     pinctrl {
         state_default: pinctrl0 {
             gpio {
-                ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf";
+                ralink,group = "spi", "i2c", "jtag", "mdio", "uartf";
                 ralink,function = "gpio";
             };
+            rgmii {
+                ralink,group = "rgmii";
+                ralink,function = "rgmii";
+            };
         };
     };
 
@@ -53,6 +57,7 @@
     };
 
     esw@10110000 {
+        ralink,rgmii = <1>;
         ralink,portmap = <0x3f>;
         ralink,fct2 = <0x0002500c>;
         /*
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
index 55d5729..1f89838 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -1454,6 +1454,19 @@ static int esw_probe(struct platform_device *pdev)
 
     esw_hw_init(esw);
 
+    reg_init = of_get_property(np, "ralink,rgmii", NULL);
+    if (reg_init && be32_to_cpu(*reg_init) == 1) {
+        /*
+         * External switch connected to RGMII interface.
+         * Unregister the switch device after initialization.
+         */
+        err = -ENODEV;
+        dev_err(&pdev->dev, "RGMII mode, not exporting switch device.\n");
+        unregister_switch(&esw->swdev);
+        platform_set_drvdata(pdev, NULL);
+        goto unmap_base;
+    }
+
     esw_w32(esw, RT305X_ESW_PORT_ST_CHG, RT305X_ESW_REG_ISR);
     esw_w32(esw, ~RT305X_ESW_PORT_ST_CHG, RT305X_ESW_REG_IMR);
     request_irq(esw->irq, esw_interrupt, 0, "esw", esw);
diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
index 776920b..65fd9a4 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -764,7 +764,6 @@ define Image/Build/Profile/Default
     $(call Image/Build/Profile/WL_330N,$(1))
     $(call Image/Build/Profile/WL_330N3G,$(1))
     $(call Image/Build/Profile/WL341V3,$(1))
-    $(call Image/Build/Profile/WL-351,$(1))
     $(call Image/Build/Profile/WNCE2001,$(1))
     $(call Image/Build/Profile/WR512-3GN,$(1))
     $(call Image/Build/Profile/WR6202,$(1))
diff --git a/target/linux/ramips/rt305x/profiles/sitecom.mk b/target/linux/ramips/rt305x/profiles/sitecom.mk
new file mode 100644
index 0000000..16d9fef
--- /dev/null
+++ b/target/linux/ramips/rt305x/profiles/sitecom.mk
@@ -0,0 +1,18 @@
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/WL-351
+    NAME:=Sitecom WL-351 v1
+    PACKAGES:=\
+        kmod-switch-rtl8366rb kmod-swconfig swconfig
+endef
+
+define Profile/WL-351/Description
+    Package set for Sitecom WL-351 v1
+endef
+
+$(eval $(call Profile,WL-351))
-- 
2.1.4

This seems to indicate that there is something wrong with the switch communication after all. But I have no idea if this patch is already included in the current CC or TRUNK.

tormod wrote:
Timeless wrote:

About the patch mentioned above. Is that one already applied in the new CC release?

AFAICS the patch has not been applied anywhere. It sits in the bug tracker https://dev.openwrt.org/ticket/17475 but probably needs to be posted to the development list. I will ask the author.

Reading this post does indication that it is not. But some time has past so there is a chance that it is not accurate anymore.
this is the bug report: link which indicates that it is working on the 15.05 tree.

[FUTURE WORK]
I will upload my binary of CC15.05 so anyone can give it a try. And also find a way to try the above mentioned patch and see if that makes a difference.

This is my current /etc/config/network configuration. Maybe there is something wrong because it still does not work?

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix '[ADRES]'

config interface 'lan'
        option ifname 'eth0.1'
        option force_link '1'
        option macaddr '11:22:33:44:55:66'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'wan'
        option ifname 'eth0.2'
        option force_link '1'
        option macaddr '00:11:22:33:44:55'
        option proto 'dhcp'

config interface 'wan6'
        option ifname 'eth0.2'
        option proto 'dhcpv6'

config switch
        option name 'switch1'
        option reset '1'
        option enable_vlan '1'
        option mirror_source_port '0'
        option mirror_monitor_port '0'
        option enable_vlan4k '1'

config switch_vlan
        option device 'switch1'
        option vlan '1'
        option ports '0 1 2 3 5t'

config switch_vlan
        option device 'switch1'
        option vlan '2'
        option ports '4 5t'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '5t 6t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '5t 6t'

(Last edited by Timeless on 11 Feb 2016, 22:24)

Timeless wrote:

Ah thats still strange. You're saying that you're unable to get the wan port working in 12.09? I remembered from my previous 12.09 experiment that all the ports were working.

It works, but only the wan port works (the blue one). When I change the config to use a different port as wan port, (one of the yellow one's) than I don't get a ip (the same issue you have with CC)

Nice work!
I'm busy this weekend, but maybe next week I will give the Imagebuilder a try. (I'm a total noob at this front, because I'm a C# developer, but my college knows how to merge and build C code).

(Last edited by jan.saris on 1 Mar 2016, 11:41)

@jan.saris: Please do not quote the complete message you are replying to, but reduce the quoting to the minimum part required for understanding your reply.

Hint: You can also Edit your messages after sending.

[CURRENT STATUS]
Ok great news! after applying the mentioned patch (with some small changes to merge it with the newest source) I was able to get the WL-351 and switch working in 15.05.

This time the default networking configuration also works smile which means that the binary works out of the box without the need of installing any additional packages or configuration.

[FUTURE WORK]

I'm still trying to get the USB pinout on this device. And this is what I know so far:
According to this documentation I found the following pinout definition(Click on the picture for a better view on the pinout itself):
https://dl.dropboxusercontent.com/u/13519734/WL-351/RT3052F%20-%20USB%20OTG.PNG

And I removed the heatsink from a WL-368 v1.001 which is basically a WL-351 with 2 antenna's(and 2.4ghz boostcircuits) instead of 3. which I had laying around for development (it does run the WL-351 image without any problem). And without the heatsink I could get a better view on the RT3052F.

Here are pictures of what I saw: (Click on the pictures for a larger version)
https://dl.dropboxusercontent.com/u/13519734/WL-351/WL-368_PCB_small.jpg

Close-ups: (best I could with a magnifying glass:) )
https://dl.dropboxusercontent.com/u/13519734/WL-351/WL-368_PCB_2_small.jpg
https://dl.dropboxusercontent.com/u/13519734/WL-351/WL-368_PCB_3_small.jpg

And now I have to find a way to see if the USB traces are actually connected and if the traces are accessible at the sides of the CPU itself. Does someone have an idea how to proceed?

[NOTES]
here is a link of a polish topic of someone that was also working on a RT3052F and desoldered the chip: link

(Last edited by Timeless on 14 Feb 2016, 16:25)

@Timeless: So WAN - LAN works now on your 15.05 build? And the WAN gets an IP from the DHCP server?
Sorry, I was offline for a couple of weeks, because I became a dad and my focus went to something else ;-)

12.09 is running perfect for me at the moment. I only wanted to be able to get IPTV streams on my local network and OpenWRT 12.09 did the trick for me.

Timeless, could you upload the working 15.05 image? I have tried to patch the firmware myself a while ago, but could not find all needed files. I must admit I'm not really used to Linux.

@jan.saris, ah no problem. Congratulations smile.

@FSmith, yeah sure. I have my image build without PPPOE, PPP but with Collectd, Luci Statistics and nano. Is that ok for you or do you want the precompiled image builder so you can make your own?

@both, yes I recently build a 15.05.1 image and it still works perfectly. all the 5 switch ports are functioning

(Last edited by Timeless on 5 Apr 2016, 18:19)

Timeless wrote:

@FSmith, yeah sure. I have my image build without PPPOE, PPP but with Collectd, Luci Statistics and nano. Is that ok for you or do you want the precompiled image builder so you can make your own?

A complete build would be great smile

FSmith wrote:

A complete build would be great smile

Sorry but that does not aswer my question. What is your defenition of a complete build?

(Last edited by Timeless on 5 Apr 2016, 20:06)

Timeless wrote:
FSmith wrote:

A complete build would be great smile

Sorry but that does not aswer my question. What is your defenition of a complete build?

Sorry, I meant the image ready to be flashed in the router.

Ah ok. But you don't need anything specific? Like PPP or PPPOE. My current images has +/-104KB free space. For normal use and settings this should be enough. But don't expect that you can install large packages.

If thats ok then I will upload my image

(Last edited by Timeless on 5 Apr 2016, 20:56)

It will do just fine, thanks!

Hi,

Ok, here is a link where you can download my build. Let me know how it works out for you wink

Ps. In the target.mk you will find which additional packages are included in this build.

Regards,

(Last edited by Timeless on 7 Apr 2016, 10:48)

Timeless, Thank you, now my switch is working again! Just enabled the wireless, and after a reboot I had a working  internet connection trouch a patch cable. Awesome!

Hi,

No problem. Great to know that it worked!

Regards

Ok since trunk switched the ralink drivers the earlier provided patch does not work anymore. I manually changed the following files:

/target/linux/ramips/dts/WL-351.dts
/target/linux/ramips/image/Makefile [MOVED]--> /target/linux/ramips/image/RT305x.mk
new file target/linux/ramips/rt305x/profiles/sitecom.mk

And since the esw_rt3052.c files is not present anymore I changed the following file:

build_dir/target-mipsel_24kec+dsp_musl-1.1.14/linux-ramips_rt305x/linux-4.4.7/drivers/net/ethernet/mediatek/esw_rt3050.c

which is only there after the pre-compile steps.

But after flashing the file to my WL-351 this is the resulting swconfig output:

root@OpenWrt:/# swconfig list
Found: switch0 - rtl8366rb

Which is correct according the the patch and also my previous 15.05.1 build

The error are also on 15.05.1 after aplying the patch. But the patch fixes the networking issue on 15.05.1 but not on DD.
But for some reason during boot I still receive:
[    4.153317] dwc2 101c0000.otg: Overcurrent change detected
[    4.330182] dwc2 101c0000.otg: Overcurrent change detected
Failed to connect to the switch. Use the "list" command to see which switches are available.
Failed to connect to the switch. Use the "list" command to see which switches are available.

Failed to connect to[    4.977982] 8021q: adding VLAN 0 to HW filter on device eth0
the switch. Use the "list" command to see which switches are available.
[    5.019517] random: procd urandom read with 9 bits of entropy available

I made the errors bold and let the rest also visable because this is how it appears in the console. The Failed errors are not in syslog.

So right now I'm quite stuck. I can ping between clients on the switch(with the patch. cannot ping without patch) but I cannot reach the router or WAN.

(Last edited by Timeless on 19 May 2016, 03:13)

The discussion might have continued from here.