zynq_sdhci.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #include <common.h>
  9. #include <dm.h>
  10. #include <fdtdec.h>
  11. #include <libfdt.h>
  12. #include <malloc.h>
  13. #include <sdhci.h>
  14. #ifndef CONFIG_ZYNQ_SDHCI_MIN_FREQ
  15. # define CONFIG_ZYNQ_SDHCI_MIN_FREQ 0
  16. #endif
  17. static int arasan_sdhci_probe(struct udevice *dev)
  18. {
  19. struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
  20. struct sdhci_host *host = dev_get_priv(dev);
  21. host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD |
  22. SDHCI_QUIRK_BROKEN_R1B;
  23. host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
  24. add_sdhci(host, CONFIG_ZYNQ_SDHCI_MAX_FREQ,
  25. CONFIG_ZYNQ_SDHCI_MIN_FREQ);
  26. upriv->mmc = host->mmc;
  27. return 0;
  28. }
  29. static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
  30. {
  31. struct sdhci_host *host = dev_get_priv(dev);
  32. host->name = (char *)dev->name;
  33. host->ioaddr = (void *)dev_get_addr(dev);
  34. return 0;
  35. }
  36. static const struct udevice_id arasan_sdhci_ids[] = {
  37. { .compatible = "arasan,sdhci-8.9a" },
  38. { }
  39. };
  40. U_BOOT_DRIVER(arasan_sdhci_drv) = {
  41. .name = "arasan_sdhci",
  42. .id = UCLASS_MMC,
  43. .of_match = arasan_sdhci_ids,
  44. .ofdata_to_platdata = arasan_sdhci_ofdata_to_platdata,
  45. .probe = arasan_sdhci_probe,
  46. .priv_auto_alloc_size = sizeof(struct sdhci_host),
  47. };