Exemplo n.º 1
0
/*
 * Card detection callback from host.
 */
static int mmc_detect(struct mmc_host *host)
{
    int err;

    BUG_ON(!host);
    BUG_ON(!host->card);

    mmc_claim_host(host);

    /*
     * Just check if our card has been removed.
     */
    err = mmc_send_status(host->card, NULL);

    mmc_release_host(host);

    if (err) {
        mmc_remove(host);

        mmc_claim_host(host);
        mmc_detach_bus(host);
        mmc_release_host(host);
    }

    return err;
}
Exemplo n.º 2
0
/*
 * Card detection callback from host.
 */
static void mmc_detect(struct mmc_host *host)
{
	int err;

	BUG_ON(!host);
	BUG_ON(!host->card);

	mmc_claim_host(host);

	/*
	 * Just check if our card has been removed.
	 */
	err = _mmc_detect_card_removed(host);

	mmc_release_host(host);

	if (err) {
		mmc_remove(host);

		mmc_claim_host(host);
		mmc_detach_bus(host);
		mmc_power_off(host);
		mmc_release_host(host);
	}
}
Exemplo n.º 3
0
/*
 * Card detection callback from host.
 */
static void mmc_detect(struct mmc_host *host)
{
	int err = 0;

	BUG_ON(!host);
	BUG_ON(!host->card);

	mmc_claim_host(host);

	if (host->card->err_count >= ERR_TRIGGER_REINIT)
		err = mmc_init_card(host, host->ocr, host->card);
	/*
	 * Just check if our card has been removed.
	 */
	if (!err)
		err = mmc_send_status(host->card, NULL);

	mmc_release_host(host);

	if (err) {
		mmc_remove(host);

		mmc_claim_host(host);
		mmc_detach_bus(host);
		mmc_release_host(host);
	}
}
Exemplo n.º 4
0
/*
 * When "deferred resume" fails, run another thread to stop mmcqd.
 */
static int mmc_removal_thread(void *d)
{
	struct mmc_host *host = d;

	mmc_remove(host);

	mmc_claim_host(host);
	mmc_detach_bus(host);
	mmc_release_host(host);

	return 0;
}
Exemplo n.º 5
0
static void mmc_err_with_deferred_resume(struct mmc_host *host)
{
	if (mmc_bus_needs_resume(host)) {
		host->bus_resume_flags |= MMC_BUSRESUME_FAILS_RESUME;
		kthread_run(mmc_removal_thread, host, "emmcrd");
	} else {
		mmc_remove(host);

		mmc_claim_host(host);
		mmc_detach_bus(host);
		mmc_release_host(host);
	}
}
Exemplo n.º 6
0
/*
 * Resume callback from host.
 *
 * This function tries to determine if the same card is still present
 * and, if so, restore all state to it.
 */
static void mmc_resume(struct mmc_host *host)
{
	int err;

	BUG_ON(!host);
	BUG_ON(!host->card);

	mmc_claim_host(host);
	err = mmc_init_card(host, host->ocr, host->card);
	mmc_release_host(host);

	if (err) {
		mmc_remove(host);

		mmc_claim_host(host);
		mmc_detach_bus(host);
		mmc_release_host(host);
	}

}