xpedite5170.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Copyright 2009 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 <asm/processor.h>
  24. #include <asm/mmu.h>
  25. #include <asm/io.h>
  26. #include <fdt_support.h>
  27. #include <pca953x.h>
  28. #if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_PCI)
  29. extern void ft_board_pci_setup(void *blob, bd_t *bd);
  30. #endif
  31. int checkboard(void)
  32. {
  33. char *s;
  34. printf("Board: X-ES %s 3U VPX SBC\n", CONFIG_SYS_BOARD_NAME);
  35. printf(" ");
  36. s = getenv("board_rev");
  37. if (s)
  38. printf("Rev %s, ", s);
  39. s = getenv("serial#");
  40. if (s)
  41. printf("Serial# %s, ", s);
  42. s = getenv("board_cfg");
  43. if (s)
  44. printf("Cfg %s", s);
  45. printf("\n");
  46. return 0;
  47. }
  48. /*
  49. * Print out which flash was booted from and if booting from the 2nd flash,
  50. * swap flash chip selects to maintain consistent flash numbering/addresses.
  51. */
  52. static void flash_cs_fixup(void)
  53. {
  54. int flash_sel;
  55. /*
  56. * Print boot dev and swap flash flash chip selects if booted from 2nd
  57. * flash. Swapping chip selects presents user with a common memory
  58. * map regardless of which flash was booted from.
  59. */
  60. flash_sel = !((pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) &
  61. CONFIG_SYS_PCA953X_C0_FLASH_PASS_CS));
  62. printf("FLASH: Executed from FLASH%d\n", flash_sel ? 2 : 1);
  63. if (flash_sel) {
  64. set_lbc_br(0, CONFIG_SYS_BR1_PRELIM);
  65. set_lbc_or(0, CONFIG_SYS_OR1_PRELIM);
  66. set_lbc_br(1, CONFIG_SYS_BR0_PRELIM);
  67. set_lbc_or(1, CONFIG_SYS_OR0_PRELIM);
  68. }
  69. }
  70. int board_early_init_r(void)
  71. {
  72. /* Initialize PCA9557 devices */
  73. pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR0, 0xff, 0);
  74. pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR1, 0xff, 0);
  75. pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR2, 0xff, 0);
  76. pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR3, 0xff, 0);
  77. flash_cs_fixup();
  78. return 0;
  79. }
  80. #if defined(CONFIG_OF_BOARD_SETUP)
  81. void ft_board_setup(void *blob, bd_t *bd)
  82. {
  83. #ifdef CONFIG_PCI
  84. ft_board_pci_setup(blob, bd);
  85. #endif
  86. ft_cpu_setup(blob, bd);
  87. }
  88. #endif
  89. #ifdef CONFIG_MP
  90. extern void cpu_mp_lmb_reserve(struct lmb *lmb);
  91. void board_lmb_reserve(struct lmb *lmb)
  92. {
  93. cpu_mp_lmb_reserve(lmb);
  94. }
  95. #endif