ftsdc021_sdhci.c 638 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * (C) Copyright 2013 Faraday Technology
  3. * Kuo-Jung Su <dantesu@faraday-tech.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <malloc.h>
  9. #include <sdhci.h>
  10. #ifndef CONFIG_FTSDC021_CLOCK
  11. #define CONFIG_FTSDC021_CLOCK clk_get_rate("MMC")
  12. #endif
  13. int ftsdc021_sdhci_init(u32 regbase)
  14. {
  15. struct sdhci_host *host = NULL;
  16. uint32_t freq = CONFIG_FTSDC021_CLOCK;
  17. host = calloc(1, sizeof(struct sdhci_host));
  18. if (!host) {
  19. puts("sdh_host malloc fail!\n");
  20. return -ENOMEM;
  21. }
  22. host->name = "FTSDC021";
  23. host->ioaddr = (void __iomem *)regbase;
  24. host->quirks = 0;
  25. add_sdhci(host, freq, 0);
  26. return 0;
  27. }