Module Name: src Committed By: jmcneill Date: Sat Jan 20 00:22:11 UTC 2024
Modified Files: src/sys/dev/sdmmc: sdhc.c sdhcvar.h Log Message: sdmmc: add support for optional delay after register write To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/sys/dev/sdmmc/sdhc.c cvs rdiff -u -r1.33 -r1.34 src/sys/dev/sdmmc/sdhcvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/sdmmc/sdhc.c diff -u src/sys/dev/sdmmc/sdhc.c:1.117 src/sys/dev/sdmmc/sdhc.c:1.118 --- src/sys/dev/sdmmc/sdhc.c:1.117 Wed Nov 2 10:38:04 2022 +++ src/sys/dev/sdmmc/sdhc.c Sat Jan 20 00:22:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhc.c,v 1.117 2022/11/02 10:38:04 jmcneill Exp $ */ +/* $NetBSD: sdhc.c,v 1.118 2024/01/20 00:22:11 jmcneill Exp $ */ /* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */ /* @@ -23,7 +23,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.117 2022/11/02 10:38:04 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.118 2024/01/20 00:22:11 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -142,6 +142,9 @@ hwrite1(struct sdhc_host *hp, bus_size_t tmp = (val << shift) | (tmp & ~(0xffU << shift)); bus_space_write_4(hp->iot, hp->ioh, o, tmp); } + if (hp->sc->sc_write_delay != 0) { + delay(hp->sc->sc_write_delay); + } } static void @@ -157,6 +160,9 @@ hwrite2(struct sdhc_host *hp, bus_size_t tmp = (val << shift) | (tmp & ~(0xffffU << shift)); bus_space_write_4(hp->iot, hp->ioh, o, tmp); } + if (hp->sc->sc_write_delay != 0) { + delay(hp->sc->sc_write_delay); + } } static void @@ -164,6 +170,9 @@ hwrite4(struct sdhc_host *hp, bus_size_t { bus_space_write_4(hp->iot, hp->ioh, o, val); + if (hp->sc->sc_write_delay != 0) { + delay(hp->sc->sc_write_delay); + } } #define HWRITE1(hp, reg, val) hwrite1(hp, reg, val) Index: src/sys/dev/sdmmc/sdhcvar.h diff -u src/sys/dev/sdmmc/sdhcvar.h:1.33 src/sys/dev/sdmmc/sdhcvar.h:1.34 --- src/sys/dev/sdmmc/sdhcvar.h:1.33 Fri Oct 14 07:54:49 2022 +++ src/sys/dev/sdmmc/sdhcvar.h Sat Jan 20 00:22:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhcvar.h,v 1.33 2022/10/14 07:54:49 jmcneill Exp $ */ +/* $NetBSD: sdhcvar.h,v 1.34 2024/01/20 00:22:11 jmcneill Exp $ */ /* $OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $ */ /* @@ -82,6 +82,8 @@ struct sdhc_softc { int (*sc_vendor_transfer_data_dma)(struct sdhc_softc *, struct sdmmc_command *); void (*sc_vendor_hw_reset)(struct sdhc_softc *, struct sdhc_host *); int (*sc_vendor_signal_voltage)(struct sdhc_softc *, int); + + u_int sc_write_delay; /* delay (us) after io write */ }; /* Host controller functions called by the attachment driver. */