aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-25 18:04:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-25 18:04:18 -0500
commit6663050edd9c2e8b1e1f55c09459144d84c045f0 (patch)
treef683d34d517465d62dcf2fd311f8f6e5d7e736b0
parent3af03655e885ba7f48ca6318e231a7086a51082e (diff)
parent2f8e7285606bcdf8f574bff633675eabcee83d5e (diff)
Merge branch 'fixes' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'fixes' of master.kernel.org:/home/rmk/linux-2.6-arm: ALSA: AACI: fix timeout duration ALSA: AACI: fix timeout condition checking ARM: 6636/1: ep93xx: default multiplexed gpio ports to gpio mode ARM: 6637/1: Make the argument to virt_to_phys() "const volatile" ARM: twd: ensure timer reload is reprogrammed on entry to periodic mode ARM: 6635/2: Configure reference clock for Versatile Express timers ARM: versatile: name configuration options after actual board names ARM: realview: name configuration options after actual board names ARM: realview,vexpress: fix section mismatch warning for pen_release ARM: 6632/3: mmci: stop using the blockend interrupts
-rw-r--r--arch/arm/include/asm/hardware/sp810.h6
-rw-r--r--arch/arm/include/asm/memory.h2
-rw-r--r--arch/arm/kernel/smp_twd.c7
-rw-r--r--arch/arm/mach-ep93xx/gpio.c7
-rw-r--r--arch/arm/mach-realview/Kconfig49
-rw-r--r--arch/arm/mach-realview/platsmp.c2
-rw-r--r--arch/arm/mach-versatile/Kconfig10
-rw-r--r--arch/arm/mach-vexpress/platsmp.c2
-rw-r--r--arch/arm/mach-vexpress/v2m.c9
-rw-r--r--drivers/mmc/host/mmci.c98
-rw-r--r--drivers/mmc/host/mmci.h5
-rw-r--r--sound/arm/aaci.c48
12 files changed, 107 insertions, 138 deletions
diff --git a/arch/arm/include/asm/hardware/sp810.h b/arch/arm/include/asm/hardware/sp810.h
index a101f10bb5b1..721847dc68ab 100644
--- a/arch/arm/include/asm/hardware/sp810.h
+++ b/arch/arm/include/asm/hardware/sp810.h
@@ -50,6 +50,12 @@
50#define SCPCELLID2 0xFF8 50#define SCPCELLID2 0xFF8
51#define SCPCELLID3 0xFFC 51#define SCPCELLID3 0xFFC
52 52
53#define SCCTRL_TIMEREN0SEL_REFCLK (0 << 15)
54#define SCCTRL_TIMEREN0SEL_TIMCLK (1 << 15)
55
56#define SCCTRL_TIMEREN1SEL_REFCLK (0 << 17)
57#define SCCTRL_TIMEREN1SEL_TIMCLK (1 << 17)
58
53static inline void sysctl_soft_reset(void __iomem *base) 59static inline void sysctl_soft_reset(void __iomem *base)
54{ 60{
55 /* writing any value to SCSYSSTAT reg will reset system */ 61 /* writing any value to SCSYSSTAT reg will reset system */
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 23c2e8e5c0fa..d0ee74b7cf86 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -188,7 +188,7 @@
188 * translation for translating DMA addresses. Use the driver 188 * translation for translating DMA addresses. Use the driver
189 * DMA support - see dma-mapping.h. 189 * DMA support - see dma-mapping.h.
190 */ 190 */
191static inline unsigned long virt_to_phys(void *x) 191static inline unsigned long virt_to_phys(const volatile void *x)
192{ 192{
193 return __virt_to_phys((unsigned long)(x)); 193 return __virt_to_phys((unsigned long)(x));
194} 194}
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index fd9156698ab9..60636f499cb3 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -36,6 +36,7 @@ static void twd_set_mode(enum clock_event_mode mode,
36 /* timer load already set up */ 36 /* timer load already set up */
37 ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE 37 ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE
38 | TWD_TIMER_CONTROL_PERIODIC; 38 | TWD_TIMER_CONTROL_PERIODIC;
39 __raw_writel(twd_timer_rate / HZ, twd_base + TWD_TIMER_LOAD);
39 break; 40 break;
40 case CLOCK_EVT_MODE_ONESHOT: 41 case CLOCK_EVT_MODE_ONESHOT:
41 /* period set, and timer enabled in 'next_event' hook */ 42 /* period set, and timer enabled in 'next_event' hook */
@@ -81,7 +82,7 @@ int twd_timer_ack(void)
81 82
82static void __cpuinit twd_calibrate_rate(void) 83static void __cpuinit twd_calibrate_rate(void)
83{ 84{
84 unsigned long load, count; 85 unsigned long count;
85 u64 waitjiffies; 86 u64 waitjiffies;
86 87
87 /* 88 /*
@@ -116,10 +117,6 @@ static void __cpuinit twd_calibrate_rate(void)
116 printk("%lu.%02luMHz.\n", twd_timer_rate / 1000000, 117 printk("%lu.%02luMHz.\n", twd_timer_rate / 1000000,
117 (twd_timer_rate / 1000000) % 100); 118 (twd_timer_rate / 1000000) % 100);
118 } 119 }
119
120 load = twd_timer_rate / HZ;
121
122 __raw_writel(load, twd_base + TWD_TIMER_LOAD);
123} 120}
124 121
125/* 122/*
diff --git a/arch/arm/mach-ep93xx/gpio.c b/arch/arm/mach-ep93xx/gpio.c
index f3dc76fdcea8..bec34b834958 100644
--- a/arch/arm/mach-ep93xx/gpio.c
+++ b/arch/arm/mach-ep93xx/gpio.c
@@ -427,6 +427,13 @@ void __init ep93xx_gpio_init(void)
427{ 427{
428 int i; 428 int i;
429 429
430 /* Set Ports C, D, E, G, and H for GPIO use */
431 ep93xx_devcfg_set_bits(EP93XX_SYSCON_DEVCFG_KEYS |
432 EP93XX_SYSCON_DEVCFG_GONK |
433 EP93XX_SYSCON_DEVCFG_EONIDE |
434 EP93XX_SYSCON_DEVCFG_GONIDE |
435 EP93XX_SYSCON_DEVCFG_HONIDE);
436
430 for (i = 0; i < ARRAY_SIZE(ep93xx_gpio_banks); i++) 437 for (i = 0; i < ARRAY_SIZE(ep93xx_gpio_banks); i++)
431 gpiochip_add(&ep93xx_gpio_banks[i].chip); 438 gpiochip_add(&ep93xx_gpio_banks[i].chip);
432} 439}
diff --git a/arch/arm/mach-realview/Kconfig b/arch/arm/mach-realview/Kconfig
index b4575ae9648e..7ca138a943a9 100644
--- a/arch/arm/mach-realview/Kconfig
+++ b/arch/arm/mach-realview/Kconfig
@@ -2,52 +2,56 @@ menu "RealView platform type"
2 depends on ARCH_REALVIEW 2 depends on ARCH_REALVIEW
3 3
4config MACH_REALVIEW_EB 4config MACH_REALVIEW_EB
5 bool "Support RealView/EB platform" 5 bool "Support RealView(R) Emulation Baseboard"
6 select ARM_GIC 6 select ARM_GIC
7 help 7 help
8 Include support for the ARM(R) RealView Emulation Baseboard platform. 8 Include support for the ARM(R) RealView(R) Emulation Baseboard
9 platform.
9 10
10config REALVIEW_EB_A9MP 11config REALVIEW_EB_A9MP
11 bool "Support Multicore Cortex-A9" 12 bool "Support Multicore Cortex-A9 Tile"
12 depends on MACH_REALVIEW_EB 13 depends on MACH_REALVIEW_EB
13 select CPU_V7 14 select CPU_V7
14 help 15 help
15 Enable support for the Cortex-A9MPCore tile on the Realview platform. 16 Enable support for the Cortex-A9MPCore tile fitted to the
17 Realview(R) Emulation Baseboard platform.
16 18
17config REALVIEW_EB_ARM11MP 19config REALVIEW_EB_ARM11MP
18 bool "Support ARM11MPCore tile" 20 bool "Support ARM11MPCore Tile"
19 depends on MACH_REALVIEW_EB 21 depends on MACH_REALVIEW_EB
20 select CPU_V6 22 select CPU_V6
21 select ARCH_HAS_BARRIERS if SMP 23 select ARCH_HAS_BARRIERS if SMP
22 help 24 help
23 Enable support for the ARM11MPCore tile on the Realview platform. 25 Enable support for the ARM11MPCore tile fitted to the Realview(R)
26 Emulation Baseboard platform.
24 27
25config REALVIEW_EB_ARM11MP_REVB 28config REALVIEW_EB_ARM11MP_REVB
26 bool "Support ARM11MPCore RevB tile" 29 bool "Support ARM11MPCore RevB Tile"
27 depends on REALVIEW_EB_ARM11MP 30 depends on REALVIEW_EB_ARM11MP
28 help 31 help
29 Enable support for the ARM11MPCore RevB tile on the Realview 32 Enable support for the ARM11MPCore Revision B tile on the
30 platform. Since there are device address differences, a 33 Realview(R) Emulation Baseboard platform. Since there are device
31 kernel built with this option enabled is not compatible with 34 address differences, a kernel built with this option enabled is
32 other revisions of the ARM11MPCore tile. 35 not compatible with other revisions of the ARM11MPCore tile.
33 36
34config MACH_REALVIEW_PB11MP 37config MACH_REALVIEW_PB11MP
35 bool "Support RealView/PB11MPCore platform" 38 bool "Support RealView(R) Platform Baseboard for ARM11MPCore"
36 select CPU_V6 39 select CPU_V6
37 select ARM_GIC 40 select ARM_GIC
38 select HAVE_PATA_PLATFORM 41 select HAVE_PATA_PLATFORM
39 select ARCH_HAS_BARRIERS if SMP 42 select ARCH_HAS_BARRIERS if SMP
40 help 43 help
41 Include support for the ARM(R) RealView MPCore Platform Baseboard. 44 Include support for the ARM(R) RealView(R) Platform Baseboard for
42 PB11MPCore is a platform with an on-board ARM11MPCore and has 45 the ARM11MPCore. This platform has an on-board ARM11MPCore and has
43 support for PCI-E and Compact Flash. 46 support for PCI-E and Compact Flash.
44 47
45config MACH_REALVIEW_PB1176 48config MACH_REALVIEW_PB1176
46 bool "Support RealView/PB1176 platform" 49 bool "Support RealView(R) Platform Baseboard for ARM1176JZF-S"
47 select CPU_V6 50 select CPU_V6
48 select ARM_GIC 51 select ARM_GIC
49 help 52 help
50 Include support for the ARM(R) RealView ARM1176 Platform Baseboard. 53 Include support for the ARM(R) RealView(R) Platform Baseboard for
54 ARM1176JZF-S.
51 55
52config REALVIEW_PB1176_SECURE_FLASH 56config REALVIEW_PB1176_SECURE_FLASH
53 bool "Allow access to the secure flash memory block" 57 bool "Allow access to the secure flash memory block"
@@ -59,23 +63,24 @@ config REALVIEW_PB1176_SECURE_FLASH
59 block (64MB @ 0x3c000000) is required. 63 block (64MB @ 0x3c000000) is required.
60 64
61config MACH_REALVIEW_PBA8 65config MACH_REALVIEW_PBA8
62 bool "Support RealView/PB-A8 platform" 66 bool "Support RealView(R) Platform Baseboard for Cortex(tm)-A8 platform"
63 select CPU_V7 67 select CPU_V7
64 select ARM_GIC 68 select ARM_GIC
65 select HAVE_PATA_PLATFORM 69 select HAVE_PATA_PLATFORM
66 help 70 help
67 Include support for the ARM(R) RealView Cortex-A8 Platform Baseboard. 71 Include support for the ARM(R) RealView Platform Baseboard for
68 PB-A8 is a platform with an on-board Cortex-A8 and has support for 72 Cortex(tm)-A8. This platform has an on-board Cortex-A8 and has
69 PCI-E and Compact Flash. 73 support for PCI-E and Compact Flash.
70 74
71config MACH_REALVIEW_PBX 75config MACH_REALVIEW_PBX
72 bool "Support RealView/PBX platform" 76 bool "Support RealView(R) Platform Baseboard Explore"
73 select ARM_GIC 77 select ARM_GIC
74 select HAVE_PATA_PLATFORM 78 select HAVE_PATA_PLATFORM
75 select ARCH_SPARSEMEM_ENABLE if CPU_V7 && !REALVIEW_HIGH_PHYS_OFFSET 79 select ARCH_SPARSEMEM_ENABLE if CPU_V7 && !REALVIEW_HIGH_PHYS_OFFSET
76 select ZONE_DMA if SPARSEMEM 80 select ZONE_DMA if SPARSEMEM
77 help 81 help
78 Include support for the ARM(R) RealView PBX platform. 82 Include support for the ARM(R) RealView(R) Platform Baseboard
83 Explore.
79 84
80config REALVIEW_HIGH_PHYS_OFFSET 85config REALVIEW_HIGH_PHYS_OFFSET
81 bool "High physical base address for the RealView platform" 86 bool "High physical base address for the RealView platform"
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index a22bf67f2f78..6959d13d908a 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -41,7 +41,7 @@ volatile int __cpuinitdata pen_release = -1;
41 * observers, irrespective of whether they're taking part in coherency 41 * observers, irrespective of whether they're taking part in coherency
42 * or not. This is necessary for the hotplug code to work reliably. 42 * or not. This is necessary for the hotplug code to work reliably.
43 */ 43 */
44static void write_pen_release(int val) 44static void __cpuinit write_pen_release(int val)
45{ 45{
46 pen_release = val; 46 pen_release = val;
47 smp_wmb(); 47 smp_wmb();
diff --git a/arch/arm/mach-versatile/Kconfig b/arch/arm/mach-versatile/Kconfig
index 3f7b5e9d83c5..9cdec5aa04a0 100644
--- a/arch/arm/mach-versatile/Kconfig
+++ b/arch/arm/mach-versatile/Kconfig
@@ -2,17 +2,19 @@ menu "Versatile platform type"
2 depends on ARCH_VERSATILE 2 depends on ARCH_VERSATILE
3 3
4config ARCH_VERSATILE_PB 4config ARCH_VERSATILE_PB
5 bool "Support Versatile/PB platform" 5 bool "Support Versatile Platform Baseboard for ARM926EJ-S"
6 select CPU_ARM926T 6 select CPU_ARM926T
7 select MIGHT_HAVE_PCI 7 select MIGHT_HAVE_PCI
8 default y 8 default y
9 help 9 help
10 Include support for the ARM(R) Versatile/PB platform. 10 Include support for the ARM(R) Versatile Platform Baseboard
11 for the ARM926EJ-S.
11 12
12config MACH_VERSATILE_AB 13config MACH_VERSATILE_AB
13 bool "Support Versatile/AB platform" 14 bool "Support Versatile Application Baseboard for ARM926EJ-S"
14 select CPU_ARM926T 15 select CPU_ARM926T
15 help 16 help
16 Include support for the ARM(R) Versatile/AP platform. 17 Include support for the ARM(R) Versatile Application Baseboard
18 for the ARM926EJ-S.
17 19
18endmenu 20endmenu
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index b1687b6abe63..634bf1d3a311 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -39,7 +39,7 @@ volatile int __cpuinitdata pen_release = -1;
39 * observers, irrespective of whether they're taking part in coherency 39 * observers, irrespective of whether they're taking part in coherency
40 * or not. This is necessary for the hotplug code to work reliably. 40 * or not. This is necessary for the hotplug code to work reliably.
41 */ 41 */
42static void write_pen_release(int val) 42static void __cpuinit write_pen_release(int val)
43{ 43{
44 pen_release = val; 44 pen_release = val;
45 smp_wmb(); 45 smp_wmb();
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index a9ed3428a2fa..1edae65a0e72 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -19,6 +19,7 @@
19#include <asm/mach/time.h> 19#include <asm/mach/time.h>
20#include <asm/hardware/arm_timer.h> 20#include <asm/hardware/arm_timer.h>
21#include <asm/hardware/timer-sp.h> 21#include <asm/hardware/timer-sp.h>
22#include <asm/hardware/sp810.h>
22 23
23#include <mach/motherboard.h> 24#include <mach/motherboard.h>
24 25
@@ -50,8 +51,16 @@ void __init v2m_map_io(struct map_desc *tile, size_t num)
50 51
51static void __init v2m_timer_init(void) 52static void __init v2m_timer_init(void)
52{ 53{
54 u32 scctrl;
55
53 versatile_sched_clock_init(MMIO_P2V(V2M_SYS_24MHZ), 24000000); 56 versatile_sched_clock_init(MMIO_P2V(V2M_SYS_24MHZ), 24000000);
54 57
58 /* Select 1MHz TIMCLK as the reference clock for SP804 timers */
59 scctrl = readl(MMIO_P2V(V2M_SYSCTL + SCCTRL));
60 scctrl |= SCCTRL_TIMEREN0SEL_TIMCLK;
61 scctrl |= SCCTRL_TIMEREN1SEL_TIMCLK;
62 writel(scctrl, MMIO_P2V(V2M_SYSCTL + SCCTRL));
63
55 writel(0, MMIO_P2V(V2M_TIMER0) + TIMER_CTRL); 64 writel(0, MMIO_P2V(V2M_TIMER0) + TIMER_CTRL);
56 writel(0, MMIO_P2V(V2M_TIMER1) + TIMER_CTRL); 65 writel(0, MMIO_P2V(V2M_TIMER1) + TIMER_CTRL);
57 66
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 563022825667..2de12fe155da 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -46,10 +46,6 @@ static unsigned int fmax = 515633;
46 * is asserted (likewise for RX) 46 * is asserted (likewise for RX)
47 * @fifohalfsize: number of bytes that can be written when MCI_TXFIFOHALFEMPTY 47 * @fifohalfsize: number of bytes that can be written when MCI_TXFIFOHALFEMPTY
48 * is asserted (likewise for RX) 48 * is asserted (likewise for RX)
49 * @broken_blockend: the MCI_DATABLOCKEND is broken on the hardware
50 * and will not work at all.
51 * @broken_blockend_dma: the MCI_DATABLOCKEND is broken on the hardware when
52 * using DMA.
53 * @sdio: variant supports SDIO 49 * @sdio: variant supports SDIO
54 * @st_clkdiv: true if using a ST-specific clock divider algorithm 50 * @st_clkdiv: true if using a ST-specific clock divider algorithm
55 */ 51 */
@@ -59,8 +55,6 @@ struct variant_data {
59 unsigned int datalength_bits; 55 unsigned int datalength_bits;
60 unsigned int fifosize; 56 unsigned int fifosize;
61 unsigned int fifohalfsize; 57 unsigned int fifohalfsize;
62 bool broken_blockend;
63 bool broken_blockend_dma;
64 bool sdio; 58 bool sdio;
65 bool st_clkdiv; 59 bool st_clkdiv;
66}; 60};
@@ -76,7 +70,6 @@ static struct variant_data variant_u300 = {
76 .fifohalfsize = 8 * 4, 70 .fifohalfsize = 8 * 4,
77 .clkreg_enable = 1 << 13, /* HWFCEN */ 71 .clkreg_enable = 1 << 13, /* HWFCEN */
78 .datalength_bits = 16, 72 .datalength_bits = 16,
79 .broken_blockend_dma = true,
80 .sdio = true, 73 .sdio = true,
81}; 74};
82 75
@@ -86,7 +79,6 @@ static struct variant_data variant_ux500 = {
86 .clkreg = MCI_CLK_ENABLE, 79 .clkreg = MCI_CLK_ENABLE,
87 .clkreg_enable = 1 << 14, /* HWFCEN */ 80 .clkreg_enable = 1 << 14, /* HWFCEN */
88 .datalength_bits = 24, 81 .datalength_bits = 24,
89 .broken_blockend = true,
90 .sdio = true, 82 .sdio = true,
91 .st_clkdiv = true, 83 .st_clkdiv = true,
92}; 84};
@@ -210,8 +202,6 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
210 host->data = data; 202 host->data = data;
211 host->size = data->blksz * data->blocks; 203 host->size = data->blksz * data->blocks;
212 host->data_xfered = 0; 204 host->data_xfered = 0;
213 host->blockend = false;
214 host->dataend = false;
215 205
216 mmci_init_sg(host, data); 206 mmci_init_sg(host, data);
217 207
@@ -288,21 +278,26 @@ static void
288mmci_data_irq(struct mmci_host *host, struct mmc_data *data, 278mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
289 unsigned int status) 279 unsigned int status)
290{ 280{
291 struct variant_data *variant = host->variant;
292
293 /* First check for errors */ 281 /* First check for errors */
294 if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|MCI_RXOVERRUN)) { 282 if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|MCI_RXOVERRUN)) {
283 u32 remain, success;
284
285 /* Calculate how far we are into the transfer */
286 remain = readl(host->base + MMCIDATACNT) << 2;
287 success = data->blksz * data->blocks - remain;
288
295 dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); 289 dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status);
296 if (status & MCI_DATACRCFAIL) 290 if (status & MCI_DATACRCFAIL) {
291 /* Last block was not successful */
292 host->data_xfered = ((success / data->blksz) - 1 * data->blksz);
297 data->error = -EILSEQ; 293 data->error = -EILSEQ;
298 else if (status & MCI_DATATIMEOUT) 294 } else if (status & MCI_DATATIMEOUT) {
295 host->data_xfered = success;
299 data->error = -ETIMEDOUT; 296 data->error = -ETIMEDOUT;
300 else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) 297 } else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) {
298 host->data_xfered = success;
301 data->error = -EIO; 299 data->error = -EIO;
302 300 }
303 /* Force-complete the transaction */
304 host->blockend = true;
305 host->dataend = true;
306 301
307 /* 302 /*
308 * We hit an error condition. Ensure that any data 303 * We hit an error condition. Ensure that any data
@@ -321,61 +316,14 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
321 } 316 }
322 } 317 }
323 318
324 /* 319 if (status & MCI_DATABLOCKEND)
325 * On ARM variants in PIO mode, MCI_DATABLOCKEND 320 dev_err(mmc_dev(host->mmc), "stray MCI_DATABLOCKEND interrupt\n");
326 * is always sent first, and we increase the
327 * transfered number of bytes for that IRQ. Then
328 * MCI_DATAEND follows and we conclude the transaction.
329 *
330 * On the Ux500 single-IRQ variant MCI_DATABLOCKEND
331 * doesn't seem to immediately clear from the status,
332 * so we can't use it keep count when only one irq is
333 * used because the irq will hit for other reasons, and
334 * then the flag is still up. So we use the MCI_DATAEND
335 * IRQ at the end of the entire transfer because
336 * MCI_DATABLOCKEND is broken.
337 *
338 * In the U300, the IRQs can arrive out-of-order,
339 * e.g. MCI_DATABLOCKEND sometimes arrives after MCI_DATAEND,
340 * so for this case we use the flags "blockend" and
341 * "dataend" to make sure both IRQs have arrived before
342 * concluding the transaction. (This does not apply
343 * to the Ux500 which doesn't fire MCI_DATABLOCKEND
344 * at all.) In DMA mode it suffers from the same problem
345 * as the Ux500.
346 */
347 if (status & MCI_DATABLOCKEND) {
348 /*
349 * Just being a little over-cautious, we do not
350 * use this progressive update if the hardware blockend
351 * flag is unreliable: since it can stay high between
352 * IRQs it will corrupt the transfer counter.
353 */
354 if (!variant->broken_blockend)
355 host->data_xfered += data->blksz;
356 host->blockend = true;
357 }
358
359 if (status & MCI_DATAEND)
360 host->dataend = true;
361 321
362 /* 322 if (status & MCI_DATAEND) {
363 * On variants with broken blockend we shall only wait for dataend,
364 * on others we must sync with the blockend signal since they can
365 * appear out-of-order.
366 */
367 if (host->dataend && (host->blockend || variant->broken_blockend)) {
368 mmci_stop_data(host); 323 mmci_stop_data(host);
369 324
370 /* Reset these flags */ 325 if (!data->error)
371 host->blockend = false; 326 /* The error clause is handled above, success! */
372 host->dataend = false;
373
374 /*
375 * Variants with broken blockend flags need to handle the
376 * end of the entire transfer here.
377 */
378 if (variant->broken_blockend && !data->error)
379 host->data_xfered += data->blksz * data->blocks; 327 host->data_xfered += data->blksz * data->blocks;
380 328
381 if (!data->stop) { 329 if (!data->stop) {
@@ -770,7 +718,6 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
770 struct variant_data *variant = id->data; 718 struct variant_data *variant = id->data;
771 struct mmci_host *host; 719 struct mmci_host *host;
772 struct mmc_host *mmc; 720 struct mmc_host *mmc;
773 unsigned int mask;
774 int ret; 721 int ret;
775 722
776 /* must have platform data */ 723 /* must have platform data */
@@ -951,12 +898,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
951 goto irq0_free; 898 goto irq0_free;
952 } 899 }
953 900
954 mask = MCI_IRQENABLE; 901 writel(MCI_IRQENABLE, host->base + MMCIMASK0);
955 /* Don't use the datablockend flag if it's broken */
956 if (variant->broken_blockend)
957 mask &= ~MCI_DATABLOCKEND;
958
959 writel(mask, host->base + MMCIMASK0);
960 902
961 amba_set_drvdata(dev, mmc); 903 amba_set_drvdata(dev, mmc);
962 904
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
index df06f01aac89..c1df7b82d36c 100644
--- a/drivers/mmc/host/mmci.h
+++ b/drivers/mmc/host/mmci.h
@@ -137,7 +137,7 @@
137#define MCI_IRQENABLE \ 137#define MCI_IRQENABLE \
138 (MCI_CMDCRCFAILMASK|MCI_DATACRCFAILMASK|MCI_CMDTIMEOUTMASK| \ 138 (MCI_CMDCRCFAILMASK|MCI_DATACRCFAILMASK|MCI_CMDTIMEOUTMASK| \
139 MCI_DATATIMEOUTMASK|MCI_TXUNDERRUNMASK|MCI_RXOVERRUNMASK| \ 139 MCI_DATATIMEOUTMASK|MCI_TXUNDERRUNMASK|MCI_RXOVERRUNMASK| \
140 MCI_CMDRESPENDMASK|MCI_CMDSENTMASK|MCI_DATABLOCKENDMASK) 140 MCI_CMDRESPENDMASK|MCI_CMDSENTMASK)
141 141
142/* These interrupts are directed to IRQ1 when two IRQ lines are available */ 142/* These interrupts are directed to IRQ1 when two IRQ lines are available */
143#define MCI_IRQ1MASK \ 143#define MCI_IRQ1MASK \
@@ -177,9 +177,6 @@ struct mmci_host {
177 struct timer_list timer; 177 struct timer_list timer;
178 unsigned int oldstat; 178 unsigned int oldstat;
179 179
180 bool blockend;
181 bool dataend;
182
183 /* pio stuff */ 180 /* pio stuff */
184 struct sg_mapping_iter sg_miter; 181 struct sg_mapping_iter sg_miter;
185 unsigned int size; 182 unsigned int size;
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 91acc9a243ec..24d3013c0231 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -30,6 +30,8 @@
30 30
31#define DRIVER_NAME "aaci-pl041" 31#define DRIVER_NAME "aaci-pl041"
32 32
33#define FRAME_PERIOD_US 21
34
33/* 35/*
34 * PM support is not complete. Turn it off. 36 * PM support is not complete. Turn it off.
35 */ 37 */
@@ -64,8 +66,8 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
64 unsigned short val) 66 unsigned short val)
65{ 67{
66 struct aaci *aaci = ac97->private_data; 68 struct aaci *aaci = ac97->private_data;
69 int timeout;
67 u32 v; 70 u32 v;
68 int timeout = 5000;
69 71
70 if (ac97->num >= 4) 72 if (ac97->num >= 4)
71 return; 73 return;
@@ -81,14 +83,17 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
81 writel(val << 4, aaci->base + AACI_SL2TX); 83 writel(val << 4, aaci->base + AACI_SL2TX);
82 writel(reg << 12, aaci->base + AACI_SL1TX); 84 writel(reg << 12, aaci->base + AACI_SL1TX);
83 85
84 /* 86 /* Initially, wait one frame period */
85 * Wait for the transmission of both slots to complete. 87 udelay(FRAME_PERIOD_US);
86 */ 88
89 /* And then wait an additional eight frame periods for it to be sent */
90 timeout = FRAME_PERIOD_US * 8;
87 do { 91 do {
92 udelay(1);
88 v = readl(aaci->base + AACI_SLFR); 93 v = readl(aaci->base + AACI_SLFR);
89 } while ((v & (SLFR_1TXB|SLFR_2TXB)) && --timeout); 94 } while ((v & (SLFR_1TXB|SLFR_2TXB)) && --timeout);
90 95
91 if (!timeout) 96 if (v & (SLFR_1TXB|SLFR_2TXB))
92 dev_err(&aaci->dev->dev, 97 dev_err(&aaci->dev->dev,
93 "timeout waiting for write to complete\n"); 98 "timeout waiting for write to complete\n");
94 99
@@ -101,9 +106,8 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
101static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) 106static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
102{ 107{
103 struct aaci *aaci = ac97->private_data; 108 struct aaci *aaci = ac97->private_data;
109 int timeout, retries = 10;
104 u32 v; 110 u32 v;
105 int timeout = 5000;
106 int retries = 10;
107 111
108 if (ac97->num >= 4) 112 if (ac97->num >= 4)
109 return ~0; 113 return ~0;
@@ -117,35 +121,34 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
117 */ 121 */
118 writel((reg << 12) | (1 << 19), aaci->base + AACI_SL1TX); 122 writel((reg << 12) | (1 << 19), aaci->base + AACI_SL1TX);
119 123
120 /* 124 /* Initially, wait one frame period */
121 * Wait for the transmission to complete. 125 udelay(FRAME_PERIOD_US);
122 */ 126
127 /* And then wait an additional eight frame periods for it to be sent */
128 timeout = FRAME_PERIOD_US * 8;
123 do { 129 do {
130 udelay(1);
124 v = readl(aaci->base + AACI_SLFR); 131 v = readl(aaci->base + AACI_SLFR);
125 } while ((v & SLFR_1TXB) && --timeout); 132 } while ((v & SLFR_1TXB) && --timeout);
126 133
127 if (!timeout) { 134 if (v & SLFR_1TXB) {
128 dev_err(&aaci->dev->dev, "timeout on slot 1 TX busy\n"); 135 dev_err(&aaci->dev->dev, "timeout on slot 1 TX busy\n");
129 v = ~0; 136 v = ~0;
130 goto out; 137 goto out;
131 } 138 }
132 139
133 /* 140 /* Now wait for the response frame */
134 * Give the AC'97 codec more than enough time 141 udelay(FRAME_PERIOD_US);
135 * to respond. (42us = ~2 frames at 48kHz.)
136 */
137 udelay(42);
138 142
139 /* 143 /* And then wait an additional eight frame periods for data */
140 * Wait for slot 2 to indicate data. 144 timeout = FRAME_PERIOD_US * 8;
141 */
142 timeout = 5000;
143 do { 145 do {
146 udelay(1);
144 cond_resched(); 147 cond_resched();
145 v = readl(aaci->base + AACI_SLFR) & (SLFR_1RXV|SLFR_2RXV); 148 v = readl(aaci->base + AACI_SLFR) & (SLFR_1RXV|SLFR_2RXV);
146 } while ((v != (SLFR_1RXV|SLFR_2RXV)) && --timeout); 149 } while ((v != (SLFR_1RXV|SLFR_2RXV)) && --timeout);
147 150
148 if (!timeout) { 151 if (v != (SLFR_1RXV|SLFR_2RXV)) {
149 dev_err(&aaci->dev->dev, "timeout on RX valid\n"); 152 dev_err(&aaci->dev->dev, "timeout on RX valid\n");
150 v = ~0; 153 v = ~0;
151 goto out; 154 goto out;
@@ -179,6 +182,7 @@ aaci_chan_wait_ready(struct aaci_runtime *aacirun, unsigned long mask)
179 int timeout = 5000; 182 int timeout = 5000;
180 183
181 do { 184 do {
185 udelay(1);
182 val = readl(aacirun->base + AACI_SR); 186 val = readl(aacirun->base + AACI_SR);
183 } while (val & mask && timeout--); 187 } while (val & mask && timeout--);
184} 188}
@@ -874,7 +878,7 @@ static int __devinit aaci_probe_ac97(struct aaci *aaci)
874 * Give the AC'97 codec more than enough time 878 * Give the AC'97 codec more than enough time
875 * to wake up. (42us = ~2 frames at 48kHz.) 879 * to wake up. (42us = ~2 frames at 48kHz.)
876 */ 880 */
877 udelay(42); 881 udelay(FRAME_PERIOD_US * 2);
878 882
879 ret = snd_ac97_bus(aaci->card, 0, &aaci_bus_ops, aaci, &ac97_bus); 883 ret = snd_ac97_bus(aaci->card, 0, &aaci_bus_ops, aaci, &ac97_bus);
880 if (ret) 884 if (ret)