Skip to contentSkip to conversation

samsung: board: support eMMC reset using DT

PATCH Superseded Joonyoung Shim 5 participants 19 messages Jan 8, 2015 – Jan 12, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 samsung: board: support eMMC reset using DT

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.

---
 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
board/samsung/common/board.c +27 -0
index c04ab3c..3218463 100644
@@ -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
+}
board/samsung/odroid/odroid.c +1 -1
index 3f43e17..db35945 100644
@@ -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);
doc/device-tree-bindings/exynos/emmc-reset.txt new file +15 -0
new file mode 100644
index 0000000..e48e508
@@ -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>;
+};
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/3 Odroid: Add eMMC-reset node on DT

This needs for special handling of SD4_nRESET_OUT line for eMMC memory to perform complete reboot on Odroid X2/U3 boards.

---
 arch/arm/dts/exynos4412-odroid.dts | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/dts/exynos4412-odroid.dts +5 -0
index ecb3e23..519a7dd 100644
@@ -90,4 +90,9 @@
 			reg = <0x125B0000 0x100>;
 		};
 	};
+
+	emmc-reset {
+		compatible = "samsung,emmc-reset";
+		reset-gpio = <&gpk1 2 0>;
+	};
 };
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/3 Odroid: Add eMMC-reset node on DT

Hi,

Quoted 13 lines · Joonyoung Shim

This needs for special handling of SD4_nRESET_OUT line for eMMC memory to perform complete reboot on Odroid X2/U3 boards.

---
 arch/arm/dts/exynos4412-odroid.dts | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/dts/exynos4412-odroid.dts +0 -0
index ecb3e23..519a7dd 100644

arch/arm/dts/exynos4412-odroid.dts line 98

Quoted 9 lines
arch/arm/dts/exynos4412-odroid.dts +5 -0
@@ -90,4 +90,9 @@
                        reg = <0x125B0000 0x100>;
                };
        };
+
+       emmc-reset {
+               compatible = "samsung,emmc-reset";
+               reset-gpio = <&gpk1 2 0>;
+       };
 };

Shouldn't this go in the relevant sdhci node instead of its own node?

Regards,
Simon

#3 lore raw

PATCH 2/3 Odroid: Add eMMC-reset node on DT

+Cc Jaehoon,

Quoted 11 lines · Simon Glass

Hi,

Quoted 8 lines · Joonyoung Shim

This needs for special handling of SD4_nRESET_OUT line for eMMC memory to perform complete reboot on Odroid X2/U3 boards.

---
 arch/arm/dts/exynos4412-odroid.dts | 5 +++++
 1 file changed, 5 insertions(+)
Quoted 17 lines
Quoted 5 lines
arch/arm/dts/exynos4412-odroid.dts +0 -0
index ecb3e23..519a7dd 100644

arch/arm/dts/exynos4412-odroid.dts line 98

Quoted 9 lines
arch/arm/dts/exynos4412-odroid.dts +5 -0
@@ -90,4 +90,9 @@
                        reg = <0x125B0000 0x100>;
                };
        };
+
+       emmc-reset {
+               compatible = "samsung,emmc-reset";
+               reset-gpio = <&gpk1 2 0>;
+       };
 };

Shouldn't this go in the relevant sdhci node instead of its own node?

Jaehoon, is it reasonable?

Thanks.

#4 lore raw

PATCH 3/3 Odroid-XU3: Add eMMC-reset node on DT

In reply to Joonyoung Shim

This needs for special handling of SD4_nRESET_OUT line for eMMC memory to perform complete reboot on Odroid XU3 board.

---
 arch/arm/dts/exynos5422-odroidxu3.dts | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/dts/exynos5422-odroidxu3.dts +5 -0
index 8f46637..d0a8621 100644
@@ -46,4 +46,9 @@
 	mmc at 12220000 {
 		fifoth_val = <0x201f0020>;
 	};
+
+	emmc-reset {
+		compatible = "samsung,emmc-reset";
+		reset-gpio = <&gpd1 0 0>;
+	};
 };
Signature · 1 line
1.9.1
#5 lore raw

PATCH 1/3 samsung: board: support eMMC reset using DT

In reply to Joonyoung Shim

Hi Joonyoung,

Quoted 28 lines · Joonyoung Shim

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.

