m54418twr.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * Copyright 2010-2012 Freescale Semiconductor, Inc.
  3. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <spi.h>
  9. #include <asm/io.h>
  10. #include <asm/immap.h>
  11. #include <mmc.h>
  12. #include <fsl_esdhc.h>
  13. DECLARE_GLOBAL_DATA_PTR;
  14. int checkboard(void)
  15. {
  16. /*
  17. * need to to:
  18. * Check serial flash size. if 2mb evb, else 8mb demo
  19. */
  20. puts("Board: ");
  21. puts("Freescale MCF54418 Tower System\n");
  22. return 0;
  23. };
  24. phys_size_t initdram(int board_type)
  25. {
  26. u32 dramsize;
  27. #if defined(CONFIG_SERIAL_BOOT)
  28. /*
  29. * Serial Boot: The dram is already initialized in start.S
  30. * only require to return DRAM size
  31. */
  32. dramsize = CONFIG_SYS_SDRAM_SIZE * 0x100000;
  33. #else
  34. sdramc_t *sdram = (sdramc_t *)(MMAP_SDRAM);
  35. ccm_t *ccm = (ccm_t *)MMAP_CCM;
  36. gpio_t *gpio = (gpio_t *) MMAP_GPIO;
  37. pm_t *pm = (pm_t *) MMAP_PM;
  38. u32 i;
  39. dramsize = CONFIG_SYS_SDRAM_SIZE * 0x100000;
  40. for (i = 0x13; i < 0x20; i++) {
  41. if (dramsize == (1 << i))
  42. break;
  43. }
  44. out_8(&pm->pmcr0, 0x2E);
  45. out_8(&gpio->mscr_sdram, 1);
  46. clrbits_be16(&ccm->misccr2, CCM_MISCCR2_FBHALF);
  47. setbits_be16(&ccm->misccr2, CCM_MISCCR2_DDR2CLK);
  48. out_be32(&sdram->rcrcr, 0x40000000);
  49. out_be32(&sdram->padcr, 0x01030203);
  50. out_be32(&sdram->cr00, 0x01010101);
  51. out_be32(&sdram->cr01, 0x00000101);
  52. out_be32(&sdram->cr02, 0x01010100);
  53. out_be32(&sdram->cr03, 0x01010000);
  54. out_be32(&sdram->cr04, 0x00010101);
  55. out_be32(&sdram->cr06, 0x00010100);
  56. out_be32(&sdram->cr07, 0x00000001);
  57. out_be32(&sdram->cr08, 0x01000001);
  58. out_be32(&sdram->cr09, 0x00000100);
  59. out_be32(&sdram->cr10, 0x00010001);
  60. out_be32(&sdram->cr11, 0x00000200);
  61. out_be32(&sdram->cr12, 0x01000002);
  62. out_be32(&sdram->cr13, 0x00000000);
  63. out_be32(&sdram->cr14, 0x00000100);
  64. out_be32(&sdram->cr15, 0x02000100);
  65. out_be32(&sdram->cr16, 0x02000407);
  66. out_be32(&sdram->cr17, 0x02030007);
  67. out_be32(&sdram->cr18, 0x02000100);
  68. out_be32(&sdram->cr19, 0x0A030203);
  69. out_be32(&sdram->cr20, 0x00020708);
  70. out_be32(&sdram->cr21, 0x00050008);
  71. out_be32(&sdram->cr22, 0x04030002);
  72. out_be32(&sdram->cr23, 0x00000004);
  73. out_be32(&sdram->cr24, 0x020A0000);
  74. out_be32(&sdram->cr25, 0x0C00000E);
  75. out_be32(&sdram->cr26, 0x00002004);
  76. out_be32(&sdram->cr28, 0x00100010);
  77. out_be32(&sdram->cr29, 0x00100010);
  78. out_be32(&sdram->cr31, 0x07990000);
  79. out_be32(&sdram->cr40, 0x00000000);
  80. out_be32(&sdram->cr41, 0x00C80064);
  81. out_be32(&sdram->cr42, 0x44520002);
  82. out_be32(&sdram->cr43, 0x00C80023);
  83. out_be32(&sdram->cr45, 0x0000C350);
  84. out_be32(&sdram->cr56, 0x04000000);
  85. out_be32(&sdram->cr57, 0x03000304);
  86. out_be32(&sdram->cr58, 0x40040000);
  87. out_be32(&sdram->cr59, 0xC0004004);
  88. out_be32(&sdram->cr60, 0x0642C000);
  89. out_be32(&sdram->cr61, 0x00000642);
  90. asm("tpf");
  91. out_be32(&sdram->cr09, 0x01000100);
  92. udelay(100);
  93. #endif
  94. return dramsize;
  95. };
  96. int testdram(void)
  97. {
  98. return 0;
  99. }