+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))) {
+ /* Unmanaged mode */
+ val &= ~(1 << 0);
+ /* With forwarding */
+ val |= (1 << 1);
+ robo_write16(ROBO_CTRL_PAGE, ROBO_SWITCH_MODE, val);
+ val = robo_read16(ROBO_CTRL_PAGE, ROBO_SWITCH_MODE);
+ if (!(val & (1 << 1))) {
+ printk("Failed to enable switch\n");
+ return -EBUSY;
+ }
+
+ last_port = (robo.devid == ROBO_DEVICE_ID_5398) ?
+ ROBO_PORT6_CTRL : ROBO_PORT3_CTRL;
+ for (i = ROBO_PORT0_CTRL; i < last_port + 1; i++)
+ robo_write16(ROBO_CTRL_PAGE, i, 0);
+ }
+
+#ifdef CONFIG_BCM47XX
+ /* WAN port LED, except for Netgear WGT634U */
+ if (nvram_getenv("nvram_type", buf, sizeof(buf)) >= 0) {
+ if (strcmp(buf, "cfe") != 0)
+ robo_write16(ROBO_CTRL_PAGE, 0x16, 0x1F);
+ }
+#endif
+ return 0;
+}