From mboxrd@z Thu Jan 1 00:00:00 1970 From: Przemyslaw Marczak Date: Tue, 01 Oct 2013 18:59:14 +0200 Subject: [U-Boot] [PATCH] mmc: sdhci: Avoid commands errors by simple timeout adaptation. In-Reply-To: References: <1380629761-16502-1-git-send-email-p.marczak@samsung.com> Message-ID: <524AFF62.7030706@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 Hello Pantelis, Thank you for reply On 10/01/2013 05:50 PM, Pantelis Antoniou wrote: > while (sdhci_readl(host, SDHCI_PRESENT_STATE) & mask) { > - if (timeout == 0) { > + if (time == cmd_timeout) { > time >= cmd_timeout here. > > You rely on the timeout hitting exactly the same value which is not > guaranteed. I think this condition is guaranteed here, because of "time" value that is incremented only inside the loop. Also if meets (time == cmd_timeout) condition and next if timeout will be increased twice, then eg. if current timeout is 100ms -> next will be 200 ms, so it needs 100 loops and no more. Am I wrong? Regards -- Przemyslaw Marczak Samsung R&D Institute Poland Samsung Electronics p.marczak at samsung.com