---
 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
board/samsung/common/board.c +2 -0
index c04ab3c..3218463 100644
@@ -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)

board/samsung/common/board.c int misc_init_r(void) · line 408

Quoted 7 lines
board/samsung/common/board.c +4 -0
@@ -400,3 +402,28 @@ int misc_init_r(void)
        return 0;
 }
 #endif
+
+void reset_misc(void)
+{
+#ifdef CONFIG_OF_CONTROL

I think all Samsung boards have this defined, so this #ifdef can be removed.

Quoted 5 lines
board/samsung/common/board.c +5 -0
+       struct gpio_desc gpio = {};
+       int node;
+
+       node = fdt_node_offset_by_compatible(gd->fdt_blob, 0,
+                       "samsung,emmc-reset");

board/samsung/common/board.c int misc_init_r(void) · line 423

Quoted 10 lines
board/samsung/common/board.c +10 -0
+       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);

That's a very long reset! Is that what it needs?

board/samsung/common/board.c int misc_init_r(void) · line 427

Quoted 4 lines
board/samsung/common/board.c +4 -0
+               dm_gpio_set_value(&gpio, 1);
+       }
+#else
+       exynos_reset_misc();

So I don't think you need this function.

Quoted 37 lines
board/samsung/common/board.c +2 -0
+#endif
+}
board/samsung/odroid/odroid.c +1 -1
index 3f43e17..db35945 100644
@@ -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);
doc/device-tree-bindings/exynos/emmc-reset.txt new file +15 -1
new file mode 100644
index 0000000..e48e508
@@ -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>;
+};
--
Quoted 2 lines

1.9.1

Regards,
Simon

#6 lore raw

PATCH 1/3 samsung: board: support eMMC reset using DT

+Cc Jaehoon,

Quoted 25 lines · Simon Glass

Hi Joonyoung,

Quoted 22 lines · Joonyoung Shim

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.

---
 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
board/samsung/common/board.c +0 -0
index c04ab3c..3218463 100644
@@ -40,6 +40,8 @@ __weak int exynos_power_init(void)
        return 0;
 }
 
Quoted 16 lines

board/samsung/common/board.c int misc_init_r(void) · line 408

Quoted 13 lines
board/samsung/common/board.c +6 -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

I think all Samsung boards have this defined, so this #ifdef can be removed.

OK, if it is true, we can remove this and i will not to support non DT case.

Quoted 9 lines
Quoted 9 lines
board/samsung/common/board.c +9 -0
+       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,
Quoted 9 lines

board/samsung/common/board.c int misc_init_r(void) · line 423

Quoted 6 lines
board/samsung/common/board.c +6 -0
+                                  GPIOD_IS_OUT);
+
+       if (dm_gpio_is_valid(&gpio)) {
+               /* Reset eMMC*/
+               dm_gpio_set_value(&gpio, 0);
+               mdelay(10);

That's a very long reset! Is that what it needs?

Jaehoon, is there any guide about wait time of reset at eMMC spec?

Thanks.

#7 lore raw

PATCH 1/3 samsung: board: support eMMC reset using DT

Quoted 45 lines · Joonyoung Shim

+Cc Jaehoon,

Quoted 25 lines · Simon Glass

Hi Joonyoung,

Quoted 22 lines · Joonyoung Shim

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.

---
 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
board/samsung/common/board.c +0 -0
index c04ab3c..3218463 100644
@@ -40,6 +40,8 @@ __weak int exynos_power_init(void)
        return 0;
 }
 
Quoted 16 lines

board/samsung/common/board.c int misc_init_r(void) · line 408

Quoted 13 lines
board/samsung/common/board.c +6 -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

I think all Samsung boards have this defined, so this #ifdef can be removed.

Quoted 1 line

OK, if it is true, we can remove this and i will not to support non DT case.

It's OK.

Thanks,
Minkyu Kang.

#8 lore raw

PATCH 1/3 samsung: board: support eMMC reset using DT

In reply to Joonyoung Shim
Quoted 66 lines · Joonyoung Shim

+Cc Jaehoon,

Quoted 25 lines · Simon Glass

Hi Joonyoung,

Quoted 22 lines · Joonyoung Shim

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.

---
 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
