OpenWrt Forum Archive

Topic: WNDR3700 exploration

The content of this topic has been archived between 1 Oct 2014 and 7 May 2018. Unfortunately there are posts – most likely complete pages – missing.

This is the flash map:

static struct mtd_partition wndr3700_partitions[] = {
    {
        .name        = "uboot",
        .offset        = 0x00000000,
        .size        = 0x50000,
    } , {
        .name        = "env",
        .offset        = 0x00050000,
        .size        = 0x20000,
    } , {
        .name        = "rootfs",
        .offset        = 0x00070000,
        .size        = 0x720000,
    } , {
        .name        = "config",
        .offset        = 0x00790000,
        .size        = 0x10000,
    } , {
        .name        = "config_bak",
        .offset        = 0x007a0000,
        .size        = 0x010000,
    } , {
        .name        = "pot",
        .offset        = 0x007b0000,
        .size        = 0x10000,
    } , {
        .name        = "traffic_meter",
        .offset        = 0x007c0000,
        .size        = 0x10000,
    } , {
        .name        = "language",
        .offset        = 0x007d0000,
        .size        = 0x20000,

    } , {
        .name        = "caldata",
        .offset        = 0x007f0000,
        .size        = 0x10000,
    } , {
        .name        = "mount_fs",
        .offset        = 0x00070040,
        .size        = 0x71FFC0,
    }
};

Here comes a hexdump of "caldata". The lines with a * are skipped blocks with ff or 00.

