mpq101.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * (C) Copyright 2011 Alex Dubov <oakad@yahoo.com>
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #include <common.h>
  23. #include <asm/processor.h>
  24. #include <asm/mmu.h>
  25. #include <asm/immap_85xx.h>
  26. #include <asm/fsl_law.h>
  27. #include <asm/io.h>
  28. #include <miiphy.h>
  29. #include <libfdt.h>
  30. #include <fdt_support.h>
  31. /*
  32. * Initialize Local Bus
  33. */
  34. void local_bus_init(void)
  35. {
  36. fsl_lbc_t *lbc = LBC_BASE_ADDR;
  37. out_be32(&lbc->ltesr, 0xffffffff); /* Clear LBC error interrupts */
  38. out_be32(&lbc->lteir, 0xffffffff); /* Enable LBC error interrupts */
  39. }
  40. int checkboard(void)
  41. {
  42. ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
  43. ccsr_local_ecm_t *ecm = (void *)(CONFIG_SYS_MPC85xx_ECM_ADDR);
  44. puts("Board: Mercury Computer Systems, Inc. MPQ-101 ");
  45. #ifdef CONFIG_PHYS_64BIT
  46. puts("(36-bit addrmap) ");
  47. #endif
  48. putc('\n');
  49. /*
  50. * Initialize local bus.
  51. */
  52. local_bus_init();
  53. /*
  54. * Hack TSEC 3 and 4 IO voltages.
  55. */
  56. out_be32(&gur->tsec34ioovcr, 0xe7e0); /* 1110 0111 1110 0xxx */
  57. out_be32(&ecm->eedr, 0xffffffff); /* clear ecm errors */
  58. out_be32(&ecm->eeer, 0xffffffff); /* enable ecm errors */
  59. return 0;
  60. }
  61. phys_size_t fixed_sdram(void)
  62. {
  63. ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_MPC85xx_DDR_ADDR);
  64. const char *p_mode = getenv("perf_mode");
  65. puts("Initializing....");
  66. out_be32(&ddr->cs0_bnds, CONFIG_SYS_DDR_CS0_BNDS);
  67. out_be32(&ddr->cs0_config, CONFIG_SYS_DDR_CS0_CONFIG);
  68. out_be32(&ddr->timing_cfg_3, CONFIG_SYS_DDR_TIMING_3);
  69. out_be32(&ddr->timing_cfg_0, CONFIG_SYS_DDR_TIMING_0);
  70. if (p_mode && !strcmp("performance", p_mode)) {
  71. out_be32(&ddr->timing_cfg_1, CONFIG_SYS_DDR_TIMING_1_PERF);
  72. out_be32(&ddr->timing_cfg_2, CONFIG_SYS_DDR_TIMING_2_PERF);
  73. out_be32(&ddr->sdram_mode, CONFIG_SYS_DDR_MODE_1_PERF);
  74. out_be32(&ddr->sdram_mode_2, CONFIG_SYS_DDR_MODE_2_PERF);
  75. out_be32(&ddr->sdram_interval, CONFIG_SYS_DDR_INTERVAL_PERF);
  76. } else {
  77. out_be32(&ddr->timing_cfg_1, CONFIG_SYS_DDR_TIMING_1);
  78. out_be32(&ddr->timing_cfg_2, CONFIG_SYS_DDR_TIMING_2);
  79. out_be32(&ddr->sdram_mode, CONFIG_SYS_DDR_MODE_1);
  80. out_be32(&ddr->sdram_mode_2, CONFIG_SYS_DDR_MODE_2);
  81. out_be32(&ddr->sdram_interval, CONFIG_SYS_DDR_INTERVAL);
  82. }
  83. out_be32(&ddr->sdram_clk_cntl, CONFIG_SYS_DDR_CLK_CTRL);
  84. out_be32(&ddr->sdram_cfg_2, CONFIG_SYS_DDR_CONTROL2);
  85. asm("sync;isync");
  86. udelay(500);
  87. out_be32(&ddr->sdram_cfg, CONFIG_SYS_DDR_CONTROL);
  88. asm("sync; isync");
  89. udelay(500);
  90. return ((phys_size_t)1) << CONFIG_SYS_SDRAM_SIZE_LOG;
  91. }
  92. void pci_init_board(void)
  93. {
  94. ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
  95. /* PCI is disabled */
  96. out_be32(&gur->devdisr, in_be32(&gur->devdisr)
  97. | MPC85xx_DEVDISR_PCI1
  98. | MPC85xx_DEVDISR_PCI2
  99. | MPC85xx_DEVDISR_PCIE);
  100. }
  101. #if defined(CONFIG_OF_BOARD_SETUP)
  102. void ft_board_setup(void *blob, bd_t *bd)
  103. {
  104. ft_cpu_setup(blob, bd);
  105. }
  106. #endif