board/samsung/common/board.c +0 -0
index c04ab3c..3218463 100644
@@ -40,6 +40,8 @@ __weak int exynos_power_init(void)
        return 0;
 }
 
Quoted 16 lines

board/samsung/common/board.c int misc_init_r(void) · line 408

Quoted 13 lines
board/samsung/common/board.c +6 -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

I think all Samsung boards have this defined, so this #ifdef can be removed.

OK, if it is true, we can remove this and i will not to support non DT case.

Quoted 9 lines
Quoted 9 lines
board/samsung/common/board.c +9 -0
+       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,
Quoted 9 lines

board/samsung/common/board.c int misc_init_r(void) · line 423

Quoted 6 lines
board/samsung/common/board.c +6 -0
+                                  GPIOD_IS_OUT);
+
+       if (dm_gpio_is_valid(&gpio)) {
+               /* Reset eMMC*/
+               dm_gpio_set_value(&gpio, 0);
+               mdelay(10);

That's a very long reset! Is that what it needs?

Quoted 1 line

Jaehoon, is there any guide about wait time of reset at eMMC spec?

Well, I'm not sure, but as Simon's comments, it's long time. (Minimum is 1us...Maximum isn't defined.)

Best Regards,
Jaehoon Chung

Quoted 3 lines

Thanks.

#9 lore raw

PATCH 1/3 samsung: board: support eMMC reset using DT

Quoted 67 lines · Jaehoon Chung
Quoted 66 lines · Joonyoung Shim

+Cc Jaehoon,

Quoted 25 lines · Simon Glass

Hi Joonyoung,

Quoted 22 lines · Joonyoung Shim

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.

---
 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
board/samsung/common/board.c +0 -0
index c04ab3c..3218463 100644
@@ -40,6 +40,8 @@ __weak int exynos_power_init(void)
        return 0;
 }
 
Quoted 16 lines

board/samsung/common/board.c int misc_init_r(void) · line 408

Quoted 13 lines
board/samsung/common/board.c +6 -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

I think all Samsung boards have this defined, so this #ifdef can be removed.

OK, if it is true, we can remove this and i will not to support non DT case.

Quoted 18 lines
Quoted 5 lines
board/samsung/common/board.c +5 -0
+       struct gpio_desc gpio = {};
+       int node;
+
+       node = fdt_node_offset_by_compatible(gd->fdt_blob, 0,
+                       "samsung,emmc-reset");

board/samsung/common/board.c int misc_init_r(void) · line 423

Quoted 10 lines
board/samsung/common/board.c +10 -0
+       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);

That's a very long reset! Is that what it needs?

Quoted 5 lines
Quoted 1 line

Jaehoon, is there any guide about wait time of reset at eMMC spec?

Well, I'm not sure, but as Simon's comments, it's long time. (Minimum is 1us...Maximum isn't defined.)

This just comes from reset_misc() of board/samsung/odroid/odroid.c file. Even, hardkernel u-boot waits 50msec.

Thanks.

#10 lore raw

PATCH 1/3 samsung: board: support eMMC reset using DT

Hi,

Quoted 68 lines · Joonyoung Shim
Quoted 67 lines · Jaehoon Chung
Quoted 66 lines · Joonyoung Shim

+Cc Jaehoon,

Quoted 25 lines · Simon Glass

Hi Joonyoung,

Quoted 22 lines · Joonyoung Shim

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.

---
 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
board/samsung/common/board.c +0 -0
index c04ab3c..3218463 100644
@@ -40,6 +40,8 @@ __weak int exynos_power_init(void)
        return 0;
 }
 
Quoted 16 lines

board/samsung/common/board.c int misc_init_r(void) · line 408

Quoted 13 lines
board/samsung/common/board.c +6 -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

I think all Samsung boards have this defined, so this #ifdef can be removed.

OK, if it is true, we can remove this and i will not to support non DT case.

Quoted 18 lines
Quoted 5 lines
board/samsung/common/board.c +5 -0
+       struct gpio_desc gpio = {};
+       int node;
+
+       node = fdt_node_offset_by_compatible(gd->fdt_blob, 0,
+                       "samsung,emmc-reset");

board/samsung/common/board.c int misc_init_r(void) · line 423

Quoted 10 lines
board/samsung/common/board.c +10 -0
+       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);

