pci.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (C) 2007 Freescale Semiconductor, Inc.
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. */
  12. #include <common.h>
  13. #include <mpc83xx.h>
  14. #include <pci.h>
  15. #if defined(CONFIG_PCI)
  16. static struct pci_region pci_regions[] = {
  17. {
  18. bus_start: CONFIG_SYS_PCI_MEM_BASE,
  19. phys_start: CONFIG_SYS_PCI_MEM_PHYS,
  20. size: CONFIG_SYS_PCI_MEM_SIZE,
  21. flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
  22. },
  23. {
  24. bus_start: CONFIG_SYS_PCI_MMIO_BASE,
  25. phys_start: CONFIG_SYS_PCI_MMIO_PHYS,
  26. size: CONFIG_SYS_PCI_MMIO_SIZE,
  27. flags: PCI_REGION_MEM
  28. },
  29. {
  30. bus_start: CONFIG_SYS_PCI_IO_BASE,
  31. phys_start: CONFIG_SYS_PCI_IO_PHYS,
  32. size: CONFIG_SYS_PCI_IO_SIZE,
  33. flags: PCI_REGION_IO
  34. }
  35. };
  36. void pci_init_board(void)
  37. {
  38. volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
  39. volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
  40. volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
  41. struct pci_region *reg[] = { pci_regions };
  42. /* Enable all 5 PCI_CLK_OUTPUTS */
  43. clk->occr |= 0xf8000000;
  44. udelay(2000);
  45. /* Configure PCI Local Access Windows */
  46. pci_law[0].bar = CONFIG_SYS_PCI_MEM_PHYS & LAWBAR_BAR;
  47. pci_law[0].ar = LBLAWAR_EN | LBLAWAR_512MB;
  48. pci_law[1].bar = CONFIG_SYS_PCI_IO_PHYS & LAWBAR_BAR;
  49. pci_law[1].ar = LBLAWAR_EN | LBLAWAR_1MB;
  50. mpc83xx_pci_init(1, reg, 0);
  51. }
  52. #endif /* CONFIG_PCI */