Ejemplo n.º 1
0
int bcmsdh_sdmmc_set_power(int on)
{
	static struct sdio_func *sdio_func;
	struct sdhci_host *host;

	if (gfunc) {
		sdio_func = gfunc;

		host = (struct sdhci_host *)sdio_func->card->host;

		if (on)
			mmc_power_restore_host(sdio_func->card->host);
		else
			mmc_power_save_host(sdio_func->card->host);
	}
	return 0;
}
Ejemplo n.º 2
0
static int wl1271_sdio_power_on(struct wl1271 *wl)
{
	struct sdio_func *func = wl_to_func(wl);
	int ret;

	/* Make sure the card will not be powered off by runtime PM */
	ret = pm_runtime_get_sync(&func->dev);
	if (ret < 0)
		goto out;

	/* Runtime PM might be disabled, so power up the card manually */
	ret = mmc_power_restore_host(func->card->host);
	if (ret < 0)
		goto out;

	sdio_claim_host(func);
	sdio_enable_func(func);

out:
	return ret;
}
Ejemplo n.º 3
0
static int sdhci_kona_off_to_enabled(struct sdio_dev *dev)
{
	/* TODO:
	 * Once clk mgmt is introduced we need to turn ON the clocks here too
	 */

	/* Note that the sequence triggered by mmc_power_restore_host changes
	 * the regulator voltage setting etc. But the regulator should be
	 * enabled in first place.
	 */
	sdhci_kona_sdio_regulator_power(dev, 1);

	/*
	 * This is key, we are calling mmc_power_restore_host, which if needed
	 * would re-trigger the protocol handshake with the card.
	 */
	if ((dev->devtype == SDIO_DEV_TYPE_SDMMC) && (dev->suspended != 1))
		mmc_power_restore_host(dev->host->mmc);
	dev->dpm_state = ENABLED;
	pr_info("OFF --> Enabled \r\n");
	return 0;
}
Ejemplo n.º 4
0
static int wl1271_sdio_power_on(struct wl1271 *wl)
{
	struct sdio_func *func = wl_to_func(wl);
	int ret;


        printk("%s: function entered \n", __FUNCTION__);
#if 1
	/* Make sure the card will not be powered off by runtime PM */
#if 0  // Added Michael Carrier
        printk("%s: Calling pm_runtime_get_sync\n", __FUNCTION__);
	ret = pm_runtime_get_sync(&func->dev);
        printk("%s: pm_runtime_get_sync returned %d\n", __FUNCTION__, ret);
	if (ret < 0)
		goto out;
	/* Runtime PM might be disabled, so power up the card manually */
#endif 

        printk("%s: Calling mmc_power_restore_host\n", __FUNCTION__);
	ret = mmc_power_restore_host(func->card->host);
        printk("%s: mmc_power_restore_host() returned %d\n", __FUNCTION__, ret);
	if (ret < 0)
		goto out;
#else
       //wl1271_setpower(1);

#endif
	/* if the power is already on (WHY?) ret == 1 */
	ret = 0;

	sdio_claim_host(func);
	sdio_enable_func(func);

	/* Set the default block size in case it was modified */
	sdio_set_block_size(func, 0);

out:
	return ret;
}
Ejemplo n.º 5
0
/**
 *	mmc_wait_for_req - start a request and wait for completion
 *	@host: MMC host to start command
 *	@mrq: MMC request to start
 *
 *	Start a new MMC custom command request for a host, and wait
 *	for the command to complete. Does not attempt to parse the
 *	response.
 */
void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq)
{
	int ret;
	DECLARE_COMPLETION_ONSTACK(complete);

	mrq->done_data = &complete;
	mrq->done = mmc_wait_done;

	mmc_start_request(host, mrq);

	if (!wait_for_completion_timeout(&complete,
		msecs_to_jiffies(10000))) {
		host->ops->dump_regs(host);
		dump_mmc_ios(host);
#ifdef MMC_HOST_DEBUGGING
		extern void dump(void);
		dump();
#endif
		if (host->ops->abort_request) {
			/* Power off */
			ret = mmc_power_save_host(host);
			if (ret)
				pr_err("%s: mmc_power_save_host : error %d\n",
					mmc_hostname(host), ret);

			/* Reset host */
			host->ops->abort_request(host);

			/* Reinitialize the host and card */
			ret = mmc_power_restore_host(host);
			if (ret)
				pr_err("%s: mmc_power_restore_host : error %d\n",
					mmc_hostname(host), ret);
		} else {
			printk(KERN_ERR"[MMC]Timeout Timer Handler Error\n");
		}
	}
}
Ejemplo n.º 6
0
static int wl1271_sdio_power_on(struct wl1271 *wl)
{
	struct sdio_func *func = wl_to_func(wl);
	int ret;

	/* If enabled, tell runtime PM not to power off the card */
	if (pm_runtime_enabled(&func->dev)) {
		ret = pm_runtime_get_sync(&func->dev);
		if (ret < 0)
			goto out;
	} else {
		/* Runtime PM is disabled: power up the card manually */
		ret = mmc_power_restore_host(func->card->host);
		if (ret < 0)
			goto out;
	}

	sdio_claim_host(func);
	sdio_enable_func(func);

out:
	return ret;
}
Ejemplo n.º 7
0
static int mmc_runtime_resume(struct device *dev)
{
	struct mmc_card *card = mmc_dev_to_card(dev);

	return mmc_power_restore_host(card->host);
}