board: xiaomi: mocha: add Xiaomi Mi Pad A0101 support
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.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
diff --git a/board/xiaomi/mocha/mocha.c b/board/xiaomi/mocha/mocha.c
new file mode 100644
index 0000000..5026d54
--- /dev/null
+++ b/board/xiaomi/mocha/mocha.c
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2024
+ * Svyatoslav Ryhel <clamor95@gmail.com>
+ */
+
+#include <dm.h>
+#include <fdt_support.h>
+#include <i2c.h>
+#include <log.h>
+
+#ifdef CONFIG_MMC_SDHCI_TEGRA
+
+#define TPS65913_I2C_ADDRESS 0x58
+#define TPS65913_PRIMARY_SECONDARY_PAD2 0xfb
+#define GPIO_4 BIT(0)
+#define TPS65913_PRIMARY_SECONDARY_PAD3 0xfe
+#define DVFS2 BIT(1)
+#define DVFS1 BIT(0)
+
+/* We are using this function only till palmas pinctrl driver is available */
+void pin_mux_mmc(void)
+{
+ struct udevice *dev;
+ int ret;
+
+ ret = i2c_get_chip_for_busnum(0, TPS65913_I2C_ADDRESS, 1, &dev);
+ if (ret) {
+ log_debug("%s: cannot find PMIC I2C chip\n", __func__);
+ return;
+ }
+
+ /* GPIO4 function has to be GPIO */
+ dm_i2c_reg_clrset(dev, TPS65913_PRIMARY_SECONDARY_PAD2,
+ GPIO_4, 0);
+
+ /* DVFS1 and DVFS2 are disabled */
+ dm_i2c_reg_clrset(dev, TPS65913_PRIMARY_SECONDARY_PAD3,
+ DVFS2 | DVFS1, 0);
+}
+#endif