pcie_fsl.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright 2019 NXP
  4. *
  5. * PCIe DM U-Boot driver for Freescale PowerPC SoCs
  6. * Author: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
  7. */
  8. #ifndef _PCIE_FSL_H_
  9. #define _PCIE_FSL_H_
  10. /* GPEX CSR */
  11. #define CSR_CLASSCODE 0x474
  12. #ifdef CONFIG_SYS_FSL_PCI_VER_3_X
  13. #define FSL_PCIE_CAP_ID 0x70
  14. #else
  15. #define FSL_PCIE_CAP_ID 0x4c
  16. #endif
  17. /* PCIe Device Control Register */
  18. #define PCI_DCR (FSL_PCIE_CAP_ID + 0x08)
  19. /* PCIe Device Status Register */
  20. #define PCI_DSR (FSL_PCIE_CAP_ID + 0x0a)
  21. /* PCIe Link Control Register */
  22. #define PCI_LCR (FSL_PCIE_CAP_ID + 0x10)
  23. /* PCIe Link Status Register */
  24. #define PCI_LSR (FSL_PCIE_CAP_ID + 0x12)
  25. #define DBI_RO_WR_EN 0x8bc
  26. #ifndef CONFIG_SYS_PCI_MEMORY_BUS
  27. #define CONFIG_SYS_PCI_MEMORY_BUS 0
  28. #endif
  29. #ifndef CONFIG_SYS_PCI_MEMORY_PHYS
  30. #define CONFIG_SYS_PCI_MEMORY_PHYS 0
  31. #endif
  32. #if defined(CONFIG_SYS_PCI_64BIT) && !defined(CONFIG_SYS_PCI64_MEMORY_BUS)
  33. #define CONFIG_SYS_PCI64_MEMORY_BUS (64ull * 1024 * 1024 * 1024)
  34. #endif
  35. #define PEX_CSR0_LTSSM_MASK 0xFC
  36. #define PEX_CSR0_LTSSM_SHIFT 2
  37. #define LTSSM_L0_REV3 0x11
  38. #define LTSSM_L0 0x16
  39. struct fsl_pcie_data {
  40. u32 block_offset; /* Offset from CCSR of 1st controller */
  41. u32 block_offset_mask; /* Mask out the CCSR base */
  42. u32 stride; /* Offset stride between controllers */
  43. };
  44. struct fsl_pcie {
  45. int idx;
  46. struct udevice *bus;
  47. void __iomem *regs;
  48. u32 law_trgt_if; /* LAW target ID */
  49. u32 block_rev; /* IP block revision */
  50. bool mode; /* RC&EP mode flag */
  51. bool enabled; /* Enable status */
  52. struct list_head list;
  53. struct fsl_pcie_data *info;
  54. };
  55. extern struct list_head fsl_pcie_list;
  56. #endif /* _PCIE_FSL_H_ */