Netgear R7800 exploration (IPQ8065, QCA9984)

do you have the uboot source of your router ?

@robimarko Do you have any experience with this kind of function (configuration of the gpio)

gpio_tlmm_config(gpio_data->gpio, 0, GPIO_INPUT,

                                        GPIO_NO_PULL, GPIO_2MA, GPIO_OE_DISABLE);

Am I wrong or this disables the gpio?

Yes, QCA uses that for all of the SoC-s in U-boot.
Its been a while since I was updating the GPIO driver in U-boot, but from what I remember it looks to set GPIO0 as input, disables pull-ups, sets drive current to 2mA(Lowest it can but it does not matter as its input) and clears the output enable bit so that pin cant accidentally become an output.

FYI, according to the datasheet GPIO0 has no special function and can only be used as GPIO.
If you need some info about a specific pin feel free to ask.

The gpio it's the pcie reset I'm trying to understand why pci have problem with using bootm instead of bootipq (the difference is it does the pci deinit that use that specific function)

Then the pci driver in the kernel assert the same gpio so I'm trying to understand if that's the problem...

(By removing the gpio the pci init in the right way but the driver finds 2 bus and ath10k_pci doesn't init (think it doesn't find the pci bus))

@anon50098793 well i actually fixed the pcie with bootm :smiley:

It was a problem with resets not asserted... testing if this cause ANY problem with normal image

Well that it kind of a big bug, driver was not asserting them or wrong ones were defined?

uboot when bootipq is called deint the pci (the function assert the reset, write 1 in a reg and disable the clks) when bootm is called, the deinit function is not called at all...

So when bootm is called the pci regs are not actually reset and wrong config are set for the pci interface.

(for example more bus detected, pci not set to bridge mode...)

Ok, that makes sense.
But isnt the Linux driver supposed to call resets before configuration?

If not than adding that should solve the issue

Think the problem is that this operation has to be done before calling the reset gpio

Why is that a issue?

