Skip to content

Commit 06867fb

Browse files
committed
* 'fixes' of http://ftp.arm.linux.org.uk/pub/linux/arm/kernel/git-cur/linux-2.6-arm: ARM: 7237/1: PL330: Fix driver freeze ARM: 7197/1: errata: Remove SMP dependency for erratum 751472 ARM: 7196/1: errata: Remove SMP dependency for erratum 720789 ARM: 7220/1: mmc: mmci: Fixup error handling for dma ARM: 7214/1: mmc: mmci: Fixup handling of MCI_STARTBITERR
2 parents 604a16b + abb959f commit 06867fb

File tree

4 files changed

+65
-75
lines changed

4 files changed

+65
-75
lines changed

arch/arm/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@ config PL310_ERRATA_588369
12461246

12471247
config ARM_ERRATA_720789
12481248
bool "ARM errata: TLBIASIDIS and TLBIMVAIS operations can broadcast a faulty ASID"
1249-
depends on CPU_V7 && SMP
1249+
depends on CPU_V7
12501250
help
12511251
This option enables the workaround for the 720789 Cortex-A9 (prior to
12521252
r2p0) erratum. A faulty ASID can be sent to the other CPUs for the
@@ -1282,7 +1282,7 @@ config ARM_ERRATA_743622
12821282

12831283
config ARM_ERRATA_751472
12841284
bool "ARM errata: Interrupted ICIALLUIS may prevent completion of broadcasted operation"
1285-
depends on CPU_V7 && SMP
1285+
depends on CPU_V7
12861286
help
12871287
This option enables the workaround for the 751472 Cortex-A9 (prior
12881288
to r3p0) erratum. An interrupted ICIALLUIS operation may prevent the

arch/arm/common/pl330.c

Lines changed: 49 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -221,17 +221,6 @@
221221
*/
222222
#define MCODE_BUFF_PER_REQ 256
223223

224-
/*
225-
* Mark a _pl330_req as free.
226-
* We do it by writing DMAEND as the first instruction
227-
* because no valid request is going to have DMAEND as
228-
* its first instruction to execute.
229-
*/
230-
#define MARK_FREE(req) do { \
231-
_emit_END(0, (req)->mc_cpu); \
232-
(req)->mc_len = 0; \
233-
} while (0)
234-
235224
/* If the _pl330_req is available to the client */
236225
#define IS_FREE(req) (*((u8 *)((req)->mc_cpu)) == CMD_DMAEND)
237226

@@ -301,8 +290,10 @@ struct pl330_thread {
301290
struct pl330_dmac *dmac;
302291
/* Only two at a time */
303292
struct _pl330_req req[2];
304-
/* Index of the last submitted request */
293+
/* Index of the last enqueued request */
305294
unsigned lstenq;
295+
/* Index of the last submitted request or -1 if the DMA is stopped */
296+
int req_running;
306297
};
307298

308299
enum pl330_dmac_state {
@@ -778,6 +769,22 @@ static inline void _execute_DBGINSN(struct pl330_thread *thrd,
778769
writel(0, regs + DBGCMD);
779770
}
780771

772+
/*
773+
* Mark a _pl330_req as free.
774+
* We do it by writing DMAEND as the first instruction
775+
* because no valid request is going to have DMAEND as
776+
* its first instruction to execute.
777+
*/
778+
static void mark_free(struct pl330_thread *thrd, int idx)
779+
{
780+
struct _pl330_req *req = &thrd->req[idx];
781+
782+
_emit_END(0, req->mc_cpu);
783+
req->mc_len = 0;
784+
785+
thrd->req_running = -1;
786+
}
787+
781788
static inline u32 _state(struct pl330_thread *thrd)
782789
{
783790
void __iomem *regs = thrd->dmac->pinfo->base;
@@ -836,31 +843,6 @@ static inline u32 _state(struct pl330_thread *thrd)
836843
}
837844
}
838845

