pci.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 <init.h>
  10. #include <asm/mmu.h>
  11. #include <asm/io.h>
  12. #include <common.h>
  13. #include <mpc83xx.h>
  14. #include <pci.h>
  15. #include <i2c.h>
  16. #include <asm/fsl_i2c.h>
  17. static struct pci_region pci1_regions[] = {
  18. {
  19. bus_start: CONFIG_SYS_PCI1_MEM_BASE,
  20. phys_start: CONFIG_SYS_PCI1_MEM_PHYS,
  21. size: CONFIG_SYS_PCI1_MEM_SIZE,
  22. flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
  23. },
  24. {
  25. bus_start: CONFIG_SYS_PCI1_IO_BASE,
  26. phys_start: CONFIG_SYS_PCI1_IO_PHYS,
  27. size: CONFIG_SYS_PCI1_IO_SIZE,
  28. flags: PCI_REGION_IO
  29. },
  30. {
  31. bus_start: CONFIG_SYS_PCI1_MMIO_BASE,
  32. phys_start: CONFIG_SYS_PCI1_MMIO_PHYS,
  33. size: CONFIG_SYS_PCI1_MMIO_SIZE,
  34. flags: PCI_REGION_MEM
  35. },
  36. };
  37. /*
  38. * pci_init_board()
  39. *
  40. * NOTICE: PCI2 is not supported. There is only one
  41. * physical PCI slot on the board.
  42. *
  43. */
  44. void
  45. pci_init_board(void)
  46. {
  47. volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
  48. volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
  49. volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
  50. struct pci_region *reg[] = { pci1_regions };
  51. /* Enable all 8 PCI_CLK_OUTPUTS */
  52. clk->occr = 0xff000000;
  53. udelay(2000);
  54. /* Configure PCI Local Access Windows */
  55. pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR;
  56. pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_1G;
  57. pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR;
  58. pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_4M;
  59. udelay(2000);
  60. mpc83xx_pci_init(1, reg);
  61. }