pci.c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * (C) Copyright 2002 ELTEC Elektronik AG
  3. * Frank Gottschling <fgottschling@eltec.de>
  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. /*
  24. * PCI initialisation for the MPC10x.
  25. */
  26. #include <common.h>
  27. #include <pci.h>
  28. #include <mpc106.h>
  29. #ifdef CONFIG_PCI
  30. struct pci_controller local_hose;
  31. void pci_init_board(void)
  32. {
  33. struct pci_controller* hose = (struct pci_controller *)&local_hose;
  34. u16 reg16;
  35. hose->first_busno = 0;
  36. hose->last_busno = 0xff;
  37. pci_set_region(hose->regions + 0,
  38. CONFIG_SYS_PCI_MEMORY_BUS,
  39. CONFIG_SYS_PCI_MEMORY_PHYS,
  40. CONFIG_SYS_PCI_MEMORY_SIZE,
  41. PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
  42. /* PCI memory space */
  43. pci_set_region(hose->regions + 1,
  44. CONFIG_SYS_PCI_MEM_BUS,
  45. CONFIG_SYS_PCI_MEM_PHYS,
  46. CONFIG_SYS_PCI_MEM_SIZE,
  47. PCI_REGION_MEM);
  48. /* ISA/PCI memory space */
  49. pci_set_region(hose->regions + 2,
  50. CONFIG_SYS_ISA_MEM_BUS,
  51. CONFIG_SYS_ISA_MEM_PHYS,
  52. CONFIG_SYS_ISA_MEM_SIZE,
  53. PCI_REGION_MEM);
  54. /* PCI I/O space */
  55. pci_set_region(hose->regions + 3,
  56. CONFIG_SYS_PCI_IO_BUS,
  57. CONFIG_SYS_PCI_IO_PHYS,
  58. CONFIG_SYS_PCI_IO_SIZE,
  59. PCI_REGION_IO);
  60. /* ISA/PCI I/O space */
  61. pci_set_region(hose->regions + 4,
  62. CONFIG_SYS_ISA_IO_BUS,
  63. CONFIG_SYS_ISA_IO_PHYS,
  64. CONFIG_SYS_ISA_IO_SIZE,
  65. PCI_REGION_IO);
  66. hose->region_count = 5;
  67. pci_setup_indirect(hose,
  68. MPC106_REG_ADDR,
  69. MPC106_REG_DATA);
  70. pci_register_hose(hose);
  71. hose->last_busno = pci_hose_scan(hose);
  72. /* Initialises the MPC10x PCI Configuration regs. */
  73. pci_read_config_word (PCI_BDF(0,0,0), PCI_COMMAND, &reg16);
  74. reg16 |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
  75. pci_write_config_word(PCI_BDF(0,0,0), PCI_COMMAND, reg16);
  76. /* Clear non-reserved bits in status register */
  77. pci_write_config_word(PCI_BDF(0,0,0), PCI_STATUS, 0xffff);
  78. }
  79. #endif /* CONFIG_PCI */