]> git.ipfire.org Git - people/ms/u-boot.git/blame - drivers/mmc/zynq_sdhci.c
ARM: DRA7: Add ABB setup for all domains
[people/ms/u-boot.git] / drivers / mmc / zynq_sdhci.c
CommitLineData
293eb33f 1/*
d9ae52c8 2 * (C) Copyright 2013 - 2015 Xilinx, Inc.
293eb33f
MS
3 *
4 * Xilinx Zynq SD Host Controller Interface
5 *
1a459660 6 * SPDX-License-Identifier: GPL-2.0+
293eb33f
MS
7 */
8
9#include <common.h>
d9ae52c8 10#include <dm.h>
345d3c0f
MS
11#include <fdtdec.h>
12#include <libfdt.h>
293eb33f
MS
13#include <malloc.h>
14#include <sdhci.h>
293eb33f 15
a57a4a5d
SDPP
16#ifndef CONFIG_ZYNQ_SDHCI_MIN_FREQ
17# define CONFIG_ZYNQ_SDHCI_MIN_FREQ 0
18#endif
19
d9ae52c8 20static int arasan_sdhci_probe(struct udevice *dev)
293eb33f 21{
d9ae52c8
MS
22 struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
23 struct sdhci_host *host = dev_get_priv(dev);
293eb33f 24
eddabd16 25 host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD |
f9ec45d1 26 SDHCI_QUIRK_BROKEN_R1B;
b2156146
SDPP
27
28#ifdef CONFIG_ZYNQ_HISPD_BROKEN
29 host->quirks |= SDHCI_QUIRK_NO_HISPD_BIT;
30#endif
31
293eb33f
MS
32 host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
33
a57a4a5d
SDPP
34 add_sdhci(host, CONFIG_ZYNQ_SDHCI_MAX_FREQ,
35 CONFIG_ZYNQ_SDHCI_MIN_FREQ);
d9ae52c8
MS
36
37 upriv->mmc = host->mmc;
38
293eb33f
MS
39 return 0;
40}
d9ae52c8
MS
41
42static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
43{
44 struct sdhci_host *host = dev_get_priv(dev);
45
46 host->name = (char *)dev->name;
47 host->ioaddr = (void *)dev_get_addr(dev);
48
49 return 0;
50}
51
52static const struct udevice_id arasan_sdhci_ids[] = {
53 { .compatible = "arasan,sdhci-8.9a" },
54 { }
55};
56
57U_BOOT_DRIVER(arasan_sdhci_drv) = {
58 .name = "arasan_sdhci",
59 .id = UCLASS_MMC,
60 .of_match = arasan_sdhci_ids,
61 .ofdata_to_platdata = arasan_sdhci_ofdata_to_platdata,
62 .probe = arasan_sdhci_probe,
63 .priv_auto_alloc_size = sizeof(struct sdhci_host),
64};