Repository navigation
clk: samsung: exynos-clkout: NFC clock pad on the Pixel 8 Pro (zuma) - #209
Conversation
|
How the ST54L is wired to the SoC, and which part is in which PR: #208 is the node with its bus, interrupt and enable pins (blue), #209 is the clock pad (orange). Both sit on top of #200, which turns on the bus. The boot results are in the comments below. They are from a test kernel on an older tree with equivalent changes, not from these exact branches. |
|
I booted the node enabled on my 8 Pro, and the ST54L answers. It's the same older 7.3-rc6 test kernel as before (not built from these branches, it has the changes of #208 and #209), this time with an overlay that turns the nfc node on. That is a screenshot taken on the phone itself (kernel, the chip name st54l, the driver nxp-nci_i2c, and nfc0 listed by the kernel). What I saw: the nxp-nci driver bound at i2c 2-0008 (name st54l) and registered nfc0, the interrupt (gpa7 line 6) is requested, and pmu-clkout0 shows enable count 1 with the chip as its consumer, so the clock from #209 shows enabled for this device while the driver is bound. The haptics device on the same bus is still there. Powering it on with nfctool took the enable pin high, nfctool reports Powered: Yes (as far as I can read nci_open_device, that only happens when the reset and init handshake with the chip completed), and dmesg has one line, "nci: nci_ntf_packet: unknown ntf opcode 0x107", which is a notification coming from the chip. No timeout and no "PLL didn't lock". An 8 second poll with no tag near started without errors, and powering off put the enable pin low again. What I haven't done: read a real tag (I need a card at the phone), read the pad register directly, bind without the clock to see that the pad is really needed, or try s2idle with the driver bound. The pad stays on for as long as the driver is bound, because the nxp-nci probe enables the clock once with devm_clk_get_optional_enabled and keeps it. I haven't measured what that costs in power. |
|
Update on the NFC test: it reads tags now. Same older 7.3-rc6 test kernel as before (not built from these branches, it carries the changes of #208 and #209) with the overlay that turns the node on, and I used neard 0.20 on top to look at tags. An NFC card held at the phone is detected (nfctool poll: Targets found). It is ISO 14443-A and ISO-DEP capable, and neard types it as Type 4 and starts the NDEF read. The probe found no NDEF records on it (0), so it carries no NDEF data. Screenshot from the phone's own terminal, probe run with the card held at it: An NFC sticker tag is detected too, and here the whole read worked: neard reports Type 2, protocol MIFARE, writable, with one NDEF record of kind URI. So the ST54L through nxp-nci and the kernel NFC core carries a full Type 2 read, and neard parses the NDEF on top. I only looked at the shape on purpose, the record contents and the tag IDs aren't in any file or in this post. Same run with the sticker tag held at the phone: Each run was power on, poll, then power off, and the neard runs also did a read. nfc0 went back to Powered: No each time, and the haptics device on the same bus stayed put. Nothing was written to either tag. While the driver is bound the clock from #209 stays enabled, I still haven't measured what that costs. Not done yet: binding without the clock to see that the pad is really needed, s2idle with the driver bound, and the eSE half of the chip. |
|
I tried it without the clock to see whether #209 is really needed, and it looks like it is. Same older 7.3-rc6 test kernel and overlay as my earlier comments (not built from these branches, but its clkout and nxp-nci files are the same as here), same sticker tag held by hand in about the same spot, same probe, one run each on two boots back to back: first with the clocks line removed from the nfc node, then with it put back. Without the clocks line the driver still binds, nfc0 appears and powering it on works (nfctool says Powered: Yes and the chip sends the same notification as before), but the pad clock stays at enable count 0 and the probe saw no tag in 25 seconds. This is the screenshot from the phone's own terminal: With the clocks line the same tag is found (the clock shows enable count 1): So on the 8 Pro the NCI power-on gets through without the pad, but tag discovery didn't in this run. What I can't say: whether the bootloader leaves the pad partly set up (I can't read register 0x3e84 from userspace), and the tag was held by hand both times. The probe only prints the tag type and the kind of record, never what's on it. |
|
Thank you, @Somnius. The no-clock control run is exactly the experiment that settles whether the pad is needed: same tag, same spot, one variable changed, and discovery only with the clock. I checked the driver side for every board it now binds on. Zuma uses the same pad path as the 9a, PMU regmap only, Before it goes in:
Optional: the Lovely work. NFC reading tags on the 8 Pro is a real milestone. |
… disabled An nfc@8 child of hsi2c_0 (the haptics' bus), status "disabled", so a normal boot is unchanged. The ST54L speaks plain NCI over I2C, so it takes the same compatible as the 9a and the zumapro-tegu node: st,st54l with nxp,nxp-nci-i2c as the fallback, for the nxp-nci driver. Pins are from the stock device tree: interrupt gpa7-6, enable (the chip's RST_N) gph1-6, power-idle gph1-3, with stock's two pin groups (power-down state only, no pin function). The enable line is the same pin the zumapro-tegu node uses. The stock node also has a PMU clock pad (CLKOUT1) as the reference clock. This commit has no clocks property, so the pad stays as the bootloader leaves it. The power-idle line has no nxp-nci property; only its pin group is kept. The eSE half of the chip is not described. I tried it on my Pixel 8 Pro: a test kernel (7.3-rc6, ...-ge98a7a38a3ef) with the node switched on by an overlay, and the pad clock from the follow-up patches either present or left out. nxp-nci binds the ST54L and registers nfc0 either way. Without the clock the NCI power-on works (the chip answers), but a sticker tag held at the phone was not found in one 25 s run. With the clock a bus card (ISO-DEP, no NDEF data on it) and the sticker tag (Type 2, one NDEF record) were both found, and neard published both as tags. The no-clock result is a single run, and I cannot read the PMU pad register from userspace, so I do not know whether the bootloader leaves the pad partly set up. The clock is in the follow-up patches. Not tested: the eSE, or s2idle with the driver bound. Signed-off-by: Lef <me@lefteros.com>
The Tensor G3 PMU (google,zuma-pmu) gets the same clock 0, the NFC controller's reference clock pad, that the Tensor G4 PMU has. Only the description of #clock-cells changes. Signed-off-by: Lef <me@lefteros.com>
The comment above the NFC clock pad register in the zuma PMU table says it is Tensor G4's. Stock's pmu_clk_pad is 0x3e84 on the Pixel 8 Pro too, so name both. Comment only, no change in the code. Signed-off-by: Lef <me@lefteros.com>
Tensor G3 (zuma) feeds the NFC controller's reference clock from the same PMU register as Tensor G4: stock's pmu_clk_pad is 0x3e84 on the Pixel 8 Pro too, and the zuma PMU's regmap already allows that register. Match google,zuma-pmu with the zumapro pad descriptor. The provider writes the register only when a consumer enables the clock. Tested on my Pixel 8 Pro: a test kernel (7.3-rc6, ...-ge98a7a38a3ef) with the NFC node switched on by an overlay. With the clock, the pad is held on while nxp-nci is bound (pmu-clkout0 enable count 1), and a bus card and a sticker tag were both found. A control boot with the same tag, the same spot and no clocks property on the node had enable count 0: the NCI power-on still worked, but no tag was found in a 25 s run. That no-clock result is a single run. I cannot read the pad register from userspace, so I do not know whether the bootloader leaves it partly set up. Not tested: s2idle with the driver bound. Signed-off-by: Lef <me@lefteros.com>
e40fe7a to
a8087e2
Compare
|
@derekross rebased onto today's
For later, noted: the stop-polling sleep hook in the husky package before the node is enabled by default, and the pad's power cost. |
|
@Somnius thank you, all three points are in, and I checked each one against the new head rather than the reply. The commit messages now say what your boots showed, with the single-run caveat and the register you can't read, which is exactly what the next reader needs. The Thanks for the blob ids too. I compared the tested tree with this head: Two small optional things for the same push:
This is still NFC reading tags on the 8 Pro, which is great to see. |
|
@derekross thank you. Both optional points are fair and I'll put them in with the next push: the husky DTS comment will say that on the 8 Pro the chip did answer without the pad and only found no tag, in one run, and the last commit message will say the 8a binds the clkout driver and writes nothing there since it has no NFC node. The boot is the one thing left, as you say. I need to refill slot B's retries first (it spent a boot today on a display test), so it will be the next time I have it on the cable with a flash window. I'll post the same checks as before: nxp-nci bound, nfc0, pmu-clkout0 at enable count 1 with the overlay, one tag read, and a plain boot without the overlay with the clkout driver bound and nothing enabled. Then I'll mark it ready. |
|
Thanks, @Somnius, no rush. The branch still merges cleanly onto today's |
Give the zuma PMU node its #clock-cells, and the Pixel 8 Pro's ST54L node clock 0, the PMU's NFC pad (stock: pmu_clk_pad 0x3e84), as on the zumapro-tegu node. The node stays disabled. The #clock-cells are in zuma.dtsi, so the clkout driver also binds on the Pixel 8a (zuma-akita). It writes nothing there: the 8a has no NFC node, so nothing enables the pad clock. Signed-off-by: Lef <me@lefteros.com>
a8087e2 to
e9c3fa3
Compare
|
@derekross I did the boot of this head, and I took both of your optional edits in the same push, so the head changed: it's now e9c3fa3 (was a8087e2). Only the last commit differs. Its message now says the 8a binds the clkout driver through the new The kernel is built from exactly e9c3fa3, Boot 1, with the nfc-test overlay (uptime 213 s): nxp_nci_i2c is bound to 2-0008 ( Boot 2, the same kernel without the overlay (uptime 205 s): no I put the phone back on my usual kernel afterwards and it came up fine. I haven't tried s2idle with the driver bound on this head, that's still the open point from my notes. I'll mark the PR ready now. |
|
Thank you, @Somnius. That's exactly the evidence I asked for, on exactly this head: the driver bound, I ran the full gate again on the branch merged onto today's I'm merging this (rebase, five commits) and closing #208, since its commit lands here. Two things for later, neither for this PR: s2idle with the clkout driver bound is still open, as you say, so please keep it on the list before NFC is turned on in the device package. And could the two boots go into the 8 Pro's notes in omarchy-mobile with the overlay you used, so the record isn't only in this thread? |






This lets the 8 Pro's NFC controller get its reference clock, so the disabled nfc@8 node for the ST54L (#208) can actually be tried. It's stacked on that PR and on #200, so until they merge the diff shows their commits too. The three commits that are this PR: the binding sentence, the clkout match, and the dts change (#clock-cells on the zuma PMU and the clocks line in the husky NFC node). The clkout commit also updates a comment on that register in gs101-pmu.c.
The comment in clk-exynos-clkout.c (it came with @W4HO-ham's 9a work) says the 9a's ST54L doesn't ACK its I2C address without the PMU's NFC pad, register 0x3e84. The stock device tree for the 8 Pro has the same pmu_clk_pad = <0x3e84>, and the zuma PMU regmap already allows that register (88061f5). So this adds "google,zuma-pmu" to the match table with the same pad descriptor, gives the zuma PMU node #clock-cells = <1> (and the binding line for it), and puts clocks = <&pmu_system_controller 0> on the node, like the zumapro-tegu one.
The node stays disabled. The clkout driver does bind on husky now (it was failing with "cannot match parent device" before, which is the pair of exynos-clkout error lines in the boot log), but the pad register is only written when a consumer enables the clock, so nothing should be written at boot.
Tested: compiled clk-exynos-clkout.c with W=1 (no warnings), built the husky dtb and checked that nfc@8 has the clocks line and is disabled. I also booted a test kernel on my 8 Pro. It wasn't built from this branch: it's my older 7.3-rc6 tree with equivalent changes. Results: before, on my previous kernel without these changes, the boot log had "exynos-clkout exynos-clkout: cannot match parent device" and "probe with driver exynos-clkout failed with error -22"; now those two lines are gone, the driver is bound, and clk_summary lists pmu-clkout0 with nothing enabled. No new errors, and the phone stayed up for the few minutes I watched it. I haven't enabled the NFC node, so I haven't seen the pad register written, and I haven't run dt_binding_check. I don't know that the register and the EXTPAD_EN bit do the same thing on the G3 as on the G4, that's what the first boot with the node enabled by an overlay will show, and I'll report here.