root@OpenWrt:/# hexdump dev/mtdblock8
0000000 0024 b258 fb49 0024 b258 fb4a 0024 b258
0000010 fb4b 3330 3138 3932 3934 3232 5231 3939
0000020 3543 3030 3833 32ff ffff ffff ffff ffff
0000030 ffff ffff ffff ffff ffff ffff ffff ffff
*
0001000 a55a 0000 0003 6000 168c 0029 6008 0001
0001010 0280 602c 168c a095 5000 168c 002a 5008
0001020 0001 0280 502c 168c a095 5064 0cc0 0504
0001030 506c 3811 0003 4004 073b 0040 4074 0003
0001040 0000 4000 0000 01c2 6034 0044 0000 ffff
0001050 ffff ffff ffff ffff ffff ffff ffff ffff
*
0001200 0cb8 dd00 e016 0201 0060 001f 0024 b258
0001210 fb49 0303 0000 0000 0000 0009 0700 0401
0001220 00ff 0200 0001 0000 00fb 0000 0000 0000
0001230 0000 0000 0000 0000 0000 0000 0000 0000
*
0001290 0000 002d 0b0b 0b0b 0b0b e000 0e0e 0e00
00012a0 020e 00ca caca 0901 0000 0000 0000 0602
00012b0 0200 0000 0e0e 0200 0000 0000 002c 0000
00012c0 0000 0000 0202 0d09 0000 0000 0000 0000
00012d0 0000 0000 8000 0000 0000 0000 0000 0000
00012e0 0000 0000 0000 0000 0000 0010 0000 0010
00012f0 0000 0000 0000 0120 0000 002d 2020 0b00
0001300 0010 e200 0d0d 0d00 020e 1cff ffff 0601
0001310 0000 0000 0000 0603 0302 0000 0e0e 0200
0001320 0000 0000 002d 0000 0000 0000 0303 0d09
0001330 0000 0000 0000 9200 0092 0000 8000 0000
0001340 0000 0000 0000 0000 0000 0000 0000 0000
0001350 0000 0000 0000 0000 7089 a2ff 0000 0000
0001360 0000 0000 0000 0000 0000 0000 0000 0000
*
0001710 0000 0000 0000 0000 0000 0000 132a 3e56
0001720 6846 586a 7580 0000 0000 0000 0000 0000
0001730 050f 224c 8816 2849 68a5 0000 0000 0000
0001740 0000 0000 152b 4157 6948 596b 7583 0000
0001750 0000 0000 0000 0000 0610 2551 8e18 2a4c
0001760 67a4 0000 0000 0000 0000 0000 142c 4056
0001770 6749 5966 7481 0000 0000 0000 0000 0000
0001780 0711 244f 8619 2b43 66a4 0000 0000 0000
0001790 0000 0000 0000 0000 0000 0000 0000 0000
*
00017b0 0000 0000 0000 0000 0000 0000 142b 4057
00017c0 6748 596c 7785 0000 0000 0000 0000 0000
00017d0 0412 2557 9419 2d54 79a5 0000 0000 0000
00017e0 0000 0000 1830 445b 6848 5b6c 7b81 0000
00017f0 0000 0000 0000 0000 0715 2e64 981a 3255
0001800 8ca5 0000 0000 0000 0000 0000 1830 455b
0001810 6748 5b6b 797e 0000 0000 0000 0000 0000
0001820 0716 326a 991a 3457 8ba5 0000 0000 0000
0001830 0000 0000 0000 0000 0000 0000 0000 0000
*
00018f0 0000 0000 0000 0000 0000 0000 4c22 2222
0001900 2258 2222 2222 5c2a 2a2a 2868 2a2a 2a28
0001910 8c30 2c2a 28b4 302c 2a28 bd2a 2a2a 28cd
0001920 2a2a 2a28 4c22 2222 2222 2222 2258 2222
0001930 2222 2222 2222 5c2a 2a2a 2a28 2826 2668
0001940 2a2a 2a2a 2828 2626 8c30 2c2c 2a28 2826
0001950 26b4 302c 2c2a 2828 2626 bd2a 2a2a 2a28
0001960 2826 26cd 2a2a 2a2a 2828 2626 4e22 2222
0001970 2222 2222 2256 2222 2222 2222 2222 5e2a
0001980 2a2a 2828 2626 2466 2a2a 2a28 2826 2624
0001990 8e30 2a2a 2828 2626 24ae 302a 2a28 2826
00019a0 2624 bf2a 2a2a 2828 2626 24c7 2a2a 2a28
00019b0 2826 2624 7033 3333 33ac 3333 3333 ff00
00019c0 0000 0070 302a 2a2a 8e30 2a2a 2aac 302a
00019d0 2a2a ff00 0000 0070 2f2f 2f2f 2f2a 2a28
00019e0 8e2f 2f2f 2f2f 2a2a 28ac 2f2f 2f2f 2f2a
00019f0 2a28 ff00 0000 0000 0000 007a 2626 2626
0001a00 2626 2626 8926 2626 2626 2626 2698 2626
0001a10 2626 2626 2626 ff00 0000 0000 0000 0010
0001a20 1618 1112 1517 4046 4142 4530 3638 3132
0001a30 3537 0000 0000 004c 1c50 5c5c 6a68 2a8c
0001a40 2390 6ab4 23bd 6a4c 1c50 5c5c 6a68 2a8c
0001a50 2390 6ab4 23bd 6a00 0000 0000 0000 0000
0001a60 0000 0000 0000 004c 1c50 5c5c 6a68 2a8c
0001a70 2390 6ab4 23bd 6a4c 1c50 5c5c 6a68 2a8c
0001a80 2390 6ab4 23bd 6a00 0000 0000 0000 0000
0001a90 0000 0000 0000 004e 1c56 5c5e 6a66 228e
0001aa0 1b96 6aae 26bf 6a4e 1c56 5c5e 6a66 228e
0001ab0 1b96 6aae 26bf 6a00 0000 0000 0000 0000
0001ac0 0000 0000 0000 0070 2e75 73a2 2e00 0000
*
0001ae0 0000 0000 0000 0000 0000 0000 0000 0000
0001af0 0000 0000 0000 0070 2875 70a2 2800 0000
*
0001b10 0000 0000 0000 0000 0000 0000 0000 0000
0001b20 0000 0000 0000 0070 2875 70a2 2800 0000
*
0001b40 0000 0000 0000 0000 0000 0000 0000 0000
0001b50 0000 0000 0000 007a 207f 6693 6698 2000
*
0001b70 0000 0000 0000 0000 0000 0000 0000 0000
0001b80 0000 0000 0000 004a 2250 625c 6268 2200
*
0001ba0 0000 0000 0000 0000 0000 0000 0000 0000
0001bb0 0000 0000 0000 004a 2250 625c 6268 2200
*
0001bd0 0000 0000 0000 0000 0000 0000 0000 0000
0001be0 0000 0000 0000 0070 2275 62ac 62b8 2200
*
0001c00 0000 0000 0000 0000 0000 0000 0000 0000
0001c10 0000 0000 0000 0070 2275 62ac 2200 0000
*
0001c30 0000 0000 0000 0000 0000 0000 0000 0000
0001c40 0000 0000 0000 0070 2275 6298 2200 0000
*
0001c60 0000 0000 0000 0000 0000 0000 0000 0000
0001c70 0000 0000 0000 004c 2250 6268 228c 3090
0001c80 70b4 3000 0000 004c 2250 6268 228c 3090
0001c90 70b4 3000 0000 0000 0000 0000 0000 0000
0001ca0 0000 0000 0000 004c 2250 6268 228c 3090
0001cb0 70b4 3000 0000 004c 2250 6268 228c 3090
0001cc0 70b4 3000 0000 0000 0000 0000 0000 0000
0001cd0 0000 0000 0000 004e 2256 6266 228e 3096
0001ce0 70ae 3000 0000 004e 2256 6266 228e 3096
0001cf0 70ae 3000 0000 0000 0000 0000 0000 0000
0001d00 0000 0000 0000 0070 1c75 5cac 1c00 0000
*
0001d20 0000 0000 0000 0000 0000 0000 0000 0000
0001d30 0000 0000 0000 0070 1c75 5cac 1c00 0000
*
0001d50 0000 0000 0000 0000 0000 0000 0000 0000
0001d60 0000 0000 0000 0070 1c75 5cac 1c00 0000
*
0001d80 0000 0000 0000 0000 0000 0000 0000 0000
0001d90 0000 0000 0000 007a 1c7f 5c93 5c98 1c00
*
0001db0 0000 0000 0000 0000 0000 0000 0000 0000
*
0001eb0 0000 0000 0000 0000 ffff ffff ffff ffff
0001ec0 ffff ffff ffff ffff ffff ffff ffff ffff
*
0005000 a55a 0000 0003 6000 168c 0029 6008 0001
0005010 0280 602c 168c a094 5000 168c 002a 5008
0005020 0001 0280 502c 168c a094 5064 0cc0 0504
0005030 506c 3811 0003 4004 073b 0040 4074 0003
0005040 0000 4000 0000 01c2 6034 0044 0000 ffff
0005050 ffff ffff ffff ffff ffff ffff ffff ffff
*
0005200 0cb8 26bf e016 0101 0060 001f 0024 b258
0005210 fb49 0303 0000 0000 0000 0009 0700 0400
0005220 01ff 0200 0001 0000 00fe 0000 0000 0000
0005230 0000 0000 0000 0000 0000 0000 0000 0000
*
0005280 0000 0158 0000 0158 0000 0000 0000 01e0
0005290 0000 002c 2020 0b00 000b e200 0e0e 0e00
00052a0 020e 1cca caca 0301 0000 0000 0000 0604
00052b0 0400 0000 0e0e 0215 1500 1f1f 002c 0000
00052c0 0000 0000 0404 4d09 0000 0000 0000 8e8c
00052d0 888e 8c88 8000 0000 0000 0000 0000 0000
00052e0 0000 0000 0000 0000 0000 0000 0000 0000
00052f0 0000 0000 0000 0000 0000 002d 0b0b 0b10
0005300 1010 e000 0d0d 0d00 020e 00ff ffff 0901
0005310 0000 0000 0000 0602 0201 0000 0e0e 0219
0005320 1900 1f1f 002d 0000 0000 0000 0303 0d09
0005330 0000 0000 0000 9200 0092 0000 8000 0000
0005340 0000 0000 0000 0000 0000 0000 0000 0000
0005350 4c58 5c68 8cb4 bdcd 0000 0000 415a 707f
0005360 8b45 596e 7f89 0000 0000 0000 0000 0000
0005370 0e24 518c a509 1227 4769 0000 0000 0000
0005380 0000 0000 4a62 7886 904b 6074 858f 0000
0005390 0000 0000 0000 0000 1127 548d cb08 1325
00053a0 4464 0000 0000 0000 0000 0000 4a62 7886
00053b0 904a 6073 848e 0000 0000 0000 0000 0000
00053c0 0f26 528b c808 1225 4462 0000 0000 0000
00053d0 0000 0000 384f 6572 7d47 5c6c 787e 0000
00053e0 0000 0000 0000 0000 0f2a 5791 d011 2039
00053f0 5b6a 0000 0000 0000 0000 0000 485f 7484
0005400 8a48 5e70 8087 0000 0000 0000 0000 0000
0005410 0f26 4e8c ac08 1224 4053 0000 0000 0000
0005420 0000 0000 283f 5468 7348 5664 6e73 0000
0005430 0000 0000 0000 0000 0a14 305d 8e0f 192a
0005440 3d48 0000 0000 0000 0000 0000 263d 5268
0005450 744a 5461 6b74 0000 0000 0000 0000 0000
0005460 070f 2a54 8c0f 1623 3347 0000 0000 0000
0005470 0000 0000 243b 5065 7149 5361 6a72 0000
0005480 0000 0000 0000 0000 050e 1f49 770e 1420
0005490 2e3c 0000 0000 0000 0000 0000 3b55 6b7b
00054a0 8545 5b6d 7d86 0000 0000 0000 0000 0000
00054b0 0d20 4887 c509 1528 4965 0000 0000 0000
00054c0 0000 0000 3e55 6b7f 8944 596b 7e8a 0000
00054d0 0000 0000 0000 0000 0d1c 3d7b b707 0f1f
00054e0 3d5e 0000 0000 0000 0000 0000 3e54 6a80
00054f0 8a45 5a6c 7f8b 0000 0000 0000 0000 0000
0005500 0b1a 3977 b507 101f 3c5e 0000 0000 0000
0005510 0000 0000 344b 6673 7f47 5d6c 797f 0000
0005520 0000 0000 0000 0000 0c1f 4e87 c50e 1d36
0005530 5364 0000 0000 0000 0000 0000 253b 5166
0005540 7648 5260 6b76 0000 0000 0000 0000 0000
0005550 0711 2553 910e 1522 314a 0000 0000 0000
0005560 0000 0000 2a40 576d 7a47 5665 727b 0000
0005570 0000 0000 0000 0000 0611 2a5b 9a0b 1423
0005580 3a4f 0000 0000 0000 0000 0000 273e 536a
0005590 7747 5565 7178 0000 0000 0000 0000 0000
00055a0 0712 2656 910c 1627 3a4a 0000 0000 0000
00055b0 0000 0000 263d 536a 7947 5565 727a 0000
00055c0 0000 0000 0000 0000 060d 1f48 830a 101d
00055d0 3244 0000 0000 0000 0000 0000 1092 78ce
00055e0 0010 9278 ce00 0000 0000 0000 0000 0000
00055f0 1092 78ce 0010 9278 ce00 0000 0000 0000
0005600 0000 0000 60ce 60ce 0030 ce30 ce00 0000
0005610 0000 0000 0000 0000 1092 78ce 0048 ce48
0005620 ce63 0000 0000 0000 0000 0000 58ce 58ce
0005630 0028 ce28 ce00 0000 0000 0000 0000 0000
0005640 70ce 70ce 7340 ce40 ce00 0000 0000 0000
0005650 0000 0000 50ce 50ce 0020 ce20 ce00 0000
0005660 0000 0000 0000 0000 68ce 68ce 0038 ce38
0005670 ce30 0000 0000 0000 0000 0000 48ce 48ce
0005680 6518 ce18 ce00 0000 0000 0000 0000 0000
0005690 60ce 60ce 0030 ce30 ce00 0000 0000 0000
00056a0 0000 0000 0891 78ce 0008 9178 ce00 0000
00056b0 0000 0000 0000 0000 a0ce a0ce 0008 9178
00056c0 ce00 0000 0000 0000 0000 0000 0891 78ce
00056d0 0008 9178 ce00 0000 0000 0000 0000 0000
00056e0 0891 78ce 0008 9178 ce00 0000 0000 0000
00056f0 0000 0000 0891 78ce 0008 9178 ce00 0000
0005700 0000 0000 0000 0000 0891 78ce 0008 9178
0005710 ce00 0000 0000 0000 0000 0000 0000 0000
0005720 0000 0000 0000 0000 0000 0000 0000 0000
*
00058f0 0000 0000 0000 0000 0000 0000 4c22 2222
0005900 2258 2222 2222 5c2a 2a2a 2868 2a2a 2a28
0005910 8c30 2c2a 28b4 302c 2a28 bd2a 2a2a 28cd
0005920 2a2a 2a28 4c22 2222 2222 2222 2258 2222
0005930 2222 2222 2222 5c2a 2a2a 2a28 2826 2668
0005940 2a2a 2a2a 2828 2626 8c30 2c2c 2a28 2826
0005950 26b4 302c 2c2a 2828 2626 bd2a 2a2a 2a28
0005960 2826 26cd 2a2a 2a2a 2828 2626 4e22 2222
0005970 2222 2222 2256 2222 2222 2222 2222 5e2a
0005980 2a2a 2828 2626 2466 2a2a 2a28 2826 2624
0005990 8e30 2a2a 2828 2626 24ae 302a 2a28 2826
00059a0 2624 bf2a 2a2a 2828 2626 24c7 2a2a 2a28
00059b0 2826 2624 7033 3333 33ac 3333 3333 ff00
00059c0 0000 0070 302a 2a2a 8e30 2a2a 2aac 302a
00059d0 2a2a ff00 0000 0070 2f2f 2f2f 2f2a 2a28
00059e0 8e2f 2f2f 2f2f 2a2a 28ac 2f2f 2f2f 2f2a
00059f0 2a28 ff00 0000 0000 0000 007a 2626 2626
0005a00 2626 2626 8926 2626 2626 2626 2698 2626
0005a10 2626 2626 2626 ff00 0000 0000 0000 0010
0005a20 1618 1112 1517 4046 4142 4530 3638 3132
0005a30 3537 0000 0000 004c 1c50 5c5c 6a68 2a8c
0005a40 2390 6ab4 23bd 6a4c 1c50 5c5c 6a68 2a8c
0005a50 2390 6ab4 23bd 6a00 0000 0000 0000 0000
0005a60 0000 0000 0000 004c 1c50 5c5c 6a68 2a8c
0005a70 2390 6ab4 23bd 6a4c 1c50 5c5c 6a68 2a8c
0005a80 2390 6ab4 23bd 6a00 0000 0000 0000 0000
0005a90 0000 0000 0000 004e 1c56 5c5e 6a66 228e
0005aa0 1b96 6aae 26bf 6a4e 1c56 5c5e 6a66 228e
0005ab0 1b96 6aae 26bf 6a00 0000 0000 0000 0000
0005ac0 0000 0000 0000 0070 2e75 73a2 2e00 0000
*
0005ae0 0000 0000 0000 0000 0000 0000 0000 0000
0005af0 0000 0000 0000 0070 2875 70a2 2800 0000
*
0005b10 0000 0000 0000 0000 0000 0000 0000 0000
0005b20 0000 0000 0000 0070 2875 70a2 2800 0000
*
0005b40 0000 0000 0000 0000 0000 0000 0000 0000
0005b50 0000 0000 0000 007a 207f 6693 6698 2000
*
0005b70 0000 0000 0000 0000 0000 0000 0000 0000
0005b80 0000 0000 0000 004a 2250 625c 6268 2200
*
0005ba0 0000 0000 0000 0000 0000 0000 0000 0000
0005bb0 0000 0000 0000 004a 2250 625c 6268 2200
*
0005bd0 0000 0000 0000 0000 0000 0000 0000 0000
0005be0 0000 0000 0000 0070 2275 62ac 62b8 2200
*
0005c00 0000 0000 0000 0000 0000 0000 0000 0000
0005c10 0000 0000 0000 0070 2275 62ac 2200 0000
*
0005c30 0000 0000 0000 0000 0000 0000 0000 0000
0005c40 0000 0000 0000 0070 2275 6298 2200 0000
*
0005c60 0000 0000 0000 0000 0000 0000 0000 0000
0005c70 0000 0000 0000 004c 2250 6268 228c 3090
0005c80 70b4 3000 0000 004c 2250 6268 228c 3090
0005c90 70b4 3000 0000 0000 0000 0000 0000 0000
0005ca0 0000 0000 0000 004c 2250 6268 228c 3090
0005cb0 70b4 3000 0000 004c 2250 6268 228c 3090
0005cc0 70b4 3000 0000 0000 0000 0000 0000 0000
0005cd0 0000 0000 0000 004e 2256 6266 228e 3096
0005ce0 70ae 3000 0000 004e 2256 6266 228e 3096
0005cf0 70ae 3000 0000 0000 0000 0000 0000 0000
0005d00 0000 0000 0000 0070 1c75 5cac 1c00 0000
*
0005d20 0000 0000 0000 0000 0000 0000 0000 0000
0005d30 0000 0000 0000 0070 1c75 5cac 1c00 0000
*
0005d50 0000 0000 0000 0000 0000 0000 0000 0000
0005d60 0000 0000 0000 0070 1c75 5cac 1c00 0000
*
0005d80 0000 0000 0000 0000 0000 0000 0000 0000
0005d90 0000 0000 0000 007a 1c7f 5c93 5c98 1c00
*
0005db0 0000 0000 0000 0000 0000 0000 0000 0000
*
0005eb0 0000 0000 0000 0000 ffff ffff ffff ffff
0005ec0 ffff ffff ffff ffff ffff ffff ffff ffff
*
0008000 faf3 0020 0000 0000 ffff ffff ffff ffff
0008010 ffff ffff ffff ffff ffff ffff ffff ffff
*
0010000

