total5200.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * (C) Copyright 2003-2004
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * (C) Copyright 2004
  6. * Mark Jonas, Freescale Semiconductor, mark.jonas@freescale.com.
  7. *
  8. * See file CREDITS for list of people who contributed to this
  9. * project.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License as
  13. * published by the Free Software Foundation; either version 2 of
  14. * the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  24. * MA 02111-1307 USA
  25. */
  26. #include <common.h>
  27. #include <mpc5xxx.h>
  28. #include <pci.h>
  29. #include "sdram.h"
  30. #if CONFIG_TOTAL5200_REV==2
  31. #include "mt48lc32m16a2-75.h"
  32. #else
  33. #include "mt48lc16m16a2-75.h"
  34. #endif
  35. long int initdram (int board_type)
  36. {
  37. sdram_conf_t sdram_conf;
  38. sdram_conf.ddr = SDRAM_DDR;
  39. sdram_conf.mode = SDRAM_MODE;
  40. sdram_conf.emode = 0;
  41. sdram_conf.control = SDRAM_CONTROL;
  42. sdram_conf.config1 = SDRAM_CONFIG1;
  43. sdram_conf.config2 = SDRAM_CONFIG2;
  44. #if defined(CONFIG_MPC5200)
  45. sdram_conf.tapdelay = 0;
  46. #endif
  47. #if defined(CONFIG_MGT5100)
  48. sdram_conf.addrsel = SDRAM_ADDRSEL;
  49. #endif
  50. return mpc5xxx_sdram_init (&sdram_conf);
  51. }
  52. int checkboard (void)
  53. {
  54. #if defined(CONFIG_MPC5200)
  55. #if CONFIG_TOTAL5200_REV==2
  56. puts ("Board: Total5200 Rev.2 ");
  57. #else
  58. puts ("Board: Total5200 ");
  59. #endif
  60. #elif defined(CONFIG_MGT5100)
  61. puts ("Board: Total5100 ");
  62. #endif
  63. /*
  64. * Retrieve FPGA Revision.
  65. */
  66. printf ("(FPGA %08X)\n", *(vu_long *) (CFG_FPGA_BASE + 0x400));
  67. /*
  68. * Take all peripherals in power-up mode.
  69. */
  70. #if CONFIG_TOTAL5200_REV==2
  71. *(vu_char *) (CFG_CPLD_BASE + 0x46) = 0x70;
  72. #else
  73. *(vu_long *) (CFG_CPLD_BASE + 0x400) = 0x70;
  74. #endif
  75. return 0;
  76. }
  77. #if defined(CONFIG_MGT5100)
  78. int board_early_init_r(void)
  79. {
  80. /*
  81. * Now, when we are in RAM, enable CS0
  82. * because CS_BOOT cannot be written.
  83. */
  84. *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 25); /* disable CS_BOOT */
  85. *(vu_long *)MPC5XXX_ADDECR |= (1 << 16); /* enable CS0 */
  86. return 0;
  87. }
  88. #endif
  89. #ifdef CONFIG_PCI
  90. static struct pci_controller hose;
  91. extern void pci_mpc5xxx_init(struct pci_controller *);
  92. void pci_init_board(void)
  93. {
  94. pci_mpc5xxx_init(&hose);
  95. }
  96. #endif
  97. #if defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET)
  98. /* IRDA_1 aka PSC6_3 (pin C13) */
  99. #define GPIO_IRDA_1 0x20000000UL
  100. void init_ide_reset (void)
  101. {
  102. debug ("init_ide_reset\n");
  103. /* Configure IRDA_1 (PSC6_3) as GPIO output for ATA reset */
  104. *(vu_long *) MPC5XXX_GPIO_ENABLE |= GPIO_IRDA_1;
  105. *(vu_long *) MPC5XXX_GPIO_DIR |= GPIO_IRDA_1;
  106. }
  107. void ide_set_reset (int idereset)
  108. {
  109. debug ("ide_reset(%d)\n", idereset);
  110. if (idereset) {
  111. *(vu_long *) MPC5XXX_GPIO_DATA_O &= ~GPIO_IRDA_1;
  112. } else {
  113. *(vu_long *) MPC5XXX_GPIO_DATA_O |= GPIO_IRDA_1;
  114. }
  115. }
  116. #endif /* defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET) */