[U-Boot] [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.
Signed-off-by: Joonyoung Shim jy0922.shim@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>; +};

This needs for special handling of SD4_nRESET_OUT line for eMMC memory to perform complete reboot on Odroid X2/U3 boards.
Signed-off-by: Joonyoung Shim jy0922.shim@samsung.com --- arch/arm/dts/exynos4412-odroid.dts | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/arch/arm/dts/exynos4412-odroid.dts b/arch/arm/dts/exynos4412-odroid.dts index ecb3e23..519a7dd 100644 --- a/arch/arm/dts/exynos4412-odroid.dts +++ b/arch/arm/dts/exynos4412-odroid.dts @@ -90,4 +90,9 @@ reg = <0x125B0000 0x100>; }; }; + + emmc-reset { + compatible = "samsung,emmc-reset"; + reset-gpio = <&gpk1 2 0>; + }; };

Hi,
On 7 January 2015 at 22:44, Joonyoung Shim jy0922.shim@samsung.com wrote:
This needs for special handling of SD4_nRESET_OUT line for eMMC memory to perform complete reboot on Odroid X2/U3 boards.
Signed-off-by: Joonyoung Shim jy0922.shim@samsung.com
arch/arm/dts/exynos4412-odroid.dts | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/arch/arm/dts/exynos4412-odroid.dts b/arch/arm/dts/exynos4412-odroid.dts index ecb3e23..519a7dd 100644 --- a/arch/arm/dts/exynos4412-odroid.dts +++ b/arch/arm/dts/exynos4412-odroid.dts @@ -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

+Cc Jaehoon,
On 01/09/2015 03:20 AM, Simon Glass wrote:
Hi,
On 7 January 2015 at 22:44, Joonyoung Shim jy0922.shim@samsung.com wrote:
This needs for special handling of SD4_nRESET_OUT line for eMMC memory to perform complete reboot on Odroid X2/U3 boards.
Signed-off-by: Joonyoung Shim jy0922.shim@samsung.com
arch/arm/dts/exynos4412-odroid.dts | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/arch/arm/dts/exynos4412-odroid.dts b/arch/arm/dts/exynos4412-odroid.dts index ecb3e23..519a7dd 100644 --- a/arch/arm/dts/exynos4412-odroid.dts +++ b/arch/arm/dts/exynos4412-odroid.dts @@ -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.

This needs for special handling of SD4_nRESET_OUT line for eMMC memory to perform complete reboot on Odroid XU3 board.
Signed-off-by: Joonyoung Shim jy0922.shim@samsung.com --- arch/arm/dts/exynos5422-odroidxu3.dts | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/arch/arm/dts/exynos5422-odroidxu3.dts b/arch/arm/dts/exynos5422-odroidxu3.dts index 8f46637..d0a8621 100644 --- a/arch/arm/dts/exynos5422-odroidxu3.dts +++ b/arch/arm/dts/exynos5422-odroidxu3.dts @@ -46,4 +46,9 @@ mmc@12220000 { fifoth_val = <0x201f0020>; }; + + emmc-reset { + compatible = "samsung,emmc-reset"; + reset-gpio = <&gpd1 0 0>; + }; };

Hi Joonyoung,
On 7 January 2015 at 22:44, Joonyoung Shim jy0922.shim@samsung.com wrote:
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@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
I think all Samsung boards have this defined, so this #ifdef can be removed.
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);
That's a very long reset! Is that what it needs?
dm_gpio_set_value(&gpio, 1);
}
+#else
exynos_reset_misc();
So I don't think you need this function.
+#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
Regards, Simon

+Cc Jaehoon,
On 01/09/2015 03:18 AM, Simon Glass wrote:
Hi Joonyoung,
On 7 January 2015 at 22:44, Joonyoung Shim jy0922.shim@samsung.com wrote:
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@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
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.
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);
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.

On 09/01/15 16:31, Joonyoung Shim wrote:
+Cc Jaehoon,
On 01/09/2015 03:18 AM, Simon Glass wrote:
Hi Joonyoung,
On 7 January 2015 at 22:44, Joonyoung Shim jy0922.shim@samsung.com wrote:
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@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
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.
It's OK.
Thanks, Minkyu Kang.

On 01/09/2015 04:31 PM, Joonyoung Shim wrote:
+Cc Jaehoon,
On 01/09/2015 03:18 AM, Simon Glass wrote:
Hi Joonyoung,
On 7 January 2015 at 22:44, Joonyoung Shim jy0922.shim@samsung.com wrote:
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@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
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.
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);
That's a very long reset! Is that what it needs?
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
Thanks.

On 01/09/2015 08:13 PM, Jaehoon Chung wrote:
On 01/09/2015 04:31 PM, Joonyoung Shim wrote:
+Cc Jaehoon,
On 01/09/2015 03:18 AM, Simon Glass wrote:
Hi Joonyoung,
On 7 January 2015 at 22:44, Joonyoung Shim jy0922.shim@samsung.com wrote:
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@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
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.
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);
That's a very long reset! Is that what it needs?
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.