I can see 3 (?) Mac adresses at the first lines and the flash magic number a55a (this should be absolute adress 0x1f7f1000 to where we guided the eeprom read process).

Anything else useful?

edit: 2nd magic # at address 0005000!

(Last edited by whiskas on 13 Nov 2009, 12:14)

Hi,

Here is an updated mach-wndr3700.c which handles leds and buttons. Tested everything works.


/*
 *  Netgear WNDR3700 board support
 *
 *  Copyright (C) 2009 Marco Porsch
 *  Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
 *
 *  This program is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License version 2 as published
 *  by the Free Software Foundation.
 */

#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
#include <linux/input.h>

#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
#include <asm/mach-ar71xx/pci.h>

#include "devices.h"

#define WNDR3700_GPIO_LED_WPS_ORANGE 0
#define WNDR3700_GPIO_LED_POWER_ORANGE 1
#define WNDR3700_GPIO_LED_POWER_GREEN    2
#define WNDR3700_GPIO_LED_WPS_GREEN    4

#define WNDR3700_GPIO_BTN_WPS        3
#define WNDR3700_GPIO_BTN_RESET        8
#define WNDR3700_GPIO_BTN_WIFI        11

#define WNDR3700_BUTTONS_POLL_INTERVAL    20


#ifdef CONFIG_MTD_PARTITIONS
static struct mtd_partition wndr3700_partitions[] = {
    {
        .name        = "uboot",
        .offset        = 0,
        .size        = 0x050000,
        .mask_flags    = MTD_WRITEABLE,
    } , {
        .name        = "env",
        .offset        = 0x050000,
        .size        = 0x020000,
        .mask_flags    = MTD_WRITEABLE,
    } , {
        .name        = "rootfs",
        .offset        = 0x070000,
        .size        = 0x720000,
    } , {
        .name        = "config",
        .offset        = 0x790000,
        .size        = 0x010000,
        .mask_flags    = MTD_WRITEABLE,
    } , {
        .name        = "config_bak",
        .offset        = 0x7a0000,
        .size        = 0x010000,
        .mask_flags    = MTD_WRITEABLE,
    } , {
        .name        = "pot",
        .offset        = 0x7b0000,
        .size        = 0x010000,
        .mask_flags    = MTD_WRITEABLE,
    } , {
        .name        = "traffic_meter",
        .offset        = 0x7c0000,
        .size        = 0x010000,
        .mask_flags    = MTD_WRITEABLE,
    } , {
        .name        = "language",
        .offset        = 0x7d0000,
        .size        = 0x020000,
        .mask_flags    = MTD_WRITEABLE,
    } , {
        .name        = "caldata",
        .offset        = 0x7f0000,
        .size        = 0x010000,
        .mask_flags    = MTD_WRITEABLE,
    }
};
#endif /* CONFIG_MTD_PARTITIONS */

