Re: [PATCH v2 1/2] arm64: dts: mediatek: alias all enabled serial ports

From: Carlo Caione

Date: Mon Jul 27 2026 - 07:49:19 EST


On Mon Jul 27, 2026 at 1:30 PM CEST, AngeloGioacchino Del Regno wrote:
> On 7/27/26 09:38, Carlo Caione wrote:
>> On most MediaTek boards only serial0 is aliased, so the remaining
>> enabled uarts get first-free ttyS line numbers from the 8250 core in
>> probe order. When the console uart defers on its clocks another uart can
>> win line 0: console=ttyS0 then ends up on the wrong port and the boot
>> looks like a hang on the serial console, depending on probe order.
>>
>> Signed-off-by: Carlo Caione <ccaione@xxxxxxxxxxxx>
>> ---
>> arch/arm64/boot/dts/mediatek/mt6795-sony-xperia-m5.dts | 1 +
>> arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts | 1 +
>> arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts | 2 ++
>> arch/arm64/boot/dts/mediatek/mt7986a-rfb.dts | 2 ++
>> arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 1 +
>> arch/arm64/boot/dts/mediatek/mt8192-asurada-hayato-r1.dts | 4 ++++
>> arch/arm64/boot/dts/mediatek/mt8195-demo.dts | 1 +
>> arch/arm64/boot/dts/mediatek/mt8365-evk.dts | 2 ++
>> arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi | 2 ++
>> arch/arm64/boot/dts/mediatek/mt8390-grinn-genio-sbc.dtsi | 2 ++
>> arch/arm64/boot/dts/mediatek/mt8390-tungsten-smarc.dtsi | 2 ++
>> arch/arm64/boot/dts/mediatek/mt8395-genio-common.dtsi | 1 +
>> 12 files changed, 21 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/mediatek/mt6795-sony-xperia-m5.dts b/arch/arm64/boot/dts/mediatek/mt6795-sony-xperia-m5.dts
>> index 0e086dd487d9..63659e240b1d 100644
>> --- a/arch/arm64/boot/dts/mediatek/mt6795-sony-xperia-m5.dts
>> +++ b/arch/arm64/boot/dts/mediatek/mt6795-sony-xperia-m5.dts
>> @@ -20,6 +20,7 @@ aliases {
>> mmc2 = &mmc2;
>> serial0 = &uart0;
>> serial1 = &uart1;
>> + serial2 = &uart2;
>> };
>>
>> backlight_lcd0: backlight {
>> diff --git a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
>> index 8c3e2e2578bc..7bccad118d24 100644
>> --- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
>> +++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
>> @@ -20,6 +20,7 @@ / {
>>
>> aliases {
>> serial0 = &uart0;
>> + serial2 = &uart2;
>
> Why is that serial2 and not serial1 = &uart2?

To tie the alias number to the SoC uart index instead of to the set of
currently-enabled ports.

The problem is that uart1 exists on mt7622 but is disabled. With serial1
= &uart2, the day uart1 gets enabled the aliases have to be renumbered
and uart2 silently moves from ttyS1 to ttyS2 (or we have to again mix
serial and uart number).

Also in general it keeps ttyS<N> matching the schematics' UART<N>.

Ciao,

--
Carlo Caione