]> git.sur5r.net Git - u-boot/blob - drivers/mmc/zynq_sdhci.c
sdhci: zynq: Remove hardcoded value zero as min frequency
[u-boot] / drivers / mmc / zynq_sdhci.c
1 /*
2  * (C) Copyright 2013 - 2015 Xilinx, Inc.
3  *
4  * Xilinx Zynq SD Host Controller Interface
5  *
6  * SPDX-License-Identifier:     GPL-2.0+
7  */
8
9 #include <common.h>
10 #include <dm.h>
11 #include <fdtdec.h>
12 #include <libfdt.h>
13 #include <malloc.h>
14 #include <sdhci.h>
15
16 #ifndef CONFIG_ZYNQ_SDHCI_MIN_FREQ
17 # define CONFIG_ZYNQ_SDHCI_MIN_FREQ     0
18 #endif
19
20 static int arasan_sdhci_probe(struct udevice *dev)
21 {
22         struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
23         struct sdhci_host *host = dev_get_priv(dev);
24
25         host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD |
26                        SDHCI_QUIRK_BROKEN_R1B;
27         host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
28
29         add_sdhci(host, CONFIG_ZYNQ_SDHCI_MAX_FREQ,
30                   CONFIG_ZYNQ_SDHCI_MIN_FREQ);
31
32         upriv->mmc = host->mmc;
33
34         return 0;
35 }
36
37 static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
38 {
39         struct sdhci_host *host = dev_get_priv(dev);
40
41         host->name = (char *)dev->name;
42         host->ioaddr = (void *)dev_get_addr(dev);
43
44         return 0;
45 }
46
47 static const struct udevice_id arasan_sdhci_ids[] = {
48         { .compatible = "arasan,sdhci-8.9a" },
49         { }
50 };
51
52 U_BOOT_DRIVER(arasan_sdhci_drv) = {
53         .name           = "arasan_sdhci",
54         .id             = UCLASS_MMC,
55         .of_match       = arasan_sdhci_ids,
56         .ofdata_to_platdata = arasan_sdhci_ofdata_to_platdata,
57         .probe          = arasan_sdhci_probe,
58         .priv_auto_alloc_size = sizeof(struct sdhci_host),
59 };