diff mbox

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

Message ID 1420695867-1621-1-git-send-email-jy0922.shim@samsung.com
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Commit Message

Joonyoung Shim Jan. 8, 2015, 5:44 a.m. UTC
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

Comments

Simon Glass Jan. 8, 2015, 6:18 p.m. UTC | #1
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
Sjoerd Simons Jan. 8, 2015, 11:23 p.m. UTC | #2
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>;
> +};
Jaehoon Chung Jan. 9, 2015, 4:21 a.m. UTC | #3
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
>
Joonyoung Shim Jan. 9, 2015, 7:31 a.m. UTC | #4
+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.
Joonyoung Shim Jan. 9, 2015, 7:42 a.m. UTC | #5
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.
Minkyu Kang Jan. 9, 2015, 7:48 a.m. UTC | #6
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.
Sjoerd Simons Jan. 9, 2015, 7:50 a.m. UTC | #7
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.
Jaehoon Chung Jan. 9, 2015, 11:13 a.m. UTC | #8
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.
>
Joonyoung Shim Jan. 10, 2015, 6:41 a.m. UTC | #9
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.
Joonyoung Shim Jan. 10, 2015, 6:53 a.m. UTC | #10
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.
Simon Glass Jan. 10, 2015, 5:46 p.m. UTC | #11
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
Jaehoon Chung Jan. 12, 2015, 1:45 a.m. UTC | #12
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
>
Joonyoung Shim Jan. 12, 2015, 4:45 a.m. UTC | #13
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.
Simon Glass Jan. 12, 2015, 3:54 p.m. UTC | #14
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
diff mbox

Patch

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>;
+};