Skip to content

serial: apple-dockchannel: channel index from the DT, software RX drain - #407

Merged
RyanTheTide merged 4 commits into
integration/aurorafrom
j616s/dockchannel-swdrain-20261024
Oct 23, 2026
Merged

RyanTheTide merged 4 commits into
integration/aurorafrom
j616s/dockchannel-swdrain-20261024

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

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.

  • Index. Measured by toggling each FIFO's RX threshold: pair 1A is IRQ index 0 (RX flag bit 1), 1B is index 1 (bit 3), 2A is index 2 (bit 5). The first two commits let the DT name the index (apple,channel). They were written earlier for the tether work and are carried here unchanged.
  • No RX interrupt. With every IRQ block and mask word opened, no AIC line follows any channel's RX flag. The ADT marks the UART enable-sw-drain = 1: macOS drains it in software. The new apple,sw-drain property mirrors that. A channel with it is drained from a 10 ms timer and needs no interrupt. Channels without it keep the IRQ path unchanged.

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

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>
@RyanTheTide
RyanTheTide merged commit 6af6603 into integration/aurora Oct 23, 2026
@RyanTheTide
RyanTheTide deleted the j616s/dockchannel-swdrain-20261024 branch October 23, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant