neo.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * (C) Copyright 2007-2008
  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. #define HWTYPE_CCX16 1
  28. #define HWREV_300 3
  29. int board_early_init_f(void)
  30. {
  31. mtdcr(uicsr, 0xFFFFFFFF); /* clear all ints */
  32. mtdcr(uicer, 0x00000000); /* disable all ints */
  33. mtdcr(uiccr, 0x00000000); /* set all to be non-critical */
  34. mtdcr(uicpr, 0xFFFFFF80); /* set int polarities */
  35. mtdcr(uictr, 0x10000000); /* set int trigger levels */
  36. mtdcr(uicvcr, 0x00000001); /* set vect base=0,INT0 highest prio */
  37. mtdcr(uicsr, 0xFFFFFFFF); /* clear all ints */
  38. /*
  39. * EBC Configuration Register: set ready timeout to 512 ebc-clks
  40. * -> ca. 15 us
  41. */
  42. mtebc(epcr, 0xa8400000); /* ebc always driven */
  43. return 0;
  44. }
  45. /*
  46. * Check Board Identity:
  47. */
  48. int checkboard(void)
  49. {
  50. char *s = getenv("serial#");
  51. u16 val = in_le16((void *)CONFIG_FPGA_BASE + 2);
  52. u8 unit_type;
  53. u8 hardware_cpu_ports;
  54. u8 hardware_con_ports;
  55. u8 hardware_version;
  56. printf("Board: CATCenter Neo");
  57. if (s != NULL) {
  58. puts(", serial# ");
  59. puts(s);
  60. }
  61. puts("\n ");
  62. unit_type = (val & 0xf000) >> 12;
  63. hardware_cpu_ports = ((val & 0x0f00) >> 8) * 8;
  64. hardware_con_ports = ((val & 0x00f0) >> 4) * 2;
  65. hardware_version = val & 0x000f;
  66. switch (unit_type) {
  67. case HWTYPE_CCX16:
  68. printf("CCX16-FPGA (80 UARTs)");
  69. break;
  70. default:
  71. printf("UnitType %d, unsupported", unit_type);
  72. break;
  73. }
  74. printf(", %d cpu ports, %d console ports,",
  75. hardware_cpu_ports, hardware_con_ports);
  76. switch (hardware_version) {
  77. case HWREV_300:
  78. printf(" HW-Ver 3.00\n");
  79. break;
  80. default:
  81. printf(" HW-Ver %d, unsupported\n",
  82. hardware_version);
  83. break;
  84. }
  85. return 0;
  86. }