Repository navigation
Apple M6 (T8152) Mac mini boot NOR (QSPI): binding and device tree (on top of #191) - #193
joshuaswarren wants to merge 12 commits into
Conversation
|
Compile receipt (arm64, clang, Not run: a link of the whole kernel, a boot of this branch, |
[Medium impact] The PR appears safe to merge based on the reviewed code. SummaryAdds T8152 boot NOR support through the existing QSPI driver.
The earlier findings are addressed in the current code. No new actionable issue was established. This review did not run builds or hardware tests.
|
|
Rebased on the fixed #191 head |
c565328 to
40ee5ac
Compare
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
|
GREEN at 40ee5ac for the last two commits (QSPI binding, boot NOR dtsi). Read only: nothing built or booted by me, and no Checked:
Non-blocking notes:
|
|
Review at 40ee5ac: findings (two commits: the binding and the boot NOR device tree) Checked
Findings
Smaller
Not checkedNo compile at this head (I did not reproduce the receipt), no boot, no read or write of the NOR, no |
40ee5ac to
041cfb1
Compare
|
Thanks. New head |
|
Review at 041cfb1: findings (two commits: the binding and the boot NOR device tree) The head is a rebase of the two commits onto the fixed #191 head. I compared the PR diff with the one I reviewed at Checked again
Still open
Not checkedNo compile at this head, no boot, no NOR read or write. The first ten commits are #191. |
The T8152 GPIO block has the same layout as the T8140 one. Match "apple,t8152-pinctrl" with the T8140 hardware data. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
T8152 has a SART with a new register layout: the per-entry config, physical address and size registers sit at 0x00, 0x60 and 0xc0. Add the operations for it and match "apple,t8152-sart". The binding lists the new compatible as a stand-alone entry. Measured on an M6 Mac mini with an earlier form of this change: the machine boots and runs its root file system from NVMe, which uses this SART. This version is compile-checked only. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
On T8152 the queue setup registers (admin queue, IO queues, the linear submission queue control) live at different offsets, and a few of them accept writes but read back zero. Add a register translation for that layout, skip the read-back checks that cannot work, and describe the controller with a new hardware data block matched by "apple,t8152-nvme-ans2". The ANS is a virtual PMGR device on this SoC and has no reset line, so the hardware data block carries a no_reset_control flag. Only T8152 skips the reset lookup. Every other SoC still requires a reset control and fails the probe without one, as before. The binding gets the new compatible. On T8152 the resets, power-domains and power-domain-names properties are not required, and the controller has two register regions (the NVMMU registers live in the first one). Measured on an M6 Mac mini with an earlier form of this change: the machine boots and runs its root file system from NVMe. This version is compile-checked only. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
041cfb1 to
049e0bc
Compare
|
v2 from the QSPI author, rebased on the fixed #191 head
Compile check at this head, arm64 clang |
|
GREEN at 049e0bc for the last two commits (QSPI v2). Read only: nothing built or booted by me. Against the version I GREENed at 40ee5ac: the binding commit is unchanged (the same diff); in |
|
GREEN at 049e0bc for the last two commits (QSPI binding and boot NOR device tree). Compared with the head I reviewed ( Checked
Not checkedNo compile at this head (I did not reproduce the receipt), no boot, no NOR read or write. The first ten commits are #191. |
|
Summary for a maintainer, at head
|
a154d5d to
2a35969
Compare
|
New head Receipts at this head (CT-local, arm64 clang |
|
GREEN at 2a35969 Read: the twelve commits against the ones I reviewed at 049e0bc, compared per commit as diffs with the hash lines removed. The two commits of this PR (the spi qspi binding and the boot NOR controller dts) are identical (0 differing lines). The ten base commits are the #191 head b8943e8, where I posted the delta review (PSD group power-off restore, Gen3 doorbell guard and locked-DART flush path, fixed-peripheral tunables, core_stop on PHY init failure, four iommus, PSD parents). Not run: build; the author's compile and dt receipts are not reproduced. Merge still needs CI and a second non-author GREEN. |
2a35969 to
12e1b4b
Compare
On T8152 the ATC USB blocks (and the GPU) are behind a per-slot service request in the power state director, on top of the normal PMGR power states. Expose each slot, or a group of slots that must come up together, as a generic power domain. Power-on writes the slot request and waits for the acknowledge; power-off requests state 6 in reverse order. Add the devicetree binding. When a power-on request times out, the slot that timed out is put back to idle with the slots before it, because its acknowledge was not seen but it may still start. When a group power-off fails, every slot is put back to its active state, including a slot whose off request timed out and may still finish stopping, because genpd keeps the domain marked on after a failed power-off and would skip power_on at the next resume. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The fixed host ports on T8152 need only the USB2 part of the PHY. Add a driver that applies the bootloader-supplied calibration, handles host and device mode, and leaves the USB3 and USB4 lanes alone. Add the devicetree binding. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
A hub with the Apple ID 05ac:800f sits behind the front ports of the M6 Mac mini. Add that ID to the hub quirk table with HUB_QUIRK_DISABLE_AUTOSUSPEND so the kernel keeps it powered. The match is on the vendor and product ID alone. Every hub with this ID loses autosuspend, not only the one on this machine. The constant is named after the ID, USB_PRODUCT_APPLE_HUB_800F, because the ID is Apple's and the part behind it was not identified from the descriptor. This quirk was not measured on its own: it only keeps the hub awake. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Add a peripherals fragment to the M6 Mac mini board file: the always-on GPIO controller with the reset hog for the front-port USB hub, and the four PSD service slots for the USB ports. The NVMe controller, its mailbox and its address filter are not described here. The NVMe node needs a mailbox driver change that is not in this tree yet. The fragment holds only addresses, interrupt numbers and wiring. The boot loader adds the register tunables that some blocks need. The PMGR power domains are not described yet, so nodes that need them are left out. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Add the DART of the Apple M6 (T8152), a third-generation DART whose topology is fixed by the hardware. Its streams are described by static parameters instead of being probed, and it takes no MMIO access until the first use, because the block can be power gated behind the ATC USB domains. The binding requires a second register region (the TLB invalidate doorbell) for the T8152 compatible only. The change adds: - the apple,t8152-dart compatible and its hardware description; - static topology and "first use" initialisation of every DART; - the Gen3 TLB invalidate and the fault handler; - the reset path for DARTs that the boot loader leaves locked. A DART that the boot loader leaves locked is held powered for its lifetime. That applies to Gen3 hardware only. The other generations keep their behaviour. The first-use initialisation re-reads the parameters and fails if the page size differs from the one assumed at probe. It runs under a spinlock, and every function it calls is non-sleeping (register accesses and an atomic poll). Measured on an M6 Mac mini with the earlier form of this change: the display controller DART attaches locked on every boot. This version is rebased on current integration/aurora and was compile-checked only. The USB DART paths need the T8152 PSD power domains and were not run on their own. The doorbell store and the TLBI of the Gen3 invalidate are arm64 instructions: they are built only with CONFIG_ARM64, and other architectures (COMPILE_TEST) get a stub that returns -EOPNOTSUPP. A locked Gen3 DART no longer takes the range flush through TLB_CMD, which Gen3 does not accept; it uses the full-stream Gen3 callback. Gen3 does not take commands through TLB_CMD, so the unlock after a lock-on-error exception is not sent there: the DART logs once that this is not supported. The stale-exception drain of a reset does not read 0x704 on Gen3, like the fault handler. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Add the apple,t8152-dwc3 compatible to the Apple dwc3 glue. The ATC ports of the M6 (T8152) controller never switch roles through the Type-C controller. The glue starts the controller as a fixed host, with or without a hub child, or as a fixed peripheral when the node sets dr_mode = "peripheral". The T8152 profile is USB2 only: it needs maximum-speed = "high-speed", takes no reset line, and its USB3 PHY is optional. The calibration lists come from the device tree (apple,tunable-* properties that the boot loader fills in at runtime; the binding does not require them in the board file) and are applied to the register windows in a fixed order after the core is reset. The pipe handler is set up for the selected role. The apple,t8103-dwc3 paths keep their behaviour. The controller stays a syscore device while it runs, as before: no separate suspend or resume path is added for T8152. The earlier form of this change ran on an M6 Mac mini USB2 front port. This version is rebased on current integration/aurora and was compile-checked only. SuperSpeed does not train yet and is not part of this change. A fixed peripheral does not require the host-only calibration lists at probe, since it never applies them. The binding lists exactly four iommus entries, two stream IDs on each of two DARTs. If the T8152 USB2 PHY fails to initialise or power on during core start, the failure goes through the same shutdown as a failed core init, so the reset and syscore flags set earlier are cleared again. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Describe the power management blocks and the USB controllers of the Mac mini (M6, J873) next to the peripherals fragment: - the two PMGR blocks and their power domains, in t8152-j873-pmgr.dtsi; - for each of the four USB ports (usb0, usb1, usb2 and usb3 of the SoC): two DART instances, the USB2 PHY and the dwc3 controller. The register windows, interrupts and DART tunables are the values of the Apple device tree of the machine. The boot loader adds the apple,tunable-* lists of the USB2 PHY and the controller at runtime. The bindings list the apple,t8152-pmgr and apple,t8152-pmgr-pwrstate compatibles, and the dwc3 and USB2 PHY bindings take the tunable lists as optional, because the boot loader adds them. The fragment is a plain description of the hardware. The ports that the change describes run USB2 only: SuperSpeed and USB4 are not part of it. This commit compiles to a device tree blob with dtc without warnings. It was not booted. The bring-up it comes from enumerated the front-port USB2 hub and a USB disk at 480 Mb/s. The four PSD service slots get their PMGR domains (the aon and the port domain of their port) as parents, so genpd powers them before the slot request. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
|
GREEN at 12e1b4b The two commits above the #191 head are identical to the ones I cleared at Not checked: compile receipts, hardware. Merge still needs CI and the owner's word. |
The T8152 boot NOR controller is the same QSPIMC block as the T8140 one. Add apple,t8152-qspi as a more specific compatible that falls back to apple,t8140-qspi, so a T8152 device tree describes the controller without the driver needing a new match entry. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Describe the QSPIMC controller that serves the boot NOR of the Mac mini, with the nvram partition that the driver lets programs and erases through, and the sio -> spi_p -> qspi chain of power domains that it needs. The register address is the CPU physical address (the boot firmware lists it relative to /arm-io, which is mapped at 0x200000000). Power state at boot, read from the PMGR registers: sio (0x840) is on, spi_p (0xd40) and qspi (0x1140) are off. sio is marked always-on like the other domains of this board, so gating it cannot take down other peripherals. spi_p and qspi are not always-on: attaching the controller to its power domain powers the chain before the driver probes (the driver has no runtime PM call of its own). The nvram partition is [0x24000, 0xf4000). A read of the NOR through the controller at 0x24000 returns the boot variables from the first byte, and the last used byte of the store lies inside the 0xd0000 bytes of the window. The fallback compatible lets the driver program and erase inside this window, so the node limits what a write can reach. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
12e1b4b to
ecad670
Compare
|
New head |
|
GREEN at ecad670 Read: the commits of this head against my last GREEN head 2a35969, compared per commit as diffs with the hash lines removed. The two commits of this PR (spi qspi binding, boot NOR controller dts) are identical. The ten base commits are the #191 head 9fbb356, where I posted the delta review (PSD power-on rollback includes the failed slot, PSD power-off restores every slot, Gen3 DART drain and unlock changes). Not run: build; the author's compile and dt receipts are not reproduced. Merge still needs CI and a second non-author GREEN. |
|
GREEN at ecad670 The commits above the #191 head are identical to the ones I cleared at Not checked: compile receipts and hardware. Merge still needs CI and the owner's word. |
|
Status at head |
|
[Joshua's agent] This PR is awaiting maintainer review. Is anything else needed from us? |
Summary
Adds the boot NOR (QSPI) controller of the Apple M6 (T8152) Mac mini (J873): the binding accepts the T8152 compatible, and a new device tree fragment describes the controller, its NVRAM partition and its power chain. Two commits.
The first ten commits of this branch are #191 (the M6 base). Only the last two commits are new here: the diff of this PR shows the base too until #191 merges, then I rebase. Review the last two.
It is not needed for the release candidate, and there is no rush to review or merge it.
Commits
apple,t8152-qspi,apple,t8140-qspi; the driver needs no change, it keeps its NVRAM window through theapple,t8140-qspientryt8152-j873-qspi.dtsi:spi@331118000, thenvrampartition, theps_sio/ps_spi_p/ps_qspipower chain,ps_siomarked always-onMeasured, on an M6 Mac mini
nvrampartition ismtd0at 0x24000, size 0xd0000.ps_sioon,ps_spi_pandps_qspioff.ps_siois marked always-on in the fragment (it is on at boot); whether other devices sit behind it was not checked.Not measured
make dtbs_check/dt_binding_check(a hand-rundt-validateof the board file gave 0 messages).Compile receipt
arm64 clang,
W=1,integration/auroraat 42672ed plus the 12 commits of this branch: the eight objects of #191 andapple/t8152-j873g.dtball rc 0 with 0 warnings. A separatecpp+dtc -@build of the board file gave 0 warnings.check-commits: Signed-off-by on all 12 commits; no checkpatch errors (warnings: long lines, the MAINTAINERS notice).