From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jaehoon Chung Date: Tue, 19 Jul 2016 13:22:34 +0900 Subject: [U-Boot] [PATCH] mmc: dw_mmc: reduce timeout detection cycle In-Reply-To: <578D9160.1030005@rock-chips.com> References: <1468892302-3956-1-git-send-email-xzy.xu@rock-chips.com> <578D8A57.7000404@samsung.com> <578D9160.1030005@rock-chips.com> Message-ID: <578DAB0A.4060606@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 Hi Ziyuan, On 07/19/2016 11:33 AM, Ziyuan Xu wrote: > Hi Jaehoon, > > On 2016?07?19? 10:03, Jaehoon Chung wrote: >> Hi Ziyuan, >> >> On 07/19/2016 10:38 AM, Ziyuan Xu wrote: >>> It's no need to speed 10 seconds to wait the mmc device out from busy >>> status. 500 milliseconds enough. >> I agreed that 10 seconds is too big.. >> Could you explain more how you get 500ms and feel enough? > Ordinarily, there are 3 types of scenarios that the mmc device was busy: > 1. The mmc interface didn't initialize (eg. gpio iomux) > The device will be busy status until gpio iomux. > > 2. The last command with data transfer. > The maximum value of data timeout is 0xffffff cyles(see dwi databook Timeout Register), and the clock is up to 52MHZ under high speed mode. > timeout = 0xffffff * 1/52M = 0.32s > > 3. voltage switch > U-BOOT doesn't support voltage switch. > > In summary, I think 500 milliseconds is enough. What do you think? I think it's not important thing. This is for checking whether card is busy or not before sending command. I think it's not relevant to Timeout register. Just ensure that card is not busy before sending command. And there is no effect for I/O performance, isn't? But 50ms is not bad. :) It's personal preference. Best Regards, Jaehoon Chung > >> >> Best Regards, >> Jaehoon Chung >> >>> Signed-off-by: Ziyuan Xu >>> --- >>> >>> drivers/mmc/dw_mmc.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c >>> index 2cf7bae..790a166 100644 >>> --- a/drivers/mmc/dw_mmc.c >>> +++ b/drivers/mmc/dw_mmc.c >>> @@ -195,7 +195,7 @@ static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, >>> ALLOC_CACHE_ALIGN_BUFFER(struct dwmci_idmac, cur_idmac, >>> data ? DIV_ROUND_UP(data->blocks, 8) : 0); >>> int ret = 0, flags = 0, i; >>> - unsigned int timeout = 100000; >>> + unsigned int timeout = 500; >>> u32 retry = 100000; >>> u32 mask, ctrl; >>> ulong start = get_timer(0); >>> >> >> >> > > > > >