From c16de866d585eb25872732274d5109022193fed1 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 3 Jan 2013 01:58:01 +0000 Subject: switch: ROBO Switch Gigabit MII Support I wrote this patch some time ago because I had a need for one of the Gigabit ports (Linksys E3000) to be forced to 100FD. This is based on the robocfg sources included w/ the RT-N16 sources from ASUS. Since work is progressing on a BGMAC driver that could be included in OpenWRT, this may be useful to someone else. In testing, forcing the speed to 10/100 or 1000 worked fine; however, when trying to force full-duplex mode, the result was always half-duplex. I was not able to isolate the source of the problem (this patch, driver or H/W limitation). The only way I could get it to work was to set the port to Auto, but then only advertise 100FD (not included in this patch). I have a modified version of the robocfg package as well, I'd have to clean it up a little first (remove the full-duplex hack) before submitting it if there is interest. Signed-off-by: Nathan Hintz git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34992 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/switch/src/switch-core.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'package/switch/src/switch-core.c') diff --git a/package/switch/src/switch-core.c b/package/switch/src/switch-core.c index 79b4e93f03..c77e4bba47 100644 --- a/package/switch/src/switch-core.c +++ b/package/switch/src/switch-core.c @@ -26,7 +26,7 @@ * enable_vlan: "0", "1" * port// * enabled: "0", "1" - * media: "AUTO", "100FD", "100HD", "10FD", "10HD" + * media: "AUTO", "1000FD", "1000HD", "100FD", "100HD", "10FD", "10HD" * vlan// * ports: same syntax as for nvram's vlan*ports (eg. "1 2 3 4 5*") */ @@ -305,6 +305,10 @@ int switch_parse_media(char *buf) if (strncmp(str, "AUTO", 4) == 0) return SWITCH_MEDIA_AUTO; + else if (strncmp(str, "1000FD", 6) == 0) + return SWITCH_MEDIA_1000 | SWITCH_MEDIA_FD; + else if (strncmp(str, "1000HD", 6) == 0) + return SWITCH_MEDIA_1000; else if (strncmp(str, "100FD", 5) == 0) return SWITCH_MEDIA_100 | SWITCH_MEDIA_FD; else if (strncmp(str, "100HD", 5) == 0) @@ -322,14 +326,18 @@ int switch_print_media(char *buf, int media) if (media & SWITCH_MEDIA_AUTO) len = sprintf(buf, "Auto"); + else if (media == (SWITCH_MEDIA_1000 | SWITCH_MEDIA_FD)) + len = sprintf(buf, "1000FD"); + else if (media == SWITCH_MEDIA_1000) + len = sprintf(buf, "1000HD"); else if (media == (SWITCH_MEDIA_100 | SWITCH_MEDIA_FD)) len = sprintf(buf, "100FD"); else if (media == SWITCH_MEDIA_100) - len = sprintf(buf, "100HD"); + len = sprintf(buf, "100HD"); else if (media == SWITCH_MEDIA_FD) - len = sprintf(buf, "10FD"); + len = sprintf(buf, "10FD"); else if (media == 0) - len = sprintf(buf, "10HD"); + len = sprintf(buf, "10HD"); else len = sprintf(buf, "Invalid"); -- cgit v1.2.3