2 * Copyright (C) 2015, Google, Inc
3 * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
5 * SPDX-License-Identifier: GPL-2.0+
17 struct mmc_config cfg;
22 struct sdhci_host host;
26 static int pci_mmc_probe(struct udevice *dev)
28 struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
29 struct pci_mmc_plat *plat = dev_get_platdata(dev);
30 struct pci_mmc_priv *priv = dev_get_priv(dev);
31 struct sdhci_host *host = &priv->host;
35 dm_pci_read_config32(dev, PCI_BASE_ADDRESS_0, &ioaddr);
36 host->ioaddr = map_sysmem(ioaddr, 0);
37 host->name = dev->name;
38 ret = sdhci_setup_cfg(&plat->cfg, host, 0, 0);
41 host->mmc = &plat->mmc;
42 host->mmc->priv = &priv->host;
44 upriv->mmc = host->mmc;
46 return sdhci_probe(dev);
49 static int pci_mmc_bind(struct udevice *dev)
51 struct pci_mmc_plat *plat = dev_get_platdata(dev);
53 return sdhci_bind(dev, &plat->mmc, &plat->cfg);
56 U_BOOT_DRIVER(pci_mmc) = {
60 .probe = pci_mmc_probe,
62 .priv_auto_alloc_size = sizeof(struct pci_mmc_priv),
63 .platdata_auto_alloc_size = sizeof(struct pci_mmc_plat),
66 static struct pci_device_id mmc_supported[] = {
67 { PCI_DEVICE_CLASS(PCI_CLASS_SYSTEM_SDHCI << 8, 0xffff00) },
71 U_BOOT_PCI_DEVICE(pci_mmc, mmc_supported);