Skip to content

Pixel 9a (zumapro): the modem's PCIe PHY (channel 0) in the shared zuma PHY driver, stacked on #178 - #186

Closed
W4HO-ham wants to merge 35 commits into
derekross:omamobilefrom
W4HO-ham:tegu-pcie0-phy
Closed

W4HO-ham wants to merge 35 commits into
derekross:omamobilefrom
W4HO-ham:tegu-pcie0-phy

Conversation

@W4HO-ham

@W4HO-ham W4HO-ham commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

The Pixel 9a's modem link (zumapro's first PCIe controller, a two-lane Gen3 PHY) in the shared zuma PCIe PHY driver, as #178 did for the Wi-Fi's channel 1. It lands through #187, which carries these commits; this PR is stacked on #178 (and so on #156), so it shows their commits too. Mine are the three on top:

  1. soc: samsung: gs101-pmu: zuma: allow the modem PCIe PHY's isolation register: PMU 0x3ec4 in zuma's regmap, next to the Wi-Fi PHY's 0x3ec8 (stock's pmu-offset for pcie@12100000).
  2. dt-bindings: phy: google,zuma-pcie-phy: Add the zumapro two-lane PHY: a new compatible, google,zumapro-pcie-gen3x2-phy, with no fallback, because channel 0 has its own UDBG external PLL, two lanes of PMA and a different power-down.
  3. phy: samsung: zuma-pcie: Add zumapro's two-lane PHY: the channel 0 (else) branches of Google's zuma CAL and the host's channel 0 steps, with the phy_ops moved into the match data. The CAL's controller writes stay with the host, as on channel 1, and power_off parks the controller's clock on the oscillator first, as Google's exynos_pcie_rc_poweroff() does for both channels.

