exynos_dw_mmc.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * (C) Copyright 2012 SAMSUNG Electronics
  3. * Jaehoon Chung <jh80.chung@samsung.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. *
  19. */
  20. #include <common.h>
  21. #include <malloc.h>
  22. #include <dwmmc.h>
  23. #include <asm/arch/dwmmc.h>
  24. #include <asm/arch/clk.h>
  25. static char *EXYNOS_NAME = "EXYNOS DWMMC";
  26. static void exynos_dwmci_clksel(struct dwmci_host *host)
  27. {
  28. u32 val;
  29. val = DWMCI_SET_SAMPLE_CLK(DWMCI_SHIFT_0) |
  30. DWMCI_SET_DRV_CLK(DWMCI_SHIFT_0) | DWMCI_SET_DIV_RATIO(0);
  31. dwmci_writel(host, DWMCI_CLKSEL, val);
  32. }
  33. int exynos_dwmci_init(u32 regbase, int bus_width, int index)
  34. {
  35. struct dwmci_host *host = NULL;
  36. host = malloc(sizeof(struct dwmci_host));
  37. if (!host) {
  38. printf("dwmci_host malloc fail!\n");
  39. return 1;
  40. }
  41. host->name = EXYNOS_NAME;
  42. host->ioaddr = (void *)regbase;
  43. host->buswidth = bus_width;
  44. host->clksel = exynos_dwmci_clksel;
  45. host->dev_index = index;
  46. add_dwmci(host, 52000000, 400000);
  47. return 0;
  48. }