summaryrefslogtreecommitdiff
path: root/package/switch/src/switch-robo.c
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2011-08-04 20:07:58 +0000
committerHauke Mehrtens <hauke@hauke-m.de>2011-08-04 20:07:58 +0000
commitb220442c75934dbd2143ea9869dc39e913e1a57f (patch)
treee5a754e6d1b06220b59609e4742c30ed89c6e5c8 /package/switch/src/switch-robo.c
parent695cef4f456ac64fefb1eaf16447a23ad07914c1 (diff)
downloadmtk-20170518-b220442c75934dbd2143ea9869dc39e913e1a57f.zip
mtk-20170518-b220442c75934dbd2143ea9869dc39e913e1a57f.tar.gz
mtk-20170518-b220442c75934dbd2143ea9869dc39e913e1a57f.tar.bz2
switch: update for brcm47xx target
* remove suport for 2.4 kernel * add support for bcma bus SVN-Revision: 27904
Diffstat (limited to 'package/switch/src/switch-robo.c')
-rw-r--r--package/switch/src/switch-robo.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/package/switch/src/switch-robo.c b/package/switch/src/switch-robo.c
index 817fba3..ec9e337 100644
--- a/package/switch/src/switch-robo.c
+++ b/package/switch/src/switch-robo.c
@@ -34,6 +34,10 @@
#include "switch-core.h"
#include "etc53xx.h"
+#ifdef CONFIG_BCM47XX
+#include <nvram.h>
+#endif
+
#define DRIVER_NAME "bcm53xx"
#define DRIVER_VERSION "0.02"
#define PFX "roboswitch: "
@@ -63,14 +67,6 @@
#define SIOCGETCPHYRD (SIOCDEVPRIVATE + 9)
#define SIOCSETCPHYWR (SIOCDEVPRIVATE + 10)
-/* Only available on brcm47xx */
-#ifdef BROADCOM
-extern char *nvram_get(const char *name);
-#define getvar(str) (nvram_get(str)?:"")
-#else
-#define getvar(str) ""
-#endif
-
/* Data structure for a Roboswitch device. */
struct robo_switch {
char *device; /* The device name string (ethX) */
@@ -258,6 +254,9 @@ static int robo_switch_enable(void)
{
unsigned int i, last_port;
u16 val;
+#ifdef CONFIG_BCM47XX
+ char buf[20];
+#endif
val = robo_read16(ROBO_CTRL_PAGE, ROBO_SWITCH_MODE);
if (!(val & (1 << 1))) {
@@ -278,10 +277,13 @@ static int robo_switch_enable(void)
robo_write16(ROBO_CTRL_PAGE, i, 0);
}
+#ifdef CONFIG_BCM47XX
/* WAN port LED, except for Netgear WGT634U */
- if (strcmp(getvar("nvram_type"), "cfe") != 0)
- robo_write16(ROBO_CTRL_PAGE, 0x16, 0x1F);
-
+ if (nvram_getenv("nvram_type", buf, sizeof(buf)) >= 0) {
+ if (strcmp(buf, "cfe") != 0)
+ robo_write16(ROBO_CTRL_PAGE, 0x16, 0x1F);
+ }
+#endif
return 0;
}