No device tree yet: the PHY node goes in with the controller node, in the modem link series (#173's rework onto these drivers, after #144).

Tested on the palmtop (2026-11-02), with a full kernel built from this branch (7.3.0-rc6-omamobile-push1-g909c8c8121bb, defconfig + kernel/configs/omamobile.config + CONFIG_PHY_ZUMA_PCIE=m; it also carried #172's two clock commits, which touch only clk-zumapro.c):

  • Channel 1 on the refactored driver: Wi-Fi came up from the device package, "external PLL lock 1, PLL lock 1, CDR lock 1, OC done 1", Gen2 x1, and wlan0 came back after each of three unbind/bind cycles of 13120000.pcie. No UFS or I/O error lines.
  • Channel 0 on a bench, the modem off (the NV partitions read-only and unmounted, the modem unit inactive): a test module with an overlay that adds the PHY node and a consumer mapping only the controller's ELBI did the host's ELBI steps, then phy_init, and per cycle phy_power_on, phy_calibrate and phy_power_off. It never touches PERST#, the LTSSM, DBI or the modem's lines. Two boots, cycles=2 and cycles=3: on all five, the external PLL, the PMA PLL and the CDR locked and offset calibration finished; no "did not turn off", the same boot before and after, no UFS or I/O error lines.
  • The first bench, before the clock park, ran one full cycle and then hung the SoC (watchdog reset, nothing in pstore) at the second cycle's first ELBI write: the PHY's clock was still selected in SOC 0x4000 with its PLL stopped. Parking the clock first, as Google does, fixed it. That's folded into the PHY commit, and its message says so.
  • Not tested yet: a link to the modem through this driver, which needs the host side to take it.

A userspace harness that records every register access of init, power_on and power_off gives the same sequence before and after for the one-lane PHY's zuma (Pixel 8 Pro) and zumapro (Pixel 9a) entries, and for channel 0 the same as #173's runner apart from the ELBI writes that stay with the host.

Checks: W=1 builds of phy-zuma-pcie.o and gs101-pmu.o with no warnings; dt_binding_check and yamllint on the binding clean; checkpatch --strict clean apart from the sign-offs, which these three wait for.

@W4HO-ham

W4HO-ham commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

This shows as conflicting because the stack under it (#156, then #178) predates last night's omamobile (4cf2c8b). For when you get to it: I rebased the whole stack (#56's three commits, #156's twenty-one, #178's nine and these three) onto 4cf2c8b, and it applied cleanly except #156's 45175ee (brcmfmac versioned join parameters), which omamobile already carries as 1cc97e9, so it's dropped. Every commit keeps its author and sign-off. It's at W4HO-ham/linux-omarchy-mobile branch rb-pcie-stack-onto-omamobile-20261102 (head b067224), in case it's useful to Brett for #156; I haven't force-pushed #178 or this one onto it, since they stack on his branch.

The 9a's modem link on top of this stack (the gs201-cp host taking channel 0 through this PHY) passed its first hardware step today: CP power-on, three link cycles to the modem ROM at Gen1 x1 with endpoint 144d:a5a5, CP off, no UFS errors. That series isn't posted yet.

@W4HO-ham

W4HO-ham commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

This one is also carried, rebased onto today's omamobile with its sign-offs, in #187, which merges cleanly and has run on the palmtop end to end (the modem link, GNSS, a SIM session and calls). Merging #187 lands it; I'll close this one when that happens, or rebase it here if you'd rather take the stack piece by piece.

@W4HO-ham

W4HO-ham commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto today's omamobile (4cf2c8b): the branch is now the same signed commits as the bottom of #187's stack, so it merges cleanly again. Nothing changed in the patches. It still carries #156's commits underneath, rebased too, since #156's own branch conflicts with omamobile now.

@derekross

Copy link
Copy Markdown
Owner

Thank you, @W4HO-ham. The bench run that found the hang, and fixing it by parking the clock as Google does, is exactly the care this PHY needs. The new compatible has its own match data, 0x3ec4 goes into zuma's PMU table only, and the refactor keeps the one-lane PHY's write order; husky's entry keeps its own ops. The gate passes on the stack's head and CI is green. Nothing more is needed here on its own: it lands through #187, and I'll close this one then. Two small things: the description says draft but the PR isn't marked as one, and the Kconfig help still says one-lane. @greenbrettmichael, for when you're back: this refactors your PHY file, so please have a look.

W4HO-ham and others added 21 commits November 9, 2026 06:40
The Pixel 9a's BCM4383 firmware (20.123.13) speaks shared-memory
("PCIe IPC") version 9. Accept it next to version 7, keyed on the version
the firmware reports rather than on a chip, and do what Broadcom's
driver does for it:

 - read the EWP info block the shared area points to (offset 128) and
   refuse to go on unless the firmware says its initialisation ended,
   so a stalled firmware fails cleanly instead of leaving rings pointing
   nowhere;
 - bound every ring-info read and the fallback TCM index arrays to the
   chip's RAM before trusting them;
 - ring host-ready right after the common rings are set up, before any
   buffer is posted (the 4389 path, now keyed on the version too), and
   leave the aggregation host capability byte (offset 133) at zero;
 - the no-DAR doorbells by the same test.

Version 8 stays refused: its layout is not known here. For the BCM4389
nothing changes: brcmf_pcie_early_hostready() is true for it by device
id as before, and the version 9 checks do not run on its version 7
firmware.

Tested on the Pixel 9a (BCM4383, API9): the firmware comes up, scans,
joins a WPA2 network and passes traffic. Not yet booted on the Pixel 7
Pro.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
The BCM4383 (PCI 14e4:4449, chip id 0x4383, rev 2) is the Wi-Fi chip in
the Pixel 9a. Add its ids, its SYSMEM base (0x6e0000, from the firmware's
load address) and the firmware name "brcmfmac4383-pcie" with the CLM
blob, and two firmware-keyed quirks for its 20.123.13 firmware:

 - it takes only the versioned "join" parameters: the unversioned iovar
   and SET_SSID both fail with -52, so enable BRCMF_FEAT_JOIN_V1 by the
   same WLC version test as for the BCM4389;
 - it advertises the supplicant offload but refuses the key
   ("failed to change PSK in firmware"), so leave FWSUP, SAE and FWAUTH
   off and let the host do the handshakes.

Tested on the Pixel 9a with the owner's firmware set: wlan0 comes up,
scans, joins a WPA2 network through iwd and passes traffic, with no
module parameters.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
…l ones

brcmf_pcie_bus_console_read() reads the firmware's console write index
and walks read_idx up to it, wrapping at bufsize. When the device is
gone the index reads 0xffffffff, which read_idx never reaches, and the
walk never ends.

Seen on a BCM4383 after s2idle on the Pixel 9a: the chip does not come
back, the reset work entered this loop from brcmf_pcie_reset() and spun
one CPU at 100 % with a stream of "CONSOLE:" lines of 0xff bytes. A
later rmmod then blocked in cancel_work_sync() for good, holding the
device lock, so the next shutdown would have hung in device_shutdown().

Return when the write index is outside the console buffer.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
…rollers

Add HSI2's pin controller at 0x13040000 (gph3 and gph4, SPI 432) and
FAR_ALIVE at 0x154e0000 (gpa5, one wake-up interrupt per pin, SPI 60 to
67), with the banks and interrupts of stock's live device tree, as
controllers 9 and 2 of the driver's zuma data. FAR_ALIVE's bus clock
comes from CMU_APM; HSI2 takes the bus-clock stand-in, as HSI2UFS does.

The Wi-Fi chip's PCIe reset, clock request, enable and wake lines are
on gph3, and its host wake on gpa5.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
…egister

zuma's PCIe PHY for its second controller (the Wi-Fi chip's) is
isolated through PMU offset 0x3ec8, as stock's pcie@13120000 gives it
(pmu-offset). Its PHY driver releases the isolation, so add the register
to zuma's PMU regmap, next to UFS's.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
zuma's (Tensor G3) second PCIe controller, the Wi-Fi chip's, has a
one-lane Gen3 PHY clocked from an external PLL in the UDBG block and
selected in the controller's SOC block, isolated by the PMU until it is
released. Its registers are the PMA, the PCS, the PHY resets in the
controller's sub-control space, the UDBG and the SOC block, at the
addresses of stock's pcie@13120000.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
Add a driver for the one-lane Gen3 PHY of zuma's (Tensor G3) second
PCIe controller, which connects the Pixel 8's Wi-Fi chip. The sequence
is Samsung's CAL for zuma, channel 1, from the driver Google builds for
zuma (pcie-exynos-zuma-rc-cal.c and pcie-exynos-rc.c):

- init: release the PMU isolation, then power the PHY down
  (phy_all_pwrdn);
- power_on: select the clock mode in the SOC block, clear the power
  downs, start the external PLL and wait for its lock, select it as the
  PHY's input clock, program the PMA and PCS in reset, release the
  resets and wait for the PLL, CDR and offset calibration, then write
  UDBG 0xc800 as establish_link does before PERST#;
- power_off: power the PHY down again.

The CAL also sets the controller's RC mode and soft power reset in the
middle of this; those are the controller driver's, in its ELBI space.
The PMA and PCS values for a Broadcom endpoint (stock's ep-device-type 1)
are used, since that is what this controller connects.

As in the gs201 PHY driver, trace=1 logs every step before it touches
the hardware, for bring-up.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
zuma's (Tensor G3) PCIe controllers are the same DesignWare core in the
same Samsung wrapper as gs201's, at IP version 0x986500. Its Wi-Fi
controller runs without the I/A sequencer, as on stock (use-ia false),
so it has three register regions.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
zuma's (Tensor G3) Wi-Fi controller follows gs201's sequence, with one
difference in order: zuma's CAL sets RC mode, pulses the soft power
reset and enables the slave pending NAK in the middle of the PHY
configuration, and establish_link() does not reset the controller again
afterwards. Do these before the PHY's power_on on zuma, and skip the
later soft resets.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
Add zuma's second PCIe controller (stock's pcie_1, ch-num 1) and its
Gen3 PHY, disabled, at the addresses of stock's pcie@13120000: one lane,
Gen3, PERST# on gph3-0 and CLKREQ# on gph3-1 with stock's pin settings,
and the PHY's isolation at PMU offset 0x3ec8. Legacy INTx is
demultiplexed from the controller's interrupt (SPI 439). As on stock,
the controller is not cache coherent and runs without the I/A.

Its memory window and config space are at 0x60000000, so the soc bus
now maps the first 2 GiB, as on gs201.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
The BCM4398 (Pixel 8 Pro) reports backplane type 6, NCI ("Booker"),
which brcmfmac rejected ("chip backplane type 6 is not supported").

On NCI, chipcommon's eromptr points at EROM2, a list of interface
descriptors grouped by core. Each core's info word and interface count
sit in EROM1 or in the OOB router (OOBR); OOBR cores also have a DMP
control word that takes the clock and core flags the AI backplane keeps
in the wrapper's ioctrl. Each interface is a network interface (NI)
node with its own reset control. Scan that into brcmfmac's core list
(the base is a core's APB slave, or a bridge's own slave; the wrapper
its first Booker interface) and implement iscoreup, coredisable and
resetcore on it, after Broadcom's GPL bcmdhd (nciutils.c,
hal_nci_cmn.h, hndoobr.h). An APB NI shared by several cores is left
out of a core's reset.

Read the CA7's halt bit from its DMP control word, and start a halted
CA7 by clearing that bit only, as bcmdhd does for NCI chips
(dhdpcie_bus_download_state()): resetting it again keeps a second
firmware download from starting.

On the Pixel 8 Pro the scan finds 46 cores, and the RAM base and size
and chipcommon revision match bcmdhd's.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
Broadcom's driver numbers the ioctl response and event buffers in a map
of their own, of 1024 IDs (dhd_msgbuf.c pktid_ctrl_map), and the
BCM4398's firmware checks them against that: with data, ioctl response
and event buffers sharing one pool, the first event buffer posted after
1023 data buffers got ID 1025 and the firmware trapped
("pciedev_host_pktid_audit(pktid_type=0): Invalid pktid<1025>").

Reserve IDs 1 to 2 * (ioctl response + event buffers) for the control
buffers (each is reposted before it is freed), and keep the data
buffers above them.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
With DMA'd ring indices the firmware can publish a completion's index
before the item itself has reached host memory. Firmware that asks for
D2H sync (PCIE_SHARED_D2H_SYNC_SEQNUM or _XORCSUM; the BCM4398's asks
for XORCSUM) stamps each item with a sequence number in its epoch byte
and, in XORCSUM mode, makes the XOR of the item's words zero.

Wait for both before handling an item, as Broadcom's driver does
(dhd_prot_d2h_sync_seqnum() and dhd_prot_d2h_sync_xorcsum()), with the
same stepped retries, and skip an item that never completes, as there.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
The BCM4398's 24.100 firmware has dropped the "event_msgs" iovar
(getting it fails, and brcmfmac stopped there: "Get event_msgs error
(-52)"). Broadcom's driver uses "event_msgs_ext", whose mask is preceded
by a small header, as brcmfmac's Cypress code already sends it.

When the firmware rejects "event_msgs", read the mask with
"event_msgs_ext" and keep using it to set the mask.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
GET_BANDLIST returns the number of bands and then the bands. Firmware
with a 6 GHz band, like the BCM4398's, reports three, and fails the
call when the buffer only has room for two ("could not obtain band
info: err=-52"). Only 2.4 and 5 GHz are set up from it, as before.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
"scan_ver" reports the scan interface's major version. Version 3 keeps
the version 2 layout with its pad byte used as ssid_type; version 4
adds scan_type_ext after scan_type. The BCM4398's firmware reports 3 and
rejects version 2 requests (brcmf_run_escan: error -52).

Read the major version, and send version 3 or 4 escan parameters when
the firmware asks for them, as Broadcom's driver does
(wl_cfgscan.c, scan_params_ver).

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
The BCM4398's firmware reports scan results as wl_bss_info version
114: version 109 with EHT fields appended, so every field brcmfmac
reads is where it was, and the IEs are found from ie_offset as before.
Accept it rather than dropping every result ("Version 114 !=
WL_BSS_INFO_VERSION").

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
The Pixel 8 Pro's Wi-Fi chip is a BCM4398 (PCIe device 0x4444), rev 3
(d0). Bcmdhd puts its 4 MiB of RAM at 0x2a0000; it sizes its SYSMEM like
the BCM4389's. Add the ids, the RAM base and the firmware name for d0
and later. The PCI id is added once the chip is supported.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
The BCM4398 follows the BCM4389 in Broadcom's driver: it is reset with
an FLR, told the host is ready with the same value, and serviced with
the same INTx follow-ups and ring polling. It also splits its
backplane into save/restore power domains, with two more than the
BCM4389: the scan MAC and the SAQM (si_srpwr_domain_all_mask()).

Key those paths on a helper covering both chips, and request the
BCM4398's six domains.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
The BCM4398's firmware writes an interim address to the last word of
RAM before its shared area's, and signals the end of its boot with a
mailbox interrupt, which Broadcom's driver waits for before it reads
the address (dhdpcie_wait_readshared_area_addr(), "recd. boot intr").
brcmfmac took the interim address and failed the firmware's API checks.

Interrupts are not set up yet at that point, so poll the PCIe core's
mailbox status through BAR0's fixed window onto it, then read the
address.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
The BCM4398's always-on domain keeps its state across WL_REG_ON, an FLR
and a PMU watchdog reset, and after a firmware has run, a second
download never starts: reloading the driver needed a reboot.

Broadcom's driver makes the firmware trap on purpose before it lets go
of it, by writing a magic number to the PCIe core's H2D doorbell 1 of
function 3 ("DB7"), and in its trap handler the firmware holds the
power resources high so that the next one boots (dhdpcie_fw_trap(),
DHD_DONGLE_TRAP_IN_DETACH). Do the same on remove when the firmware
supports it (PCIE_SHARED2_TRAP_ON_HOST_DB7). With it, brcmfmac reloads,
with or without the PCIe controller, load and run the firmware again.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
greenbrettmichael and others added 14 commits November 9, 2026 06:41
The BCM4398's 24.100 firmware (WLC version 18.2):

- takes the versioned join parameters only, by the same WLC version
  test as the BCM4389 and BCM4383;
- advertises the supplicant offload but refuses the key, as the
  BCM4383's does ("failed to change PSK in firmware"): leave the
  handshakes to the host;
- advertises host_sfhllc and relies on it: given plain Ethernet frames
  it traps in its transmit path (a null write in txq_hw_fill() while
  encrypting the first aggregated frame). Build the 802.3/LLC header on
  the host, as for the BCM4389.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
Add the BCM4398's PCIe id. On the Pixel 8 Pro (firmware 24.100.671.86.2
from the device's factory image) it joins WPA2, passes 50 to 87 Mbit/s
down and 47 to 70 Mbit/s up on 2.4 GHz, stays up across idle and deep
sleep, and survives driver reloads.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
The Pixel 8 Pro's BCM4398 sits on pcie_1. As stock's wlan node gives
them: WL_REG_ON on gph3-4 (as the root port's supply, so the PCI
pwrctrl core switches it around link training, with bcmdhd's 200 ms),
device wake on gph3-5 and host wake on gpa5-1. Its DMA buffers come from
a restricted pool below 4 GiB, as on the Pixel 7 Pro.

Assisted-by: LLM
Signed-off-by: Brett-Michael Green <brett@bmgvisualtech.com>
The Wi-Fi PCIe controller of zumapro (Tensor G4, Pixel 9a) is the one
zuma has: the same DesignWare core and Samsung wrapper, at the same
addresses (ELBI 0x13120000, DBI 0x13400000, config 0x60ffe000), with
the same controller interrupt (SPI 439), and Google's
pcie-exynos-rc.c drives both SoCs with the same code. The only place it
tells them apart (IP version 0x986500 against 0x987500) is a register
dump.

Describe zumapro as "google,zumapro-pcie", "google,zuma-pcie", and make
zuma's three-region constraint match on the fallback, so it covers
zumapro too.

Tested on a Pixel 9a with this pair of compatibles on PCIe channel 1,
driven by pcie-gs201 with zuma's match data: the link trained at Gen2 x1
on the first try and the BCM4383 behind it came up in brcmfmac.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
…zuma

zumapro (Tensor G4, Pixel 9a) has zuma's one-lane Gen3 PHY on its Wi-Fi
PCIe controller, at the same addresses (PMA 0x13160000, PCS 0x13140000,
UDBG 0x13150000, SOC 0x13130000) and with the PMU's PHY control at the
same offset (0x3ec8). Google builds one CAL file,
pcie-exynos-zuma-rc-cal.c, for both SoCs, and its channel 1 sequence is
the one this binding's driver programs, register for register.

Describe zumapro as "google,zumapro-pcie-phy", "google,zuma-pcie-phy".

Tested on a Pixel 9a with this pair of compatibles: phy-zuma-pcie
reported the external PLL, PLL and CDR locked and offset calibration
done, and the link trained at Gen2 x1.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
Add the PCI ID of the BCM4383, the Wi-Fi chip of Google's Pixel 9a.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
… off

Google's root-complex driver for the zuma family (pcie-exynos-rc.c,
built with pcie-exynos-zuma-rc-cal.c for zuma and zumapro) does two
things around the channel 1 PHY that this driver did not:

- exynos_pcie_rc_establish_link() sets bit 10 of the PMU's PHY control
  register once the PHY has been configured, through its private PMU
  write, before it releases PERST#;
- exynos_pcie_rc_poweroff() clears bits 1:0 of SOC 0x4000 before the
  PHY power-down, which switches the PHY's input clock back to the
  oscillator.

Do the same on zumapro: set bit 10 at the end of power_on, after the
UDBG 0xc800 write, and fail power_on if the PMU refuses it; return the
input clock to the oscillator at the start of power_off. power_on
already writes SOC 0x4000 first, so a power_off/power_on cycle (the
host's training retry) selects the PHY clock again.

Keep both to zumapro's own match entry, ahead of the zuma fallback its
nodes carry. Google does them on zuma too, but they have only run on a
zumapro board, so zuma's path stays as it was until a zuma board has
run them.

Nothing clears bit 10 again. Google never clears it in
pcie-exynos-rc.c either: it is set by a read-modify-write and left set,
and the isolation writes go through the PHY control mask, whose
definition is not in the GPL sources, so that it leaves bit 10 alone
is inferred, not read.

Tested on a Pixel 9a (zumapro), PCIe channel 1, with pcie-gs201 as
host: the link trained at Gen2 x1 on the first try and the BCM4383
joined a network with no ping loss. An unbind and rebind of the
controller ran the oscillator step and the power-down; the PHY control
read 0x4c1 before power_on set bit 10 again, and the rebind trained
Gen2 x1 on the first try with it already set. That boot had both steps
on zuma's match data; this version moves them to zumapro's entry, which
the same node selects first.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
…s down

Google's exynos_pcie_rc_poweroff() for the zuma family (pcie-exynos-rc.c
in the zuma and zumapro sources) turns the LTSSM off and pulses the
controller's soft power reset (ELBI 0x3a4 bit 1 low for 20 us) while the
PHY still runs, and only then powers the PHY down. This driver went
straight to the PHY power-down.

Do the same before the PHY power-down in the bring-down path, which runs
at deinit and when host_init fails after the PHY came up. Keep it to a
match entry of zumapro's own, ahead of the zuma fallback its node
carries: Google does the same on zuma, but it has only run on a zumapro
board, so zuma's path stays as it was until a zuma board has run it.
The gs201 sequence follows Google's gs201 driver (dwc-whi), whose
power-off I have not checked, and the gs201 power-down works as it is.

Tested on a Pixel 9a (zumapro), with the pulse on zuma's match data,
which the same node selected then: the link trained at Gen2 x1 and the
BCM4383 joined a network with no ping loss. An unbind of the controller
logged "LTSSM off, soft power reset pulse" before the PHY power-down,
the rebind trained Gen2 x1 on the first try, the BCM4383 reconnected,
and UFS logged no errors.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
Add zumapro's second PCIe controller (stock's pcie_1, ch-num 1, the
Wi-Fi chip's link) and its Gen3 PHY, disabled. Both are zuma's: the same
registers as stock's pcie@13120000 and zuma's nodes, the controller
interrupt on SPI 439 with legacy INTx demultiplexed from it, PERST# on
gph3-0 and CLKREQ# on gph3-1 with stock's pin settings, and the PHY's
isolation at PMU offset 0x3ec8. So both nodes carry zuma's compatible as
a fallback, and the gs201 host and zuma PHY drivers run them on zuma's
data. As on stock and on zuma, the controller runs without the I/A and
is not cache coherent.

Unlike zuma, zumapro has a CMU_HSI2 driver, so the controller lists the
PCIe1 gates it uses, up to the seven the DesignWare binding allows: its
APB, DBI, slave and master clocks, and the PHY's UDBG, PAL and reference
clocks. The PHY bridge and test APB, I/A, SSMT, System MMU and PMMU
gates stay out; all of these gates are CLK_IGNORE_UNUSED, and stock
lists no PCIe clocks at all (pcie-clk-num 0).

Tested on a Pixel 9a with the same description applied as an overlay
(that overlay listed all fourteen PCIe1 gates): the link trained at
Gen2 x1, the limit of the BCM4383 behind it.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
The Pixel 9a's BCM4383 sits behind PCIe channel 1. Enable the channel
and its PHY, give the root port WL_REG_ON (gph3-4) as a fixed regulator
with the 150 ms the bring-up waited before configuring the PHY, and
describe the chip with its board type, so brcmfmac picks the board's
firmware files.

The link runs at Gen2, the chip's own limit (its LnkCap reads 5 GT/s).
ASPM L0s and L1 stay off on the root port: nothing re-locks the PHY's
clock and data recovery after L1 on this path (no I/A sequencer), and
with ASPM on, the link entered L1 and the chip's config space read as
all ones.

All of the chip's DMA goes through a 16 MiB restricted DMA pool below
4 GiB, as on the Pixel 7 Pro: the HSI2 System MMU and S2MPU see PCIe and
UFS on the same VID, so they cannot confine the chip, and the pool at
least keeps driver bugs away from the rest of RAM.

Tested on the Pixel 9a with the same description applied as an overlay
to 7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty, with
pcie-gs201 and phy-zuma-pcie as modules: the link trained at Gen2 x1 on
the first try, the chip used legacy INTx, brcmfmac assigned the pool to
it and brought up wlan0, and wlan0 joined a network with no ping loss.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
The BCM4383 (Pixel 9a) shares its chip with Bluetooth. With Bluetooth
up, so with BT_REG_ON high, an unbind and rebind of the PCIe host (which
drops and raises WL_REG_ON) left brcmfmac unable to start the chip
again: it recognised the chip and downloaded the firmware, then failed
with "FW failed to initialize". With hci_uart unloaded first, the same
rebind brought wlan0 back.

Broadcom's driver never resets this chip with the chipcommon watchdog.
bcmdhd sets cc_wd_reset false, so dhdpcie_dongle_reset() resets the
WLAN function with an FLR (dhd_bus_perform_flr()), with no check on
Bluetooth: "For buscorerev = 66 and after, F0 FLR should be done
independent from F1. So don't need BT quiesce" (dhd_pcie.c,
google-modules/wlan/bcm4383). The chip advertises FLReset+.

Reset it with the FLR the BCM4389 already uses, falling back to the
watchdog if the FLR is refused or doesn't complete.

Tested on a Pixel 9a (7.3.0-rc6-omamobile-push1-gd60d217db5c6): three
unbinds and rebinds of the PCIe host with Bluetooth powered each brought
wlan0 back, the link at Gen2 x1 every time, with hci0 still powered
afterwards. Without this commit the same test failed twice out of two
with "FW failed to initialize".

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
…egister

zuma's PCIe PHY for its first controller (the S5300 modem's) is isolated
through PMU offset 0x3ec4, as stock's pcie@12100000 gives it
(pmu-offset). Its PHY driver releases the isolation and sets bit 10 once
the PHY is configured, so add the register to zuma's PMU regmap, next to
the Wi-Fi PHY's 0x3ec8.

On the Pixel 9a, the modem link's bring-up driver read the register as
0xc0 at boot, 0x1 out of isolation and 0x401 after configuration, and
the link came up at Gen1 x1.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
zumapro's first PCIe controller (HSI1 GEN3A_0, the modem's link on the
Pixel 9a) has a two-lane Gen3 PHY. It has the same five register blocks
as the one-lane Wi-Fi PHY, and a PMU isolation register of its own
(0x3ec4), but Google's zuma CAL runs a different sequence for it: its own
external PLL controls and lock bit in UDBG, a PLL and bias control in the
PCS, two lanes of PMA registers and a different power-down. So it can't
share the one-lane compatible or use it as a fallback.

Add google,zumapro-pcie-gen3x2-phy, with an example at stock's
addresses.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
zumapro's first PCIe controller connects the Pixel 9a's modem through a
two-lane Gen3 PHY. Add it to this driver as
google,zumapro-pcie-gen3x2-phy, with the sequences from the channel 0
(else) branches of Google's zuma CAL (pcie-exynos-zuma-rc-cal.c) and the
host's channel 0 steps around them in pcie-exynos-rc.c:

- init: the PMU isolation off, then exynos_pcie_rc_phy_all_pwrdn(): PCS
  0x150 PLL off with bias on, both lanes' power-downs, the PLL lock
  signal forced off, PLL and bias off, and the external PLL turned off
  only once the PMA PLL has disengaged, as the CAL does;
- power_on: SOC 0x4000, exynos_pcie_rc_phy_all_pwrdn_clear(), then
  exynos_pcie_rc_pcie_phy_config() with the external PLL started and
  polled through UDBG 0xc710/0xc704, both lanes' PMA tables and the
  generic PCS timers, then exynos_pcie_rc_establish_link()'s PMU bit 10,
  UDBG 0xc800 bits 6:5 cleared and the input clock gated;
- calibrate: PCS 0x150 PLL and bias on, which Google writes once the
  link is up, so the host calls it after training;
- power_off: the power-down above.

The CAL adds i * 0x1000 to its PMA base for lane i and never takes it
back, so with two lanes its lock checks and its last input clock write
land 0x1000 higher. That is what stock runs, and what brought the link
up here, so it is kept and commented.

As for the one-lane PHY, the CAL's controller writes (ELBI 0x80, the
soft power reset, 0x3d8 and 0x1078) stay with the host, which does them
before phy_power_on() on zuma. The one-lane PHY's zumapro power_off
returns the input clock to the oscillator, as Google's
exynos_pcie_rc_poweroff() does for both channels, and so does the
two-lane PHY's: power_on selects the PHY's clock in SOC 0x4000 and the
power-down stops the external PLL, so without the park the host's next
ELBI writes, which come before phy_power_on(), would run on a stopped
clock. On a Pixel 9a a bench without it hung the SoC at the second
power-on's first ELBI write.

The phy_ops move into the match data. The one-lane PHY's sequence is
split into helpers both PHYs share and its Broadcom lane writes into a
table of their own; a userspace harness that records every register
access of init, power_on and power_off gives the same sequence before
and after for both of its match entries.

On a Pixel 9a this channel 0 sequence, run from tables by the modem
link's bring-up driver with the ELBI writes in the CAL's order, brought
the link up to the modem's ROM at Gen1 x1 and to its boot loader at
Gen3 x2, with no lock check missed, and has run thousands of link power
cycles with the modem online. This driver's version ran on a bench with
the modem off (a test consumer doing the host's ELBI steps, then
phy_init and power_on, calibrate and power_off): five cycles over two
boots, the external PLL, PMA PLL and CDR locked and offset calibration
done on every one, and the Pixel 9a's Wi-Fi on the one-lane PHY trained
at Gen2 x1 and came back after three rebinds. It hasn't trained a link
to the modem yet: that needs the host driver to take it.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
@derekross

Copy link
Copy Markdown
Owner

Closing: these commits landed through #187 (rebase-merged today), with your authorship and sign-offs kept. Thank you, @W4HO-ham.

@derekross derekross closed this Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants