xpedite5200.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * Copyright 2008 Extreme Engineering Solutions, Inc.
  3. * Copyright 2004, 2007 Freescale Semiconductor, Inc.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <command.h>
  25. #include <pci.h>
  26. #include <asm/processor.h>
  27. #include <asm/immap_85xx.h>
  28. #include <asm/immap_fsl_pci.h>
  29. #include <asm/io.h>
  30. #include <asm/cache.h>
  31. #include <asm/mmu.h>
  32. #include <libfdt.h>
  33. #include <fdt_support.h>
  34. #include <pca953x.h>
  35. extern void ft_board_pci_setup(void *blob, bd_t *bd);
  36. int checkboard(void)
  37. {
  38. volatile ccsr_lbc_t *lbc = (void *)(CONFIG_SYS_MPC85xx_LBC_ADDR);
  39. volatile ccsr_local_ecm_t *ecm = (void *)(CONFIG_SYS_MPC85xx_ECM_ADDR);
  40. char *s;
  41. printf("Board: X-ES %s PMC\n", CONFIG_SYS_BOARD_NAME);
  42. printf(" ");
  43. s = getenv("board_rev");
  44. if (s)
  45. printf("Rev %s, ", s);
  46. s = getenv("serial#");
  47. if (s)
  48. printf("Serial# %s, ", s);
  49. s = getenv("board_cfg");
  50. if (s)
  51. printf("Cfg %s", s);
  52. printf("\n");
  53. lbc->ltesr = 0xffffffff; /* Clear LBC error interrupts */
  54. lbc->lteir = 0xffffffff; /* Enable LBC error interrupts */
  55. ecm->eedr = 0xffffffff; /* Clear ecm errors */
  56. ecm->eeer = 0xffffffff; /* Enable ecm errors */
  57. return 0;
  58. }
  59. static void flash_cs_fixup(void)
  60. {
  61. volatile ccsr_lbc_t *lbc = (void *)(CONFIG_SYS_MPC85xx_LBC_ADDR);
  62. int flash_sel;
  63. /*
  64. * Print boot dev and swap flash flash chip selects if booted from 2nd
  65. * flash. Swapping chip selects presents user with a common memory
  66. * map regardless of which flash was booted from.
  67. */
  68. flash_sel = !((pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) &
  69. CONFIG_SYS_PCA953X_FLASH_PASS_CS));
  70. printf("FLASH: Executed from FLASH%d\n", flash_sel ? 2 : 1);
  71. if (flash_sel) {
  72. lbc->br0 = CONFIG_SYS_BR1_PRELIM;
  73. lbc->or0 = CONFIG_SYS_OR1_PRELIM;
  74. lbc->br1 = CONFIG_SYS_BR0_PRELIM;
  75. lbc->or1 = CONFIG_SYS_OR0_PRELIM;
  76. }
  77. }
  78. int board_early_init_r(void)
  79. {
  80. /* Initialize PCA9557 devices */
  81. pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR0, 0xff, 0);
  82. pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR1, 0xff, 0);
  83. /*
  84. * Remap NOR flash region to caching-inhibited
  85. * so that flash can be erased/programmed properly.
  86. */
  87. /* Flush d-cache and invalidate i-cache of any FLASH data */
  88. flush_dcache();
  89. invalidate_icache();
  90. /* Invalidate existing TLB entry for NOR flash */
  91. disable_tlb(0);
  92. set_tlb(1, (CONFIG_SYS_FLASH_BASE2 & 0xf0000000),
  93. (CONFIG_SYS_FLASH_BASE2 & 0xf0000000),
  94. MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
  95. 0, 0, BOOKE_PAGESZ_256M, 1);
  96. flash_cs_fixup();
  97. return 0;
  98. }
  99. #if defined(CONFIG_OF_BOARD_SETUP)
  100. void ft_board_setup(void *blob, bd_t *bd)
  101. {
  102. #ifdef CONFIG_PCI
  103. ft_board_pci_setup(blob, bd);
  104. #endif
  105. ft_cpu_setup(blob, bd);
  106. }
  107. #endif