Commit 962336b9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull MMC fixes from Ulf Hansson:
 "MMC core:
   - Avoid bitfield RMW for claim/retune flags

  MMC host:
   - dw_mmc-rockchip: Fix runtime PM support for internal phase support
   - mmci: Fix device_node reference leak in of_get_dml_pipe_index()
   - sdhci-brcmstb: Use correct register offset for V1 pin_sel restore"

* tag 'mmc-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
  mmc: core: Avoid bitfield RMW for claim/retune flags
  mmc: sdhci-brcmstb: use correct register offset for V1 pin_sel restore
  mmc: dw_mmc-rockchip: Fix runtime PM support for internal phase support
  mmc: mmci: Fix device_node reference leak in of_get_dml_pipe_index()
parents 78d964c4 901084c5
Loading
Loading
Loading
Loading
+37 −1
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ struct dw_mci_rockchip_priv_data {
	int			default_sample_phase;
	int			num_phases;
	bool			internal_phase;
	int                     sample_phase;
	int                     drv_phase;
};

/*
@@ -573,9 +575,43 @@ static void dw_mci_rockchip_remove(struct platform_device *pdev)
	dw_mci_pltfm_remove(pdev);
}

static int dw_mci_rockchip_runtime_suspend(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct dw_mci *host = platform_get_drvdata(pdev);
	struct dw_mci_rockchip_priv_data *priv = host->priv;

	if (priv->internal_phase) {
		priv->sample_phase = rockchip_mmc_get_phase(host, true);
		priv->drv_phase = rockchip_mmc_get_phase(host, false);
	}

	return dw_mci_runtime_suspend(dev);
}

static int dw_mci_rockchip_runtime_resume(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct dw_mci *host = platform_get_drvdata(pdev);
	struct dw_mci_rockchip_priv_data *priv = host->priv;
	int ret;

	ret = dw_mci_runtime_resume(dev);
	if (ret)
		return ret;

	if (priv->internal_phase) {
		rockchip_mmc_set_phase(host, true, priv->sample_phase);
		rockchip_mmc_set_phase(host, false, priv->drv_phase);
		mci_writel(host, MISC_CON, MEM_CLK_AUTOGATE_ENABLE);
	}

	return ret;
}

static const struct dev_pm_ops dw_mci_rockchip_dev_pm_ops = {
	SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
	RUNTIME_PM_OPS(dw_mci_runtime_suspend, dw_mci_runtime_resume, NULL)
	RUNTIME_PM_OPS(dw_mci_rockchip_runtime_suspend, dw_mci_rockchip_runtime_resume, NULL)
};

static struct platform_driver dw_mci_rockchip_pltfm_driver = {
+1 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ static int of_get_dml_pipe_index(struct device_node *np, const char *name)
				       &dma_spec))
		return -ENODEV;

	of_node_put(dma_spec.np);
	if (dma_spec.args_count)
		return dma_spec.args[0];

+1 −1
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ static void sdhci_brcmstb_restore_regs(struct mmc_host *mmc, enum cfg_core_ver v
		writel(sr->boot_main_ctl, priv->boot_regs + SDIO_BOOT_MAIN_CTL);

	if (ver == SDIO_CFG_CORE_V1) {
		writel(sr->sd_pin_sel, cr + SDIO_CFG_SD_PIN_SEL);
		writel(sr->sd_pin_sel, cr + SDIO_CFG_V1_SD_PIN_SEL);
		return;
	}

+5 −4
Original line number Diff line number Diff line
@@ -486,14 +486,12 @@ struct mmc_host {

	struct mmc_ios		ios;		/* current io bus settings */

	bool			claimed;	/* host exclusively claimed */

	/* group bitfields together to minimize padding */
	unsigned int		use_spi_crc:1;
	unsigned int		claimed:1;	/* host exclusively claimed */
	unsigned int		doing_init_tune:1; /* initial tuning in progress */
	unsigned int		can_retune:1;	/* re-tuning can be used */
	unsigned int		doing_retune:1;	/* re-tuning in progress */
	unsigned int		retune_now:1;	/* do re-tuning at next req */
	unsigned int		retune_paused:1; /* re-tuning is temporarily disabled */
	unsigned int		retune_crc_disable:1; /* don't trigger retune upon crc */
	unsigned int		can_dma_map_merge:1; /* merging can be used */
	unsigned int		vqmmc_enabled:1; /* vqmmc regulator is enabled */
@@ -508,6 +506,9 @@ struct mmc_host {
	int			rescan_disable;	/* disable card detection */
	int			rescan_entered;	/* used with nonremovable devices */

	bool			can_retune;	/* re-tuning can be used */
	bool			retune_now;	/* do re-tuning at next req */
	bool			retune_paused;	/* re-tuning is temporarily disabled */
	int			need_retune;	/* re-tuning is needed */
	int			hold_retune;	/* hold off re-tuning */
	unsigned int		retune_period;	/* re-tuning period in secs */