That's a very long reset! Is that what it needs?

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Jaehoon, is there any guide about wait time of reset at eMMC spec?

Well, I'm not sure, but as Simon's comments, it's long time. (Minimum is 1us...Maximum isn't defined.)

This just comes from reset_misc() of board/samsung/odroid/odroid.c file. Even, hardkernel u-boot waits 50msec.

The only info I have immediately to hand is the 'JEDEC Standard No. 84-A441' (eMMC) and it says a 1uS pulse is required. So can we change this to udelay(1)?

Regards,
Simon

#11 lore raw

PATCH 1/3 samsung: board: support eMMC reset using DT

Quoted 78 lines · Simon Glass

Hi,

Quoted 74 lines · Joonyoung Shim
Quoted 72 lines · Jaehoon Chung
Quoted 66 lines · Joonyoung Shim

+Cc Jaehoon,

Quoted 25 lines · Simon Glass

Hi Joonyoung,

Quoted 22 lines · Joonyoung Shim

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.

---
 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
board/samsung/common/board.c +0 -0
index c04ab3c..3218463 100644
@@ -40,6 +40,8 @@ __weak int exynos_power_init(void)
        return 0;
 }
 
Quoted 16 lines

board/samsung/common/board.c int misc_init_r(void) · line 408

Quoted 13 lines
board/samsung/common/board.c +6 -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

I think all Samsung boards have this defined, so this #ifdef can be removed.

OK, if it is true, we can remove this and i will not to support non DT case.

Quoted 9 lines
Quoted 9 lines
board/samsung/common/board.c +9 -0
+       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,
Quoted 9 lines

board/samsung/common/board.c int misc_init_r(void) · line 423

Quoted 6 lines
board/samsung/common/board.c +6 -0
+                                  GPIOD_IS_OUT);
+
+       if (dm_gpio_is_valid(&gpio)) {
+               /* Reset eMMC*/
+               dm_gpio_set_value(&gpio, 0);
+               mdelay(10);

That's a very long reset! Is that what it needs?

Quoted 1 line

Jaehoon, is there any guide about wait time of reset at eMMC spec?

Well, I'm not sure, but as Simon's comments, it's long time. (Minimum is 1us...Maximum isn't defined.)

Quoted 6 lines
Quoted 2 lines

This just comes from reset_misc() of board/samsung/odroid/odroid.c file. Even, hardkernel u-boot waits 50msec.

The only info I have immediately to hand is the 'JEDEC Standard No. 84-A441' (eMMC) and it says a 1uS pulse is required. So can we change this to udelay(1)?

It's minimum value, that's not problem that 10msec is set.
But if change this value, i think good that it changes to greater value than 1us.

Best Regards,
Jaehoon Chung

Quoted 4 lines

Regards,
Simon

#12 lore raw

PATCH 1/3 samsung: board: support eMMC reset using DT

Quoted 82 lines · Jaehoon Chung
Quoted 81 lines · Simon Glass

Hi,

Quoted 76 lines · Joonyoung Shim
Quoted 67 lines · Jaehoon Chung
Quoted 66 lines · Joonyoung Shim

+Cc Jaehoon,

Quoted 25 lines · Simon Glass

Hi Joonyoung,

Quoted 22 lines · Joonyoung Shim

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.

---
 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
board/samsung/common/board.c +0 -0
index c04ab3c..3218463 100644
@@ -40,6 +40,8 @@ __weak int exynos_power_init(void)
        return 0;
 }
 
Quoted 16 lines

board/samsung/common/board.c int misc_init_r(void) · line 408

Quoted 13 lines
board/samsung/common/board.c +6 -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

I think all Samsung boards have this defined, so this #ifdef can be removed.

OK, if it is true, we can remove this and i will not to support non DT case.

Quoted 18 lines
Quoted 5 lines
board/samsung/common/board.c +5 -0
+       struct gpio_desc gpio = {};
+       int node;
+
+       node = fdt_node_offset_by_compatible(gd->fdt_blob, 0,
+                       "samsung,emmc-reset");

board/samsung/common/board.c int misc_init_r(void) · line 423

Quoted 10 lines
board/samsung/common/board.c +10 -0
+       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);

That's a very long reset! Is that what it needs?

