m547xevb.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2000-2003
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. *
  6. * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
  7. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  8. */
  9. #include <config.h>
  10. #include <common.h>
  11. #include <init.h>
  12. #include <pci.h>
  13. #include <asm/global_data.h>
  14. #include <asm/immap.h>
  15. #include <asm/io.h>
  16. #include <linux/delay.h>
  17. DECLARE_GLOBAL_DATA_PTR;
  18. int checkboard(void)
  19. {
  20. puts("Board: ");
  21. puts("Freescale FireEngine 5475 EVB\n");
  22. return 0;
  23. };
  24. int dram_init(void)
  25. {
  26. siu_t *siu = (siu_t *) (MMAP_SIU);
  27. sdram_t *sdram = (sdram_t *)(MMAP_SDRAM);
  28. u32 dramsize, i;
  29. #ifdef CONFIG_SYS_DRAMSZ1
  30. u32 temp;
  31. #endif
  32. out_be32(&siu->drv, CONFIG_SYS_SDRAM_DRVSTRENGTH);
  33. dramsize = CONFIG_SYS_DRAMSZ * 0x100000;
  34. for (i = 0x13; i < 0x20; i++) {
  35. if (dramsize == (1 << i))
  36. break;
  37. }
  38. i--;
  39. out_be32(&siu->cs0cfg, CONFIG_SYS_SDRAM_BASE | i);
  40. #ifdef CONFIG_SYS_DRAMSZ1
  41. temp = CONFIG_SYS_DRAMSZ1 * 0x100000;
  42. for (i = 0x13; i < 0x20; i++) {
  43. if (temp == (1 << i))
  44. break;
  45. }
  46. i--;
  47. dramsize += temp;
  48. out_be32(&siu->cs1cfg, (CONFIG_SYS_SDRAM_BASE + temp) | i);
  49. #endif
  50. out_be32(&sdram->cfg1, CONFIG_SYS_SDRAM_CFG1);
  51. out_be32(&sdram->cfg2, CONFIG_SYS_SDRAM_CFG2);
  52. /* Issue PALL */
  53. out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2);
  54. /* Issue LEMR */
  55. out_be32(&sdram->mode, CONFIG_SYS_SDRAM_EMOD);
  56. out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE | 0x04000000);
  57. udelay(500);
  58. /* Issue PALL */
  59. out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2);
  60. /* Perform two refresh cycles */
  61. out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4);
  62. out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4);
  63. out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE);
  64. out_be32(&sdram->ctrl,
  65. (CONFIG_SYS_SDRAM_CTRL & ~0x80000000) | 0x10000F00);
  66. udelay(100);
  67. gd->ram_size = dramsize;
  68. return 0;
  69. };
  70. int testdram(void)
  71. {
  72. /* TODO: XXX XXX XXX */
  73. printf("DRAM test not implemented!\n");
  74. return (0);
  75. }
  76. #if defined(CONFIG_PCI)
  77. /*
  78. * Initialize PCI devices, report devices found.
  79. */
  80. static struct pci_controller hose;
  81. extern void pci_mcf547x_8x_init(struct pci_controller *hose);
  82. void pci_init_board(void)
  83. {
  84. pci_mcf547x_8x_init(&hose);
  85. }
  86. #endif /* CONFIG_PCI */