> From: joshua stein <[email protected]>
> Date: Wed, 7 May 2025 21:52:29 -0500
>
> Otherwise the dwmmc on the RK3128 fails to "switch func mode 0"
> ---
> sys/dev/sdmmc/sdmmc_mem.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
I'm honestly not trying to find an issue with every diff in this
series, but...
> diff --git a/sys/dev/sdmmc/sdmmc_mem.c b/sys/dev/sdmmc/sdmmc_mem.c
> index ffabcc8a040..ebfdf3c5e60 100644
> --- a/sys/dev/sdmmc/sdmmc_mem.c
> +++ b/sys/dev/sdmmc/sdmmc_mem.c
> @@ -756,15 +756,6 @@ sdmmc_mem_sd_init(struct sdmmc_softc *sc, struct
> sdmmc_function *sf)
> return error;
> }
>
> - error = sdmmc_mem_send_scr(sc, raw_scr);
> - if (error) {
> - printf("%s: SD_SEND_SCR send failed\n", DEVNAME(sc));
> - return error;
> - }
> - error = sdmmc_mem_decode_scr(sc, raw_scr, sf);
> - if (error)
> - return error;
> -
> if (ISSET(sc->sc_caps, SMC_CAPS_4BIT_MODE) &&
> ISSET(sf->scr.bus_width, SCR_SD_BUS_WIDTHS_4BIT)) {
> DPRINTF(("%s: change bus width\n", DEVNAME(sc)));
This makes no sense. It is the sdmmc_mem_decode_scr() call above that
sets sf->scr.bus_width. So by removing that call, you're skipping the
bus width change. And I guess that means you'll stick to 1-bit mode?
Something else must be wrong.
> @@ -775,6 +766,15 @@ sdmmc_mem_sd_init(struct sdmmc_softc *sc, struct
> sdmmc_function *sf)
> }
> }
>
> + error = sdmmc_mem_send_scr(sc, raw_scr);
> + if (error) {
> + printf("%s: SD_SEND_SCR send failed\n", DEVNAME(sc));
> + return error;
> + }
> + error = sdmmc_mem_decode_scr(sc, raw_scr, sf);
> + if (error)
> + return error;
> +
> best_func = 0;
> if (sf->scr.sd_spec >= SCR_SD_SPEC_VER_1_10 &&
> ISSET(sf->csd.ccc, SD_CSD_CCC_SWITCH)) {
> --
> 2.47.1
>
>