Hi,
On 9 January 2015 at 23:53, Joonyoung Shim jy0922.shim@samsung.com wrote:
On 01/09/2015 08:13 PM, Jaehoon Chung wrote:
On 01/09/2015 04:31 PM, Joonyoung Shim wrote:
+Cc Jaehoon,
On 01/09/2015 03:18 AM, Simon Glass wrote:
Hi Joonyoung,
On 7 January 2015 at 22:44, Joonyoung Shim jy0922.shim@samsung.com wrote:
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@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
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.
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);
That's a very long reset! Is that what it needs?
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

On 01/11/2015 02:46 AM, Simon Glass wrote:
Hi,
On 9 January 2015 at 23:53, Joonyoung Shim jy0922.shim@samsung.com wrote:
On 01/09/2015 08:13 PM, Jaehoon Chung wrote:
On 01/09/2015 04:31 PM, Joonyoung Shim wrote:
+Cc Jaehoon,
On 01/09/2015 03:18 AM, Simon Glass wrote:
Hi Joonyoung,
On 7 January 2015 at 22:44, Joonyoung Shim jy0922.shim@samsung.com wrote:
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@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
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.
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);
That's a very long reset! Is that what it needs?
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)?
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
Regards, Simon

On 01/12/2015 10:45 AM, Jaehoon Chung wrote:
On 01/11/2015 02:46 AM, Simon Glass wrote:
Hi,
On 9 January 2015 at 23:53, Joonyoung Shim jy0922.shim@samsung.com wrote:
On 01/09/2015 08:13 PM, Jaehoon Chung wrote:
On 01/09/2015 04:31 PM, Joonyoung Shim wrote:
+Cc Jaehoon,
On 01/09/2015 03:18 AM, Simon Glass wrote:
Hi Joonyoung,
On 7 January 2015 at 22:44, Joonyoung Shim jy0922.shim@samsung.com wrote: > 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@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
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.
> + 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);
That's a very long reset! Is that what it needs?
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)?
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.

Hi,
On 11 January 2015 at 20:45, Joonyoung Shim jy0922.shim@samsung.com wrote:
On 01/12/2015 10:45 AM, Jaehoon Chung wrote:
On 01/11/2015 02:46 AM, Simon Glass wrote:
Hi,
On 9 January 2015 at 23:53, Joonyoung Shim jy0922.shim@samsung.com wrote:
On 01/09/2015 08:13 PM, Jaehoon Chung wrote:
On 01/09/2015 04:31 PM, Joonyoung Shim wrote:
+Cc Jaehoon,
On 01/09/2015 03:18 AM, Simon Glass wrote: > Hi Joonyoung, > > On 7 January 2015 at 22:44, Joonyoung Shim jy0922.shim@samsung.com wrote: >> 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@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 > > 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.
>> + 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); > > That's a very long reset! Is that what it needs? >
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)?
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

On Thu, 2015-01-08 at 14:44 +0900, Joonyoung Shim wrote:
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@samsung.com
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.
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.
+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>;
+};

On 01/09/2015 08:23 AM, Sjoerd Simons wrote:
On Thu, 2015-01-08 at 14:44 +0900, Joonyoung Shim wrote:
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@samsung.com
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.
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).
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
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.
+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@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

Hi,
On 01/09/2015 01:21 PM, Jaehoon Chung wrote:
On 01/09/2015 08:23 AM, Sjoerd Simons wrote:
On Thu, 2015-01-08 at 14:44 +0900, Joonyoung Shim wrote:
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@samsung.com
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.
Nitpick, on XU3 the line you apparently need to twiddle is SD0_nRESET_OUT.
Then, i think it's better to omit "SD4_".
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.
Best Regards, Jaehoon Chung
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.

On Fri, 2015-01-09 at 16:42 +0900, Joonyoung Shim wrote:
Hi,
On 01/09/2015 01:21 PM, Jaehoon Chung wrote:
On 01/09/2015 08:23 AM, Sjoerd Simons wrote:
On Thu, 2015-01-08 at 14:44 +0900, Joonyoung Shim wrote:
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@samsung.com
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.
Nitpick, on XU3 the line you apparently need to twiddle is SD0_nRESET_OUT.
Then, i think it's better to omit "SD4_".
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.
Best Regards, Jaehoon Chung
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
Yeah u-boot does it, but linux upstream kernel does not. Hence wondering about the requirements.

Hi Sjoerd,
On 01/09/2015 04:50 PM, Sjoerd Simons wrote:
On Fri, 2015-01-09 at 16:42 +0900, Joonyoung Shim wrote:
Hi,
On 01/09/2015 01:21 PM, Jaehoon Chung wrote:
On 01/09/2015 08:23 AM, Sjoerd Simons wrote:
On Thu, 2015-01-08 at 14:44 +0900, Joonyoung Shim wrote:
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@samsung.com
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.
Nitpick, on XU3 the line you apparently need to twiddle is SD0_nRESET_OUT.
Then, i think it's better to omit "SD4_".
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.
Best Regards, Jaehoon Chung
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
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.
participants (5)
-
Jaehoon Chung
-
Joonyoung Shim
-
Minkyu Kang
-
Simon Glass
-
Sjoerd Simons