static int sdhci_pm_resume(struct device *dev) {
    int retval = 0;
    unsigned long flags;
    struct platform_device *pdev = container_of(dev, struct platform_device, dev);
    struct sdhci_host *host = platform_get_drvdata(pdev);
    struct mmc_host *mmc = host->mmc;
    spin_lock_irqsave(&host->lock, flags);
    if(host->ops->set_clock)
        host->ops->set_clock(host, 1);
    spin_unlock_irqrestore(&host->lock, flags);

#ifdef CONFIG_MMC_HOST_WAKEUP_SUPPORTED
        if(!strcmp(host->hw_name, "Spread SDIO host1")) {
            sdhci_host_wakeup_clear(host);
        }
#endif
    retval = sdhci_resume_host(host);
    if(!retval) {
#ifdef CONFIG_PM_RUNTIME
        if(pm_runtime_enabled(dev))
            pm_runtime_put_autosuspend(dev);
#endif
    }
    return retval;

}
static int sdhci_s3c_resume(struct platform_device *dev)
{
	struct sdhci_host *host = platform_get_drvdata(dev);

	sdhci_resume_host(host);
	return 0;
}
Exemplo n.º 3
0
static int sdhci_pltfm_suspend(struct platform_device *dev, pm_message_t state)
{
	struct sdhci_host *host = platform_get_drvdata(dev);
	int ret;

	ret = sdhci_suspend_host(host, state);
	if (ret) {
		dev_err(&dev->dev, "suspend failed, error = %d\n", ret);
		return ret;
	}
	
#if defined (CONFIG_MACH_STAR) //                                                                     
	if(host->irq==INT_SDMMC1)
		enable_irq_wake(host->irq);
#endif

	if (host->ops && host->ops->suspend)
		ret = host->ops->suspend(host, state);
	if (ret) {
		dev_err(&dev->dev, "suspend hook failed, error = %d\n", ret);
		sdhci_resume_host(host);
#if defined (CONFIG_MACH_STAR) //                                                           
	if(host->irq == INT_SDMMC1)
		disable_irq_wake(host->irq);
#endif
	}

	return ret;
}
Exemplo n.º 4
0
static int sdhci_s3c_resume(struct platform_device *dev)
{
	struct sdhci_host *host = platform_get_drvdata(dev);
	struct sdhci_s3c *sc = sdhci_priv(host);

	/* add by cym 20130328 */
#if MMC2_SKIP_SUSPEND
    /* mmc2 is s3c_device_hsmmc3 */
    if (2 == host->mmc->index) {
        printk(KERN_INFO "skip %s for %s dev->id(%d)\n", __func__, mmc_hostname(host->mmc), dev->id);
        return 0;
    }
    else {
        printk(KERN_INFO "%s for %s dev->id(%d)\n", __func__, mmc_hostname(host->mmc), dev->id);
    }
#endif
	/* end add */

	sdhci_resume_host(host);
/* add by cym 20130328 */
#ifndef MMC2_SKIP_SUSPEND
/* end add */
	if(!(host->mmc->caps & MMC_CAP_NONREMOVABLE)){//lisw hotplug during suspend
		int status = gpio_get_value(sc->ext_cd_gpio);
		if (sc->pdata->ext_cd_gpio_invert)
			status = !status;
		sdhci_s3c_notify_change(sc->pdev, status);

	}
/* add by cym 20130328 */
#endif
/* end add */
	return 0;
}
Exemplo n.º 5
0
static int sdhci_s3c_resume(struct platform_device *dev)
{
	struct sdhci_host *host = platform_get_drvdata(dev);

#if defined(CONFIG_WIMAX_CMC)/* && defined(CONFIG_TARGET_LOCALE_NA)*/

	struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
	u32 ier;
#endif
#ifdef CONFIG_MACH_MIDAS_01_BD
	/* turn vdd_tflash off if a card exists*/
	if (sdhci_s3c_get_card_exist(host))
		sdhci_s3c_vtf_on_off(1);
	else
		sdhci_s3c_vtf_on_off(0);

#endif
	sdhci_resume_host(host);
#if defined(CONFIG_WIMAX_CMC)/* && defined(CONFIG_TARGET_LOCALE_NA)*/

	if (pdata->enable_intr_on_resume) {
		ier = sdhci_readl(host, SDHCI_INT_ENABLE);
		ier |= SDHCI_INT_CARD_INT;
		sdhci_writel(host, ier, SDHCI_INT_ENABLE);
		sdhci_writel(host, ier, SDHCI_SIGNAL_ENABLE);
	}
#endif
	return 0;
}
Exemplo n.º 6
0
static int sdhci_acpi_resume(struct device *dev)
{
	struct sdhci_acpi_host *c = dev_get_drvdata(dev);

	sdhci_acpi_byt_setting(&c->pdev->dev);

	return sdhci_resume_host(c->host);
}
static int tegra_sdhci_resume(struct platform_device *pdev)
{
	struct tegra_sdhci_host *host = platform_get_drvdata(pdev);
	int ret;

	tegra_sdhci_enable_clock(host, 1);
	ret = sdhci_resume_host(host->sdhci);
	if (ret)
		pr_err("%s: failed, error = %d\n", __func__, ret);

	return ret;
}
Exemplo n.º 8
0
static int sdhci_pxav3_resume(struct device *dev)
{
	int ret;
	struct sdhci_host *host = dev_get_drvdata(dev);

	pm_runtime_get_sync(dev);
	ret = sdhci_resume_host(host);
	pm_runtime_mark_last_busy(dev);
	pm_runtime_put_autosuspend(dev);

	return ret;
}
Exemplo n.º 9
0
static int sdhci_pltfm_resume(struct platform_device *pdev)
{
	struct sdio_dev *dev = platform_get_drvdata(pdev);
	struct sdhci_host *host = dev->host;

	/*
	 * If the device type is WIFI, and WiFi is enabled,
	 * turn on the clock since currently
	 * the WIFI driver does not support turning on/off the
	 * clock dynamicly.
	 */
	if (dev->devtype == SDIO_DEV_TYPE_WIFI && sdhci_test_sdio_enabled(dev))
		sdhci_pltfm_clk_enable(host, 1);

#if 0
	if (dev->devtype == SDIO_DEV_TYPE_SDMMC && dev->cd_gpio >= 0) {
		ret =
		    request_irq(gpio_to_irq(dev->cd_gpio),
				sdhci_pltfm_cd_interrupt,
				IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
				"sdio cd", dev);
		if (ret) {
			dev_err(&pdev->dev, "Unable to request card detection "
				"irq=%d for gpio=%d\n",
				gpio_to_irq(dev->cd_gpio), dev->cd_gpio);
			return ret;
		}
	}
#endif

#ifndef CONFIG_MMC_UNSAFE_RESUME
	/*
	 * card state might have been changed during system suspend.
	 * Need to sync up only if MMC_UNSAFE_RESUME is not enabled
	 */
	if (dev->devtype == SDIO_DEV_TYPE_SDMMC && dev->cd_gpio >= 0) {
		if (gpio_get_value_cansleep(dev->cd_gpio) == 0)
			bcm_kona_sd_card_emulate(dev, 1);
		else
			bcm_kona_sd_card_emulate(dev, 0);
	}
#endif
	dev->suspended = 0;

	if (dev->devtype == SDIO_DEV_TYPE_WIFI) {
		printk(KERN_DEBUG "%s: WiFi resume\n", __FUNCTION__);
		sdhci_resume_host(host);
	}
	return 0;
}
Exemplo n.º 10
0
static int sdhci_sirf_resume(struct device *dev)
{
	struct sdhci_host *host = dev_get_drvdata(dev);
	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
	int ret;

	ret = clk_enable(pltfm_host->clk);
	if (ret) {
		dev_dbg(dev, "Resume: Error enabling clock\n");
		return ret;
	}

	return sdhci_resume_host(host);
}
Exemplo n.º 11
0
static int sdhci_resume(struct device *dev)
{
	struct sdhci_host *host = dev_get_drvdata(dev);
	struct spear_sdhci *sdhci = dev_get_platdata(dev);
	int ret;

	ret = clk_enable(sdhci->clk);
	if (ret) {
		dev_dbg(dev, "Resume: Error enabling clock\n");
		return ret;
	}

	return sdhci_resume_host(host);
}
static int tegra_sdhci_resume(struct platform_device *pdev)
{
	struct tegra_sdhci_host *host = platform_get_drvdata(pdev);
	int ret;
#ifdef CONFIG_MACH_SAMSUNG_VARIATION_TEGRA	
	int i, present;
#endif
	u8 pwr;
	if (host->card_always_on && is_card_sdio(host->sdhci->mmc->card)) {
		int ret = 0;

		if (device_may_wakeup(&pdev->dev)) {
		        disable_irq_wake(host->sdhci->irq);
		}

		/* soft reset SD host controller and enable interrupts */
		ret = tegra_sdhci_restore(host->sdhci);
		if (ret) {
			pr_err("%s: failed, error = %d\n", __func__, ret);
			return ret;
		}

		mmiowb();
#ifdef CONFIG_MACH_SAMSUNG_VARIATION_TEGRA
		for(i=0;i<20;i++){
			present = sdhci_readl(host->sdhci, SDHCI_PRESENT_STATE);
			if((present & SDHCI_CARD_PRESENT) == SDHCI_CARD_PRESENT)
				break;
			mdelay(5);
//			printk(KERN_ERR "MMC : %s : 6(Card Presnet %x) : %d \n",mmc_hostname(host->sdhci->mmc),present,i);
		}
#endif
		host->sdhci->mmc->ops->set_ios(host->sdhci->mmc,
			&host->sdhci->mmc->ios);
		return 0;
	}

	tegra_sdhci_enable_clock(host, 1);

	pwr = SDHCI_POWER_ON;
	sdhci_writeb(host->sdhci, pwr, SDHCI_POWER_CONTROL);
	host->sdhci->pwr = 0;

	ret = sdhci_resume_host(host->sdhci);
	if (ret)
		pr_err("%s: failed, error = %d\n", __func__, ret);

	return ret;
}
Exemplo n.º 13
0
static int sdhci_s3c_resume(struct platform_device *dev)
{
	struct sdhci_host *host = platform_get_drvdata(dev);

#ifdef CONFIG_MACH_MIDAS_01_BD
	/* turn vdd_tflash off if a card exists*/
	if (sdhci_s3c_get_card_exist(host))
		sdhci_s3c_vtf_on_off(1);
	else
		sdhci_s3c_vtf_on_off(0);

#endif
	sdhci_resume_host(host);
	return 0;
}
Exemplo n.º 14
0
static int sdhci_s3c_resume(struct platform_device *dev)
{
	struct sdhci_host *host = platform_get_drvdata(dev);
	struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
	int ret;

	sdhci_resume_host(host);

	if(pdata && pdata->cfg_ext_cd){
		ret = request_irq(pdata->ext_cd, sdhci_irq_cd, IRQF_SHARED, mmc_hostname(host->mmc), sdhci_priv(host));
		if(ret)
			return ret;
	}

	return 0;
}
Exemplo n.º 15
0
static int sdhci_s3c_resume(struct platform_device *dev)
{
	struct sdhci_host *host = platform_get_drvdata(dev);
	struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
	u32 ier;

	sdhci_resume_host(host);

	if (pdata->enable_intr_on_resume) {
		ier = sdhci_readl(host, SDHCI_INT_ENABLE);
		ier |= SDHCI_INT_CARD_INT;
		sdhci_writel(host, ier, SDHCI_INT_ENABLE);
		sdhci_writel(host, ier, SDHCI_SIGNAL_ENABLE);
	}

	return 0;
}
static int sdhci_pltfm_resume(struct device *device)
{
	struct sdio_dev *dev =
		platform_get_drvdata(to_platform_device(device));
	struct sdhci_host *host = dev->host;
	int ret = 0;

	if (sdhci_pltfm_rpm_enabled(dev)) {
		/*
		 * Note that we havent done a put_sync. The
		 * pm core takes care of that.
		 */
		pm_runtime_get_sync(dev->dev);
	} else {
		ret = sdhci_pltfm_clk_enable(dev, 1);
		if (ret) {
			dev_err(dev->dev,
				"Failed to enable clock during resume\n");
			return -EAGAIN;
		}
	}

	ret = sdhci_resume_host(host);
	if (ret) {
		dev_err(dev->dev,
		 "Unable to resume sdhci host err=%d\n", ret);
		return ret;
	}

	if (!sdhci_pltfm_rpm_enabled(dev)) {
		ret = sdhci_pltfm_clk_enable(dev, 0);
		if (ret) {
			dev_err(dev->dev,
				"Failed to disable clock during resume\n");
			/* Not really a big error to cry and return*/
		}
	}

	dev->suspended = 0;

	if (dev->devtype == SDIO_DEV_TYPE_EMMC)
		host->mmc->pm_flags |= MMC_PM_KEEP_POWER;

	return 0;
}
Exemplo n.º 17
0
static int sdhci_s3c_resume(struct platform_device *dev)
{
	struct sdhci_host *host = platform_get_drvdata(dev);
	sdhci_resume_host(host);
	
#if defined(CONFIG_WIMAX_CMC) && defined(CONFIG_TARGET_LOCALE_NA)
      	struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
	u32 ier;
	if (pdata->enable_intr_on_resume) {
                ier = sdhci_readl(host, SDHCI_INT_ENABLE);
                ier |= SDHCI_INT_CARD_INT;
                sdhci_writel(host, ier, SDHCI_INT_ENABLE);
                sdhci_writel(host, ier, SDHCI_SIGNAL_ENABLE);
        } 
#endif

	return 0;
}
Exemplo n.º 18
0
static int sdhci_pltfm_resume(struct device *dev)
{
	struct sdhci_host *host = dev_get_drvdata(dev);
	int ret = 0;

	if (host->ops && host->ops->resume)
		ret = host->ops->resume(host);
	if (ret) {
		dev_err(dev, "resume hook failed, error = %d\n", ret);
		return ret;
	}

	ret = sdhci_resume_host(host);
	if (ret)
		dev_err(dev, "resume failed, error = %d\n", ret);

	return ret;
}
Exemplo n.º 19
0
static int tegra_sdhci_resume(struct platform_device *pdev)
{
	struct tegra_sdhci_host *host = platform_get_drvdata(pdev);
	int ret;
	u8 pwr;

	MMC_printk("%s:+", mmc_hostname(host->sdhci->mmc));

	if ((host->card_always_on && is_card_sdio(host->sdhci->mmc->card))||is_card_mmc(host->sdhci->mmc->card)) {
		int ret = 0;

		if (device_may_wakeup(&pdev->dev)) {
		        disable_irq_wake(host->sdhci->irq);
		}

		/* soft reset SD host controller and enable interrupts */
		ret = tegra_sdhci_restore(host->sdhci);
		if (ret) {
			pr_err("%s: failed, error = %d\n", __func__, ret);
			return ret;
		}

		mmiowb();
		host->sdhci->mmc->ops->set_ios(host->sdhci->mmc,
			&host->sdhci->mmc->ios);
		 printk("tegra_sdhci_suspend: skip %s resume(always on)!\n",is_card_mmc(host->sdhci->mmc->card)?"eMMC":"SDIO");
		return 0;
	}

	tegra_sdhci_enable_clock(host, 1);

	pwr = SDHCI_POWER_ON;
	sdhci_writeb(host->sdhci, pwr, SDHCI_POWER_CONTROL);
	host->sdhci->pwr = 0;

	ret = sdhci_resume_host(host->sdhci);
	if (ret)
		pr_err("%s: failed, error = %d\n", __func__, ret);

	MMC_printk("%s:-", mmc_hostname(host->sdhci->mmc));
	return ret;
}
Exemplo n.º 20
0
static int sdhci_pltfm_suspend(struct platform_device *dev, pm_message_t state)
{
	struct sdhci_host *host = platform_get_drvdata(dev);
	int ret;

	ret = sdhci_suspend_host(host, state);
	if (ret) {
		dev_err(&dev->dev, "suspend failed, error = %d\n", ret);
		return ret;
	}

	if (host->ops && host->ops->suspend)
		ret = host->ops->suspend(host, state);
	if (ret) {
		dev_err(&dev->dev, "suspend hook failed, error = %d\n", ret);
		sdhci_resume_host(host);
	}

	return ret;
}
Exemplo n.º 21
0
static int sdhci_pltfm_suspend(struct device *dev)
{
	struct sdhci_host *host = dev_get_drvdata(dev);
	int ret;

	ret = sdhci_suspend_host(host);
	if (ret) {
		dev_err(dev, "suspend failed, error = %d\n", ret);
		return ret;
	}

	if (host->ops && host->ops->suspend)
		ret = host->ops->suspend(host);
	if (ret) {
		dev_err(dev, "suspend hook failed, error = %d\n", ret);
		sdhci_resume_host(host);
	}

	return ret;
}
Exemplo n.º 22
0
static int sdhci_pltfm_resume(struct platform_device *dev)
{
	struct sdhci_host *host = platform_get_drvdata(dev);
	int ret = 0;
	MMC_printk("%s: ++", mmc_hostname(host->mmc));

	if (host->ops && host->ops->resume)
		ret = host->ops->resume(host);
	if (ret) {
		dev_err(&dev->dev, "resume hook failed, error = %d\n", ret);
		return ret;
	}

	ret = sdhci_resume_host(host);
	if (ret)
		dev_err(&dev->dev, "resume failed, error = %d\n", ret);

	MMC_printk("%s: --", mmc_hostname(host->mmc));
	return ret;
}
Exemplo n.º 23
0
/**
 * xsdhcips_resume - Resume method for the driver
 * @dev:	Address of the device structure
 * Returns 0 on success and error value on error
 *
 * Resume operation after suspend
 */