Quoted 5 lines
Quoted 1 line

Jaehoon, is there any guide about wait time of reset at eMMC spec?

Well, I'm not sure, but as Simon's comments, it's long time. (Minimum is 1us...Maximum isn't defined.)

This just comes from reset_misc() of board/samsung/odroid/odroid.c file. Even, hardkernel u-boot waits 50msec.

Quoted 7 lines
Quoted 3 lines

The only info I have immediately to hand is the 'JEDEC Standard No. 84-A441' (eMMC) and it says a 1uS pulse is required. So can we change this to udelay(1)?

It's minimum value, that's not problem that 10msec is set.
But if change this value, i think good that it changes to greater value than 1us.

Actually, i don't have any idea about proper wait time, so i will use just current 10msec with TODO comments until getting right guide about wait time. Is it ok?

Thanks.

#13 lore raw

PATCH 1/3 samsung: board: support eMMC reset using DT

Hi,

Quoted 87 lines · Joonyoung Shim
Quoted 86 lines · Jaehoon Chung
Quoted 84 lines · Simon Glass

Hi,

Quoted 68 lines · Joonyoung Shim
Quoted 67 lines · Jaehoon Chung
Quoted 66 lines · Joonyoung Shim

+Cc Jaehoon,

Quoted 25 lines · Simon Glass

Hi Joonyoung,

Quoted 22 lines · Joonyoung Shim

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.

---
 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
board/samsung/common/board.c +0 -0
index c04ab3c..3218463 100644
@@ -40,6 +40,8 @@ __weak int exynos_power_init(void)
        return 0;
 }
 
Quoted 16 lines

board/samsung/common/board.c int misc_init_r(void) · line 408

Quoted 13 lines
board/samsung/common/board.c +6 -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

I think all Samsung boards have this defined, so this #ifdef can be removed.

OK, if it is true, we can remove this and i will not to support non DT case.

Quoted 18 lines
Quoted 5 lines
board/samsung/common/board.c +5 -0
+       struct gpio_desc gpio = {};
+       int node;
+
+       node = fdt_node_offset_by_compatible(gd->fdt_blob, 0,
+                       "samsung,emmc-reset");

board/samsung/common/board.c int misc_init_r(void) · line 423

Quoted 10 lines
board/samsung/common/board.c +10 -0
+       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);

That's a very long reset! Is that what it needs?

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Jaehoon, is there any guide about wait time of reset at eMMC spec?

Well, I'm not sure, but as Simon's comments, it's long time. (Minimum is 1us...Maximum isn't defined.)

This just comes from reset_misc() of board/samsung/odroid/odroid.c file. Even, hardkernel u-boot waits 50msec.

The only info I have immediately to hand is the 'JEDEC Standard No. 84-A441' (eMMC) and it says a 1uS pulse is required. So can we change this to udelay(1)?

Quoted 7 lines
Quoted 3 lines

It's minimum value, that's not problem that 10msec is set.
But if change this value, i think good that it changes to greater value than 1us.

Actually, i don't have any idea about proper wait time, so i will use just current 10msec with TODO comments until getting right guide about wait time. Is it ok?

Find with me, you are just moving code. I think you should also mention that the eMMC spec says 1us and someone should test it.

Regards,
Simon

#14 lore raw

PATCH 1/3 samsung: board: support eMMC reset using DT

In reply to Joonyoung Shim
Quoted 14 lines · Joonyoung Shim

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.

doc/device-tree-bindings/exynos/emmc-reset.txt new file +0 -0
new file mode 100644
index 0000000..e48e508

doc/device-tree-bindings/exynos/emmc-reset.txt line 4

Quoted 4 lines
doc/device-tree-bindings/exynos/emmc-reset.txt new file +4 -0
@@ -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.

Nitpick, on XU3 the line you apparently need to twiddle is SD0_nRESET_OUT.

Is this type of usage of this pin specific to the Odroid Exynos boards or potentially on more boards? (Sorry for the simple questions, but my exynos documentation just says the line exists not what its intended usage is).

Fwiw, I did a quick check in the linux code and it doesn't seem to be using those pins for currently for any boards. However my X2 does successfully reset/reboot in u-boot and linux, so it seems optional there. The XU3 does fail to reset itself, so it seems required for that board.

