3 Copyright 2005, Broadcom Corporation
6 THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
7 KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
8 SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
9 FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
17 #include <sys/ioctl.h>
18 #include <sys/mount.h>
23 #include <sys/reboot.h>
26 #include <sys/types.h>
28 #include <sys/sysinfo.h>
33 #define SHELL "/bin/sh"
35 extern struct nvram_tuple router_defaults
[];
38 restore_defaults_module(char *prefix
)
40 struct nvram_tuple
*t
;
42 for (t
= router_defaults
; t
->name
; t
++) {
43 if(strncmp(t
->name
, prefix
, sizeof(prefix
))!=0) continue;
44 nvram_set(t
->name
, t
->value
);
49 restore_defaults(void)
51 struct nvram_tuple
*t
;
53 char prefix
[] = "usb_pathXXXXXXXXXXXXXXXXX_", tmp
[100];
57 /* Restore defaults if told to or OS has changed */
59 restore_defaults
= !nvram_match("restore_defaults", "0");
62 fprintf(stderr
, "\n## Restoring defaults... ##\n");
64 /* Restore defaults */
65 for (t
= router_defaults
; t
->name
; t
++) {
66 if (restore_defaults
|| !nvram_get(t
->name
)) {
67 nvram_set(t
->name
, t
->value
);
71 nvram_set("os_name", "linux");
72 nvram_set("os_version", tomato_version
);
73 nvram_set("os_date", tomato_buildtime
);
76 if (!nvram_match("extendno_org", nvram_safe_get("extendno")))
78 dbg("Reset TxBF settings...\n");
79 nvram_set("extendno_org", nvram_safe_get("extendno"));
80 nvram_set("wl0_txbf", "1");
81 nvram_set("wl1_txbf", "1");
82 nvram_set("wl0_itxbf", "0");
83 nvram_set("wl1_itxbf", "1");
90 static int fatalsigs
[] = {
101 static int initsigs
[] = {
111 static char *defenv
[] = {
114 "PATH=/usr/bin:/bin:/usr/sbin:/sbin",
120 /* Set terminal settings to reasonable defaults */
121 static void set_term(int fd
)
127 /* set control chars */
128 tty
.c_cc
[VINTR
] = 3; /* C-c */
129 tty
.c_cc
[VQUIT
] = 28; /* C-\ */
130 tty
.c_cc
[VERASE
] = 127; /* C-? */
131 tty
.c_cc
[VKILL
] = 21; /* C-u */
132 tty
.c_cc
[VEOF
] = 4; /* C-d */
133 tty
.c_cc
[VSTART
] = 17; /* C-q */
134 tty
.c_cc
[VSTOP
] = 19; /* C-s */
135 tty
.c_cc
[VSUSP
] = 26; /* C-z */
137 /* use line dicipline 0 */
140 /* Make it be sane */
141 tty
.c_cflag
&= CBAUD
|CBAUDEX
|CSIZE
|CSTOPB
|PARENB
|PARODD
;
142 tty
.c_cflag
|= CREAD
|HUPCL
|CLOCAL
;
146 tty
.c_iflag
= ICRNL
| IXON
| IXOFF
;
149 tty
.c_oflag
= OPOST
| ONLCR
;
153 ISIG
| ICANON
| ECHO
| ECHOE
| ECHOK
| ECHOCTL
| ECHOKE
| IEXTEN
;
155 tcsetattr(fd
, TCSANOW
, &tty
);
158 static int console_init(void)
163 ioctl(0, TIOCNOTTY
, 0);
170 if ((fd
= open(_PATH_CONSOLE
, O_RDWR
)) < 0) {
171 /* Avoid debug messages is redirected to socket packet if no exist a UART chip, added by honor, 2003-12-04 */
172 open("/dev/null", O_RDONLY
);
173 open("/dev/null", O_WRONLY
);
174 open("/dev/null", O_WRONLY
);
175 perror(_PATH_CONSOLE
);
182 ioctl(0, TIOCSCTTY
, 1);
183 tcsetpgrp(0, getpgrp());
190 * Waits for a file descriptor to change status or unblocked signal
191 * @param fd file descriptor
192 * @param timeout seconds to wait before timing out or 0 for no timeout
193 * @return 1 if descriptor changed status or 0 if timed out or -1 on error
195 static int waitfor(int fd
, int timeout
)
198 struct timeval tv
= { timeout
, 0 };
202 return select(fd
+ 1, &rfds
, NULL
, NULL
, (timeout
> 0) ? &tv
: NULL
);
205 static pid_t
run_shell(int timeout
, int nowait
)
210 /* Wait for user input */
211 if (waitfor(STDIN_FILENO
, timeout
) <= 0) return 0;
213 switch (pid
= fork()) {
218 /* Reset signal handlers set for parent process */
219 for (sig
= 0; sig
< (_NSIG
-1); sig
++)
220 signal(sig
, SIG_DFL
);
224 printf("\n\nTomato %s\n\n", tomato_version
);
226 /* Now run it. The new program will take over this PID,
227 * so nothing further in init.c should be run. */
228 execve(SHELL
, (char *[]) { SHELL
, NULL
}, defenv
);
230 /* We're still here? Some error happened. */
238 waitpid(pid
, NULL
, 0);
244 int console_main(int argc
, char *argv
[])
246 for (;;) run_shell(0, 0);
251 static void shutdn(int rb
)
257 _dprintf("shutdn rb=%d\n", rb
);
260 for (i
= 0; i
< sizeof(fatalsigs
) / sizeof(fatalsigs
[0]); i
++)
261 sigaddset(&ss
, fatalsigs
[i
]);
262 for (i
= 0; i
< sizeof(initsigs
) / sizeof(initsigs
[0]); i
++)
263 sigaddset(&ss
, initsigs
[i
]);
264 sigprocmask(SIG_BLOCK
, &ss
, NULL
);
266 for (i
= 30; i
> 0; --i
) {
267 if (((act
= check_action()) == ACT_IDLE
) || (act
== ACT_REBOOT
)) break;
268 _dprintf("Busy with %d. Waiting before shutdown... %d\n", act
, i
);
271 set_action(ACT_REBOOT
);
273 // Disconnect pppd - need this for PPTP/L2TP to finish gracefully
287 umount("/jffs"); // may hang if not
293 for (i
= 4; i
> 0; --i
) {
304 reboot(rb
? RB_AUTOBOOT
: RB_HALT_SYSTEM
);
311 static void handle_fatalsigs(int sig
)
313 _dprintf("fatal sig=%d\n", sig
);
317 /* Fixed the race condition & incorrect code by using sigwait()
318 * instead of pause(). But SIGCHLD is a problem, since other
319 * code: 1) messes with it and 2) depends on CHLD being caught so
320 * that the pid gets immediately reaped instead of left a zombie.
321 * Pidof still shows the pid, even though it's in zombie state.
322 * So this SIGCHLD handler reaps and then signals the mainline by
325 static void handle_reap(int sig
)
331 static int check_nv(const char *name
, const char *value
)
334 if (!nvram_match("manual_boot_nv", "1")) {
335 if (((p
= nvram_get(name
)) == NULL
) || (strcmp(p
, value
) != 0)) {
336 _dprintf("Error: Critical variable %s is invalid. Resetting.\n", name
);
337 nvram_set(name
, value
);
344 static inline int invalid_mac(const char *mac
)
346 return (!mac
|| !(*mac
) || strncasecmp(mac
, "00:90:4c", 8) == 0);
349 static int find_sercom_mac_addr(void)
352 unsigned char m
[6], s
[18];
354 sprintf(s
, MTD_DEV(%dro
), 0);
355 if ((fp
= fopen(s
, "rb"))) {
356 fseek(fp
, 0x1ffa0, SEEK_SET
);
357 fread(m
, sizeof(m
), 1, fp
);
359 sprintf(s
, "%02X:%02X:%02X:%02X:%02X:%02X",
360 m
[0], m
[1], m
[2], m
[3], m
[4], m
[5]);
361 nvram_set("et0macaddr", s
);
362 return !invalid_mac(s
);
367 static int find_dir320_mac_addr(void)
371 int i
, part
, size
, found
= 0;
373 if (!mtd_getinfo("board_data", &part
, &size
))
375 sprintf(s
, MTD_DEV(%dro
), part
);
377 if ((fp
= fopen(s
, "rb"))) {
378 buffer
= malloc(size
);
379 memset(buffer
, 0, size
);
380 fread(buffer
, size
, 1, fp
);
381 if (!memcmp(buffer
, "RGCFG1", 6)) {
382 for (i
= 6; i
< size
- 24; i
++) {
383 if (!memcmp(buffer
+ i
, "lanmac=", 7)) {
384 memcpy(s
, buffer
+ i
+ 7, 17);
386 nvram_set("et0macaddr", s
);
389 else if (!memcmp(buffer
+ i
, "wanmac=", 7)) {
390 memcpy(s
, buffer
+ i
+ 7, 17);
392 nvram_set("il0macaddr", s
);
395 nvram_set("et0macaddr", s
);
406 strcpy(s
, nvram_safe_get("wl0_hwaddr"));
408 nvram_set("et0macaddr", s
);
413 static int init_vlan_ports(void)
416 int model
= get_model();
420 switch (check_hw_type()) {
421 case HW_BCM5352E
: // G v4, GS v3, v4
422 dirty
|= check_nv("vlan0ports", "3 2 1 0 5*");
427 dirty
|= check_nv("vlan0ports", "0 5*");
428 dirty
|= check_nv("vlan1ports", "1 5");
429 dirty
|= check_nv("vlan_enable", "1");
433 case MODEL_WL500GPv2
:
436 if (nvram_match("vlan1ports", "0 5u")) // 520GU or 330GE or WL500GE?
437 dirty
|= check_nv("vlan1ports", "0 5");
438 else if (nvram_match("vlan1ports", "4 5u"))
439 dirty
|= check_nv("vlan1ports", "4 5");
442 dirty
|= check_nv("vlan0ports", "1 2 3 4 5*");
443 dirty
|= check_nv("vlan1ports", "0 5");
447 dirty
|= (nvram_get("vlan2ports") != NULL
);
448 nvram_unset("vlan2ports");
449 dirty
|= check_nv("vlan0ports", "1 2 3 4 5*");
450 dirty
|= check_nv("vlan1ports", "0 5");
452 case MODEL_WRT310Nv1
:
453 dirty
|= check_nv("vlan1ports", "1 2 3 4 8*");
454 dirty
|= check_nv("vlan2ports", "0 8");
457 dirty
|= check_nv("vlan0ports", "0 1 2 3 5*");
458 dirty
|= check_nv("vlan1ports", "4 5");
463 case MODEL_WNR3500LV2
:
466 dirty
|= check_nv("vlan1ports", "4 3 2 1 8*");
467 dirty
|= check_nv("vlan2ports", "0 8");
470 dirty
|= check_nv("vlan1ports", "1 2 3 4 8*");
471 dirty
|= check_nv("vlan2ports", "0 8");
472 dirty
|= check_nv("boot_wait", "on");
473 dirty
|= check_nv("wait_time", "5");
476 dirty
|= check_nv("vlan1ports", "1 2 3 4 8*");
477 dirty
|= check_nv("vlan2ports", "0 8");
478 dirty
|= check_nv("ledbh0", "11");
479 dirty
|= check_nv("ledbh1", "11");
480 dirty
|= check_nv("ledbh2", "11");
481 dirty
|= check_nv("ledbh11", "136");
482 // must flash tt through tftp.
483 dirty
|= check_nv("boot_wait", "on");
484 dirty
|= check_nv("wait_time", "5");
487 dirty
|= check_nv("vlan2ports", "0 1 2 3 5*");
488 dirty
|= check_nv("vlan1ports", "4 5");
491 dirty
|= check_nv("vlan1ports", "4 5");
492 dirty
|= check_nv("vlan2ports", "3 2 1 0 5*");
494 case MODEL_WNR2000v2
:
495 dirty
|= check_nv("vlan1ports", "4 3 2 1 5*");
496 dirty
|= check_nv("vlan2ports", "0 5");
500 dirty
|= check_nv("vlan1ports", "1 2 3 4 5*");
501 dirty
|= check_nv("vlan2ports", "0 5");
503 case MODEL_RG200E_CA
:
504 dirty
|= check_nv("vlan2ports", "0 5");
507 dirty
|= check_nv("vlan1ports", "4 5");
511 dirty
|= check_nv("vlan0ports", "1 2 3 4 5*");
512 dirty
|= check_nv("vlan1ports", "0 5");
517 dirty
|= check_nv("vlan0ports", "3 2 1 0 5*");
518 dirty
|= check_nv("vlan1ports", "4 5");
520 case MODEL_WRT610Nv2
:
521 case MODEL_F5D8235v3
:
522 dirty
|= check_nv("vlan1ports", "1 2 3 4 8*");
523 dirty
|= check_nv("vlan2ports", "0 8");
527 dirty
|= check_nv("vlan1ports", "3 2 1 0 8*");
528 dirty
|= check_nv("vlan2ports", "4 8");
537 dirty
|= check_nv("vlan1ports", "0 1 2 3 5*");
538 dirty
|= check_nv("vlan2ports", "4 5");
542 dirty
|= check_nv("vlan1ports", "1 2 3 4 5*");
543 dirty
|= check_nv("vlan2ports", "0 5");
548 dirty
|= check_nv("vlan1ports", "0 1 2 3 8*");
549 dirty
|= check_nv("vlan2ports", "4 8");
552 dirty
|= check_nv("vlan1ports", "4 3 2 1 8*");
553 dirty
|= check_nv("vlan2ports", "4 8");
554 dirty
|= check_nv("boot_wait", "on");
555 dirty
|= check_nv("wait_time", "5");
557 case MODEL_TDN6
: //bwq518
558 dirty
|= check_nv("vlan1ports", "1 2 3 4 5*");
559 dirty
|= check_nv("vlan2ports", "0 5");
560 dirty
|= check_nv("boot_wait", "on");
561 dirty
|= check_nv("wait_time", "5");
563 case MODEL_WRT160Nv3
:
564 if (nvram_match("vlan1ports", "1 2 3 4 5*")) {
565 // fix lan port numbering on CSE41, CSE51
566 dirty
|= check_nv("vlan1ports", "4 3 2 1 5*");
568 else if (nvram_match("vlan1ports", "1 2 3 4 8*")) {
570 dirty
|= check_nv("vlan1ports", "4 3 2 1 8*");
574 #ifdef CONFIG_BCMWL6A
577 dirty
|= check_nv("vlan1ports", "3 2 1 0 5*");
578 dirty
|= check_nv("vlan2ports", "4 5");
582 dirty
|= check_nv("vlan1ports", "0 1 2 3 5*");
583 dirty
|= check_nv("vlan2ports", "4 5");
589 dirty
|= check_nv("vlan1ports", "1 2 3 4 5*");
590 dirty
|= check_nv("vlan2ports", "0 5");
599 static void check_bootnv(void)
607 dirty
= check_nv("wl0_leddc", "0x640000") | check_nv("wl1_leddc", "0x640000");
611 dirty
|= check_nv("vlan0hwname", "et0");
612 dirty
|= check_nv("vlan1hwname", "et0");
615 dirty
|= check_nv("wl0gpio0", "130");
619 // need to cleanup some variables...
620 if ((nvram_get("t_model") == NULL
) && (nvram_get("MyFirmwareVersion") != NULL
)) {
621 nvram_unset("MyFirmwareVersion");
622 nvram_set("restore_defaults", "1");
626 dirty
|= check_nv("wl0gpio1", "0x02");
629 /* fix WL500W mac adresses for WAN port */
630 if (invalid_mac(nvram_get("et1macaddr"))) {
631 strcpy(mac
, nvram_safe_get("et0macaddr"));
633 dirty
|= check_nv("et1macaddr", mac
);
635 dirty
|= check_nv("wl0gpio0", "0x88");
638 dirty
|= check_nv("sdram_init", "0x0009"); // 32MB; defaults: 0x000b, 0x0009
639 dirty
|= check_nv("wl0gpio0", "136");
641 case MODEL_WL500GPv2
:
643 dirty
|= check_nv("wl0gpio1", "136");
646 dirty
|= check_nv("vlan0hwname", "et0");
647 dirty
|= check_nv("vlan1hwname", "et0");
648 dirty
|= check_nv("boardflags", "0x00000100"); // set BFL_ENETVLAN
649 nvram_unset("wl0gpio0");
652 if (strlen(nvram_safe_get("et0macaddr")) == 12 ||
653 strlen(nvram_safe_get("il0macaddr")) == 12) {
654 dirty
|= find_dir320_mac_addr();
656 if (nvram_get("vlan2hwname") != NULL
) {
657 nvram_unset("vlan2hwname");
660 dirty
|= check_nv("wandevs", "vlan1");
661 dirty
|= check_nv("vlan1hwname", "et0");
662 dirty
|= check_nv("wl0gpio0", "8");
663 dirty
|= check_nv("wl0gpio1", "0");
664 dirty
|= check_nv("wl0gpio2", "0");
665 dirty
|= check_nv("wl0gpio3", "0");
668 dirty
|= check_nv("wandevs", "vlan1");
669 dirty
|= check_nv("vlan0hwname", "et0");
670 dirty
|= check_nv("vlan1hwname", "et0");
673 if (invalid_mac(nvram_get("et0macaddr"))) {
674 dirty
|= find_sercom_mac_addr();
677 case MODEL_WRT160Nv1
:
678 case MODEL_WRT310Nv1
:
680 dirty
|= check_nv("wl0gpio0", "8");
684 dirty
|= check_nv("boardflags", "0x00000710"); // needed to enable USB
685 dirty
|= check_nv("vlan2hwname", "et0");
686 dirty
|= check_nv("ledbh0", "7");
688 case MODEL_WNR3500LV2
:
689 dirty
|= check_nv("vlan2hwname", "et0");
691 case MODEL_WNR2000v2
:
692 dirty
|= check_nv("ledbh5", "8");
695 dirty
|= check_nv("reset_gpio", "5");
696 dirty
|= check_nv("ledbh0", "136");
697 dirty
|= check_nv("ledbh1", "11");
698 /* fall through, same as RT-N16 */
700 dirty
|= check_nv("vlan2hwname", "et0");
703 case MODEL_RG200E_CA
:
705 dirty
|= check_nv("vlan1hwname", "et0");
706 dirty
|= check_nv("vlan2hwname", "et0");
707 dirty
|= check_nv("boardflags", "0x710"); // set BFL_ENETVLAN, enable VLAN
708 dirty
|= check_nv("reset_gpio", "30");
710 case MODEL_WRT610Nv2
:
711 dirty
|= check_nv("vlan2hwname", "et0");
712 dirty
|= check_nv("pci/1/1/ledbh2", "8");
713 dirty
|= check_nv("sb/1/ledbh1", "8");
714 if (invalid_mac(nvram_get("pci/1/1/macaddr"))) {
715 strcpy(mac
, nvram_safe_get("et0macaddr"));
717 dirty
|= check_nv("pci/1/1/macaddr", mac
);
724 case MODEL_F5D8235v3
:
725 if (nvram_match("sb/1/macaddr", nvram_safe_get("et0macaddr"))) {
726 strcpy(mac
, nvram_safe_get("et0macaddr"));
728 dirty
|= check_nv("sb/1/macaddr", mac
);
730 dirty
|= check_nv("pci/1/1/macaddr", mac
);
733 dirty
|= check_nv("vlan2hwname", "et0");
734 if (strncasecmp(nvram_safe_get("pci/2/1/macaddr"), "00:90:4c", 8) == 0) {
735 strcpy(mac
, nvram_safe_get("et0macaddr"));
737 dirty
|= check_nv("pci/2/1/macaddr", mac
);
741 dirty
|= check_nv("vlan2hwname", "et0");
742 if (strncasecmp(nvram_safe_get("pci/1/1/macaddr"), "00:90:4c", 8) == 0 ||
743 strncasecmp(nvram_safe_get("sb/1/macaddr"), "00:90:4c", 8) == 0) {
744 strcpy(mac
, nvram_safe_get("et0macaddr"));
746 dirty
|= check_nv("sb/1/macaddr", mac
);
748 dirty
|= check_nv("pci/1/1/macaddr", mac
);
757 case MODEL_WRT160Nv3
:
760 dirty
|= check_nv("vlan2hwname", "et0");
765 if (strncmp(nvram_safe_get("pmon_ver"), "CFE", 3) != 0) return;
767 hardware
= check_hw_type();
768 if (!nvram_get("boardtype") ||
769 !nvram_get("boardnum") ||
770 !nvram_get("boardflags") ||
771 !nvram_get("clkfreq") ||
772 !nvram_get("os_flash_addr") ||
773 !nvram_get("dl_ram_addr") ||
774 !nvram_get("os_ram_addr") ||
775 !nvram_get("scratch") ||
776 !nvram_get("et0macaddr") ||
777 ((hardware
!= HW_BCM4704_BCM5325F
) && (!nvram_get("vlan0ports") || !nvram_get("vlan0hwname")))) {
778 _dprintf("Unable to find critical settings, erasing NVRAM\n");
783 dirty
|= check_nv("aa0", "3");
784 dirty
|= check_nv("wl0gpio0", "136");
785 dirty
|= check_nv("wl0gpio2", "0");
786 dirty
|= check_nv("wl0gpio3", "0");
787 dirty
|= check_nv("cctl", "0");
788 dirty
|= check_nv("ccode", "0");
792 /* Lower the DDR ram drive strength , the value will be stable for all boards
793 Latency 3 is more stable for all ddr 20050420 by honor */
794 dirty
|= check_nv("sdram_init", "0x010b");
795 dirty
|= check_nv("sdram_config", "0x0062");
796 if (!nvram_match("debug_clkfix", "0")) {
797 dirty
|= check_nv("clkfreq", "216");
800 nvram_set("sdram_ncdl", "0x0");
802 dirty
|= check_nv("pa0itssit", "62");
803 dirty
|= check_nv("pa0b0", "0x15eb");
804 dirty
|= check_nv("pa0b1", "0xfa82");
805 dirty
|= check_nv("pa0b2", "0xfe66");
806 //dirty |= check_nv("pa0maxpwr", "0x4e");
808 case HW_BCM5352E
: // G v4, GS v3, v4
809 dirty
|= check_nv("sdram_init", "0x010b");
810 dirty
|= check_nv("sdram_config", "0x0062");
812 nvram_set("sdram_ncdl", "0x0");
814 dirty
|= check_nv("pa0itssit", "62");
815 dirty
|= check_nv("pa0b0", "0x168b");
816 dirty
|= check_nv("pa0b1", "0xfabf");
817 dirty
|= check_nv("pa0b2", "0xfeaf");
818 //dirty |= check_nv("pa0maxpwr", "0x4e");
821 dirty
|= check_nv("pa0itssit", "62");
822 dirty
|= check_nv("pa0b0", "0x1326");
823 dirty
|= check_nv("pa0b1", "0xFB51");
824 dirty
|= check_nv("pa0b2", "0xFE87");
825 //dirty |= check_nv("pa0maxpwr", "0x4e");
827 case HW_BCM4704_BCM5325F
:
831 dirty
|= check_nv("pa0itssit", "62");
832 dirty
|= check_nv("pa0b0", "0x170c");
833 dirty
|= check_nv("pa0b1", "0xfa24");
834 dirty
|= check_nv("pa0b2", "0xfe70");
835 //dirty |= check_nv("pa0maxpwr", "0x48");
842 dirty
|= init_vlan_ports();
846 REBOOT
: // do a simple reboot
853 static int init_nvram(void)
855 unsigned long features
;
865 sprintf(s
, "%d", model
);
866 nvram_set("t_model", s
);
875 name
= "WRT54G/GS/GL";
876 switch (check_hw_type()) {
878 nvram_set("gpio2", "adm_eecs");
879 nvram_set("gpio3", "adm_eesk");
880 nvram_unset("gpio4");
881 nvram_set("gpio5", "adm_eedi");
882 nvram_set("gpio6", "adm_rc");
885 nvram_unset("gpio2");
886 nvram_unset("gpio3");
887 nvram_unset("gpio4");
888 nvram_unset("gpio5");
889 nvram_unset("gpio6");
892 nvram_set("opo", "0x0008");
893 nvram_set("ag0", "0x02");
896 nvram_set("gpio2", "ses_led");
897 nvram_set("gpio3", "ses_led2");
898 nvram_set("gpio4", "ses_button");
899 features
= SUP_SES
| SUP_WHAM_LED
;
906 if (!nvram_match("t_fix1", (char *)name
)) {
907 nvram_set("lan_ifnames", "vlan0 eth1");
908 nvram_set("gpio2", "ses_button");
909 nvram_set("reset_gpio", "7");
911 nvram_set("pa0itssit", "62");
912 nvram_set("pa0b0", "0x1542");
913 nvram_set("pa0b1", "0xfacb");
914 nvram_set("pa0b2", "0xfec7");
915 //nvram_set("pa0maxpwr", "0x4c");
918 case MODEL_WRTSL54GS
:
921 features
= SUP_SES
| SUP_WHAM_LED
;
926 features
= SUP_SES
| SUP_AOSS_LED
| SUP_BRAU
;
929 case MODEL_WZRRSG54HP
:
932 features
= SUP_SES
| SUP_AOSS_LED
| SUP_HPAMP
;
934 case MODEL_WZRRSG54HP
:
935 name
= "WZR-RS-G54HP";
942 features
= SUP_SES
| SUP_AOSS_LED
| SUP_BRAU
| SUP_HPAMP
;
946 bf
= strtoul(nvram_safe_get("boardflags"), NULL
, 0);
952 if ( nvram_is_empty("wlx_hpamp") || nvram_match("wlx_hpamp", "")) {
953 if (nvram_get_int("wl_txpwr") > 10) nvram_set("wl_txpwr", "10");
954 nvram_set("wlx_hpamp", "1");
955 nvram_set("wlx_hperx", "0");
959 if (nvram_match("wlx_hpamp", "0")) {
965 if (nvram_match("wlx_hperx", "0")) {
972 sprintf(s
, "0x%lX", n
);
973 nvram_set("boardflags", s
);
977 syslog(LOG_WARNING
, "Unexpected: boardflag=%lX", bf
);
988 features
= SUP_SES
| SUP_AOSS_LED
;
990 case MODEL_WHR2A54G54
:
992 name
= "WHR2-A54G54";
993 features
= SUP_SES
| SUP_AOSS_LED
| SUP_BRAU
;
998 features
= SUP_SES
| SUP_AOSS_LED
;
1003 features
= SUP_SES
| SUP_AOSS_LED
;
1005 case MODEL_WZRRSG54
:
1007 name
= "WZR-RS-G54";
1008 features
= SUP_SES
| SUP_AOSS_LED
;
1010 case MODEL_WVRG54NF
:
1012 name
= "WVR-G54-NF";
1018 features
= SUP_SES
| SUP_AOSS_LED
;
1024 case MODEL_WR850GV1
:
1027 features
= SUP_NONVE
;
1029 case MODEL_WR850GV2
:
1031 name
= "WR850G v2/v3";
1032 features
= SUP_NONVE
;
1039 nvram_set("usb_ohci", "-1");
1041 if (!nvram_match("t_fix1", (char *)name
)) {
1042 nvram_set("lan_ifnames", "vlan0 eth1 eth2 eth3"); // set to "vlan0 eth2" by DD-WRT; default: vlan0 eth1
1048 features
= SUP_SES
| SUP_80211N
;
1050 nvram_set("usb_ohci", "-1");
1058 nvram_set("usb_uhci", "-1");
1061 case MODEL_WX6615GT
:
1074 case MODEL_WLA2G54L
:
1077 if (!nvram_match("t_fix1", (char *)name
)) {
1078 nvram_set("lan_ifnames", "vlan0 eth1 eth2");
1079 nvram_set("wl_ifname", "eth1");
1080 nvram_set("wan_ifname", "none");
1085 name
= "TrueMobile 2300";
1094 #ifndef WL_BSS_INFO_VERSION
1095 #error WL_BSS_INFO_VERSION
1097 #if WL_BSS_INFO_VERSION >= 108
1103 nvram_set("opo", "12");
1109 features
= SUP_SES
| SUP_AOSS_LED
| SUP_BRAU
;
1111 nvram_set("opo", "0x0008");
1112 nvram_set("ag0", "0x0C");
1114 #ifdef CONFIG_BCMWL5
1118 features
= SUP_SES
| SUP_80211N
;
1119 if (!nvram_match("t_fix1", (char *)name
)) {
1120 #ifdef TCONFIG_USBAP
1121 nvram_set("wl1_hwaddr", nvram_safe_get("0:macaddr"));
1122 nvram_set("ehciirqt", "3");
1123 nvram_set("qtdc_pid", "48407");
1124 nvram_set("qtdc_vid", "2652");
1125 nvram_set("qtdc0_ep", "4");
1126 nvram_set("qtdc0_sz", "0");
1127 nvram_set("qtdc1_ep", "18");
1128 nvram_set("qtdc1_sz", "10");
1129 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
1130 nvram_set("landevs", "vlan1 wl0 wl1");
1131 nvram_set("wl0_ifname", "wl0");
1132 nvram_set("wl1_ifname", "wl1");
1134 nvram_set("lan_ifnames", "vlan1 eth1");
1135 nvram_set("landevs", "vlan1 wl0");
1137 nvram_set("wl_ifname", "eth1");
1138 nvram_set("wan_ifnameX", "vlan2");
1139 nvram_set("wandevs", "vlan2");
1142 case MODEL_DIR620C1
:
1144 name
= "Dir-620 C1";
1145 features
= SUP_SES
| SUP_80211N
;
1146 if (!nvram_match("t_fix1", (char *)name
)) {
1147 #ifdef TCONFIG_USBAP
1148 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
1149 nvram_set("landevs", "vlan1 wl0 wl1");
1150 nvram_set("wl0_ifname", "eth1");
1151 nvram_set("wl1_ifname", "eth2");
1153 nvram_set("lan_ifnames", "vlan1 eth1");
1154 nvram_set("landevs", "vlan1 wl0");
1156 nvram_set("wan_ifnameX", "vlan2");
1157 nvram_set("wl_ifname", "eth1");
1164 features
= SUP_SES
| SUP_80211N
;
1166 nvram_set("usb_uhci", "-1");
1168 if (!nvram_match("t_fix1", (char *)name
)) {
1169 nvram_set("lan_ifnames", "vlan1 eth1");
1170 nvram_set("wan_ifname", "vlan2");
1171 nvram_set("wan_ifnames", "vlan2");
1172 nvram_set("wan_ifnameX", "vlan2");
1173 nvram_set("wl_ifname", "eth1");
1179 features
= SUP_SES
| SUP_80211N
;
1181 nvram_set("usb_uhci", "-1");
1183 if (!nvram_match("t_fix1", (char *)name
)) {
1184 nvram_set("lan_ifnames", "vlan1 eth1");
1185 nvram_set("wan_ifname", "vlan2");
1186 nvram_set("wan_ifnames", "vlan2");
1187 nvram_set("wan_ifnameX", "vlan2");
1188 nvram_set("wl_ifname", "eth1");
1191 case MODEL_RG200E_CA
:
1194 features
= SUP_SES
| SUP_80211N
;
1196 nvram_set("usb_uhci", "-1");
1198 if (!nvram_match("t_fix1", (char *)name
)) {
1199 nvram_set("lan_ifnames", "vlan1 eth1");
1200 nvram_set("wan_ifname", "vlan2");
1201 nvram_set("wan_ifnames", "vlan2");
1202 nvram_set("wan_ifnameX", "vlan2");
1203 nvram_set("wl_ifname", "eth1");
1209 features
= SUP_SES
| SUP_80211N
;
1211 nvram_set("usb_uhci", "-1");
1213 if (!nvram_match("t_fix1", (char *)name
)) {
1214 nvram_set("lan_ifnames", "vlan1 eth1");
1215 nvram_set("wan_ifname", "vlan2");
1216 nvram_set("wan_ifnames", "vlan2");
1217 nvram_set("wan_ifnameX", "vlan2");
1218 nvram_set("wl_ifname", "eth1");
1224 features
= SUP_SES
| SUP_80211N
;
1226 nvram_set("usb_uhci", "-1");
1228 if (!nvram_match("t_fix1", (char *)name
)) {
1229 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
1230 nvram_set("wan_ifnameX", "vlan2");
1231 nvram_set("wan_ifnames", "vlan2");
1232 nvram_set("wan_ifnameX", "vlan2");
1233 nvram_set("wl_ifnames", "eth1 eth2");
1234 nvram_set("wl_ifname", "eth1");
1235 nvram_set("wl0_ifname", "eth1");
1236 nvram_set("wl1_ifname", "eth2");
1237 nvram_set("wl0_bw_cap","3");
1238 nvram_set("wl0_chanspec","1l");
1239 nvram_set("wl1_bw_cap","7");
1240 nvram_set("wl1_chanspec","36/80");
1241 nvram_set("blink_5g_interface","eth2");
1242 //nvram_set("landevs", "vlan1 wl0 wl1");
1243 //nvram_set("wandevs", "vlan2");
1246 nvram_set("wl0_hwaddr", nvram_safe_get("sb/1/macaddr"));
1247 nvram_set("wl1_hwaddr", nvram_safe_get("0:macaddr"));
1253 features
= SUP_SES
| SUP_80211N
;
1255 nvram_set("usb_uhci", "-1");
1257 if (!nvram_match("t_fix1", (char *)name
)) {
1258 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
1259 nvram_set("wan_ifnameX", "vlan2");
1260 nvram_set("wan_ifnames", "vlan2");
1261 nvram_set("wan_ifnameX", "vlan2");
1262 nvram_set("wl_ifnames", "eth1 eth2");
1263 nvram_set("wl_ifname", "eth1");
1264 nvram_set("wl0_ifname", "eth1");
1265 nvram_set("wl1_ifname", "eth2");
1266 nvram_set("wl0_bw_cap","3");
1267 nvram_set("wl0_chanspec","1l");
1268 nvram_set("wl1_bw_cap","7");
1269 nvram_set("wl1_chanspec","36/80");
1270 nvram_set("blink_5g_interface","eth2");
1273 nvram_set("wl0_hwaddr", nvram_safe_get("sb/1/macaddr"));
1274 nvram_set("wl1_hwaddr", nvram_safe_get("0:macaddr"));
1280 name
= nvram_match("boardrev", "0x1153") ? "RT-N10P" : "RT-N10";
1281 features
= SUP_SES
| SUP_80211N
;
1282 if (!nvram_match("t_fix1", (char *)name
)) {
1283 nvram_set("lan_ifnames", "vlan0 eth1");
1284 nvram_set("wan_ifnameX", "vlan1");
1285 nvram_set("wl_ifname", "eth1");
1291 features
= SUP_SES
| SUP_80211N
;
1293 nvram_set("usb_uhci", "-1");
1295 if (!nvram_match("t_fix1", (char *)name
)) {
1296 nvram_set("lan_ifnames", "vlan0 eth1");
1297 nvram_set("wan_ifnameX", "vlan1");
1298 nvram_set("wl_ifname", "eth1");
1304 features
= SUP_SES
| SUP_BRAU
| SUP_80211N
;
1305 if (!nvram_match("t_fix1", (char *)name
)) {
1306 nvram_set("lan_ifnames", "vlan0 eth1");
1307 nvram_set("wan_ifnameX", "vlan1");
1308 nvram_set("wl_ifname", "eth1");
1314 features
= SUP_80211N
;
1315 if (!nvram_match("t_fix1", (char *)name
)) {
1316 nvram_set("lan_ifnames", "vlan0 eth1");
1317 nvram_set("wan_ifnameX", "vlan1");
1318 nvram_set("wl_ifname", "eth1");
1324 features
= SUP_SES
| SUP_80211N
| SUP_1000ET
;
1326 nvram_set("usb_uhci", "-1");
1328 if (!nvram_match("t_fix1", (char *)name
)) {
1329 nvram_set("lan_ifnames", "vlan1 eth1");
1330 nvram_set("wan_iface", "vlan2");
1331 nvram_set("wan_ifname", "vlan2");
1332 nvram_set("wan_ifnameX", "vlan2");
1333 nvram_set("wan_ifnames", "vlan2");
1334 nvram_set("wl_ifname", "eth1");
1340 features
= SUP_SES
| SUP_80211N
| SUP_1000ET
;
1342 nvram_set("usb_uhci", "-1");
1344 if (!nvram_match("t_fix1", (char *)name
)) {
1345 nvram_set("lan_ifnames", "vlan1 eth1");
1346 nvram_set("wan_ifnameX", "vlan2");
1347 nvram_set("wl_ifname", "eth1");
1348 nvram_set("vlan_enable", "1");
1354 name
= nvram_match("boardrev", "0x1446") ? "RT-N53 A1" : "RT-N53";
1355 features
= SUP_SES
| SUP_80211N
;
1356 #if defined(LINUX26) && defined(TCONFIG_USBAP)
1357 if (nvram_get_int("usb_storage") == 1) nvram_set("usb_storage", "-1");
1359 if (!nvram_match("t_fix1", (char *)name
)) {
1360 #ifdef TCONFIG_USBAP
1361 nvram_set("wl1_hwaddr", nvram_safe_get("0:macaddr"));
1362 nvram_set("ehciirqt", "3");
1363 nvram_set("qtdc_pid", "48407");
1364 nvram_set("qtdc_vid", "2652");
1365 nvram_set("qtdc0_ep", "4");
1366 nvram_set("qtdc0_sz", "0");
1367 nvram_set("qtdc1_ep", "18");
1368 nvram_set("qtdc1_sz", "10");
1369 nvram_set("lan_ifnames", "vlan2 eth1 eth2");
1370 nvram_set("landevs", "vlan2 wl0 wl1");
1371 nvram_set("wl1_ifname", "eth2");
1373 nvram_set("lan_ifnames", "vlan2 eth1");
1374 nvram_set("landevs", "vlan2 wl0");
1376 nvram_set("lan_ifname", "br0");
1377 nvram_set("wl_ifname", "eth1");
1378 nvram_set("wl0_ifname", "eth1");
1379 nvram_set("wan_ifnameX", "vlan1");
1380 nvram_set("wandevs", "vlan1");
1381 nvram_unset("vlan0ports");
1384 #ifdef CONFIG_BCMWL6A
1388 features
= SUP_SES
| SUP_80211N
| SUP_1000ET
;
1390 nvram_set("usb_uhci", "-1");
1392 if (!nvram_match("t_fix1", (char *)name
)) {
1393 nvram_set("vlan1hwname", "et0");
1394 nvram_set("vlan2hwname", "et0");
1395 nvram_set("lan_ifname", "br0");
1396 nvram_set("landevs", "vlan1 wl0");
1397 nvram_set("lan_ifnames", "vlan1 eth1");
1398 nvram_set("wan_ifnames", "vlan2");
1399 nvram_set("wan_ifnameX", "vlan2");
1400 nvram_set("wandevs", "vlan2");
1401 nvram_set("wl_ifnames", "eth1");
1402 nvram_set("wl_ifname", "eth1");
1403 nvram_set("wl0_ifname", "eth1");
1406 nvram_set("wl0_hwaddr", nvram_safe_get("0:macaddr"));
1409 nvram_set("usb_usb3", "1");
1410 nvram_set("xhci_ports", "1-1");
1411 nvram_set("ehci_ports", "2-1 2-2");
1412 nvram_set("ohci_ports", "3-1 3-2");
1418 features
= SUP_SES
| SUP_80211N
| SUP_1000ET
| SUP_80211AC
;
1420 nvram_set("usb_uhci", "-1");
1422 if (!nvram_match("t_fix1", (char *)name
)) {
1423 nvram_set("vlan1hwname", "et0");
1424 nvram_set("vlan2hwname", "et0");
1425 nvram_set("lan_ifname", "br0");
1426 nvram_set("landevs", "vlan1 wl0 wl1");
1427 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
1428 nvram_set("wan_ifnames", "vlan2");
1429 nvram_set("wan_ifnameX", "vlan2");
1430 nvram_set("wandevs", "vlan2");
1431 nvram_set("wl_ifnames", "eth1 eth2");
1432 nvram_set("wl_ifname", "eth1");
1433 nvram_set("wl0_ifname", "eth1");
1434 nvram_set("wl1_ifname", "eth2");
1437 nvram_set("wl0_hwaddr", nvram_safe_get("0:macaddr"));
1438 nvram_set("wl1_hwaddr", nvram_safe_get("1:macaddr"));
1441 nvram_set("usb_usb3", "1");
1442 nvram_set("xhci_ports", "1-1");
1443 nvram_set("ehci_ports", "2-1 2-2");
1444 nvram_set("ohci_ports", "3-1 3-2");
1446 // force wl1 settings
1447 nvram_set("wl1_bw", "3");
1448 nvram_set("wl1_bw_cap", "7");
1449 nvram_set("wl1_chanspec", "149/80");
1450 nvram_set("wl1_nctrlsb", "lower");
1451 nvram_set("0:ccode", "SG");
1452 nvram_set("1:ccode", "SG");
1453 nvram_set("wl_country", "SG");
1454 nvram_set("wl_country_code", "SG");
1459 name
= "RT-AC68R/U";
1460 features
= SUP_SES
| SUP_80211N
| SUP_1000ET
| SUP_80211AC
;
1462 nvram_set("usb_uhci", "-1");
1464 if (!nvram_match("t_fix1", (char *)name
)) {
1465 nvram_set("vlan1hwname", "et0");
1466 nvram_set("vlan2hwname", "et0");
1467 nvram_set("lan_ifname", "br0");
1468 nvram_set("landevs", "vlan1 wl0 wl1");
1469 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
1470 nvram_set("wan_ifnames", "vlan2");
1471 nvram_set("wan_ifnameX", "vlan2");
1472 nvram_set("wandevs", "vlan2");
1473 nvram_set("wl_ifnames", "eth1 eth2");
1474 nvram_set("wl_ifname", "eth1");
1475 nvram_set("wl0_ifname", "eth1");
1476 nvram_set("wl1_ifname", "eth2");
1479 nvram_set("wl0_hwaddr", nvram_safe_get("0:macaddr"));
1480 nvram_set("wl1_hwaddr", nvram_safe_get("1:macaddr"));
1483 nvram_set("usb_usb3", "1");
1484 nvram_set("xhci_ports", "1-1");
1485 nvram_set("ehci_ports", "2-1 2-2");
1486 nvram_set("ohci_ports", "3-1 3-2");
1488 // force wl1 settings
1489 nvram_set("wl1_bw", "3");
1490 nvram_set("wl1_bw_cap", "7");
1491 nvram_set("wl1_chanspec", "149/80");
1492 nvram_set("wl1_nctrlsb", "lower");
1493 nvram_set("0:ccode", "SG");
1494 nvram_set("1:ccode", "SG");
1495 nvram_set("wl_country", "SG");
1496 nvram_set("wl_country_code", "SG");
1503 if(nvram_match("board_id", "U12H245T00_NETGEAR")) //R6250
1506 name
= model
== MODEL_R7000
? "R7000" : "R6300v2"; //R7000 or R6300v2
1508 features
= SUP_SES
| SUP_80211N
| SUP_1000ET
| SUP_80211AC
;
1510 nvram_set("usb_uhci", "-1");
1512 if (!nvram_match("t_fix1", (char *)name
)) {
1513 nvram_set("vlan1hwname", "et0");
1514 nvram_set("vlan2hwname", "et0");
1515 nvram_set("lan_ifname", "br0");
1516 nvram_set("landevs", "vlan1 wl0 wl1");
1517 nvram_set("lan_ifnames", "vlan1 eth2 eth3");
1518 nvram_set("wan_ifnames", "vlan2");
1519 nvram_set("wan_ifnameX", "vlan2");
1520 nvram_set("wandevs", "vlan2");
1521 nvram_set("wl_ifnames", "eth2 eth3");
1522 nvram_set("wl_ifname", "eth2");
1523 nvram_set("wl0_ifname", "eth2");
1524 nvram_set("wl1_ifname", "eth3");
1527 nvram_set("pci/1/1/macaddr", nvram_safe_get("et0macaddr"));
1528 nvram_set("pci/2/1/macaddr", nvram_safe_get("et1macaddr"));
1531 nvram_set("usb_usb3", "1");
1532 nvram_set("xhci_ports", "1-1");
1533 nvram_set("ehci_ports", "2-1 2-2");
1534 nvram_set("ohci_ports", "3-1 3-2");
1536 // force wl1 settings
1537 nvram_set("wl1_bw", "3");
1538 nvram_set("wl1_bw_cap", "7");
1539 nvram_set("wl1_chanspec", "149/80");
1540 nvram_set("wl1_nctrlsb", "lower");
1541 nvram_set("wl_country", "SG");
1542 nvram_set("wl_country_code", "SG");
1543 nvram_set("blink_wl", "1");
1545 // bcm4360ac_defaults - fix problem of loading driver failed with code 21
1546 nvram_set("pci/1/1/aa2g", "7");
1547 nvram_set("pci/1/1/agbg0", "71");
1548 nvram_set("pci/1/1/agbg1", "71");
1549 nvram_set("pci/1/1/agbg2", "71");
1550 nvram_set("pci/1/1/antswitch", "0");
1551 nvram_set("pci/1/1/boardflags", "0x1000");
1552 nvram_set("pci/1/1/boardflags2", "0x100002");
1553 nvram_set("pci/1/1/boardflags3", "0x10000003");
1554 nvram_set("pci/1/1/boardnum", "57359");
1555 nvram_set("pci/1/1/boardrev", "0x1150");
1556 nvram_set("pci/1/1/boardtype", "0x661");
1557 nvram_set("pci/1/1/cckbw202gpo", "0");
1558 nvram_set("pci/1/1/cckbw20ul2gpo", "0");
1559 nvram_set("pci/1/1/ccode", "EU");
1560 nvram_set("pci/1/1/devid", "0x43a1");
1561 nvram_set("pci/1/1/dot11agduphrpo", "0");
1562 nvram_set("pci/1/1/dot11agduplrpo", "0");
1563 nvram_set("pci/1/1/dot11agofdmhrbw202gpo", "0xCA86");
1564 nvram_set("pci/1/1/epagain2g", "0");
1565 nvram_set("pci/1/1/femctrl", "3");
1566 nvram_set("pci/1/1/gainctrlsph", "0");
1567 // nvram_set("pci/1/1/macaddr", "E4:F4:C6:01:47:7C");
1568 nvram_set("pci/1/1/maxp2ga0", "106");
1569 nvram_set("pci/1/1/maxp2ga1", "106");
1570 nvram_set("pci/1/1/maxp2ga2", "106");
1571 nvram_set("pci/1/1/mcsbw202gpo", "0xA976A600");
1572 nvram_set("pci/1/1/mcsbw402gpo", "0xA976A600");
1573 nvram_set("pci/1/1/measpower", "0x7f");
1574 nvram_set("pci/1/1/measpower1", "0x7f");
1575 nvram_set("pci/1/1/measpower2", "0x7f");
1576 nvram_set("pci/1/1/noiselvl2ga0", "31");
1577 nvram_set("pci/1/1/noiselvl2ga1", "31");
1578 nvram_set("pci/1/1/noiselvl2ga2", "31");
1579 nvram_set("pci/1/1/ofdmlrbw202gpo", "0");
1580 nvram_set("pci/1/1/pa2ga0", "0xFF32,0x1C30,0xFCA3");
1581 nvram_set("pci/1/1/pa2ga1", "0xFF35,0x1BE3,0xFCB0");
1582 nvram_set("pci/1/1/pa2ga2", "0xFF33,0x1BE1,0xFCB0");
1583 nvram_set("pci/1/1/papdcap2g", "0");
1584 nvram_set("pci/1/1/pdgain2g", "14");
1585 nvram_set("pci/1/1/pdoffset2g40ma0", "15");
1586 nvram_set("pci/1/1/pdoffset2g40ma1", "15");
1587 nvram_set("pci/1/1/pdoffset2g40ma2", "15");
1588 nvram_set("pci/1/1/pdoffset2g40mvalid", "1");
1589 nvram_set("pci/1/1/pdoffset40ma0", "0");
1590 nvram_set("pci/1/1/pdoffset40ma1", "0");
1591 nvram_set("pci/1/1/pdoffset40ma2", "0");
1592 nvram_set("pci/1/1/pdoffset80ma0", "0");
1593 nvram_set("pci/1/1/pdoffset80ma1", "0");
1594 nvram_set("pci/1/1/pdoffset80ma2", "0");
1595 nvram_set("pci/1/1/regrev", "66");
1596 nvram_set("pci/1/1/rpcal2g", "0x5f7");
1597 nvram_set("pci/1/1/rxgainerr2ga0", "63");
1598 nvram_set("pci/1/1/rxgainerr2ga1", "31");
1599 nvram_set("pci/1/1/rxgainerr2ga2", "31");
1600 nvram_set("pci/1/1/rxgains2gelnagaina0", "3");
1601 nvram_set("pci/1/1/rxgains2gelnagaina1", "3");
1602 nvram_set("pci/1/1/rxgains2gelnagaina2", "3");
1603 nvram_set("pci/1/1/rxgains2gtrelnabypa0", "1");
1604 nvram_set("pci/1/1/rxgains2gtrelnabypa1", "1");
1605 nvram_set("pci/1/1/rxgains2gtrelnabypa2", "1");
1606 nvram_set("pci/1/1/rxgains2gtrisoa0", "7");
1607 nvram_set("pci/1/1/rxgains2gtrisoa1", "7");
1608 nvram_set("pci/1/1/rxgains2gtrisoa2", "7");
1609 nvram_set("pci/1/1/sar2g", "18");
1610 nvram_set("pci/1/1/sromrev", "11");
1611 nvram_set("pci/1/1/subband5gver", "0x4");
1612 nvram_set("pci/1/1/subvid", "0x14e4");
1613 nvram_set("pci/1/1/tssifloor2g", "0x3ff");
1614 nvram_set("pci/1/1/tssiposslope2g", "1");
1615 nvram_set("pci/1/1/tworangetssi2g", "0");
1616 nvram_set("pci/1/1/xtalfreq", "65535");
1617 nvram_set("pci/2/1/aa2g", "7");
1618 nvram_set("pci/2/1/aa5g", "0");
1619 nvram_set("pci/2/1/aga0", "0");
1620 nvram_set("pci/2/1/aga1", "0");
1621 nvram_set("pci/2/1/aga2", "0");
1622 nvram_set("pci/2/1/agbg0", "0");
1623 nvram_set("pci/2/1/agbg1", "0");
1624 nvram_set("pci/2/1/agbg2", "0");
1625 nvram_set("pci/2/1/antswitch", "0");
1626 nvram_set("pci/2/1/boardflags", "0x30000000");
1627 nvram_set("pci/2/1/boardflags2", "0x300002");
1628 nvram_set("pci/2/1/boardflags3", "0x10000000");
1629 nvram_set("pci/2/1/boardnum", "20507");
1630 nvram_set("pci/2/1/boardrev", "0x1451");
1631 nvram_set("pci/2/1/boardtype", "0x621");
1632 nvram_set("pci/2/1/cckbw202gpo", "0");
1633 nvram_set("pci/2/1/cckbw20ul2gpo", "0");
1634 nvram_set("pci/2/1/ccode", "SG");
1635 nvram_set("pci/2/1/devid", "0x43a2");
1636 nvram_set("pci/2/1/dot11agduphrpo", "0");
1637 nvram_set("pci/2/1/dot11agduplrpo", "0");
1638 nvram_set("pci/2/1/dot11agofdmhrbw202gpo", "0");
1639 nvram_set("pci/2/1/epagain2g", "0");
1640 nvram_set("pci/2/1/epagain5g", "0");
1641 nvram_set("pci/2/1/femctrl", "3");
1642 nvram_set("pci/2/1/gainctrlsph", "0");
1643 // nvram_set("pci/2/1/macaddr", "E4:F4:C6:01:47:7B");
1644 nvram_set("pci/2/1/maxp2ga0", "76");
1645 nvram_set("pci/2/1/maxp2ga1", "76");
1646 nvram_set("pci/2/1/maxp2ga2", "76");
1647 nvram_set("pci/2/1/maxp5ga0", "106,106,106,106");
1648 nvram_set("pci/2/1/maxp5ga1", "106,106,106,106");
1649 nvram_set("pci/2/1/maxp5ga2", "106,106,106,106");
1650 nvram_set("pci/2/1/mcsbw1605ghpo", "0");
1651 nvram_set("pci/2/1/mcsbw1605glpo", "0");
1652 nvram_set("pci/2/1/mcsbw1605gmpo", "0");
1653 nvram_set("pci/2/1/mcsbw1605hpo", "0");
1654 nvram_set("pci/2/1/mcsbw202gpo", "0");
1655 nvram_set("pci/2/1/mcsbw205ghpo", "0xBA768600");
1656 nvram_set("pci/2/1/mcsbw205glpo", "0xBA768600");
1657 nvram_set("pci/2/1/mcsbw205gmpo", "0xBA768600");
1658 nvram_set("pci/2/1/mcsbw402gpo", "0");
1659 nvram_set("pci/2/1/mcsbw405ghpo", "0xBA768600");
1660 nvram_set("pci/2/1/mcsbw405glpo", "0xBA768600");
1661 nvram_set("pci/2/1/mcsbw405gmpo", "0xBA768600");
1662 nvram_set("pci/2/1/mcsbw805ghpo", "0xBA768600");
1663 nvram_set("pci/2/1/mcsbw805glpo", "0xBA768600");
1664 nvram_set("pci/2/1/mcsbw805gmpo", "0xBA768600");
1665 nvram_set("pci/2/1/mcslr5ghpo", "0");
1666 nvram_set("pci/2/1/mcslr5glpo", "0");
1667 nvram_set("pci/2/1/mcslr5gmpo", "0");
1668 nvram_set("pci/2/1/measpower", "0x7f");
1669 nvram_set("pci/2/1/measpower1", "0x7f");
1670 nvram_set("pci/2/1/measpower2", "0x7f");
1671 nvram_set("pci/2/1/noiselvl2ga0", "31");
1672 nvram_set("pci/2/1/noiselvl2ga1", "31");
1673 nvram_set("pci/2/1/noiselvl2ga2", "31");
1674 nvram_set("pci/2/1/noiselvl5ga0", "31,31,31,31");
1675 nvram_set("pci/2/1/noiselvl5ga1", "31,31,31,31");
1676 nvram_set("pci/2/1/noiselvl5ga2", "31,31,31,31");
1677 nvram_set("pci/2/1/ofdmlrbw202gpo", "0");
1678 nvram_set("pci/2/1/pa2ga0", "0xfe72,0x14c0,0xfac7");
1679 nvram_set("pci/2/1/pa2ga1", "0xfe80,0x1472,0xfabc");
1680 nvram_set("pci/2/1/pa2ga2", "0xfe82,0x14bf,0xfad9");
1681 nvram_set("pci/2/1/pa5ga0", "0xFF4C,0x1808,0xFD1B,0xFF4C,0x18CF,0xFD0C,0xFF4A,0x1920,0xFD08,0xFF4C,0x1949,0xFCF6");
1682 nvram_set("pci/2/1/pa5ga1", "0xFF4A,0x18AC,0xFD0B,0xFF44,0x1904,0xFCFF,0xFF56,0x1A09,0xFCFC,0xFF4F,0x19AB,0xFCEF");
1683 nvram_set("pci/2/1/pa5ga2", "0xFF4C,0x1896,0xFD11,0xFF43,0x192D,0xFCF5,0xFF50,0x19EE,0xFCF1,0xFF52,0x19C6,0xFCF1");
1684 nvram_set("pci/2/1/papdcap2g", "0");
1685 nvram_set("pci/2/1/papdcap5g", "0");
1686 nvram_set("pci/2/1/pdgain2g", "4");
1687 nvram_set("pci/2/1/pdgain5g", "4");
1688 nvram_set("pci/2/1/pdoffset2g40ma0", "15");
1689 nvram_set("pci/2/1/pdoffset2g40ma1", "15");
1690 nvram_set("pci/2/1/pdoffset2g40ma2", "15");
1691 nvram_set("pci/2/1/pdoffset2g40mvalid", "1");
1692 nvram_set("pci/2/1/pdoffset40ma0", "4369");
1693 nvram_set("pci/2/1/pdoffset40ma1", "4369");
1694 nvram_set("pci/2/1/pdoffset40ma2", "4369");
1695 nvram_set("pci/2/1/pdoffset80ma0", "0");
1696 nvram_set("pci/2/1/pdoffset80ma1", "0");
1697 nvram_set("pci/2/1/pdoffset80ma2", "0");
1698 nvram_set("pci/2/1/phycal_tempdelta", "255");
1699 nvram_set("pci/2/1/rawtempsense", "0x1ff");
1700 nvram_set("pci/2/1/regrev", "66");
1701 nvram_set("pci/2/1/rpcal2g", "0");
1702 nvram_set("pci/2/1/rpcal5gb0", "0x610c");
1703 nvram_set("pci/2/1/rpcal5gb1", "0x6a09");
1704 nvram_set("pci/2/1/rpcal5gb2", "0x5eff");
1705 nvram_set("pci/2/1/rpcal5gb3", "0x700c");
1706 nvram_set("pci/2/1/rxchain", "7");
1707 nvram_set("pci/2/1/rxgainerr2ga0", "63");
1708 nvram_set("pci/2/1/rxgainerr2ga1", "31");
1709 nvram_set("pci/2/1/rxgainerr2ga2", "31");
1710 nvram_set("pci/2/1/rxgainerr5ga0", "63,63,63,63");
1711 nvram_set("pci/2/1/rxgainerr5ga1", "31,31,31,31");
1712 nvram_set("pci/2/1/rxgainerr5ga2", "31,31,31,31");
1713 nvram_set("pci/2/1/rxgains2gelnagaina0", "0");
1714 nvram_set("pci/2/1/rxgains2gelnagaina1", "0");
1715 nvram_set("pci/2/1/rxgains2gelnagaina2", "0");
1716 nvram_set("pci/2/1/rxgains2gtrelnabypa0", "0");
1717 nvram_set("pci/2/1/rxgains2gtrelnabypa1", "0");
1718 nvram_set("pci/2/1/rxgains2gtrelnabypa2", "0");
1719 nvram_set("pci/2/1/rxgains2gtrisoa0", "0");
1720 nvram_set("pci/2/1/rxgains2gtrisoa1", "0");
1721 nvram_set("pci/2/1/rxgains2gtrisoa2", "0");
1722 nvram_set("pci/2/1/rxgains5gelnagaina0", "4");
1723 nvram_set("pci/2/1/rxgains5gelnagaina1", "4");
1724 nvram_set("pci/2/1/rxgains5gelnagaina2", "4");
1725 nvram_set("pci/2/1/rxgains5ghelnagaina0", "3");
1726 nvram_set("pci/2/1/rxgains5ghelnagaina1", "3");
1727 nvram_set("pci/2/1/rxgains5ghelnagaina2", "4");
1728 nvram_set("pci/2/1/rxgains5ghtrelnabypa0", "1");
1729 nvram_set("pci/2/1/rxgains5ghtrelnabypa1", "1");
1730 nvram_set("pci/2/1/rxgains5ghtrelnabypa2", "1");
1731 nvram_set("pci/2/1/rxgains5ghtrisoa0", "5");
1732 nvram_set("pci/2/1/rxgains5ghtrisoa1", "4");
1733 nvram_set("pci/2/1/rxgains5ghtrisoa2", "4");
1734 nvram_set("pci/2/1/rxgains5gmelnagaina0", "3");
1735 nvram_set("pci/2/1/rxgains5gmelnagaina1", "4");
1736 nvram_set("pci/2/1/rxgains5gmelnagaina2", "4");
1737 nvram_set("pci/2/1/rxgains5gmtrelnabypa0", "1");
1738 nvram_set("pci/2/1/rxgains5gmtrelnabypa1", "1");
1739 nvram_set("pci/2/1/rxgains5gmtrelnabypa2", "1");
1740 nvram_set("pci/2/1/rxgains5gmtrisoa0", "5");
1741 nvram_set("pci/2/1/rxgains5gmtrisoa1", "4");
1742 nvram_set("pci/2/1/rxgains5gmtrisoa2", "4");
1743 nvram_set("pci/2/1/rxgains5gtrelnabypa0", "1");
1744 nvram_set("pci/2/1/rxgains5gtrelnabypa1", "1");
1745 nvram_set("pci/2/1/rxgains5gtrelnabypa2", "1");
1746 nvram_set("pci/2/1/rxgains5gtrisoa0", "7");
1747 nvram_set("pci/2/1/rxgains5gtrisoa1", "6");
1748 nvram_set("pci/2/1/rxgains5gtrisoa2", "5");
1749 nvram_set("pci/2/1/sar2g", "18");
1750 nvram_set("pci/2/1/sar5g", "15");
1751 nvram_set("pci/2/1/sb20in40hrpo", "0");
1752 nvram_set("pci/2/1/sb20in40lrpo", "0");
1753 nvram_set("pci/2/1/sb20in80and160hr5ghpo", "0");
1754 nvram_set("pci/2/1/sb20in80and160hr5glpo", "0");
1755 nvram_set("pci/2/1/sb20in80and160hr5gmpo", "0");
1756 nvram_set("pci/2/1/sb20in80and160lr5ghpo", "0");
1757 nvram_set("pci/2/1/sb20in80and160lr5glpo", "0");
1758 nvram_set("pci/2/1/sb20in80and160lr5gmpo", "0");
1759 nvram_set("pci/2/1/sb40and80hr5ghpo", "0");
1760 nvram_set("pci/2/1/sb40and80hr5glpo", "0");
1761 nvram_set("pci/2/1/sb40and80hr5gmpo", "0");
1762 nvram_set("pci/2/1/sb40and80lr5ghpo", "0");
1763 nvram_set("pci/2/1/sb40and80lr5glpo", "0");
1764 nvram_set("pci/2/1/sb40and80lr5gmpo", "0");
1765 nvram_set("pci/2/1/sromrev", "11");
1766 nvram_set("pci/2/1/subband5gver", "0x4");
1767 nvram_set("pci/2/1/subvid", "0x14e4");
1768 nvram_set("pci/2/1/tempcorrx", "0x3f");
1769 nvram_set("pci/2/1/tempoffset", "255");
1770 nvram_set("pci/2/1/tempsense_option", "0x3");
1771 nvram_set("pci/2/1/tempsense_slope", "0xff");
1772 nvram_set("pci/2/1/temps_hysteresis", "15");
1773 nvram_set("pci/2/1/temps_period", "15");
1774 nvram_set("pci/2/1/tempthresh", "255");
1775 nvram_set("pci/2/1/tssifloor2g", "0x3ff");
1776 nvram_set("pci/2/1/tssifloor5g", "0x3ff,0x3ff,0x3ff,0x3ff");
1777 nvram_set("pci/2/1/tssiposslope2g", "1");
1778 nvram_set("pci/2/1/tssiposslope5g", "1");
1779 nvram_set("pci/2/1/tworangetssi2g", "0");
1780 nvram_set("pci/2/1/tworangetssi5g", "0");
1781 nvram_set("pci/2/1/txchain", "7");
1782 nvram_set("pci/2/1/xtalfreq", "65535");
1789 features
= SUP_SES
| SUP_80211N
| SUP_1000ET
| SUP_80211AC
;
1791 nvram_set("usb_uhci", "-1");
1793 if (!nvram_match("t_fix1", (char *)name
)) {
1794 nvram_set("vlan1hwname", "et0");
1795 nvram_set("vlan2hwname", "et0");
1796 nvram_set("lan_ifname", "br0");
1797 nvram_set("landevs", "vlan1 wl0 wl1");
1798 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
1799 nvram_set("wan_ifnames", "vlan2");
1800 nvram_set("wan_ifnameX", "vlan2");
1801 nvram_set("wandevs", "vlan2");
1802 nvram_set("wl_ifnames", "eth1 eth2");
1803 nvram_set("wl_ifname", "eth1");
1804 nvram_set("wl0_ifname", "eth1");
1805 nvram_set("wl1_ifname", "eth2");
1807 // fix WL mac for 5G
1808 strcpy(s
, nvram_safe_get("pci/1/1/macaddr"));
1810 nvram_set("pci/2/1/macaddr", s
);
1813 nvram_set("usb_usb3", "1");
1814 nvram_set("xhci_ports", "1-1");
1815 nvram_set("ehci_ports", "2-1 2-2");
1816 nvram_set("ohci_ports", "3-1 3-2");
1818 // force wl1 settings
1819 nvram_set("wl1_bw", "3");
1820 nvram_set("wl1_bw_cap", "7");
1821 nvram_set("wl1_chanspec", "149/80");
1822 nvram_set("wl1_nctrlsb", "lower");
1823 nvram_set("wl_country", "SG");
1824 nvram_set("wl_country_code", "SG");
1826 // bcm4360ac_defaults - fix problem of loading driver failed with code 21
1827 nvram_set("pci/1/1/aa2g", "7");
1828 nvram_set("pci/1/1/agbg0", "71");
1829 nvram_set("pci/1/1/agbg1", "71");
1830 nvram_set("pci/1/1/agbg2", "71");
1831 nvram_set("pci/1/1/antswitch", "0");
1832 nvram_set("pci/1/1/boardflags", "0x1000");
1833 nvram_set("pci/1/1/boardflags2", "0x100002");
1834 nvram_set("pci/1/1/boardflags3", "0x10000003");
1835 nvram_set("pci/1/1/boardnum", "57359");
1836 nvram_set("pci/1/1/boardrev", "0x1150");
1837 nvram_set("pci/1/1/boardtype", "0x661");
1838 nvram_set("pci/1/1/cckbw202gpo", "0");
1839 nvram_set("pci/1/1/cckbw20ul2gpo", "0");
1840 nvram_set("pci/1/1/ccode", "EU");
1841 nvram_set("pci/1/1/devid", "0x43a1");
1842 nvram_set("pci/1/1/dot11agduphrpo", "0");
1843 nvram_set("pci/1/1/dot11agduplrpo", "0");
1844 nvram_set("pci/1/1/dot11agofdmhrbw202gpo", "0xCA86");
1845 nvram_set("pci/1/1/epagain2g", "0");
1846 nvram_set("pci/1/1/femctrl", "3");
1847 nvram_set("pci/1/1/gainctrlsph", "0");
1848 // nvram_set("pci/1/1/macaddr", "E4:F4:C6:01:47:7C");
1849 nvram_set("pci/1/1/maxp2ga0", "106");
1850 nvram_set("pci/1/1/maxp2ga1", "106");
1851 nvram_set("pci/1/1/maxp2ga2", "106");
1852 nvram_set("pci/1/1/mcsbw202gpo", "0xA976A600");
1853 nvram_set("pci/1/1/mcsbw402gpo", "0xA976A600");
1854 nvram_set("pci/1/1/measpower", "0x7f");
1855 nvram_set("pci/1/1/measpower1", "0x7f");
1856 nvram_set("pci/1/1/measpower2", "0x7f");
1857 nvram_set("pci/1/1/noiselvl2ga0", "31");
1858 nvram_set("pci/1/1/noiselvl2ga1", "31");
1859 nvram_set("pci/1/1/noiselvl2ga2", "31");
1860 nvram_set("pci/1/1/ofdmlrbw202gpo", "0");
1861 nvram_set("pci/1/1/pa2ga0", "0xFF32,0x1C30,0xFCA3");
1862 nvram_set("pci/1/1/pa2ga1", "0xFF35,0x1BE3,0xFCB0");
1863 nvram_set("pci/1/1/pa2ga2", "0xFF33,0x1BE1,0xFCB0");
1864 nvram_set("pci/1/1/papdcap2g", "0");
1865 nvram_set("pci/1/1/pdgain2g", "14");
1866 nvram_set("pci/1/1/pdoffset2g40ma0", "15");
1867 nvram_set("pci/1/1/pdoffset2g40ma1", "15");
1868 nvram_set("pci/1/1/pdoffset2g40ma2", "15");
1869 nvram_set("pci/1/1/pdoffset2g40mvalid", "1");
1870 nvram_set("pci/1/1/pdoffset40ma0", "0");
1871 nvram_set("pci/1/1/pdoffset40ma1", "0");
1872 nvram_set("pci/1/1/pdoffset40ma2", "0");
1873 nvram_set("pci/1/1/pdoffset80ma0", "0");
1874 nvram_set("pci/1/1/pdoffset80ma1", "0");
1875 nvram_set("pci/1/1/pdoffset80ma2", "0");
1876 nvram_set("pci/1/1/regrev", "66");
1877 nvram_set("pci/1/1/rpcal2g", "0x5f7");
1878 nvram_set("pci/1/1/rxgainerr2ga0", "63");
1879 nvram_set("pci/1/1/rxgainerr2ga1", "31");
1880 nvram_set("pci/1/1/rxgainerr2ga2", "31");
1881 nvram_set("pci/1/1/rxgains2gelnagaina0", "3");
1882 nvram_set("pci/1/1/rxgains2gelnagaina1", "3");
1883 nvram_set("pci/1/1/rxgains2gelnagaina2", "3");
1884 nvram_set("pci/1/1/rxgains2gtrelnabypa0", "1");
1885 nvram_set("pci/1/1/rxgains2gtrelnabypa1", "1");
1886 nvram_set("pci/1/1/rxgains2gtrelnabypa2", "1");
1887 nvram_set("pci/1/1/rxgains2gtrisoa0", "7");
1888 nvram_set("pci/1/1/rxgains2gtrisoa1", "7");
1889 nvram_set("pci/1/1/rxgains2gtrisoa2", "7");
1890 nvram_set("pci/1/1/sar2g", "18");
1891 nvram_set("pci/1/1/sromrev", "11");
1892 nvram_set("pci/1/1/subband5gver", "0x4");
1893 nvram_set("pci/1/1/subvid", "0x14e4");
1894 nvram_set("pci/1/1/tssifloor2g", "0x3ff");
1895 nvram_set("pci/1/1/tssiposslope2g", "1");
1896 nvram_set("pci/1/1/tworangetssi2g", "0");
1897 nvram_set("pci/1/1/xtalfreq", "65535");
1898 nvram_set("pci/2/1/aa2g", "7");
1899 nvram_set("pci/2/1/aa5g", "0");
1900 nvram_set("pci/2/1/aga0", "0");
1901 nvram_set("pci/2/1/aga1", "0");
1902 nvram_set("pci/2/1/aga2", "0");
1903 nvram_set("pci/2/1/agbg0", "0");
1904 nvram_set("pci/2/1/agbg1", "0");
1905 nvram_set("pci/2/1/agbg2", "0");
1906 nvram_set("pci/2/1/antswitch", "0");
1907 nvram_set("pci/2/1/boardflags", "0x30000000");
1908 nvram_set("pci/2/1/boardflags2", "0x300002");
1909 nvram_set("pci/2/1/boardflags3", "0x10000000");
1910 nvram_set("pci/2/1/boardnum", "20507");
1911 nvram_set("pci/2/1/boardrev", "0x1451");
1912 nvram_set("pci/2/1/boardtype", "0x621");
1913 nvram_set("pci/2/1/cckbw202gpo", "0");
1914 nvram_set("pci/2/1/cckbw20ul2gpo", "0");
1915 nvram_set("pci/2/1/ccode", "SG");
1916 nvram_set("pci/2/1/devid", "0x43a2");
1917 nvram_set("pci/2/1/dot11agduphrpo", "0");
1918 nvram_set("pci/2/1/dot11agduplrpo", "0");
1919 nvram_set("pci/2/1/dot11agofdmhrbw202gpo", "0");
1920 nvram_set("pci/2/1/epagain2g", "0");
1921 nvram_set("pci/2/1/epagain5g", "0");
1922 nvram_set("pci/2/1/femctrl", "3");
1923 nvram_set("pci/2/1/gainctrlsph", "0");
1924 // nvram_set("pci/2/1/macaddr", "E4:F4:C6:01:47:7B");
1925 nvram_set("pci/2/1/maxp2ga0", "76");
1926 nvram_set("pci/2/1/maxp2ga1", "76");
1927 nvram_set("pci/2/1/maxp2ga2", "76");
1928 nvram_set("pci/2/1/maxp5ga0", "106,106,106,106");
1929 nvram_set("pci/2/1/maxp5ga1", "106,106,106,106");
1930 nvram_set("pci/2/1/maxp5ga2", "106,106,106,106");
1931 nvram_set("pci/2/1/mcsbw1605ghpo", "0");
1932 nvram_set("pci/2/1/mcsbw1605glpo", "0");
1933 nvram_set("pci/2/1/mcsbw1605gmpo", "0");
1934 nvram_set("pci/2/1/mcsbw1605hpo", "0");
1935 nvram_set("pci/2/1/mcsbw202gpo", "0");
1936 nvram_set("pci/2/1/mcsbw205ghpo", "0xBA768600");
1937 nvram_set("pci/2/1/mcsbw205glpo", "0xBA768600");
1938 nvram_set("pci/2/1/mcsbw205gmpo", "0xBA768600");
1939 nvram_set("pci/2/1/mcsbw402gpo", "0");
1940 nvram_set("pci/2/1/mcsbw405ghpo", "0xBA768600");
1941 nvram_set("pci/2/1/mcsbw405glpo", "0xBA768600");
1942 nvram_set("pci/2/1/mcsbw405gmpo", "0xBA768600");
1943 nvram_set("pci/2/1/mcsbw805ghpo", "0xBA768600");
1944 nvram_set("pci/2/1/mcsbw805glpo", "0xBA768600");
1945 nvram_set("pci/2/1/mcsbw805gmpo", "0xBA768600");
1946 nvram_set("pci/2/1/mcslr5ghpo", "0");
1947 nvram_set("pci/2/1/mcslr5glpo", "0");
1948 nvram_set("pci/2/1/mcslr5gmpo", "0");
1949 nvram_set("pci/2/1/measpower", "0x7f");
1950 nvram_set("pci/2/1/measpower1", "0x7f");
1951 nvram_set("pci/2/1/measpower2", "0x7f");
1952 nvram_set("pci/2/1/noiselvl2ga0", "31");
1953 nvram_set("pci/2/1/noiselvl2ga1", "31");
1954 nvram_set("pci/2/1/noiselvl2ga2", "31");
1955 nvram_set("pci/2/1/noiselvl5ga0", "31,31,31,31");
1956 nvram_set("pci/2/1/noiselvl5ga1", "31,31,31,31");
1957 nvram_set("pci/2/1/noiselvl5ga2", "31,31,31,31");
1958 nvram_set("pci/2/1/ofdmlrbw202gpo", "0");
1959 nvram_set("pci/2/1/pa2ga0", "0xfe72,0x14c0,0xfac7");
1960 nvram_set("pci/2/1/pa2ga1", "0xfe80,0x1472,0xfabc");
1961 nvram_set("pci/2/1/pa2ga2", "0xfe82,0x14bf,0xfad9");
1962 nvram_set("pci/2/1/pa5ga0", "0xFF4C,0x1808,0xFD1B,0xFF4C,0x18CF,0xFD0C,0xFF4A,0x1920,0xFD08,0xFF4C,0x1949,0xFCF6");
1963 nvram_set("pci/2/1/pa5ga1", "0xFF4A,0x18AC,0xFD0B,0xFF44,0x1904,0xFCFF,0xFF56,0x1A09,0xFCFC,0xFF4F,0x19AB,0xFCEF");
1964 nvram_set("pci/2/1/pa5ga2", "0xFF4C,0x1896,0xFD11,0xFF43,0x192D,0xFCF5,0xFF50,0x19EE,0xFCF1,0xFF52,0x19C6,0xFCF1");
1965 nvram_set("pci/2/1/papdcap2g", "0");
1966 nvram_set("pci/2/1/papdcap5g", "0");
1967 nvram_set("pci/2/1/pdgain2g", "4");
1968 nvram_set("pci/2/1/pdgain5g", "4");
1969 nvram_set("pci/2/1/pdoffset2g40ma0", "15");
1970 nvram_set("pci/2/1/pdoffset2g40ma1", "15");
1971 nvram_set("pci/2/1/pdoffset2g40ma2", "15");
1972 nvram_set("pci/2/1/pdoffset2g40mvalid", "1");
1973 nvram_set("pci/2/1/pdoffset40ma0", "4369");
1974 nvram_set("pci/2/1/pdoffset40ma1", "4369");
1975 nvram_set("pci/2/1/pdoffset40ma2", "4369");
1976 nvram_set("pci/2/1/pdoffset80ma0", "0");
1977 nvram_set("pci/2/1/pdoffset80ma1", "0");
1978 nvram_set("pci/2/1/pdoffset80ma2", "0");
1979 nvram_set("pci/2/1/phycal_tempdelta", "255");
1980 nvram_set("pci/2/1/rawtempsense", "0x1ff");
1981 nvram_set("pci/2/1/regrev", "66");
1982 nvram_set("pci/2/1/rpcal2g", "0");
1983 nvram_set("pci/2/1/rpcal5gb0", "0x610c");
1984 nvram_set("pci/2/1/rpcal5gb1", "0x6a09");
1985 nvram_set("pci/2/1/rpcal5gb2", "0x5eff");
1986 nvram_set("pci/2/1/rpcal5gb3", "0x700c");
1987 nvram_set("pci/2/1/rxchain", "7");
1988 nvram_set("pci/2/1/rxgainerr2ga0", "63");
1989 nvram_set("pci/2/1/rxgainerr2ga1", "31");
1990 nvram_set("pci/2/1/rxgainerr2ga2", "31");
1991 nvram_set("pci/2/1/rxgainerr5ga0", "63,63,63,63");
1992 nvram_set("pci/2/1/rxgainerr5ga1", "31,31,31,31");
1993 nvram_set("pci/2/1/rxgainerr5ga2", "31,31,31,31");
1994 nvram_set("pci/2/1/rxgains2gelnagaina0", "0");
1995 nvram_set("pci/2/1/rxgains2gelnagaina1", "0");
1996 nvram_set("pci/2/1/rxgains2gelnagaina2", "0");
1997 nvram_set("pci/2/1/rxgains2gtrelnabypa0", "0");
1998 nvram_set("pci/2/1/rxgains2gtrelnabypa1", "0");
1999 nvram_set("pci/2/1/rxgains2gtrelnabypa2", "0");
2000 nvram_set("pci/2/1/rxgains2gtrisoa0", "0");
2001 nvram_set("pci/2/1/rxgains2gtrisoa1", "0");
2002 nvram_set("pci/2/1/rxgains2gtrisoa2", "0");
2003 nvram_set("pci/2/1/rxgains5gelnagaina0", "4");
2004 nvram_set("pci/2/1/rxgains5gelnagaina1", "4");
2005 nvram_set("pci/2/1/rxgains5gelnagaina2", "4");
2006 nvram_set("pci/2/1/rxgains5ghelnagaina0", "3");
2007 nvram_set("pci/2/1/rxgains5ghelnagaina1", "3");
2008 nvram_set("pci/2/1/rxgains5ghelnagaina2", "4");
2009 nvram_set("pci/2/1/rxgains5ghtrelnabypa0", "1");
2010 nvram_set("pci/2/1/rxgains5ghtrelnabypa1", "1");
2011 nvram_set("pci/2/1/rxgains5ghtrelnabypa2", "1");
2012 nvram_set("pci/2/1/rxgains5ghtrisoa0", "5");
2013 nvram_set("pci/2/1/rxgains5ghtrisoa1", "4");
2014 nvram_set("pci/2/1/rxgains5ghtrisoa2", "4");
2015 nvram_set("pci/2/1/rxgains5gmelnagaina0", "3");
2016 nvram_set("pci/2/1/rxgains5gmelnagaina1", "4");
2017 nvram_set("pci/2/1/rxgains5gmelnagaina2", "4");
2018 nvram_set("pci/2/1/rxgains5gmtrelnabypa0", "1");
2019 nvram_set("pci/2/1/rxgains5gmtrelnabypa1", "1");
2020 nvram_set("pci/2/1/rxgains5gmtrelnabypa2", "1");
2021 nvram_set("pci/2/1/rxgains5gmtrisoa0", "5");
2022 nvram_set("pci/2/1/rxgains5gmtrisoa1", "4");
2023 nvram_set("pci/2/1/rxgains5gmtrisoa2", "4");
2024 nvram_set("pci/2/1/rxgains5gtrelnabypa0", "1");
2025 nvram_set("pci/2/1/rxgains5gtrelnabypa1", "1");
2026 nvram_set("pci/2/1/rxgains5gtrelnabypa2", "1");
2027 nvram_set("pci/2/1/rxgains5gtrisoa0", "7");
2028 nvram_set("pci/2/1/rxgains5gtrisoa1", "6");
2029 nvram_set("pci/2/1/rxgains5gtrisoa2", "5");
2030 nvram_set("pci/2/1/sar2g", "18");
2031 nvram_set("pci/2/1/sar5g", "15");
2032 nvram_set("pci/2/1/sb20in40hrpo", "0");
2033 nvram_set("pci/2/1/sb20in40lrpo", "0");
2034 nvram_set("pci/2/1/sb20in80and160hr5ghpo", "0");
2035 nvram_set("pci/2/1/sb20in80and160hr5glpo", "0");
2036 nvram_set("pci/2/1/sb20in80and160hr5gmpo", "0");
2037 nvram_set("pci/2/1/sb20in80and160lr5ghpo", "0");
2038 nvram_set("pci/2/1/sb20in80and160lr5glpo", "0");
2039 nvram_set("pci/2/1/sb20in80and160lr5gmpo", "0");
2040 nvram_set("pci/2/1/sb40and80hr5ghpo", "0");
2041 nvram_set("pci/2/1/sb40and80hr5glpo", "0");
2042 nvram_set("pci/2/1/sb40and80hr5gmpo", "0");
2043 nvram_set("pci/2/1/sb40and80lr5ghpo", "0");
2044 nvram_set("pci/2/1/sb40and80lr5glpo", "0");
2045 nvram_set("pci/2/1/sb40and80lr5gmpo", "0");
2046 nvram_set("pci/2/1/sromrev", "11");
2047 nvram_set("pci/2/1/subband5gver", "0x4");
2048 nvram_set("pci/2/1/subvid", "0x14e4");
2049 nvram_set("pci/2/1/tempcorrx", "0x3f");
2050 nvram_set("pci/2/1/tempoffset", "255");
2051 nvram_set("pci/2/1/tempsense_option", "0x3");
2052 nvram_set("pci/2/1/tempsense_slope", "0xff");
2053 nvram_set("pci/2/1/temps_hysteresis", "15");
2054 nvram_set("pci/2/1/temps_period", "15");
2055 nvram_set("pci/2/1/tempthresh", "255");
2056 nvram_set("pci/2/1/tssifloor2g", "0x3ff");
2057 nvram_set("pci/2/1/tssifloor5g", "0x3ff,0x3ff,0x3ff,0x3ff");
2058 nvram_set("pci/2/1/tssiposslope2g", "1");
2059 nvram_set("pci/2/1/tssiposslope5g", "1");
2060 nvram_set("pci/2/1/tworangetssi2g", "0");
2061 nvram_set("pci/2/1/tworangetssi5g", "0");
2062 nvram_set("pci/2/1/txchain", "7");
2063 nvram_set("pci/2/1/xtalfreq", "65535");
2070 features
= SUP_SES
| SUP_80211N
| SUP_1000ET
| SUP_80211AC
;
2072 nvram_set("usb_uhci", "-1");
2074 if (!nvram_match("t_fix1", (char *)name
)) {
2075 nvram_set("vlan1hwname", "et0");
2076 nvram_set("vlan2hwname", "et0");
2077 nvram_set("lan_ifname", "br0");
2078 nvram_set("landevs", "vlan1 wl0 wl1");
2079 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
2080 nvram_set("wan_ifnames", "vlan2");
2081 nvram_set("wan_ifnameX", "vlan2");
2082 nvram_set("wandevs", "vlan2");
2083 nvram_set("wl_ifnames", "eth1 eth2");
2084 nvram_set("wl_ifname", "eth1");
2085 nvram_set("wl0_ifname", "eth1");
2086 nvram_set("wl1_ifname", "eth2");
2089 strcpy(s
, nvram_safe_get("et0macaddr"));
2091 nvram_set("0:macaddr", s
);
2093 nvram_set("1:macaddr", s
);
2096 nvram_set("usb_usb3", "1");
2097 nvram_set("xhci_ports", "1-1");
2098 nvram_set("ehci_ports", "2-1 2-2");
2099 nvram_set("ohci_ports", "3-1 3-2");
2102 nvram_set("boot_wait", "off");
2103 nvram_set("wait_time", "1");
2105 // 2.4GHz module defaults
2106 nvram_set("devpath0", "pci/1/1");
2107 nvram_set("0:aa2g", "7");
2108 nvram_set("0:ag0", "0");
2109 nvram_set("0:ag1", "0");
2110 nvram_set("0:ag2", "0");
2111 nvram_set("0:antswctl2g", "0");
2112 nvram_set("0:antswitch", "0");
2113 nvram_set("0:boardflags2", "0x00100000");
2114 nvram_set("0:boardflags", "0x80001200");
2115 nvram_set("0:boardtype", "0x59b");
2116 nvram_set("0:boardvendor", "0x14e4");
2117 nvram_set("0:cckbw202gpo", "0x0000");
2118 nvram_set("0:cckbw20ul2gpo", "0x0000");
2119 nvram_set("0:ccode", "#a");
2120 nvram_set("0:devid", "0x4332");
2121 nvram_set("0:elna2g", "2");
2122 nvram_set("0:extpagain2g", "3");
2123 nvram_set("0:ledbh0", "11");
2124 nvram_set("0:ledbh1", "11");
2125 nvram_set("0:ledbh2", "11");
2126 nvram_set("0:ledbh3", "11");
2127 nvram_set("0:ledbh12", "11");
2128 nvram_set("0:leddc", "0xffff");
2129 nvram_set("0:legofdm40duppo", "0x0");
2130 nvram_set("0:legofdmbw202gpo", "0x88888888");
2131 nvram_set("0:legofdmbw20ul2gpo", "0x88888888");
2132 nvram_set("0:maxp2ga0", "0x46");
2133 nvram_set("0:maxp2ga1", "0x46");
2134 nvram_set("0:maxp2ga2", "0x46");
2135 nvram_set("0:mcs32po", "0x0");
2136 nvram_set("0:mcsbw202gpo", "0x88888888");
2137 nvram_set("0:mcsbw20ul2gpo", "0x88888888");
2138 nvram_set("0:mcsbw402gpo", "0x88888888");
2139 nvram_set("0:pa2gw0a0", "0xfe63");
2140 nvram_set("0:pa2gw0a1", "0xfe78");
2141 nvram_set("0:pa2gw0a2", "0xfe65");
2142 nvram_set("0:pa2gw1a0", "0x1dfd");
2143 nvram_set("0:pa2gw1a1", "0x1e4a");
2144 nvram_set("0:pa2gw1a2", "0x1e74");
2145 nvram_set("0:pa2gw2a0", "0xf8c7");
2146 nvram_set("0:pa2gw2a1", "0xf8d8");
2147 nvram_set("0:pa2gw2a2", "0xf8b9");
2148 nvram_set("0:parefldovoltage", "35");
2149 nvram_set("0:pdetrange2g", "3");
2150 nvram_set("0:phycal_tempdelta", "0");
2151 nvram_set("0:regrev", "0");
2152 nvram_set("0:rxchain", "7");
2153 nvram_set("0:sromrev", "9");
2154 nvram_set("0:tempoffset", "0");
2155 nvram_set("0:temps_hysteresis", "5");
2156 nvram_set("0:temps_period", "5");
2157 nvram_set("0:tempthresh", "120");
2158 nvram_set("0:triso2g", "3");
2159 nvram_set("0:tssipos2g", "1");
2160 nvram_set("0:txchain", "7");
2161 nvram_set("0:venid", "0x14e4");
2162 nvram_set("0:xtalfreq", "20000");
2164 // 5GHz module defaults
2165 nvram_set("devpath1", "pci/2/1");
2166 nvram_set("1:aa2g", "0");
2167 nvram_set("1:aa5g", "7");
2168 nvram_set("1:agbg0", "71");
2169 nvram_set("1:agbg1", "71");
2170 nvram_set("1:agbg2", "133");
2171 nvram_set("1:antswitch", "0");
2172 nvram_set("1:boardflags2", "0x00300002");
2173 nvram_set("1:boardflags3", "0x0");
2174 nvram_set("1:boardflags", "0x30000000");
2175 nvram_set("1:boardnum", "20771");
2176 nvram_set("1:boardrev", "0x1402");
2177 nvram_set("1:boardtype", "0x621");
2178 nvram_set("1:boardvendor", "0x14e4");
2179 nvram_set("1:cckbw202gpo", "0");
2180 nvram_set("1:cckbw20ul2gpo", "0");
2181 nvram_set("1:ccode", "#a");
2182 nvram_set("1:devid", "0x43a2");
2183 nvram_set("1:dot11agduphrpo", "0");
2184 nvram_set("1:dot11agduplrpo", "0");
2185 nvram_set("1:epagain2g", "0");
2186 nvram_set("1:epagain5g", "0");
2187 nvram_set("1:femctrl", "3");
2188 nvram_set("1:gainctrlsph", "0");
2189 nvram_set("1:maxp2ga0", "76");
2190 nvram_set("1:maxp2ga1", "76");
2191 nvram_set("1:maxp2ga2", "76");
2192 nvram_set("1:maxp5ga0", "70,70,86,86");
2193 nvram_set("1:maxp5ga1", "70,70,86,86");
2194 nvram_set("1:maxp5ga2", "70,70,86,86");
2195 nvram_set("1:mcsbw402gpo", "0");
2196 nvram_set("1:mcsbw1605ghpo", "0");
2197 nvram_set("1:mcsbw1605gmpo", "0");
2198 nvram_set("1:mcsbw402gpo", "0");
2199 nvram_set("1:mcsbw1605glpo", "0x00222222");
2200 nvram_set("1:mcsbw205ghpo", "0xaa880000");
2201 nvram_set("1:mcsbw205glpo", "0x66666666");
2202 nvram_set("1:mcsbw205gmpo", "0x66666666");
2203 nvram_set("1:mcsbw405ghpo", "0xaa880000");
2204 nvram_set("1:mcsbw405glpo", "0x22222222");
2205 nvram_set("1:mcsbw405gmpo", "0x22222222");
2206 nvram_set("1:mcsbw805ghpo", "0x88880000");
2207 nvram_set("1:mcsbw805glpo", "0x00222222");
2208 nvram_set("1:mcsbw805gmpo", "0x00222222");
2209 nvram_set("1:mcslr5ghpo", "0");
2210 nvram_set("1:mcslr5glpo", "0");
2211 nvram_set("1:mcslr5gmpo", "0");
2212 nvram_set("1:measpower1", "0x7f");
2213 nvram_set("1:measpower2", "0x7f");
2214 nvram_set("1:measpower", "0x7f");
2215 nvram_set("1:noiselvl2ga0", "31");
2216 nvram_set("1:noiselvl2ga1", "31");
2217 nvram_set("1:noiselvl2ga2", "31");
2218 nvram_set("1:noiselvl5ga0", "31,31,31,31");
2219 nvram_set("1:noiselvl5ga1", "31,31,31,31");
2220 nvram_set("1:noiselvl5ga2", "31,31,31,31");
2221 nvram_set("1:ofdmlrbw202gpo", "0");
2222 nvram_set("1:pa2ga0", "0xfe72,0x14c0,0xfac7");
2223 nvram_set("1:pa2ga1", "0xfe80,0x1472,0xfabc");
2224 nvram_set("1:pa2ga2", "0xfe82,0x14bf,0xfad9");
2225 nvram_set("1:pa5ga0", "0xff31,0x1a56,0xfcc7,0xff35,0x1a8f,0xfcc1,0xff35,0x18d4,0xfcf4,0xff2d,0x18d5,0xfce8");
2226 nvram_set("1:pa5ga1", "0xff30,0x190f,0xfce6,0xff38,0x1abc,0xfcc0,0xff0f,0x1762,0xfcef,0xff18,0x1648,0xfd23");
2227 nvram_set("1:pa5ga2", "0xff32,0x18f6,0xfce8,0xff36,0x195d,0xfcdf,0xff28,0x16ae,0xfd1e,0xff28,0x166c,0xfd2b");
2228 nvram_set("1:papdcap2g", "0");
2229 nvram_set("1:papdcap5g", "0");
2230 nvram_set("1:pcieingress_war", "15");
2231 nvram_set("1:pdgain2g", "4");
2232 nvram_set("1:pdgain5g", "4");
2233 nvram_set("1:pdoffset40ma0", "0x1111");
2234 nvram_set("1:pdoffset40ma1", "0x1111");
2235 nvram_set("1:pdoffset40ma2", "0x1111");
2236 nvram_set("1:pdoffset80ma0", "0");
2237 nvram_set("1:pdoffset80ma1", "0");
2238 nvram_set("1:pdoffset80ma2", "0xfecc");
2239 nvram_set("1:phycal_tempdelta", "255");
2240 nvram_set("1:rawtempsense", "0x1ff");
2241 nvram_set("1:regrev", "0");
2242 nvram_set("1:rxchain", "7");
2243 nvram_set("1:rxgainerr2ga0", "63");
2244 nvram_set("1:rxgainerr2ga1", "31");
2245 nvram_set("1:rxgainerr2ga2", "31");
2246 nvram_set("1:rxgainerr5ga0", "63,63,63,63");
2247 nvram_set("1:rxgainerr5ga1", "31,31,31,31");
2248 nvram_set("1:rxgainerr5ga2", "31,31,31,31");
2249 nvram_set("1:rxgains2gelnagaina0", "0");
2250 nvram_set("1:rxgains2gelnagaina1", "0");
2251 nvram_set("1:rxgains2gelnagaina2", "0");
2252 nvram_set("1:rxgains2gtrisoa0", "0");
2253 nvram_set("1:rxgains2gtrisoa1", "0");
2254 nvram_set("1:rxgains2gtrisoa2", "0");
2255 nvram_set("1:rxgains5gelnagaina0", "1");
2256 nvram_set("1:rxgains5gelnagaina1", "1");
2257 nvram_set("1:rxgains5gelnagaina2", "1");
2258 nvram_set("1:rxgains5ghelnagaina0", "2");
2259 nvram_set("1:rxgains5ghelnagaina1", "2");
2260 nvram_set("1:rxgains5ghelnagaina2", "3");
2261 nvram_set("1:rxgains5ghtrelnabypa0", "1");
2262 nvram_set("1:rxgains5ghtrelnabypa1", "1");
2263 nvram_set("1:rxgains5ghtrelnabypa2", "1");
2264 nvram_set("1:rxgains5ghtrisoa0", "5");
2265 nvram_set("1:rxgains5ghtrisoa1", "4");
2266 nvram_set("1:rxgains5ghtrisoa2", "4");
2267 nvram_set("1:rxgains5gmelnagaina0", "2");
2268 nvram_set("1:rxgains5gmelnagaina1", "2");
2269 nvram_set("1:rxgains5gmelnagaina2", "3");
2270 nvram_set("1:rxgains5gmtrelnabypa0", "1");
2271 nvram_set("1:rxgains5gmtrelnabypa1", "1");
2272 nvram_set("1:rxgains5gmtrelnabypa2", "1");
2273 nvram_set("1:rxgains5gmtrisoa0", "5");
2274 nvram_set("1:rxgains5gmtrisoa1", "4");
2275 nvram_set("1:rxgains5gmtrisoa2", "4");
2276 nvram_set("1:rxgains5gtrelnabypa0", "1");
2277 nvram_set("1:rxgains5gtrelnabypa1", "1");
2278 nvram_set("1:rxgains5gtrelnabypa2", "1");
2279 nvram_set("1:rxgains5gtrisoa0", "7");
2280 nvram_set("1:rxgains5gtrisoa1", "6");
2281 nvram_set("1:rxgains5gtrisoa2", "5");
2282 nvram_set("1:sar2g", "18");
2283 nvram_set("1:sar5g", "15");
2284 nvram_set("1:sb20in40hrpo", "0");
2285 nvram_set("1:sb20in40lrpo", "0");
2286 nvram_set("1:sb20in80and160hr5ghpo", "0");
2287 nvram_set("1:sb20in80and160hr5glpo", "0");
2288 nvram_set("1:sb20in80and160hr5gmpo", "0");
2289 nvram_set("1:sb20in80and160lr5ghpo", "0");
2290 nvram_set("1:sb20in80and160lr5glpo", "0");
2291 nvram_set("1:sb20in80and160lr5gmpo", "0");
2292 nvram_set("1:sb40and80hr5ghpo", "0");
2293 nvram_set("1:sb40and80hr5glpo", "0");
2294 nvram_set("1:sb40and80hr5gmpo", "0");
2295 nvram_set("1:sb40and80lr5ghpo", "0");
2296 nvram_set("1:sb40and80lr5glpo", "0");
2297 nvram_set("1:sb40and80lr5gmpo", "0");
2298 nvram_set("1:sromrev", "11");
2299 nvram_set("1:subband5gver", "4");
2300 nvram_set("1:subvid", "0x14e4");
2301 nvram_set("1:tempcorrx", "0x3f");
2302 nvram_set("1:tempoffset", "255");
2303 nvram_set("1:temps_hysteresis", "15");
2304 nvram_set("1:temps_period", "15");
2305 nvram_set("1:tempsense_option", "0x3");
2306 nvram_set("1:tempsense_slope", "0xff");
2307 nvram_set("1:tempthresh", "255");
2308 nvram_set("1:tssiposslope2g", "1");
2309 nvram_set("1:tssiposslope5g", "1");
2310 nvram_set("1:tworangetssi2g", "0");
2311 nvram_set("1:tworangetssi5g", "0");
2312 nvram_set("1:txchain", "7");
2313 nvram_set("1:venid", "0x14e4");
2314 nvram_set("1:xtalfreq", "40000");
2321 #ifdef TCONFIG_AC66U
2323 features
= SUP_SES
| SUP_80211N
| SUP_1000ET
| SUP_80211AC
;
2326 features
= SUP_SES
| SUP_80211N
| SUP_1000ET
;
2327 #if defined(LINUX26) && defined(TCONFIG_MICROSD)
2328 if (nvram_get_int("usb_mmc") == -1) nvram_set("usb_mmc", "1");
2333 nvram_set("usb_uhci", "-1");
2335 if (!nvram_match("t_fix1", (char *)name
)) {
2336 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
2337 nvram_set("wan_ifnameX", "vlan2");
2338 nvram_set("wl_ifnames", "eth1 eth2");
2339 #ifdef TCONFIG_AC66U
2340 nvram_set("wl_ifname", "eth1");
2341 nvram_set("wl0_ifname", "eth1");
2342 nvram_set("wl1_ifname", "eth2");
2344 nvram_set("landevs", "vlan1 wl0 wl1");
2345 nvram_set("wandevs", "vlan2");
2346 #ifndef TCONFIG_AC66U
2347 #if defined(LINUX26) && defined(TCONFIG_USB)
2348 nvram_set("usb_noled", "1-1.4"); /* SD/MMC Card */
2351 nvram_set("wl1_bw_cap","7");
2352 nvram_set("wl1_chanspec","36/80");
2353 nvram_set("wl0_bw_cap","3");
2354 nvram_set("wl0_chanspec","1l");
2355 nvram_set("blink_5g_interface","eth2");
2358 strcpy(s
, nvram_safe_get("et0macaddr"));
2360 nvram_set("wl0_hwaddr", s
);
2362 nvram_set("wl1_hwaddr", s
);
2364 // bcm4360ac_defaults
2365 nvram_set("pci/2/1/aa2g", "0");
2366 nvram_set("pci/2/1/aa5g", "7");
2367 nvram_set("pci/2/1/aga0", "71");
2368 nvram_set("pci/2/1/aga1", "71");
2369 nvram_set("pci/2/1/aga2", "71");
2370 nvram_set("pci/2/1/agbg0", "133");
2371 nvram_set("pci/2/1/agbg1", "133");
2372 nvram_set("pci/2/1/agbg2", "133");
2373 nvram_set("pci/2/1/antswitch", "0");
2374 nvram_set("pci/2/1/cckbw202gpo", "0");
2375 nvram_set("pci/2/1/cckbw20ul2gpo", "0");
2376 nvram_set("pci/2/1/dot11agofdmhrbw202gpo", "0");
2377 nvram_set("pci/2/1/femctrl", "3");
2378 nvram_set("pci/2/1/papdcap2g", "0");
2379 nvram_set("pci/2/1/tworangetssi2g", "0");
2380 nvram_set("pci/2/1/pdgain2g", "4");
2381 nvram_set("pci/2/1/epagain2g", "0");
2382 nvram_set("pci/2/1/tssiposslope2g", "1");
2383 nvram_set("pci/2/1/gainctrlsph", "0");
2384 nvram_set("pci/2/1/papdcap5g", "0");
2385 nvram_set("pci/2/1/tworangetssi5g", "0");
2386 nvram_set("pci/2/1/pdgain5g", "4");
2387 nvram_set("pci/2/1/epagain5g", "0");
2388 nvram_set("pci/2/1/tssiposslope5g", "1");
2389 nvram_set("pci/2/1/maxp2ga0", "76");
2390 nvram_set("pci/2/1/maxp2ga1", "76");
2391 nvram_set("pci/2/1/maxp2ga2", "76");
2392 nvram_set("pci/2/1/mcsbw202gpo", "0");
2393 nvram_set("pci/2/1/mcsbw402gpo", "0");
2394 nvram_set("pci/2/1/measpower", "0x7f");
2395 nvram_set("pci/2/1/measpower1", "0x7f");
2396 nvram_set("pci/2/1/measpower2", "0x7f");
2397 nvram_set("pci/2/1/noiselvl2ga0", "31");
2398 nvram_set("pci/2/1/noiselvl2ga1", "31");
2399 nvram_set("pci/2/1/noiselvl2ga2", "31");
2400 nvram_set("pci/2/1/noiselvl5gha0", "31");
2401 nvram_set("pci/2/1/noiselvl5gha1", "31");
2402 nvram_set("pci/2/1/noiselvl5gha2", "31");
2403 nvram_set("pci/2/1/noiselvl5gla0", "31");
2404 nvram_set("pci/2/1/noiselvl5gla1", "31");
2405 nvram_set("pci/2/1/noiselvl5gla2", "31");
2406 nvram_set("pci/2/1/noiselvl5gma0", "31");
2407 nvram_set("pci/2/1/noiselvl5gma1", "31");
2408 nvram_set("pci/2/1/noiselvl5gma2", "31");
2409 nvram_set("pci/2/1/noiselvl5gua0", "31");
2410 nvram_set("pci/2/1/noiselvl5gua1", "31");
2411 nvram_set("pci/2/1/noiselvl5gua2", "31");
2412 nvram_set("pci/2/1/ofdmlrbw202gpo", "0");
2413 nvram_set("pci/2/1/pa2ga0", "0xfe72,0x14c0,0xfac7");
2414 nvram_set("pci/2/1/pa2ga1", "0xfe80,0x1472,0xfabc");
2415 nvram_set("pci/2/1/pa2ga2", "0xfe82,0x14bf,0xfad9");
2416 nvram_set("pci/2/1/pcieingress_war", "15");
2417 nvram_set("pci/2/1/phycal_tempdelta", "255");
2418 nvram_set("pci/2/1/rawtempsense", "0x1ff");
2419 nvram_set("pci/2/1/rxchain", "7");
2420 nvram_set("pci/2/1/rxgainerr2g", "0xffff");
2421 nvram_set("pci/2/1/rxgainerr5g", "0xffff,0xffff,0xffff,0xffff");
2422 nvram_set("pci/2/1/rxgains2gelnagaina0", "0");
2423 nvram_set("pci/2/1/rxgains2gelnagaina1", "0");
2424 nvram_set("pci/2/1/rxgains2gelnagaina2", "0");
2425 nvram_set("pci/2/1/rxgains2gtrelnabypa0", "0");
2426 nvram_set("pci/2/1/rxgains2gtrelnabypa1", "0");
2427 nvram_set("pci/2/1/rxgains2gtrelnabypa2", "0");
2428 nvram_set("pci/2/1/rxgains2gtrisoa0", "0");
2429 nvram_set("pci/2/1/rxgains2gtrisoa1", "0");
2430 nvram_set("pci/2/1/rxgains2gtrisoa2", "0");
2431 nvram_set("pci/2/1/sar2g", "18");
2432 nvram_set("pci/2/1/sar5g", "15");
2433 nvram_set("pci/2/1/sromrev", "11");
2434 nvram_set("pci/2/1/subband5gver", "0x4");
2435 nvram_set("pci/2/1/tempcorrx", "0x3f");
2436 nvram_set("pci/2/1/tempoffset", "255");
2437 nvram_set("pci/2/1/temps_hysteresis", "15");
2438 nvram_set("pci/2/1/temps_period", "15");
2439 nvram_set("pci/2/1/tempsense_option", "0x3");
2440 nvram_set("pci/2/1/tempsense_slope", "0xff");
2441 nvram_set("pci/2/1/tempthresh", "255");
2442 nvram_set("pci/2/1/txchain", "7");
2443 nvram_set("pci/2/1/ledbh0", "2");
2444 nvram_set("pci/2/1/ledbh1", "5");
2445 nvram_set("pci/2/1/ledbh2", "4");
2446 nvram_set("pci/2/1/ledbh3", "11");
2447 nvram_set("pci/2/1/ledbh10", "7");
2449 //force EU country for eth2
2450 nvram_set("pci/2/1/ccode", "EU");
2451 #endif // TCONFIG_AC66U
2454 #ifdef CONFIG_BCMWL6
2458 features
= SUP_SES
| SUP_80211N
| SUP_1000ET
| SUP_80211AC
;
2460 nvram_set("usb_uhci", "-1");
2462 if (!nvram_match("t_fix1", (char *)name
)) {
2463 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
2464 nvram_set("wan_ifnameX", "vlan2");
2465 nvram_set("wl_ifnames", "eth1 eth2");
2466 nvram_set("wl_ifname", "eth1");
2467 nvram_set("wl0_ifname", "eth2");
2468 nvram_set("wl1_ifname", "eth1");
2469 nvram_set("wl0_bw_cap","7");
2470 nvram_set("wl0_chanspec","36/80");
2471 nvram_set("wl1_bw_cap","3");
2472 nvram_set("wl1_chanspec","1l");
2473 nvram_set("blink_5g_interface","eth1");
2474 //nvram_set("landevs", "vlan1 wl0 wl1");
2475 //nvram_set("wandevs", "vlan2");
2478 strcpy(s
, nvram_safe_get("et0macaddr"));
2479 nvram_set("wl0_hwaddr", nvram_safe_get("0:macaddr"));
2480 nvram_set("wl1_hwaddr", nvram_safe_get("1:macaddr"));
2482 // fix ssid according to 5G(eth2) and 2.4G(eth1)
2483 nvram_set("wl_ssid","Tomato50");
2484 nvram_set("wl0_ssid","Tomato50");
2485 nvram_set("wl1_ssid","Tomato24");
2490 if (nvram_match("product", "WLI-H4-D1300")) {
2491 name
= "WLI-H4-D1300";
2493 else if (nvram_match("product", "WZR-D1100H")) {
2494 name
= "WZR-D1100H";
2497 name
= "WZR-D1800H";
2499 features
= SUP_SES
| SUP_AOSS_LED
| SUP_80211N
| SUP_1000ET
| SUP_80211AC
;
2501 nvram_set("usb_uhci", "-1");
2503 if (!nvram_match("t_fix1", (char *)name
)) {
2504 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
2505 nvram_set("wan_ifnameX", "vlan2");
2506 nvram_set("wl_ifnames", "eth1 eth2");
2507 nvram_set("wl_ifname", "eth1");
2508 nvram_set("wl0_ifname", "eth2");
2509 nvram_set("wl1_ifname", "eth1");
2510 nvram_set("wl0_bw_cap","7");
2511 nvram_set("wl0_chanspec","36/80");
2512 nvram_set("wl1_bw_cap","3");
2513 nvram_set("wl1_chanspec","1l");
2514 nvram_set("blink_5g_interface","eth1");
2517 strcpy(s
, nvram_safe_get("et0macaddr"));
2520 for (i
= 0; i
< strlen(s
); i
++) if ( s
[i
] == '-') s
[i
] = ':';
2521 nvram_set("et0macaddr",s
);
2523 nvram_set("wl0_hwaddr", s
);
2525 nvram_set("wl1_hwaddr", s
);
2527 // fix ssid according to 5G(eth2) and 2.4G(eth1)
2528 nvram_set("wl_ssid","Tomato50");
2529 nvram_set("wl0_ssid","Tomato50");
2530 nvram_set("wl1_ssid","Tomato24");
2532 nvram_set("pci/2/1/maxp2ga0", "0x70");
2533 nvram_set("pci/2/1/maxp2ga1", "0x70");
2534 nvram_set("pci/2/1/maxp2ga2", "0x70");
2535 nvram_set("pci/2/1/maxp5ga0", "0x6A");
2536 nvram_set("pci/2/1/maxp5ga1", "0x6A");
2537 nvram_set("pci/2/1/maxp5ga2", "0x6A");
2538 nvram_set("pci/2/1/cckbw202gpo", "0x5555");
2539 nvram_set("pci/2/1/cckbw20ul2gpo", "0x5555");
2540 nvram_set("pci/2/1/legofdmbw202gpo", "0x97555555");
2541 nvram_set("pci/2/1/legofdmbw20ul2gpo", "0x97555555");
2542 nvram_set("pci/2/1/mcsbw202gpo", "0xDA755555");
2543 nvram_set("pci/2/1/mcsbw20ul2gpo", "0xDA755555");
2544 nvram_set("pci/2/1/mcsbw402gpo", "0xFC965555");
2545 nvram_set("pci/2/1/cckbw205gpo", "0x5555");
2546 nvram_set("pci/2/1/cckbw20ul5gpo", "0x5555");
2547 nvram_set("pci/2/1/legofdmbw205gpo", "0x97555555");
2548 nvram_set("pci/2/1/legofdmbw20ul5gpo", "0x97555555");
2549 nvram_set("pci/2/1/legofdmbw205gmpo", "0x77777777");
2550 nvram_set("pci/2/1/legofdmbw20ul5gmpo", "0x77777777");
2551 nvram_set("pci/2/1/legofdmbw205ghpo", "0x77777777");
2552 nvram_set("pci/2/1/legofdmbw20ul5ghpo", "0x77777777");
2553 nvram_set("pci/2/1/mcsbw205ghpo", "0x77777777");
2554 nvram_set("pci/2/1/mcsbw20ul5ghpo", "0x77777777");
2555 nvram_set("pci/2/1/mcsbw205gpo", "0xDA755555");
2556 nvram_set("pci/2/1/mcsbw20ul5gpo", "0xDA755555");
2557 nvram_set("pci/2/1/mcsbw405gpo", "0xFC965555");
2558 nvram_set("pci/2/1/mcsbw405ghpo", "0x77777777");
2559 nvram_set("pci/2/1/mcsbw405ghpo", "0x77777777");
2560 nvram_set("pci/2/1/mcs32po", "0x7777");
2561 nvram_set("pci/2/1/legofdm40duppo", "0x0000");
2562 nvram_set("pci/1/1/maxp5ga0", "104,104,104,104");
2563 nvram_set("pci/1/1/maxp5ga1", "104,104,104,104");
2564 nvram_set("pci/1/1/maxp5ga2", "104,104,104,104");
2565 nvram_set("pci/1/1/mcsbw205glpo", "0xBB975311");
2566 nvram_set("pci/1/1/mcsbw405glpo", "0xBB975311");
2567 nvram_set("pci/1/1/mcsbw805glpo", "0xBB975311");
2568 nvram_set("pci/1/1/mcsbw205gmpo", "0xBB975311");
2569 nvram_set("pci/1/1/mcsbw405gmpo", "0xBB975311");
2570 nvram_set("pci/1/1/mcsbw805gmpo", "0xBB975311");
2571 nvram_set("pci/1/1/mcsbw205ghpo", "0xBB975311");
2572 nvram_set("pci/1/1/mcsbw405ghpo", "0xBB975311");
2573 nvram_set("pci/1/1/mcsbw805ghpo", "0xBB975311");
2575 //force US country for 5G eth1, modified by bwq518
2576 nvram_set("pci/1/1/ccode", "US");
2577 nvram_set("wl1_country_code", "US");
2578 nvram_set("regulation_domain_5G", "US");
2581 case MODEL_EA6500V1
:
2584 features
= SUP_SES
| SUP_80211N
| SUP_1000ET
| SUP_80211AC
;
2586 nvram_set("usb_uhci", "-1");
2588 if (!nvram_match("t_fix1", (char *)name
)) {
2589 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
2590 nvram_set("wan_ifnameX", "vlan2");
2591 nvram_set("wl_ifnames", "eth1 eth2");
2592 nvram_set("wl_ifname", "eth1");
2593 nvram_set("wl0_ifname", "eth1");
2594 nvram_set("wl1_ifname", "eth2");
2595 nvram_set("wl0_bw_cap","7");
2596 nvram_set("wl0_chanspec","36/80");
2597 nvram_set("wl1_bw_cap","3");
2598 nvram_set("wl1_chanspec","1l");
2599 nvram_set("blink_5g_interface","eth1");
2601 // fix ssid according to 5G(eth1) and 2.4G(eth2)
2602 nvram_set("wl_ssid","Tomato50");
2603 nvram_set("wl0_ssid","Tomato50");
2604 nvram_set("wl1_ssid","Tomato24");
2606 //force US country for 5G eth1, modified by bwq518
2607 nvram_set("pci/1/1/ccode", nvram_safe_get("ccode"));
2608 nvram_set("regulation_domain_5G", nvram_safe_get("ccode"));
2611 #endif // CONFIG_BCMWL6
2612 case MODEL_WNR3500L
:
2614 name
= "WNR3500L/U/v2";
2615 features
= SUP_SES
| SUP_AOSS_LED
| SUP_80211N
| SUP_1000ET
;
2616 if (!nvram_match("t_fix1", (char *)name
)) {
2617 nvram_set("sromrev", "3");
2618 nvram_set("lan_ifnames", "vlan1 eth1");
2619 nvram_set("wan_ifnameX", "vlan2");
2620 nvram_set("wl_ifname", "eth1");
2623 case MODEL_WNR3500LV2
:
2625 name
= "WNR3500L v2";
2626 features
= SUP_SES
| SUP_AOSS_LED
| SUP_80211N
| SUP_1000ET
;
2627 if (!nvram_match("t_fix1", (char *)name
)) {
2628 nvram_set("lan_ifnames", "vlan1 eth1");
2629 nvram_set("wan_ifnameX", "vlan2");
2630 nvram_set("wl_ifname", "eth1");
2633 case MODEL_WNR2000v2
:
2635 name
= "WNR2000 v2";
2636 features
= SUP_SES
| SUP_AOSS_LED
| SUP_80211N
;
2637 if (!nvram_match("t_fix1", (char *)name
)) {
2638 nvram_set("lan_ifnames", "vlan0 eth1");
2639 nvram_set("wan_ifnameX", "vlan1");
2640 nvram_set("wl_ifname", "eth1");
2647 case MODEL_F5D8235v3
:
2649 features
= SUP_SES
| SUP_80211N
;
2652 name
= "Share Max N300 (F7D3301/F7D7301) v1";
2655 name
= "Share N300 (F7D3302/F7D7302) v1";
2658 name
= "Play Max / N600 HD (F7D4301/F7D8301) v1";
2661 name
= "Play N600 (F7D4302/F7D8302) v1";
2663 case MODEL_F5D8235v3
:
2664 name
= "N F5D8235-4 v3";
2668 nvram_set("usb_uhci", "-1");
2670 if (!nvram_match("t_fix1", (char *)name
)) {
2671 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
2672 nvram_set("wan_ifnameX", "vlan2");
2673 nvram_set("landevs", "vlan1 wl0 wl1");
2674 nvram_set("wandevs", "vlan2");
2680 name
= nvram_safe_get("boot_hw_model");
2681 ver
= nvram_safe_get("boot_hw_ver");
2682 features
= SUP_SES
| SUP_80211N
;
2683 if (!nvram_match("t_fix1", (char *)name
)) {
2684 nvram_set("lan_ifnames", "vlan1 eth1");
2685 nvram_set("wan_ifnameX", "vlan2");
2686 nvram_set("wl_ifname", "eth1");
2691 name
= nvram_safe_get("boot_hw_model");
2692 ver
= nvram_safe_get("boot_hw_ver");
2693 features
= SUP_SES
| SUP_80211N
;
2695 nvram_set("usb_uhci", "-1");
2697 if (!nvram_match("t_fix1", (char *)name
)) {
2698 nvram_set("lan_ifnames", "vlan1 eth1");
2699 nvram_set("wan_ifnameX", "vlan2");
2700 nvram_set("wl_ifname", "eth1");
2705 name
= nvram_safe_get("boot_hw_model");
2706 ver
= nvram_safe_get("boot_hw_ver");
2707 features
= SUP_SES
| SUP_80211N
;
2708 #if defined(LINUX26) && defined(TCONFIG_USBAP)
2709 if (nvram_get_int("usb_storage") == 1) nvram_set("usb_storage", "-1");
2711 if (!nvram_match("t_fix1", (char *)name
)) {
2712 #ifdef TCONFIG_USBAP
2713 nvram_set("wl1_hwaddr", nvram_safe_get("0:macaddr"));
2714 nvram_set("ehciirqt", "3");
2715 nvram_set("qtdc_pid", "48407");
2716 nvram_set("qtdc_vid", "2652");
2717 nvram_set("qtdc0_ep", "4");
2718 nvram_set("qtdc0_sz", "0");
2719 nvram_set("qtdc1_ep", "18");
2720 nvram_set("qtdc1_sz", "10");
2721 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
2722 nvram_set("landevs", "vlan1 wl0 wl1");
2723 nvram_set("wl0_ifname", "eth1");
2724 nvram_set("wl1_ifname", "eth2");
2726 nvram_set("lan_ifnames", "vlan1 eth1");
2727 nvram_set("landevs", "vlan1 wl0");
2729 nvram_set("wan_ifnameX", "vlan2");
2730 nvram_set("wl_ifname", "eth1");
2736 name
= nvram_safe_get("boot_hw_model");
2737 ver
= nvram_safe_get("boot_hw_ver");
2738 features
= SUP_SES
| SUP_80211N
| SUP_1000ET
;
2740 nvram_set("usb_uhci", "-1");
2742 if (!nvram_match("t_fix1", (char *)name
)) {
2743 #ifdef TCONFIG_USBAP
2744 nvram_set("wl1_hwaddr", nvram_safe_get("usb/0xBD17/macaddr"));
2745 nvram_set("ehciirqt", "3");
2746 nvram_set("qtdc_pid", "48407");
2747 nvram_set("qtdc_vid", "2652");
2748 nvram_set("qtdc0_ep", "4");
2749 nvram_set("qtdc0_sz", "0");
2750 nvram_set("qtdc1_ep", "18");
2751 nvram_set("qtdc1_sz", "10");
2752 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
2753 nvram_set("landevs", "vlan1 wl0 wl1");
2754 nvram_set("wl0_ifname", "eth1");
2755 nvram_set("wl1_ifname", "eth2");
2757 nvram_set("lan_ifnames", "vlan1 eth1");
2758 nvram_set("landevs", "vlan1 wl0");
2760 nvram_set("wl_ifname", "eth1");
2761 nvram_set("wan_ifnameX", "vlan2");
2765 case MODEL_WRT160Nv3
:
2766 // same as M10, M20, WRT310Nv2, E1000v1
2768 name
= nvram_safe_get("boot_hw_model");
2769 ver
= nvram_safe_get("boot_hw_ver");
2770 if (nvram_match("boot_hw_model", "E100")){
2773 if (nvram_match("boot_hw_model", "M10") || nvram_match("boot_hw_model", "M20")){
2776 features
= SUP_SES
| SUP_80211N
| SUP_WHAM_LED
;
2777 if (!nvram_match("t_fix1", (char *)name
)) {
2778 nvram_set("lan_ifnames", "vlan1 eth1");
2779 nvram_set("wan_ifnameX", "vlan2");
2780 nvram_set("wl_ifname", "eth1");
2785 name
= nvram_match("boardrev", "0x1307") ? "E2000" : "WRT320N";
2786 features
= SUP_SES
| SUP_80211N
| SUP_WHAM_LED
| SUP_1000ET
;
2787 if (!nvram_match("t_fix1", (char *)name
)) {
2788 nvram_set("lan_ifnames", "vlan1 eth1");
2789 nvram_set("wan_ifnameX", "vlan2");
2790 nvram_set("wl_ifname", "eth1");
2793 case MODEL_WRT610Nv2
:
2795 name
= nvram_match("boot_hw_model", "E300") ? "E3000" : "WRT610N v2";
2796 features
= SUP_SES
| SUP_80211N
| SUP_WHAM_LED
| SUP_1000ET
;
2798 nvram_set("usb_uhci", "-1");
2800 if (!nvram_match("t_fix1", (char *)name
)) {
2801 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
2802 nvram_set("wan_ifnameX", "vlan2");
2803 nvram_set("wl_ifname", "eth1");
2809 features
= SUP_SES
| SUP_80211N
| SUP_1000ET
;
2811 nvram_set("usb_uhci", "-1");
2813 if (!nvram_match("t_fix1", (char *)name
)) {
2814 nvram_set("lan_ifnames", "vlan1 eth1 eth2");
2815 nvram_set("wan_ifnameX", "vlan2");
2816 nvram_set("wl_ifname", "eth1");
2819 #endif // CONFIG_BCMWL5
2824 // The 330gE has only one wired port which can act either as WAN or LAN.
2825 // Failsafe mode is to have it start as a LAN port so you can get an IP
2826 // address via DHCP and access the router config page.
2827 if (!nvram_match("t_fix1", (char *)name
)) {
2828 nvram_set("wl_ifname", "eth1");
2829 nvram_set("lan_ifnames", "eth1");
2830 nvram_set("wan_ifnameX", "eth0");
2831 nvram_set("wan_islan", "1");
2832 nvram_set("wan_proto", "disabled");
2835 case MODEL_WL500GPv2
:
2837 name
= "WL-500gP v2";
2840 nvram_set("usb_uhci", "-1");
2848 nvram_set("usb_uhci", "-1");
2853 name
= "WL-500g Deluxe";
2854 // features = SUP_SES;
2856 nvram_set("usb_ohci", "-1");
2858 if (!nvram_match("t_fix1", (char *)name
)) {
2859 nvram_set("wl_ifname", "eth1");
2860 nvram_set("lan_ifnames", "vlan0 eth1");
2861 nvram_set("wan_ifnameX", "vlan1");
2862 nvram_unset("wl0gpio0");
2869 if (!nvram_match("t_fix1", (char *)name
)) {
2870 nvram_set("wan_ifnameX", "vlan1");
2871 nvram_set("wl_ifname", "eth1");
2876 name
= "ZXV10 H618B";
2877 features
= SUP_SES
| SUP_AOSS_LED
;
2879 nvram_set("usb_uhci", "-1");
2881 if (!nvram_match("t_fix1", (char *)name
)) {
2882 nvram_set("lan_ifnames", "vlan0 eth1");
2883 nvram_set("wan_ifname", "vlan1");
2884 nvram_set("wan_ifnames", "vlan1");
2885 nvram_set("wan_ifnameX", "vlan1");
2886 nvram_set("wl_ifname", "eth1");
2889 case MODEL_WL1600GL
:
2894 #endif // WL_BSS_INFO_VERSION >= 108
2895 case MODEL_WZRG300N
:
2898 features
= SUP_SES
| SUP_AOSS_LED
| SUP_BRAU
| SUP_80211N
;
2900 case MODEL_WRT160Nv1
:
2903 name
= (model
== MODEL_WRT300N
) ? "WRT300N v1" : "WRT160N v1";
2904 features
= SUP_SES
| SUP_80211N
;
2905 if (!nvram_match("t_fix1", (char *)name
)) {
2906 nvram_set("wan_ifnameX", "eth1");
2907 nvram_set("lan_ifnames", "eth0 eth2");
2910 case MODEL_WRT310Nv1
:
2912 name
= "WRT310N v1";
2913 features
= SUP_SES
| SUP_80211N
| SUP_WHAM_LED
| SUP_1000ET
;
2914 if (!nvram_match("t_fix1", (char *)name
)) {
2915 nvram_set("lan_ifnames", "vlan1 eth1");
2916 nvram_set("wan_ifnameX", "vlan2");
2917 nvram_set("wl_ifname", "eth1");
2923 nvram_set("t_fix1", name
);
2924 if (ver
&& strcmp(ver
, "")) {
2925 sprintf(s
, "%s %s v%s", mfr
, name
, ver
);
2927 sprintf(s
, "%s %s", mfr
, name
);
2931 snprintf(s
, sizeof(s
), "%s %d/%s/%s/%s/%s", mfr
, check_hw_type(),
2932 nvram_safe_get("boardtype"), nvram_safe_get("boardnum"), nvram_safe_get("boardrev"), nvram_safe_get("boardflags"));
2935 nvram_set("t_model_name", s
);
2937 nvram_set("pa0maxpwr", "400"); // allow Tx power up tp 400 mW, needed for ND only
2939 sprintf(s
, "0x%lX", features
);
2940 nvram_set("t_features", s
);
2943 note: set wan_ifnameX if wan_ifname needs to be overriden
2946 if (nvram_is_empty("wan_ifnameX")) {
2948 nvram_set("wan_ifnameX", ((strtoul(nvram_safe_get("boardflags"), NULL
, 0) & BFL_ENETVLAN
) ||
2949 (check_hw_type() == HW_BCM4712
)) ? "vlan1" : "eth1");
2951 p
= nvram_safe_get("wan_ifname");
2952 if ((*p
== 0) || (nvram_match("wl_ifname", p
))) {
2953 p
= ((strtoul(nvram_safe_get("boardflags"), NULL
, 0) & BFL_ENETVLAN
) ||
2954 (check_hw_type() == HW_BCM4712
)) ? "vlan1" : "eth1";
2956 nvram_set("wan_ifnameX", p
);
2960 //!!TB - do not force country code here to allow nvram override
2961 //nvram_set("wl_country", "JP");
2962 //nvram_set("wl_country_code", "JP");
2963 nvram_set("wan_get_dns", "");
2964 nvram_set("wan_get_domain", "");
2965 nvram_set("ppp_get_ip", "");
2966 nvram_set("action_service", "");
2967 nvram_set("jffs2_format", "0");
2968 nvram_set("rrules_radio", "-1");
2969 nvram_unset("https_crt_gen");
2970 nvram_unset("log_wmclear");
2972 nvram_set("ipv6_get_dns", "");
2974 #ifdef TCONFIG_MEDIA_SERVER
2975 nvram_unset("ms_rescan");
2977 if (nvram_get_int("http_id_gen") == 1) nvram_unset("http_id");
2979 nvram_unset("sch_rboot_last");
2980 nvram_unset("sch_rcon_last");
2981 nvram_unset("sch_c1_last");
2982 nvram_unset("sch_c2_last");
2983 nvram_unset("sch_c3_last");
2985 nvram_set("brau_state", "");
2986 if ((features
& SUP_BRAU
) == 0) nvram_set("script_brau", "");
2987 if ((features
& SUP_SES
) == 0) nvram_set("sesx_script", "");
2989 if ((features
& SUP_1000ET
) == 0) nvram_set("jumbo_frame_enable", "0");
2991 // compatibility with old versions
2992 if (nvram_match("wl_net_mode", "disabled")) {
2993 nvram_set("wl_radio", "0");
2994 nvram_set("wl_net_mode", "mixed");
3000 #ifndef TCONFIG_BCMARM
3001 /* Get the special files from nvram and copy them to disc.
3002 * These were files saved with "nvram setfile2nvram <filename>".
3003 * Better hope that they were saved with full pathname.
3005 static void load_files_from_nvram(void)
3009 char buf
[NVRAM_SPACE
];
3011 if (nvram_getall(buf
, sizeof(buf
)) != 0)
3014 for (name
= buf
; *name
; name
+= strlen(name
) + 1) {
3015 if (strncmp(name
, "FILE:", 5) == 0) { /* This special name marks a file to get. */
3016 if ((cp
= strchr(name
, '=')) == NULL
)
3019 syslog(LOG_INFO
, "Loading file '%s' from nvram", name
+ 5);
3020 nvram_nvram2file(name
, name
+ 5);
3021 if (memcmp(".autorun", cp
- 8, 9) == 0)
3025 /* Start any autorun files that may have been loaded into one of the standard places. */
3027 run_nvscript(".autorun", NULL
, 3);
3031 #if defined(LINUX26) && defined(TCONFIG_USB)
3032 static inline void tune_min_free_kbytes(void)
3034 struct sysinfo info
;
3036 memset(&info
, 0, sizeof(struct sysinfo
));
3038 if (info
.totalram
>= 55 * 1024 * 1024) {
3039 // If we have 64MB+ RAM, tune min_free_kbytes
3040 // to reduce page allocation failure errors.
3041 f_write_string("/proc/sys/vm/min_free_kbytes", "8192", 0, 0);
3046 static void sysinit(void)
3048 static int noconsole
= 0;
3049 static const time_t tm
= 0;
3057 mount("proc", "/proc", "proc", 0, NULL
);
3058 mount("tmpfs", "/tmp", "tmpfs", 0, NULL
);
3061 mount("devfs", "/dev", "tmpfs", MS_MGC_VAL
| MS_NOATIME
, NULL
);
3062 mknod("/dev/null", S_IFCHR
| 0666, makedev(1, 3));
3063 mknod("/dev/console", S_IFCHR
| 0600, makedev(5, 1));
3064 mount("sysfs", "/sys", "sysfs", MS_MGC_VAL
, NULL
);
3065 mkdir("/dev/shm", 0777);
3066 mkdir("/dev/pts", 0777);
3067 mknod("/dev/pts/ptmx", S_IRWXU
|S_IFCHR
, makedev(5, 2));
3068 mknod("/dev/pts/0", S_IRWXU
|S_IFCHR
, makedev(136, 0));
3069 mknod("/dev/pts/1", S_IRWXU
|S_IFCHR
, makedev(136, 1));
3070 mount("devpts", "/dev/pts", "devpts", MS_MGC_VAL
, NULL
);
3073 if (console_init()) noconsole
= 1;
3077 static const char *mkd
[] = {
3078 "/tmp/etc", "/tmp/var", "/tmp/home", "/tmp/mnt",
3079 "/tmp/splashd", //!!Victek
3080 "/tmp/share", "/var/webmon", // !!TB
3081 "/var/log", "/var/run", "/var/tmp", "/var/lib", "/var/lib/misc",
3082 "/var/spool", "/var/spool/cron", "/var/spool/cron/crontabs",
3083 "/tmp/var/wwwext", "/tmp/var/wwwext/cgi-bin", // !!TB - CGI support
3087 for (i
= 0; mkd
[i
]; ++i
) {
3088 mkdir(mkd
[i
], 0755);
3090 mkdir("/var/lock", 0777);
3091 mkdir("/var/tmp/dhcp", 0777);
3092 mkdir("/home/root", 0700);
3093 chmod("/tmp", 0777);
3094 f_write("/etc/hosts", NULL
, 0, 0, 0644); // blank
3095 f_write("/etc/fstab", NULL
, 0, 0, 0644); // !!TB - blank
3096 simple_unlock("cron");
3097 simple_unlock("firewall");
3098 simple_unlock("restrictions");
3101 if ((d
= opendir("/rom/etc")) != NULL
) {
3102 while ((de
= readdir(d
)) != NULL
) {
3103 if (de
->d_name
[0] == '.') continue;
3104 snprintf(s
, sizeof(s
), "%s/%s", "/rom/etc", de
->d_name
);
3105 snprintf(t
, sizeof(t
), "%s/%s", "/etc", de
->d_name
);
3110 symlink("/proc/mounts", "/etc/mtab");
3112 #ifdef TCONFIG_SAMBASRV
3113 if ((d
= opendir("/usr/codepages")) != NULL
) {
3114 while ((de
= readdir(d
)) != NULL
) {
3115 if (de
->d_name
[0] == '.') continue;
3116 snprintf(s
, sizeof(s
), "/usr/codepages/%s", de
->d_name
);
3117 snprintf(t
, sizeof(t
), "/usr/share/%s", de
->d_name
);
3125 eval("hotplug2", "--coldplug");
3128 static const char *dn
[] = {
3129 "null", "zero", "random", "urandom", "full", "ptmx", "nvram",
3132 for (i
= 0; dn
[i
]; ++i
) {
3133 snprintf(s
, sizeof(s
), "/dev/%s", dn
[i
]);
3136 chmod("/dev/gpio", 0660);
3139 set_action(ACT_IDLE
);
3141 for (i
= 0; defenv
[i
]; ++i
) {
3146 printf("\n\nHit ENTER for console...\n\n");
3153 // disable IPv6 by default on all interfaces
3154 f_write_string("/proc/sys/net/ipv6/conf/default/disable_ipv6", "1", 0, 0);
3157 for (i
= 0; i
< sizeof(fatalsigs
) / sizeof(fatalsigs
[0]); i
++) {
3158 signal(fatalsigs
[i
], handle_fatalsigs
);
3160 signal(SIGCHLD
, handle_reap
);
3162 #ifdef CONFIG_BCMWL5
3163 // ctf must be loaded prior to any other modules
3164 if (nvram_invmatch("ctf_disable", "1"))
3173 switch (hardware
= check_hw_type()) {
3175 modprobe("bcm57xx");
3182 //load after initnvram as Broadcom Wl require pci/x/1/devid and pci/x/1/macaddr nvram to be set first for DIR-865L
3183 //else 5G interface will not start!
3184 //must be tested on other routers to determine if loading nvram 1st will cause problems!
3187 //config_loopback();
3189 // eval("nvram", "defaults", "--initcheck");
3190 restore_defaults(); // restore default if necessary
3193 // set the packet size
3194 if (nvram_get_int("jumbo_frame_enable")) {
3195 // only set the size here - 'enable' flag is set by the driver
3196 // eval("et", "robowr", "0x40", "0x01", "0x1F"); // (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4)
3197 eval("et", "robowr", "0x40", "0x05", nvram_safe_get("jumbo_frame_size"));
3200 //load after init_nvram
3205 klogctl(8, NULL
, nvram_get_int("console_loglevel"));
3207 #if defined(LINUX26) && defined(TCONFIG_USB)
3208 tune_min_free_kbytes();
3211 set_host_domain_name();
3217 #ifdef CONFIG_BCMWL6
3221 if (!noconsole
) xstart("console");
3223 i
= nvram_get_int("sesx_led");
3224 led(LED_AMBER
, (i
& 1) != 0);
3225 led(LED_WHITE
, (i
& 2) != 0);
3226 led(LED_AOSS
, (i
& 4) != 0);
3227 led(LED_BRIDGE
, (i
& 8) != 0);
3231 int init_main(int argc
, char *argv
[])
3237 nvram_unset("debug_rc_svc");
3241 sigemptyset(&sigset
);
3242 for (i
= 0; i
< sizeof(initsigs
) / sizeof(initsigs
[0]); i
++) {
3243 sigaddset(&sigset
, initsigs
[i
]);
3245 sigprocmask(SIG_BLOCK
, &sigset
, NULL
);
3247 #if defined(DEBUG_NOISY)
3248 nvram_set("debug_logeval", "1");
3249 nvram_set("debug_cprintf", "1");
3250 nvram_set("debug_cprintf_file", "1");
3251 nvram_set("debug_ddns", "1");
3256 state
= SIGUSR2
; /* START */
3259 TRACE_PT("main loop signal/state=%d\n", state
);
3262 case SIGUSR1
: /* USER1: service handler */
3266 case SIGHUP
: /* RESTART */
3267 case SIGINT
: /* STOP */
3268 case SIGQUIT
: /* HALT */
3269 case SIGTERM
: /* REBOOT */
3271 unlink("/var/notice/sysup");
3273 if( nvram_match( "webmon_bkp", "1" ) )
3274 xstart( "/usr/sbin/webmon_bkp", "hourly" ); // make a copy before halt/reboot router
3276 run_nvscript("script_shut", NULL
, 10);
3284 if ((state
== SIGTERM
/* REBOOT */) ||
3285 (state
== SIGQUIT
/* HALT */)) {
3286 remove_storage_main(1);
3289 shutdn(state
== SIGTERM
/* REBOOT */);
3292 if (state
== SIGINT
/* STOP */) {
3296 // SIGHUP (RESTART) falls through
3298 case SIGUSR2
: /* START */
3299 SET_LED(RELEASE_WAN_CONTROL
);
3302 #ifndef TCONFIG_BCMARM
3303 load_files_from_nvram();
3307 fd
= file_lock("usb"); // hold off automount processing
3310 xstart("/usr/sbin/mymotd", "init");
3311 run_nvscript("script_init", NULL
, 2);
3313 file_unlock(fd
); // allow to process usb hotplug events
3316 * On RESTART some partitions can stay mounted if they are busy at the moment.
3317 * In that case USB drivers won't unload, and hotplug won't kick off again to
3318 * remount those drives that actually got unmounted. Make sure to remount ALL
3319 * partitions here by simulating hotplug event.
3321 if (state
== SIGHUP
/* RESTART */)
3322 add_remove_usbhost("-1", 1);
3333 #ifdef CONFIG_BCMWL5
3335 /* Restart NAS one more time - for some reason without
3336 * this the new driver doesn't always bring WDS up.
3343 syslog(LOG_INFO
, "%s: Tomato %s", nvram_safe_get("t_model_name"), tomato_version
);
3346 notice_set("sysup", "");
3350 chld_reap(0); /* Periodically reap zombies. */
3352 sigwait(&sigset
, &state
);
3358 int reboothalt_main(int argc
, char *argv
[])
3360 int reboot
= (strstr(argv
[0], "reboot") != NULL
);
3361 puts(reboot
? "Rebooting..." : "Shutting down...");
3364 kill(1, reboot
? SIGTERM
: SIGQUIT
);
3366 /* In the case we're hung, we'll get stuck and never actually reboot.
3367 * The only way out is to pull power.
3368 * So after 'reset_wait' seconds (default: 20), forcibly crash & restart.
3371 int wait
= nvram_get_int("reset_wait") ? : 20;
3372 if ((wait
< 10) || (wait
> 120)) wait
= 10;
3374 f_write("/proc/sysrq-trigger", "s", 1, 0 , 0); /* sync disks */
3376 puts("Still running... Doing machine reset.");
3378 f_write("/proc/sysrq-trigger", "s", 1, 0 , 0); /* sync disks */
3380 f_write("/proc/sysrq-trigger", "b", 1, 0 , 0); /* machine reset */