static struct flash_platform_data wndr3700_flash_data = {
#ifdef CONFIG_MTD_PARTITIONS
        .parts          = wndr3700_partitions,
        .nr_parts       = ARRAY_SIZE(wndr3700_partitions),
#endif
};

static struct ar71xx_pci_irq wndr3700_pci_irqs[] __initdata = {
    {
        .slot    = 0,
        .pin    = 1,
        .irq    = AR71XX_PCI_IRQ_DEV0,
    }, {
        .slot    = 1,
        .pin    = 1,
        .irq    = AR71XX_PCI_IRQ_DEV1,
    }
};

static struct spi_board_info wndr3700_spi_info[] = {
    {
        .bus_num    = 0,
        .chip_select    = 0,
        .max_speed_hz    = 25000000,
        .modalias    = "m25p80",
        .platform_data  = &wndr3700_flash_data,
    }
};

static struct gpio_led wndr3700_leds_gpio[] __initdata = {
    {
        .name        = "wndr3700:green:power",
        .gpio        = WNDR3700_GPIO_LED_POWER_GREEN,
        .active_low    = 1,
        .default_trigger = "default-on",
    }, {
        .name        = "wndr3700:orange:power",
        .gpio        = WNDR3700_GPIO_LED_POWER_ORANGE,
        .active_low    = 1,
    }, {
        .name        = "wndr3700:green:wps",
        .gpio        = WNDR3700_GPIO_LED_WPS_GREEN,
        .active_low    = 1,
    }, {
        .name        = "wndr3700:orange:wps",
        .gpio        = WNDR3700_GPIO_LED_WPS_ORANGE,
        .active_low    = 1,
    }
};

