quad100hd.c 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * (C) Copyright 2008
  3. * Gary Jennejohn, DENX Software Engineering GmbH, garyj@denx.de.
  4. *
  5. * Based in part on board/icecube/icecube.c from PPCBoot
  6. * (C) Copyright 2003 Intrinsyc Software
  7. *
  8. * See file CREDITS for list of people who contributed to this
  9. * project.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License as
  13. * published by the Free Software Foundation; either version 2 of
  14. * the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  24. * MA 02111-1307 USA
  25. */
  26. #include <common.h>
  27. #include <command.h>
  28. #include <malloc.h>
  29. #include <environment.h>
  30. #include <logbuff.h>
  31. #include <post.h>
  32. #include <asm/processor.h>
  33. #include <asm/io.h>
  34. #include <asm/ppc4xx-gpio.h>
  35. DECLARE_GLOBAL_DATA_PTR;
  36. int board_early_init_f(void)
  37. {
  38. /* taken from PPCBoot */
  39. mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */
  40. mtdcr(UIC0ER, 0x00000000); /* disable all ints */
  41. mtdcr(UIC0CR, 0x00000000);
  42. mtdcr(UIC0PR, 0xFFFF7FFE); /* set int polarities */
  43. mtdcr(UIC0TR, 0x00000000); /* set int trigger levels */
  44. mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */
  45. mtdcr(UIC0VCR, 0x00000001); /* set vect base=0,INT0 highest priority */
  46. mtdcr(CPC0_SRR, 0x00040000); /* Hold PCI bridge in reset */
  47. return 0;
  48. }
  49. /*
  50. * Check Board Identity:
  51. */
  52. int checkboard(void)
  53. {
  54. char buf[64];
  55. int i = getenv_f("serial#", buf, sizeof(buf));
  56. #ifdef DISPLAY_BOARD_INFO
  57. sys_info_t sysinfo;
  58. #endif
  59. puts("Board: Quad100hd");
  60. if (i > 0) {
  61. puts(", serial# ");
  62. puts(buf);
  63. }
  64. putc('\n');
  65. #ifdef DISPLAY_BOARD_INFO
  66. /* taken from ppcboot */
  67. get_sys_info(&sysinfo);
  68. printf("\tVCO: %lu MHz\n", sysinfo.freqVCOMhz);
  69. printf("\tCPU: %lu MHz\n", sysinfo.freqProcessor / 1000000);
  70. printf("\tPLB: %lu MHz\n", sysinfo.freqPLB / 1000000);
  71. printf("\tOPB: %lu MHz\n", sysinfo.freqOPB / 1000000);
  72. printf("\tEPB: %lu MHz\n", sysinfo.freqPLB / (sysinfo.pllExtBusDiv *
  73. 1000000));
  74. printf("\tPCI: %lu MHz\n", sysinfo.freqPCI / 1000000);
  75. #endif
  76. return 0;
  77. }