W dniu 31.03.2025 o 07:51, Svyatoslav Ryhel pisze:
нд, 30 бер. 2025 р. о 22:27 Artur Kowalski <arturkow2...@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 <arturkow2...@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@70006000 {
+#elif CONFIG_IS_ENABLED(TEGRA_ENABLE_UARTD)
         uartd: serial@70006300 {
+#else
+#error Unsupported UART
+#endif
                 status = "okay";
                 clock-frequency = <216000000>;
         };
@@ -434,7 +453,12 @@
         };

         sdmmc3: sdhci@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.

Reply via email to