neo.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /*
  2. * (C) Copyright 2011
  3. * Dirk Eibach, Guntermann & Drunck GmbH, eibach@gdsys.de
  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 <asm/processor.h>
  26. #include <asm/io.h>
  27. #include <asm/ppc4xx-gpio.h>
  28. #include <dtt.h>
  29. #include "405ep.h"
  30. #include <gdsys_fpga.h>
  31. #define LATCH0_BASE (CONFIG_SYS_LATCH_BASE)
  32. #define LATCH1_BASE (CONFIG_SYS_LATCH_BASE + 0x100)
  33. #define LATCH2_BASE (CONFIG_SYS_LATCH_BASE + 0x200)
  34. enum {
  35. UNITTYPE_CCX16 = 1,
  36. UNITTYPE_CCIP216 = 2,
  37. };
  38. enum {
  39. HWVER_300 = 3,
  40. };
  41. int misc_init_r(void)
  42. {
  43. /* startup fans */
  44. dtt_init();
  45. return 0;
  46. }
  47. int checkboard(void)
  48. {
  49. char *s = getenv("serial#");
  50. puts("Board: CATCenter Neo");
  51. if (s != NULL) {
  52. puts(", serial# ");
  53. puts(s);
  54. }
  55. puts("\n");
  56. return 0;
  57. }
  58. static void print_fpga_info(void)
  59. {
  60. ihs_fpga_t *fpga = (ihs_fpga_t *) CONFIG_SYS_FPGA_BASE(0);
  61. u16 versions = in_le16(&fpga->versions);
  62. u16 fpga_version = in_le16(&fpga->fpga_version);
  63. u16 fpga_features = in_le16(&fpga->fpga_features);
  64. int fpga_state = get_fpga_state(0);
  65. unsigned unit_type;
  66. unsigned hardware_version;
  67. unsigned feature_channels;
  68. puts("FPGA: ");
  69. if (fpga_state & FPGA_STATE_DONE_FAILED) {
  70. printf(" done timed out\n");
  71. return;
  72. }
  73. if (fpga_state & FPGA_STATE_REFLECTION_FAILED) {
  74. printf(" refelectione test failed\n");
  75. return;
  76. }
  77. unit_type = (versions & 0xf000) >> 12;
  78. hardware_version = versions & 0x000f;
  79. feature_channels = fpga_features & 0x007f;
  80. switch (unit_type) {
  81. case UNITTYPE_CCX16:
  82. printf("CCX-Switch");
  83. break;
  84. default:
  85. printf("UnitType %d(not supported)", unit_type);
  86. break;
  87. }
  88. switch (hardware_version) {
  89. case HWVER_300:
  90. printf(" HW-Ver 3.00-3.12\n");
  91. break;
  92. default:
  93. printf(" HW-Ver %d(not supported)\n",
  94. hardware_version);
  95. break;
  96. }
  97. printf(" FPGA V %d.%02d, features:",
  98. fpga_version / 100, fpga_version % 100);
  99. printf(" %d channel(s)\n", feature_channels);
  100. }
  101. int last_stage_init(void)
  102. {
  103. print_fpga_info();
  104. return 0;
  105. }
  106. void gd405ep_init(void)
  107. {
  108. }
  109. void gd405ep_set_fpga_reset(unsigned state)
  110. {
  111. if (state) {
  112. out_le16((void *)LATCH0_BASE, CONFIG_SYS_LATCH0_RESET);
  113. out_le16((void *)LATCH1_BASE, CONFIG_SYS_LATCH1_RESET);
  114. } else {
  115. out_le16((void *)LATCH0_BASE, CONFIG_SYS_LATCH0_BOOT);
  116. out_le16((void *)LATCH1_BASE, CONFIG_SYS_LATCH1_BOOT);
  117. }
  118. }
  119. void gd405ep_setup_hw(void)
  120. {
  121. /*
  122. * set "startup-finished"-gpios
  123. */
  124. gpio_write_bit(21, 0);
  125. gpio_write_bit(22, 1);
  126. }
  127. int gd405ep_get_fpga_done(unsigned fpga)
  128. {
  129. /*
  130. * Neo hardware has no FPGA-DONE GPIO
  131. */
  132. return 1;
  133. }