ref: 2b1ecbe87da757ddb12e38239773a05f816d03ae
parent: 7bae48c452c75115a965aa13243c886a99cbf192
author: cinap_lenrek <[email protected]>
date: Sat Jun 18 16:31:49 EDT 2022
imx8/usdhc: work around broken multi-write for now for unknown reasons, multiwrite is busted in usdhc: sdhc: write error intr 10 stat ff88858e usdhccmd: need to reset Datinhibit intr 10 stat ff88858e usdhc: cmd 193a0027 arg 1e5b6b error intr 18010 stat ff88858f i'm disabling it for now, adding a flag to the SDio struct.
--- a/sys/src/9/imx8/usdhc.c
+++ b/sys/src/9/imx8/usdhc.c
@@ -219,16 +219,15 @@
uintptr a;
Adma *adma, *p;
- a = (uintptr)addr;
+ a = PADDR(addr);
n = (len + Maxdma-1) / Maxdma;
adma = sdmalloc(n * sizeof(Adma));
for(p = adma; len > 0; p++){
- p->desc = Valid | Tran;
if(n == 1)
- p->desc |= len<<OLength | End | Int;
+ p->desc = len<<OLength | End | Int | Valid | Tran;
else
- p->desc |= Maxdma<<OLength;
- p->addr = PADDR(a);
+ p->desc = Maxdma<<OLength | Valid | Tran;
+ p->addr = a;
a += Maxdma;
len -= Maxdma;
n--;
@@ -529,4 +528,5 @@
usdhciosetup,
usdhcio,
.highspeed = 1,
+ .nomultiwrite = 1,
};
--- a/sys/src/9/port/sd.h
+++ b/sys/src/9/port/sd.h
@@ -162,6 +162,7 @@
void (*iosetup)(int, void*, int, int);
void (*io)(int, uchar*, int);
char highspeed;
+ char nomultiwrite; /* quirk for usdhc */
};
extern SDio sdio;
--- a/sys/src/9/port/sdmmc.c
+++ b/sys/src/9/port/sdmmc.c
@@ -332,7 +332,7 @@
error(Echange);
buf = data;
len = unit->secsize;
- if(Multiblock){
+ if(Multiblock && (!write || !io->nomultiwrite)){
b = bno;
tries = 0;
while(waserror())