m548xevb.c 2.2 KB

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