xpedite550x.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * Copyright 2010 Extreme Engineering Solutions, Inc.
  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 <command.h>
  24. #include <asm/processor.h>
  25. #include <asm/mmu.h>
  26. #include <asm/immap_85xx.h>
  27. #include <asm/fsl_pci.h>
  28. #include <asm/io.h>
  29. #include <asm/cache.h>
  30. #include <libfdt.h>
  31. #include <fdt_support.h>
  32. #include <pca953x.h>
  33. DECLARE_GLOBAL_DATA_PTR;
  34. extern void ft_board_pci_setup(void *blob, bd_t *bd);
  35. static void flash_cs_fixup(void)
  36. {
  37. int flash_sel;
  38. /*
  39. * Print boot dev and swap flash flash chip selects if booted from 2nd
  40. * flash. Swapping chip selects presents user with a common memory
  41. * map regardless of which flash was booted from.
  42. */
  43. flash_sel = !((pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) &
  44. CONFIG_SYS_PCA953X_C0_FLASH_PASS_CS));
  45. printf("Flash: Executed from flash%d\n", flash_sel ? 2 : 1);
  46. if (flash_sel) {
  47. set_lbc_br(0, CONFIG_SYS_BR1_PRELIM);
  48. set_lbc_or(0, CONFIG_SYS_OR1_PRELIM);
  49. set_lbc_br(1, CONFIG_SYS_BR0_PRELIM);
  50. set_lbc_or(1, CONFIG_SYS_OR0_PRELIM);
  51. }
  52. }
  53. int board_early_init_r(void)
  54. {
  55. /* Initialize PCA9557 devices */
  56. pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR0, 0xff, 0);
  57. pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR1, 0xff, 0);
  58. pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR2, 0xff, 0);
  59. pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR3, 0xff, 0);
  60. /*
  61. * Remap NOR flash region to caching-inhibited
  62. * so that flash can be erased/programmed properly.
  63. */
  64. /* Flush d-cache and invalidate i-cache of any FLASH data */
  65. flush_dcache();
  66. invalidate_icache();
  67. /* Invalidate existing TLB entry for NOR flash */
  68. disable_tlb(0);
  69. set_tlb(1, (CONFIG_SYS_FLASH_BASE2 & 0xf0000000),
  70. (CONFIG_SYS_FLASH_BASE2 & 0xf0000000),
  71. MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
  72. 0, 0, BOOKE_PAGESZ_256M, 1);
  73. flash_cs_fixup();
  74. return 0;
  75. }
  76. #if defined(CONFIG_OF_BOARD_SETUP)
  77. void ft_board_setup(void *blob, bd_t *bd)
  78. {
  79. #ifdef CONFIG_PCI
  80. ft_board_pci_setup(blob, bd);
  81. #endif
  82. ft_cpu_setup(blob, bd);
  83. }
  84. #endif
  85. #ifdef CONFIG_MP
  86. extern void cpu_mp_lmb_reserve(struct lmb *lmb);
  87. void board_lmb_reserve(struct lmb *lmb)
  88. {
  89. cpu_mp_lmb_reserve(lmb);
  90. }
  91. #endif