1 (edited by andrewt12 2011-05-20 04:19:32)

Topic: TP Link WR1043ND 11n gigabit router

EDIT: 20/05/11- Full support is now in OpenWRT, see wiki page http://wiki.openwrt.org/toh/tp-link/tl-wr1043nd

EDIT: 24/02/10- See post # 310 for the latest switch driver

EDIT: 27/12/09-  See post #42 for a patch against trunk r18935. Adds support for the rtl8366rb switch to enable vlan for wan + lan

Hi,

First Post here and first time looking into making a port for a new router.

The Router is manufactured by TP-LINK and is very similar to the wr941nd ( AP81 ) with the addition of a gigabit switch, usb port and also has 8MB of flash.
Link to product page http://www.tplink.com/products/product_des.asp?id=219

Ive started a wiki page with a picture of the internals link http://wiki.openwrt.org/inbox/tp-link.tl-wr1043nd
Shortly I will be attaching a serial port to the unit to get more information on the bootloader.

Stock firmware runs a 2.6.15 kernel. The rootfs has the same layout as the wr941nd and has many references to wr941nd also.

TP-Link has yet to release the GPL source yet, when I emailed them they said its only a new model and have yet to release the source, they said I should see it on there site in the near future.


I will post an update once ive got the serial port working.


Cheers
Andrew

2 (edited by andrewt12 2009-12-03 11:46:34)

Re: TP Link WR1043ND 11n gigabit router

Ok, here is the boot output from the serial port. Unlike the wr941nd there are no pads which need bridging to get the serial port to work.


Ok, here is the boot output from the serial port. Unlike the wr941nd there are no pads which need bridging to get the serial port to work.

U-Boot 1.1.4 (Sep 15 2009 - 09:41:38)

AP83 (ar9100) U-boot 0.0.11
DRAM:
sri
32 MB
id read 0x100000ff
flash size 8MB, sector count = 128
Flash:  8 MB
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   ag7100_enet_initialize...
No valid address in Flash. Using fixed address
: cfg1 0xf cfg2 0x7114
eth0: 00:03:7f:09:0b:ad
eth0 up
eth0
Autobooting in 1 seconds## Booting image at bf020000 ...
   Uncompressing Kernel Image ... OK

Starting kernel ...

Linux version 2.6.15--LSDK-6.1.1.40 gcc version 3.4.4 #84 Thu Sep 17 11:06:05 C9
flash_size passed from bootloader = 8
CPU revision is: 00019374
Determined physical RAM map:
 memory: 02000000 @ 00000000 (usable)
