Prepare v2023.10
[platform/kernel/u-boot.git] / drivers / pci / pcie_layerscape.h
index 26d0177..b7f692f 100644 (file)
@@ -8,23 +8,25 @@
 #ifndef _PCIE_LAYERSCAPE_H_
 #define _PCIE_LAYERSCAPE_H_
 #include <pci.h>
-#include <dm.h>
+
 #include <linux/sizes.h>
+#include <asm/arch-fsl-layerscape/svr.h>
+#include <asm/arch-ls102xa/svr.h>
 
-#ifndef CONFIG_SYS_PCI_MEMORY_BUS
-#define CONFIG_SYS_PCI_MEMORY_BUS CONFIG_SYS_SDRAM_BASE
+#ifndef CFG_SYS_PCI_MEMORY_BUS
+#define CFG_SYS_PCI_MEMORY_BUS CFG_SYS_SDRAM_BASE
 #endif
 
-#ifndef CONFIG_SYS_PCI_MEMORY_PHYS
-#define CONFIG_SYS_PCI_MEMORY_PHYS CONFIG_SYS_SDRAM_BASE
+#ifndef CFG_SYS_PCI_MEMORY_PHYS
+#define CFG_SYS_PCI_MEMORY_PHYS CFG_SYS_SDRAM_BASE
 #endif
 
-#ifndef CONFIG_SYS_PCI_MEMORY_SIZE
-#define CONFIG_SYS_PCI_MEMORY_SIZE SZ_4G
+#ifndef CFG_SYS_PCI_MEMORY_SIZE
+#define CFG_SYS_PCI_MEMORY_SIZE SZ_4G
 #endif
 
-#ifndef CONFIG_SYS_PCI_EP_MEMORY_BASE
-#define CONFIG_SYS_PCI_EP_MEMORY_BASE CONFIG_SYS_LOAD_ADDR
+#ifndef CFG_SYS_PCI_EP_MEMORY_BASE
+#define CFG_SYS_PCI_EP_MEMORY_BASE CONFIG_SYS_LOAD_ADDR
 #endif
 
 #define PCIE_PHYS_SIZE                 0x200000000
 
 #define PCIE_SRIOV_VFBAR0      0x19C
 
-#define PCIE_MASK_OFFSET(flag, pf) ((flag) ? 0 : (0x1000 + 0x20000 * (pf)))
+#define PCIE_MASK_OFFSET(flag, pf, off) ((flag) ? 0 : (0x1000 + (off) * (pf)))
 
 /* LUT registers */
 #define PCIE_LUT_UDR(n)                (0x800 + (n) * 8)
 /* CS2 */
 #define PCIE_CS2_OFFSET                0x1000 /* For PCIe without SR-IOV */
 
-#define SVR_LS102XA            0
-#define SVR_VAR_PER_SHIFT      8
-#define SVR_LS102XA_MASK       0x700
-#define SVR_LS2088A            0x870900
-#define SVR_LS2084A            0x870910
-#define SVR_LS2048A            0x870920
-#define SVR_LS2044A            0x870930
-#define SVR_LS2081A            0x870918
-#define SVR_LS2041A            0x870914
-
 /* LS1021a PCIE space */
 #define LS1021_PCIE_SPACE_OFFSET       0x4000000000ULL
 #define LS1021_PCIE_SPACE_SIZE         0x0800000000ULL
 #define LS1021_PEXMSCPORTSR(pex_idx)   (0x94 + (pex_idx) * 4)
 #define LS1021_LTSSM_STATE_SHIFT       20
 
+/* LX2160a PF1 offset */
+#define LX2160_PCIE_PF1_OFFSET 0x8000
+
+/* layerscape PF1 offset */
+#define LS_PCIE_PF1_OFFSET     0x20000
+
 struct ls_pcie {
        void __iomem *dbi;
        void __iomem *lut;
@@ -170,6 +168,7 @@ struct ls_pcie_ep {
        void __iomem *addr;
        u32 cfg2_flag;
        u32 sriov_flag;
+       u32 pf1_offset;
        u32 num_ib_wins;
        u32 num_ob_wins;
        u8 max_functions;
@@ -185,7 +184,7 @@ void ls_pcie_atu_outbound_set(struct ls_pcie *pcie, int idx, int type,
                              u64 phys, u64 bus_addr, u64 size);
 void ls_pcie_atu_inbound_set(struct ls_pcie *pcie, u32 pf, u32 vf_flag,
                             int type, int idx, int bar, u64 phys);
-void ls_pcie_dump_atu(struct ls_pcie *pcie);
+void ls_pcie_dump_atu(struct ls_pcie *pcie, u32 win_num, u32 type);
 int ls_pcie_link_up(struct ls_pcie *pcie);
 void ls_pcie_dbi_ro_wr_en(struct ls_pcie *pcie);
 void ls_pcie_dbi_ro_wr_dis(struct ls_pcie *pcie);