Repository navigation
arm64: dts: apple: t8122: SPI2 and SPI4 run from the 24 MHz reference, not 200 MHz - #1598
Conversation
The J613 ADT gives SPI2 clock ID 0x198 a 24 MHz boot frequency. On hardware, divider 25 produces 0.96 MHz: six 29184-byte frames take 243.2 ms and overrun the 229 ms receive deadline. Use the existing 24 MHz reference clock so an 8 MHz request selects divider 3. Leave SPI1 unchanged pending evidence for that controller. Signed-off-by: Satya Benson <satya@benson.earth>
The divider rounds up, so a requested transfer rate can exceed the achieved rate even when the input clock is described correctly. Record the effective speed after clamping the divider and use it for the IRQ transfer deadline and the polling decision. Add a host test extracting the production preparation function and timeout expression. Cover exact and rounded divisors, the divider limit and the polling threshold with address and undefined-behavior sanitizers. Signed-off-by: Satya Benson <satya@benson.earth>
The J613 boot clock table also describes SPI4 clock ID 0x19a as 24 MHz. Use clkref for this unclaimed controller; the QSPI clock ID 0x188 is 200 MHz and remains unchanged. Signed-off-by: Satya Benson <satya@benson.earth>
|
Claude Fable 5.2 on @satchlj's behalf Hardware confirmation of the device-tree part, with an unpatched driver (2026-11-11, J613 M3 MacBook Air).
Not observed: frame duration and the programmed clock divider. This kernel logs neither, so the expected ~29 ms frames and divider 3 are not confirmed by these records. The driver part of this PR was not run here. |
RyanTheTide
left a comment
There was a problem hiding this comment.
The effective-rate accounting is right, and the J613 frame timing confirms the 24 MHz input. One small hardening: if clk_get_rate() ever returns 0, cr is 0 and the new effective_speed_hz line divides by zero; clamping cr to at least 1 would avoid that. We will run it on our SPI keyboard and Touch ID machines before merging.
|
Interim results. Kernel: integration e661192 plus this PR and the others in this round, one-shot.
The M2 (SPI keyboard) run is still queued. The |
If clk_get_rate() returns zero, the calculated divider is zero and computing effective_speed_hz divides by zero. Clamp the divider to at least one before programming it and calculating the effective speed, as suggested by RyanTheTide in review. Non-zero clock rates retain their existing behavior. Signed-off-by: Satya Benson <satya@benson.earth>
|
GPT-6.1 Sol on @satchlj's behalf Pushed b876103 as one signed-off, fast-forward commit, addressing RyanTheTide's review. In Checks:
This commit has NOT been booted on hardware. The J613 is away until Friday 2026-11-13 afternoon US Eastern. The change does not alter behaviour for a non-zero clock rate. |
|
Claude Fable 5.2 on @satchlj's behalf. First hardware boot of b876103 on J613 (M3 MacBook Air), unattended. Composition: integration 5b36eff + #973 c0aa78b + #1598 b876103 + #1490 f38fa76 (merge commit d4ed471f, kernel release 7.3.0-aurora73-ppt-10-ARCH), booted as one-shot trials; the installed default was not changed.
This exercises the normal non-zero clock path on this composition, not a forced zero-rate provider. A fingerprint verify was not run (nobody at the machine); it is planned for later today. |
omacom/linux-aurora carry/edgeB-7.3 (tag edgeB3) 54835f485826: edgeB2 plus aurora-silicon/linux#1598 (T8122 SPI2 input and SPI4 reference clocks), the J613 Touch ID data-ready line, and omacom/linux-aurora#370 (brcmfmac ring completions). The M3 Air's Touch ID works again: the SPI2 clock was described as 200 MHz, so the sensor frame missed its transfer budget. Mesa and aura are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Looks good; approve once the b876103 Touch ID row and the queued M2 SPI keyboard row are in. Checked: the T8122 SPI2 and SPI4 nodes now use the 24 MHz reference (t8122.dtsi, t8122-peripheral-buses.dtsi), which matches the measured divider-25 frame time. apple_spi_prep_transfer() (drivers/spi/spi-apple.c:323-345) now clamps the divider to 1..CLKDIV_MAX before it computes effective_speed_hz, so a zero clock rate can no longer divide by zero. The polling decision and the IRQ deadline (spi-apple.c:619-621) both use the achieved rate. The branch is clean against integration/aurora. HW row: J613 at head b876103, default cmdline with the corrected Stage 2: 5/5 Nit: the PR body ends with "Generated with Claude Code"; the last line should be Assisted-by: LLM (Claude:Opus 5.5) |
|
Rows at this head (b876103), from the fleet78 kernel, which is integration/aurora cc14570 plus this PR and 18 other ready PRs. Each Mac booted it once on the shared fleet command line.
Still open from the review: the b876103 Touch ID enrol/verify row on a T8122. It needs a finger on the sensor. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial review at head b8761033979a53ae01cd3877c4953574b9ba57d3 against pre-pr-checklist.md.
Verdict: Approve (0 code blockers; remaining hands-on b8761033 Touch ID finger-touch row is non-blocking).
Checked
- DT changes (
arch/arm64/boot/dts/apple/t8122.dtsi,t8122-peripheral-buses.dtsi): Switchingspi2(Touch ID) andspi4from&clk_200mto&clkref(24 MHz) matches the measured divider-25 frame time (243.2 ms for 29,184 bytes = 0.96 MHz) and also correctsapple_spi_delay_cycles()hardware CS setup/hold timing on T8122 Touch ID (previously 8.33× too long).spi1andqspiare properly left unchanged. - Driver arithmetic & safety (
drivers/spi/spi-apple.c):apple_spi_prep_transfer()clampscrto1..APPLE_SPI_CLKDIV_MAX(min_t(u32, cr, APPLE_SPI_CLKDIV_MAX)thenmax(cr, 1U)), preventing divide-by-zero whenclk_get_rate()returns 0, then computest->effective_speed_hz = clk_get_rate(spi->clk) / cr.- Both the polling threshold (line 345) and IRQ transfer timeout (line 621, with
max(t->effective_speed_hz, 1U)) use the achieved rate rather than the requested rate. No SoC/board gates, no magic delays, works on default cmdline (Rules 1–3).
- CI: 2/2 checks pass (
dt-checks,host-tests). - Clean-room & attribution (Rule 4): Checked all 4 raw commit objects (
3f09f2d2,e8d0e9a8,f1c9d85f,b8761033). Every commit carries human author/committer (Satya Benson <satya@benson.earth>) andSigned-off-by: Satya Benson <satya@benson.earth>only — no agent co-author, sign-off, orAssisted-bytrailers in any commit. PR body now ends cleanly withAssisted-by: LLM (Claude:Opus 5.5). No Apple code/disassembly/tuning values.
Hardware rows & Touch ID finger-row assessment (Rule 5)
- Covered:
- J613 (T8122) at
f1c9d85f: 9× 29,184-byte frames atclk=24000000 div=3(29,202–29,252 µs vs 243 ms before), 5/5fprintd-verifymatches, 0 SPI timeouts; plus rebuilt Stage 2 (f1c9d85fDT) with 5/5fprintd-verify+ 1 lock-screen unlock, 0-110/timeouts. - J613 (T8122) at
b8761033: unattended boot confirmedapple-mesa spi1.0bind at 8 MHz, 24 MHz clock,CLKDIV 3,fprintdhealthy, 0 probe errors. - M1 Pro (T6000, SPI keyboard) at
b8761033(fleet78): SPI keyboard/trackpad/actuator bind onspi2.0, 2/2 s2idle cycles, 0 SPI errors, enforcing, 0 AVC, 0 failed units. - M2 Air (T8112, NOR + Touch ID SPI) at
b8761033(fleet78):spi0NOR MTD partitions found,spi1apple-mesa spi1.0bound at 8 MHz, 2/2 s2idle cycles, 0 SPI errors, 0 kernel errors.
- J613 (T8122) at
- Touch ID finger row at
b8761033— non-blocking: The only delta fromf1c9d85ftob8761033iscr = max(cr, 1U);, which is a mathematical no-op for every non-zero input clock (DIV_ROUND_UP(24000000, speed_hz) >= 1). With 5/5fprintd-verify+ wire-time verification already proven atf1c9d85f, plus cleanb8761033boot/bind on J613 and full regression rows on M1 Pro and M2 Air, this is sufficient for approval. Adding the hands-onb8761033Touch ID finger row when an owner is at J613 is still welcome if the merger prefers a head-exact interactive check, but it does not block approval.
Minor non-blocking nits (follow-up friendly)
tools/spi/apple-spi-clock-test.pyis not yet registered intools/asahi/run-host-tests.py, so CIhost-testsdoes not currently execute it; it also lacks a committedclk = 0test case forb8761033.drivers/spi/spi-apple.c:328,332: cachingunsigned long rate = clk_get_rate(spi->clk);avoids callingclk_get_rate()twice.
Assisted-by: LLM (Google:Gemini 4 Neon)
c3a4d79
into
aurora-silicon:integration/aurora
Claude Fable 5.2 on @satchlj's behalf
Fixes Touch ID matching on J613 (M3 MacBook Air, T8122), which failed with SPI receive timeouts while reading fingerprint frames. This is the remaining failure reported on #1491 (0 matches in 6 attempts); #1491 fixed the transmit-only case and did not touch this path.
Cause. The T8122 device tree gives SPI2 (the fingerprint sensor's bus,
spi@2a1108000) and SPI4 (spi@2a1110000) a 200 MHz input clock. Their real input is the 24 MHz reference. For an 8 MHz device the driver therefore programmed divider 25 and the bus ran at 0.96 MHz. A 29,184-byte frame took 243.2 ms against a 229 ms timeout.Evidence for 24 MHz
Commits
arm64: dts: apple: t8122: Fix the fingerprint SPI input clock: SPI2 references the 24 MHz clock.spi: apple: Account for the programmed clock in receive timeouts: the timeout and the polling decision use the rate actually achieved after divider rounding, not the requested rate, so a rounded divider cannot reproduce this failure. Adds a host test (tools/spi/apple-spi-clock-test.py) that rejects the original driver.arm64: dts: apple: t8122: Correct the SPI4 reference clock: same correction for SPI4.Tested on hardware (J613, exact head f1c9d85)
Kernel
7.3.0-aurora73-exact-1111-spi-D-ARCH, which is integration plus the then-open J613 PR heads plus these three commits and one transfer-metadata debug line, booted with a one-shot Stage 2 carrying the corrected device tree (the running device tree on this machine comes from the boot loader, so the dts change only takes effect through a rebuilt Stage 2)./clock-ref, 24 MHz.clk=24000000 div=3on every transfer.fprintd-verify, @satchlj's enrolled finger). Seven earlier verification windows expired with no finger on the sensor and attempted no frame transfer.Offline
Not tested
Assisted-by: LLM (Claude:Opus 5.5)