pci.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * pci.c -- WindRiver SBC8349 PCI board support.
  4. * Copyright (c) 2006 Wind River Systems, Inc.
  5. * Copyright (C) 2006-2009 Freescale Semiconductor, Inc.
  6. *
  7. * Based on MPC8349 PCI support but w/o PIB related code.
  8. */
  9. #include <asm/mmu.h>
  10. #include <asm/io.h>
  11. #include <common.h>
  12. #include <mpc83xx.h>
  13. #include <pci.h>
  14. #include <i2c.h>
  15. #include <asm/fsl_i2c.h>
  16. static struct pci_region pci1_regions[] = {
  17. {
  18. bus_start: CONFIG_SYS_PCI1_MEM_BASE,
  19. phys_start: CONFIG_SYS_PCI1_MEM_PHYS,
  20. size: CONFIG_SYS_PCI1_MEM_SIZE,
  21. flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
  22. },
  23. {
  24. bus_start: CONFIG_SYS_PCI1_IO_BASE,
  25. phys_start: CONFIG_SYS_PCI1_IO_PHYS,
  26. size: CONFIG_SYS_PCI1_IO_SIZE,
  27. flags: PCI_REGION_IO
  28. },
  29. {
  30. bus_start: CONFIG_SYS_PCI1_MMIO_BASE,
  31. phys_start: CONFIG_SYS_PCI1_MMIO_PHYS,
  32. size: CONFIG_SYS_PCI1_MMIO_SIZE,
  33. flags: PCI_REGION_MEM
  34. },
  35. };
  36. /*
  37. * pci_init_board()
  38. *
  39. * NOTICE: PCI2 is not supported. There is only one
  40. * physical PCI slot on the board.
  41. *
  42. */
  43. void
  44. pci_init_board(void)
  45. {
  46. volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
  47. volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
  48. volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
  49. struct pci_region *reg[] = { pci1_regions };
  50. /* Enable all 8 PCI_CLK_OUTPUTS */
  51. clk->occr = 0xff000000;
  52. udelay(2000);
  53. /* Configure PCI Local Access Windows */
  54. pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR;
  55. pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_1G;
  56. pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR;
  57. pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_4M;
  58. udelay(2000);
  59. mpc83xx_pci_init(1, reg);
  60. }