From a7bcd521aa5dc9c4e5bcccdc9e79146188fd328e Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 19:11:58 -0647 Subject: [PATCH 01/15] device/tegu: fingerprint F6c-F9 and GNSS G3's third and fourth tries Follow-ups from #131's review: the fingerprint plan's status moves past F6c (calibration accepted, the circle lit, a finger enrolled, matching still failing), and MODEM-PLAN records that neither the RF rails nor the AoC's gnss-type cure Kepler's engine-start fault. --- device/tegu/FINGERPRINT-PLAN.md | 49 ++++++++++++++++++++++++++++++++- device/tegu/MODEM-PLAN.md | 33 +++++++++++++++++++++- 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/device/tegu/FINGERPRINT-PLAN.md b/device/tegu/FINGERPRINT-PLAN.md index 3c9bdf88d..e2e98a980 100644 --- a/device/tegu/FINGERPRINT-PLAN.md +++ b/device/tegu/FINGERPRINT-PLAN.md @@ -1,7 +1,7 @@ # Fingerprint plan (tegu / zumapro): fingerprint unlock on the palmtop -Status (2026-10-28): **F0 and F2-F5 passed (F4, the first RPMB write, on 2026-10-27 under D1 = A); F6a and F6b passed; F6c waits for the factory calibration, which the owner fetched on 2026-10-28.** Earlier: **research and plan only, nothing run on the palmtop for +Status (2026-10-28, evening): **F0 and F2-F5 passed (F4, the first RPMB write, on 2026-10-27 under D1 = A); F6a-F6c passed (the HAL runs with the factory calibration); F7 and F8 passed (the circle lights, a finger is enrolled); F9 fails: captures reach the matcher but don't match (image quality 15-26).** Earlier: **research and plan only, nothing run on the palmtop for fingerprint.** Stage 16 of ALL-HARDWARE-PLAN (private). The Pixel 7 Pro stack works ([cheetah FINGERPRINT-PLAN](../cheetah/FINGERPRINT-PLAN.md), opt-in); this plan says what carries over to the Pixel 9a and what is new. @@ -533,3 +533,50 @@ needs them. and its id stay in the owner's private reference folder, never in the repository or a log. Next: hand it to the TA from Linux, without writing `mfg_data`. +- 2026-10-28, afternoon: the HAL injects the calibration itself + (`DataSynchronizer::injectMtCali`). It reads a 112-byte header from offset + 0 of `/dev/block/by-name/mfg_data` and logged "No SA calibration present" + on the zeros. The file `get-cal-url` names has exactly that layout: magic + `0xca11ca11`, version 1, and at 0x6c the payload length (file size − 112). + With the file written at offset 0 of the chroot's private `mfg_data.img` + copy (the real partition untouched), the "No SA calibration" line is gone + and the HAL sets `vendor.gf.cali.state = 1`. Next: enrollment (F8/F9, the + owner's finger). + +## F7-F8 results (2026-10-28, evening, `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`) + +- **F7 seen by eye.** LHBM, ported into the upstream-form `panel-google-tg4c` + (`allow_lhbm=1`, `local_hbm_mode` and `local_hbm_max_timeout` on the + backlight device), lit + the circle at 120 Hz, and the owner saw a white circle at the sensor. +- **F8 passed: a finger is enrolled.** With the factory calibration in + the chroot's `mfg_data.img`, the bridge (rebuilt for the runner's + `--panel`) and `omamobile-fp-ctl enroll`: FINGER DOWN, ACQUIRED, and + PROGRESS counting down from 12 to 0, then ENROLLED. +- **F9 doesn't match yet.** Every authenticate touch comes back ACQUIRED 2 + (PARTIAL), with the HAL logging `valid_area=100` but `image_quality=29`. + A 300 ms LHBM settle changed nothing. Lead: the port wrote only `0x87 0x05`. + Google's tg4c first writes the LHBM brightness, the panel's own RGB values + per band read from 0xD1 on CMD2 page 2 plus an overdrive offset chosen by + the gray level under the circle, and then the LHBM gamma + (`0x6F 0x07; 0x87 0x01-0x04` by brightness). +- **F9, later that evening.** + DSI reads now work (`gs-dsim-cmd` read support: the read request needs + `DSIM_PKTHDR_BTA`, bit 24), so the LHBM brightness bands are read from the + panel and written with overdrive group 0 and the gamma. PARTIAL stayed. + The HAL's log then showed three bridge and runner bugs (omamobile-fingerprint + 0.1.11, PR #135): the HAL got raw touchscreen positions (10x panel pixels, + 5432,17847 for the 540,1756 circle), it captures at + `onPointerDownWithContext` (before `onUiReady`, while the circle was still + dark), and it parses the refresh rate after the `@` in + `panel0-backlight/state` (`on: 1080x2424@120`; a bare `on` logged "Failed + to parse refresh rate"). With all three fixed, enrollment completes and + authenticate captures come back GOOD and reach the matcher, but every one + is NOMATCH at `image_quality` 15-26, at screen brightness 1500 and 3628 + alike. Open leads: Google picks the overdrive group from the luminance + under the circle and restores the normal bands at a second stage + (`tg4c_set_local_hbm_brightness(ctx, false)`), where the port always uses + group 0; whether the circle reaches LHBM luminance at all (nobody has yet + compared it with the shell's drawn target); the HAL's raw capture dump + (`vendor.gf.debug.dump_data=1` wrote nothing). Many misses lock the sensor + out (`LOCKOUT -1`); `omamobile-fp-ctl resetlockout` clears it. diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 191187207..dbaf34046 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -8,7 +8,9 @@ trains Gen1 x1 and enumerates as 144d:a5a5; M3-M5 passed: CPIF and cbd boot it to **ONLINE** (Gen3 x2) with working IPC (pktproc), no SIM yet; G1-G2 passed: gnssd loads Kepler's firmware and talks CHPP over SPI; G3 partial: our HAL client starts sessions, but Kepler's core faults at -engine start. Next: a stock GNSS capture, IOCC, the SIM. +every engine start, with the RF rails on (2026-10-28) and with the AoC told +the GNSS type (2026-10-28, evening) alike. Next: `strace` gnssd across an +engine start, a stock GNSS capture, IOCC, the SIM. The staged plan (sections F, K, U and runbooks M0.2-M6, G1-G4) is below, with each step's results under it. Kernel branches `omamobile-tegu-modem` and `omamobile-tegu-gnssif` (section K). @@ -542,6 +544,35 @@ startNmea 25; callbacks location 4, NMEA 5). longer stops the profile. Until M6 qualifies the power-off, don't stop the modem profile by hand; reboot with someone at the palmtop. +### G3, third try: rails on (2026-10-28, `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`, round ps1 DTB with ldo9s-11s on) + +[V] With LDO9S-11S on, Kepler loads, reaches OPERATIONAL and no longer +logs "FCAL Part 1 is not done yet": the RF front end calibrates now. The +gnss-slsi HAL and our client start a session (capabilities 0xe7df, start +and startNmea ok, status SESSION_BEGIN then ENGINE_ON), but every engine +start still ends in the same fault: "KEP M7 HARDFAULT ... LR,PC 600B5B39 +0000062C" (16 times in 10 minutes, ENGINE_ON/ENGINE_OFF each time), no +NMEA. So the rails were one missing piece, not the fault itself. Indoor or +outdoor doesn't matter yet: the engine crashes before it searches. +The G3 script's HARDFAULT count missed these (gnssd wrote them outside its +window). + +### G3, fourth try: the AoC told the GNSS type (2026-10-28, evening, gn3 DTB) + +[V] With `&aoc { gnss-type = <2>; }` (kAOCGnssType, as Google's +`zumapro-phone-ignss.dtsi`), Kepler loads, goes OPERATIONAL, and the +gnss-slsi HAL and our client start a session (startNmea ok, "the HAL asks +for a location"). But every engine start still ends in the same "KEP M7 +HARDFAULT ... LR,PC 600B5B39 0000062C" (20 in 4 minutes), so the type isn't +it. In the register dump, R3 = 0x62D and PC = 0x62C: the M7 jumped +through a function pointer holding 0x62D, a Thumb address near zero, which +looks like an entry nobody filled in. Other leads from the logs: +`aiding_timemark_reader_thread: open() errno:2` (gnssd can't open its +time-mark device), `TGT_MEMS initInterface: fromBinder() failed` (the HAL's +sensor service is missing), and `libsighandler.so` not found. Next, attended +with the modem up: `strace -f` gnssd across one engine start, to see which +files and devices it opens or fails to open (observation only). + ### Suspend with the modem on (2026-10-27, early morning, same kernel) - **What ran:** s2idle on `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty` From e32b5a1151883e711c4a2279967e422320ca0c91 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 19:15:05 -0647 Subject: [PATCH 02/15] device/tegu FINGERPRINT-PLAN: Google overdrives the circle only for its first frames tg4c's post stage writes the normal LHBM bands after the effective delay, so stock captures under the normal circle; the port kept overdrive group 0 throughout. The palmtop now runs the normal bands, and re-enrolling under them is next. --- device/tegu/FINGERPRINT-PLAN.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/device/tegu/FINGERPRINT-PLAN.md b/device/tegu/FINGERPRINT-PLAN.md index e2e98a980..568bd3ad8 100644 --- a/device/tegu/FINGERPRINT-PLAN.md +++ b/device/tegu/FINGERPRINT-PLAN.md @@ -573,10 +573,12 @@ needs them. to parse refresh rate"). With all three fixed, enrollment completes and authenticate captures come back GOOD and reach the matcher, but every one is NOMATCH at `image_quality` 15-26, at screen brightness 1500 and 3628 - alike. Open leads: Google picks the overdrive group from the luminance - under the circle and restores the normal bands at a second stage - (`tg4c_set_local_hbm_brightness(ctx, false)`), where the port always uses - group 0; whether the circle reaches LHBM luminance at all (nobody has yet + alike. Lead one: Google overdrives only the first stage. After the + effective delay (2 frames, 3 with IRC off) `tg4c_set_local_hbm_mode_post` + writes the normal bands, so stock captures under the normal circle, while + the port kept overdrive group 0 the whole time. From 2026-10-29 the + palmtop runs `lhbm_od=4` (the normal bands, read from the panel), and the + next step is to re-enroll and match under it. Other leads: whether the circle reaches LHBM luminance at all (nobody has yet compared it with the shell's drawn target); the HAL's raw capture dump (`vendor.gf.debug.dump_data=1` wrote nothing). Many misses lock the sensor out (`LOCKOUT -1`); `omamobile-fp-ctl resetlockout` clears it. From c0945ca1e9efa9a4fd569a031f1ca8dedc863058 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 19:27:30 -0647 Subject: [PATCH 03/15] device/tegu FINGERPRINT-PLAN: F9 and F10 pass, the lock screen unlocks by fingerprint Under the panel's normal LHBM bands and a fresh enrollment, the enrolled finger matches and others don't, through the HAL and through fprintd, and the lock screen unlocks with it. --- device/tegu/FINGERPRINT-PLAN.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/device/tegu/FINGERPRINT-PLAN.md b/device/tegu/FINGERPRINT-PLAN.md index 568bd3ad8..5835b59ba 100644 --- a/device/tegu/FINGERPRINT-PLAN.md +++ b/device/tegu/FINGERPRINT-PLAN.md @@ -1,7 +1,7 @@ # Fingerprint plan (tegu / zumapro): fingerprint unlock on the palmtop -Status (2026-10-28, evening): **F0 and F2-F5 passed (F4, the first RPMB write, on 2026-10-27 under D1 = A); F6a-F6c passed (the HAL runs with the factory calibration); F7 and F8 passed (the circle lights, a finger is enrolled); F9 fails: captures reach the matcher but don't match (image quality 15-26).** Earlier: **research and plan only, nothing run on the palmtop for +Status (2026-10-29): **works: F0-F10 passed. The enrolled finger matches and other fingers don't, through the HAL and through fprintd, and the lock screen unlocks by fingerprint.** It needs the bridge and runner fixes in #135 and tg4c's LHBM on the panel's normal bands (`lhbm_od=4`). (F4, the first RPMB write, ran on 2026-10-27 under D1 = A.) Earlier: **research and plan only, nothing run on the palmtop for fingerprint.** Stage 16 of ALL-HARDWARE-PLAN (private). The Pixel 7 Pro stack works ([cheetah FINGERPRINT-PLAN](../cheetah/FINGERPRINT-PLAN.md), opt-in); this plan says what carries over to the Pixel 9a and what is new. @@ -582,3 +582,16 @@ needs them. compared it with the shell's drawn target); the HAL's raw capture dump (`vendor.gf.debug.dump_data=1` wrote nothing). Many misses lock the sensor out (`LOCKOUT -1`); `omamobile-fp-ctl resetlockout` clears it. + +## F9-F10 results (2026-10-29, `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`) + +- **F9 passed.** With `lhbm_od=4` (the normal LHBM bands read from the + panel, which is where Google's tg4c sits after its first-stage + overdrive) and a fresh enrollment, `omamobile-fp-ctl auth` gave MATCH on + the first touch twice. A different finger gave NOMATCH. +- **F10 passed.** fprintd was masked in the install image. Unmasked, it + finds the bridge's device, `fprintd-enroll` completes (20 stages), and + `fprintd-verify` matches. Locked with `omarchy-shell lock lock`, the + palmtop unlocked with the enrolled finger, and refused a different finger + several times. The libfprint driver still names the device "Pixel 7 Pro + under-display fingerprint sensor". From 6fe831315c874744f405c60a1fdd8cb217f0edf0 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 20:00:50 -0647 Subject: [PATCH 04/15] device/tegu: name the kernel fingerprint works on, and where fprintd was masked Review: the status says it works on the owner's integration kernel, with LHBM open as derekross/linux-omarchy-mobile#126 and the DSI reads as #125, and the fprintd mask came from the palmtop's private bring-up root. The G3 next step is on the charger. --- device/tegu/FINGERPRINT-PLAN.md | 8 ++++++-- device/tegu/MODEM-PLAN.md | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/device/tegu/FINGERPRINT-PLAN.md b/device/tegu/FINGERPRINT-PLAN.md index 5835b59ba..f04e6a023 100644 --- a/device/tegu/FINGERPRINT-PLAN.md +++ b/device/tegu/FINGERPRINT-PLAN.md @@ -1,7 +1,7 @@ # Fingerprint plan (tegu / zumapro): fingerprint unlock on the palmtop -Status (2026-10-29): **works: F0-F10 passed. The enrolled finger matches and other fingers don't, through the HAL and through fprintd, and the lock screen unlocks by fingerprint.** It needs the bridge and runner fixes in #135 and tg4c's LHBM on the panel's normal bands (`lhbm_od=4`). (F4, the first RPMB write, ran on 2026-10-27 under D1 = A.) Earlier: **research and plan only, nothing run on the palmtop for +Status (2026-10-29): **works on the owner's kernel: F0-F10 passed. The enrolled finger matches and other fingers don't, through the HAL and through fprintd, and the lock screen unlocks by fingerprint.** It runs on `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`, the integration tree, with tg4c's LHBM loaded by hand. That LHBM isn't in the published tree yet: it's open as derekross/linux-omarchy-mobile#126, on the panel's own bands, which need no DSI reads (the reads are derekross/linux-omarchy-mobile#125, used only for the overdrive experiments). It also needs the bridge and runner fixes in #135. (F4, the first RPMB write, ran on 2026-10-27 under D1 = A.) Earlier: **research and plan only, nothing run on the palmtop for fingerprint.** Stage 16 of ALL-HARDWARE-PLAN (private). The Pixel 7 Pro stack works ([cheetah FINGERPRINT-PLAN](../cheetah/FINGERPRINT-PLAN.md), opt-in); this plan says what carries over to the Pixel 9a and what is new. @@ -589,7 +589,11 @@ needs them. panel, which is where Google's tg4c sits after its first-stage overdrive) and a fresh enrollment, `omamobile-fp-ctl auth` gave MATCH on the first touch twice. A different finger gave NOMATCH. -- **F10 passed.** fprintd was masked in the install image. Unmasked, it +- **F10 passed.** fprintd was masked on the palmtop's own root: a link + to `/dev/null` from the same batch as the 9a's other bring-up masks + (ModemManager, NetworkManager, omamobile-aoc, omamobile-fp), made by the + private bring-up root it was installed from. Nothing in this repository + masks it. Unmasked, it finds the bridge's device, `fprintd-enroll` completes (20 stages), and `fprintd-verify` matches. Locked with `omarchy-shell lock lock`, the palmtop unlocked with the enrolled finger, and refused a different finger diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index dbaf34046..a5bbf463f 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -570,7 +570,7 @@ looks like an entry nobody filled in. Other leads from the logs: `aiding_timemark_reader_thread: open() errno:2` (gnssd can't open its time-mark device), `TGT_MEMS initInterface: fromBinder() failed` (the HAL's sensor service is missing), and `libsighandler.so` not found. Next, attended -with the modem up: `strace -f` gnssd across one engine start, to see which +and on the charger, with the modem up: `strace -f` gnssd across one engine start, to see which files and devices it opens or fails to open (observation only). ### Suspend with the modem on (2026-10-27, early morning, same kernel) From af5d8a08c43f56f2a39319dadc6964778e0d6e71 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 03:07:28 -0647 Subject: [PATCH 05/15] MODEM-PLAN: GNSS G3 fifth to twenty-fourth tries, the SPI link The engine tracks satellites and gnssd's watchdog does the rest. The link garbles single bytes at the 6.24 MHz the SPI really runs at, and stock's OSCCLK clock, 32-bit words and auto CS break the framing. --- device/tegu/MODEM-PLAN.md | 152 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index a5bbf463f..9710c03d3 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -573,6 +573,158 @@ sensor service is missing), and `libsighandler.so` not found. Next, attended and on the charger, with the modem up: `strace -f` gnssd across one engine start, to see which files and devices it opens or fails to open (observation only). +### G3, fifth to eighth tries (2026-10-29, night, same kernel, on the charger, outdoors spot) + +- **strace of gnssd across engine starts** (`logs/tegu-modem-20261027/phone/g7-strace.sh`): + the HAL's request reaches gnssd, gnssd talks CHPP to Kepler over + `gnss_ipc` normally (the all-zero reads after each write are the SPI + full-duplex bytes Google's `send_betp` passes up by design), and Kepler + stops answering a few seconds after the engine start; gnssd then reads the + GNSS image back (`IOCTL_READ_GNSS_IMAGE`) and dumps RAM. `umts_boot0` + ioctl 0x28 (EINVAL, not in our CPIF) comes after the fault, in the crash + path. +- **Missing libraries**: gnssd `dlopen()`s `libcustomgnss.so` + (`GlueLayer_IsUseCustomGnssLib=1`), which needs `libsitril-gps.so` and + `libsitril-client.so` (RIL's GPS channel, binder to radioExternal). All + three were missing from the chroot. With them in, libcustomgnss reads the + CP state from `/sys/bus/platform/devices/cpif/modem_state`, which the + chroot lacked; with that bound, it logs "Modem state ONLINE". `GpsOpen()` + still fails (no radioExternal HAL). Kepler's fault is unchanged (PR #141). +- **DVS and DFS off** through gnssd's `/data/vendor/gps/overlay/gps_overlay.conf` + (read 27 times): the fault is unchanged (9 in 4 minutes). +- **Stock's rails are Kepler's to control**: LDO9S-11S carry + `channel-mux-selection` 0x29-0x2b (subsys GPS) in stock's DT, with + LDO9S ranging 0.725-1.3 V; our DT holds them on at fixed voltages. +- **Hazard found**: after the modem profile has stopped (gnssd's exit), + starting the profile again in `OMAMOBILE_MODEM_STAGE=rfsd` reset the + palmtop silently (watchdog, no pstore). Reboot instead. +- **Where the fault is** (local disassembly of the soft-watchdog RAM dump, + which is kepler.bin as loaded at 0x60000000; private, never committed): + the patch code at 0x600B5B34 calls a veneer at 0x600E143C that jumps to + 0x200005B5 (R12 at the fault), code in Kepler's SRAM (the main stack is at + 0x2002FF38). That code branched through R3 = 0x62D, and the M7 faulted + fetching 0x62C, low memory that isn't in the image. So something maps or + powers Kepler's low memory, or fills that pointer, and it hasn't happened + by engine start. `umts_boot0` ioctl 0x28 (gnssd's "SHMEM_SIZE -1") is + not defined in Google's tegu CPIF either, so stock gets EINVAL too and it + isn't the cause. +- **The loaded image is intact.** The dump differs from kepler.bin in 17 + words, all in the configuration header below 0x390, and they are gps.cfg's + values that gnssd writes before the load (RfMiscCtrl 0x80008001 at 0x10, + AidingConfiguration 0x20046 at 0x1c, the VDR 200/20 limits at + 0x344-0x350). So the write-combine mapping of GNSS_FW (stock: cached, + over an I/O-coherent link) doesn't corrupt the load. The layout matches + stock too: GNSS_FW at cp_rmem + 8 MiB, 4 MiB long. The missing piece is + on the core's side (its low memory at engine start), which the AP can't + see; the next step is Kepler's own debug log (`gps_overlay.conf.next`). + +### G3, ninth to fourteenth tries: the "hardfault" is gnssd's watchdog (2026-10-29, night) + +[V] With gnssd's debug log on (`gps_overlay.conf`: `debug_enable=1`, +`debug_console=1`, `chpp_log_level=4`), the engine is seen **working**: it +tracks satellites (SVIDs 5, 11, 12, 13 at C/N0 29-35 dB-Hz) within ~10 s +of the start. The fault that follows is gnssd's own: its soft watchdog +logs "KEP soft_dog pos req timeout", then "sw version timeout", resets +Kepler and sends BLC ID 6 ("Try and trigger hard fault to see if CPU is +locked up or maybe we can get RAM dumps"), which is the "KEP M7 +HARDFAULT" with PC 0x62C. The watchdog fires because the CHPP link over +the GNSS SPI loses packets: thousands of "ACK timeout" and 244 "Rx BAD +checksum" in one run. In the raw reads, frames that should start with the +CHPP preamble `68 43` often read `34 21`, the same bits one bit late, and +long frames end in zeros. + +The SPI settings tried, each on a fresh boot (the CP boots once per boot): + +| SPI mode | rx chunk | feedback delay | RX bad checksums | Kepler | +| --- | --- | --- | --- | --- | +| 0 (as ported) | 64 | 2 (as ported) | 244 | tracks, then the watchdog | +| 0 | 32 | 2 | 17 | opstate 0 | +| 0 | 32 | 0 (stock's value) | 93 | opstate 0 | +| 1 | 32 | 0 | 34 | opstate 0 | +| 1 | 64 | 0 | 0 (RX clean) | TX lost: Kepler never sees our RESET-ACK | +| 0, 1 MHz | 64 | 0 | 63 | opstate 0 | +| 3 | 64 | 0 | 32 | opstate 0 | +| 0, 32-bit words (swapped in gnss_spi) | 64 | 2 | 1 | RX transfers time out (-110), opstate 0 | +| 0, 32-bit, auto CS (`google,gs101-spi` only) | 64 | 2 | 0 | RX transfers time out (-110), opstate 0 | +| 0, auto CS | 64 | 2 | 274 | tracks, then the watchdog (as ported) | + +So RX samples the core's data a bit early in mode 0, mode 1 fixes RX but +breaks TX, and neither the feedback delay nor a slower clock fixes it. +Stock drives this SPI with 32-bit words, `swap-mode = <1>` and DMA +(`dma-mode`, PDMA 0x14/0x15); our port uses PIO. 32-bit words alone (byte +order fixed in gnss_spi) time out in PIO, so the next step is DMA for this +SPI. Google's driver uses auto CS for this device (no +`samsung,spi-chip-select-mode`), but auto CS changes nothing with 8-bit +words. Our DT has no PDMA controller (stock's overlay uses `pdma1`), so DMA +means a PL330 node for zumapro first. The palmtop is back on the as-ported setting (mode 0, +64-byte reads, delay 2, the gn3 DTB). + +Next steps for the link, from the night of 10-29 (not tried yet): +- **32-bit words in PIO time out** (`res -110`, every 64-byte read) under + mainline spi-s3c64xx. Not its FIFO-level check: Google's driver makes the + same `RX_FIFO_LVL < xfer->len` comparison for 32-bit words and works, so + the level counts bytes. -110 is mainline's interrupt wait + (`wait_for_completion_timeout` in `s3c64xx_wait_for_pio()` with + `use_irq`), which Google's driver doesn't have: it polls. The FIFO + trigger interrupt with 32-bit words is the next thing to read + (spi-s3c64xx is built in, so a change is a kernel push). +- **DMA:** stock's `pdma1` is a PL330 at 0x10130000 (SPI 806, a 200 MHz + fixed clock, Samsung's 36-bit address wrappers, which mainline doesn't + have), with the GNSS SPI on channels 0x14 (tx) and 0x15 (rx). A + read-only probe (2026-10-29) read its PrimeCell IDs (periph 0x30 0x13, + cell 0x0d 0xf0) from Linux without an abort, so a DT node can probe it. + Mainline uses DMA only for transfers longer than the 64-byte FIFO, so the + 64-byte reads would stay PIO. + +**What the link does (10-29, night), cause still open:** mainline spi-s3c64xx cuts +every PIO transfer of 64 bytes or more into 63-byte pieces +(`xfer->len = fifo_len - 1`), stopping and flushing the FIFO between them. +So each 64-byte read of Kepler becomes 63 + 1 bytes, and each longer write +is cut mid-frame; 32-bit words then can't work at all (63 isn't a multiple +of 4: the `len-63` timeouts). Stock never splits: it uses DMA. But the +split isn't shown to be the cause: with gnss_spi cutting every transfer +into 60-byte pieces itself (one message, CS held, every pause on a 32-bit +boundary, so the controller never cuts), the link garbled just the same +(369 bad checksums, Kepler tracking, then the watchdog). Progress: a runtime test module +registered stock's pdma1 (PL330 at 0x10130000, SPI 806) and the built-in +pl330 driver probed it and ran a 256-byte memcpy correctly; a DTB with the +node probes it at boot. But with `dmas` on the GNSS SPI (0x14/0x15, either +order), RX DMA moves nothing (residue 64): the SPI's DMA requests don't +reach pdma1, so some routing stock sets up is still missing (a sysreg or +USI DMA select, or the PL330's peripheral security setting). The palmtop +is back on gn3 without the node. A one-boot reset at 69 s happened on the +second boot with the node, cause not seen. + +### G3, fifteenth to twenty-third tries: the SPI runs at twice stock's clock (2026-10-29, small hours) + +[V] Each try on a fresh boot of the gn3 kernel, gnssd's debug log on, a test +`gnss_spi.ko` with module parameters (feedback delay, chip-select setup, +clock, `HIGH_SPEED_EN`), raw RX bytes taken from strace of gnssd's reads of +`/dev/gnss_ipc`. Results: + +| Try | Setting | Bad checksums | Kepler | +| --- | --- | --- | --- | +| baseline (control) | as ported: 8-bit, 64-byte reads, delay 2 | 46 | tracks (C/N0 29-34), then the watchdog | +| w32p32 | 32-bit words, 32-byte pieces in one message | 19 | no watchdog, stops after RESET-ACK | +| w32rx32 | 32-bit, 32-byte reads | 7 | same | +| fb3 | 32-bit, feedback delay 3 | 5 | same | +| cs200 | 32-bit, delay 3, 200 us CS setup | 0 | same | +| osc | 32-bit, USI3 mux on OSCCLK, about 1.5 MHz | 0 | same | +| acs | 32-bit, auto CS DTB | 0 | same | +| osc8 | 8-bit, OSCCLK, about 1.5 MHz, delay 0 | 1 | same | +| hs | 8-bit, `HIGH_SPEED_EN` forced, 32-byte transfers | 17 | same | +| hs60 | 8-bit, `HIGH_SPEED_EN`, 60-byte reads | 408 | tracks, then the watchdog (38) | + +What the raw bytes show: + +- **The real SPI clock is 6.24 MHz, not 3.125.** USI3's mux (`zumapro_mout_hsi0_usi3_local`) is read-only in clk-zumapro and sits on the 399.36 MHz parent; the 4-bit divider stops at /16, so the IP clock is 24.96 MHz and the SPI clock 24.96 / 4, whatever spi-s3c64xx asks for. The "1 MHz" try of the night before ran at 6.24 MHz too. +- **The baseline's errors are per byte:** one byte of a repeated frame arrives with its top bit taken from the previous byte's last bit (`10 01 00 0a ... 4f b6 25 9c` read as `08 00 00 05 ... 27 db 12 ce`), and the rest of the frame is right. That is the controller sampling before Kepler's data has settled: too little margin at 6.24 MHz, as mode 1 (which samples half a clock later) showed. +- **Every changed setting broke the framing instead:** with 32-bit words, with the OSCCLK mux, and with chip select toggled every 32 bytes, CHPP frames arrive at any bit offset (8-bit baseline: always 0 or 1), the link stops after RESET-ACK, and the bad-checksum count drops only because few frames are recognised. A chip-select toggle in the middle of a frame drops one byte from Kepler at the break. So the low counts in this table are not improvements. + +The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz on USI3 (3.125 MHz SPI) from a parent that can give it, as stock does, with nothing else changed. The OSCCLK try isn't a fair test of that (24.576 / 4, about 1.5 MHz, switched behind the clock framework's back). The palmtop is back on the baseline (`gnss_spi` aa4618bb, `gnssif` eb0f3d9a, gn3 DTB, no debug overlay). One reset at 348 s, after the hs60 run had ended, came during modem PCIe link activity ("PHY isolated"), not in the SPI path. + +**Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. + ### Suspend with the modem on (2026-10-27, early morning, same kernel) - **What ran:** s2idle on `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty` From b95ed16222e1e630cad88671f2e0497d98cfeb7a Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 03:30:30 -0647 Subject: [PATCH 06/15] MODEM-PLAN: GNSS G3, stock's clock and mode 1 reads Stock's OSCCLK clock breaks framing here. Reading in mode 1 lines every frame up on the as-ported clock, but the first bytes after each chip select still arrive damaged, and Kepler resets can take the SoC down. --- device/tegu/MODEM-PLAN.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 9710c03d3..1693ae989 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -725,6 +725,10 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. +**Read in mode 1, write in mode 0 (twenty-fifth and twenty-sixth tries).** The baseline's raw reads show more than single bytes: about 80% of CHPP frames arrive one whole bit late (the preamble found at bit offset 1, so CHPP never sees it), which is where most ACK timeouts come from. Feedback delay 3 at 8 bits changed nothing (57 bad checksums, same split of offsets). A test module that switches `spi->mode` per transfer (read-only transfers in mode 1, writes in mode 0; spi-s3c64xx reconfigures on every transfer because its `cur_speed` never equals the rate asked) put every frame at bit offset 0 for the first time on the as-ported clock: short frames pass, the engine reports satellites, the watchdog fires later. Long frames (279 bytes) still fail: the first byte or two after each read's chip select are damaged (in one string Kepler resent, the byte after a 60-byte boundary read `6` in one copy and `8` in the next, and `11 00 11` became `41`). 60-byte reads, so spi-s3c64xx never splits a read, didn't change that. Two resets came from the modem side, not the SPI: after Kepler's watchdog resets, gnssd reloads the image over the CP's PCIe link (`IOCTL_READ_GNSS_IMAGE`, then "PHY isolated"), and the SoC reset within a second (03:15, and 02:43 after the hs60 run). Frequent Kepler resets are therefore a crash risk until the link is fixed; keep GNSS runs short. Separately, two boots reset at about 34 s, right after Bluetooth started (01:41, 03:03), before any GNSS step. + +**Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. + ### Suspend with the modem on (2026-10-27, early morning, same kernel) - **What ran:** s2idle on `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty` From 114a1232a663c361c5bc476182ab9ab801ebaddb Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 04:32:40 -0647 Subject: [PATCH 07/15] MODEM-PLAN: GNSS G3, bytes lost at each chip-select release Kepler resends frames, so the copies can be compared. In mode 1, long frames lose the same bytes at every 64-byte read boundary. --- device/tegu/MODEM-PLAN.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 1693ae989..31aad55d0 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -727,6 +727,8 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **Read in mode 1, write in mode 0 (twenty-fifth and twenty-sixth tries).** The baseline's raw reads show more than single bytes: about 80% of CHPP frames arrive one whole bit late (the preamble found at bit offset 1, so CHPP never sees it), which is where most ACK timeouts come from. Feedback delay 3 at 8 bits changed nothing (57 bad checksums, same split of offsets). A test module that switches `spi->mode` per transfer (read-only transfers in mode 1, writes in mode 0; spi-s3c64xx reconfigures on every transfer because its `cur_speed` never equals the rate asked) put every frame at bit offset 0 for the first time on the as-ported clock: short frames pass, the engine reports satellites, the watchdog fires later. Long frames (279 bytes) still fail: the first byte or two after each read's chip select are damaged (in one string Kepler resent, the byte after a 60-byte boundary read `6` in one copy and `8` in the next, and `11 00 11` became `41`). 60-byte reads, so spi-s3c64xx never splits a read, didn't change that. Two resets came from the modem side, not the SPI: after Kepler's watchdog resets, gnssd reloads the image over the CP's PCIe link (`IOCTL_READ_GNSS_IMAGE`, then "PHY isolated"), and the SoC reset within a second (03:15, and 02:43 after the hs60 run). Frequent Kepler resets are therefore a crash risk until the link is fixed; keep GNSS runs short. Separately, two boots reset at about 34 s, right after Bluetooth started (01:41, 03:03), before any GNSS step. +**Where the bytes go (twenty-seventh try, mode 1 reads with 50 us chip-select setup):** 101 bad checksums (260 without the setup), and the palmtop stayed up through 14 Kepler watchdog resets with omamobile-modem 0.1.9's slower CP watcher (#148). Comparing the copies Kepler resends: short frames inside one 64-byte read agree byte for byte, and every copy of a long frame loses the same one or two bytes at each 64-byte read boundary (`11 00 11 00 10 00 01` read as `11 00 00 | 00 01`, `00 00 31 2e 30 2e 30` as `00 00 2e | 2e 30`). So in mode 1 Kepler's stream drops bytes when chip select is released between reads, deterministically, not by timing. In the as-ported mode 0 the copies disagree mostly at byte 63, the one-byte tail spi-s3c64xx splits off each 64-byte read. Next: hold chip select across rx_work's consecutive reads of one Kepler message (one long transfer while gnss2ap stays high), which also removes the split. + **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. ### Suspend with the modem on (2026-10-27, early morning, same kernel) From a25cb32de7fe9e0078eac226cdbf789a7842a0e1 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 04:40:14 -0647 Subject: [PATCH 08/15] MODEM-PLAN: GNSS G3, chip select held across a message Holding chip select between Kepler's reads ends long frames in zeros, so Kepler wants it released between reads, as stock does. --- device/tegu/MODEM-PLAN.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 31aad55d0..26bc34fe5 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -729,6 +729,8 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **Where the bytes go (twenty-seventh try, mode 1 reads with 50 us chip-select setup):** 101 bad checksums (260 without the setup), and the palmtop stayed up through 14 Kepler watchdog resets with omamobile-modem 0.1.9's slower CP watcher (#148). Comparing the copies Kepler resends: short frames inside one 64-byte read agree byte for byte, and every copy of a long frame loses the same one or two bytes at each 64-byte read boundary (`11 00 11 00 10 00 01` read as `11 00 00 | 00 01`, `00 00 31 2e 30 2e 30` as `00 00 2e | 2e 30`). So in mode 1 Kepler's stream drops bytes when chip select is released between reads, deterministically, not by timing. In the as-ported mode 0 the copies disagree mostly at byte 63, the one-byte tail spi-s3c64xx splits off each 64-byte read. Next: hold chip select across rx_work's consecutive reads of one Kepler message (one long transfer while gnss2ap stays high), which also removes the split. +**Chip select held across a message (twenty-eighth try):** mode 1 reads with chip select kept asserted between rx_work's reads (released when gnss2ap drops or before a write) made it worse: 292 bad checksums, and the 279-byte frames now end in zeros (footer 0). Kepler wants chip select released between its 64-byte reads, as stock does, so the bytes lost at each release in the mode 1 tries have another cause. What's left untried needs stock evidence: a logic-analyzer capture of stock's SPI21 (CS, SCLK, MISO timing between reads), or stock's register state for SPI21 and CMU_HSI0 USI3 while GNSS runs. + **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. ### Suspend with the modem on (2026-10-27, early morning, same kernel) From 57c86963ebad989ecf2bcbeb43de959cdc62f7ff Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 05:05:08 -0647 Subject: [PATCH 09/15] MODEM-PLAN: GNSS G3, Kepler one bit late at feedback delay 3 With feedback delay 3 Kepler's frames are intact but one bit late. A per-read realignment gives clean short frames and satellites; long frames still lose data at each chip-select release. --- device/tegu/MODEM-PLAN.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 26bc34fe5..04286d8d1 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -731,6 +731,8 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **Chip select held across a message (twenty-eighth try):** mode 1 reads with chip select kept asserted between rx_work's reads (released when gnss2ap drops or before a write) made it worse: 292 bad checksums, and the 279-byte frames now end in zeros (footer 0). Kepler wants chip select released between its 64-byte reads, as stock does, so the bytes lost at each release in the mode 1 tries have another cause. What's left untried needs stock evidence: a logic-analyzer capture of stock's SPI21 (CS, SCLK, MISO timing between reads), or stock's register state for SPI21 and CMU_HSI0 USI3 while GNSS runs. +**One bit late, cleanly, with feedback delay 3 (twenty-ninth to thirty-second tries, offline checks on the saved reads with CHPP's CRC32 over the 8-byte header and payload):** at feedback delay 3 (mode 0, 8 bits, the as-ported clock) Kepler's frames are intact but one bit late: shifting the reads left one bit turns 11 valid frames into 123 (at delay 2 the same shift recovers nothing). Kepler is on time just after it starts and one bit late later, so a fixed shift lost its first RESET-ACKs for 2 s and set off a reset storm (125 RESETs from Kepler, 144 RESET-ACKs from gnssd); delaying our writes by one bit as well killed the link outright, so writes are right as they are. A per-read choice (a preamble at bit 0 keeps the read, at bit 1 shifts it, a read without one keeps the last choice) gives clean short frames and the engine reporting satellites, but 279- and 361-byte frames still fail: setting the one dropped bit at each 64-byte boundary every possible way repairs none of them, so more than a bit goes missing at each chip-select release, as in the mode 1 tries. The test module (`gnss_spi.c` with `fb_delay`, `realign`, `rx_cpha`, `hold`, `osc`, `div` parameters) is on maclab in `~/tegu/gnssif-realign`; the palmtop is back on the baseline. + **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. ### Suspend with the modem on (2026-10-27, early morning, same kernel) From 373bace296d78e2bdad9497b250422b233dcb254 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 05:18:30 -0647 Subject: [PATCH 10/15] MODEM-PLAN: GNSS G3, stock's clock read correctly, and the link hang At stock's clock Kepler's frames are intact but its bit offset drifts with every transfer, more as the clock slows. The CP link hang came back with the slower watcher, so it remains open. --- device/tegu/MODEM-PLAN.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 04286d8d1..f6ee37c2b 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -733,6 +733,8 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **One bit late, cleanly, with feedback delay 3 (twenty-ninth to thirty-second tries, offline checks on the saved reads with CHPP's CRC32 over the 8-byte header and payload):** at feedback delay 3 (mode 0, 8 bits, the as-ported clock) Kepler's frames are intact but one bit late: shifting the reads left one bit turns 11 valid frames into 123 (at delay 2 the same shift recovers nothing). Kepler is on time just after it starts and one bit late later, so a fixed shift lost its first RESET-ACKs for 2 s and set off a reset storm (125 RESETs from Kepler, 144 RESET-ACKs from gnssd); delaying our writes by one bit as well killed the link outright, so writes are right as they are. A per-read choice (a preamble at bit 0 keeps the read, at bit 1 shifts it, a read without one keeps the last choice) gives clean short frames and the engine reporting satellites, but 279- and 361-byte frames still fail: setting the one dropped bit at each 64-byte boundary every possible way repairs none of them, so more than a bit goes missing at each chip-select release, as in the mode 1 tries. The test module (`gnss_spi.c` with `fb_delay`, `realign`, `rx_cpha`, `hold`, `osc`, `div` parameters) is on maclab in `~/tegu/gnssif-realign`; the palmtop is back on the baseline. +**Stock's clock again, read correctly (thirty-third and thirty-fourth tries):** the OSCCLK frames are not garbled: every read that holds a frame has a valid one at some bit shift (offline: 32 of 33 valid when each read is shifted to its preamble). But at OSCCLK / 2 (3.07 MHz) Kepler's bit offset walks by one or two bits about every 100 ms (0, 2, 3, 5, 6, 7, 0, 1, 3 in the first second), roughly a clock edge gained or lost per transfer; with the offset tracked per read and our writes delayed by it, 20 frames came through clean but Kepler only answered RESETs. At OSCCLK / 1 (6.14 MHz) the offset changed twice in 100 s. So the drift grows as the clock slows, the opposite of a too-fast slave; a clock edge seen twice (or a glitch) at each transfer's start or stop would fit. The 05:02 reset (CLUSTER0_NONCPU_WDTRESET) came with #148's watcher installed: in its last minute the CP link cycled twice a second in step with gnssd's `IOCTL_LOAD_GNSS_IMAGE` calls, so the watcher was one source of link cycling, not the only one, and the hang (CPIF's link power-down racing an access, presumably) is still open. Keep GNSS runs short until it is fixed. + **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. ### Suspend with the modem on (2026-10-27, early morning, same kernel) From e8d377c463739b046137d227a598cbce8c623de1 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 05:41:46 -0647 Subject: [PATCH 11/15] MODEM-PLAN: the CP link hang, read from the CPIF source The doorbell writes into the CP's BAR with no lock held across its link check, and the PCIe power-off clears pcie_powered_on outside the transmit lock, so a doorbell can land while the PHY goes into isolation. --- device/tegu/MODEM-PLAN.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index f6ee37c2b..2e817bc34 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -735,6 +735,8 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **Stock's clock again, read correctly (thirty-third and thirty-fourth tries):** the OSCCLK frames are not garbled: every read that holds a frame has a valid one at some bit shift (offline: 32 of 33 valid when each read is shifted to its preamble). But at OSCCLK / 2 (3.07 MHz) Kepler's bit offset walks by one or two bits about every 100 ms (0, 2, 3, 5, 6, 7, 0, 1, 3 in the first second), roughly a clock edge gained or lost per transfer; with the offset tracked per read and our writes delayed by it, 20 frames came through clean but Kepler only answered RESETs. At OSCCLK / 1 (6.14 MHz) the offset changed twice in 100 s. So the drift grows as the clock slows, the opposite of a too-fast slave; a clock edge seen twice (or a glitch) at each transfer's start or stop would fit. The 05:02 reset (CLUSTER0_NONCPU_WDTRESET) came with #148's watcher installed: in its last minute the CP link cycled twice a second in step with gnssd's `IOCTL_LOAD_GNSS_IMAGE` calls, so the watcher was one source of link cycling, not the only one, and the hang (CPIF's link power-down racing an access, presumably) is still open. Keep GNSS runs short until it is fixed. +**The CP link hang, read from the source (offline):** our `tegu-pcie0-cp` guards DBI and configuration space while the PHY is isolated (accesses return 0 or are dropped), but not the CP's BAR window, which CPIF uses for doorbells and the MSI registers. In CPIF (`s51xx_pcie_send_doorbell_int()`), the doorbell checks the link and then `iowrite32()`s into the BAR with no lock held across. The main sender (`link_device.c`) is safe: it takes `pcie_tx_lock`, sees `pcie_onoff_lock` held during a power-off and reserves the doorbell instead. But `s5100_poweroff_pcie()` clears `pcie_powered_on` outside `pcie_tx_lock`, and it only takes that lock briefly at the start to wait for a running transmit, so a sender that took the lock just before the power-off mutexes can ring the doorbell while the PHY goes into isolation. `IOCTL_LOAD_GNSS_IMAGE` itself only copies into the GNSS_FW carve-out in AP memory (no link access); the reloads matter because the Kepler reset around them makes IPC traffic, so the link wakes and idles twice a second. Next, hands-free but at the price of watchdog resets: a counter or trace at each BAR access in CPIF and at `cp_phy_isolate()`, to see which access lands after isolation; or the narrow fix of making `tegu-pcie0-cp` refuse isolation while CPIF holds `pcie_tx_lock` (a hook), which needs a CPIF change either way. + **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. ### Suspend with the modem on (2026-10-27, early morning, same kernel) From d51c2db93c71b8e0ca3afd1f660d838048502f10 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 05:42:07 -0647 Subject: [PATCH 12/15] MODEM-PLAN: correct the CP link hang reading The doorbell path is serialized with the PCIe power-off after all; no unguarded BAR access found by reading. --- device/tegu/MODEM-PLAN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 2e817bc34..d44d54212 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -735,7 +735,7 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **Stock's clock again, read correctly (thirty-third and thirty-fourth tries):** the OSCCLK frames are not garbled: every read that holds a frame has a valid one at some bit shift (offline: 32 of 33 valid when each read is shifted to its preamble). But at OSCCLK / 2 (3.07 MHz) Kepler's bit offset walks by one or two bits about every 100 ms (0, 2, 3, 5, 6, 7, 0, 1, 3 in the first second), roughly a clock edge gained or lost per transfer; with the offset tracked per read and our writes delayed by it, 20 frames came through clean but Kepler only answered RESETs. At OSCCLK / 1 (6.14 MHz) the offset changed twice in 100 s. So the drift grows as the clock slows, the opposite of a too-fast slave; a clock edge seen twice (or a glitch) at each transfer's start or stop would fit. The 05:02 reset (CLUSTER0_NONCPU_WDTRESET) came with #148's watcher installed: in its last minute the CP link cycled twice a second in step with gnssd's `IOCTL_LOAD_GNSS_IMAGE` calls, so the watcher was one source of link cycling, not the only one, and the hang (CPIF's link power-down racing an access, presumably) is still open. Keep GNSS runs short until it is fixed. -**The CP link hang, read from the source (offline):** our `tegu-pcie0-cp` guards DBI and configuration space while the PHY is isolated (accesses return 0 or are dropped), but not the CP's BAR window, which CPIF uses for doorbells and the MSI registers. In CPIF (`s51xx_pcie_send_doorbell_int()`), the doorbell checks the link and then `iowrite32()`s into the BAR with no lock held across. The main sender (`link_device.c`) is safe: it takes `pcie_tx_lock`, sees `pcie_onoff_lock` held during a power-off and reserves the doorbell instead. But `s5100_poweroff_pcie()` clears `pcie_powered_on` outside `pcie_tx_lock`, and it only takes that lock briefly at the start to wait for a running transmit, so a sender that took the lock just before the power-off mutexes can ring the doorbell while the PHY goes into isolation. `IOCTL_LOAD_GNSS_IMAGE` itself only copies into the GNSS_FW carve-out in AP memory (no link access); the reloads matter because the Kepler reset around them makes IPC traffic, so the link wakes and idles twice a second. Next, hands-free but at the price of watchdog resets: a counter or trace at each BAR access in CPIF and at `cp_phy_isolate()`, to see which access lands after isolation; or the narrow fix of making `tegu-pcie0-cp` refuse isolation while CPIF holds `pcie_tx_lock` (a hook), which needs a CPIF change either way. +**The CP link hang, read from the source (offline):** our `tegu-pcie0-cp` guards DBI and configuration space while the PHY is isolated (accesses return 0 or are dropped), but not the CP's BAR window, which CPIF uses for its doorbell. CPIF's main doorbell path (`link_device.c`) looks safe: it rings under `pcie_tx_lock` after checking that `pcie_onoff_lock` is free and `pcie_powered_on` is set, and `s5100_poweroff_pcie()` takes `pcie_onoff_lock` first and then waits for `pcie_tx_lock` before it powers the link down, so a doorbell either finishes before the power-off or is reserved for later. `IOCTL_LOAD_GNSS_IMAGE` only copies into the GNSS_FW carve-out in AP memory (no link access); the reloads matter because the Kepler reset around them makes IPC traffic, so the link wakes and idles twice a second. I found no unguarded BAR access by reading; the other doorbell callers (`modem_ctrl_s5100.c`) are the CP boot and the power-on path. Next, hands-free but at the price of watchdog resets: a trace at each BAR access in CPIF and at `cp_phy_isolate()`, to see which access lands after isolation. **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. From 8fe37208d755a922dc0e3222097e1e5b128dd597 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 09:17:56 -0647 Subject: [PATCH 13/15] MODEM-PLAN: GNSS G3 on 10-29 morning, the clock and the cut fixed Two kernel changes give the GNSS SPI stock's 3.072 MHz and one uncut 64-byte read per block. Mode 0 reads stay marginal, mode 1 reads lose one byte per back-to-back block; a logic analyzer is the next tool. --- device/tegu/MODEM-PLAN.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index d44d54212..836ea36f1 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -737,6 +737,18 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **The CP link hang, read from the source (offline):** our `tegu-pcie0-cp` guards DBI and configuration space while the PHY is isolated (accesses return 0 or are dropped), but not the CP's BAR window, which CPIF uses for its doorbell. CPIF's main doorbell path (`link_device.c`) looks safe: it rings under `pcie_tx_lock` after checking that `pcie_onoff_lock` is free and `pcie_powered_on` is set, and `s5100_poweroff_pcie()` takes `pcie_onoff_lock` first and then waits for `pcie_tx_lock` before it powers the link down, so a doorbell either finishes before the power-off or is reserved for later. `IOCTL_LOAD_GNSS_IMAGE` only copies into the GNSS_FW carve-out in AP memory (no link access); the reloads matter because the Kepler reset around them makes IPC traffic, so the link wakes and idles twice a second. I found no unguarded BAR access by reading; the other doorbell callers (`modem_ctrl_s5100.c`) are the CP boot and the power-on path. Next, hands-free but at the price of watchdog resets: a trace at each BAR access in CPIF and at `cp_phy_isolate()`, to see which access lands after isolation. +### G3, the morning of 10-29: the clock fixed, the cut fixed, and what is left (thirty-fifth to forty-fourth tries) + +[V] Two kernel changes, built from the gn3 source (`~/tegu/int-dt-20261026/kernel` on maclab, the reproducible build; the first attempt from `wt-modem` carried an older USI4 clock table and broke the audio I2C) and pushed as boot images only: spi-s3c64xx no longer cuts a transfer that fills the FIFO (64 bytes in one polled piece; the 32 + 32 test had shown every frame crossing a piece boundary failing with chip select held, so the cut, not the chip-select release, lost the bytes), and clk-zumapro lets USI3 reach OSCCLK (`nMUX`, so the framework may reparent, plus `CLK_SET_RATE_PARENT` on the divider and the source gate): `zumapro_gout_hsi0_usi3_ip` now reads 12.288 MHz after the first transfer, a 3.072 MHz bus, stock's rate. Both are commits on `tegu-spi-word-pieces` (kernel PR). Graphics, audio bring-up and touch are unaffected on that kernel. The SPI block's own prescaler does not exist on this IP (CLK_CFG reads 0 and ignores writes). + +[V] Reads, with every byte dumped to the kernel log (a gnssif built with `GNSS_PKT_DEBUG`, 64 bytes per line) and short 12-second sessions so Kepler's watchdog does not pile up resets: +- Mode 0 at stock's clock is marginal at every feedback delay: the per-read detector flips between "on time" and "one bit late" within a session, and long frames fail wherever it flips. (Delay 3 at 6.24 MHz had looked stable only because the session was short.) +- Mode 1 reads (writes stay mode 0) are byte-aligned and intact, but every block after the first one of a message loses its first byte: inserting one byte (0xAA) at the first position of block 1 makes Kepler's constant version frame pass its CRC. With a 100 us chip-select setup the protocol was the healthiest seen (0 ACK timeouts, our packets acknowledged), the first-byte loss unchanged. A 500 us gap before each read made Kepler stop sending long frames; a 50 us chip-select hold did nothing. +- Padding each write to a whole 64-byte exchange (gnssif) changed nothing measurable. +- CHPP's checksum is CRC32 over the 8-byte header and the payload (checked on short frames); the tools are in `/tmp/w32p32` on fw12 and the captures in `logs/tegu-gnss-w32-20261029/`. + +So with the clock and the cut right, what is left is one byte per back-to-back chip-select cycle in mode 1, or a half-bit sampling margin in mode 0, which is exactly the kind of question a logic analyzer on SPI21's SCLK, CS and MISO answers in a minute and software guessing does not. The palmtop runs the new kernel with the as-ported modules. The resets during this morning's sessions were mostly the curated startup's 150 s dead-man after its own false-positive fault check (an `OF: overlay: WARNING` line), rebooting through `reboot-to bootloader`; a few hard resets with no record in pstore remain unexplained (`logs/morning-20261029.md` item 7). + **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. ### Suspend with the modem on (2026-10-27, early morning, same kernel) From 97d2e4cc4a197b042197ac44ae47d505f56e0195 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 09:34:02 -0647 Subject: [PATCH 14/15] MODEM-PLAN: GNSS G3 parked without a hardware probe --- device/tegu/MODEM-PLAN.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 836ea36f1..fa2983d93 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -749,6 +749,8 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz So with the clock and the cut right, what is left is one byte per back-to-back chip-select cycle in mode 1, or a half-bit sampling margin in mode 0, which is exactly the kind of question a logic analyzer on SPI21's SCLK, CS and MISO answers in a minute and software guessing does not. The palmtop runs the new kernel with the as-ported modules. The resets during this morning's sessions were mostly the curated startup's 150 s dead-man after its own false-positive fault check (an `OF: overlay: WARNING` line), rebooting through `reboot-to bootloader`; a few hard resets with no record in pstore remain unexplained (`logs/morning-20261029.md` item 7). +**Parked (2026-10-29, the owner's decision):** no logic analyzer, and no more module-level guessing. The two kernel changes stay (kernel PR #135); the as-ported gnssif and gnss_spi run on the palmtop. GNSS resumes when either a stock capture of SPI21's timing or a new idea about the first byte of a back-to-back block turns up. + **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. ### Suspend with the modem on (2026-10-27, early morning, same kernel) From d3a1dc0d057dcc5bac114b41668b85029da4bf7c Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 10:14:54 -0647 Subject: [PATCH 15/15] device/tegu MODEM-PLAN: the GNSS night moves to its own pull request The ten commits with G3's fifth to forty-fourth tries, the CP link hang and GNSS parked are reviewed on #153 now, so this pull request goes back to fingerprint F6c-F10 and G3's third and fourth tries: MODEM-PLAN is the file as of 6fe8313 again. --- device/tegu/MODEM-PLAN.md | 180 -------------------------------------- 1 file changed, 180 deletions(-) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index fa2983d93..a5bbf463f 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -573,186 +573,6 @@ sensor service is missing), and `libsighandler.so` not found. Next, attended and on the charger, with the modem up: `strace -f` gnssd across one engine start, to see which files and devices it opens or fails to open (observation only). -### G3, fifth to eighth tries (2026-10-29, night, same kernel, on the charger, outdoors spot) - -- **strace of gnssd across engine starts** (`logs/tegu-modem-20261027/phone/g7-strace.sh`): - the HAL's request reaches gnssd, gnssd talks CHPP to Kepler over - `gnss_ipc` normally (the all-zero reads after each write are the SPI - full-duplex bytes Google's `send_betp` passes up by design), and Kepler - stops answering a few seconds after the engine start; gnssd then reads the - GNSS image back (`IOCTL_READ_GNSS_IMAGE`) and dumps RAM. `umts_boot0` - ioctl 0x28 (EINVAL, not in our CPIF) comes after the fault, in the crash - path. -- **Missing libraries**: gnssd `dlopen()`s `libcustomgnss.so` - (`GlueLayer_IsUseCustomGnssLib=1`), which needs `libsitril-gps.so` and - `libsitril-client.so` (RIL's GPS channel, binder to radioExternal). All - three were missing from the chroot. With them in, libcustomgnss reads the - CP state from `/sys/bus/platform/devices/cpif/modem_state`, which the - chroot lacked; with that bound, it logs "Modem state ONLINE". `GpsOpen()` - still fails (no radioExternal HAL). Kepler's fault is unchanged (PR #141). -- **DVS and DFS off** through gnssd's `/data/vendor/gps/overlay/gps_overlay.conf` - (read 27 times): the fault is unchanged (9 in 4 minutes). -- **Stock's rails are Kepler's to control**: LDO9S-11S carry - `channel-mux-selection` 0x29-0x2b (subsys GPS) in stock's DT, with - LDO9S ranging 0.725-1.3 V; our DT holds them on at fixed voltages. -- **Hazard found**: after the modem profile has stopped (gnssd's exit), - starting the profile again in `OMAMOBILE_MODEM_STAGE=rfsd` reset the - palmtop silently (watchdog, no pstore). Reboot instead. -- **Where the fault is** (local disassembly of the soft-watchdog RAM dump, - which is kepler.bin as loaded at 0x60000000; private, never committed): - the patch code at 0x600B5B34 calls a veneer at 0x600E143C that jumps to - 0x200005B5 (R12 at the fault), code in Kepler's SRAM (the main stack is at - 0x2002FF38). That code branched through R3 = 0x62D, and the M7 faulted - fetching 0x62C, low memory that isn't in the image. So something maps or - powers Kepler's low memory, or fills that pointer, and it hasn't happened - by engine start. `umts_boot0` ioctl 0x28 (gnssd's "SHMEM_SIZE -1") is - not defined in Google's tegu CPIF either, so stock gets EINVAL too and it - isn't the cause. -- **The loaded image is intact.** The dump differs from kepler.bin in 17 - words, all in the configuration header below 0x390, and they are gps.cfg's - values that gnssd writes before the load (RfMiscCtrl 0x80008001 at 0x10, - AidingConfiguration 0x20046 at 0x1c, the VDR 200/20 limits at - 0x344-0x350). So the write-combine mapping of GNSS_FW (stock: cached, - over an I/O-coherent link) doesn't corrupt the load. The layout matches - stock too: GNSS_FW at cp_rmem + 8 MiB, 4 MiB long. The missing piece is - on the core's side (its low memory at engine start), which the AP can't - see; the next step is Kepler's own debug log (`gps_overlay.conf.next`). - -### G3, ninth to fourteenth tries: the "hardfault" is gnssd's watchdog (2026-10-29, night) - -[V] With gnssd's debug log on (`gps_overlay.conf`: `debug_enable=1`, -`debug_console=1`, `chpp_log_level=4`), the engine is seen **working**: it -tracks satellites (SVIDs 5, 11, 12, 13 at C/N0 29-35 dB-Hz) within ~10 s -of the start. The fault that follows is gnssd's own: its soft watchdog -logs "KEP soft_dog pos req timeout", then "sw version timeout", resets -Kepler and sends BLC ID 6 ("Try and trigger hard fault to see if CPU is -locked up or maybe we can get RAM dumps"), which is the "KEP M7 -HARDFAULT" with PC 0x62C. The watchdog fires because the CHPP link over -the GNSS SPI loses packets: thousands of "ACK timeout" and 244 "Rx BAD -checksum" in one run. In the raw reads, frames that should start with the -CHPP preamble `68 43` often read `34 21`, the same bits one bit late, and -long frames end in zeros. - -The SPI settings tried, each on a fresh boot (the CP boots once per boot): - -| SPI mode | rx chunk | feedback delay | RX bad checksums | Kepler | -| --- | --- | --- | --- | --- | -| 0 (as ported) | 64 | 2 (as ported) | 244 | tracks, then the watchdog | -| 0 | 32 | 2 | 17 | opstate 0 | -| 0 | 32 | 0 (stock's value) | 93 | opstate 0 | -| 1 | 32 | 0 | 34 | opstate 0 | -| 1 | 64 | 0 | 0 (RX clean) | TX lost: Kepler never sees our RESET-ACK | -| 0, 1 MHz | 64 | 0 | 63 | opstate 0 | -| 3 | 64 | 0 | 32 | opstate 0 | -| 0, 32-bit words (swapped in gnss_spi) | 64 | 2 | 1 | RX transfers time out (-110), opstate 0 | -| 0, 32-bit, auto CS (`google,gs101-spi` only) | 64 | 2 | 0 | RX transfers time out (-110), opstate 0 | -| 0, auto CS | 64 | 2 | 274 | tracks, then the watchdog (as ported) | - -So RX samples the core's data a bit early in mode 0, mode 1 fixes RX but -breaks TX, and neither the feedback delay nor a slower clock fixes it. -Stock drives this SPI with 32-bit words, `swap-mode = <1>` and DMA -(`dma-mode`, PDMA 0x14/0x15); our port uses PIO. 32-bit words alone (byte -order fixed in gnss_spi) time out in PIO, so the next step is DMA for this -SPI. Google's driver uses auto CS for this device (no -`samsung,spi-chip-select-mode`), but auto CS changes nothing with 8-bit -words. Our DT has no PDMA controller (stock's overlay uses `pdma1`), so DMA -means a PL330 node for zumapro first. The palmtop is back on the as-ported setting (mode 0, -64-byte reads, delay 2, the gn3 DTB). - -Next steps for the link, from the night of 10-29 (not tried yet): -- **32-bit words in PIO time out** (`res -110`, every 64-byte read) under - mainline spi-s3c64xx. Not its FIFO-level check: Google's driver makes the - same `RX_FIFO_LVL < xfer->len` comparison for 32-bit words and works, so - the level counts bytes. -110 is mainline's interrupt wait - (`wait_for_completion_timeout` in `s3c64xx_wait_for_pio()` with - `use_irq`), which Google's driver doesn't have: it polls. The FIFO - trigger interrupt with 32-bit words is the next thing to read - (spi-s3c64xx is built in, so a change is a kernel push). -- **DMA:** stock's `pdma1` is a PL330 at 0x10130000 (SPI 806, a 200 MHz - fixed clock, Samsung's 36-bit address wrappers, which mainline doesn't - have), with the GNSS SPI on channels 0x14 (tx) and 0x15 (rx). A - read-only probe (2026-10-29) read its PrimeCell IDs (periph 0x30 0x13, - cell 0x0d 0xf0) from Linux without an abort, so a DT node can probe it. - Mainline uses DMA only for transfers longer than the 64-byte FIFO, so the - 64-byte reads would stay PIO. - -**What the link does (10-29, night), cause still open:** mainline spi-s3c64xx cuts -every PIO transfer of 64 bytes or more into 63-byte pieces -(`xfer->len = fifo_len - 1`), stopping and flushing the FIFO between them. -So each 64-byte read of Kepler becomes 63 + 1 bytes, and each longer write -is cut mid-frame; 32-bit words then can't work at all (63 isn't a multiple -of 4: the `len-63` timeouts). Stock never splits: it uses DMA. But the -split isn't shown to be the cause: with gnss_spi cutting every transfer -into 60-byte pieces itself (one message, CS held, every pause on a 32-bit -boundary, so the controller never cuts), the link garbled just the same -(369 bad checksums, Kepler tracking, then the watchdog). Progress: a runtime test module -registered stock's pdma1 (PL330 at 0x10130000, SPI 806) and the built-in -pl330 driver probed it and ran a 256-byte memcpy correctly; a DTB with the -node probes it at boot. But with `dmas` on the GNSS SPI (0x14/0x15, either -order), RX DMA moves nothing (residue 64): the SPI's DMA requests don't -reach pdma1, so some routing stock sets up is still missing (a sysreg or -USI DMA select, or the PL330's peripheral security setting). The palmtop -is back on gn3 without the node. A one-boot reset at 69 s happened on the -second boot with the node, cause not seen. - -### G3, fifteenth to twenty-third tries: the SPI runs at twice stock's clock (2026-10-29, small hours) - -[V] Each try on a fresh boot of the gn3 kernel, gnssd's debug log on, a test -`gnss_spi.ko` with module parameters (feedback delay, chip-select setup, -clock, `HIGH_SPEED_EN`), raw RX bytes taken from strace of gnssd's reads of -`/dev/gnss_ipc`. Results: - -| Try | Setting | Bad checksums | Kepler | -| --- | --- | --- | --- | -| baseline (control) | as ported: 8-bit, 64-byte reads, delay 2 | 46 | tracks (C/N0 29-34), then the watchdog | -| w32p32 | 32-bit words, 32-byte pieces in one message | 19 | no watchdog, stops after RESET-ACK | -| w32rx32 | 32-bit, 32-byte reads | 7 | same | -| fb3 | 32-bit, feedback delay 3 | 5 | same | -| cs200 | 32-bit, delay 3, 200 us CS setup | 0 | same | -| osc | 32-bit, USI3 mux on OSCCLK, about 1.5 MHz | 0 | same | -| acs | 32-bit, auto CS DTB | 0 | same | -| osc8 | 8-bit, OSCCLK, about 1.5 MHz, delay 0 | 1 | same | -| hs | 8-bit, `HIGH_SPEED_EN` forced, 32-byte transfers | 17 | same | -| hs60 | 8-bit, `HIGH_SPEED_EN`, 60-byte reads | 408 | tracks, then the watchdog (38) | - -What the raw bytes show: - -- **The real SPI clock is 6.24 MHz, not 3.125.** USI3's mux (`zumapro_mout_hsi0_usi3_local`) is read-only in clk-zumapro and sits on the 399.36 MHz parent; the 4-bit divider stops at /16, so the IP clock is 24.96 MHz and the SPI clock 24.96 / 4, whatever spi-s3c64xx asks for. The "1 MHz" try of the night before ran at 6.24 MHz too. -- **The baseline's errors are per byte:** one byte of a repeated frame arrives with its top bit taken from the previous byte's last bit (`10 01 00 0a ... 4f b6 25 9c` read as `08 00 00 05 ... 27 db 12 ce`), and the rest of the frame is right. That is the controller sampling before Kepler's data has settled: too little margin at 6.24 MHz, as mode 1 (which samples half a clock later) showed. -- **Every changed setting broke the framing instead:** with 32-bit words, with the OSCCLK mux, and with chip select toggled every 32 bytes, CHPP frames arrive at any bit offset (8-bit baseline: always 0 or 1), the link stops after RESET-ACK, and the bad-checksum count drops only because few frames are recognised. A chip-select toggle in the middle of a frame drops one byte from Kepler at the break. So the low counts in this table are not improvements. - -The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz on USI3 (3.125 MHz SPI) from a parent that can give it, as stock does, with nothing else changed. The OSCCLK try isn't a fair test of that (24.576 / 4, about 1.5 MHz, switched behind the clock framework's back). The palmtop is back on the baseline (`gnss_spi` aa4618bb, `gnssif` eb0f3d9a, gn3 DTB, no debug overlay). One reset at 348 s, after the hs60 run had ended, came during modem PCIe link activity ("PHY isolated"), not in the SPI path. - -**Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. - -**Read in mode 1, write in mode 0 (twenty-fifth and twenty-sixth tries).** The baseline's raw reads show more than single bytes: about 80% of CHPP frames arrive one whole bit late (the preamble found at bit offset 1, so CHPP never sees it), which is where most ACK timeouts come from. Feedback delay 3 at 8 bits changed nothing (57 bad checksums, same split of offsets). A test module that switches `spi->mode` per transfer (read-only transfers in mode 1, writes in mode 0; spi-s3c64xx reconfigures on every transfer because its `cur_speed` never equals the rate asked) put every frame at bit offset 0 for the first time on the as-ported clock: short frames pass, the engine reports satellites, the watchdog fires later. Long frames (279 bytes) still fail: the first byte or two after each read's chip select are damaged (in one string Kepler resent, the byte after a 60-byte boundary read `6` in one copy and `8` in the next, and `11 00 11` became `41`). 60-byte reads, so spi-s3c64xx never splits a read, didn't change that. Two resets came from the modem side, not the SPI: after Kepler's watchdog resets, gnssd reloads the image over the CP's PCIe link (`IOCTL_READ_GNSS_IMAGE`, then "PHY isolated"), and the SoC reset within a second (03:15, and 02:43 after the hs60 run). Frequent Kepler resets are therefore a crash risk until the link is fixed; keep GNSS runs short. Separately, two boots reset at about 34 s, right after Bluetooth started (01:41, 03:03), before any GNSS step. - -**Where the bytes go (twenty-seventh try, mode 1 reads with 50 us chip-select setup):** 101 bad checksums (260 without the setup), and the palmtop stayed up through 14 Kepler watchdog resets with omamobile-modem 0.1.9's slower CP watcher (#148). Comparing the copies Kepler resends: short frames inside one 64-byte read agree byte for byte, and every copy of a long frame loses the same one or two bytes at each 64-byte read boundary (`11 00 11 00 10 00 01` read as `11 00 00 | 00 01`, `00 00 31 2e 30 2e 30` as `00 00 2e | 2e 30`). So in mode 1 Kepler's stream drops bytes when chip select is released between reads, deterministically, not by timing. In the as-ported mode 0 the copies disagree mostly at byte 63, the one-byte tail spi-s3c64xx splits off each 64-byte read. Next: hold chip select across rx_work's consecutive reads of one Kepler message (one long transfer while gnss2ap stays high), which also removes the split. - -**Chip select held across a message (twenty-eighth try):** mode 1 reads with chip select kept asserted between rx_work's reads (released when gnss2ap drops or before a write) made it worse: 292 bad checksums, and the 279-byte frames now end in zeros (footer 0). Kepler wants chip select released between its 64-byte reads, as stock does, so the bytes lost at each release in the mode 1 tries have another cause. What's left untried needs stock evidence: a logic-analyzer capture of stock's SPI21 (CS, SCLK, MISO timing between reads), or stock's register state for SPI21 and CMU_HSI0 USI3 while GNSS runs. - -**One bit late, cleanly, with feedback delay 3 (twenty-ninth to thirty-second tries, offline checks on the saved reads with CHPP's CRC32 over the 8-byte header and payload):** at feedback delay 3 (mode 0, 8 bits, the as-ported clock) Kepler's frames are intact but one bit late: shifting the reads left one bit turns 11 valid frames into 123 (at delay 2 the same shift recovers nothing). Kepler is on time just after it starts and one bit late later, so a fixed shift lost its first RESET-ACKs for 2 s and set off a reset storm (125 RESETs from Kepler, 144 RESET-ACKs from gnssd); delaying our writes by one bit as well killed the link outright, so writes are right as they are. A per-read choice (a preamble at bit 0 keeps the read, at bit 1 shifts it, a read without one keeps the last choice) gives clean short frames and the engine reporting satellites, but 279- and 361-byte frames still fail: setting the one dropped bit at each 64-byte boundary every possible way repairs none of them, so more than a bit goes missing at each chip-select release, as in the mode 1 tries. The test module (`gnss_spi.c` with `fb_delay`, `realign`, `rx_cpha`, `hold`, `osc`, `div` parameters) is on maclab in `~/tegu/gnssif-realign`; the palmtop is back on the baseline. - -**Stock's clock again, read correctly (thirty-third and thirty-fourth tries):** the OSCCLK frames are not garbled: every read that holds a frame has a valid one at some bit shift (offline: 32 of 33 valid when each read is shifted to its preamble). But at OSCCLK / 2 (3.07 MHz) Kepler's bit offset walks by one or two bits about every 100 ms (0, 2, 3, 5, 6, 7, 0, 1, 3 in the first second), roughly a clock edge gained or lost per transfer; with the offset tracked per read and our writes delayed by it, 20 frames came through clean but Kepler only answered RESETs. At OSCCLK / 1 (6.14 MHz) the offset changed twice in 100 s. So the drift grows as the clock slows, the opposite of a too-fast slave; a clock edge seen twice (or a glitch) at each transfer's start or stop would fit. The 05:02 reset (CLUSTER0_NONCPU_WDTRESET) came with #148's watcher installed: in its last minute the CP link cycled twice a second in step with gnssd's `IOCTL_LOAD_GNSS_IMAGE` calls, so the watcher was one source of link cycling, not the only one, and the hang (CPIF's link power-down racing an access, presumably) is still open. Keep GNSS runs short until it is fixed. - -**The CP link hang, read from the source (offline):** our `tegu-pcie0-cp` guards DBI and configuration space while the PHY is isolated (accesses return 0 or are dropped), but not the CP's BAR window, which CPIF uses for its doorbell. CPIF's main doorbell path (`link_device.c`) looks safe: it rings under `pcie_tx_lock` after checking that `pcie_onoff_lock` is free and `pcie_powered_on` is set, and `s5100_poweroff_pcie()` takes `pcie_onoff_lock` first and then waits for `pcie_tx_lock` before it powers the link down, so a doorbell either finishes before the power-off or is reserved for later. `IOCTL_LOAD_GNSS_IMAGE` only copies into the GNSS_FW carve-out in AP memory (no link access); the reloads matter because the Kepler reset around them makes IPC traffic, so the link wakes and idles twice a second. I found no unguarded BAR access by reading; the other doorbell callers (`modem_ctrl_s5100.c`) are the CP boot and the power-on path. Next, hands-free but at the price of watchdog resets: a trace at each BAR access in CPIF and at `cp_phy_isolate()`, to see which access lands after isolation. - -### G3, the morning of 10-29: the clock fixed, the cut fixed, and what is left (thirty-fifth to forty-fourth tries) - -[V] Two kernel changes, built from the gn3 source (`~/tegu/int-dt-20261026/kernel` on maclab, the reproducible build; the first attempt from `wt-modem` carried an older USI4 clock table and broke the audio I2C) and pushed as boot images only: spi-s3c64xx no longer cuts a transfer that fills the FIFO (64 bytes in one polled piece; the 32 + 32 test had shown every frame crossing a piece boundary failing with chip select held, so the cut, not the chip-select release, lost the bytes), and clk-zumapro lets USI3 reach OSCCLK (`nMUX`, so the framework may reparent, plus `CLK_SET_RATE_PARENT` on the divider and the source gate): `zumapro_gout_hsi0_usi3_ip` now reads 12.288 MHz after the first transfer, a 3.072 MHz bus, stock's rate. Both are commits on `tegu-spi-word-pieces` (kernel PR). Graphics, audio bring-up and touch are unaffected on that kernel. The SPI block's own prescaler does not exist on this IP (CLK_CFG reads 0 and ignores writes). - -[V] Reads, with every byte dumped to the kernel log (a gnssif built with `GNSS_PKT_DEBUG`, 64 bytes per line) and short 12-second sessions so Kepler's watchdog does not pile up resets: -- Mode 0 at stock's clock is marginal at every feedback delay: the per-read detector flips between "on time" and "one bit late" within a session, and long frames fail wherever it flips. (Delay 3 at 6.24 MHz had looked stable only because the session was short.) -- Mode 1 reads (writes stay mode 0) are byte-aligned and intact, but every block after the first one of a message loses its first byte: inserting one byte (0xAA) at the first position of block 1 makes Kepler's constant version frame pass its CRC. With a 100 us chip-select setup the protocol was the healthiest seen (0 ACK timeouts, our packets acknowledged), the first-byte loss unchanged. A 500 us gap before each read made Kepler stop sending long frames; a 50 us chip-select hold did nothing. -- Padding each write to a whole 64-byte exchange (gnssif) changed nothing measurable. -- CHPP's checksum is CRC32 over the 8-byte header and the payload (checked on short frames); the tools are in `/tmp/w32p32` on fw12 and the captures in `logs/tegu-gnss-w32-20261029/`. - -So with the clock and the cut right, what is left is one byte per back-to-back chip-select cycle in mode 1, or a half-bit sampling margin in mode 0, which is exactly the kind of question a logic analyzer on SPI21's SCLK, CS and MISO answers in a minute and software guessing does not. The palmtop runs the new kernel with the as-ported modules. The resets during this morning's sessions were mostly the curated startup's 150 s dead-man after its own false-positive fault check (an `OF: overlay: WARNING` line), rebooting through `reboot-to bootloader`; a few hard resets with no record in pstore remain unexplained (`logs/morning-20261029.md` item 7). - -**Parked (2026-10-29, the owner's decision):** no logic analyzer, and no more module-level guessing. The two kernel changes stay (kernel PR #135); the as-ported gnssif and gnss_spi run on the palmtop. GNSS resumes when either a stock capture of SPI21's timing or a new idea about the first byte of a back-to-back block turns up. - -**Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. - ### Suspend with the modem on (2026-10-27, early morning, same kernel) - **What ran:** s2idle on `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`