sandpoint.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * (C) Copyright 2000
  3. * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
  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 <mpc824x.h>
  25. #include <pci.h>
  26. int checkboard (void)
  27. {
  28. /*TODO: Check processor type */
  29. puts ( "Board: Sandpoint "
  30. #ifdef CONFIG_MPC8240
  31. "8240"
  32. #endif
  33. #ifdef CONFIG_MPC8245
  34. "8245"
  35. #endif
  36. " Unity ##Test not implemented yet##\n");
  37. return 0;
  38. }
  39. #if 0 /* NOT USED */
  40. int checkflash (void)
  41. {
  42. /* TODO: XXX XXX XXX */
  43. printf ("## Test not implemented yet ##\n");
  44. return (0);
  45. }
  46. #endif
  47. long int initdram (int board_type)
  48. {
  49. int i, cnt;
  50. volatile uchar * base= CFG_SDRAM_BASE;
  51. volatile ulong * addr;
  52. ulong save[32];
  53. ulong val, ret = 0;
  54. for (i=0, cnt=(CFG_MAX_RAM_SIZE / sizeof(long)) >> 1; cnt > 0; cnt >>= 1) {
  55. addr = (volatile ulong *)base + cnt;
  56. save[i++] = *addr;
  57. *addr = ~cnt;
  58. }
  59. addr = (volatile ulong *)base;
  60. save[i] = *addr;
  61. *addr = 0;
  62. if (*addr != 0) {
  63. *addr = save[i];
  64. goto Done;
  65. }
  66. for (cnt = 1; cnt <= CFG_MAX_RAM_SIZE / sizeof(long); cnt <<= 1) {
  67. addr = (volatile ulong *)base + cnt;
  68. val = *addr;
  69. *addr = save[--i];
  70. if (val != ~cnt) {
  71. ulong new_bank0_end = cnt * sizeof(long) - 1;
  72. ulong mear1 = mpc824x_mpc107_getreg(MEAR1);
  73. ulong emear1 = mpc824x_mpc107_getreg(EMEAR1);
  74. mear1 = (mear1 & 0xFFFFFF00) |
  75. ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
  76. emear1 = (emear1 & 0xFFFFFF00) |
  77. ((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
  78. mpc824x_mpc107_setreg(MEAR1, mear1);
  79. mpc824x_mpc107_setreg(EMEAR1, emear1);
  80. ret = cnt * sizeof(long);
  81. goto Done;
  82. }
  83. }
  84. ret = CFG_MAX_RAM_SIZE;
  85. Done:
  86. return ret;
  87. }
  88. /*
  89. * Initialize PCI Devices, report devices found.
  90. */
  91. #ifndef CONFIG_PCI_PNP
  92. static struct pci_config_table pci_sandpoint_config_table[] = {
  93. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0f, PCI_ANY_ID,
  94. pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
  95. PCI_ENET0_MEMADDR,
  96. PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
  97. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x10, PCI_ANY_ID,
  98. pci_cfgfunc_config_device, { PCI_ENET1_IOADDR,
  99. PCI_ENET1_MEMADDR,
  100. PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
  101. { }
  102. };
  103. #endif
  104. struct pci_controller hose = {
  105. #ifndef CONFIG_PCI_PNP
  106. config_table: pci_sandpoint_config_table,
  107. #endif
  108. };
  109. void pci_init_board(void)
  110. {
  111. pci_mpc824x_init(&hose);
  112. }