openwrt / mt76

mac80211 driver for MediaTek MT76x0e, MT76x2e, MT7603, MT7615, MT7628 and MT7688
744 stars 341 forks source link

MT7612e interrupts initialization #464

Open TonyTarakan opened 4 years ago

TonyTarakan commented 4 years ago

Hello! I'm trying to start MT7612e with a custom MIPS board(Baikal architecture). At the moment I have the following situation: Attempt 1: Using a driver from 5.4.72 mainline I got ENOSYS error in mt76pci_probe. Function call order: mt76pci_probe -> devm_request_irq -> devm_request_threaded_irq -> request_threaded_irq -> _setup_irq _setup_irq returns -ENOSYS after checking if (desc>irq_data.chip == &no_irq_chip) return -ENOSYS;

As I understand this function uses INTx emulation mechanism. So I tried to enable MSI mechanism:

Attempt 2: I added pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES) function before calling devm_request_irq probe function finished without errors. The modem was detected as network device(wlan0). Connection is OK. Ping is OK But there is a problem on speed test(iperf): driver repeatedly falls on mt76_mcu_get_response:

mt76x2e 0000:00:00.0: MCU message 31 (seq 13) timed out
mt76x2e 0000:00:00.0: Firmware Version: 0.0.00
mt76x2e 0000:00:00.0: Build: 1
mt76x2e 0000:00:00.0: Build Time: 201507311614____
mt76x2e 0000:00:00.0: Firmware running!
ieee80211 phy2: Hardware restart was requested

Can you explain why __setup_irq returns ENOSYS with default driver? Can mt76_mcu_get_response problem be caused by MSI mode?

TonyTarakan commented 4 years ago

Seems like ENOSYS error caused by irq value:

usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
devm_request_irq irq = 34
__setup_irq returned: 0
devm_request_irq irq = 35
__setup_irq returned: 0

ahci 1f050000.sata: forcing port_map 0x0 -> 0x3
ahci 1f050000.sata: AHCI 0001.0300 32 slots 2 ports 6 Gbps 0x3 impl platform mode
ahci 1f050000.sata: flags: ncq sntf pm led clo only pmp fbs pio slum part ccc apst
ahci 1f050000.sata: port 0 is not capable of FBS
ahci 1f050000.sata: port 1 is not capable of FBS
devm_request_irq irq = 15
__setup_irq returned: 0

i2c /dev entries driver
devm_request_irq irq = 44
__setup_irq returned: 0

dw_pci 1f052000.pci: DW PCIe driver successfully loaded.
dw_pci 1f052000.pci: MSI IRQ:16   AER IRQ:17

dw_pcie_init: DEV_ID_VEND_ID=0x80601d39 CLASS_CODE_REV_ID=0x1
dw_pcie_init: PCIe link speed GEN1 x1
PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [mem 0x20000000-0x3040ffff]
pci_bus 0000:00: root bus resource [io  0x1b520000-0x1bdaffff]
pci_bus 0000:00: root bus resource [bus 01-30]
pci 0000:00:00.0: [14c3:7612] type 00 class 0x028000
pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x000fffff 64bit]
pci 0000:00:00.0: reg 0x30: [mem 0x00000000-0x0000ffff pref]
pci 0000:00:00.0: PME# supported from D0 D3hot D3cold
pci 0000:00:00.0: BAR 0: assigned [mem 0x20000000-0x200fffff 64bit]
pci 0000:00:00.0: BAR 6: assigned [mem 0x20100000-0x2010ffff pref]
pci 0000:00:00.0: quirk irq: 0
pci 0000:00:00.0: BAR 0: remapped [mem 0x08000000-0x080fffff 64bit]
pci 0000:00:00.0: Link Capability is GEN1, x1
mt76x2e 0000:00:00.0: Device 14c3:7612, irq 0
mt76x2e 0000:00:00.0: enabling device (0000 -> 0002)
mt76x2e 0000:00:00.0: ASIC revision: 76120044
devm_request_irq irq = 0
__setup_irq returned: -89

Where are these irq numbers defined? For example why pdev->irq is 0?