ppc/8xxx: Refactor code to determine if PCI is enabled & agent/host
[oweals/u-boot.git] / board / tqc / tqm85xx / tqm85xx.c
index ab0e0dd883817af20f45c274fef5c5b503c56055..3931ec5036f93fbd49843f25c2924f5ab41a15d4 100644 (file)
@@ -561,8 +561,7 @@ static inline void init_pci1(void)
        /* PORPLLSR[16] */
        uint pci_clk_sel = gur->porpllsr & MPC85xx_PORDEVSR_PCI1_SPD;
 
-       uint pci_agent = (host_agent == 3) || (host_agent == 4 ) ||
-               (host_agent == 6);
+       uint pci_agent = is_fsl_pci_agent(LAW_TRGT_IF_PCI_1, host_agent);
 
        uint pci_speed = CONFIG_SYS_CLK_FREQ;   /* PCI PSPEED in [4:5] */
 
@@ -575,10 +574,6 @@ static inline void init_pci1(void)
                        pci_agent ? "agent" : "host",
                        pci_arb ? "arbiter" : "external-arbiter");
 
-
-               /* inbound */
-               r += fsl_pci_setup_inbound_windows(r);
-
                /* outbound memory */
                pci_set_region (r++,
                                CONFIG_SYS_PCI1_MEM_BASE,
@@ -596,10 +591,8 @@ static inline void init_pci1(void)
                hose->region_count = r - hose->regions;
 
                hose->first_busno = first_free_busno;
-               pci_setup_indirect (hose, (int)&pci->cfg_addr,
-                                   (int)&pci->cfg_data);
 
-               fsl_pci_init (hose);
+               fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
                printf ("       PCI on bus %02x..%02x\n",
                        hose->first_busno, hose->last_busno);
@@ -636,11 +629,10 @@ static inline void init_pcie1(void)
        uint host_agent = (gur->porbmsr & MPC85xx_PORBMSR_HA) >> 16;
        volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *)CONFIG_SYS_PCIE1_ADDR;
        struct pci_controller *hose = &pcie1_hose;
-       int pcie_ep =  (host_agent == 0) || (host_agent == 2 ) ||
-               (host_agent == 3);
+       int pcie_ep = is_fsl_pci_agent(LAW_TRGT_IF_PCIE_1, host_agent);
        struct pci_region *r = hose->regions;
 
-       int pcie_configured  = io_sel >= 1;
+       int pcie_configured = is_fsl_pci_cfg(LAW_TRGT_IF_PCIE_1, io_sel);
 
        if (pcie_configured && !(gur->devdisr & MPC85xx_DEVDISR_PCIE)){
                printf ("PCIe:  %s, base address %x",
@@ -653,9 +645,6 @@ static inline void init_pcie1(void)
                }
                puts ("\n");
 
-               /* inbound */
-               r += fsl_pci_setup_inbound_windows(r);
-
                /* outbound memory */
                pci_set_region (r++,
                                CONFIG_SYS_PCIE1_MEM_BASE,
@@ -673,10 +662,8 @@ static inline void init_pcie1(void)
                hose->region_count = r - hose->regions;
 
                hose->first_busno = first_free_busno;
-               pci_setup_indirect(hose, (int)&pci->cfg_addr,
-                                  (int)&pci->cfg_data);
 
-               fsl_pci_init (hose);
+               fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
                printf ("       PCIe on bus %02x..%02x\n",
                        hose->first_busno, hose->last_busno);