static struct gpio_button wndr3700_gpio_buttons[] __initdata = {
    {
        .desc        = "reset",
        .type        = EV_KEY,
        .code        = BTN_0,
        .threshold    = 5,
        .gpio        = WNDR3700_GPIO_BTN_RESET,
    }, {
        .desc        = "wps",
        .type        = EV_KEY,
        .code        = BTN_1,
        .threshold    = 5,
        .gpio        = WNDR3700_GPIO_BTN_WPS,
    } , {
        .desc        = "wifi",
        .type        = EV_KEY,
        .code        = BTN_2,
        .threshold    = 5,
        .gpio        = WNDR3700_GPIO_BTN_WIFI,
    }
};


static void __init wndr3700_setup(void)
{
    u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000);

    ar71xx_set_mac_base(mac);
    ar71xx_add_device_mdio(0x0);

    ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
    ar71xx_eth0_data.phy_mask = 0xf;
    ar71xx_eth0_data.speed = SPEED_1000;
    ar71xx_eth0_data.duplex = DUPLEX_FULL;

    ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
    ar71xx_eth1_data.phy_mask = 0x10;

    ar71xx_add_device_eth(0);
    ar71xx_add_device_eth(1);

    ar71xx_add_device_usb();

    ar71xx_pci_init(ARRAY_SIZE(wndr3700_pci_irqs), wndr3700_pci_irqs);

    ar71xx_add_device_spi(NULL, wndr3700_spi_info,
                  ARRAY_SIZE(wndr3700_spi_info));
                  
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wndr3700_leds_gpio),
                    wndr3700_leds_gpio);
                    
      ar71xx_add_device_gpio_buttons(-1, WNDR3700_BUTTONS_POLL_INTERVAL,
                    ARRAY_SIZE(wndr3700_gpio_buttons),
                    wndr3700_gpio_buttons);

