[U-Boot] [PATCH 1/3] samsung: board: support eMMC reset using DT

Joonyoung Shim jy0922.shim at samsung.com
Thu Jan 8 06:44:25 CET 2015


Some exynos boards require special handling of SD4_nRESET_OUT line for
eMMC memory to perform complete reboot e.g. Odroid X2/U3/XU3 boards.

This will support eMMC reset using DT from reset_misc of samsung common
board file and each board files can support eMMC reset on non DT case.

Signed-off-by: Joonyoung Shim <jy0922.shim at samsung.com>
---
 board/samsung/common/board.c                   | 27 ++++++++++++++++++++++++++
 board/samsung/odroid/odroid.c                  |  2 +-
 doc/device-tree-bindings/exynos/emmc-reset.txt | 15 ++++++++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 doc/device-tree-bindings/exynos/emmc-reset.txt

diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index c04ab3c..3218463 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -40,6 +40,8 @@ __weak int exynos_power_init(void)
 	return 0;
 }
 
+__weak void exynos_reset_misc(void) {}
+
 #if defined CONFIG_EXYNOS_TMU
 /* Boot Time Thermal Analysis for SoC temperature threshold breach */
 static void boot_temp_check(void)
@@ -400,3 +402,28 @@ int misc_init_r(void)
 	return 0;
 }
 #endif
+
+void reset_misc(void)
+{
+#ifdef CONFIG_OF_CONTROL
+	struct gpio_desc gpio = {};
+	int node;
+
+	node = fdt_node_offset_by_compatible(gd->fdt_blob, 0,
+			"samsung,emmc-reset");
+	if (node < 0)
+		return;
+
+	gpio_request_by_name_nodev(gd->fdt_blob, node, "reset-gpio", 0, &gpio,
+				   GPIOD_IS_OUT);
+
+	if (dm_gpio_is_valid(&gpio)) {
+		/* Reset eMMC*/
+		dm_gpio_set_value(&gpio, 0);
+		mdelay(10);
+		dm_gpio_set_value(&gpio, 1);
+	}
+#else
+	exynos_reset_misc();
+#endif
+}
diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
index 3f43e17..db35945 100644
--- a/board/samsung/odroid/odroid.c
+++ b/board/samsung/odroid/odroid.c
@@ -516,7 +516,7 @@ int board_usb_init(int index, enum usb_init_type init)
 }
 #endif
 
-void reset_misc(void)
+void exynos_reset_misc(void)
 {
 	/* Reset eMMC*/
 	gpio_set_value(EXYNOS4X12_GPIO_K12, 0);
diff --git a/doc/device-tree-bindings/exynos/emmc-reset.txt b/doc/device-tree-bindings/exynos/emmc-reset.txt
new file mode 100644
index 0000000..e48e508
--- /dev/null
+++ b/doc/device-tree-bindings/exynos/emmc-reset.txt
@@ -0,0 +1,15 @@
+* Samsung eMMC reset
+
+Some exynos boards require special handling of SD4_nRESET_OUT line for eMMC
+memory to perform complete reboot.
+
+Required properties:
+- compatible: should be "samsung,emmc-reset"
+- reset-gpio: gpio chip for eMMC reset.
+
+Example:
+
+emmc-reset {
+        compatible = "samsung,emmc-reset";
+        reset-gpio = <&gpk1 2 0>;
+};
-- 
1.9.1



More information about the U-Boot mailing list