tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Patching sdmmmc capabilities for old controllers



Hi all,

> I'd like to add a capability in sdmmcvar.h to show that the controller only
> supports v1.0.  This is different from the other capabilities there which
> are supported (i.e. not unsupported) capabilities.  The reason to do this
> is to avoid touching every other driver to add a v1.1+ capability, so it's
> the least intrusive way that I can see of supporting this controller.

Rather than add the capability, I received comments that handling this in
the existing code would be better, so I've attached another patch that does
that.  Stylistic note, I added a goto to match other places in the code,
but it might be nicer to take this block and make it a separate function
instead.

Regards,

Julian
? sys/dev/sdmmc/sdmmc_mem.c.dist
? sys/dev/sdmmc/sdmmcvar.h.dist
cvs diff: Diffing sys/dev/sdmmc
Index: sys/dev/sdmmc/sdmmc_mem.c
===================================================================
RCS file: /cvsroot/src/sys/dev/sdmmc/sdmmc_mem.c,v
retrieving revision 1.68.2.1
diff -u -r1.68.2.1 sdmmc_mem.c
--- sys/dev/sdmmc/sdmmc_mem.c	25 Feb 2020 18:40:43 -0000	1.68.2.1
+++ sys/dev/sdmmc/sdmmc_mem.c	7 May 2020 16:22:25 -0000
@@ -833,9 +833,14 @@
 		DPRINTF(("%s: switch func mode 0\n", SDMMCDEVNAME(sc)));
 		error = sdmmc_mem_sd_switch(sf, 0, 1, 0, &status);
 		if (error) {
-			aprint_error_dev(sc->sc_dev,
-			    "switch func mode 0 failed\n");
-			return error;
+			if (error == EINVAL) {
+				/* Not supported by controller */
+				goto skipswitchfuncs;
+			} else {
+				aprint_error_dev(sc->sc_dev,
+				    "switch func mode 0 failed\n");
+				return error;
+			}
 		}
 
 		support_func = SFUNC_STATUS_GROUP(&status, 1);
@@ -887,6 +892,7 @@
 			delay(25);
 		}
 	}
+skipswitchfuncs:
 
 	/* update bus clock */
 	if (sc->sc_busclk > sf->csd.tran_speed)


Home | Main Index | Thread Index | Old Index