From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joonyoung Shim Date: Mon, 12 Jan 2015 13:45:23 +0900 Subject: [U-Boot] [PATCH 1/3] samsung: board: support eMMC reset using DT In-Reply-To: <54B3273E.1050609@samsung.com> References: <1420695867-1621-1-git-send-email-jy0922.shim@samsung.com> <54AF83BE.2050905@samsung.com> <54AFB7D6.3070307@samsung.com> <54B0CC5A.6030305@samsung.com> <54B3273E.1050609@samsung.com> Message-ID: <54B35163.5000408@samsung.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 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 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 >>>>>>> --- >>>>>>> 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.