ok no... the bug is that the resets are not asserted and the reg is not set on init... (with bootipq works because it does for us... bootm doesn't work because nobody does this task)

1 Like

Ok, so its a driver bug then.
I already see your patch on the mailing list

https://github.com/openwrt/openwrt/pull/3377 here is the pr...

@anon50098793 can you test? i tested on my r7800 with both initramfs and a flashed image but it would be good to have more test

@robimarko eh more or less... IMHO it's a uboot bug since it's uboot that doesn't reset the pci (a bootloader should prepare the device not cause a bug that needs to be fixed with a reset from the dedicated driver)

1 Like

Well, Linux should not really depend on the bootloader doing initialisation anyway.
So its a driver bug.

You are right... anyway i think they will complain about the extra writel for sure but i really can't find a reason why it's there...

Potentially, but since PARF is Qcom specific we have no way of knowing which actuall bit is being changed to get it to work.

Tried without that and doesn't change anything... very funny... also i notice that our driver lacks some strange config comparing it to the bootloader version....

For example

		/* enable access to PCIe slave port on system fabric */
		if (i == 0) {
			writel(BIT(4), PCIE_SFAB_AXI_S5_FCLK_CTL);
		}

(also slave 1?!?!? call the police)

And we have 3 different version where they set the buffer to 1k 256B and 2k...

  • 1k from qsdk original
  • 256 from netgear source
  • 2k standard driver ?
	/* 1K PCIE buffer setting */
	writel(0x3, cfg->pcie20 + PCIE20_AXI_MSTR_RESP_COMP_CTRL0);
	writel(0x1, cfg->pcie20 + PCIE20_AXI_MSTR_RESP_COMP_CTRL1);

Well, who can know what QCA are doing.
It also largelly depends on version of bootloader used

1 Like

yup, wireless all good with that patch and bootm here...

probably testing on more bootipq systems would be more relavent for a change like this?

anyway... nice work narrowing it down so fast...

had to adjust some stuff re: unrelated? dwc3 phy KCONF for usb booting... but i'm pretty sure that's my issue...

##########  CONFIG_PHY_QCOM_DWC3=y >>> ? 
CONFIG_PHY_QCOM_IPQ806X_USB=y
dmesg with some dwc3 phy irq not found probably unrelated and might have always been there
[    0.068472] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.108661] qcom-pcie 1b500000.pci: 1b500000.pci supply vdda not found, using dummy regulator
[    0.108804] qcom-pcie 1b500000.pci: 1b500000.pci supply vdda_phy not found, using dummy regulator
[    0.108916] qcom-pcie 1b500000.pci: 1b500000.pci supply vdda_refclk not found, using dummy regulator
[    0.109181] qcom-pcie 1b500000.pci: host bridge /soc/pci@1b500000 ranges:
[    0.109251] qcom-pcie 1b500000.pci:    IO 0x0fe00000..0x0fefffff -> 0x0fe00000
[    0.109289] qcom-pcie 1b500000.pci:   MEM 0x08000000..0x0fdfffff -> 0x08000000
[    0.329811] qcom-pcie 1b500000.pci: Link up
[    0.329994] qcom-pcie 1b500000.pci: PCI host bridge to bus 0000:00
[    0.330017] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.330036] pci_bus 0000:00: root bus resource [io  0x0000-0xfffff] (bus address [0xfe00000-0xfefffff])
[    0.330054] pci_bus 0000:00: root bus resource [mem 0x08000000-0x0fdfffff]
[    0.330118] pci 0000:00:00.0: [17cb:0101] type 01 class 0xff0000
[    0.330284] pci 0000:00:00.0: supports D1
[    0.330300] pci 0000:00:00.0: PME# supported from D0 D1 D3hot
[    0.334083] PCI: bus0: Fast back to back transfers disabled
[    0.334545] pci 0000:01:00.0: [168c:0046] type 00 class 0x028000
[    0.334903] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x001fffff 64bit]
[    0.336055] pci 0000:01:00.0: PME# supported from D0 D3hot D3cold
[    0.340032] PCI: bus1: Fast back to back transfers disabled
[    0.340118] pci 0000:00:00.0: BAR 8: assigned [mem 0x08000000-0x081fffff]
[    0.340144] pci 0000:01:00.0: BAR 0: assigned [mem 0x08000000-0x081fffff 64bit]
[    0.340276] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[    0.340301] pci 0000:00:00.0:   bridge window [mem 0x08000000-0x081fffff]
[    0.341252] pcieport 0000:00:00.0: AER: enabled with IRQ 36