static int xsdhcips_resume(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct sdhci_host *host = platform_get_drvdata(pdev);
	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
	struct xsdhcips *xsdhcips = pltfm_host->priv;
	int ret;

	ret = clk_enable(xsdhcips->aperclk);
	if (ret) {
		dev_err(dev, "Cannot enable APER clock.\n");
		return ret;
	}

	ret = clk_enable(xsdhcips->devclk);
	if (ret) {
		dev_err(dev, "Cannot enable device clock.\n");
		clk_disable(xsdhcips->aperclk);
		return ret;
	}

	return sdhci_resume_host(host);
}
Exemplo n.º 24
0
static int sdhci_pm_resume(struct device *dev) {
    int				 retval = 0;
    unsigned long		 flags;
    struct platform_device	*pdev	= container_of(dev, struct platform_device, dev);
    struct sdhci_host		*host	= platform_get_drvdata(pdev);
    printk("%s: %s enter\n", mmc_hostname(host->mmc), __func__);
    if(is_wifi_slot(host) || is_cbp_slot(host) || is_sd_slot(host)) {
	    sdhci_sprd_set_base_clock(host);
    }
    spin_lock_irqsave(&host->lock, flags);
    if(host->ops->set_clock)
        host->ops->set_clock(host, 1);
    spin_unlock_irqrestore(&host->lock, flags);

    if(is_wifi_slot(host))
    {
        printk("[WLAN] resume read REG_AP_CLK_AP_AHB_CFG is %x\n",__raw_readl(REG_AP_CLK_AP_AHB_CFG));
		printk("[WLAN] resume read REG_AP_CLK_SDIO1_CFG is %x\n",__raw_readl(REG_AP_CLK_SDIO1_CFG));
	}
    
#ifdef CONFIG_MMC_HOST_WAKEUP_SUPPORTED
    if (pdev->id == 1)
        sdhci_host_wakeup_clear(host);
#endif
    retval = sdhci_resume_host(host);
#ifdef CONFIG_PM_RUNTIME
    if(pm_runtime_enabled(dev))
        pm_runtime_put_autosuspend(dev);
#endif
    if(is_wifi_slot(host))
     {
        dhd_mmc_suspend	= 0;
	printk("[WLAN] %s,dhd_mmc_suspend=%d\n",__func__,dhd_mmc_suspend);
     }
    printk("%s: %s leave retval %d\n", mmc_hostname(host->mmc), __func__, retval);
    return retval;
}
Exemplo n.º 25
0
static int sdhci_pltfm_resume(struct platform_device *dev)
{
	struct sdhci_host *host = platform_get_drvdata(dev);
	int ret = 0;

#if defined (CONFIG_MACH_STAR) //                                                                     
	if(host->irq==INT_SDMMC1)
		disable_irq_wake(host->irq);
#endif


	if (host->ops && host->ops->resume)
		ret = host->ops->resume(host);
	if (ret) {
		dev_err(&dev->dev, "resume hook failed, error = %d\n", ret);
		return ret;
	}

	ret = sdhci_resume_host(host);
	if (ret)
		dev_err(&dev->dev, "resume failed, error = %d\n", ret);

	return ret;
}
Exemplo n.º 26
0
static int tegra_sdhci_resume(struct platform_device *pdev)
{
	struct tegra_sdhci_host *host = platform_get_drvdata(pdev);
	int ret;
	u8 pwr;

	if (host->card_always_on && is_card_sdio(host->sdhci->mmc->card)) {
		int ret = 0;

		if (device_may_wakeup(&pdev->dev)) {
		        disable_irq_wake(host->sdhci->irq);
		}

		/* soft reset SD host controller and enable interrupts */
		ret = tegra_sdhci_restore(host->sdhci);
		if (ret) {
			pr_err("%s: failed, error = %d\n", __func__, ret);
			return ret;
		}

		mmiowb();
		host->sdhci->mmc->ops->set_ios(host->sdhci->mmc,
			&host->sdhci->mmc->ios);
		return 0;
	}

	if (host->cd_gpio != -1) {
		bool card_status_before_suspend =  host->card_present;

		if (host->cd_gpio != -1) {
			host->card_present = host->card_present_old = (gpio_get_value(host->cd_gpio) == host->cd_gpio_polarity);
		}
		pr_info("%s: card_status_before_suspend=%d, card_present=%d \n", __func__, card_status_before_suspend, host->card_present);
		if (card_status_before_suspend != host->card_present) {
			if (!host->card_present) {
#ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME
				mmc_set_bus_resume_policy(host->sdhci->mmc, 0);
#endif
			}
		}
	}

	tegra_sdhci_enable_clock(host, 1);

	pwr = SDHCI_POWER_ON;
	sdhci_writeb(host->sdhci, pwr, SDHCI_POWER_CONTROL);
	host->sdhci->pwr = 0;
	/*
	* Set disable_delay
	* to enable mmc_schedule_delay_work
	*/
	mmc_set_disable_delay(host->sdhci->mmc, 5);
	ret = sdhci_resume_host(host->sdhci);
	if (ret)
		pr_err("%s: failed, error = %d\n", __func__, ret);

	if (host->irq_cd != -1)
		enable_irq(host->irq_cd);

	return ret;
}
Exemplo n.º 27
0
static int sdhci_s3c_resume(struct device *dev)
{
	struct sdhci_host *host = dev_get_drvdata(dev);

	return sdhci_resume_host(host);
}
Exemplo n.º 28
0
int sdhci_pltfm_resume(struct platform_device *dev)
{
	struct sdhci_host *host = platform_get_drvdata(dev);

	return sdhci_resume_host(host);
}
Exemplo n.º 29
0
static int sdhci_acpi_resume(struct device *dev)
{
	struct sdhci_acpi_host *c = dev_get_drvdata(dev);

	return sdhci_resume_host(c->host);
}