Skip to contentSkip to conversation

Bring support for Xiaomi Mi Pad 1 (Tegra K1)

PATCH New Svyatoslav Ryhel 1 participant 8 messages Feb 26, 2025

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v2 cover Bring support for Xiaomi Mi Pad 1 (Tegra K1)

This patch set brings support for Xiaomi Mi Pad 1 based on Tegra K1 SoC as original vendor bootloader substitution. All major features are implemented.

---
Changes in v2:
- reconfigured panel driver to act as cascaded panels not as independant
- resolved panel flickering
- resolved self-upgrade test
---

Svyatoslav Ryhel (7):
pinctrl: tegra: add Tegra K1 support
video: tegra20: dc: dsi: add Tegra K1 compatible
video: tegra20: mipi: add Tegra K1 support
video: add TI LP855x backlight driver
video: panel: add Sharp LQ079L1SX01 MIPI DSI panel driver
ARM: tegra124: implement BCT patching
board: xiaomi: mocha: add Xiaomi Mi Pad A0101 support

 arch/arm/dts/Makefile                       |   1 +
 arch/arm/dts/tegra124-xiaomi-mocha.dts      | 603 ++++++++++++++++++++
 arch/arm/include/asm/arch-tegra124/pinmux.h |   4 +
 arch/arm/mach-tegra/Kconfig                 |   2 +-
 arch/arm/mach-tegra/tegra124/Kconfig        |   5 +
 arch/arm/mach-tegra/tegra124/Makefile       |   1 +
 arch/arm/mach-tegra/tegra124/bct.c          |  91 +++
 arch/arm/mach-tegra/tegra124/bct.h          |  55 ++
 board/xiaomi/mocha/Kconfig                  |  12 +
 board/xiaomi/mocha/MAINTAINERS              |   8 +
 board/xiaomi/mocha/Makefile                 |   9 +
 board/xiaomi/mocha/mocha-spl.c              |  49 ++
 board/xiaomi/mocha/mocha.c                  |  41 ++
 board/xiaomi/mocha/mocha.env                |  23 +
 configs/mocha_defconfig                     |  90 +++
 doc/board/index.rst                         |   1 +
 doc/board/xiaomi/index.rst                  |   9 +
 doc/board/xiaomi/mocha.rst                  | 112 ++++
 drivers/pinctrl/tegra/pinctrl-tegra.c       |  56 ++
 drivers/video/Kconfig                       |  19 +
 drivers/video/Makefile                      |   2 +
 drivers/video/lp855x_backlight.c            | 302 ++++++++++
 drivers/video/sharp-lq079l1sx01.c           | 288 ++++++++++
 drivers/video/tegra20/tegra-dc.c            |   3 +
 drivers/video/tegra20/tegra-dsi.c           |  12 +-
 drivers/video/tegra20/tegra-mipi.c          | 134 ++++-
 include/configs/mocha.h                     |  25 +
 27 files changed, 1941 insertions(+), 16 deletions(-)
 create mode 100644 arch/arm/dts/tegra124-xiaomi-mocha.dts
 create mode 100644 arch/arm/mach-tegra/tegra124/bct.c
 create mode 100644 arch/arm/mach-tegra/tegra124/bct.h
 create mode 100644 board/xiaomi/mocha/Kconfig
 create mode 100644 board/xiaomi/mocha/MAINTAINERS
 create mode 100644 board/xiaomi/mocha/Makefile
 create mode 100644 board/xiaomi/mocha/mocha-spl.c
 create mode 100644 board/xiaomi/mocha/mocha.c
 create mode 100644 board/xiaomi/mocha/mocha.env
 create mode 100644 configs/mocha_defconfig
 create mode 100644 doc/board/xiaomi/index.rst
 create mode 100644 doc/board/xiaomi/mocha.rst
 create mode 100644 drivers/video/lp855x_backlight.c
 create mode 100644 drivers/video/sharp-lq079l1sx01.c
 create mode 100644 include/configs/mocha.h
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/7 pinctrl: tegra: add Tegra K1 support

