bcm, bcm64: handle disk activity led from sdmmc

We don't want to blink the disk activity led for wifi,
so handle the disk activity LED from sdmmc when it
is actually used as a disk.
This commit is contained in:
cinap_lenrek 2023-11-05 18:52:50 +00:00
parent 901a176a03
commit c0a7fbea1f
5 changed files with 27 additions and 15 deletions

View file

@ -409,11 +409,6 @@ emmcio(SDio*, int write, uchar *buf, int len)
int i;
assert((len&3) == 0);
okay(1);
if(waserror()){
okay(0);
nexterror();
}
if(write)
dmastart(DmaChanEmmc, DmaDevEmmc, DmaM2D,
buf, &r[Data], len);
@ -439,8 +434,6 @@ emmcio(SDio*, int write, uchar *buf, int len)
}
if(i)
WR(Interrupt, i);
poperror();
okay(0);
}
static void
@ -457,6 +450,11 @@ emmcinterrupt(Ureg*, void*)
WR(Irpten, r[Irpten] & ~i);
}
static void
emmcled(SDio*, int on)
{
okay(on);
}
static SDio sdio = {
"emmc",
@ -467,6 +465,7 @@ static SDio sdio = {
emmciosetup,
emmcio,
emmcbus,
emmcled,
emmccardintr,
};

View file

@ -452,7 +452,6 @@ sdhciosetup(SDio*, int write, void *buf, int bsize, int bcount)
else
cachedwbinvse(buf, len);
WR(Dmadesc, sdhc.busdram + (PADDR(sdhc.dma) - PHYSDRAM));
okay(1);
}
static void
@ -461,10 +460,6 @@ sdhcio(SDio*, int write, uchar *buf, int len)
u32int *r = (u32int*)SDHCREGS;
int i;
if(waserror()){
okay(0);
nexterror();
}
WR(Irpten, r[Irpten] | Datadone|Err);
tsleep(&sdhc.r, datadone, 0, 3000);
WR(Irpten, r[Irpten] & ~(Datadone|Err));
@ -478,8 +473,6 @@ sdhcio(SDio*, int write, uchar *buf, int len)
WR(Interrupt, i);
if(!write)
cachedinvse(buf, len);
poperror();
okay(0);
}
static void
@ -494,6 +487,12 @@ sdhcinterrupt(Ureg*, void*)
WR(Irpten, r[Irpten] & ~i);
}
static void
sdhcled(SDio*, int on)
{
okay(on);
}
void
sdhclink(void)
{
@ -506,6 +505,7 @@ sdhclink(void)
sdhciosetup,
sdhcio,
sdhcbus,
sdhcled,
};
addmmcio(&io);
}

View file

@ -240,6 +240,12 @@ sdhostio(SDio*, int write, uchar *buf, int len)
sdhosterror(i);
}
static void
sdhostled(SDio*, int on)
{
okay(on);
}
void
sdhostlink(void)
{
@ -252,6 +258,7 @@ sdhostlink(void)
sdhostiosetup,
sdhostio,
sdhostbus,
sdhostled,
};
addmmcio(&io);
}

View file

@ -197,6 +197,7 @@ struct SDio {
void (*iosetup)(SDio*, int, void*, int, int);
void (*io)(SDio*, int, uchar*, int);
void (*bus)(SDio*, int, int);
void (*led)(SDio*, int);
int (*cardintr)(SDio*, int);
char nomultiwrite; /* quirk for usdhc */
void *aux;

View file

@ -675,9 +675,13 @@ mmcbio(SDunit *unit, int lun, int write, void *data, long nb, uvlong bno)
eqlock(card);
if(waserror()){
if(io->led != nil)
(*io->led)(io, 0);
qunlock(card);
nexterror();
}
if(io->led != nil)
(*io->led)(io, 1);
if(card->ismmc && unit->subno != (card->ext_csd[179]&7)){
b = (card->ext_csd[179] & ~7) | unit->subno;
@ -714,7 +718,8 @@ mmcbio(SDunit *unit, int lun, int write, void *data, long nb, uvlong bno)
buf += len;
}
}
if(io->led != nil)
(*io->led)(io, 0);
qunlock(card);
poperror();