mpc832xemds.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*
  2. * Copyright (C) 2006 Freescale Semiconductor, Inc.
  3. *
  4. * Dave Liu <daveliu@freescale.com>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. */
  14. #include <common.h>
  15. #include <ioports.h>
  16. #include <mpc83xx.h>
  17. #include <i2c.h>
  18. #include <miiphy.h>
  19. #include <command.h>
  20. #if defined(CONFIG_PCI)
  21. #include <pci.h>
  22. #endif
  23. #include <asm/mmu.h>
  24. #if defined(CONFIG_OF_LIBFDT)
  25. #include <libfdt.h>
  26. #endif
  27. #if defined(CONFIG_PQ_MDS_PIB)
  28. #include "../common/pq-mds-pib.h"
  29. #endif
  30. const qe_iop_conf_t qe_iop_conf_tab[] = {
  31. /* ETH3 */
  32. {1, 0, 1, 0, 1}, /* TxD0 */
  33. {1, 1, 1, 0, 1}, /* TxD1 */
  34. {1, 2, 1, 0, 1}, /* TxD2 */
  35. {1, 3, 1, 0, 1}, /* TxD3 */
  36. {1, 9, 1, 0, 1}, /* TxER */
  37. {1, 12, 1, 0, 1}, /* TxEN */
  38. {3, 24, 2, 0, 1}, /* TxCLK->CLK10 */
  39. {1, 4, 2, 0, 1}, /* RxD0 */
  40. {1, 5, 2, 0, 1}, /* RxD1 */
  41. {1, 6, 2, 0, 1}, /* RxD2 */
  42. {1, 7, 2, 0, 1}, /* RxD3 */
  43. {1, 8, 2, 0, 1}, /* RxER */
  44. {1, 10, 2, 0, 1}, /* RxDV */
  45. {0, 13, 2, 0, 1}, /* RxCLK->CLK9 */
  46. {1, 11, 2, 0, 1}, /* COL */
  47. {1, 13, 2, 0, 1}, /* CRS */
  48. /* ETH4 */
  49. {1, 18, 1, 0, 1}, /* TxD0 */
  50. {1, 19, 1, 0, 1}, /* TxD1 */
  51. {1, 20, 1, 0, 1}, /* TxD2 */
  52. {1, 21, 1, 0, 1}, /* TxD3 */
  53. {1, 27, 1, 0, 1}, /* TxER */
  54. {1, 30, 1, 0, 1}, /* TxEN */
  55. {3, 6, 2, 0, 1}, /* TxCLK->CLK8 */
  56. {1, 22, 2, 0, 1}, /* RxD0 */
  57. {1, 23, 2, 0, 1}, /* RxD1 */
  58. {1, 24, 2, 0, 1}, /* RxD2 */
  59. {1, 25, 2, 0, 1}, /* RxD3 */
  60. {1, 26, 1, 0, 1}, /* RxER */
  61. {1, 28, 2, 0, 1}, /* Rx_DV */
  62. {3, 31, 2, 0, 1}, /* RxCLK->CLK7 */
  63. {1, 29, 2, 0, 1}, /* COL */
  64. {1, 31, 2, 0, 1}, /* CRS */
  65. {3, 4, 3, 0, 2}, /* MDIO */
  66. {3, 5, 1, 0, 2}, /* MDC */
  67. {0, 0, 0, 0, QE_IOP_TAB_END}, /* END of table */
  68. };
  69. int board_early_init_f(void)
  70. {
  71. volatile u8 *bcsr = (volatile u8 *)CONFIG_SYS_BCSR;
  72. /* Enable flash write */
  73. bcsr[9] &= ~0x08;
  74. return 0;
  75. }
  76. int board_early_init_r(void)
  77. {
  78. #ifdef CONFIG_PQ_MDS_PIB
  79. pib_init();
  80. #endif
  81. return 0;
  82. }
  83. int fixed_sdram(void);
  84. phys_size_t initdram(int board_type)
  85. {
  86. volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
  87. u32 msize = 0;
  88. if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32) im)
  89. return -1;
  90. /* DDR SDRAM - Main SODIMM */
  91. im->sysconf.ddrlaw[0].bar = CONFIG_SYS_DDR_BASE & LAWBAR_BAR;
  92. msize = fixed_sdram();
  93. /* return total bus SDRAM size(bytes) -- DDR */
  94. return (msize * 1024 * 1024);
  95. }
  96. /*************************************************************************
  97. * fixed sdram init -- doesn't use serial presence detect.
  98. ************************************************************************/
  99. int fixed_sdram(void)
  100. {
  101. volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
  102. u32 msize = 0;
  103. u32 ddr_size;
  104. u32 ddr_size_log2;
  105. msize = CONFIG_SYS_DDR_SIZE;
  106. for (ddr_size = msize << 20, ddr_size_log2 = 0;
  107. (ddr_size > 1); ddr_size = ddr_size >> 1, ddr_size_log2++) {
  108. if (ddr_size & 1) {
  109. return -1;
  110. }
  111. }
  112. im->sysconf.ddrlaw[0].ar =
  113. LAWAR_EN | ((ddr_size_log2 - 1) & LAWAR_SIZE);
  114. #if (CONFIG_SYS_DDR_SIZE != 128)
  115. #warning Currenly any ddr size other than 128 is not supported
  116. #endif
  117. im->ddr.sdram_clk_cntl = CONFIG_SYS_DDR_CLK_CNTL;
  118. im->ddr.csbnds[0].csbnds = CONFIG_SYS_DDR_CS0_BNDS;
  119. im->ddr.cs_config[0] = CONFIG_SYS_DDR_CS0_CONFIG;
  120. im->ddr.timing_cfg_0 = CONFIG_SYS_DDR_TIMING_0;
  121. im->ddr.timing_cfg_1 = CONFIG_SYS_DDR_TIMING_1;
  122. im->ddr.timing_cfg_2 = CONFIG_SYS_DDR_TIMING_2;
  123. im->ddr.timing_cfg_3 = CONFIG_SYS_DDR_TIMING_3;
  124. im->ddr.sdram_cfg = CONFIG_SYS_DDR_SDRAM_CFG;
  125. im->ddr.sdram_cfg2 = CONFIG_SYS_DDR_SDRAM_CFG2;
  126. im->ddr.sdram_mode = CONFIG_SYS_DDR_MODE;
  127. im->ddr.sdram_mode2 = CONFIG_SYS_DDR_MODE2;
  128. im->ddr.sdram_interval = CONFIG_SYS_DDR_INTERVAL;
  129. __asm__ __volatile__ ("sync");
  130. udelay(200);
  131. im->ddr.sdram_cfg |= SDRAM_CFG_MEM_EN;
  132. __asm__ __volatile__ ("sync");
  133. return msize;
  134. }
  135. int checkboard(void)
  136. {
  137. puts("Board: Freescale MPC832XEMDS\n");
  138. return 0;
  139. }
  140. #if defined(CONFIG_OF_BOARD_SETUP)
  141. void ft_board_setup(void *blob, bd_t *bd)
  142. {
  143. ft_cpu_setup(blob, bd);
  144. #ifdef CONFIG_PCI
  145. ft_pci_setup(blob, bd);
  146. #endif
  147. }
  148. #endif