839-
/* If the request 'req' of thread 'thrd' is currently active */
840-
static inline bool _req_active(struct pl330_thread *thrd,
841-
struct _pl330_req *req)
842-
{
843-
void __iomem *regs = thrd->dmac->pinfo->base;
844-
u32 buf = req->mc_bus, pc = readl(regs + CPC(thrd->id));
845-
846-
if (IS_FREE(req))
847-
return false;
848-
849-
return (pc >= buf && pc <= buf + req->mc_len) ? true : false;
850-
}
851-
852-
/* Returns 0 if the thread is inactive, ID of active req + 1 otherwise */
853-
static inline unsigned _thrd_active(struct pl330_thread *thrd)
854-
{
855-
if (_req_active(thrd, &thrd->req[0]))
856-
return 1; /* First req active */
857-
858-
if (_req_active(thrd, &thrd->req[1]))
859-
return 2; /* Second req active */
860-
861-
return 0;
862-
}
863-
864846
static void _stop(struct pl330_thread *thrd)
865847
{
866848
void __iomem *regs = thrd->dmac->pinfo->base;
@@ -892,17 +874,22 @@ static bool _trigger(struct pl330_thread *thrd)
892874
struct _arg_GO go;
893875
unsigned ns;
894876
u8 insn[6] = {0, 0, 0, 0, 0, 0};
877+
int idx;
895878

896879
/* Return if already ACTIVE */
897880
if (_state(thrd) != PL330_STATE_STOPPED)
898881
return true;
899882

900-
if (!IS_FREE(&thrd->req[1 - thrd->lstenq]))
901-
req = &thrd->req[1 - thrd->lstenq];
902-
else if (!IS_FREE(&thrd->req[thrd->lstenq]))
903-
req = &thrd->req[thrd->lstenq];
904-
else
905-
req = NULL;
883+
idx = 1 - thrd->lstenq;
884+
if (!IS_FREE(&thrd->req[idx]))
885+
req = &thrd->req[idx];
886+
else {
887+
idx = thrd->lstenq;
888+
if (!IS_FREE(&thrd->req[idx]))
889+
req = &thrd->req[idx];
890+
else
891+
req = NULL;
892+
}
906893

907894
/* Return if no request */
908895
if (!req || !req->r)
@@ -933,6 +920,8 @@ static bool _trigger(struct pl330_thread *thrd)
933920
/* Only manager can execute GO */
934921
_execute_DBGINSN(thrd, insn, true);
935922

923+
thrd->req_running = idx;
924+
936925
return true;
937926
}
938927

@@ -1382,8 +1371,8 @@ static void pl330_dotask(unsigned long data)
13821371

13831372
thrd->req[0].r = NULL;
13841373
thrd->req[1].r = NULL;
1385-
MARK_FREE(&thrd->req[0]);
1386-
MARK_FREE(&thrd->req[1]);
1374+
mark_free(thrd, 0);
1375+
mark_free(thrd, 1);
13871376

13881377
/* Clear the reset flag */
13891378
pl330->dmac_tbd.reset_chan &= ~(1 << i);
@@ -1461,14 +1450,12 @@ int pl330_update(const struct pl330_info *pi)
14611450

14621451
thrd = &pl330->channels[id];
14631452

1464-
active = _thrd_active(thrd);
1465-
if (!active) /* Aborted */
1453+
active = thrd->req_running;
1454+
if (active == -1) /* Aborted */
14661455
continue;
14671456

1468-
active -= 1;
1469-
14701457
rqdone = &thrd->req[active];
1471-
MARK_FREE(rqdone);
1458+
mark_free(thrd, active);
14721459

14731460
/* Get going again ASAP */
14741461
_start(thrd);
@@ -1509,7 +1496,7 @@ int pl330_chan_ctrl(void *ch_id, enum pl330_chan_op op)
15091496
struct pl330_thread *thrd = ch_id;
15101497
struct pl330_dmac *pl330;
15111498
unsigned long flags;
1512-
int ret = 0, active;
1499+
int ret = 0, active = thrd->req_running;
15131500

15141501
if (!thrd || thrd->free || thrd->dmac->state == DYING)
15151502
return -EINVAL;
@@ -1525,28 +1512,24 @@ int pl330_chan_ctrl(void *ch_id, enum pl330_chan_op op)
15251512

15261513
thrd->req[0].r = NULL;
15271514
thrd->req[1].r = NULL;
1528-
MARK_FREE(&thrd->req[0]);
1529-
MARK_FREE(&thrd->req[1]);
1515+
mark_free(thrd, 0);
1516+
mark_free(thrd, 1);
15301517
break;
15311518

15321519
case PL330_OP_ABORT:
1533-
active = _thrd_active(thrd);
1534-
15351520
/* Make sure the channel is stopped */
15361521
_stop(thrd);
15371522

15381523
/* ABORT is only for the active req */
1539-
if (!active)
1524+
if (active == -1)
15401525
break;
15411526

1542-
active--;
1543-
15441527
thrd->req[active].r = NULL;
1545-
MARK_FREE(&thrd->req[active]);
1528+
mark_free(thrd, active);
15461529

15471530
/* Start the next */
15481531
case PL330_OP_START:
1549-
if (!_thrd_active(thrd) && !_start(thrd))
1532+
if ((active == -1) && !_start(thrd))
15501533
ret = -EIO;
15511534
break;
15521535

