[PATCH 10/19] thunderbolt: Make the ring register layout configurable
Sven Peter
sven at kernel.org
Tue Sep 1 11:56:29 PDT 2026
Hi,
On 9/1/26 10:58, Mika Westerberg wrote:
> Hi,
>
> On Sun, Aug 30, 2026 at 10:19:28PM +0200, Sven Peter wrote:
>> The ring descriptor and options registers are laid out differently on
>> the Apple NHI. Describe their offsets and strides with a
>> tb_nhi_ring_layout struct that NHI drivers can override.
> This is odd because Apple is sitting in USB-IF and they are behind the
> original register layout so why they do not follow it themselves?
My guess is as good as yours but knowing Apple's culture it's probably
separate teams not being allowed to talk to each other...
>
>> Signed-off-by: Sven Peter <sven at kernel.org>
>> ---
>> drivers/thunderbolt/nhi.c | 30 ++++++++++++++++++++++++------
>> drivers/thunderbolt/nhi.h | 18 ++++++++++++++++++
>> include/linux/thunderbolt.h | 3 +++
>> 3 files changed, 45 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
>> index fc54ff7edfb9..3a3d334e69fd 100644
>> --- a/drivers/thunderbolt/nhi.c
>> +++ b/drivers/thunderbolt/nhi.c
>> @@ -176,19 +176,32 @@ void nhi_disable_interrupts(struct tb_nhi *nhi)
>>
>> /* ring helper methods */
>>
>> +static const struct tb_nhi_ring_layout nhi_default_ring_layout = {
>> + .tx_desc_base = REG_TX_RING_BASE,
>> + .rx_desc_base = REG_RX_RING_BASE,
>> + .desc_stride = 16,
>> + .tx_options_base = REG_TX_OPTIONS_BASE,
>> + .rx_options_base = REG_RX_OPTIONS_BASE,
>> + .options_stride = 32,
>> +};
> I'm not fan of these to be honest.
>
> I think either adding ring_ops that includes hooks that can be overridden
> by non-standard HI or not sure if we can take advantage of regmap here?
Sure! I don't think regmap buys us anything but I think I can get away
with just adding nhi_ring_desc_base() and nhi_ring_options_base() to the
ops.
Sven
More information about the linux-arm-kernel
mailing list