megi's PinePhone Development Log RSS

Surgenons in Gaza Surgeons in Gaza

2024–02–28: Support for WiFi on QuartzPro64

So I got an itch to look at the AP6275P PCIe module again, which is present on QuartzPro64 board from Pine64.

And I managed to get it working with upstream bcrmfmac driver and some small patches

The only a bit more complicated thing to figure out was how to tie DT node to a PCIe device connected to a PCIe port, because this is not very well documented and invloves conjuring quite a few magic numbers, as can be seen in the above patch.

Then I had to add a way to enable 32kHz clock that is generated by the real-time clock chip and necessary for WiFi to function.

The result is that the chip now works:

iw phy
Wiphy phy0
        wiphy index: 0
        max # scan SSIDs: 10
        max scan IEs length: 2048 bytes
        max # sched scan SSIDs: 16
        max # match sets: 16
        Retry short limit: 7
        Retry long limit: 4
        Coverage class: 0 (up to 0m)
        Device supports roaming.
        Device supports T-DLS.
        Supported Ciphers:
                * WEP40 (00-0f-ac:1)
                * WEP104 (00-0f-ac:5)
                * TKIP (00-0f-ac:2)
                * CCMP-128 (00-0f-ac:4)
                * CMAC (00-0f-ac:6)
        Available Antennas: TX 0 RX 0
        Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * P2P-client
                 * P2P-GO
                 * P2P-device
        Band 1:
                Capabilities: 0x1022
                        HT20/HT40
                        Static SM Power Save
                        RX HT20 SGI
                        No RX STBC
                        Max AMSDU length: 3839 bytes
                        DSSS/CCK HT40
                Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
                Minimum RX AMPDU time spacing: 16 usec (0x07)
                HT TX/RX MCS rate indexes supported: 0-15
                Bitrates (non-HT):
                        * 1.0 Mbps
                        * 2.0 Mbps (short preamble supported)
                        * 5.5 Mbps (short preamble supported)
                        * 11.0 Mbps (short preamble supported)
                        * 6.0 Mbps
                        * 9.0 Mbps
                        * 12.0 Mbps
                        * 18.0 Mbps
                        * 24.0 Mbps
                        * 36.0 Mbps
                        * 48.0 Mbps
                        * 54.0 Mbps
                Frequencies:
                        * 2412.0 MHz [1] (20.0 dBm)
                        * 2417.0 MHz [2] (20.0 dBm)
                        * 2422.0 MHz [3] (20.0 dBm)
                        * 2427.0 MHz [4] (20.0 dBm)
                        * 2432.0 MHz [5] (20.0 dBm)
                        * 2437.0 MHz [6] (20.0 dBm)
                        * 2442.0 MHz [7] (20.0 dBm)
                        * 2447.0 MHz [8] (20.0 dBm)
                        * 2452.0 MHz [9] (20.0 dBm)
                        * 2457.0 MHz [10] (20.0 dBm)
                        * 2462.0 MHz [11] (20.0 dBm)
                        * 2467.0 MHz [12] (20.0 dBm)
                        * 2472.0 MHz [13] (20.0 dBm)
                        * 2484.0 MHz [14] (disabled)
        Band 2:
                Capabilities: 0x1062
                        HT20/HT40
                        Static SM Power Save
                        RX HT20 SGI
                        RX HT40 SGI
                        No RX STBC
                        Max AMSDU length: 3839 bytes
                        DSSS/CCK HT40
                Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
                Minimum RX AMPDU time spacing: 16 usec (0x07)
                HT TX/RX MCS rate indexes supported: 0-15
                VHT Capabilities (0x0c114820):
                        Max MPDU length: 3895
                        Supported Channel Width: neither 160 nor 80+80
                        short GI (80 MHz)
                        SU Beamformer
                        MU Beamformee
                VHT RX MCS set:
                        1 streams: MCS 0-9
                        2 streams: MCS 0-9
                        3 streams: not supported
                        4 streams: not supported
                        5 streams: not supported
                        6 streams: not supported
                        7 streams: not supported
                        8 streams: not supported
                VHT RX highest supported: 0 Mbps
                VHT TX MCS set:
                        1 streams: MCS 0-9
                        2 streams: MCS 0-9
                        3 streams: not supported
                        4 streams: not supported
                        5 streams: not supported
                        6 streams: not supported
                        7 streams: not supported
                        8 streams: not supported
                VHT TX highest supported: 0 Mbps
                VHT extended NSS: not supported
                Bitrates (non-HT):
                        * 6.0 Mbps
                        * 9.0 Mbps
                        * 12.0 Mbps
                        * 18.0 Mbps
                        * 24.0 Mbps
                        * 36.0 Mbps
                        * 48.0 Mbps
                        * 54.0 Mbps
                Frequencies:
                        * 5170.0 MHz [34] (20.0 dBm)
                        * 5180.0 MHz [36] (20.0 dBm)
                        * 5190.0 MHz [38] (20.0 dBm)
                        * 5200.0 MHz [40] (20.0 dBm)
                        * 5210.0 MHz [42] (20.0 dBm)
                        * 5220.0 MHz [44] (20.0 dBm)
                        * 5230.0 MHz [46] (20.0 dBm)
                        * 5240.0 MHz [48] (20.0 dBm)
                        * 5260.0 MHz [52] (20.0 dBm) (radar detection)
                        * 5280.0 MHz [56] (20.0 dBm) (radar detection)
                        * 5300.0 MHz [60] (20.0 dBm) (radar detection)
                        * 5320.0 MHz [64] (20.0 dBm) (radar detection)
                        * 5500.0 MHz [100] (20.0 dBm) (radar detection)
                        * 5520.0 MHz [104] (20.0 dBm) (radar detection)
                        * 5540.0 MHz [108] (20.0 dBm) (radar detection)
                        * 5560.0 MHz [112] (20.0 dBm) (radar detection)
                        * 5580.0 MHz [116] (20.0 dBm) (radar detection)
                        * 5600.0 MHz [120] (20.0 dBm) (radar detection)
                        * 5620.0 MHz [124] (20.0 dBm) (radar detection)
                        * 5640.0 MHz [128] (20.0 dBm) (radar detection)
                        * 5660.0 MHz [132] (20.0 dBm) (radar detection)
                        * 5680.0 MHz [136] (20.0 dBm) (radar detection)
                        * 5700.0 MHz [140] (20.0 dBm) (radar detection)
                        * 5720.0 MHz [144] (13.0 dBm) (radar detection)
                        * 5745.0 MHz [149] (13.0 dBm)
                        * 5765.0 MHz [153] (13.0 dBm)
                        * 5785.0 MHz [157] (13.0 dBm)
                        * 5805.0 MHz [161] (13.0 dBm)
                        * 5825.0 MHz [165] (13.0 dBm)
        Supported commands:
                 * new_interface
                 * set_interface
                 * new_key
                 * start_ap
                 * join_ibss
                 * set_pmksa
                 * del_pmksa
                 * flush_pmksa
                 * remain_on_channel
                 * frame
                 * set_wiphy_netns
                 * set_channel
                 * tdls_oper
                 * start_sched_scan
                 * start_p2p_device
                 * connect
                 * disconnect
                 * crit_protocol_start
                 * crit_protocol_stop
                 * update_connect_params
        software interface modes (can always be added):
        valid interface combinations:
                 * #{ managed } <= 2, #{ P2P-device } <= 1, #{ P2P-client, P2P-GO } <= 1,
                   total <= 3, #channels <= 2
                 * #{ managed } <= 1, #{ AP } <= 1, #{ P2P-client } <= 1, #{ P2P-device } <= 1,
                   total <= 4, #channels <= 1
        Device supports scan flush.
        Device supports randomizing MAC-addr in sched scans.
        max # scan plans: 1
        max scan plan interval: 508
        max scan plan iterations: 0
        Supported TX frame types:
                 * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
        Supported RX frame types:
                 * managed: 0x40 0xd0
                 * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
                 * P2P-client: 0x40 0xd0
                 * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
                 * P2P-device: 0x40 0xd0
        Supported extended features:
                * [ CQM_RSSI_LIST ]: multiple CQM_RSSI_THOLD records
                * [ 4WAY_HANDSHAKE_STA_PSK ]: 4-way handshake with PSK in station mode
                * [ 4WAY_HANDSHAKE_STA_1X ]: 4-way handshake with 802.1X in station mode
                * [ DFS_OFFLOAD ]: DFS offload
                * [ SAE_OFFLOAD ]: SAE offload support
                * [ 4WAY_HANDSHAKE_AP_PSK ]: AP mode PSK offload support
                * [ SAE_OFFLOAD_AP ]: AP mode SAE authentication offload support

And is reasonably fast in my network:

Reverse mode, remote host 192.168.1.1 is sending
[  5] local 192.168.1.229 port 48112 connected to 192.168.1.1 port 4447
[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-1.00   sec  17.5 MBytes   146 Mbits/sec  0.057 ms  0/12656 (0%)
[  5]   1.00-2.00   sec  20.2 MBytes   169 Mbits/sec  0.129 ms  0/14616 (0%)
[  5]   2.00-3.00   sec  20.5 MBytes   172 Mbits/sec  0.345 ms  0/14863 (0%)
[  5]   3.00-4.00   sec  21.6 MBytes   181 Mbits/sec  0.031 ms  0/15654 (0%)
[  5]   4.00-5.00   sec  21.4 MBytes   180 Mbits/sec  0.095 ms  0/15516 (0%)
[  5]   5.00-6.00   sec  22.3 MBytes   187 Mbits/sec  0.032 ms  0/16173 (0%)
[  5]   6.00-7.00   sec  22.1 MBytes   185 Mbits/sec  0.093 ms  0/15987 (0%)
[  5]   7.00-8.00   sec  22.3 MBytes   187 Mbits/sec  0.032 ms  0/16135 (0%)
^C[  5]   8.00-8.42   sec  9.12 MBytes   181 Mbits/sec  0.244 ms  0/6603 (0%)
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-8.42   sec  0.00 Bytes  0.00 bits/sec  0.000 ms  0/0 (0%)  sender
[  5]   0.00-8.42   sec   177 MBytes   176 Mbits/sec  0.244 ms  0/128203 (0%)  receiver

Connecting to host 192.168.1.1, port 4447
[  5] local 192.168.1.229 port 45454 connected to 192.168.1.1 port 4447
[ ID] Interval           Transfer     Bitrate         Total Datagrams
[  5]   0.00-1.00   sec  21.9 MBytes   184 Mbits/sec  15886
[  5]   1.00-2.00   sec  20.4 MBytes   171 Mbits/sec  14787
[  5]   2.00-3.00   sec  25.2 MBytes   211 Mbits/sec  18253
[  5]   3.00-4.00   sec  20.9 MBytes   176 Mbits/sec  15170
[  5]   4.00-5.00   sec  24.7 MBytes   207 Mbits/sec  17887
[  5]   5.00-6.00   sec  24.7 MBytes   207 Mbits/sec  17861
[  5]   6.00-7.00   sec  23.9 MBytes   200 Mbits/sec  17273
[  5]   7.00-8.00   sec  24.7 MBytes   208 Mbits/sec  17914
[  5]   8.00-9.00   sec  28.1 MBytes   236 Mbits/sec  20340
[  5]   9.00-10.00  sec  23.8 MBytes   200 Mbits/sec  17266
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-10.00  sec   238 MBytes   200 Mbits/sec  0.000 ms  0/172637 (0%)  sender
[  5]   0.00-10.03  sec   238 MBytes   199 Mbits/sec  0.045 ms  15/172637 (0.0087%)  receiver