//    ar91xx_add_device_wmac();

    
}

MIPS_MACHINE(AR71XX_MACH_WNDR3700, "NETGEAR WNDR3700", wndr3700_setup);

The usb led is missing, because it seems to be triggered by something else than GPIOs.
I could find some code in the GPL archive that seems to achieve it :

void turn_on_usbled(void)
{
    down(&usbled_sem);
    usbled_state = 1;
    ar7100_reg_rmw_clear(AR7100_RESET, AR7100_RESET_GE1_PHY);
    up(&usbled_sem);
}
EXPORT_SYMBOL(turn_on_usbled);

void turn_off_usbled(void)
{
    down(&usbled_sem);
    usbled_state = 0;
    ar7100_reg_rmw_set(AR7100_RESET, AR7100_RESET_GE1_PHY);
    up(&usbled_sem);
}
EXPORT_SYMBOL(turn_off_usbled);

If needed, it should not be very hard to write a kernel module like the wndr3700-usbled one in the Netgear firmware to control it over /proc

Well, I found the 2G interface could be up with following two changes.

1. update compat-wireless to 2009-11-12.
2. Patch compat-wireless-2009-11-12 with

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 7cb529a..b4b4366 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -438,8 +438,8 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah)
     ah->ah_flags = 0;
     if (ah->hw_version.devid == AR5416_AR9100_DEVID)
         ah->hw_version.macVersion = AR_SREV_VERSION_9100;
-    if (!AR_SREV_9100(ah))
-        ah->ah_flags = AH_USE_EEPROM;
+    /* if (!AR_SREV_9100(ah)) */
+    /*     ah->ah_flags = AH_USE_EEPROM; */
 
     ah->atim_window = 0;
     ah->sta_id1_defaults = AR_STA_ID1_CRPT_MIC_ENABLE;

It seems that setting AH_USE_EEPROM make ath9k swap the read calibration data. (Is this a bug?)

With above changes, I can make one wireless client connect to WNDR3700, but the performance is not good. Lot of ping packet lost.

@yjchang & aorlinsk
thx again for your great work!

The corresponding code piece for swapping the endianness of the flash is this (in eeprom_def.c, function static int ath9k_hw_def_check_eeprom(struct ath_hw *ah)):

if (!ath9k_hw_use_flash(ah)) {
        ath_print(common, ATH_DBG_EEPROM,
              "Read Magic = 0x%04X\n", magic);

        if (magic != AR5416_EEPROM_MAGIC) {
            magic2 = swab16(magic);

            if (magic2 == AR5416_EEPROM_MAGIC) {
                size = sizeof(struct ar5416_eeprom_def);
                need_swap = true;
                eepdata = (u16 *) (&ah->eeprom);

                for (addr = 0; addr < size / sizeof(u16); addr++) {
                    temp = swab16(*eepdata);
                    *eepdata = temp;
                    eepdata++;
                }
            } else {
                ath_print(common, ATH_DBG_FATAL,
                      "Invalid EEPROM Magic. "
                      "Endianness mismatch.\n");
                return -EINVAL;
            }
        }
    }

It seems to me, the magic number is reversed for this specific platform.

(Last edited by whiskas on 16 Nov 2009, 13:51)

