Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/mmc/host/dwmmc.c
Show All 32 Lines | |||||
* Chapter 14, Altera Cyclone V Device Handbook (CV-5V2 2014.07.22) | * Chapter 14, Altera Cyclone V Device Handbook (CV-5V2 2014.07.22) | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/conf.h> | |||||
#include <sys/bus.h> | #include <sys/bus.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/module.h> | #include <sys/module.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/proc.h> | |||||
#include <sys/rman.h> | #include <sys/rman.h> | ||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
#include <sys/taskqueue.h> | #include <sys/taskqueue.h> | ||||
#include <dev/mmc/bridge.h> | #include <dev/mmc/bridge.h> | ||||
#include <dev/mmc/mmcbrvar.h> | #include <dev/mmc/mmcbrvar.h> | ||||
#include <dev/mmc/mmc_fdt_helpers.h> | #include <dev/mmc/mmc_fdt_helpers.h> | ||||
▲ Show 20 Lines • Show All 399 Lines • ▼ Show 20 Lines | dwmmc_intr(void *arg) | ||||
DWMMC_UNLOCK(sc); | DWMMC_UNLOCK(sc); | ||||
} | } | ||||
static void | static void | ||||
dwmmc_handle_card_present(struct dwmmc_softc *sc, bool is_present) | dwmmc_handle_card_present(struct dwmmc_softc *sc, bool is_present) | ||||
{ | { | ||||
bool was_present; | bool was_present; | ||||
if (dumping || SCHEDULER_STOPPED()) | |||||
return; | |||||
was_present = sc->child != NULL; | was_present = sc->child != NULL; | ||||
if (!was_present && is_present) { | if (!was_present && is_present) { | ||||
taskqueue_enqueue_timeout(taskqueue_swi_giant, | taskqueue_enqueue_timeout(taskqueue_swi_giant, | ||||
&sc->card_delayed_task, -(hz / 2)); | &sc->card_delayed_task, -(hz / 2)); | ||||
} else if (was_present && !is_present) { | } else if (was_present && !is_present) { | ||||
taskqueue_enqueue(taskqueue_swi_giant, &sc->card_task); | taskqueue_enqueue(taskqueue_swi_giant, &sc->card_task); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,068 Lines • ▼ Show 20 Lines | if (sc->ccb != NULL) { | ||||
return (EBUSY); | return (EBUSY); | ||||
} | } | ||||
sc->ccb = ccb; | sc->ccb = ccb; | ||||
DWMMC_UNLOCK(sc); | DWMMC_UNLOCK(sc); | ||||
dwmmc_request(sc->dev, NULL, NULL); | dwmmc_request(sc->dev, NULL, NULL); | ||||
return (0); | return (0); | ||||
} | } | ||||
static void | |||||
dwmmc_cam_poll(device_t dev) | |||||
{ | |||||
struct dwmmc_softc *sc; | |||||
sc = device_get_softc(dev); | |||||
dwmmc_intr(sc); | |||||
} | |||||
#endif /* MMCCAM */ | #endif /* MMCCAM */ | ||||
static device_method_t dwmmc_methods[] = { | static device_method_t dwmmc_methods[] = { | ||||
/* Bus interface */ | /* Bus interface */ | ||||
DEVMETHOD(bus_read_ivar, dwmmc_read_ivar), | DEVMETHOD(bus_read_ivar, dwmmc_read_ivar), | ||||
DEVMETHOD(bus_write_ivar, dwmmc_write_ivar), | DEVMETHOD(bus_write_ivar, dwmmc_write_ivar), | ||||
#ifndef MMCCAM | #ifndef MMCCAM | ||||
/* mmcbr_if */ | /* mmcbr_if */ | ||||
DEVMETHOD(mmcbr_update_ios, dwmmc_update_ios), | DEVMETHOD(mmcbr_update_ios, dwmmc_update_ios), | ||||
DEVMETHOD(mmcbr_request, dwmmc_request), | DEVMETHOD(mmcbr_request, dwmmc_request), | ||||
DEVMETHOD(mmcbr_get_ro, dwmmc_get_ro), | DEVMETHOD(mmcbr_get_ro, dwmmc_get_ro), | ||||
DEVMETHOD(mmcbr_acquire_host, dwmmc_acquire_host), | DEVMETHOD(mmcbr_acquire_host, dwmmc_acquire_host), | ||||
DEVMETHOD(mmcbr_release_host, dwmmc_release_host), | DEVMETHOD(mmcbr_release_host, dwmmc_release_host), | ||||
#endif | #endif | ||||
#ifdef MMCCAM | #ifdef MMCCAM | ||||
/* MMCCAM interface */ | /* MMCCAM interface */ | ||||
DEVMETHOD(mmc_sim_get_tran_settings, dwmmc_get_tran_settings), | DEVMETHOD(mmc_sim_get_tran_settings, dwmmc_get_tran_settings), | ||||
DEVMETHOD(mmc_sim_set_tran_settings, dwmmc_set_tran_settings), | DEVMETHOD(mmc_sim_set_tran_settings, dwmmc_set_tran_settings), | ||||
DEVMETHOD(mmc_sim_cam_request, dwmmc_cam_request), | DEVMETHOD(mmc_sim_cam_request, dwmmc_cam_request), | ||||
DEVMETHOD(mmc_sim_cam_poll, dwmmc_cam_poll), | |||||
DEVMETHOD(bus_add_child, bus_generic_add_child), | DEVMETHOD(bus_add_child, bus_generic_add_child), | ||||
#endif | #endif | ||||
DEVMETHOD_END | DEVMETHOD_END | ||||
}; | }; | ||||
DEFINE_CLASS_0(dwmmc, dwmmc_driver, dwmmc_methods, | DEFINE_CLASS_0(dwmmc, dwmmc_driver, dwmmc_methods, | ||||
sizeof(struct dwmmc_softc)); | sizeof(struct dwmmc_softc)); |