Changeset 8179d4c in rtems-libbsd for rtemsbsd/sys


Ignore:
Timestamp:
03/26/15 12:48:37 (9 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, 5-freebsd-12, 6-freebsd-12, freebsd-9.3, master
Children:
d0ecc91
Parents:
9ea1778
git-author:
Sebastian Huber <sebastian.huber@…> (03/26/15 12:48:37)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/26/15 12:53:24)
Message:

dw_mmc: Implement host acquire/release

This should avoid the "mmc: host bridge didn't serialize us." panic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rtemsbsd/sys/dev/dw_mmc/dw_mmc.c

    r9ea1778 r8179d4c  
    8181        struct mtx bus_mtx;
    8282        bus_space_handle_t bushandle;
     83        int bus_busy;
    8384        uint32_t biu_clock;
    8485        uint32_t ciu_clock;
     
    125126            "dw_mmc", MTX_DEF)
    126127
    127 #define DW_MMC_BUS_LOCK(_sc)            mtx_lock(&(_sc)->bus_mtx)
    128 #define DW_MMC_BUS_UNLOCK(_sc)          mtx_unlock(&(_sc)->bus_mtx)
    129 #define DW_MMC_BUS_LOCK_INIT(_sc) \
    130         mtx_init(&_sc->bus_mtx, device_get_nameunit(_sc->dev), \
    131             "dw_mmc", MTX_DEF)
    132 
    133128static int
    134129dw_mmc_poll_reset_completion(struct dw_mmc_softc *sc, uint32_t ctrl_resets)
     
    357352
    358353        DW_MMC_LOCK_INIT(sc);
    359         DW_MMC_BUS_LOCK_INIT(sc);
    360354
    361355        dw_mmc_platform_install_intr(sc);
     
    955949        struct dw_mmc_softc *sc = device_get_softc(brdev);
    956950
    957         DW_MMC_BUS_LOCK(sc);
    958 
     951        DW_MMC_LOCK(sc);
     952        while (sc->bus_busy)
     953                msleep(sc, &sc->sc_mtx, PZERO, "dw_mmc: acquire host", 0);
     954        sc->bus_busy = 1;
     955        DW_MMC_UNLOCK(sc);
    959956        return (0);
    960957}
     
    965962        struct dw_mmc_softc *sc = device_get_softc(brdev);
    966963
    967         DW_MMC_BUS_UNLOCK(sc);
    968 
     964        DW_MMC_LOCK(sc);
     965        sc->bus_busy = 0;
     966        wakeup(sc);
     967        DW_MMC_UNLOCK(sc);
    969968        return (0);
    970969}
Note: See TracChangeset for help on using the changeset viewer.