Quoted 10 lines
doc/device-tree-bindings/exynos/emmc-reset.txt new file +10 -0
+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>;
+};
Signature · 9 lines
Sjoerd Simons <[email protected]>
Collabora Ltd.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6170 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150109/555ec0f6/attachment.bin>
#15 lore raw

PATCH 1/3 samsung: board: support eMMC reset using DT

Quoted 23 lines · Sjoerd Simons
Quoted 14 lines · Joonyoung Shim

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.

doc/device-tree-bindings/exynos/emmc-reset.txt new file +0 -0
new file mode 100644
index 0000000..e48e508

doc/device-tree-bindings/exynos/emmc-reset.txt line 4

Quoted 4 lines
doc/device-tree-bindings/exynos/emmc-reset.txt new file +4 -0
@@ -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.

Nitpick, on XU3 the line you apparently need to twiddle is SD0_nRESET_OUT.

Quoted 4 lines

Is this type of usage of this pin specific to the Odroid Exynos boards or potentially on more boards? (Sorry for the simple questions, but my exynos documentation just says the line exists not what its intended usage is).

In case of Exynos4, eMMC can be used with sdhci controller or dw-mmc controller. So Pin name should be used to SD0 or SD4.

But Exynos5 is only supported the dw-mmc controller. (So eMMC is used pin-name as "SD0".)

Best Regards,
Jaehoon Chung

Quoted 26 lines

Fwiw, I did a quick check in the linux code and it doesn't seem to be using those pins for currently for any boards. However my X2 does successfully reset/reboot in u-boot and linux, so it seems optional there. The XU3 does fail to reset itself, so it seems required for that board.

doc/device-tree-bindings/exynos/emmc-reset.txt line 15

Quoted 10 lines
doc/device-tree-bindings/exynos/emmc-reset.txt new file +10 -0
+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>;
+};

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#16 lore raw

PATCH 1/3 samsung: board: support eMMC reset using DT

Hi,

Quoted 10 lines · Jaehoon Chung
Quoted 9 lines · Sjoerd Simons
Quoted 7 lines · Joonyoung Shim

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.

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
doc/device-tree-bindings/exynos/emmc-reset.txt new file +0 -0
new file mode 100644
index 0000000..e48e508
Quoted 9 lines

doc/device-tree-bindings/exynos/emmc-reset.txt line 4

Quoted 5 lines
doc/device-tree-bindings/exynos/emmc-reset.txt new file +4 -0
@@ -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.

Nitpick, on XU3 the line you apparently need to twiddle is SD0_nRESET_OUT.

Then, i think it's better to omit "SD4_".

Quoted 11 lines
Quoted 4 lines

Is this type of usage of this pin specific to the Odroid Exynos boards or potentially on more boards? (Sorry for the simple questions, but my exynos documentation just says the line exists not what its intended usage is).

In case of Exynos4, eMMC can be used with sdhci controller or dw-mmc controller. So Pin name should be used to SD0 or SD4.

But Exynos5 is only supported the dw-mmc controller. (So eMMC is used pin-name as "SD0".)

I can find only "SD_4_nRESET_OUT" from exynos4412 user manual and only "SD_0__nRESET_OUT" from exynos5422 user manual.

Quoted 9 lines

Best Regards,
Jaehoon Chung

Quoted 7 lines

Fwiw, I did a quick check in the linux code and it doesn't seem to be using those pins for currently for any boards. However my X2 does successfully reset/reboot in u-boot and linux, so it seems optional there. The XU3 does fail to reset itself, so it seems required for that board.

I checked upstream u-boot and hardkernel u-boot and i found codes to reset eMMC using gpio.

upstream u-boot: reset_misc() of board/samsung/odroid/odroid.c hardkernel u-boot: reset_cpu() of arch/arm/cpu/armv7/exynos/reset.c

Thanks.

#17 lore raw

PATCH 1/3 samsung: board: support eMMC reset using DT

Quoted 55 lines · Joonyoung Shim

Hi,

Quoted 10 lines · Jaehoon Chung
Quoted 9 lines · Sjoerd Simons
Quoted 7 lines · Joonyoung Shim

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.

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
doc/device-tree-bindings/exynos/emmc-reset.txt new file +0 -0
new file mode 100644
index 0000000..e48e508
Quoted 9 lines

