summaryrefslogtreecommitdiff
path: root/drivers/mmc/host/dw_mmc-pci.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-10 11:16:00 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-10 11:16:00 -0700
commitbfffbea1aaeeb1eb6500c83ff9653416daa5b490 (patch)
tree1325ecb176b7a3d04924d6a1563b15ad6085d36a /drivers/mmc/host/dw_mmc-pci.c
parent34ae0a6f05aee9f51fca17001b4a90703d434ae1 (diff)
parent01ebea1b411aafc8eab440bf1d2037f01bbed99b (diff)
Merge tag 'mmc-updates-for-3.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc
Pull MMC updates from Chris Ball: "MMC highlights for 3.11: Core: - Add support for eMMC 5.1 devices - Add MMC_CAP_AGGRESSIVE_PM capability for aggressive power management of eMMC/SD between requests, using runtime PM - Add an ioctl to perform the eMMC 4.5 Sanitize command. Sample code at: git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git Drivers: - dw_mmc: Add support for Rockchip's Cortex-A9 SoCs - dw_mmc: Add support for Altera SoCFPGAs - sdhci-esdhc-imx: Add support for 8-bit bus width, non-removable cards - sdhci-bcm-kona: New driver for Broadcom Kona (281xx) SoCs - sdhi/tmio: Add DT DMA support" * tag 'mmc-updates-for-3.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: (87 commits) mmc: bcm281xx SDHCI driver mmc: sdhci: add card_event callback to sdhci mmc: core: Fixup Oops for SDIO shutdown mmc: sdhci-pci: add another device id mmc: esdhc: Fix bug when writing to SDHCI_HOST_CONTROL register mmc: esdhc: Add support for 8-bit bus width and non-removable card mmc: core: production year for eMMC 4.41 and later mmc: omap: remove unnecessary #if 0's mmc: sdhci: fix ctrl_2 on super-speed selection mmc: dw_mmc-pltfm: add Rockchip variant mmc: dw_mmc-pltfm: move probe and remove below dt match table mmc: dw_mmc-pltfm: remove static from dw_mci_pltfm_remove mmc: sdhci-acpi: add support for eMMC hardware reset for HID 80860F14 mmc: sdhci-pci: add support for eMMC hardware reset for BYT eMMC. mmc: dw_mmc: Add support DW SD/MMC driver on SOCFPGA mmc: sdhci: fix caps2 for HS200 sdhci-pxav3: Fix runtime PM initialization mmc: core: Add DT-bindings for MMC_CAP2_FULL_PWR_CYCLE mmc: core: Invent MMC_CAP2_FULL_PWR_CYCLE mmc: core: Enable power_off_notify for eMMC shutdown sequence ...
Diffstat (limited to 'drivers/mmc/host/dw_mmc-pci.c')
-rw-r--r--drivers/mmc/host/dw_mmc-pci.c58
1 files changed, 17 insertions, 41 deletions
diff --git a/drivers/mmc/host/dw_mmc-pci.c b/drivers/mmc/host/dw_mmc-pci.c
index 083fcd29c9c6..b456b0c35231 100644
--- a/drivers/mmc/host/dw_mmc-pci.c
+++ b/drivers/mmc/host/dw_mmc-pci.c
@@ -21,7 +21,6 @@
#include "dw_mmc.h"
#define PCI_BAR_NO 2
-#define COMPLETE_BAR 0
#define SYNOPSYS_DW_MCI_VENDOR_ID 0x700
#define SYNOPSYS_DW_MCI_DEVICE_ID 0x1107
/* Defining the Capabilities */
@@ -38,51 +37,37 @@ static struct dw_mci_board pci_board_data = {
};
static int dw_mci_pci_probe(struct pci_dev *pdev,
- const struct pci_device_id *entries)
+ const struct pci_device_id *entries)
{
struct dw_mci *host;
int ret;
- ret = pci_enable_device(pdev);
+ ret = pcim_enable_device(pdev);
if (ret)
return ret;
- if (pci_request_regions(pdev, "dw_mmc_pci")) {
- ret = -ENODEV;
- goto err_disable_dev;
- }
- host = kzalloc(sizeof(struct dw_mci), GFP_KERNEL);
- if (!host) {
- ret = -ENOMEM;
- goto err_release;
- }
+ host = devm_kzalloc(&pdev->dev, sizeof(struct dw_mci), GFP_KERNEL);
+ if (!host)
+ return -ENOMEM;
host->irq = pdev->irq;
host->irq_flags = IRQF_SHARED;
host->dev = &pdev->dev;
host->pdata = &pci_board_data;
- host->regs = pci_iomap(pdev, PCI_BAR_NO, COMPLETE_BAR);
- if (!host->regs) {
- ret = -EIO;
- goto err_unmap;
- }
+ ret = pcim_iomap_regions(pdev, 1 << PCI_BAR_NO, pci_name(pdev));
+ if (ret)
+ return ret;
+
+ host->regs = pcim_iomap_table(pdev)[0];
- pci_set_drvdata(pdev, host);
ret = dw_mci_probe(host);
if (ret)
- goto err_probe_failed;
- return ret;
-
-err_probe_failed:
- pci_iounmap(pdev, host->regs);
-err_unmap:
- kfree(host);
-err_release:
- pci_release_regions(pdev);
-err_disable_dev:
- pci_disable_device(pdev);
- return ret;
+ return ret;
+
+ pci_set_drvdata(pdev, host);
+
+ return 0;
}
static void dw_mci_pci_remove(struct pci_dev *pdev)
@@ -90,32 +75,23 @@ static void dw_mci_pci_remove(struct pci_dev *pdev)
struct dw_mci *host = pci_get_drvdata(pdev);
dw_mci_remove(host);
- pci_set_drvdata(pdev, NULL);
- pci_release_regions(pdev);
- pci_iounmap(pdev, host->regs);
- kfree(host);
- pci_disable_device(pdev);
}
#ifdef CONFIG_PM_SLEEP
static int dw_mci_pci_suspend(struct device *dev)
{
- int ret;
struct pci_dev *pdev = to_pci_dev(dev);
struct dw_mci *host = pci_get_drvdata(pdev);
- ret = dw_mci_suspend(host);
- return ret;
+ return dw_mci_suspend(host);
}
static int dw_mci_pci_resume(struct device *dev)
{
- int ret;
struct pci_dev *pdev = to_pci_dev(dev);
struct dw_mci *host = pci_get_drvdata(pdev);
- ret = dw_mci_resume(host);
- return ret;
+ return dw_mci_resume(host);
}
#else
#define dw_mci_pci_suspend NULL