[    2.509140] ipq806x-gmac-dwmac 37400000.ethernet: TX Checksum insertion supported
[    2.514949] ipq806x-gmac-dwmac 37400000.ethernet: Wake-Up On Lan supported
[    2.522256] ipq806x-gmac-dwmac 37400000.ethernet: Enhanced/Alternate descriptors
[    2.529101] ipq806x-gmac-dwmac 37400000.ethernet: Enabled extended descriptors
[    2.536661] ipq806x-gmac-dwmac 37400000.ethernet: Ring mode enabled
[    2.543610] ipq806x-gmac-dwmac 37400000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    2.549862] ipq806x-gmac-dwmac 37400000.ethernet: device MAC address 2e:3c:92:f8:9c:60
[    2.561312] dwc3-qcom 110f8800.usb3: IRQ hs_phy_irq not found
[    2.566266] dwc3-qcom 110f8800.usb3: IRQ dp_hs_phy_irq not found
[    2.571997] dwc3-qcom 110f8800.usb3: IRQ dm_hs_phy_irq not found
[    2.578156] dwc3-qcom 110f8800.usb3: IRQ ss_phy_irq not found
[    2.584743] dwc3 11000000.dwc3: Failed to get clk 'ref': -2
[    2.659459] dwc3-qcom 100f8800.usb3: IRQ hs_phy_irq not found
[    2.659496] dwc3-qcom 100f8800.usb3: IRQ dp_hs_phy_irq not found
[    2.664191] dwc3-qcom 100f8800.usb3: IRQ dm_hs_phy_irq not found
[    2.670351] dwc3-qcom 100f8800.usb3: IRQ ss_phy_irq not found
[    2.676882] dwc3 10000000.dwc3: Failed to get clk 'ref': -2
[    2.748932] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[    2.749000] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
[    2.753545] xhci-hcd xhci-hcd.0.auto: hcc params 0x0228f065 hci version 0x96 quirks 0x0000000002010000
[    2.761051] xhci-hcd xhci-hcd.0.auto: irq 41, io mem 0x11000000
[    2.771090] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.04
[    2.776153] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.784493] usb usb1: Product: xHCI Host Controller
[    2.791597] usb usb1: Manufacturer: Linux 5.4.60 xhci-hcd
[    2.796457] usb usb1: SerialNumber: xhci-hcd.0.auto
[    2.802463] hub 1-0:1.0: USB hub found
[    2.806766] hub 1-0:1.0: 1 port detected
[    2.810862] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[    2.814621] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
[    2.819825] xhci-hcd xhci-hcd.0.auto: Host supports USB 3.0 SuperSpeed
[    2.827607] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    2.834260] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.04
[    2.842299] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.850376] usb usb2: Product: xHCI Host Controller
[    2.857561] usb usb2: Manufacturer: Linux 5.4.60 xhci-hcd
[    2.862256] usb usb2: SerialNumber: xhci-hcd.0.auto
[    2.868358] hub 2-0:1.0: USB hub found
[    2.872558] hub 2-0:1.0: 1 port detected
[    2.878044] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[    2.880422] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 3
[    2.885982] xhci-hcd xhci-hcd.1.auto: hcc params 0x0228f065 hci version 0x100 quirks 0x0000000002010010
[    2.893318] xhci-hcd xhci-hcd.1.auto: irq 42, io mem 0x10000000
[    2.903414] usb usb3: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.04
[    2.908609] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.916964] usb usb3: Product: xHCI Host Controller
[    2.924061] usb usb3: Manufacturer: Linux 5.4.60 xhci-hcd
[    2.928913] usb usb3: SerialNumber: xhci-hcd.1.auto
[    2.935010] hub 3-0:1.0: USB hub found
[    2.939138] hub 3-0:1.0: 1 port detected
[    2.943288] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[    2.947076] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 4
[    2.952286] xhci-hcd xhci-hcd.1.auto: Host supports USB 3.0 SuperSpeed
[    2.960082] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
[    2.966785] usb usb4: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.04
[    2.974743] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.982746] usb usb4: Product: xHCI Host Controller
[    2.990033] usb usb4: Manufacturer: Linux 5.4.60 xhci-hcd
[    2.994798] usb usb4: SerialNumber: xhci-hcd.1.auto
[    3.000788] hub 4-0:1.0: USB hub found
[    3.005100] hub 4-0:1.0: 1 port detected
[    3.009735] usbcore: registered new interface driver uas
[    3.013013] usbcore: registered new interface driver usb-storage
[    3.018494] i2c /dev entries driver
[    3.026611] cpuidle: enable-method property 'qcom,kpss-acc-v1' found operations
[    3.027469] cpuidle: enable-method property 'qcom,kpss-acc-v1' found operations
[    3.035821] mmci-pl18x 12400000.sdcc: mmc0: PL180 manf 51 rev0 at 0x12400000 irq 34,0 (pio)
[    3.042061] mmci-pl18x 12400000.sdcc: DMA channels RX dma0chan1, TX dma0chan2
[    3.076707] sdhci: Secure Digital Host Controller Interface driver
[    3.076739] sdhci: Copyright(c) Pierre Ossman
[    3.081777] sdhci-pltfm: SDHCI platform and OF driver helper
[    3.089040] NET: Registered protocol family 10
[    3.093397] Segment Routing with IPv6
[    3.096405] NET: Registered protocol family 17
[    3.100438] 8021q: 802.1Q VLAN Support v1.8
[    3.104469] Registering SWP/SWPB emulation handler
[    3.133632] qcom_rpm 108000.rpm: RPM firmware 3.0.16777372
[    3.147467] s1a: supplied by regulator-dummy
[    3.147574] s1a: Bringing 0uV into 1050000-1050000uV
[    3.151158] s1b: supplied by regulator-dummy
[    3.155924] s1b: Bringing 0uV into 1050000-1050000uV
[    3.160291] s2a: supplied by regulator-dummy
[    3.165096] s2a: Bringing 0uV into 775000-775000uV
[    3.169464] s2b: supplied by regulator-dummy
[    3.173873] s2b: Bringing 0uV into 775000-775000uV
[    �[    3.188734] Waiting for root device /dev/sda3...
[    3.222087] mmc0: new high speed MMC card at address 0001
[    3.222818] mmcblk0: mmc0:0001 M62704 3.53 GiB 
[    3.226817] mmcblk0boot0: mmc0:0001 M62704 partition 1 2.00 MiB
[    3.231057] mmcblk0boot1: mmc0:0001 M62704 partition 2 2.00 MiB
[    3.236917] mmcblk0rpmb: mmc0:0001 M62704 partition 3 512 KiB, chardev (248:0)
[    3.244817]  mmcblk0: p1 p3 p4 < p5 p6 p7 >
[    3.335126] usb 3-1: new high-speed USB device number 2 using xhci-hcd
[    3.519254] usb 3-1: New USB device found, idVendor=0930, idProduct=1400, bcdDevice= 1.00
[    3.519307] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    3.526522] usb 3-1: Product: TOSHIBA USB DRV
[    3.533539] usb 3-1: Manufacturer: TOSHIBA
[    3.537988] usb 3-1: SerialNumber: 0708598439943D63
[    3.543318] usb-storage 3-1:1.0: USB Mass Storage device detected
[    3.547446] scsi host0: usb-storage 3-1:1.0
[    4.556318] scsi 0:0:0:0: Direct-Access     TOSHIBA  TOSHIBA USB DRV  PMAP PQ: 0 ANSI: 6
[    4.558970] sd 0:0:0:0: [sda] 15654912 512-byte logical blocks: (8.02 GB/7.46 GiB)
[    4.564706] sd 0:0:0:0: [sda] Write Protect is off
[    4.572064] sd 0:0:0:0: [sda] No Caching mode page found
[    4.575784] sd 0:0:0:0: [sda] Assuming drive cache: write through
[    4.586046]  sda: sda1 sda2 sda3
[    4.590408] sd 0:0:0:0: [sda] Attached SCSI removable disk
[    4.603083] random: fast init done
[    4.607800] EXT4-fs (sda3): mounted filesystem with ordered data mode. Opts: (null)
[    4.607870] VFS: Mounted root (ext4 filesystem) readonly on device 8:3.
[    4.615473] Freeing unused kernel memory: 1024K
[    4.634674] Run /sbin/init as init process
[    4.698059] init: Console is alive
[    4.698252] init: - watchdog -
[    4.811023] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    4.820764] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    4.831989] ehci-fsl: Freescale EHCI Host controller driver
[    4.832545] ehci-platform: EHCI generic platform driver
[    4.840072] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    4.841982] ohci-platform: OHCI generic platform driver
[    4.851341] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    4.858944] init: - preinit -
[    5.018516] random: jshn: uninitialized urandom read (4 bytes read)
[    5.043334] random: jshn: uninitialized urandom read (4 bytes read)
[    5.159336] random: jshn: uninitialized urandom read (4 bytes read)
[    6.063948] urandom_read: 2 callbacks suppressed
[    6.063955] random: procd: uninitialized urandom read (4 bytes read)
[    6.068456] dwmac1000: Master AXI performs any burst length
[    6.073981] ipq806x-gmac-dwmac 37400000.ethernet eth1: No Safety Features support found
[    6.079366] ipq806x-gmac-dwmac 37400000.ethernet eth1: IEEE 1588-2008 Advanced Timestamp supported
[    6.087487] ipq806x-gmac-dwmac 37400000.ethernet eth1: registered PTP clock
[    6.096372] ipq806x-gmac-dwmac 37400000.ethernet eth1: configuring for fixed/sgmii link mode
[    6.104158] ipq806x-gmac-dwmac 37400000.ethernet eth1: Link is Up - 1Gbps/Full - flow control off
[   10.681425] ath10k 5.4 driver, optimized for CT firmware, probing pci device: 0x46.
[   10.681481] ath10k_mac_create, priv_size: 868  hw: 10f41b8d  hw->priv: 47d6bf3d
[   10.690260] ath10k_pci 0000:01:00.0: enabling device (0140 -> 0142)
[   10.695828] ath10k_pci 0000:01:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 reset_mode 0
[   11.225013] ath10k_pci 0000:01:00.0: qca9984/qca9994 hw1.0 target 0x01000000 chip_id 0x00000000 sub 168c:cafe
[   11.225050] ath10k_pci 0000:01:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
[   11.236445] ath10k_pci 0000:01:00.0: firmware ver 10.4b-ct-9984-fW-13-795874169 api 5 features mfp,peer-flow-ctrl,txstatus-noack,wm9
[   13.570209] ath10k_pci 0000:01:00.0: board_file api 2 bmi_id 0:1 crc32 85498734
[   19.413704] ath10k_pci 0000:01:00.0: unsupported HTC service id: 1536
[   19.414918] ath10k_pci 0000:01:00.0: 10.4 wmi init: vdevs: 16  peers: 48  tid: 96
[   19.419119] ath10k_pci 0000:01:00.0: msdu-desc: 2500  skid: 32
[   19.502152] ath10k_pci 0000:01:00.0: wmi print 'P 48/48 V 16 K 144 PH 176 T 186  msdu-desc: 2500  sw-crypt: 0 ct-sta: 0'
[   19.502994] ath10k_pci 0000:01:00.0: wmi print 'free: 84920 iram: 13316 sram: 11224'
[   19.792132] ath10k_pci 0000:01:00.0: htt-ver 2.2 wmi-op 6 htt-op 4 cal pre-cal-file max-sta 32 raw 0 hwcrypto 1
[   19.891634] ath10k 5.4 driver, optimized for CT firmware, probing pci device: 0x46.
[   19.891767] ath10k_mac_create, priv_size: 868  hw: f7d333c6  hw->priv: 051ab781
[   19.898917] ath10k_pci 0001:01:00.0: enabling device (0140 -> 0142)
[   19.906014] ath10k_pci 0001:01:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 reset_mode 0
[   21.020773] ath10k_pci 0001:01:00.0: qca9984/qca9994 hw1.0 target 0x01000000 chip_id 0x00000000 sub 168c:cafe
[   21.020805] ath10k_pci 0001:01:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
[   21.031710] ath10k_pci 0001:01:00.0: firmware ver 10.4b-ct-9984-fW-13-795874169 api 5 features mfp,peer-flow-ctrl,txstatus-noack,wm9
[   23.362254] ath10k_pci 0001:01:00.0: board_file api 2 bmi_id 0:2 crc32 85498734
[   29.209972] ath10k_pci 0001:01:00.0: unsupported HTC service id: 1536
[   29.210784] ath10k_pci 0001:01:00.0: 10.4 wmi init: vdevs: 16  peers: 48  tid: 96
[   29.215477] ath10k_pci 0001:01:00.0: msdu-desc: 2500  skid: 32
[   29.299040] ath10k_pci 0001:01:00.0: wmi print 'P 48/48 V 16 K 144 PH 176 T 186  msdu-desc: 2500  sw-crypt: 0 ct-sta: 0'
[   29.299900] ath10k_pci 0001:01:00.0: wmi print 'free: 84920 iram: 13316 sram: 11224'
[   29.674260] ath10k_pci 0001:01:00.0: htt-ver 2.2 wmi-op 6 htt-op 4 cal pre-cal-file max-sta 32 raw 0 hwcrypto 1

Any stability issue with the WiFi? (The other problem were already present and actually it's just the driver using legacy old driver)