]> git.sur5r.net Git - u-boot/commitdiff
samsung: board: support eMMC reset using DT
authorJoonyoung Shim <jy0922.shim@samsung.com>
Thu, 15 Jan 2015 02:45:56 +0000 (11:45 +0900)
committerMinkyu Kang <mk7.kang@samsung.com>
Fri, 13 Feb 2015 08:17:10 +0000 (17:17 +0900)
Some exynos boards require special handling of 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.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
board/samsung/common/board.c
board/samsung/odroid/odroid.c
doc/device-tree-bindings/exynos/emmc-reset.txt [new file with mode: 0644]

index 8b4c8e9a9db90f882a1349e1b5c6e1258fc77ce3..da2245ff9d6c21aa1a6ae05fcaa590564069acf2 100644 (file)
@@ -355,3 +355,31 @@ int misc_init_r(void)
        return 0;
 }
 #endif
+
+void reset_misc(void)
+{
+       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
+                *
+                * FIXME: Need to optimize delay time. Minimum 1usec pulse is
+                *        required by 'JEDEC Standard No.84-A441' (eMMC)
+                *        document but real delay time is expected to greater
+                *        than 1usec.
+                */
+               dm_gpio_set_value(&gpio, 0);
+               mdelay(10);
+               dm_gpio_set_value(&gpio, 1);
+       }
+}
index e3517f2eb24101f8614b53c120d30f37ea5caa06..306cc0f9d9624e32228ad1e4bea25bc8e0224fb1 100644 (file)
@@ -503,11 +503,3 @@ int board_usb_init(int index, enum usb_init_type init)
        return s3c_udc_probe(&s5pc210_otg_data);
 }
 #endif
-
-void reset_misc(void)
-{
-       /* Reset eMMC*/
-       gpio_set_value(EXYNOS4X12_GPIO_K12, 0);
-       mdelay(10);
-       gpio_set_value(EXYNOS4X12_GPIO_K12, 1);
-}
diff --git a/doc/device-tree-bindings/exynos/emmc-reset.txt b/doc/device-tree-bindings/exynos/emmc-reset.txt
new file mode 100644 (file)
index 0000000..5e7ba26
--- /dev/null
@@ -0,0 +1,15 @@
+* Samsung eMMC reset
+
+Some exynos boards require special handling of 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>;
+};