I get both wireless interfaces with the following code:

in arch/mips/ar71xx/mach-wndr3700.c

    ar71xx_add_device_wmac(0, 0x1f7f1000);
    ar71xx_add_device_wmac(1, 0x1f7f5000);

in arch/mips/ar71xx/devices.c

static struct ath9k_platform_data ar71xx_wmac0_data;

static struct platform_device ar71xx_wmac0_device = {
    .name        = "ath9k_flashcalc0",
    .id        = -1,
    .dev = {
        .platform_data = &ar71xx_wmac0_data,
    },
};
static struct ath9k_platform_data ar71xx_wmac1_data;

static struct platform_device ar71xx_wmac1_device = {
    .name        = "ath9k_flashcalc1",
    .id        = -1,
    .dev = {
        .platform_data = &ar71xx_wmac1_data,
    },
};

void __init ar71xx_add_device_wmac(u8 id, unsigned int addr)
{
    u8 *ee = (u8 *) KSEG1ADDR(addr);
    struct platform_device *pdev=0;
    struct ath9k_platform_data *pdata=0;

    switch (id)
    {
        case 0:
            pdev = &ar71xx_wmac0_device;
            pdata =&ar71xx_wmac0_data;
            break;

        case 1:
            pdev = &ar71xx_wmac1_device;
            pdata =&ar71xx_wmac1_data;
            break;

        default:
           return;
    }

    memcpy(pdata->eeprom_data, ee,
               sizeof(pdata->eeprom_data));

    platform_device_register(pdev);
}

in compat-wireless/drivers/net/wireless/ath/ath9k/pci.c

static bool once=true;

static int ath_set_cal_data(struct ath_softc *sc)
{
    struct device *d;
    struct platform_device *pd;
    struct ath9k_platform_data *pdata;

    if (once)
    {
        d = bus_find_device_by_name(&platform_bus_type, NULL, "ath9k_flashcalc0");
        printk(" # reading wmac0 caldata\n");
        once = false;
    }
    else
    {
        d = bus_find_device_by_name(&platform_bus_type, NULL, "ath9k_flashcalc1");
        printk(" # reading wmac1 caldata\n");
    }

    if (d){
        pd = to_platform_device(d);
        pdata = (struct ath9k_platform_data *) pd->dev.platform_data;
        sc->cal_data = pdata->eeprom_data;
    }else{
        sc->cal_data = NULL;
        printk(" # error reading caldata\n");
    }
}

Sorry for not posting diffs, but i think we all have quiet different sources by now and ... i'm lazy big_smile

Still the wmacs have the same wrong MAC. - Of course they have, still the MACs are saved in the block before the two calibration blocks starting with the magic numbers.

edit: numbers were mixed up. Sorry

2nd edit: another odd problem: the wifi-interface wlan1 is 5GHz only, while wlan0 and wlan2 are 2GHz only

(Last edited by whiskas on 16 Nov 2009, 15:21)

There was this here https://dev.openwrt.org/changeset/18411

Glad to see everything channelized in on place (especially those diff)

(Last edited by ratbug on 17 Nov 2009, 13:55)

What's the progress on this looking like? I noticed there was a flurry of updates in last day or so on tracker for wndr3700 related things, so it looks like further progress might have been made by someone?

(Last edited by Dragon on 28 Nov 2009, 18:59)

I have not tried a recent checkout, but as far as i can see from the code, wireless should work out-of-the-box now. I have not used AP mode much, so don't take my word on that. Transmission rates were quiet low for me, maybe someone can post his/her benchmarks here (use 'iperf').

I have not seen a switch-driver so far, but ethernet-access is generally working. Has anybody tried WAN?

I have not burned an image to flash, only ramdisk. So dunno about that.

did anyone note that the default firmware does not support dns and dhcp integration? The default firmware is using (a modified version) of dnsmasq as their dns resolver, and udhcpd as the dhcp server. But these 2 are NOT integrated. So when I replaced my openwrt router running on a via itx board with the wndr3700 my whole network fell apart. I am so used to dns and dhcp integration that I wrongly assumed that it was going to work with this router also. Now I have to setup a seperate dns server (using openwrt) on a nslu2 just to keep my network working ...

Digging through the released sources I also noticed this nice bit of comment in the dnsmasq rfc1035.c code:

/*
         * NETGEAR SPEC v1.6
         * 3.5.2        DNS Hijack
         * An implementation MUST support DNS hijack. When the router performs DNS hijack,
         * it intercepts all the interested DNS queries going through it either destined to
         * the router itself or to other DNS servers on the Internet. That is, no matter a PC
         * on the LAN configures its DNS server to be setup dynamically or to IPs other than
         * the router, the router MUST hijack the interested DNS queries from the PC. (<----
         * ---------------------------------------------------------------------------------
         * --This is done by kernel netfilter NAT `REDIRECT` target when in hijack mode-----
         * -------------------------------------------------------------------------------->).
         * The DNS hijack behaviors are different at between Blank State and normal state.
         * At the Blank State, the router MUST hijack all the DNS queries, except for the XBox
         * Live domain names, from the LAN PCs and sends back the answer back to resolve the
         * queried domain name to the router's LAN IP address. An implementation MUST put zero
         * in the TTL field of resource record in the answer it sends back at the blank state.
         * This prevents the LAN PCs to cache the IP resolved and so they will send DNS queries
         * again to get the real corresponding IP addresses after the blank state is done. There
         * are 3 XBox Live domain names that the router MUST NOT hijack and MUST forward the
         * queries to the Internet DNS servers to get the correct resolved IP addresses and send
         * them back. The 3 XBox Live domain names are:
         * ============================
         * as.xboxlive.com,
         * tgs.xboxlive.com,
         * macs.xboxlive.com.
         * At the normal state (i.e. the blank state is gone), the router MUST only hijack the
         * following 4 domain names and resolve them to the router's LAN IP address. All other
         * domain names are not interested.
         * ============================
         * www.routerlogin.com
         * routerlogin.com
         * www.routerlogin.net
         * routerlogin.net
         */

