m54418twr.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * Copyright 2010-2012 Freescale Semiconductor, Inc.
  3. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <spi.h>
  25. #include <asm/io.h>
  26. #include <asm/immap.h>
  27. #include <mmc.h>
  28. #include <fsl_esdhc.h>
  29. DECLARE_GLOBAL_DATA_PTR;
  30. int checkboard(void)
  31. {
  32. /*
  33. * need to to:
  34. * Check serial flash size. if 2mb evb, else 8mb demo
  35. */
  36. puts("Board: ");
  37. puts("Freescale MCF54418 Tower System\n");
  38. return 0;
  39. };
  40. phys_size_t initdram(int board_type)
  41. {
  42. u32 dramsize;
  43. #if defined(CONFIG_SERIAL_BOOT)
  44. /*
  45. * Serial Boot: The dram is already initialized in start.S
  46. * only require to return DRAM size
  47. */
  48. dramsize = CONFIG_SYS_SDRAM_SIZE * 0x100000;
  49. #else
  50. sdramc_t *sdram = (sdramc_t *)(MMAP_SDRAM);
  51. ccm_t *ccm = (ccm_t *)MMAP_CCM;
  52. gpio_t *gpio = (gpio_t *) MMAP_GPIO;
  53. pm_t *pm = (pm_t *) MMAP_PM;
  54. u32 i;
  55. dramsize = CONFIG_SYS_SDRAM_SIZE * 0x100000;
  56. for (i = 0x13; i < 0x20; i++) {
  57. if (dramsize == (1 << i))
  58. break;
  59. }
  60. out_8(&pm->pmcr0, 0x2E);
  61. out_8(&gpio->mscr_sdram, 1);
  62. clrbits_be16(&ccm->misccr2, CCM_MISCCR2_FBHALF);
  63. setbits_be16(&ccm->misccr2, CCM_MISCCR2_DDR2CLK);
  64. out_be32(&sdram->rcrcr, 0x40000000);
  65. out_be32(&sdram->padcr, 0x01030203);
  66. out_be32(&sdram->cr00, 0x01010101);
  67. out_be32(&sdram->cr01, 0x00000101);
  68. out_be32(&sdram->cr02, 0x01010100);
  69. out_be32(&sdram->cr03, 0x01010000);
  70. out_be32(&sdram->cr04, 0x00010101);
  71. out_be32(&sdram->cr06, 0x00010100);
  72. out_be32(&sdram->cr07, 0x00000001);
  73. out_be32(&sdram->cr08, 0x01000001);
  74. out_be32(&sdram->cr09, 0x00000100);
  75. out_be32(&sdram->cr10, 0x00010001);
  76. out_be32(&sdram->cr11, 0x00000200);
  77. out_be32(&sdram->cr12, 0x01000002);
  78. out_be32(&sdram->cr13, 0x00000000);
  79. out_be32(&sdram->cr14, 0x00000100);
  80. out_be32(&sdram->cr15, 0x02000100);
  81. out_be32(&sdram->cr16, 0x02000407);
  82. out_be32(&sdram->cr17, 0x02030007);
  83. out_be32(&sdram->cr18, 0x02000100);
  84. out_be32(&sdram->cr19, 0x0A030203);
  85. out_be32(&sdram->cr20, 0x00020708);
  86. out_be32(&sdram->cr21, 0x00050008);
  87. out_be32(&sdram->cr22, 0x04030002);
  88. out_be32(&sdram->cr23, 0x00000004);
  89. out_be32(&sdram->cr24, 0x020A0000);
  90. out_be32(&sdram->cr25, 0x0C00000E);
  91. out_be32(&sdram->cr26, 0x00002004);
  92. out_be32(&sdram->cr28, 0x00100010);
  93. out_be32(&sdram->cr29, 0x00100010);
  94. out_be32(&sdram->cr31, 0x07990000);
  95. out_be32(&sdram->cr40, 0x00000000);
  96. out_be32(&sdram->cr41, 0x00C80064);
  97. out_be32(&sdram->cr42, 0x44520002);
  98. out_be32(&sdram->cr43, 0x00C80023);
  99. out_be32(&sdram->cr45, 0x0000C350);
  100. out_be32(&sdram->cr56, 0x04000000);
  101. out_be32(&sdram->cr57, 0x03000304);
  102. out_be32(&sdram->cr58, 0x40040000);
  103. out_be32(&sdram->cr59, 0xC0004004);
  104. out_be32(&sdram->cr60, 0x0642C000);
  105. out_be32(&sdram->cr61, 0x00000642);
  106. asm("tpf");
  107. out_be32(&sdram->cr09, 0x01000100);
  108. udelay(100);
  109. #endif
  110. return dramsize;
  111. };
  112. int testdram(void)
  113. {
  114. return 0;
  115. }