doc/device-tree-bindings/exynos/emmc-reset.txt line 4

Quoted 5 lines
doc/device-tree-bindings/exynos/emmc-reset.txt new file +4 -0
@@ -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.

Nitpick, on XU3 the line you apparently need to twiddle is SD0_nRESET_OUT.

Then, i think it's better to omit "SD4_".

Quoted 11 lines
Quoted 4 lines

Is this type of usage of this pin specific to the Odroid Exynos boards or potentially on more boards? (Sorry for the simple questions, but my exynos documentation just says the line exists not what its intended usage is).

In case of Exynos4, eMMC can be used with sdhci controller or dw-mmc controller. So Pin name should be used to SD0 or SD4.

But Exynos5 is only supported the dw-mmc controller. (So eMMC is used pin-name as "SD0".)

I can find only "SD_4_nRESET_OUT" from exynos4412 user manual and only "SD_0__nRESET_OUT" from exynos5422 user manual.

Quoted 9 lines

Best Regards,
Jaehoon Chung

Quoted 7 lines

Fwiw, I did a quick check in the linux code and it doesn't seem to be using those pins for currently for any boards. However my X2 does successfully reset/reboot in u-boot and linux, so it seems optional there. The XU3 does fail to reset itself, so it seems required for that board.

Quoted 5 lines

I checked upstream u-boot and hardkernel u-boot and i found codes to reset eMMC using gpio.

upstream u-boot: reset_misc() of board/samsung/odroid/odroid.c hardkernel u-boot: reset_cpu() of arch/arm/cpu/armv7/exynos/reset.c

Yeah u-boot does it, but linux upstream kernel does not. Hence wondering about the requirements.

Signature · 9 lines
Sjoerd Simons <[email protected]>
Collabora Ltd.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6170 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150109/c45692aa/attachment.bin>
#18 lore raw

PATCH 1/3 samsung: board: support eMMC reset using DT

Hi Sjoerd,

Quoted 56 lines · Sjoerd Simons
Quoted 55 lines · Joonyoung Shim

Hi,

Quoted 10 lines · Jaehoon Chung
Quoted 9 lines · Sjoerd Simons
Quoted 7 lines · Joonyoung Shim

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.

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
doc/device-tree-bindings/exynos/emmc-reset.txt new file +0 -0
new file mode 100644
index 0000000..e48e508
Quoted 9 lines

doc/device-tree-bindings/exynos/emmc-reset.txt line 4

Quoted 5 lines
doc/device-tree-bindings/exynos/emmc-reset.txt new file +4 -0
@@ -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.

Nitpick, on XU3 the line you apparently need to twiddle is SD0_nRESET_OUT.

Then, i think it's better to omit "SD4_".

Quoted 11 lines
Quoted 4 lines

Is this type of usage of this pin specific to the Odroid Exynos boards or potentially on more boards? (Sorry for the simple questions, but my exynos documentation just says the line exists not what its intended usage is).

In case of Exynos4, eMMC can be used with sdhci controller or dw-mmc controller. So Pin name should be used to SD0 or SD4.

But Exynos5 is only supported the dw-mmc controller. (So eMMC is used pin-name as "SD0".)

I can find only "SD_4_nRESET_OUT" from exynos4412 user manual and only "SD_0__nRESET_OUT" from exynos5422 user manual.

Quoted 9 lines

Best Regards,
Jaehoon Chung

Quoted 7 lines

Fwiw, I did a quick check in the linux code and it doesn't seem to be using those pins for currently for any boards. However my X2 does successfully reset/reboot in u-boot and linux, so it seems optional there. The XU3 does fail to reset itself, so it seems required for that board.

Quoted 9 lines
Quoted 5 lines

I checked upstream u-boot and hardkernel u-boot and i found codes to reset eMMC using gpio.

upstream u-boot: reset_misc() of board/samsung/odroid/odroid.c hardkernel u-boot: reset_cpu() of arch/arm/cpu/armv7/exynos/reset.c

Yeah u-boot does it, but linux upstream kernel does not. Hence wondering about the requirements.

I didn't test Odroid X2 board but my Odroid U3 board cannot reboot without controlling nRESET_OUT gpio on upstream linux kernel.

Thanks.