]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - include/asm-ppc/4xx_pcie.h
ppc4xx: 4xx_pcie: More general cleanup and 405EX PCIe support added
[karo-tx-uboot.git] / include / asm-ppc / 4xx_pcie.h
index 1bb8fc7ed13d403dd0d567ff26281f9144d33328..17ac57b23bcd6a014de9eeb88de75926875b12c6 100644 (file)
 #define DCRN_SDR0_CFGDATA      0x00f
 
 #if defined(CONFIG_440SPE)
+#define CFG_PCIE_NR_PORTS      3
+
+#define CFG_PCIE_ADDR_HIGH     0x0000000d
+
 #define DCRN_PCIE0_BASE                0x100
 #define DCRN_PCIE1_BASE                0x120
 #define DCRN_PCIE2_BASE                0x140
+
+#define PCIE0_SDR              0x300
+#define PCIE1_SDR              0x340
+#define PCIE2_SDR              0x370
 #endif
 
 #if defined(CONFIG_405EX)
+#define CFG_PCIE_NR_PORTS      2
+
+#define CFG_PCIE_ADDR_HIGH     0x00000000
+
 #define        DCRN_PCIE0_BASE         0x040
 #define        DCRN_PCIE1_BASE         0x060
+
+#define PCIE0_SDR              0x400
+#define PCIE1_SDR              0x440
 #endif
 
 #define PCIE0                  DCRN_PCIE0_BASE
 #define PESDR0_PLLLCT2         0x03a1
 #define PESDR0_PLLLCT3         0x03a2
 
-#if defined(CONFIG_440SPE)
-#define PCIE0_SDR              0x300
-#define PCIE1_SDR              0x340
-#define PCIE2_SDR              0x370
-#endif
-
-#if defined(CONFIG_405EX)
-#define PCIE0_SDR              0x400
-#define PCIE1_SDR              0x440
-#endif
-
 /* common regs, at least for 405EX and 440SPe */
 #define SDRN_PESDR_UTLSET1(n)          (sdr_base(n) + 0x00)
 #define SDRN_PESDR_UTLSET2(n)          (sdr_base(n) + 0x01)
 
 #define GPL_DMER_MASK_DISA     0x02000000
 
+#define U64_TO_U32_LOW(val)    ((u32)((val) & 0x00000000ffffffffULL))
+#define U64_TO_U32_HIGH(val)   ((u32)((val) >> 32))
+
 int ppc4xx_init_pcie(void);
 int ppc4xx_init_pcie_rootport(int port);
 int ppc4xx_init_pcie_endport(int port);
@@ -260,7 +267,7 @@ static inline u32 sdr_base(int port)
                return PCIE0_SDR;
        case 1:
                return PCIE1_SDR;
-#if defined(PCIE2_SDR)
+#if CFG_PCIE_NR_PORTS > 2
        case 2:
                return PCIE2_SDR;
 #endif