utx8245.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. #include <netdev.h>
  35. #define SAVE_SZ 32
  36. int checkboard(void)
  37. {
  38. ulong busfreq = get_bus_freq(0);
  39. char buf[32];
  40. printf("Board: UTX8245 Local Bus at %s MHz\n", strmhz(buf, busfreq));
  41. return 0;
  42. }
  43. phys_size_t initdram(int board_type)
  44. {
  45. long size;
  46. long new_bank0_end;
  47. long new_bank1_end;
  48. long mear1;
  49. long emear1;
  50. size = get_ram_size(CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_MAX_RAM_SIZE);
  51. new_bank0_end = size/2 - 1;
  52. new_bank1_end = size - 1;
  53. mear1 = mpc824x_mpc107_getreg(MEAR1);
  54. emear1 = mpc824x_mpc107_getreg(EMEAR1);
  55. mear1 = (mear1 & 0xFFFF0000) |
  56. ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) |
  57. ((new_bank1_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT << 8);
  58. emear1 = (emear1 & 0xFFFF0000) |
  59. ((new_bank0_end & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) |
  60. ((new_bank1_end & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT << 8);
  61. mpc824x_mpc107_setreg(MEAR1, mear1);
  62. mpc824x_mpc107_setreg(EMEAR1, emear1);
  63. return (size);
  64. }
  65. /*
  66. * Initialize PCI Devices, report devices found.
  67. */
  68. static struct pci_config_table pci_utx8245_config_table[] = {
  69. #ifndef CONFIG_PCI_PNP
  70. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0C, PCI_ANY_ID,
  71. pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
  72. PCI_ENET0_MEMADDR,
  73. PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
  74. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0B, PCI_ANY_ID,
  75. pci_cfgfunc_config_device, { PCI_FIREWIRE_IOADDR,
  76. PCI_FIREWIRE_MEMADDR,
  77. PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
  78. #endif /*CONFIG_PCI_PNP*/
  79. { }
  80. };
  81. static void pci_utx8245_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
  82. {
  83. if (PCI_DEV(dev) == 11)
  84. /* assign serial interrupt line 9 (int25) to FireWire */
  85. pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 25);
  86. else if (PCI_DEV(dev) == 12)
  87. /* assign serial interrupt line 8 (int24) to Ethernet */
  88. pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 24);
  89. else if (PCI_DEV(dev) == 14)
  90. /* assign serial interrupt line 0 (int16) to PMC slot 0 */
  91. pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 16);
  92. else if (PCI_DEV(dev) == 15)
  93. /* assign serial interrupt line 1 (int17) to PMC slot 1 */
  94. pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 17);
  95. }
  96. static struct pci_controller utx8245_hose = {
  97. #ifndef CONFIG_PCI_PNP
  98. config_table: pci_utx8245_config_table,
  99. fixup_irq: pci_utx8245_fixup_irq,
  100. write_byte: pci_hose_write_config_byte
  101. #endif /*CONFIG_PCI_PNP*/
  102. };
  103. void pci_init_board (void)
  104. {
  105. pci_mpc824x_init(&utx8245_hose);
  106. icache_enable();
  107. }
  108. int board_eth_init(bd_t *bis)
  109. {
  110. return pci_eth_init(bis);
  111. }