blob: 4fe3da93b206d0df8706efd371df44f653f4f60e [file] [log] [blame]
Michal Simek293eb332013-04-22 14:56:49 +02001/*
Michal Simekd9ae52c2015-11-30 16:13:03 +01002 * (C) Copyright 2013 - 2015 Xilinx, Inc.
Michal Simek293eb332013-04-22 14:56:49 +02003 *
4 * Xilinx Zynq SD Host Controller Interface
5 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Michal Simek293eb332013-04-22 14:56:49 +02007 */
8
9#include <common.h>
Michal Simekd9ae52c2015-11-30 16:13:03 +010010#include <dm.h>
Michal Simek345d3c02014-02-24 11:16:31 +010011#include <fdtdec.h>
12#include <libfdt.h>
Michal Simek293eb332013-04-22 14:56:49 +020013#include <malloc.h>
14#include <sdhci.h>
Michal Simek293eb332013-04-22 14:56:49 +020015
Michal Simekd9ae52c2015-11-30 16:13:03 +010016static int arasan_sdhci_probe(struct udevice *dev)
Michal Simek293eb332013-04-22 14:56:49 +020017{
Michal Simekd9ae52c2015-11-30 16:13:03 +010018 struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
19 struct sdhci_host *host = dev_get_priv(dev);
Michal Simek293eb332013-04-22 14:56:49 +020020
Siva Durga Prasad Paladugueddabd12014-07-08 15:31:04 +053021 host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD |
Siva Durga Prasad Paladuguf9ec45d2014-01-22 09:17:09 +010022 SDHCI_QUIRK_BROKEN_R1B;
Michal Simek293eb332013-04-22 14:56:49 +020023 host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
24
Siva Durga Prasad Paladugub8a9beb2015-11-25 11:51:37 +053025 add_sdhci(host, CONFIG_ZYNQ_SDHCI_MAX_FREQ, 0);
Michal Simekd9ae52c2015-11-30 16:13:03 +010026
27 upriv->mmc = host->mmc;
28
Michal Simek293eb332013-04-22 14:56:49 +020029 return 0;
30}
Michal Simekd9ae52c2015-11-30 16:13:03 +010031
32static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
33{
34 struct sdhci_host *host = dev_get_priv(dev);
35
36 host->name = (char *)dev->name;
37 host->ioaddr = (void *)dev_get_addr(dev);
38
39 return 0;
40}
41
42static const struct udevice_id arasan_sdhci_ids[] = {
43 { .compatible = "arasan,sdhci-8.9a" },
44 { }
45};
46
47U_BOOT_DRIVER(arasan_sdhci_drv) = {
48 .name = "arasan_sdhci",
49 .id = UCLASS_MMC,
50 .of_match = arasan_sdhci_ids,
51 .ofdata_to_platdata = arasan_sdhci_ofdata_to_platdata,
52 .probe = arasan_sdhci_probe,
53 .priv_auto_alloc_size = sizeof(struct sdhci_host),
54};