summaryrefslogtreecommitdiff
path: root/board/microsoft
diff options
context:
space:
mode:
Diffstat (limited to 'board/microsoft')
-rw-r--r--board/microsoft/surface-2/Kconfig13
-rw-r--r--board/microsoft/surface-2/MAINTAINERS7
-rw-r--r--board/microsoft/surface-2/Makefile6
-rw-r--r--board/microsoft/surface-2/board-info.c71
-rw-r--r--board/microsoft/surface-2/surface-2-spl.c42
-rw-r--r--board/microsoft/surface-2/surface-2.env8
6 files changed, 147 insertions, 0 deletions
diff --git a/board/microsoft/surface-2/Kconfig b/board/microsoft/surface-2/Kconfig
new file mode 100644
index 00000000000..8573666dc92
--- /dev/null
+++ b/board/microsoft/surface-2/Kconfig
@@ -0,0 +1,13 @@
+if TARGET_SURFACE_2
+
+config SYS_BOARD
+ default "surface-2"
+
+config SYS_VENDOR
+ default "microsoft"
+
+config TEGRA_BOARD_STRING
+ string "Default Tegra board name"
+ default "Microsoft Surface 2"
+
+endif
diff --git a/board/microsoft/surface-2/MAINTAINERS b/board/microsoft/surface-2/MAINTAINERS
new file mode 100644
index 00000000000..57747d304cd
--- /dev/null
+++ b/board/microsoft/surface-2/MAINTAINERS
@@ -0,0 +1,7 @@
+SURFACE_2 BOARD
+M: Jonas Schwöbel <jonasschwoebel@yahoo.de>
+S: Maintained
+F: arch/arm/dts/tegra114-microsoft-surface-2*
+F: board/microsoft/surface-2/
+F: configs/surface-2_defconfig
+F: doc/board/microsoft/surface-2.rst
diff --git a/board/microsoft/surface-2/Makefile b/board/microsoft/surface-2/Makefile
new file mode 100644
index 00000000000..43bf6c66db2
--- /dev/null
+++ b/board/microsoft/surface-2/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (c) 2010-2013, NVIDIA CORPORATION. All rights reserved.
+
+obj-$(CONFIG_XPL_BUILD) += surface-2-spl.o
+obj-$(CONFIG_MULTI_DTB_FIT) += board-info.o
diff --git a/board/microsoft/surface-2/board-info.c b/board/microsoft/surface-2/board-info.c
new file mode 100644
index 00000000000..95a4accdc90
--- /dev/null
+++ b/board/microsoft/surface-2/board-info.c
@@ -0,0 +1,71 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2025
+ * Svyatoslav Ryhel <clamor95@gmail.com>
+ */
+
+#include <stdio.h>
+#include <env.h>
+#include <spl_gpio.h>
+
+#include <asm/gpio.h>
+#include <asm/arch/pinmux.h>
+#include <linux/string.h>
+
+static int id_gpio_get_value(u32 pingrp, u32 pin)
+{
+ /* Configure pinmux */
+ pinmux_set_func(pingrp, PMUX_FUNC_KBC);
+ pinmux_set_pullupdown(pingrp, PMUX_PULL_DOWN);
+ pinmux_tristate_enable(pingrp);
+ pinmux_set_io(pingrp, PMUX_PIN_INPUT);
+
+ /*
+ * Since this function may be called
+ * during DM reload we should use SPL
+ * GPIO functions which do not depend
+ * on DM.
+ */
+ spl_gpio_input(NULL, pin);
+ return spl_gpio_get_value(NULL, pin);
+}
+
+static int get_board_id(void)
+{
+ u32 pcb_id0, pcb_id1, pcb_id2, pcb_id3, pcb_id4, board_id;
+
+ pcb_id0 = id_gpio_get_value(PMUX_PINGRP_KB_COL0_PQ0, TEGRA_GPIO(Q, 0));
+ pcb_id1 = id_gpio_get_value(PMUX_PINGRP_KB_COL1_PQ1, TEGRA_GPIO(Q, 1));
+ pcb_id2 = id_gpio_get_value(PMUX_PINGRP_KB_COL2_PQ2, TEGRA_GPIO(Q, 2));
+ pcb_id3 = id_gpio_get_value(PMUX_PINGRP_KB_COL3_PQ3, TEGRA_GPIO(Q, 3));
+ pcb_id4 = id_gpio_get_value(PMUX_PINGRP_KB_COL4_PQ4, TEGRA_GPIO(Q, 4));
+
+ /* Construct board ID */
+ board_id = pcb_id4 << 4 | pcb_id3 << 3 | pcb_id2 << 2 | pcb_id1 << 1 | pcb_id0;
+
+ log_debug("[SURFACE-2]: Board ID %02x\n", board_id);
+
+ return board_id & 0x1f;
+}
+
+int board_fit_config_name_match(const char *name)
+{
+ char dt_name[64] = { 0 };
+
+ snprintf(dt_name, sizeof(dt_name), "tegra114-microsoft-surface-2-%02x.dtb",
+ get_board_id());
+
+ if (!strcmp(name, dt_name))
+ return 0;
+
+ return -1;
+}
+
+void nvidia_board_late_init(void)
+{
+ char dt_path[64] = { 0 };
+
+ snprintf(dt_path, sizeof(dt_path), "tegra114-microsoft-surface-2-%02x.dtb",
+ get_board_id());
+ env_set("fdtfile", dt_path);
+}
diff --git a/board/microsoft/surface-2/surface-2-spl.c b/board/microsoft/surface-2/surface-2-spl.c
new file mode 100644
index 00000000000..16f4373c7f0
--- /dev/null
+++ b/board/microsoft/surface-2/surface-2-spl.c
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Surface 2 SPL stage configuration
+ *
+ * (C) Copyright 2010-2013
+ * NVIDIA Corporation <www.nvidia.com>
+ *
+ * (C) Copyright 2023
+ * Svyatoslav Ryhel <clamor95@gmail.com>
+ */
+
+#include <asm/arch/tegra.h>
+#include <asm/arch-tegra/tegra_i2c.h>
+#include <linux/delay.h>
+
+#define TPS65913_I2C_ADDR (0x58 << 1)
+
+#define TPS65913_SMPS12_CTRL 0x20
+#define TPS65913_SMPS12_VOLTAGE 0x23
+#define TPS65913_SMPS45_CTRL 0x28
+#define TPS65913_SMPS45_VOLTAGE 0x2B
+
+#define TPS65913_SMPS12_CTRL_DATA (0x5100 | TPS65913_SMPS12_CTRL)
+#define TPS65913_SMPS12_VOLTAGE_DATA (0x3900 | TPS65913_SMPS12_VOLTAGE)
+#define TPS65913_SMPS45_CTRL_DATA (0x5100 | TPS65913_SMPS45_CTRL)
+#define TPS65913_SMPS45_VOLTAGE_DATA (0x4c00 | TPS65913_SMPS45_VOLTAGE)
+
+void pmic_enable_cpu_vdd(void)
+{
+ /* Set CORE VDD to 1.200V. */
+ tegra_i2c_ll_write(TPS65913_I2C_ADDR, TPS65913_SMPS45_VOLTAGE_DATA);
+ udelay(1000);
+ tegra_i2c_ll_write(TPS65913_I2C_ADDR, TPS65913_SMPS45_CTRL_DATA);
+
+ udelay(1000);
+
+ /* Set CPU VDD to 1.0125V. */
+ tegra_i2c_ll_write(TPS65913_I2C_ADDR, TPS65913_SMPS12_VOLTAGE_DATA);
+ udelay(1000);
+ tegra_i2c_ll_write(TPS65913_I2C_ADDR, TPS65913_SMPS12_CTRL_DATA);
+ udelay(10 * 1000);
+}
diff --git a/board/microsoft/surface-2/surface-2.env b/board/microsoft/surface-2/surface-2.env
new file mode 100644
index 00000000000..a77885a7c6d
--- /dev/null
+++ b/board/microsoft/surface-2/surface-2.env
@@ -0,0 +1,8 @@
+button_cmd_0_name=Volume Down
+button_cmd_0=bootmenu
+
+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_4=power off=reset
+bootmenu_delay=-1