@@ -1587,14 +1570,13 @@ int pl330_chan_status(void *ch_id, struct pl330_chanstatus *pstatus)
15871570
else
15881571
pstatus->faulting = false;
15891572

1590-
active = _thrd_active(thrd);
1573+
active = thrd->req_running;
15911574

1592-
if (!active) {
1575+
if (active == -1) {
15931576
/* Indicate that the thread is not running */
15941577
pstatus->top_req = NULL;
15951578
pstatus->wait_req = NULL;
15961579
} else {
1597-
active--;
15981580
pstatus->top_req = thrd->req[active].r;
15991581
pstatus->wait_req = !IS_FREE(&thrd->req[1 - active])
16001582
? thrd->req[1 - active].r : NULL;
@@ -1659,9 +1641,9 @@ void *pl330_request_channel(const struct pl330_info *pi)
16591641
thrd->free = false;
16601642
thrd->lstenq = 1;
16611643
thrd->req[0].r = NULL;
1662-
MARK_FREE(&thrd->req[0]);
1644+
mark_free(thrd, 0);
16631645
thrd->req[1].r = NULL;
1664-
MARK_FREE(&thrd->req[1]);
1646+
mark_free(thrd, 1);
16651647
break;
16661648
}
16671649
}
@@ -1767,14 +1749,14 @@ static inline void _reset_thread(struct pl330_thread *thrd)
17671749
thrd->req[0].mc_bus = pl330->mcode_bus
17681750
+ (thrd->id * pi->mcbufsz);
17691751
thrd->req[0].r = NULL;
1770-
MARK_FREE(&thrd->req[0]);
1752+
mark_free(thrd, 0);
17711753

17721754
thrd->req[1].mc_cpu = thrd->req[0].mc_cpu
17731755
+ pi->mcbufsz / 2;
17741756
thrd->req[1].mc_bus = thrd->req[0].mc_bus
17751757
+ pi->mcbufsz / 2;
17761758
thrd->req[1].r = NULL;
1777-
MARK_FREE(&thrd->req[1]);
1759+
mark_free(thrd, 1);
17781760
}
17791761

17801762
static int dmac_alloc_threads(struct pl330_dmac *pl330)

arch/arm/mm/proc-v7.S

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,13 @@ __v7_setup:
363363
orreq r10, r10, #1 << 6 @ set bit #6
364364
mcreq p15, 0, r10, c15, c0, 1 @ write diagnostic register
365365
#endif
366-
#ifdef CONFIG_ARM_ERRATA_751472
367-
cmp r6, #0x30 @ present prior to r3p0
366+
#if defined(CONFIG_ARM_ERRATA_751472) && defined(CONFIG_SMP)
367+
ALT_SMP(cmp r6, #0x30) @ present prior to r3p0
368+
ALT_UP_B(1f)
368369
mrclt p15, 0, r10, c15, c0, 1 @ read diagnostic register
369370
orrlt r10, r10, #1 << 11 @ set bit #11
370371
mcrlt p15, 0, r10, c15, c0, 1 @ write diagnostic register
372+
1:
371373
#endif
372374

373375
3: mov r10, #0

drivers/mmc/host/mmci.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,8 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
675675
unsigned int status)
676676
{
677677
/* First check for errors */
678-
if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|MCI_RXOVERRUN)) {
678+
if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_STARTBITERR|
679+
MCI_TXUNDERRUN|MCI_RXOVERRUN)) {
679680
u32 remain, success;
680681

681682
/* Terminate the DMA transfer */
@@ -754,8 +755,12 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd,
754755
}
755756

756757
if (!cmd->data || cmd->error) {
757-
if (host->data)
758+
if (host->data) {
759+
/* Terminate the DMA transfer */
760+
if (dma_inprogress(host))
761+
mmci_dma_data_error(host);
758762
mmci_stop_data(host);
763+
}
759764
mmci_request_end(host, cmd->mrq);
760765
} else if (!(cmd->data->flags & MMC_DATA_READ)) {
761766
mmci_start_data(host, cmd->data);
@@ -955,8 +960,9 @@ static irqreturn_t mmci_irq(int irq, void *dev_id)
955960
dev_dbg(mmc_dev(host->mmc), "irq0 (data+cmd) %08x\n", status);
956961

957962
data = host->data;
958-
if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|
959-
MCI_RXOVERRUN|MCI_DATAEND|MCI_DATABLOCKEND) && data)
963+
if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_STARTBITERR|
964+
MCI_TXUNDERRUN|MCI_RXOVERRUN|MCI_DATAEND|
965+
MCI_DATABLOCKEND) && data)
960966
mmci_data_irq(host, data, status);
961967

962968
cmd = host->cmd;

0 commit comments

Comments
 (0)