pci.c 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Copyright 2004 Freescale Semiconductor.
  3. * Copyright (C) 2003 Motorola Inc.
  4. * Xianghua Xiao (x.xiao@motorola.com)
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. /*
  25. * PCI Configuration space access support for MPC85xx PCI Bridge
  26. */
  27. #include <common.h>
  28. #include <asm/cpm_85xx.h>
  29. #include <pci.h>
  30. #if defined(CONFIG_PCI)
  31. void
  32. pci_mpc85xx_init(struct pci_controller *hose)
  33. {
  34. volatile immap_t *immap = (immap_t *)CFG_CCSRBAR;
  35. volatile ccsr_pcix_t *pcix = &immap->im_pcix;
  36. u16 reg16;
  37. hose->first_busno = 0;
  38. hose->last_busno = 0xff;
  39. pci_set_region(hose->regions + 0,
  40. CFG_PCI1_MEM_BASE,
  41. CFG_PCI1_MEM_PHYS,
  42. CFG_PCI1_MEM_SIZE,
  43. PCI_REGION_MEM);
  44. pci_set_region(hose->regions + 1,
  45. CFG_PCI1_IO_BASE,
  46. CFG_PCI1_IO_PHYS,
  47. CFG_PCI1_IO_SIZE,
  48. PCI_REGION_IO);
  49. hose->region_count = 2;
  50. pci_setup_indirect(hose,
  51. (CFG_IMMR+0x8000),
  52. (CFG_IMMR+0x8004));
  53. pci_read_config_word (PCI_BDF(0,0,0), PCI_COMMAND, &reg16);
  54. reg16 |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
  55. pci_write_config_word(PCI_BDF(0,0,0), PCI_COMMAND, reg16);
  56. /*
  57. * Clear non-reserved bits in status register.
  58. */
  59. pci_write_config_word(PCI_BDF(0,0,0), PCI_STATUS, 0xffff);
  60. pci_write_config_byte(PCI_BDF(0,0,0), PCI_LATENCY_TIMER,0x80);
  61. pcix->potar1 = (CFG_PCI1_MEM_BASE >> 12) & 0x000fffff;
  62. pcix->potear1 = 0x00000000;
  63. pcix->powbar1 = (CFG_PCI1_MEM_BASE >> 12) & 0x000fffff;
  64. pcix->powbear1 = 0x00000000;
  65. pcix->powar1 = 0x8004401c; /* 512M MEM space */
  66. pcix->potar2 = (CFG_PCI1_IO_BASE >> 12) & 0x000fffff;
  67. pcix->potear2 = 0x00000000;
  68. pcix->powbar2 = (CFG_PCI1_IO_BASE >> 12) & 0x000fffff;
  69. pcix->powbear2 = 0x00000000;
  70. pcix->powar2 = 0x80088017; /* 16M IO space */
  71. pcix->pitar1 = 0x00000000;
  72. pcix->piwbar1 = 0x00000000;
  73. pcix->piwar1 = 0xa0F5501f;
  74. /*
  75. * Hose scan.
  76. */
  77. pci_register_hose(hose);
  78. hose->last_busno = pci_hose_scan(hose);
  79. }
  80. #endif /* CONFIG_PCI */