a3000.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * (C) Copyright 2001
  3. * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
  4. *
  5. * Modified during 2003 by
  6. * Ken Chou, kchou@ieee.org
  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 <mpc824x.h>
  28. #include <pci.h>
  29. int checkboard (void)
  30. {
  31. ulong busfreq = get_bus_freq(0);
  32. char buf[32];
  33. printf("Board: A3000 Local Bus at %s MHz\n", strmhz(buf, busfreq));
  34. return 0;
  35. }
  36. long int initdram (int board_type)
  37. {
  38. long size;
  39. long new_bank0_end;
  40. long mear1;
  41. long emear1;
  42. size = get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE);
  43. new_bank0_end = size - 1;
  44. mear1 = mpc824x_mpc107_getreg(MEAR1);
  45. emear1 = mpc824x_mpc107_getreg(EMEAR1);
  46. mear1 = (mear1 & 0xFFFFFF00) |
  47. ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
  48. emear1 = (emear1 & 0xFFFFFF00) |
  49. ((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
  50. mpc824x_mpc107_setreg(MEAR1, mear1);
  51. mpc824x_mpc107_setreg(EMEAR1, emear1);
  52. return (size);
  53. }
  54. /*
  55. * Initialize PCI Devices
  56. */
  57. #ifndef CONFIG_PCI_PNP
  58. static struct pci_config_table pci_a3000_config_table[] = {
  59. /* vendor, device, class */
  60. /* bus, dev, func */
  61. { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_83815, PCI_ANY_ID,
  62. PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, /* dp83815 eth0 divice */
  63. pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
  64. PCI_ENET0_MEMADDR,
  65. PCI_COMMAND_IO |
  66. PCI_COMMAND_MEMORY |
  67. PCI_COMMAND_MASTER }},
  68. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
  69. PCI_ANY_ID, 0x14, PCI_ANY_ID, /* PCI slot1 */
  70. pci_cfgfunc_config_device, { PCI_ENET1_IOADDR,
  71. PCI_ENET1_MEMADDR,
  72. PCI_COMMAND_IO |
  73. PCI_COMMAND_MEMORY |
  74. PCI_COMMAND_MASTER }},
  75. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
  76. PCI_ANY_ID, 0x15, PCI_ANY_ID, /* PCI slot2 */
  77. pci_cfgfunc_config_device, { PCI_ENET2_IOADDR,
  78. PCI_ENET2_MEMADDR,
  79. PCI_COMMAND_IO |
  80. PCI_COMMAND_MEMORY |
  81. PCI_COMMAND_MASTER }},
  82. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
  83. PCI_ANY_ID, 0x16, PCI_ANY_ID, /* PCI slot3 */
  84. pci_cfgfunc_config_device, { PCI_ENET3_IOADDR,
  85. PCI_ENET3_MEMADDR,
  86. PCI_COMMAND_IO |
  87. PCI_COMMAND_MEMORY |
  88. PCI_COMMAND_MASTER }},
  89. { }
  90. };
  91. #endif
  92. struct pci_controller hose = {
  93. #ifndef CONFIG_PCI_PNP
  94. config_table: pci_a3000_config_table,
  95. #endif
  96. };
  97. void pci_init_board(void)
  98. {
  99. pci_mpc824x_init(&hose);
  100. }