I would like to know what other "gem's" can be found in the "NETGEAR SPEC v1.6". And these are the dns hijack's we know about, but how about "unpublished" hijacks?

and back to this subject, was anyone successfull in building a working firmware that is identical to the released firmware using only the release sources?

if so, is it possible to build a modified version without all the unnessesary stuff that netgear put in there??

whiskas wrote:

I have not seen a switch-driver so far, but ethernet-access is generally working. Has anybody tried WAN?

What do we expect for a switch driver ? I found interesting files in various archives related to rtl8366s, and I even started to compare them trying to keep the most complete ones. (some manufacturers just have stripped down versions of low level drivers...)
I think all the low level stuff support is complete (from various GPL archives), what is missing/proprietary is the control interface for the various features (through /proc or /dev), and this looks likely not to be the hardest part to write.

From what I could see, in the implementations of the "high level" switch control there are 2 parts :
- kind of init or setup of the switch. probably a hardcoded configuration. There are direct calls to GPIOs methods (changing with CPU platform). This looks a bit hackish but easier to write for manufacturers I guess... If I understand things well I should use the generic GPIO access so the driver could work with any CPU platform.
- switch control : to get some statuses, PHY info/change. Maybe live reconfiguration.

If you have pointers to describe how things work (or should work) regarding CPU network interfaces, PHYs, switches, GPIOs and their drivers in the kernel, I can have a deeper look. Pointers to a correct implementation for another platform can make it as well.

So it looks as though all the open tickets on the timeline are closed for the WNDR3700. Is it good to go then? Any resolution of speed issues?

If the OS is more or less ready, I'm willing to try flashing my router. I think netgear has a way to unbrick if it doesn't work.

You could give it a try. Since Ethernet working you can always ssh in to reflash to netgears firmware.
In the unlikely case it gets bricked, you can should always be able to reflash using a serial cable.

Be sure to post all bugs you may find and also post them as tickets in trac.

is it possible that the wan port is not supported? In my test is was unable to get an ip on the wan port over my cable modems dhcp. Any ideas?

Try to verify it by plugging your PC into the WAN-port and do a ping with static IPs. If it fails file a ticket for the developers.

Whassup?

@entee:
Did you try flashing? And?

@Walhalla:
WAN fine or not?

I have some serious problems with the wireless range.
I have problems connecting to the router even across a big room!

Can somebody confirm this?

Sorry, I've become a bit overloaded with work, so I haven't had a chance to flash or test yet. Hopefully this weekend?

Again, sorry for not being terribly helpful

WhooDInI wrote:

BiG up! to all dd-wrt users and great job y'all.

Now, about WNDR3700, I just got mine from amazon.de and I cant hardly wait for a dd-wrt firmware. big_smile
The default interface s***s but other then that the hardware rules. I'm trying to connect to another wireless and I cant see how.

Meanwhile I found these:
WNDR3700 V1.0.4.35 Source Code ~200MB
ftp://downloads.netgear.com/files/GPL/W … ar.bz2.zip

WNDR3700 V1.0.4.49 Source Code ~200MB
ftp://downloads.netgear.com/files/GPL/W … ar.bz2.zip

WNDR3700 BootLoader ~3MB
ftp://downloads.netgear.com/files/GPL/W … ar.bz2.zip
all of those and others on this page:
http://kb.netgear.com/app/answers/detail/a_id/2649

I dont know if they are any use to DD-WRT Developers but I hope it helps. big_smile

L8er y'all!

luminoso wrote:

List of WNDR3700 firmwares

Not sure what this adds - the links were posted already wink. Albeit in another topic.

Hi,

last week I compiled an image for my WDNR3700 with the latest trunk that was available that day.  It was working fine for me, except for some regulatory domain tweaking in the config to get the 5Ghz band working. Other than that I did not test USB or anything else, since I use the device as an access point.
I guess it is pretty save to flash and I did not experience any problems at all during multiple firmware updates. In order to get back the original firmware you have to strip the first 128 bytes of the original firmware and then flash it using the cmd/web gui.

One "minor" problem is the ath9k driver in Europe. It seems it does not support radar detection in AP mode, which is mandatory in most EU states. So 5ghz is basically off, if you aren't running it illegally with US/other countries settings. Is there somebody working on getting that fixed?

  --Markus

be patient, Rome wasn't built in one day

@whiskas,

Do you know the pinout for the jtag connector on the board?

ratbug wrote:

Do you know the pinout for the jtag connector on the board?

No. To be honest, i don't even know there is one. Sorry, can't help on that.

Sorry, posts 76 to 75 are missing from our archive.