utx8245.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * (C) Copyright 2001
  3. * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
  4. *
  5. * (C) Copyright 2002
  6. * Gregory E. Allen, gallen@arlut.utexas.edu
  7. * Matthew E. Karger, karger@arlut.utexas.edu
  8. * Applied Research Laboratories, The University of Texas at Austin
  9. *
  10. * See file CREDITS for list of people who contributed to this
  11. * project.
  12. *
  13. * This program is free software; you can redistribute it and/or
  14. * modify it under the terms of the GNU General Public License as
  15. * published by the Free Software Foundation; either version 2 of
  16. * the License, or (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  26. * MA 02111-1307 USA
  27. */
  28. #include <common.h>
  29. #include <mpc824x.h>
  30. #include <asm/processor.h>
  31. #include <asm/io.h>
  32. #include <asm/mmu.h>
  33. #include <pci.h>
  34. #define SAVE_SZ 32
  35. int checkboard(void)
  36. {
  37. ulong busfreq = get_bus_freq(0);
  38. char buf[32];
  39. printf("Board: UTX8245 Local Bus at %s MHz\n", strmhz(buf, busfreq));
  40. return 0;
  41. }
  42. long int initdram(int board_type)
  43. {
  44. #if 1
  45. long size;
  46. long new_bank0_end;
  47. long mear1;
  48. long emear1;
  49. /*
  50. write_bat(IBAT1, ((CFG_MAX_RAM_SIZE/2) | BATU_BL_256M | BATU_VS | BATU_VP),
  51. ( (CFG_MAX_RAM_SIZE/2)| BATL_PP_10 | BATL_MEMCOHERENCE));
  52. write_bat(DBAT1, ((CFG_MAX_RAM_SIZE/2) | BATU_BL_256M | BATU_VS | BATU_VP),
  53. ( (CFG_MAX_RAM_SIZE/2)| BATL_PP_10 | BATL_MEMCOHERENCE));
  54. */
  55. size = get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE);
  56. new_bank0_end = size - 1;
  57. mear1 = mpc824x_mpc107_getreg(MEAR1);
  58. emear1 = mpc824x_mpc107_getreg(EMEAR1);
  59. mear1 = (mear1 & 0xFFFFFF00) |
  60. ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
  61. emear1 = (emear1 & 0xFFFFFF00) |
  62. ((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
  63. mpc824x_mpc107_setreg(MEAR1, mear1);
  64. mpc824x_mpc107_setreg(EMEAR1, emear1);
  65. return (size);
  66. #else
  67. return (CFG_MAX_RAM_SIZE);
  68. #endif
  69. }
  70. /*
  71. * Initialize PCI Devices, report devices found.
  72. */
  73. static struct pci_config_table pci_utx8245_config_table[] = {
  74. #ifndef CONFIG_PCI_PNP
  75. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0C, PCI_ANY_ID,
  76. pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
  77. PCI_ENET0_MEMADDR,
  78. PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
  79. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0B, PCI_ANY_ID,
  80. pci_cfgfunc_config_device, { PCI_FIREWIRE_IOADDR,
  81. PCI_FIREWIRE_MEMADDR,
  82. PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
  83. #endif /*CONFIG_PCI_PNP*/
  84. { }
  85. };
  86. static void pci_utx8245_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
  87. {
  88. if (PCI_DEV(dev) == 11)
  89. /* assign serial interrupt line 9 (int25) to FireWire */
  90. pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 25);
  91. else if (PCI_DEV(dev) == 12)
  92. /* assign serial interrupt line 8 (int24) to Ethernet */
  93. pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 24);
  94. else if (PCI_DEV(dev) == 14)
  95. /* assign serial interrupt line 0 (int16) to PMC slot 0 */
  96. pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 16);
  97. else if (PCI_DEV(dev) == 15)
  98. /* assign serial interrupt line 1 (int17) to PMC slot 1 */
  99. pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 17);
  100. }
  101. static struct pci_controller utx8245_hose = {
  102. #ifndef CONFIG_PCI_PNP
  103. config_table: pci_utx8245_config_table,
  104. fixup_irq: pci_utx8245_fixup_irq,
  105. write_byte: pci_hose_write_config_byte
  106. #endif /*CONFIG_PCI_PNP*/
  107. };
  108. void pci_init_board (void)
  109. {
  110. pci_mpc824x_init(&utx8245_hose);
  111. icache_enable();
  112. }