musenki.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * (C) Copyright 2001
  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. ulong busfreq = get_bus_freq(0);
  29. char buf[32];
  30. printf("Board: MUSENKI Local Bus at %s MHz\n", strmhz(buf, busfreq));
  31. return 0;
  32. }
  33. #if 0 /* NOT USED */
  34. int checkflash (void)
  35. {
  36. /* TODO: XXX XXX XXX */
  37. printf ("## Test not implemented yet ##\n");
  38. return (0);
  39. }
  40. #endif
  41. long int initdram (int board_type)
  42. {
  43. int i, cnt;
  44. volatile uchar * base= CFG_SDRAM_BASE;
  45. volatile ulong * addr;
  46. ulong save[32];
  47. ulong val, ret = 0;
  48. for (i=0, cnt=(CFG_MAX_RAM_SIZE / sizeof(long)) >> 1; cnt > 0; cnt >>= 1) {
  49. addr = (volatile ulong *)base + cnt;
  50. save[i++] = *addr;
  51. *addr = ~cnt;
  52. }
  53. addr = (volatile ulong *)base;
  54. save[i] = *addr;
  55. *addr = 0;
  56. if (*addr != 0) {
  57. *addr = save[i];
  58. goto Done;
  59. }
  60. for (cnt = 1; cnt <= CFG_MAX_RAM_SIZE / sizeof(long); cnt <<= 1) {
  61. addr = (volatile ulong *)base + cnt;
  62. val = *addr;
  63. *addr = save[--i];
  64. if (val != ~cnt) {
  65. ulong new_bank0_end = cnt * sizeof(long) - 1;
  66. ulong mear1 = mpc824x_mpc107_getreg(MEAR1);
  67. ulong emear1 = mpc824x_mpc107_getreg(EMEAR1);
  68. mear1 = (mear1 & 0xFFFFFF00) |
  69. ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
  70. emear1 = (emear1 & 0xFFFFFF00) |
  71. ((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
  72. mpc824x_mpc107_setreg(MEAR1, mear1);
  73. mpc824x_mpc107_setreg(EMEAR1, emear1);
  74. ret = cnt * sizeof(long);
  75. goto Done;
  76. }
  77. }
  78. ret = CFG_MAX_RAM_SIZE;
  79. Done:
  80. return ret;
  81. }
  82. /*
  83. * Initialize PCI Devices
  84. */
  85. #ifndef CONFIG_PCI_PNP
  86. static struct pci_config_table pci_sandpoint_config_table[] = {
  87. #if 0
  88. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
  89. 0x0, 0x0, 0x0, /* unknown eth0 divice */
  90. pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
  91. PCI_ENET0_MEMADDR,
  92. PCI_COMMAND_IO |
  93. PCI_COMMAND_MEMORY |
  94. PCI_COMMAND_MASTER }},
  95. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
  96. 0x0, 0x0, 0x0, /* unknown eth1 device */
  97. pci_cfgfunc_config_device, { PCI_ENET1_IOADDR,
  98. PCI_ENET1_MEMADDR,
  99. PCI_COMMAND_IO |
  100. PCI_COMMAND_MEMORY |
  101. PCI_COMMAND_MASTER }},
  102. #endif
  103. { }
  104. };
  105. #endif
  106. struct pci_controller hose = {
  107. #ifndef CONFIG_PCI_PNP
  108. config_table: pci_sandpoint_config_table,
  109. #endif
  110. };
  111. void pci_init(void)
  112. {
  113. pci_mpc824x_init(&hose);
  114. }