Repository navigation
serial: apple-dockchannel: channel index from the DT, software RX drain - #407
Merged
RyanTheTide merged 4 commits intoOct 23, 2026
Merged
Conversation
A DockChannel block carries several channels that share one interrupt window: channel n owns bits 2n (TX) and 2n + 1 (RX) of its mask and flag registers. The binding has no way to say which channel a node is, so the driver can only drive channel 0. Add an optional apple,channel index, defaulting to 0 so existing device trees keep their meaning. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org> (cherry picked from commit d4ea491f6274200e79ff7412800dac9b9743b7c8)
The driver hard-codes the TX and RX interrupt bits of channel 0. On the M4 Pro the debug UART is channel 1, whose bits are 2 and 3, so the port transmits but never sees an RX interrupt. Read apple,channel and derive the channel's interrupt bits from it. The interrupt window is shared by all channels of the block, so update the mask with a read-modify-write of this channel's bits only, clear only this channel's flags at probe, and ignore flags that belong to other channels in the handler. Without the property the driver behaves as before. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org> (cherry picked from commit 20339c0e1bf0311f3c59e93a13615888be5d329d)
Some DockChannel channels never raise an interrupt when data arrives. Apple's device tree marks them with enable-sw-drain, and macOS drains their RX FIFO in software. On the M4 Pro (T6040) this is the DebugUSB console channel: its RX flag latches, but no AIC line follows it with any IRQ block or mask word. Add a boolean that mirrors that property. A channel that has it does not need an interrupt. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…channels A channel marked apple,sw-drain does not interrupt on RX. Move the FIFO drain into a helper, and on such channels run it from a 10 ms timer between startup and shutdown instead of requesting and enabling the interrupt. 10 ms is about 115 bytes at 115200 baud, far below the FIFO size. Channels without the property keep the interrupt path. Tested on a J616s (T6040): the DebugUSB console channel (index 2) takes typed input over KIS with the property set, and none without it. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DockChannel UART: channel index from the DT, and software RX drain for channels that never interrupt.
The M4 Pro (T6040, J616s) DebugUSB console is DockChannel FIFO pair 2A. Two problems kept its RX on a local polling hack.
Tested on Ryan's J616s: native tether boot of integration/aurora + #403 + this branch + a local tether DT that sets apple,channel = <2> and apple,sw-drain. The KIS shell takes typed input and no dcuart interrupt is requested. With apple,channel = <2> and no sw-drain, input is dead, as expected. m4test on that boot is 14 pass, 0 fail, 1 skip (gpu). dt_binding_check passes for the binding. The driver was built with the shipping universal recipe in the combined tree.
No board DT in this tree describes the J616s KIS console yet (it is in the local tether DT only), so nothing else changes behaviour.
🤖 Generated with Claude Code