Skip to content

ath79: add support for TP-Link Archer D7/D7b v1#2079

Closed
DavideFioravanti wants to merge 1 commit intoopenwrt:masterfrom
DavideFioravanti:archer-d7-new
Closed

ath79: add support for TP-Link Archer D7/D7b v1#2079
DavideFioravanti wants to merge 1 commit intoopenwrt:masterfrom
DavideFioravanti:archer-d7-new

Conversation

@DavideFioravanti
Copy link
Copy Markdown
Contributor

@DavideFioravanti DavideFioravanti commented May 24, 2019

TP-Link Archer D7 v1 is a dual-band AC1750 router + modem.
The router section is based on Qualcomm/Atheros QCA9558 + QCA9880.
The "DSL" section is based on BCM6318 but it's currently not supported.

The Archer D7b seems to differ from the Archer D7 only in the
partition table

Router section - Specification:

775/650/258 MHz (CPU/DDR/AHB)
128 MB of RAM (DDR2)
16 MB of FLASH (SPI NOR)
3T3R 2.4 GHz
3T3R 5 GHz
4x 10/100/1000 Mbps Ethernet
7x LED, 2x button
UART header on PCB

Known issues:

Broadband LED (missing GPIO - probably driven by the BCM6318)
Internet LED (missing GPIO - probably driven by the BCM6318)
WIFI LED (working only for one interface at time, while in the
OEM firmware works for both wifi interfaces)
DSL not working (eth0) (WIP)

UART connection

J1 HEADER (Qualcomm CPU)
. VCC
. GND
. RX
O TX

J41 HEADER (Broadcom CPU)
. VCC
. GND
. RX
O TX

The following instructions require a connection to the J1 UART header
and are tested for the Archer D7 v1.
If you have an Arhcer D7b v1, you should change the names accordingly.

Flash instructions under U-Boot, using UART

  1. Press "tpl" to stop autobooting and obtain U-Boot CLI access.
  2. Setup ip addresses for U-Boot and your tftp server.
  3. Issue below commands:
    tftpboot 0x81000000 openwrt-ath79-generic-tplink_archer-d7-v1-squashfs-sysupgrade.bin
    erase 0x9f020000 +f90000
    cp.b 0x81000000 0x9f020000 0xf90000
    reset

Initramfs instructions under U-Boot for testing, using UART

  1. Press "tpl" to stop autobooting and obtain U-Boot CLI access.
  2. Setup ip addresses for U-Boot and your tftp server.
  3. Issue below commands:
    tftpboot 0x81000000 openwrt-ath79-generic-tplink_archer-d7-v1-initramfs-kernel.bin
    bootm 0x81000000
  4. Here you can backup the original firmware and/or flash the sysupgrade openwrt if you want

Restore the original firmware

  1. Backup every partition using the OpenWrt web interface
  2. Download the OEM firmware from the TP-Link website
  3. Extract the bin file in a folder (eg. Archer_D7v1_1.6.0_0.9.1_up_boot(160216)_2016-02-16_15.55.48.bin)
  4. Remove the U-Boot and the Broadcom image part from the file.
    Issue the following command:
    dd if="Archer_D7v1_1.6.0_0.9.1_up_boot(160216)_2016-02-16_15.55.48.bin" of="Archer_D7v1_1.6.0_0.9.1_up_boot(160216)_2016-02-16_15.55.48.bin.mod" skip=257 bs=512 count=31872
  5. Double check the .mod file size. It must be 16318464 bytes.
  6. Flash it using the OpenWrt web interface. Force the update if needed.
    WARNING: Remember to NOT keep settings.

5b. (Alternative to 5.) Flash it using the U-Boot and UART connection.
Issue below commands in the U-Boot:
tftpboot 0x81000000 Archer_D7v1_1.6.0_0.9.1_up_boot(160216)_2016-02-16_15.55.48.bin.mod
erase 0x9f020000 +f90000
cp.b 0x81000000 0x9f020000 0xf90000
reset

Signed-off-by: Davide Fioravanti [email protected]

@ynezz ynezz added the target/ath79 pull request/issue for ath79 target label May 24, 2019
};
};

