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/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