m547xevb.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 <pci.h>
  12. #include <asm/immap.h>
  13. #include <asm/io.h>
  14. DECLARE_GLOBAL_DATA_PTR;
  15. int checkboard(void)
  16. {
  17. puts("Board: ");
  18. puts("Freescale FireEngine 5475 EVB\n");
  19. return 0;
  20. };
  21. int dram_init(void)
  22. {
  23. siu_t *siu = (siu_t *) (MMAP_SIU);
  24. sdram_t *sdram = (sdram_t *)(MMAP_SDRAM);
  25. u32 dramsize, i;
  26. #ifdef CONFIG_SYS_DRAMSZ1
  27. u32 temp;
  28. #endif
  29. out_be32(&siu->drv, CONFIG_SYS_SDRAM_DRVSTRENGTH);
  30. dramsize = CONFIG_SYS_DRAMSZ * 0x100000;
  31. for (i = 0x13; i < 0x20; i++) {
  32. if (dramsize == (1 << i))
  33. break;
  34. }
  35. i--;
  36. out_be32(&siu->cs0cfg, CONFIG_SYS_SDRAM_BASE | i);
  37. #ifdef CONFIG_SYS_DRAMSZ1
  38. temp = CONFIG_SYS_DRAMSZ1 * 0x100000;
  39. for (i = 0x13; i < 0x20; i++) {
  40. if (temp == (1 << i))
  41. break;
  42. }
  43. i--;
  44. dramsize += temp;
  45. out_be32(&siu->cs1cfg, (CONFIG_SYS_SDRAM_BASE + temp) | i);
  46. #endif
  47. out_be32(&sdram->cfg1, CONFIG_SYS_SDRAM_CFG1);
  48. out_be32(&sdram->cfg2, CONFIG_SYS_SDRAM_CFG2);
  49. /* Issue PALL */
  50. out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2);
  51. /* Issue LEMR */
  52. out_be32(&sdram->mode, CONFIG_SYS_SDRAM_EMOD);
  53. out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE | 0x04000000);
  54. udelay(500);
  55. /* Issue PALL */
  56. out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2);
  57. /* Perform two refresh cycles */
  58. out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4);
  59. out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4);
  60. out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE);
  61. out_be32(&sdram->ctrl,
  62. (CONFIG_SYS_SDRAM_CTRL & ~0x80000000) | 0x10000F00);
  63. udelay(100);
  64. gd->ram_size = dramsize;
  65. return 0;
  66. };
  67. int testdram(void)
  68. {
  69. /* TODO: XXX XXX XXX */
  70. printf("DRAM test not implemented!\n");
  71. return (0);
  72. }
  73. #if defined(CONFIG_PCI)
  74. /*
  75. * Initialize PCI devices, report devices found.
  76. */
  77. static struct pci_controller hose;
  78. extern void pci_mcf547x_8x_init(struct pci_controller *hose);
  79. void pci_init_board(void)
  80. {
  81. pci_mcf547x_8x_init(&hose);
  82. }
  83. #endif /* CONFIG_PCI */