示例#1
0
static int sslsd_suspend(struct platform_device *dev, pm_message_t state)
{
	struct mmc_host	*mmc = platform_get_drvdata(dev);
	disable_irq(sdhc_irq);
//printk("sslsd: suspend level=%d\n", level);
	return mmc_suspend_host(mmc, state);
}
int msmsdcc_suspend(struct platform_device *dev, pm_message_t state)
{
	struct mmc_host *mmc = mmc_get_drvdata(dev);
	int rc = 0;

	if (mmc) {
		struct msmsdcc_host *host = mmc_priv(mmc);

		if (host->stat_irq)
			disable_irq(host->stat_irq);

		if (mmc->card && mmc->card->type != MMC_TYPE_SDIO)
			rc = mmc_suspend_host(mmc, state);
		if (!rc) {
			writel(0, host->base + MMCIMASK0);

			if (host->clks_on) {
				clk_disable(host->clk);
				clk_disable(host->pclk);
				host->clks_on = 0;
			}
		}
	}
	return rc;
}
示例#3
0
static int
msmsdcc_suspend(struct platform_device *dev, pm_message_t state)
{
	struct mmc_host *mmc = mmc_get_drvdata(dev);
	struct msmsdcc_host *host = mmc_priv(mmc);
	int rc = 0;
	pr_debug("%s ++ entering\n", __func__);

#ifdef CONFIG_MMC_AUTO_SUSPEND
	if (test_and_set_bit(0, &host->suspended))
		return 0;
#endif
	if (mmc) {
		if (host->plat->status_irq)
			disable_irq(host->plat->status_irq);

		if (!mmc->card || mmc->card->type != MMC_TYPE_SDIO)
			rc = mmc_suspend_host(mmc, state);
		if (!rc) {
			writel(0, host->base + MMCIMASK0);

			if (host->clks_on) {
				clk_disable(host->clk);
				clk_disable(host->pclk);
				host->clks_on = 0;
			}
		}

		if (host->plat->sdiowakeup_irq)
			enable_irq(host->plat->sdiowakeup_irq);
	}
	pr_debug("%s -- leaving\n", __func__);
	return rc;
}
示例#4
0
int msmsdcc_suspend(struct platform_device *dev, pm_message_t state)
{
	struct mmc_host *mmc = mmc_get_drvdata(dev);
	int rc = 0;

	if (mmc) {
		struct msmsdcc_host *host = mmc_priv(mmc);
		void __iomem *base = host->base;
		uint32_t status;
		unsigned long timeleft = jiffies + msecs_to_jiffies(100);

		if (host->stat_irq)
			disable_irq(host->stat_irq);

		do {
			status = readl(base + MMCISTATUS);
			if (!(status & (MCI_TXFIFOEMPTY | MCI_RXFIFOEMPTY)))
				break;
			cpu_relax();
		} while (time_is_after_jiffies(timeleft));

		if (mmc->card && mmc->card->type != MMC_TYPE_SDIO)
			rc = mmc_suspend_host(mmc, state);
		if (!rc) {
			writel(0, host->base + MMCIMASK0);

			if (host->clks_on) {
				clk_disable(host->clk);
				clk_disable(host->pclk);
				host->clks_on = 0;
			}
		}
	}
	return rc;
}
示例#5
0
static int sunximmc_suspend(struct device *dev)
{
    struct platform_device *pdev = to_platform_device(dev);
    struct mmc_host *mmc = platform_get_drvdata(pdev);
    int ret = 0;

    if (mmc)
    {
        struct sunxi_mmc_host *smc_host = mmc_priv(mmc);

        if (mmc->card && (mmc->card->type!=MMC_TYPE_SDIO || mmc_pm_io_shd_suspend_host()))
            ret = mmc_suspend_host(mmc);

        if (smc_host->power_on) {
            /* disable irq */
            disable_irq(smc_host->irq);

            /* backup registers */
            sdxc_regs_save(smc_host);

        	/* disable mmc mclk */
        	clk_disable(smc_host->mclk);

        	/* disable mmc hclk */
            if (mmc->card && mmc->card->type!=MMC_TYPE_SDIO)
        	    clk_disable(smc_host->hclk);

            /* suspend pins to save power */
            sunximmc_suspend_pins(smc_host);
        }
    }

    SMC_DBG("smc %d suspend\n", pdev->id);
    return ret;
}
示例#6
0
static int s3c_hsmmc_suspend(struct platform_device *pdev, pm_message_t state)
{
	struct s3c_hsmmc_host *s3c_host = global_host[pdev->id];
	struct mmc_host *host = s3c_host->mmc;

	mmc_suspend_host(host, state);

	return 0;
}
示例#7
0
文件: imxmmc.c 项目: ivucica/linux
static int imxmci_suspend(struct platform_device *dev, pm_message_t state)
{
	struct mmc_host *mmc = platform_get_drvdata(dev);
	int ret = 0;

	if (mmc)
		ret = mmc_suspend_host(mmc, state);

	return ret;
}
示例#8
0
static int sh_mmcif_suspend(struct device *dev)
{
	struct sh_mmcif_host *host = dev_get_drvdata(dev);
	int ret = mmc_suspend_host(host->mmc);

	if (!ret)
		sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, MASK_ALL);

	return ret;
}
static int sdhci_bcm2708_suspend(struct platform_device *dev, pm_message_t state)
{
	struct sdhci_host *host = (struct sdhci_host *)
				  platform_get_drvdata(dev);
	int ret = 0;

	if (host->mmc) {
		ret = mmc_suspend_host(host->mmc);
	}

	return ret;
}
示例#10
0
int ubicom32sd_suspend_host(struct ubicom32sd_host *host, pm_message_t state)
{
	int ret;

	ret = mmc_suspend_host(host->mmc, state);
	if (ret)
		return ret;

	free_irq(host->irq, host);

	return 0;
}
示例#11
0
static int omap_hsmmc_suspend(struct platform_device *pdev, pm_message_t state)
{
	int ret = 0;
	struct omap_hsmmc_host *host = platform_get_drvdata(pdev);

	if (host && host->suspended)
		return 0;

	if (host) {
		host->suspended = 1;
		if (host->pdata->suspend) {
			ret = host->pdata->suspend(&pdev->dev,
							host->slot_id);
			if (ret) {
				dev_dbg(mmc_dev(host->mmc),
					"Unable to handle MMC board"
					" level suspend\n");
				host->suspended = 0;
				return ret;
			}
		}
		cancel_work_sync(&host->mmc_carddetect_work);
		mmc_host_enable(host->mmc);
		ret = mmc_suspend_host(host->mmc, state);
		if (ret == 0) {
			OMAP_HSMMC_WRITE(host->base, ISE, 0);
			OMAP_HSMMC_WRITE(host->base, IE, 0);


			OMAP_HSMMC_WRITE(host->base, HCTL,
				OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
			mmc_host_disable(host->mmc);
			clk_disable(host->iclk);
			if (host->got_dbclk)
				clk_disable(host->dbclk);
		} else {
			host->suspended = 0;
			if (host->pdata->resume) {
				ret = host->pdata->resume(&pdev->dev,
							  host->slot_id);
				if (ret)
					dev_dbg(mmc_dev(host->mmc),
						"Unmask interrupt failed\n");
			}
			mmc_host_disable(host->mmc);
		}

	}
	return ret;
}
示例#12
0
static int tmio_mmc_suspend(struct platform_device *dev, pm_message_t state)
{
	const struct mfd_cell *cell = mfd_get_cell(dev);
	struct mmc_host *mmc = platform_get_drvdata(dev);
	int ret;

	ret = mmc_suspend_host(mmc);

	/* Tell MFD core it can disable us now.*/
	if (!ret && cell->disable)
		cell->disable(dev);

	return ret;
}
示例#13
0
static int at91_mci_suspend(struct platform_device *pdev, pm_message_t state)
{
	struct mmc_host *mmc = platform_get_drvdata(pdev);
	struct at91mci_host *host = mmc_priv(mmc);
	int ret = 0;

	if (host->board->det_pin && device_may_wakeup(&pdev->dev))
		enable_irq_wake(host->board->det_pin);

	if (mmc)
		ret = mmc_suspend_host(mmc, state);

	return ret;
}
示例#14
0
static int ak98_sdio_suspend(struct platform_device *dev, pm_message_t state)
{
	struct mmc_host *mmc = platform_get_drvdata(dev);
	int ret = 0;

	if (mmc) {
		struct ak98_mci_host *host = mmc_priv(mmc);

		ret = mmc_suspend_host(mmc, state);
		if (ret == 0)
			writel(0, host->base + AK88MCIMASK0);
	}

	return ret;
}
示例#15
0
static int rk28_sdmmc0_suspend(struct platform_device *pdev, pm_message_t state)
{

    struct mmc_host *mmc = platform_get_drvdata(pdev);
    int ret = 0;
    
    spin_lock( &sdmmc0_spinlock);
    sd_is_suspend_mmc = 1;
    spin_unlock( &sdmmc0_spinlock);

    if (mmc)
        ret = mmc_suspend_host(mmc, state);

    return ret;
}
示例#16
0
static int mmci_suspend(struct amba_device *dev, pm_message_t state)
{
    struct mmc_host *mmc = amba_get_drvdata(dev);
    int ret = 0;

    if (mmc) {
        struct mmci_host *host = mmc_priv(mmc);

        ret = mmc_suspend_host(mmc, state);
        if (ret == 0)
            writel(0, host->base + MMCIMASK0);
    }

    return ret;
}
示例#17
0
文件: s3cmci.c 项目: kzlin129/tt-gpl
static int s3c_sdi_suspend(struct device *dev, pm_message_t state, u32 level)
{
    struct platform_device* pdev = to_platform_device(dev);
    struct mmc_host *mmc = platform_get_drvdata(pdev);
    struct s3c_sdi_host *host = mmc_priv(mmc);
    int ret = 0;

    if (host && (level == SUSPEND_POWER_DOWN)) {
        if (mmc)
            ret = mmc_suspend_host(mmc, state);

        s3c_dma_free(host->dma, &s3c_sdi_dma_client);
    }

    return ret;
}
示例#18
0
static int omap_mmc_suspend(struct platform_device *pdev, pm_message_t state)
{
	int ret = 0;
	struct mmc_omap_host *host = platform_get_drvdata(pdev);

	if (host && host->suspended)
		return 0;

	if (host) {
		ret = mmc_suspend_host(host->mmc, state);
		if (ret == 0) {
			host->suspended = 1;

			mmc_clk_try_enable(host);

			OMAP_HSMMC_WRITE(host->base, ISE, 0);
			OMAP_HSMMC_WRITE(host->base, IE, 0);

			if (host->pdata->suspend) {
				ret = host->pdata->suspend(&pdev->dev, host->slot_id);
				if (ret)
					dev_dbg(mmc_dev(host->mmc),
						"Unable to handle MMC board"
						" level suspend\n");
			}

			if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) {
				OMAP_HSMMC_WRITE(host->base, HCTL,
					OMAP_HSMMC_READ(host->base, HCTL)
					& SDVSCLR);
				OMAP_HSMMC_WRITE(host->base, HCTL,
					OMAP_HSMMC_READ(host->base, HCTL)
					| SDVS30);
				OMAP_HSMMC_WRITE(host->base, HCTL,
					OMAP_HSMMC_READ(host->base, HCTL)
					| SDBP);
			}

			mmc_clk_try_disable(host);

			if (cpu_is_omap2430())
				clk_disable(host->dbclk);
		}

	}
	return ret;
}
示例#19
0
static int hi_mci_suspend(struct platform_device *dev, pm_message_t state)
{
	struct mmc_host *mmc = platform_get_drvdata(dev);
	struct himci_host *host;
	int ret = 0;

	himci_trace(2, "begin");
	himci_assert(dev);

	if (mmc) {
		ret = mmc_suspend_host(mmc);

		host = mmc_priv(mmc);
		hi_mci_sys_ctrl_suspend(host);
	}

	himci_trace(2, "end");

	return ret;
}
示例#20
0
static int stmp3xxx_mmc_suspend(struct platform_device *pdev,
				pm_message_t state)
{
	struct stmp3xxx_mmc_host *host;
	struct stmp3xxxmmc_platform_data *mmc_data;
	struct mmc_host *mmc;
	int ret = 0;

	dev_dbg(&pdev->dev, "Suspending\n");

	mmc_data = pdev->dev.platform_data;
	mmc = platform_get_drvdata(pdev);
	host = mmc_priv(mmc);

	ret = mmc_suspend_host(mmc, state);
	if (!ret) {
		if (mmc_data && mmc_data->hw_release)
			mmc_data->hw_release();
		clk_disable(host->clk);
	}
	return ret;
}
示例#21
0
static int mmc_omap_suspend(struct platform_device *pdev, pm_message_t mesg)
{
	int i, ret = 0;
	struct mmc_omap_host *host = platform_get_drvdata(pdev);

	if (host == NULL || host->suspended)
		return 0;

	for (i = 0; i < host->nr_slots; i++) {
		struct mmc_omap_slot *slot;

		slot = host->slots[i];
		ret = mmc_suspend_host(slot->mmc, mesg);
		if (ret < 0) {
			while (--i >= 0) {
				slot = host->slots[i];
				mmc_resume_host(slot->mmc);
			}
			return ret;
		}
	}
	host->suspended = 1;
	return 0;
}
static int
msmsdcc_suspend(struct platform_device *dev, pm_message_t state)
{
//#ifdef LG_FW_SD_CARD
#if 0
	printk(KERN_ERR "[yoohoo] msmsdcc_suspend : start \n");
	return 0;
#else
	struct mmc_host *mmc = mmc_get_drvdata(dev);
	struct msmsdcc_host *host = mmc_priv(mmc);
	int rc = 0;

#ifdef CONFIG_MMC_AUTO_SUSPEND
	if (test_and_set_bit(0, &host->suspended))
		return 0;
#endif
	if (mmc) {
		if (host->plat->status_irq)
			disable_irq(host->plat->status_irq);

		if (!mmc->card || mmc->card->type != MMC_TYPE_SDIO)
			rc = mmc_suspend_host(mmc, state);
		if (!rc) {
			writel(0, host->base + MMCIMASK0);

			if (host->clks_on) {
				clk_disable(host->clk);
				clk_disable(host->pclk);
				host->clks_on = 0;
			}
		}
	}
	return rc;
#endif

}
示例#23
0
static int s3cmci_suspend(struct platform_device *dev, pm_message_t state)
{
	struct mmc_host *mmc = platform_get_drvdata(dev);

	return  mmc_suspend_host(mmc, state);
}
static int omap_mmc_suspend(struct platform_device *pdev, pm_message_t state)
{
	int ret = 0;
	int err = 0;
	struct mmc_omap_host *host = platform_get_drvdata(pdev);

	if (host && host->suspended)
		return 0;

	if (host) {
		host->suspended = 1;

		if (host->card_sleep){
			dev_dbg(mmc_dev(host->mmc),"has been in sleep status\n");
		}
		else if (mmc_card_can_sleep(host->mmc)){
			err = mmc_card_sleep(host->mmc);

			if (err){
				dev_dbg(mmc_dev(host->mmc),"MMC sleep command CMD5 return error\n");
			}
			else{
				host->card_sleep = 1;
			}
		}

		if (host->pdata->suspend) {
			ret = host->pdata->suspend(&pdev->dev,
						host->slot_id);
			if (ret) {
				dev_dbg(mmc_dev(host->mmc),
					"Unable to handle MMC board"
					" level suspend\n");
				host->suspended = 0;
				return ret;
			}
		}
		cancel_work_sync(&host->mmc_carddetect_work);

		ret = mmc_suspend_host(host->mmc, state);
		if (ret == 0) {
			omap_hsmmc_enable_clks(host);

			OMAP_HSMMC_WRITE(host->base, ISE, 0);
			OMAP_HSMMC_WRITE(host->base, IE, 0);

			if (host->id == OMAP_MMC1_DEVID
					&& !(OMAP_HSMMC_READ(host->base, HCTL)
							& SDVSDET)) {
				OMAP_HSMMC_WRITE(host->base, HCTL,
					OMAP_HSMMC_READ(host->base, HCTL)
					& SDVSCLR);
				OMAP_HSMMC_WRITE(host->base, HCTL,
					OMAP_HSMMC_READ(host->base, HCTL)
					| SDVS30);
				OMAP_HSMMC_WRITE(host->base, HCTL,
					OMAP_HSMMC_READ(host->base, HCTL)
					| SDBP);
			}

			omap_hsmmc_disable_clks(host);
		} else {
			host->suspended = 0;
			if (host->pdata->resume) {
				ret = host->pdata->resume(&pdev->dev,
					host->slot_id);
				if (ret)
					dev_dbg(mmc_dev(host->mmc),
						"Unmask interrupt failed\n");
			}
		}

	}
	return ret;
}
示例#25
0
static int sdhci_of_suspend(struct of_device *ofdev, pm_message_t state)
{
	struct sdhci_host *host = dev_get_drvdata(&ofdev->dev);

	return mmc_suspend_host(host->mmc);
}