ixp4xx: remove linux 3.10 support
[openwrt.git] / target / linux / brcm2708 / patches-3.10 / 0182-fix-sign-in-sdhci_bcm2708_raw_writel-wait-calculatio.patch
1 From c62717f4dbf933743d3bcde958062d790587ecef Mon Sep 17 00:00:00 2001
2 From: Matt Whitlock <raspberrypi@mattwhitlock.name>
3 Date: Tue, 25 Mar 2014 03:45:21 -0400
4 Subject: [PATCH 182/196] fix sign in sdhci_bcm2708_raw_writel wait calculation
5
6 The ns_wait variable is intended to hold a lower bound on the number of nanoseconds that have elapsed since the last sdhci register write. However, the actual calculation of it was incorrect, as the subtraction was inverted. This commit fixes the calculation.
7
8 Note that this correction has no bearing when running with the default cycle_delay of 2 and the default clock rate of 50 MHz, under which conditions ns_2clk is 40 nanoseconds and ns_wait, regardless of whether the subtraction is done correctly or incorrectly, cannot possibly be less than 40 except for during the one-microsecond period just before the tick counter wraps around to meet last_write_hpt (i.e., approximately 4295 seconds after the preceding sdhci register write). The correction in this commit only comes into play if ns_2clk > 1000, which requires a cycle_delay of 51 or greater when using the default clock rate. Under those conditions, sdhci_bcm2708_raw_writel will not wait for the full cycle_delay count if at least 1000 nanoseconds have elapsed since the last register write.
9 ---
10  drivers/mmc/host/sdhci-bcm2708.c | 2 +-
11  1 file changed, 1 insertion(+), 1 deletion(-)
12
13 diff --git a/drivers/mmc/host/sdhci-bcm2708.c b/drivers/mmc/host/sdhci-bcm2708.c
14 index 2797ae6..9beab6a 100644
15 --- a/drivers/mmc/host/sdhci-bcm2708.c
16 +++ b/drivers/mmc/host/sdhci-bcm2708.c
17 @@ -263,7 +263,7 @@ static void sdhci_bcm2708_raw_writel(struct sdhci_host *host, u32 val, int reg)
18                 {
19                         /* we must have waited at least this many ns: */
20                         unsigned int ns_wait = HPTIME_CLK_NS *
21 -                                              (last_write_hpt - now - 1);
22 +                                              (now - last_write_hpt - 1);
23                         if (ns_wait < ns_2clk)
24                                 ndelay(ns_2clk - ns_wait);
25                 }
26 -- 
27 1.9.1
28