Tegra 124 is fully compatible with existing Tegra pincontrol driver, but it needs a specific MIPI PAD control pinconfig.

---
 arch/arm/include/asm/arch-tegra124/pinmux.h |  4 ++
 drivers/pinctrl/tegra/pinctrl-tegra.c       | 56 +++++++++++++++++++++
 2 files changed, 60 insertions(+)
arch/arm/include/asm/arch-tegra124/pinmux.h +4 -0
index 3aba17d21e4..fbe15fc612d 100644
@@ -578,6 +578,10 @@ static const char * const tegra_pinctrl_to_drvgrp[] = {
 	[PMUX_DRVGRP_AO4] = "ao4",
 };
 
+static const char * const tegra_pinctrl_to_mipipadgrp[] = {
+	[PMUX_MIPIPADCTRLGRP_DSI_B] = "mipi_pad_ctrl_dsi_b",
+};
+
 static const char * const tegra_pinctrl_to_func[] = {
 	[PMUX_FUNC_DEFAULT] = "default",
 	[PMUX_FUNC_BLINK] = "blink",
drivers/pinctrl/tegra/pinctrl-tegra.c +56 -0

74 lines not on this page · raw message

Signature · 1 line
2.43.0
#2 lore raw

PATCH v2 2/7 video: tegra20: dc: dsi: add Tegra K1 compatible

In reply to Svyatoslav Ryhel

Tegra K1 is fully compatible with existing DC and DSI implementation using Tegra 4 data.

---
 drivers/video/tegra20/tegra-dc.c  | 3 +++
 drivers/video/tegra20/tegra-dsi.c | 1 +
 2 files changed, 4 insertions(+)
drivers/video/tegra20/tegra-dc.c +3 -0
index e366df9ab51..16a2b5281bf 100644
@@ -553,6 +553,9 @@ static const struct udevice_id tegra_lcd_ids[] = {
 	}, {
 		.compatible = "nvidia,tegra114-dc",
 		.data = (ulong)&tegra114_dc_soc_info
+	}, {
+		.compatible = "nvidia,tegra124-dc",
+		.data = (ulong)&tegra114_dc_soc_info
 	}, {
 		/* sentinel */
 	}
drivers/video/tegra20/tegra-dsi.c +1 -0
index 079b00e0f61..25cd4db0061 100644
@@ -1118,6 +1118,7 @@ static const struct panel_ops tegra_dsi_bridge_ops = {
 static const struct udevice_id tegra_dsi_bridge_ids[] = {
 	{ .compatible = "nvidia,tegra30-dsi", .data = DSI_V0 },
 	{ .compatible = "nvidia,tegra114-dsi", .data = DSI_V1 },
+	{ .compatible = "nvidia,tegra124-dsi", .data = DSI_V1 },
 	{ }
 };
 
Signature · 1 line
2.43.0
#3 lore raw

PATCH v2 3/7 video: tegra20: mipi: add Tegra K1 support

In reply to Svyatoslav Ryhel

Re-design MIPI calibration driver to fit T124.

---
 drivers/video/tegra20/tegra-dsi.c  |  11 ++-
 drivers/video/tegra20/tegra-mipi.c | 134 ++++++++++++++++++++++++++---
 2 files changed, 130 insertions(+), 15 deletions(-)
drivers/video/tegra20/tegra-dsi.c +10 -1
index 25cd4db0061..9f39ac7589b 100644
@@ -53,6 +53,7 @@ struct tegra_dsi_priv {
 	int video_fifo_depth;
 	int host_fifo_depth;
 
+	u32 calibration_pads;
 	u32 version;
 
 	/* for ganged-mode support */
@@ -549,7 +550,7 @@ static void tegra_dsi_mipi_calibrate(struct udevice *dev)
 		DSI_PAD_PREEMP_PD(0x03) | DSI_PAD_PREEMP_PU(0x3);
 	writel(value, &pad->pad_ctrl_3);
 
-	ret = misc_write(priv->mipi, 0, NULL, 0);
+	ret = misc_write(priv->mipi, priv->calibration_pads, NULL, 0);
 	if (ret)
 		log_debug("%s: MIPI calibration failed %d\n", __func__, ret);
 
@@ -1078,6 +1079,14 @@ static int tegra_dsi_bridge_probe(struct udevice *dev)
 			log_debug("%s: cannot get MIPI: error %d\n", __func__, ret);
 			return ret;
 		}
+
+		ret = dev_read_u32_index(dev, "nvidia,mipi-calibrate", 1,
+					 &priv->calibration_pads);
+		if (ret) {
+			log_debug("%s: cannot get calibration pads: error %d\n",
+				  __func__, ret);
+			return ret;
+		}
 	}
 
 	panel_get_display_timing(priv->panel, &priv->timing);
drivers/video/tegra20/tegra-mipi.c +120 -14

188 lines not on this page · raw message

Signature · 1 line
2.43.0
#4 lore raw

PATCH v2 4/7 video: add TI LP855x backlight driver

In reply to Svyatoslav Ryhel

Add support for National Semiconductor/TI LP8550/1/2/3/5/6/7 LED Backlight. Driver is based on Linux version but is reworked and optimised for U-Boot DM framework. Currently only register driven backlight control is supported, PWM driver backlight control may be added later if needed.

---
 drivers/video/Kconfig            |  10 +
 drivers/video/Makefile           |   1 +
 drivers/video/lp855x_backlight.c | 302 +++++++++++++++++++++++++++++++
 3 files changed, 313 insertions(+)
 create mode 100644 drivers/video/lp855x_backlight.c
drivers/video/Kconfig +10 -0
index 3c3cebaacd0..926dafe7a5a 100644
@@ -743,6 +743,16 @@ config BACKLIGHT_LM3533
 	  LM3533 Lighting Power chip. Only Bank A is supported as for now.
 	  Supported backlight level range is from 2 to 255 with step of 1.
 
+config BACKLIGHT_LP855x
+	bool "Backlight Driver for LP855x"
+	depends on BACKLIGHT
+	select DM_I2C
+	help
+	  Say Y to enable the backlight driver for National Semiconductor / TI
+	  LP8550/1/2/3/5/6/7 LED Backlight Driver. Only register driven mode is
+	  supported for now, PWM mode can be added if there will be any need in
+	  it. Supported backlight level range is from 0 to 255 with step of 1.
+
 source "drivers/video/ti/Kconfig"
 
 source "drivers/video/exynos/Kconfig"
drivers/video/Makefile +1 -0
index 5a00438ce06..391ef8397bc 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_$(PHASE_)BMP) += bmp.o
 endif
 
 obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_backlight.o
+obj-$(CONFIG_BACKLIGHT_LP855x) += lp855x_backlight.o
 obj-${CONFIG_EXYNOS_FB} += exynos/
 obj-${CONFIG_VIDEO_ROCKCHIP} += rockchip/
 obj-${CONFIG_VIDEO_STM32} += stm32/
drivers/video/lp855x_backlight.c new file +302 -0

302 lines not on this page · raw message

Signature · 1 line
2.43.0
#5 lore raw

PATCH v2 5/7 video: panel: add Sharp LQ079L1SX01 MIPI DSI panel driver

In reply to Svyatoslav Ryhel

This module is a color active matrix LCD module incorporating Oxide TFT (Thin Film Transistor). It is composed of a color TFT-LCD panel, driver ICs, a control circuit and power supply circuit, and a backlight unit. Graphics and texts can be displayed on a 1536x2048 dots panel with (16,777,216) colors by using MIPI DUAL DSI interface, supplying +3.3V DC supply voltage for TFT-LCD panel driving and supplying DC supply voltage for LED Backlight.

---
 drivers/video/Kconfig             |   9 +
 drivers/video/Makefile            |   1 +
 drivers/video/sharp-lq079l1sx01.c | 288 ++++++++++++++++++++++++++++++
 3 files changed, 298 insertions(+)
 create mode 100644 drivers/video/sharp-lq079l1sx01.c
drivers/video/Kconfig +9 -0
index 926dafe7a5a..b1ef73f3e5c 100644
@@ -599,6 +599,15 @@ config VIDEO_LCD_SAMSUNG_LTL106HL02
 	  LCD module found in Microsoft Surface 2. The panel has a FullHD
 	  resolution (1920x1080).
 
+config VIDEO_LCD_SHARP_LQ079L1SX01
+	tristate "Sharp LQ079L1SX01 1536x2048 DSI video mode panel"
+	depends on PANEL && BACKLIGHT
+	select VIDEO_MIPI_DSI
+	help
+	  Say Y here if you want to enable support for Sharp LQ079L1SX01
+	  LCD module found in Xiaomi Mi Pad tablet. The panel has a QXGA
+	  resolution (1536x2048).
+
 config VIDEO_LCD_SHARP_LQ101R1SX01
 	tristate "Sharp LQ101R1SX01 2560x1600 DSI video mode panel"
 	depends on PANEL && BACKLIGHT
drivers/video/Makefile +1 -0
index 391ef8397bc..6073bc5234a 100644
@@ -65,6 +65,7 @@ obj-$(CONFIG_VIDEO_LCD_RAYDIUM_RM68200) += raydium-rm68200.o
 obj-$(CONFIG_VIDEO_LCD_RENESAS_R61307) += renesas-r61307.o
 obj-$(CONFIG_VIDEO_LCD_RENESAS_R69328) += renesas-r69328.o
 obj-$(CONFIG_VIDEO_LCD_SAMSUNG_LTL106HL02) += samsung-ltl106hl02.o
+obj-$(CONFIG_VIDEO_LCD_SHARP_LQ079L1SX01) += sharp-lq079l1sx01.o
 obj-$(CONFIG_VIDEO_LCD_SHARP_LQ101R1SX01) += sharp-lq101r1sx01.o
 obj-$(CONFIG_VIDEO_LCD_SSD2828) += ssd2828.o
 obj-$(CONFIG_VIDEO_LCD_TDO_TL070WSH30) += tdo-tl070wsh30.o
drivers/video/sharp-lq079l1sx01.c new file +288 -0

288 lines not on this page · raw message

Signature · 1 line
2.43.0
#6 lore raw

PATCH v2 6/7 ARM: tegra124: implement BCT patching

In reply to Svyatoslav Ryhel

This function allows updating bootloader from u-boot on production devices without need in host PC.

Be aware! It works only with re-crypt BCT and AES
encrypted devices.

---
 arch/arm/mach-tegra/Kconfig           |  2 +-
 arch/arm/mach-tegra/tegra124/Makefile |  1 +
 arch/arm/mach-tegra/tegra124/bct.c    | 91 +++++++++++++++++++++++++++
 arch/arm/mach-tegra/tegra124/bct.h    | 55 ++++++++++++++++
 4 files changed, 148 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-tegra/tegra124/bct.c
 create mode 100644 arch/arm/mach-tegra/tegra124/bct.h
arch/arm/mach-tegra/Kconfig +1 -1
index 78b89729f19..4690dcb3ea6 100644
@@ -247,7 +247,7 @@ config CMD_ENTERRCM
 
 config CMD_EBTUPDATE
 	bool "Enable 'ebtupdate' command"
-	depends on TEGRA20 || TEGRA30
+	depends on TEGRA20 || TEGRA30 || TEGRA124
 	select TEGRA_CRYPTO
 	help
 	  Updating u-boot from within u-boot in rather complex or even
arch/arm/mach-tegra/tegra124/Makefile +1 -0
index dee790015a3..7b93db89c0f 100644
@@ -6,6 +6,7 @@
 #
 
 obj-$(CONFIG_XPL_BUILD) += cpu.o
+obj-$(CONFIG_$(XPL_)CMD_EBTUPDATE) += bct.o
 
 obj-y	+= clock.o
 obj-y	+= pmc.o
arch/arm/mach-tegra/tegra124/bct.c new file +91 -0

91 lines not on this page · raw message

arch/arm/mach-tegra/tegra124/bct.h new file +55 -0

55 lines not on this page · raw message

Signature · 1 line
2.43.0
#7 lore raw

PATCH v2 7/7 board: xiaomi: mocha: add Xiaomi Mi Pad A0101 support

In reply to Svyatoslav Ryhel

The Mi Pad is a tablet computer based on Nvidia Tegra K1 SoC which originally ran the Android operating system. The Mi Pad has a 7.9" IPS display with 1536 x 2048 (324 ppi) resolution. 2 GB of RAM and 16/64 GB of internal memory that can be supplemented with a microSDXC card giving up to 128 GB of additional storage.

---
 arch/arm/dts/Makefile                  |   1 +
 arch/arm/dts/tegra124-xiaomi-mocha.dts | 603 +++++++++++++++++++++++++
 arch/arm/mach-tegra/tegra124/Kconfig   |   5 +
 board/xiaomi/mocha/Kconfig             |  12 +
 board/xiaomi/mocha/MAINTAINERS         |   8 +
 board/xiaomi/mocha/Makefile            |   9 +
 board/xiaomi/mocha/mocha-spl.c         |  49 ++
 board/xiaomi/mocha/mocha.c             |  41 ++
 board/xiaomi/mocha/mocha.env           |  23 +
 configs/mocha_defconfig                |  90 ++++
 doc/board/index.rst                    |   1 +
 doc/board/xiaomi/index.rst             |   9 +
 doc/board/xiaomi/mocha.rst             | 112 +++++
 include/configs/mocha.h                |  25 +
 14 files changed, 988 insertions(+)
 create mode 100644 arch/arm/dts/tegra124-xiaomi-mocha.dts
 create mode 100644 board/xiaomi/mocha/Kconfig
 create mode 100644 board/xiaomi/mocha/MAINTAINERS
 create mode 100644 board/xiaomi/mocha/Makefile
 create mode 100644 board/xiaomi/mocha/mocha-spl.c
 create mode 100644 board/xiaomi/mocha/mocha.c
 create mode 100644 board/xiaomi/mocha/mocha.env
 create mode 100644 configs/mocha_defconfig
 create mode 100644 doc/board/xiaomi/index.rst
 create mode 100644 doc/board/xiaomi/mocha.rst
 create mode 100644 include/configs/mocha.h
arch/arm/dts/Makefile +1 -0
index 267b0179a5f..6096781cc44 100644
@@ -121,6 +121,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += \
 	tegra124-nyan-big.dtb \
 	tegra124-cei-tk1-som.dtb \
 	tegra124-venice2.dtb \
+	tegra124-xiaomi-mocha.dtb \
 	tegra186-p2771-0000-000.dtb \
 	tegra186-p2771-0000-500.dtb \
 	tegra210-p2371-0000.dtb \
arch/arm/dts/tegra124-xiaomi-mocha.dts new file +603 -0

603 lines not on this page · raw message

arch/arm/mach-tegra/tegra124/Kconfig +5 -0
index 84c8f86bad0..a62b055f7e6 100644
@@ -30,6 +30,10 @@ config TARGET_CEI_TK1_SOM
 	  the SoC are assigned to which functions, and the PCIEe
 	  configuration.
 
+config TARGET_MOCHA
+	bool "Xiaomi Tegra124 Mi Pad board"
+	select BOARD_LATE_INIT
+
 config TARGET_NYAN_BIG
 	bool "Google/NVIDIA Nyan-big Chromebook"
 	select BOARD_LATE_INIT
@@ -54,5 +58,6 @@ source "board/nvidia/jetson-tk1/Kconfig"
 source "board/nvidia/nyan-big/Kconfig"
 source "board/nvidia/venice2/Kconfig"
 source "board/toradex/apalis-tk1/Kconfig"
+source "board/xiaomi/mocha/Kconfig"
 
 endif
board/xiaomi/mocha/Kconfig new file +12 -0
new file mode 100644
index 00000000000..25c61d4169e
@@ -0,0 +1,12 @@
+if TARGET_MOCHA
+
+config SYS_BOARD
+	default "mocha"
+
+config SYS_VENDOR
+	default "xiaomi"
+
+config SYS_CONFIG_NAME
+	default "mocha"
+
+endif
board/xiaomi/mocha/MAINTAINERS new file +8 -0
new file mode 100644
index 00000000000..c3871a15a35
@@ -0,0 +1,8 @@
+MOCHA BOARD
+M:	Svyatoslav Ryhel <[email protected]>
+S:	Maintained
+F:	arch/arm/dts/tegra124-xiaomi-mocha.dts
+F:	board/xiaomi/mocha/
+F:	configs/mocha_defconfig
+F:	doc/board/xiaomi/mocha.rst
+F:	include/configs/mocha.h
board/xiaomi/mocha/Makefile new file +9 -0
new file mode 100644
index 00000000000..c42e42639b3
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (c) 2024, Svyatoslav Ryhel <[email protected]>
+#
+
+obj-$(CONFIG_XPL_BUILD) += mocha-spl.o
+
+obj-y += mocha.o
+
board/xiaomi/mocha/mocha-spl.c new file +49 -0

49 lines not on this page · raw message

board/xiaomi/mocha/mocha.c new file +41 -0

41 lines not on this page · raw message

board/xiaomi/mocha/mocha.env new file +23 -0
new file mode 100644
index 00000000000..d93e24316f6
@@ -0,0 +1,23 @@
+#include <env/nvidia/prod_upd.env>
+
+button_cmd_0_name=Volume Down
+button_cmd_0=bootmenu
+button_cmd_1_name=Hall sensor (back)
+button_cmd_1=poweroff
+button_cmd_1_name=Hall sensor (front)
+button_cmd_1=poweroff
+
+partitions=name=emmc,start=0,size=-,uuid=${uuid_gpt_rootfs}
+
+boot_block_size_r=0x400000
+boot_block_size=0x2000
+boot_dev=1
+
+bootmenu_0=mount internal storage=usb start && ums 0 mmc 0; bootmenu
+bootmenu_1=mount external storage=usb start && ums 0 mmc 1; bootmenu
+bootmenu_2=fastboot=echo Starting Fastboot protocol ...; fastboot usb 0; bootmenu
+bootmenu_3=update bootloader=run flash_uboot
+bootmenu_4=reboot RCM=enterrcm
+bootmenu_5=reboot=reset
+bootmenu_6=power off=poweroff
+bootmenu_delay=-1
configs/mocha_defconfig new file +90 -0

90 lines not on this page · raw message

doc/board/index.rst +1 -0
index b055046e649..84c135e02c1 100644
@@ -69,4 +69,5 @@ Board-specific doc
    variscite/index
    wexler/index
    xen/index
+   xiaomi/index
    xilinx/index
doc/board/xiaomi/index.rst new file +9 -0
new file mode 100644
index 00000000000..109ab4a251f
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Xiaomi
+======
+
+.. toctree::
+   :maxdepth: 2
+
+   mocha
doc/board/xiaomi/mocha.rst new file +112 -0

112 lines not on this page · raw message

include/configs/mocha.h new file +25 -0
new file mode 100644
index 00000000000..1c2eb906085
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2010-2013, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * Copyright (c) 2024, Svyatoslav Ryhel <[email protected]>
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include "tegra124-common.h"
+
+/* High-level configuration options */
+#define CFG_TEGRA_BOARD_STRING		"Xiaomi Mocha"
+
+/* Board-specific serial config */
+#define CFG_SYS_NS16550_COM1		NV_PA_APB_UARTD_BASE
+
+#ifdef CONFIG_TEGRA_SUPPORT_NON_SECURE
+  #define CFG_PRAM                     0x38400 /* 225 MB */
+#endif
+
+#include "tegra-common-post.h"
+
+#endif /* __CONFIG_H */
Signature · 1 line
2.43.0