board: lg: star: add Optimus 2X P990 support
The LG Optimus 2X is a touchscreen-based, slate-sized smartphone designed
and manufactured by LG that runs the Android operating system. The
Optimus 2X features a 4" WVGA display, an Nvidia Tegra 2 dual-core chip,
512 MB of RAM and extendable 8 GB of internal storage. UART-B is default
debug port.
Tested-by: Ion Agorria <ion@agorria.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
diff --git a/board/lg/star/Kconfig b/board/lg/star/Kconfig
new file mode 100644
index 0000000..5852312
--- /dev/null
+++ b/board/lg/star/Kconfig
@@ -0,0 +1,16 @@
+if TARGET_STAR
+
+config SYS_BOARD
+ default "star"
+
+config SYS_VENDOR
+ default "lg"
+
+config SYS_CONFIG_NAME
+ default "tegra"
+
+config TEGRA_BOARD_STRING
+ string "Default Tegra board name"
+ default "LG Star"
+
+endif
diff --git a/board/lg/star/MAINTAINERS b/board/lg/star/MAINTAINERS
new file mode 100644
index 0000000..e2d6e90
--- /dev/null
+++ b/board/lg/star/MAINTAINERS
@@ -0,0 +1,7 @@
+STAR BOARD
+M: Svyatoslav Ryhel <clamor95@gmail.com>
+S: Maintained
+F: arch/arm/dts/tegra20-lg-star.dts
+F: board/lg/star/
+F: configs/star_defconfig
+F: doc/board/lg/star.rst
diff --git a/board/lg/star/Makefile b/board/lg/star/Makefile
new file mode 100644
index 0000000..3e6e9f4
--- /dev/null
+++ b/board/lg/star/Makefile
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2010-2012
+# NVIDIA Corporation <www.nvidia.com>
+#
+# (C) Copyright 2024
+# Svyatoslav Ryhel <clamor95@gmail.com>
+
+obj-y += star.o
diff --git a/board/lg/star/star.c b/board/lg/star/star.c
new file mode 100644
index 0000000..dc59375
--- /dev/null
+++ b/board/lg/star/star.c
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2023
+ * Svyatoslav Ryhel <clamor95@gmail.com>
+ */
+
+#include <dm.h>
+#include <dm/root.h>
+#include <fdt_support.h>
+#include <log.h>
+#include <spl_gpio.h>
+
+static int star_fix_panel(void *fdt)
+{
+ int panel_offset, ret;
+
+ /* Patch panel compatible */
+ spl_gpio_input(NULL, TEGRA_GPIO(J, 5));
+ if (spl_gpio_get_value(NULL, TEGRA_GPIO(J, 5))) {
+ panel_offset = fdt_node_offset_by_compatible(fdt, -1,
+ "hit,tx10d07vm0baa");
+ if (panel_offset < 0) {
+ log_debug("%s: panel node not found\n", __func__);
+ return panel_offset;
+ }
+
+ ret = fdt_setprop_string(fdt, panel_offset, "compatible",
+ "lg,lh400wv3-sd04");
+ if (ret) {
+ log_debug("%s: panel comapible patch failed\n", __func__);
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
+void pinmux_init(void)
+{
+ void *fdt = (void *)gd->fdt_blob;
+
+ star_fix_panel(fdt);
+}
+
+#if IS_ENABLED(CONFIG_OF_LIBFDT) && IS_ENABLED(CONFIG_OF_BOARD_SETUP)
+int ft_board_setup(void *fdt, struct bd_info *bd)
+{
+ return star_fix_panel(fdt);
+}
+#endif
diff --git a/board/lg/star/star.env b/board/lg/star/star.env
new file mode 100644
index 0000000..f2bf298
--- /dev/null
+++ b/board/lg/star/star.env
@@ -0,0 +1,15 @@
+#include <env/nvidia/prod_upd.env>
+
+button_cmd_0_name=Volume Down
+button_cmd_0=bootmenu
+partitions=name=emmc,start=0,size=-,uuid=${uuid_gpt_rootfs}
+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