m547xevb.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * (C) Copyright 2000-2003
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
  6. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  7. *
  8. * SPDX-License-Identifier: GPL-2.0+
  9. */
  10. #include <config.h>
  11. #include <common.h>
  12. #include <pci.h>
  13. #include <asm/immap.h>
  14. #include <asm/io.h>
  15. DECLARE_GLOBAL_DATA_PTR;
  16. int checkboard(void)
  17. {
  18. puts("Board: ");
  19. puts("Freescale FireEngine 5475 EVB\n");
  20. return 0;
  21. };
  22. phys_size_t initdram(int board_type)
  23. {
  24. siu_t *siu = (siu_t *) (MMAP_SIU);
  25. sdram_t *sdram = (sdram_t *)(MMAP_SDRAM);
  26. u32 dramsize, i;
  27. #ifdef CONFIG_SYS_DRAMSZ1
  28. u32 temp;
  29. #endif
  30. out_be32(&siu->drv, CONFIG_SYS_SDRAM_DRVSTRENGTH);
  31. dramsize = CONFIG_SYS_DRAMSZ * 0x100000;
  32. for (i = 0x13; i < 0x20; i++) {
  33. if (dramsize == (1 << i))
  34. break;
  35. }
  36. i--;
  37. out_be32(&siu->cs0cfg, CONFIG_SYS_SDRAM_BASE | i);
  38. #ifdef CONFIG_SYS_DRAMSZ1
  39. temp = CONFIG_SYS_DRAMSZ1 * 0x100000;
  40. for (i = 0x13; i < 0x20; i++) {
  41. if (temp == (1 << i))
  42. break;
  43. }
  44. i--;
  45. dramsize += temp;
  46. out_be32(&siu->cs1cfg, (CONFIG_SYS_SDRAM_BASE + temp) | i);
  47. #endif
  48. out_be32(&sdram->cfg1, CONFIG_SYS_SDRAM_CFG1);
  49. out_be32(&sdram->cfg2, CONFIG_SYS_SDRAM_CFG2);
  50. /* Issue PALL */
  51. out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2);
  52. /* Issue LEMR */
  53. out_be32(&sdram->mode, CONFIG_SYS_SDRAM_EMOD);
  54. out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE | 0x04000000);
  55. udelay(500);
  56. /* Issue PALL */
  57. out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2);
  58. /* Perform two refresh cycles */
  59. out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4);
  60. out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4);
  61. out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE);
  62. out_be32(&sdram->ctrl,
  63. (CONFIG_SYS_SDRAM_CTRL & ~0x80000000) | 0x10000F00);
  64. udelay(100);
  65. return dramsize;
  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 */