gpio-export {
Copy link
Copy Markdown
Member

@chunkeey chunkeey Jun 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please convert this to use the userspace gpio-switch since gpio-export is never going to get accepted upstream.

See #1366 (comment)

EDIT: no wait. these are both usb power. So they are likely usb_vbus gpio regulators. Please look at
ar9331_tplink_tl-wr710n-v1.dts for an example on how to convert both to vbus regulator.

&eth0 {
status = "okay";

mtd-mac-address = <&romfs 0xf100>;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this handle is defined in the device .dts but not the .dtsi. It works, but it is sort of cheesy, please move this property (and mtd-mac-address-increment) to the two dts files instead.

lan {
label = "tp-link:white:lan";
gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
default-state = "off";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to specify "default-state = off". it's the default already.


define Device/tplink_archer-d7-v1
ATH_SOC := qca9558
DEVICE_TITLE := TP-Link Archer D7 v1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update to use DEVICE_VENDOR, DEVICE_MODEL and DEVICE_VARIANT as introduced in:
8c3dbaf


define Device/tplink_archer-d7b-v1
ATH_SOC := qca9558
DEVICE_TITLE := TP-Link Archer D7b v1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update to use DEVICE_VENDOR, DEVICE_MODEL and DEVICE_VARIANT as introduced in:
8c3dbaf

@adschm
Copy link
Copy Markdown
Member

adschm commented Jul 5, 2019

I'm currently working on a PR to store the label-mac-address in the DTS (#2159).

I would appreciate if you could provide information about your device:
Please run
find /proc/device-tree/ -name "*mac-address*"
on your device (just with the current firmware, no need to update anything; just has to be ath79, no ar71xx).
For each of the returned paths (if there are any), retrieve the mac-address with cat, e.g.
cat /proc/device-tree/ahb/eth@19000000/mac-address

Now check which of those returned MAC addresses matches the one on the label/sticker/case of your device and tell me the device-tree path leading to it. Note that you do not have to post your MAC addresses here, but just a statement about which match, e.g. like

/proc/device-tree/ahb/eth@1a000000/mac-address
/proc/device-tree/ahb/eth@1a000000/mtd-mac-address-increment
/proc/device-tree/ahb/eth@1a000000/mtd-mac-address
/proc/device-tree/ahb/eth@19000000/mac-address <== this one
/proc/device-tree/ahb/eth@19000000/mtd-mac-address
/proc/device-tree/ahb/apb/wmac@18100000/mac-address
/proc/device-tree/ahb/apb/wmac@18100000/mtd-mac-address

There may be one, two or no paths giving the correct address. It may also happen that the find command returns nothing. Thanks.

@adschm
Copy link
Copy Markdown
Member

adschm commented Jul 5, 2019

Unfortunately, my description is slightly incorrect. The MAC addresses are stored binary, so you can't read with cat, but have to use the following code to read from the paths retrieved by find:

. /lib/functions/system.sh
get_mac_binary "$yourpath" 0

The include is obviously only required once. Sorry.

tplink,archer-d7-v1|\
tplink,archer-d7b-v1)
ucidef_set_led_switch "lan" "LAN" "tp-link:white:lan" "switch0" "0x3c"
ucidef_set_led_wlan "wlan" "WLAN" "tp-link:white:wlan" "phy0tpt" "phy1tpt"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use linux,default-trigger = "phy0tpt"; and linux,default-trigger = "phy1tpt"; in your LED nodes instead. Configuration of LEDs in DTS is preferred. Example:

wlan {
label = "cf-e120a-v3:green:wlan";
gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};

#include "qca9557.dtsi"

/ {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this stray newline.

gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
trigger-sources = <&hub_port1>, <&hub_port0>;
linux,default-trigger = "usbport";
default-state = "off";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to specify "default-state = off". it's the default already.

DEVICE_TITLE := TP-Link Archer D7b v1
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k-ct ath10k-firmware-qca988x-ct
BOARDNAME := ARCHER-D7b-V1
IMAGE_SIZE := 15936k
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0xfa0000 != 15936k

@DavideFioravanti
Copy link
Copy Markdown
Contributor Author

DavideFioravanti commented Aug 11, 2019

@adrianschmutzler
Here you are.
The label says: XX:XX:XX:XX:XX:65

get_mac_binary /proc/device-tree/ahb/eth@1a000000/mac-address 0 ==> XX:XX:XX:XX:XX:65 (LAN)
get_mac_binary /proc/device-tree/ahb/eth@19000000/mac-address 0 ==> XX:XX:XX:XX:XX:66 (WAN)
get_mac_binary /proc/device-tree/ahb/wmac@18100000/mac-address 0 ==> XX:XX:XX:XX:XX:65 (2G)

@DavideFioravanti DavideFioravanti force-pushed the archer-d7-new branch 3 times, most recently from 18584f4 to d842fd6 Compare August 11, 2019 12:05
@DavideFioravanti
Copy link
Copy Markdown
Contributor Author

@ynezz @adrianschmutzler @chunkeey Sorry for my late reply. I just finished my university exams, so it won't happen anymore... I promise! 😄

I should have solved all the problems you found in the commit.

Moreover this is a dmesg from the router:

root@OpenWrt:~# dmesg
[    0.000000] Linux version 4.19.65 (fiore@FISSO-5MK32M9) (gcc version 7.4.0 (OpenWrt GCC 7.4.0 r9611-127d38f219)) #0 Sun Aug 11 09:45:41 2019
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019750 (MIPS 74Kc)
[    0.000000] MIPS: machine is TP-Link Archer D7 v1
[    0.000000] SoC: Qualcomm Atheros QCA9558 ver 1 rev 0
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] On node 0 totalpages: 32768
[    0.000000]   Normal zone: 288 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 32768 pages, LIFO batch:7
[    0.000000] random: get_random_bytes called from start_kernel+0x98/0x4a8 with crng_init=0
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32480
[    0.000000] Kernel command line: console=ttyS0,115200n8 rootfstype=squashfs,jffs2
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 122488K/131072K available (4274K kernel code, 178K rwdata, 1008K rodata, 1188K init, 207K bss, 8584K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 51
[    0.000000] CPU clock: 720.000 MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5309056796 ns
[    0.000007] sched_clock: 32 bits at 360MHz, resolution 2ns, wraps every 5965232126ns
[    0.008290] Calibrating delay loop... 358.80 BogoMIPS (lpj=1794048)
[    0.074983] pid_max: default: 32768 minimum: 301
[    0.080094] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.087128] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.098859] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.109361] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.115958] pinctrl core: initialized pinctrl subsystem
[    0.122322] NET: Registered protocol family 16
[    0.134058] PCI host bridge /ahb/pcie-controller@18250000 ranges:
[    0.140549]  MEM 0x0000000012000000..0x0000000013ffffff
[    0.146139]   IO 0x0000000000000001..0x0000000000000001
[    0.169473] PCI host bridge to bus 0000:00
[    0.173837] pci_bus 0000:00: root bus resource [mem 0x12000000-0x13ffffff]
[    0.181199] pci_bus 0000:00: root bus resource [io  0x0001]
[    0.187128] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.194357] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.202812] pci 0000:00:00.0: [168c:003c] type 00 class 0x028000
[    0.202866] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x001fffff 64bit]
[    0.202921] pci 0000:00:00.0: reg 0x30: [mem 0x00000000-0x0000ffff pref]
[    0.202997] pci 0000:00:00.0: supports D1
[    0.203006] pci 0000:00:00.0: PME# supported from D0 D1 D3hot
[    0.204056] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00
[    0.204081] pci 0000:00:00.0: BAR 0: assigned [mem 0x12000000-0x121fffff 64bit]
[    0.211913] pci 0000:00:00.0: BAR 6: assigned [mem 0x12200000-0x1220ffff pref]
[    0.222714] clocksource: Switched to clocksource MIPS
[    0.229018] NET: Registered protocol family 2
[    0.234404] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes)
[    0.242586] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.250045] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.256825] TCP: Hash tables configured (established 1024 bind 1024)
[    0.263708] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.269929] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.276941] NET: Registered protocol family 1
[    0.281616] PCI: CLS 0 bytes, default 32
[    0.284197] Crashlog allocated RAM at address 0x3f00000
[    0.290917] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    0.303423] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.309630] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.331552] io scheduler noop registered
[    0.335761] io scheduler deadline registered (default)
[    0.341939] ar7200-usb-phy 18030000.usb-phy0: phy reset is missing
[    0.348621] ar7200-usb-phy 18030010.usb-phy1: phy reset is missing
[    0.356836] pinctrl-single 1804002c.pinmux: 544 pins, size 68
[    0.363946] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.371282] console [ttyS0] disabled
[    0.375156] 18020000.uart: ttyS0 at MMIO 0x18020000 (irq = 9, base_baud = 2500000) is a 16550A
[    0.384353] console [ttyS0] enabled
[    0.391766] bootconsole [early0] disabled
[    0.417370] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.422190] 7 fixed-partitions partitions found on MTD device spi0.0
[    0.428662] Creating 7 MTD partitions on "spi0.0":
[    0.433556] 0x000000000000-0x000000020000 : "u-boot"
[    0.439334] 0x000000020000-0x000000fb0000 : "firmware"
[    0.447153] 2 tplink-fw partitions found on MTD device firmware
[    0.453207] Creating 2 MTD partitions on "firmware":
[    0.458252] 0x000000000000-0x0000001b7879 : "kernel"
[    0.463998] 0x0000001b787c-0x000000f90000 : "rootfs"
[    0.469623] mtd: device 3 (rootfs) set to be root filesystem
[    0.476679] 1 squashfs-split partitions found on MTD device rootfs
[    0.483014] 0x0000004b0000-0x000000f90000 : "rootfs_data"
[    0.489182] 0x000000fb0000-0x000000fc0000 : "radioDECT"
[    0.495170] 0x000000fc0000-0x000000fd0000 : "config"
[    0.500833] 0x000000fd0000-0x000000fe0000 : "romfs"
[    0.506526] 0x000000fe0000-0x000000ff0000 : "rom"
[    0.511934] 0x000000ff0000-0x000001000000 : "art"
[    0.518386] libphy: Fixed MDIO Bus: probed
[    0.874496] libphy: ag71xx_mdio: probed
[    0.881028] switch0: Atheros AR8327 rev. 4 switch registered on mdio-bus.0
[    1.532051] ag71xx 19000000.eth: connected to PHY at mdio-bus.0:00 [uid=004dd034, driver=Atheros AR8216/AR8236/AR8316]
[    1.543472] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode: rgmii
[    1.884387] ag71xx 1a000000.eth: connected to PHY at fixed-0:00 [uid=00000000, driver=Generic PHY]
[    1.894083] eth1: Atheros AG71xx at 0xba000000, irq 5, mode: sgmii
[    1.902521] NET: Registered protocol family 10
[    1.911637] Segment Routing with IPv6
[    1.915504] NET: Registered protocol family 17
[    1.920078] 8021q: 802.1Q VLAN Support v1.8
[    1.926973] usb_vbus: disabling
[    1.938585] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    1.950029] Freeing unused kernel memory: 1188K
[    1.954661] This architecture does not have kernel memory protection.
[    1.961185] Run /sbin/init as init process
[    2.562727] random: fast init done
[    2.939052] init: Console is alive
[    2.942692] init: - watchdog -
[    4.818118] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    5.199116] usbcore: registered new interface driver usbfs
[    5.204810] usbcore: registered new interface driver hub
[    5.210271] usbcore: registered new device driver usb
[    5.220742] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.234350] SCSI subsystem initialized
[    5.242388] ehci-platform: EHCI generic platform driver
[    5.247953] ehci-platform 1b000000.usb: EHCI Host Controller
[    5.253771] ehci-platform 1b000000.usb: new USB bus registered, assigned bus number 1
[    5.261781] ehci-platform 1b000000.usb: irq 14, io mem 0x1b000000
[    5.292740] ehci-platform 1b000000.usb: USB 2.0 started, EHCI 1.00
[    5.299754] hub 1-0:1.0: USB hub found
[    5.303907] hub 1-0:1.0: 1 port detected
[    5.308428] ehci-platform 1b400000.usb: EHCI Host Controller
[    5.314248] ehci-platform 1b400000.usb: new USB bus registered, assigned bus number 2
[    5.322274] ehci-platform 1b400000.usb: irq 15, io mem 0x1b400000
[    5.352740] ehci-platform 1b400000.usb: USB 2.0 started, EHCI 1.00
[    5.359755] hub 2-0:1.0: USB hub found
[    5.363911] hub 2-0:1.0: 1 port detected
[    5.371624] usbcore: registered new interface driver usb-storage
[    5.378529] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    5.396268] init: - preinit -
[    6.255699] usb 2-1: new high-speed USB device number 2 using ehci-platform
[    6.585024] usb-storage 2-1:1.0: USB Mass Storage device detected
[    6.655384] scsi host0: usb-storage 2-1:1.0
[    6.764548] random: procd: uninitialized urandom read (4 bytes read)
[    7.007941] random: jshn: uninitialized urandom read (4 bytes read)
[    7.203532] random: jshn: uninitialized urandom read (4 bytes read)
[    7.714046] scsi 0:0:0:0: Direct-Access     Kingston DataTraveler 3.0 PMAP PQ: 0 ANSI: 6
[    7.724609] sd 0:0:0:0: [sda] 60604416 512-byte logical blocks: (31.0 GB/28.9 GiB)
[    7.743152] sd 0:0:0:0: [sda] Write Protect is off
[    7.748057] sd 0:0:0:0: [sda] Mode Sense: 45 00 00 00
[    7.748722] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[    8.761595] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[    8.767637] IPv6: ADDRCONF(NETDEV_UP): eth1.1: link is not ready
[    8.863934]  sda: sda1
[    8.869697] sd 0:0:0:0: [sda] Attached SCSI removable disk
[    9.793845] eth1: link up (1000Mbps/Full duplex)
[    9.798546] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[    9.805305] IPv6: ADDRCONF(NETDEV_CHANGE): eth1.1: link becomes ready
[   12.031702] jffs2_scan_eraseblock(): End of filesystem marker found at 0x10000
[   12.039082] jffs2_build_filesystem(): unlocking the mtd device...
[   12.039117] done.
[   12.047348] jffs2_build_filesystem(): erasing all blocks after the end marker...
[   61.611083] done.
[   61.620675] jffs2: notice: (551) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   61.637668] mount_root: overlay filesystem has not been fully initialized yet
[   61.656852] mount_root: switching to jffs2 overlay
[   61.685148] overlayfs: upper fs does not support tmpfile.
[   62.014473] urandom-seed: Seed file not found (/etc/urandom.seed)
[   62.113712] eth1: link down
[   62.132525] procd: - early -
[   62.136327] procd: - watchdog -
[   62.812295] procd: - watchdog -
[   62.815768] procd: - ubus -
[   62.880379] urandom_read: 5 callbacks suppressed
[   62.880386] random: ubusd: uninitialized urandom read (4 bytes read)
[   62.892184] random: ubusd: uninitialized urandom read (4 bytes read)
[   62.899891] procd: - init -
[   63.637270] kmodloader: loading kernel modules from /etc/modules.d/*
[   63.809045] urngd: v1.0.0 started.
[   63.897241] Loading modules backported from Linux version v5.2-rc7-0-g6fbc7275c7a9
[   63.904970] Backport generated by backports.git v5.2-rc7-1-0-g021a6ba1
[   63.948852] usbcore: registered new interface driver ums-alauda
[   63.963953] usbcore: registered new interface driver ums-cypress
[   63.983815] usbcore: registered new interface driver ums-datafab
[   63.997657] random: crng init done
[   64.002065] usbcore: registered new interface driver ums-freecom
[   64.009997] usbcore: registered new interface driver ums-isd200
[   64.017695] usbcore: registered new interface driver ums-jumpshot
[   64.025521] usbcore: registered new interface driver ums-karma
[   64.033388] usbcore: registered new interface driver ums-sddr09
[   64.041109] usbcore: registered new interface driver ums-sddr55
[   64.048983] usbcore: registered new interface driver ums-usbat
[   64.064788] xt_time: kernel timezone is -0000
[   64.132111] PPP generic driver version 2.4.2
[   64.138735] NET: Registered protocol family 24
[   64.174027] ath10k 4.19 driver, optimized for CT firmware, probing pci device: 0x3c.
[   64.183134] ath10k_pci 0000:00:00.0: enabling device (0000 -> 0002)
[   64.191751] ath10k_pci 0000:00:00.0: pci irq legacy oper_irq_mode 1 irq_mode 0 reset_mode 0
[   64.666600] firmware ath10k!fwcfg-pci-0000:00:00.0.txt: firmware_loading_store: map pages failed
[   64.857213] firmware ath10k!pre-cal-pci-0000:00:00.0.bin: firmware_loading_store: map pages failed
[   65.281344] firmware ath10k!QCA988X!hw2.0!ct-firmware-5.bin: firmware_loading_store: map pages failed
[   65.472061] firmware ath10k!QCA988X!hw2.0!ct-firmware-2.bin: firmware_loading_store: map pages failed
[   65.662550] firmware ath10k!QCA988X!hw2.0!firmware-6.bin: firmware_loading_store: map pages failed
[   65.853770] firmware ath10k!QCA988X!hw2.0!firmware-5.bin: firmware_loading_store: map pages failed
[   66.043706] firmware ath10k!QCA988X!hw2.0!firmware-4.bin: firmware_loading_store: map pages failed
[   66.234515] firmware ath10k!QCA988X!hw2.0!firmware-3.bin: firmware_loading_store: map pages failed
[   66.247276] ath10k_pci 0000:00:00.0: qca988x hw2.0 target 0x4100016c chip_id 0x043202ff sub 0000:0000
[   66.256684] ath10k_pci 0000:00:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
[   66.269091] ath10k_pci 0000:00:00.0: firmware ver 10.1-ct-8x-__fW-022-8f2afb9e api 2 features wmi-10.x,has-wmi-mgmt-tx,mfp,txstatus-noack,wmi-10.x-CT,ratemask-CT,txrate-CT,get-temp-CT,tx-rc-CT,cust-stats-CT,retry-gt2-CT,txrate2-CT,beacon-cb-CT,wmi-block-ack-CT crc32 f90f1a48
[   66.499780] firmware ath10k!QCA988X!hw2.0!board-2.bin: firmware_loading_store: map pages failed
[   66.509069] ath10k_pci 0000:00:00.0: board_file api 1 bmi_id N/A crc32 bebc7c08
[   67.451808] ath10k_pci 0000:00:00.0: 10.1 wmi init: vdevs: 16  peers: 127  tid: 256
[   67.469266] ath10k_pci 0000:00:00.0: wmi print 'P 128 V 8 T 410'
[   67.475602] ath10k_pci 0000:00:00.0: wmi print 'msdu-desc: 1424  sw-crypt: 0 ct-sta: 0'
[   67.483758] ath10k_pci 0000:00:00.0: wmi print 'alloc rem: 20904 iram: 26120'
[   67.551831] ath10k_pci 0000:00:00.0: htt-ver 2.1 wmi-op 2 htt-op 2 cal file max-sta 128 raw 0 hwcrypto 1
[   67.564639] ath10k_pci 0000:00:00.0: NOTE:  Firmware DBGLOG output disabled in debug_mask: 0x10000000
[   67.705948] ath: EEPROM regdomain: 0x0
[   67.705955] ath: EEPROM indicates default country code should be used
[   67.705958] ath: doing EEPROM country->regdmn map search
[   67.705970] ath: country maps to regdmn code: 0x3a
[   67.705975] ath: Country alpha2 being used: US
[   67.705978] ath: Regpair used: 0x3a
[   67.789729] ath: EEPROM regdomain: 0x0
[   67.789736] ath: EEPROM indicates default country code should be used
[   67.789739] ath: doing EEPROM country->regdmn map search
[   67.789752] ath: country maps to regdmn code: 0x3a
[   67.789756] ath: Country alpha2 being used: US
[   67.789760] ath: Regpair used: 0x3a
[   67.807247] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
[   67.808578] ieee80211 phy1: Atheros AR9550 Rev:0 mem=0xb8100000, irq=12
[   67.901755] kmodloader: done loading kernel modules from /etc/modules.d/*
[   79.600092] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[   79.607209] eth1: link up (1000Mbps/Full duplex)
[   79.611904] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[   79.650904] br-lan: port 1(eth1.1) entered blocking state
[   79.656430] br-lan: port 1(eth1.1) entered disabled state
[   79.662177] device eth1.1 entered promiscuous mode
[   79.667083] device eth1 entered promiscuous mode
[   79.763929] br-lan: port 1(eth1.1) entered blocking state
[   79.769414] br-lan: port 1(eth1.1) entered forwarding state
[   79.775256] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   79.847323] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   79.876395] IPv6: ADDRCONF(NETDEV_UP): eth0.2: link is not ready
[   80.720760] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   80.914035] eth0: link up (1000Mbps/Full duplex)
[   80.939817] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   80.986152] IPv6: ADDRCONF(NETDEV_CHANGE): eth0.2: link becomes ready
[   84.491714] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
[   84.618579] br-lan: port 2(wlan1) entered blocking state
[   84.624023] br-lan: port 2(wlan1) entered disabled state
[   84.629952] device wlan1 entered promiscuous mode
[   84.704999] IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
[   84.711611] br-lan: port 2(wlan1) entered blocking state
[   84.717054] br-lan: port 2(wlan1) entered forwarding state
[   85.833008] ath10k_pci 0000:00:00.0: 10.1 wmi init: vdevs: 16  peers: 127  tid: 256
[   85.850469] ath10k_pci 0000:00:00.0: wmi print 'P 128 V 8 T 410'
[   85.856831] ath10k_pci 0000:00:00.0: wmi print 'msdu-desc: 1424  sw-crypt: 0 ct-sta: 0'
[   85.864991] ath10k_pci 0000:00:00.0: wmi print 'alloc rem: 20904 iram: 26120'
[   85.975459] ath10k_pci 0000:00:00.0: pdev param 0 not supported by firmware
[   86.084334] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[   86.213612] br-lan: port 3(wlan0) entered blocking state
[   86.219028] br-lan: port 3(wlan0) entered disabled state
[   86.224767] device wlan0 entered promiscuous mode
[   86.365669] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[   86.372313] br-lan: port 3(wlan0) entered blocking state
[   86.377748] br-lan: port 3(wlan0) entered forwarding state

tplink,archer-d7-v1|\
tplink,archer-d7b-v1)
ucidef_add_switch "switch0" \
"0@eth1" "3:lan:3" "4:lan:2" "5:lan:1" "6@eth0" "2:wan:4" "1:wan"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"1:wan:5" instead of "1:wan"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how to name it... It is an internal wan connected to the Broadcom cpu (I can't test it because I don't have an adsl anymore, but it could work if previously configured using the OEM fw)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I'm not sure, but if you keep like this, won't you have two "port 1" in luci then?
If it's only internal and there is not external access anyway, I would not initialize it here, but just remove it.

IMAGES := sysupgrade.bin
IMAGE/sysupgrade.bin := tplink-v2-image -s -V "ver. 2.0" | \
append-metadata | check-size $$$$(IMAGE_SIZE)
SUPPORTED_DEVICES += archer-d7-v1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find an archer-d7-v1 in ar71xx. Remove it? Same for d7b?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question also arises for already merged d50-v1. This one also it not supported in ar71xx, so I suppose the SUPPORTED_DEVICES can be removed there, too?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it wasn't present there: Yes

@DavideFioravanti
Copy link
Copy Markdown
Contributor Author

Technically, yes, but since you set mtd-mac-address in the DTS files, it would be nicer to keep MAC definition and "use" (i.e. label-mac-device) in the same file.

Ok, fine!
Added your aliases and rebased.

@DavideFioravanti DavideFioravanti changed the title ath79: add support for TP-Link Archer D7(b) v1 ath79: add support for TP-Link Archer D7/D7b v1 Sep 29, 2019
@powo01
Copy link
Copy Markdown

powo01 commented Oct 3, 2019

Hello,

I have build problems with this patch and also with your own branch

Error: ../dts/qca9558_tplink_archer-d7-v1.dts:11.1-8 syntax error
FATAL ERROR: Unable to parse input tree

Regards,
Wolfgang

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@powo01
Copy link
Copy Markdown

powo01 commented Oct 3, 2019

@adrianschmutzler Thanks, now build working :-)

@adschm
Copy link
Copy Markdown
Member

adschm commented Oct 29, 2019

@DavideFioravanti Ping.

@DavideFioravanti
Copy link
Copy Markdown
Contributor Author

@adrianschmutzler Rebased and tested

@DavideFioravanti DavideFioravanti force-pushed the archer-d7-new branch 2 times, most recently from 42aba24 to b71a3e2 Compare January 19, 2020 20:07
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just added a tplink-v2 definition to ath79:
4897bf0

You should be able to reuse that one instead of the tplink-qca-dsl here.

While at it, please check whether you need the "-s" for the KERNEL_INITRAMFS.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated my commit and I can confirm you that it's working using the tplink-v2 definition (I tested both initramfs and sysupgrade image).

For what concerns the "-s" option, it's working?
Looking into https://github.com/openwrt/openwrt/blob/master/tools/firmware-utils/src/mktplinkfw2.c seems that the variable "strip_padding" is never used

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You were using the "-s" option for INITRAMFS, which I haven't seen elsewhere before (e.g. ramips does not use it.) So I was interested in whether it was actually necessary, and since you now have removed it here (by invoking tplink-v2), it looks like you don't need it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I don't need it.
However I was saying that the "-s" option doesn't do anything in mktplinkfw2.c... or am I missing something?

TP-Link Archer D7 v1 is a dual-band AC1750 router + modem.
The router section is based on Qualcomm/Atheros QCA9558 + QCA9880.
The "DSL" section is based on BCM6318 but it's currently not supported.

The Archer D7b seems to differ from the Archer D7 only in the
partition table

Router section - Specification:

775/650/258 MHz (CPU/DDR/AHB)
128 MB of RAM (DDR2)
16 MB of FLASH (SPI NOR)
3T3R 2.4 GHz
3T3R 5 GHz
4x 10/100/1000 Mbps Ethernet
7x LED, 2x button
UART header on PCB

Known issues:

Broadband LED (missing GPIO - probably driven by the BCM6318)
Internet LED (missing GPIO - probably driven by the BCM6318)
WIFI LED (working only for one interface at time, while in the
OEM firmware works for both wifi interfaces)
DSL not working (eth0) (WIP)

UART connection
---------------
J1 HEADER (Qualcomm CPU)
. VCC
. GND
. RX
O TX

J41 HEADER (Broadcom CPU)
. VCC
. GND
. RX
O TX

The following instructions require a connection to the J1 UART header
and are tested for the Archer D7 v1.
If you have an Arhcer D7b v1, you should change the names accordingly.

Flash instructions under U-Boot, using UART
------------------------------------------
 1. Press "tpl" to stop autobooting and obtain U-Boot CLI access.
 2. Setup ip addresses for U-Boot and your tftp server.
 3. Issue below commands:
		tftpboot 0x81000000 openwrt-ath79-generic-tplink_archer-d7-v1-squashfs-sysupgrade.bin
		erase 0x9f020000 +f90000
		cp.b 0x81000000 0x9f020000 0xf90000
		reset

Initramfs instructions under U-Boot for testing, using UART
----------------------------------------------------------
 1. Press "tpl" to stop autobooting and obtain U-Boot CLI access.
 2. Setup ip addresses for U-Boot and your tftp server.
 3. Issue below commands:
		tftpboot 0x81000000 openwrt-ath79-generic-tplink_archer-d7-v1-initramfs-kernel.bin
		bootm 0x81000000
 4. Here you can backup the original firmware and/or flash the sysupgrade openwrt if you want

Restore the original firmware
-----------------------------
 0. Backup every partition using the OpenWrt web interface
 1. Download the OEM firmware from the TP-Link website
 2. Extract the bin file in a folder (eg. Archer_D7v1_1.6.0_0.9.1_up_boot(160216)_2016-02-16_15.55.48.bin)
 3. Remove the U-Boot and the Broadcom image part from the file.
	Issue the following command:
		dd if="Archer_D7v1_1.6.0_0.9.1_up_boot(160216)_2016-02-16_15.55.48.bin" of="Archer_D7v1_1.6.0_0.9.1_up_boot(160216)_2016-02-16_15.55.48.bin.mod" skip=257 bs=512 count=31872
 4. Double check the .mod file size. It must be 16318464 bytes.
 5. Flash it using the OpenWrt web interface. Force the update if needed.
	WARNING: Remember to NOT keep settings.

 5b. (Alternative to 5.) Flash it using the U-Boot and UART connection.
	Issue below commands in the U-Boot:
		tftpboot 0x81000000 Archer_D7v1_1.6.0_0.9.1_up_boot(160216)_2016-02-16_15.55.48.bin.mod
		erase 0x9f020000 +f90000
		cp.b 0x81000000 0x9f020000 0xf90000
		reset

Signed-off-by: Davide Fioravanti <[email protected]>
@adschm
Copy link
Copy Markdown
Member

adschm commented Feb 4, 2020

Hi, I plan to merge your PR, and have pulled the current state with some tiny adjustments to my staging tree: https://git.openwrt.org/?p=openwrt/staging/adrian.git;a=shortlog;h=refs/heads/staging

Please respond to the comments I will raise in a minute, I'd then change according to your answers directly in my staging tree.

tplink,archer-d7-v1|\
tplink,archer-d7b-v1)
ucidef_add_switch "switch0" \
"0@eth1" "3:lan:3" "4:lan:2" "5:lan:1" "6@eth0" "2:wan:4" "1:wan:5"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the commit message you say eth0 is not working ("WIP"). Can you provide more details on that? So, is just DSL not working, and this is acting as a switch, or should we better disable the ports?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Despite, you use fixed-link for eth1 in DTS, so how can you actually have two wan-ports then?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One port of the cpu is connected to the switch and the other port of the cpu is connected to the Broadcom cpu.
The last port of the switch is labeled as LAN/WAN so i chose to use this as wan port.

For what concerns the DSL part, the configuration of the DSL part is stored on the BCM flash.
If the dsl link is active and the user configured the modem using the OEM fw, it could work. However I don't have an adsl connection anymore so I can't test it but I chose to left it enabled because it doesn't cause trouble (many users alreay tested it https://forum.openwrt.org/t/archer-d7-support/15790/118)

I didn't get the question about the fixed-link... could you explain it? (I am sorry but I have very little experience in the dts world 😞 )

Copy link
Copy Markdown
Member

@adschm adschm Feb 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last port of the switch is labeled as LAN/WAN so i chose to use this as wan port.

So, this is either 2: or 1: (internally). Which is it and what's the other one then?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"2:wan:4" is the wan on the back of the router and it's labeled as WAN1 in the switch configuration page
"1:wan:5" is the internal wan and it's labeled as WAN2 in the switch configuration page

image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, that means you configure both WAN1 and WAN2 as if connected to eth0.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

wlan {
label = "tp-link:white:wlan";
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt", "phy1tpt";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this really work? From the commit message, it looks like it's only working for one interface at a time, which sounds to me like "broken". In this case, I'd actually prefer to have no default-trigger by default, so that user may set them up based on their needs afterwards.

Copy link
Copy Markdown
Contributor Author

@DavideFioravanti DavideFioravanti Feb 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't works as intended, in fact it follows just the phy0tpt state. Your solution is fine to me 😉


&pcie1 {
status = "okay";
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats for ath10k?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

@DavideFioravanti
Copy link
Copy Markdown
Contributor Author

@adrianschmutzler Probably during one rebase I removed the wps and rfkill button configuration.
Could you please add this section in the qca9558_tplink_archer-d7.dtsi before the reset button?

                wifi {
                        label = "WiFi button";
                        linux,code = <KEY_RFKILL>;
                        gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
                };

                wps {
                        label = "WPS button";
                        linux,code = <KEY_WPS_BUTTON>;
                        gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
                };

I tested it on my device and verified on the GPL:
WLAN_SW_BUTTON_GPIO=0 WPS_PUSH_BUTTON_GPIO=1

Thank you for your patience

@adschm
Copy link
Copy Markdown
Member

adschm commented Mar 18, 2020

Okay, will merge it today.

@adschm adschm closed this Mar 18, 2020
@Tarnatos
Copy link
Copy Markdown

Hey. Why Thies PR hast been closed? Archer D7 support look really interesting to me.

@powo01
Copy link
Copy Markdown

powo01 commented May 7, 2020

Hey. Why Thies PR hast been closed? Archer D7 support look really interesting to me.

it is already integrated in the openwrt master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs reviewer target/ath79 pull request/issue for ath79 target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants