summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2022-06-18 13:19:55 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2022-06-18 13:19:55 +0000
commite760ded4943d802d7012514d56e18a8ddb54cc56 (patch)
treea622599c95eb5845f00d3244484cd29a3957df3c /sys
parent524f8c2d5374e34bbb665e7a52484859ae9e3e59 (diff)
imx8/usdhc: implement highspeed mode (50Mhz)
Diffstat (limited to 'sys')
-rw-r--r--sys/src/9/imx8/usdhc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/src/9/imx8/usdhc.c b/sys/src/9/imx8/usdhc.c
index 01ea685d6..ba3989211 100644
--- a/sys/src/9/imx8/usdhc.c
+++ b/sys/src/9/imx8/usdhc.c
@@ -10,6 +10,7 @@
enum {
Initfreq = 400000, /* initialisation frequency for MMC */
SDfreq = 25*Mhz, /* standard SD frequency */
+ SDfreqhs = 50*Mhz, /* highspeed frequency */
DTO = 14, /* data timeout exponent (guesswork) */
GoIdle = 0, /* mmc/sdio go idle state */
@@ -446,6 +447,15 @@ usdhccmd(u32int cmd, u32int arg, u32int *resp)
WR(Control0, (RR(Control0) & ~DwidthMask) | Dwidth4);
break;
}
+ } else {
+ /*
+ * If card switched into high speed mode, increase clock speed
+ */
+ if((arg&0x8000000F) == 0x80000001){
+ delay(1);
+ usdhcclk(SDfreqhs);
+ delay(1);
+ }
}
}else if(cmd == IORWdirect && (arg & ~0xFF) == (1<<31|0<<28|7<<9)){
switch(arg & 0x3){
@@ -518,4 +528,5 @@ SDio sdio = {
usdhccmd,
usdhciosetup,
usdhcio,
+ .highspeed = 1,
};