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>
|
|
|
|
|
2016-01-05 06:51:04 +00:00
|
|
|
#ifndef CONFIG_ZYNQ_SDHCI_MIN_FREQ
|
|
|
|
# define CONFIG_ZYNQ_SDHCI_MIN_FREQ 0
|
|
|
|
#endif
|
|
|
|
|
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;
|
2016-01-12 09:42:16 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_ZYNQ_HISPD_BROKEN
|
|
|
|
host->quirks |= SDHCI_QUIRK_NO_HISPD_BIT;
|
|
|
|
#endif
|
|
|
|
|
2013-04-22 12:56:49 +00:00
|
|
|
host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
|
|
|
|
|
2016-01-05 06:51:04 +00:00
|
|
|
add_sdhci(host, CONFIG_ZYNQ_SDHCI_MAX_FREQ,
|
|
|
|
CONFIG_ZYNQ_SDHCI_MIN_FREQ);
|
2015-11-30 15:13:03 +00:00
|
|
|
|
|
|
|
upriv->mmc = host->mmc;
|
2016-05-01 19:52:34 +00:00
|
|
|
host->mmc->dev = dev;
|
2015-11-30 15:13:03 +00:00
|
|
|
|
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);
|
|
|
|
|
2016-04-22 11:59:31 +00:00
|
|
|
host->name = dev->name;
|
2015-11-30 15:13:03 +00:00
|
|
|
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),
|
|
|
|
};
|