Remember / use sc_verid

This commit is contained in:
skrll 2020-03-20 17:07:17 +00:00
parent 71d02e4922
commit bc8d1afbda
2 changed files with 8 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dwc_mmc.c,v 1.24 2020/03/20 06:18:45 skrll Exp $ */ /* $NetBSD: dwc_mmc.c,v 1.25 2020/03/20 17:07:17 skrll Exp $ */
/*- /*-
* Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca> * Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.24 2020/03/20 06:18:45 skrll Exp $"); __KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.25 2020/03/20 17:07:17 skrll Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -807,11 +807,11 @@ dwc_mmc_init(struct dwc_mmc_softc *sc)
{ {
uint32_t val; uint32_t val;
if (sc->sc_fifo_reg == 0) {
val = MMC_READ(sc, DWC_MMC_VERID); val = MMC_READ(sc, DWC_MMC_VERID);
const u_int id = __SHIFTOUT(val, DWC_MMC_VERID_ID); sc->sc_verid = __SHIFTOUT(val, DWC_MMC_VERID_ID);
if (id < DWC_MMC_VERID_240A) if (sc->sc_fifo_reg == 0) {
if (sc->sc_verid < DWC_MMC_VERID_240A)
sc->sc_fifo_reg = 0x100; sc->sc_fifo_reg = 0x100;
else else
sc->sc_fifo_reg = 0x200; sc->sc_fifo_reg = 0x200;

View File

@ -1,4 +1,4 @@
/* $NetBSD: dwc_mmc_var.h,v 1.13 2020/01/23 23:53:55 jmcneill Exp $ */ /* $NetBSD: dwc_mmc_var.h,v 1.14 2020/03/20 17:07:17 skrll Exp $ */
/*- /*-
* Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca> * Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca>
@ -45,6 +45,7 @@ struct dwc_mmc_softc {
u_int sc_clock_freq; u_int sc_clock_freq;
u_int sc_bus_width; u_int sc_bus_width;
bool sc_card_inited; bool sc_card_inited;
u_int sc_verid;
void *sc_ih; void *sc_ih;
kmutex_t sc_lock; kmutex_t sc_lock;