2 * (C) Copyright 2013 - 2015 Xilinx, Inc.
4 * Xilinx Zynq SD Host Controller Interface
6 * SPDX-License-Identifier: GPL-2.0+
16 #ifndef CONFIG_ZYNQ_SDHCI_MIN_FREQ
17 # define CONFIG_ZYNQ_SDHCI_MIN_FREQ 0
20 struct arasan_sdhci_plat {
21 struct mmc_config cfg;
25 static int arasan_sdhci_probe(struct udevice *dev)
27 struct arasan_sdhci_plat *plat = dev_get_platdata(dev);
28 struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
29 struct sdhci_host *host = dev_get_priv(dev);
33 host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD |
34 SDHCI_QUIRK_BROKEN_R1B;
36 #ifdef CONFIG_ZYNQ_HISPD_BROKEN
37 host->quirks |= SDHCI_QUIRK_NO_HISPD_BIT;
40 host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
42 caps = sdhci_readl(host, SDHCI_CAPABILITIES);
43 ret = sdhci_setup_cfg(&plat->cfg, dev->name,
44 caps, CONFIG_ZYNQ_SDHCI_MAX_FREQ,
45 CONFIG_ZYNQ_SDHCI_MIN_FREQ, host->version,
47 host->mmc = &plat->mmc;
50 host->mmc->priv = host;
52 upriv->mmc = host->mmc;
54 return sdhci_probe(dev);
57 static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
59 struct sdhci_host *host = dev_get_priv(dev);
61 host->name = dev->name;
62 host->ioaddr = (void *)dev_get_addr(dev);
67 static int arasan_sdhci_bind(struct udevice *dev)
69 struct arasan_sdhci_plat *plat = dev_get_platdata(dev);
72 ret = sdhci_bind(dev, &plat->mmc, &plat->cfg);
79 static const struct udevice_id arasan_sdhci_ids[] = {
80 { .compatible = "arasan,sdhci-8.9a" },
84 U_BOOT_DRIVER(arasan_sdhci_drv) = {
85 .name = "arasan_sdhci",
87 .of_match = arasan_sdhci_ids,
88 .ofdata_to_platdata = arasan_sdhci_ofdata_to_platdata,
90 .bind = arasan_sdhci_bind,
91 .probe = arasan_sdhci_probe,
92 .priv_auto_alloc_size = sizeof(struct sdhci_host),
93 .platdata_auto_alloc_size = sizeof(struct arasan_sdhci_plat),