[PATCH v2 3/3] tegra: allow to expose UART on microSD slot

Artur Kowalski arturkow2000 at gmail.com
Tue Apr 22 17:37:49 CEST 2025


W dniu 01.04.2025 o 15:48, Svyatoslav Ryhel pisze:

> вт, 1 квіт. 2025 р. о 16:34 Artur Kowalski <arturkow2000 at gmail.com> пише:
>>
>> W dniu 31.03.2025 o 07:51, Svyatoslav Ryhel pisze:
>>> нд, 30 бер. 2025 р. о 22:27 Artur Kowalski <arturkow2000 at gmail.com> пише:
>>>> Tegra20 has mux allowing to repurpose microSD as UART on boards which
>>>> use sdmmc3 controller for microSD. Add TEGRA_UARTA_MICROSD to enable
>>>> this feature. It is currently supported on Transformer T20, support for
>>>> other boards may require Device Tree changes.
>>>>
>>>> Update Transformer T20 DTS to select correct pinmux and stdout-path
>>>> based on TEGRA_UARTA_MICROSD.
>>>>
>>>> Signed-off-by: Artur Kowalski <arturkow2000 at gmail.com>
>>>> ---
>>>>
>>>> Changes in v2:
>>>> - added TEGRA_UARTA_MICROSD Kconfig option
>>>> - removed .dtsi for enabling UART over microSD
>>>> - modified transformer DT to use UARTA and correct pinmux when
>>>>     TEGRA_UARTA_MICROSD is enabled; it is enough to flip a single
>>>>     switch to enable/disable UART over microSD
>>>>
>>>>    arch/arm/dts/tegra20-asus-transformer.dtsi | 24 ++++++++++++++++++++++
>>>>    arch/arm/mach-tegra/tegra20/Kconfig        | 15 ++++++++++++++
>>>>    2 files changed, 39 insertions(+)
>>>>
>>>> diff --git a/arch/arm/dts/tegra20-asus-transformer.dtsi b/arch/arm/dts/tegra20-asus-transformer.dtsi
>>>> index 49efabbfd92..9ea323c81f3 100644
>>>> --- a/arch/arm/dts/tegra20-asus-transformer.dtsi
>>>> +++ b/arch/arm/dts/tegra20-asus-transformer.dtsi
>>>> @@ -5,7 +5,13 @@
>>>>
>>>>    / {
>>>>           chosen {
>>>> +#if CONFIG_IS_ENABLED(TEGRA_ENABLE_UARTA)
>>>> +               stdout-path = &uarta;
>>>> +#elif CONFIG_IS_ENABLED(TEGRA_ENABLE_UARTD)
>>>>                   stdout-path = &uartd;
>>>> +#else
>>>> +#error Unsupported UART
>>>> +#endif
>>>>           };
>>>>
>>>>           aliases {
>>>> @@ -195,10 +201,17 @@
>>>>                                   nvidia,function = "i2c1";
>>>>                           };
>>>>
>>>> +#if CONFIG_IS_ENABLED(TEGRA_UARTA_SDB_SDD)
>>>> +                       dbguart {
>>>> +                               nvidia,pins = "sdb", "sdd";
>>>> +                               nvidia,function = "uarta";
>>>> +                       };
>>>> +#else
>>>>                           sdb {
>>>>                                   nvidia,pins = "sdb", "sdc", "sdd", "slxc", "slxk";
>>>>                                   nvidia,function = "sdio3";
>>>>                           };
>>>> +#endif
>>>>
>>>>                           sdio1 {
>>>>                                   nvidia,pins = "sdio1";
>>>> @@ -376,7 +389,13 @@
>>>>                   };
>>>>           };
>>>>
>>>> +#if CONFIG_IS_ENABLED(TEGRA_ENABLE_UARTA)
>>>> +       uarta: serial at 70006000 {
>>>> +#elif CONFIG_IS_ENABLED(TEGRA_ENABLE_UARTD)
>>>>           uartd: serial at 70006300 {
>>>> +#else
>>>> +#error Unsupported UART
>>>> +#endif
>>>>                   status = "okay";
>>>>                   clock-frequency = <216000000>;
>>>>           };
>>>> @@ -434,7 +453,12 @@
>>>>           };
>>>>
>>>>           sdmmc3: sdhci at c8000400 {
>>>> +#if CONFIG_IS_ENABLED(TEGRA_UARTA_MICROSD)
>>>> +               /* Can't use both at the same time */
>>>> +               status = "disabled";
>>>> +#else
>>>>                   status = "okay";
>>>> +#endif
>>>>                   bus-width = <4>;
>>>>
>>>>                   cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
>>>> diff --git a/arch/arm/mach-tegra/tegra20/Kconfig b/arch/arm/mach-tegra/tegra20/Kconfig
>>>> index 3349f1e2786..c2c51660216 100644
>>>> --- a/arch/arm/mach-tegra/tegra20/Kconfig
>>>> +++ b/arch/arm/mach-tegra/tegra20/Kconfig
>>>> @@ -77,6 +77,21 @@ endchoice
>>>>    config SYS_SOC
>>>>           default "tegra20"
>>>>
>>>> +config TEGRA_UARTA_MICROSD
>>>> +       bool "UARTA on MicroSD breakout board"
>>>> +       default n
>>>> +       depends on TEGRA_ENABLE_UARTA && TARGET_TRANSFORMER_T20
>>>> +       select TEGRA_UARTA_SDB_SDD
>>>> +       help
>>>> +         Repurpose the SD card slot for getting access to the UARTA serial
>>>> +         console. Primarily useful only for low level u-boot debugging on
>>>> +         tablets, where normal UARTD is difficult to access and requires
>>>> +         device disassembly and/or soldering. Enabling this option causes
>>>> +         UARTA TX to become exposed on SDD and RX on SDB pins which correspond
>>>> +         to microSD CLK and CMD pins respectively. Currently this is supported
>>>> +         only on Transformer T20, support for other platforms may require DT
>>>> +         and configs (from include/configs/*) updates.
>>>> +
>>>>    source "board/nvidia/harmony/Kconfig"
>>>>    source "board/avionic-design/medcom-wide/Kconfig"
>>>>    source "board/compal/paz00/Kconfig"
>>>> --
>>>> 2.48.1
>>>>
>>> This is not applicable since this is a hack by nature, BUT if you
>>> contain this in the transformer t20 board and Kconfig (no dts
>>> changes), this may be applied.
>> Ok, then I'll drop DTS changes. I will add few words about this option
>> in Transformer documentation
>> and a note in Kconfig help to not surprise users with not booting U-Boot
>> as enabling this option without
>> changing DTS causes U-Boot to hang.
> You should remove then Kconfig option as well. Add a new chapter to
> Transformer T20 documentation which describes this method, here[1] you
> may find a similar approach but info is in the commit message of
> tegra30 uart-e funcmux. Additionally, as I have said previously, these
> changes can be contained in the transformer t20 board file by using
> some device tree manipulations from there.

Currently I'm working on few other things both in U-Boot in OS, some of 
patches probably I will send to upstream
in the coming weeks, but eventually, I will come back to this.

> ---
> 1 https://source.denx.de/u-boot/u-boot/-/commit/b515d7ae0de51a26f73b2ddb5ea4db0d95b67d7a


More information about the U-Boot mailing list