Built 1 zonelists
Kernel command line: console=ttyS0,115200 root=31:2 rootfstype=squashfs init=/s
Primary instruction cache 64kB, physically tagged, 4-way, linesize 32 bytes.
Primary data cache 32kB, 4-way, linesize 32 bytes.
Synthesized TLB refill handler (20 instructions).
Synthesized TLB load handler fastpath (32 instructions).
Synthesized TLB store handler fastpath (32 instructions).
Synthesized TLB modify handler fastpath (31 instructions).
Cache parity protection disabled
PID hash table entries: 256 (order: 8, 4096 bytes)
Using 200.000 MHz high precision timer.
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 30152k/32768k available (1406k kernel code, 2600k reserved, 293k data, )
Mount-cache hash table entries: 512
Checking for 'wait' instruction...  available.
NET: Registered protocol family 16
Jumpstart button pressed.
SCSI subsystem initialized
AR7100 GPIOC major 0
squashfs: version 3.3 (2007/10/31) Phillip Lougher
Initializing Cryptographic API
io scheduler noop registered
io scheduler deadline registered
Serial: 8250/16550 driver $Revision: #1 $ 1 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0x0 (irq = 19) is a 16550A
RAMDISK driver initialized: 1 RAM disks of 8192K size 1024 blocksize
PPP generic driver version 2.4.2
NET: Registered protocol family 24
cmdlinepart partition parsing not available
Searching for RedBoot partition table
5 RedBoot partitions found on MTD device ar7100-nor0
Creating 5 MTD partitions on "ar7100-nor0":
0x00000000-0x00020000 : "boot"
0x00020000-0x00120000 : "kernel"
0x00120000-0x007e0000 : "rootfs"
0x007e0000-0x007f0000 : "config"
0x007f0000-0x00800000 : "art"
->Oops: flash id 0x202017 .
NET: Registered protocol family 2
IP route cache hash table entries: 512 (order: -1, 2048 bytes)
TCP established hash table entries: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
ar7100wdt_init: Registering WDT success
VFS: Mounted root (squashfs filesystem) readonly.
Freeing unused kernel memory: 108k freed
init started:  BusyBox v1.01 (2009.01.06-01:38+0000) multi-call binary
Algorithmics/MIPS FPU Emulator v1.5
ip_conntrack version 2.4 (256 buckets, 5120 max) - 240 bytes per conntrack
insmod: cannot open module `/lib/modules/2.6.15/kernel/flashid.ko': No such fily
Now flash open!
Now flash open!
AG7100: Length per segment 1536
AG7100: Max segments per packet 1
AG7100: Max tx descriptor count    40
AG7100: Max rx descriptor count    252
AG7100: fifo cfg 3 00780008
rtl8368s_getAsicPHYRegs(0, 1, 22, &data) return is 0, data is 0x00001000
AG7100: pll reg 0x18050014: 0x1a000000  Writing 4

 (none) mips #84 Thu Sep 17 11:06:05 CST 2009 (none)
(none) login: SIOCETHTOOL
bridge: can't decode speed from eth0: 0
device eth0 entered promiscuous mode
AG7100: pll reg 0x18050014: 0x1a000000  Writing 4
br0: port 1(eth0) entering learning state
br0: topology change detected, propagating
br0: port 1(eth0) entering forwarding state
ath_hal: module license 'Proprietary' taints kernel.
ath_hal: 0.9.17.1 (AR5416, DEBUG, REGOPS_FUNC, WRITE_EEPROM, 11D)
wlan: 0.8.4.2 (Atheros/multi-bss)
ath_rate_atheros: Copyright (c) 2001-2005 Atheros Communications, Inc, All Righd
ath_dev: Copyright (c) 2001-2007 Atheros Communications, Inc, All Rights Reservd
ath_ahb: 0.9.4.5 (Atheros/multi-bss)
Howl Revision ID 0xb9
wifi0: Atheros AR9100 WiSoC: mem=0xb80c0000, irq=2
wlan: mac acl policy registered
ieee80211_ioctl_setmode: CHH Mode: 11NGHT20
ath_set_config: Setting ATH parameter
ath_set_config: Setting ATH parameter
ath_set_config: Setting ATH parameter
ieee80211_ioctl_setparam: CHH Calling ieee80211_open
ieee80211_ioctl_setparam: CHH Calling ieee80211_open
Force rf_pwd_icsyndiv to 1 on 2412 (1 0)
--AP ar5416InitUserSettings ahp->ah_miscMode 0xc
ar5416Reset Setting CFG 0x10a
Howl Revision ID 0xb9
MBSSID Set bit 22 of AR_STA_ID 0xb8c1ec2b
Country ie is AUI
Force rf_pwd_icsyndiv to 1 on 2412 (1 0)
--AP ar5416InitUserSettings ahp->ah_miscMode 0xc
ar5416Reset Setting CFG 0x10a
Howl Revision ID 0xb9
MBSSID Set bit 22 of AR_STA_ID 0xb8c1ec2b
ath_set_config: Setting ATH parameter
Force rf_pwd_icsyndiv to 1 on 2412 (1 0)
--AP ar5416InitUserSettings ahp->ah_miscMode 0xc
ar5416Reset Setting CFG 0x10a
Howl Revision ID 0xb9
MBSSID Set bit 22 of AR_STA_ID 0xb8c1ec2b
ath_netdev_stop: The stopping of the running
ieee80211_ioctl_setparam: CHH Calling ieee80211_open
ieee80211_ioctl_setparam: CHH Calling ieee80211_open
ieee80211_ioctl_setparam: CHH Calling ieee80211_open
ath_rate_maxtxrate:762
maxrate = 130000
Force rf_pwd_icsyndiv to 1 on 2412 (1 0)
--AP ar5416InitUserSettings ahp->ah_miscMode 0xc
ar5416Reset Setting CFG 0x10a
Howl Revision ID 0xb9
MBSSID Set bit 22 of AR_STA_ID 0xb8c1ec2b
Country ie is AUI
br0: port 1(eth0) entering disabled state
AG7100: pll reg 0x18050014: 0x1a000000  Writing 4
br0: port 1(eth0) entering learning state
br0: topology change detected, propagating
br0: port 1(eth0) entering forwarding state
device ath0 entered promiscuous mode
br0: port 2(ath0) entering learning state
br0: topology change detected, propagating
br0: port 2(ath0) entering forwarding state
ath_netdev_stop: The stopping of the running
br0: port 2(ath0) entering disabled state

TP_Flags:0****
Force rf_pwd_icsyndiv to 1 on 2412 (1 0)
--AP ar5416InitUserSettings ahp->ah_miscMode 0xc
ar5416Reset Setting CFG 0x10a
Howl Revision ID 0xb9
MBSSID Set bit 22 of AR_STA_ID 0xb8c1ec2b
Country ie is AUI
br0: port 2(ath0) entering learning state
br0: topology change detected, propagating
br0: port 2(ath0) entering forwarding state
fuse init (API version 7.8)
fuse distribution version: 2.7.4
usbcore: registered new driver usbfs
usbcore: registered new driver hub
Port Status c000004
ar7100-ehci ar7100-ehci.0: ATH EHCI
ar7100-ehci ar7100-ehci.0: new USB bus registered, assigned bus number 1
ar7100-ehci ar7100-ehci.0: irq 3, io mem 0x1b000000
hcc_params addr 0xbb000108 val 0x6 hcs_params addr 0xbb000104 val 0x10011
ar7100-ehci ar7100-ehci.0: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
SIOCENABLEFWD
ath_netdev_stop: The stopping of the running
br0: port 2(ath0) entering disabled state
ieee80211_ioctl_setparam: IOCTL Set WPA: 2
ieee80211_ioctl_setparam: CHH Calling ieee80211_open
ieee80211_ioctl_setparam: CHH Calling ieee80211_open
Force rf_pwd_icsyndiv to 1 on 2412 (1 0)
--AP ar5416InitUserSettings ahp->ah_miscMode 0xc
ar5416Reset Setting CFG 0x10a
Howl Revision ID 0xb9
MBSSID Set bit 22 of AR_STA_ID 0xb8c1ec2b
Country ie is AUI
br0: port 2(ath0) entering learning state
br0: topology change detected, propagating
br0: port 2(ath0) entering forwarding state

Re: TP Link WR1043ND 11n gigabit router

This Unit doesn't work at all in 11n mode with my Intel 5300agn, it connects and data flows for a minute then it comes to a stop, no amount of fiddling with the settings helps. Ive read that the Intel card is a bit flaky so are going to get an Atheros 2x2 card to replace the Intel.

4 (edited by andrewt12 2009-12-04 14:02:34)

Re: TP Link WR1043ND 11n gigabit router

Great, TP-Link have locked out access to the UBoot boot loader, typing tp before the 1 second timeout doesn't work.

Edit: Its not tp its tpl, so im into the Uboot now hacking can start, from what ive learnt so far the main thing will be adding the switch support.

5 (edited by andrewt12 2009-12-05 23:24:49)

Re: TP Link WR1043ND 11n gigabit router

Got Openwrt running on my board, most things working except the Lan. I cant find the specific datasheet for the RTL8366BR. I really need TP-Links source now.

One thing Im a bit stuck on is the kernel board detection, from what I can tell prom.c parses the flash for the right platform, I followed how the others are done but it doesn't work. For now im passing "board=TL-WR1043ND" on the kernel command line. I'm sure I am missing something here.

<edit>

Got the ethernet up at 1000mb and have the wifi working at g only, havent tried N yet, so far Im happy as to how quickly this has come along, thanks to the already good support in OpenWRT for the ap81 platform.

Re: TP Link WR1043ND 11n gigabit router

so... can u share knowlage what driver for PHY did u use?

Re: TP Link WR1043ND 11n gigabit router

so... can u share knowlage what driver for PHY did u use?

Are you referring to the wired or wirless ?

Wireless is working using the ath9k driver
phy0: Atheros AR9100 MAC/BB Rev:0 AR2133 RF Rev:a2 mem=0xb80c0000, irq=2

Wired is working by bringing the Ethernet up @ 1000mbs no drivers for the switch yet, hence no Vlan support.

I will submit my patches soon, its in a usable state, For myself I dont need the WAN so I can use as I have it now as a AP with 5 port giga switch.

I will work on implementing the RTL8366RB, its just going to take a little more time as there is lack of information and existing drivers for this switch. Im going to need to write a new driver.


Regards
Andrew

Re: TP Link WR1043ND 11n gigabit router

WR1043ND board support is now in trunk. I will update my wiki entry with flashing information shortly.

9 (edited by andrewt12 2009-12-12 08:32:49)

Re: TP Link WR1043ND 11n gigabit router

andrewt12 wrote:

WR1043ND board support is now in trunk. I will update my wiki entry with flashing information shortly.

Thanks p1vo for adding the flashing info to the wiki entry. Thought I was the only one interested in this model.

Ive mapped out the rest of the gpio's for the leds, will submit a patch in a few days.

Have been working on the rtl8366rb. Found the SMI bus is connected to gpio's 18 and 19. An rtl8366_smi has been added to trunk, its unsuitable as is as its for the S/SR version of the chip which has slightly different register access. Ive patched it to detect the RB version switch found in the wr1043nd.  The chip ID is 5937 compared to 8366 of the S/SR, it doesn't give much yet, its only for chip access, we still need a switch driver for vlans. You can get a register dump.

Realtek RTL8366 switch driver version 0.1.0
rtl8366-smi rtl8366-smi: using GPIO pins 18 (SDA) and 19 (SCK)
rtl8366-smi rtl8366-smi: RTL5937 ver. 3 chip found
rtl8366-smi: probed
eth0: Atheros AG71xx at 0xb9000000, irq 4
eth1: Atheros AG71xx at 0xba000000, irq 5
eth0: connected to 4 PHYs
eth0: link up (1000Mbps/Full duplex)

eth1: connected to PHY at rtl8366-smi:00 [uid=001cc961, driver=Realtek RTL8366]
eth1: link up (100Mbps/Full duplex)

Ive found sources for the rtl8366RB chip,  so there is enough information to write a driver. Its just a little over my head the way all the phy and switch code interact in the kernel. I think I will wait till the S/SR driver is committed and base the RB on that. Anyone up for writing a switch driver ?

Re: TP Link WR1043ND 11n gigabit router

There are a lot of people interested in this router. Good job!

11 (edited by p1vo 2009-12-11 18:00:45)

Re: TP Link WR1043ND 11n gigabit router

exactly,,, great work mate smile
dont forget that there is so few ppl with that device cos its new on the market. if we take care about proper ad after adding full suport it could become second wrt54gl wink

Re: TP Link WR1043ND 11n gigabit router

http://www.tp-link.com/GPL/TL-WR1043N_v1.tar.gz

tp-link has published source code smile

13 (edited by andrewt12 2009-12-12 09:43:54)

Re: TP Link WR1043ND 11n gigabit router

Good stuff, been waiting for this.

More on the Ethernet, It looks like it uses both ethernet ports on the ap81 soc. With the tp-link firmware there are 2 ethernet devices, eth0 & eth1. Also there are no Vlans configured.

Abstract from the product info

The 5th port MAC or PHY of the RTL8366SB and RTL8366RB implement dual MII/RGMII interfaces (the 6th port MAC of the RTL8366RB provides a single GMII interface) for connecting with an external PHY or MAC in specific applications. This interface could be connected to an external CPU or RISC as 5-port Gigabit Router applications.

So I assume the WAN port (PHY4) would go to the eth1 cpu port and eth0 cpu port goes to MAC5 port in phy mode.  Just need to work out how to configure the switch for this operation.

EDIT:
Im not sure about this assumption now. Seeing as the WAN port goes to PHY0 and the Lan ports 1 - 4 ports goto PHY1 to PHY4. I dont have a datasheet and are presuming the S/SR and the RB are very similar. Even the SR datasheet I have is lacking register details. Still I dont know why they wouldn't implement dual RGMII interfaces, it doesn't cost any extra as the hardware is already there plus the better performance.

14 (edited by obsy 2009-12-12 09:35:03)

Re: TP Link WR1043ND 11n gigabit router

Quick howto recover from bad flash.

Requirements: tfpd server with an address 192.168.0.5, file named code.bin containing openwrt firmware.

1. erase 0xbf020000 +7c0000

7c0000: size of the firmware

2. tftpboot 0x81000000 code.bin
3. cp.b 0x81000000 0xbf020000 0x7c0000
4. bootm 0xbf020000

Re: TP Link WR1043ND 11n gigabit router

Has anyone tried putting the TP-Link firmware back on ?

There are 2 sections in the TP-Link firmware,
0x00000 -> 0x20200 = Header + Uboot
0x20200 -> 0x7E01FF = Header + Firmware

So as we can see, flashing with known methods will result in corrupt flash.

Re: TP Link WR1043ND 11n gigabit router

@andrewt12: when can we expect the patches for leds?

Re: TP Link WR1043ND 11n gigabit router

obsy wrote:

@andrewt12: when can we expect the patches for leds?

Ive got a bit preoccupied with the switch driver, I will submit the LED patch later tonight.

Also, I wrote a switch driver based on Realtek's code, It just set the default config but I could not make it work, Im thinking I need to do more than just set the registers and make vlans.  I will keep plugging away at it for now.

Cheers

Re: TP Link WR1043ND 11n gigabit router

andrewt12 wrote:
obsy wrote:

@andrewt12: when can we expect the patches for leds?

Ive got a bit preoccupied with the switch driver, I will submit the LED patch later tonight.

Also, I wrote a switch driver based on Realtek's code, It just set the default config but I could not make it work, Im thinking I need to do more than just set the registers and make vlans.  I will keep plugging away at it for now.

Cheers

If possible, please also enable the jumbo frame, which offical firmware seems disable that.

Re: TP Link WR1043ND 11n gigabit router

Ive just submitted the LED patch to OpenWrt-Devel, shouldn't be too long before its committed.

Re: TP Link WR1043ND 11n gigabit router

@andrewt12: active_low is wrong. 0 should  turn off led.

Re: TP Link WR1043ND 11n gigabit router

Yea I know, The first one I submitted was wrong and I send a new one 15 minutes later but the wrong one got applied. Ive submitted a fix. My bad.

Re: TP Link WR1043ND 11n gigabit router

Back to oryginal firmware: remove first 0x20200 bytes and just flash via uboot or mtd. Tested, working smile

23 (edited by andrewt12 2009-12-19 10:29:03)

Re: TP Link WR1043ND 11n gigabit router

Got the LEDS right now.

Back to oryginal firmware: remove first 0x20200 bytes and just flash via uboot or mtd. Tested, working

Good stuff.

Re: TP Link WR1043ND 11n gigabit router

Update- 

Got my rtl8366rb switch driver working. Had an endianness issue before.
It doesnt register with swconfig yet, so all you get is a static vlan setup of vlan 1 for lan and vlan 2 for wan. But it does the job. There is no way its going to get into trunk in its current form and its going to take me a while to get it to work with swconfig.

In a few days I will clean it up and host it for anyone who wants it.

Re: TP Link WR1043ND 11n gigabit router

good job! I can test if you want.