2013-04-22 12:56:49 +00:00
|
|
|
/*
|
2015-11-30 15:13:03 +00:00
|
|
|
* (C) Copyright 2013 - 2015 Xilinx, Inc.
|
2013-04-22 12:56:49 +00:00
|
|
|
*
|
|
|
|
* Xilinx Zynq SD Host Controller Interface
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2013-04-22 12:56:49 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2015-11-30 15:13:03 +00:00
|
|
|
#include <dm.h>
|
2014-02-24 10:16:31 +00:00
|
|
|
#include <fdtdec.h>
|
|
|
|
#include <libfdt.h>
|
2013-04-22 12:56:49 +00:00
|
|
|
#include <malloc.h>
|
|
|
|
#include <sdhci.h>
|
|
|
|
|
2015-11-30 15:13:03 +00:00
|
|
|
static int arasan_sdhci_probe(struct udevice *dev)
|
2013-04-22 12:56:49 +00:00
|
|
|
{
|
2015-11-30 15:13:03 +00:00
|
|
|
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
|
|
|
|
struct sdhci_host *host = dev_get_priv(dev);
|
2013-04-22 12:56:49 +00:00
|
|
|
|
2014-07-08 10:01:04 +00:00
|
|
|
host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD |
|
2014-01-22 08:17:09 +00:00
|
|
|
SDHCI_QUIRK_BROKEN_R1B;
|
2013-04-22 12:56:49 +00:00
|
|
|
host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
|
|
|
|
|
2015-11-25 06:21:37 +00:00
|
|
|
add_sdhci(host, CONFIG_ZYNQ_SDHCI_MAX_FREQ, 0);
|
2015-11-30 15:13:03 +00:00
|
|
|
|
|
|
|
upriv->mmc = host->mmc;
|
|
|
|
|
2013-04-22 12:56:49 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2015-11-30 15:13:03 +00:00
|
|
|
|
|
|
|
static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
|
|
|
|
{
|
|
|
|
struct sdhci_host *host = dev_get_priv(dev);
|
|
|
|
|
|
|
|
host->name = (char *)dev->name;
|
|
|
|
host->ioaddr = (void *)dev_get_addr(dev);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct udevice_id arasan_sdhci_ids[] = {
|
|
|
|
{ .compatible = "arasan,sdhci-8.9a" },
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
U_BOOT_DRIVER(arasan_sdhci_drv) = {
|
|
|
|
.name = "arasan_sdhci",
|
|
|
|
.id = UCLASS_MMC,
|
|
|
|
.of_match = arasan_sdhci_ids,
|
|
|
|
.ofdata_to_platdata = arasan_sdhci_ofdata_to_platdata,
|
|
|
|
.probe = arasan_sdhci_probe,
|
|
|
|
.priv_auto_alloc_size = sizeof(struct sdhci_host),
|
|
|
|
};
|