]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/powerpc/cpu/ppc4xx/4xx_pci.c
Merge branch 'master' of git://www.denx.de/git/u-boot-cfi-flash
[karo-tx-uboot.git] / arch / powerpc / cpu / ppc4xx / 4xx_pci.c
index eed4534e5f50b146edd57ff27efddfa2c304ee11..2ca355b1347969cca6ac4b0bd355329c51dd1fc0 100644 (file)
@@ -476,7 +476,9 @@ void pci_init_board(void)
  *-----------------------------------------------------------------------------*/
 #if defined(CONFIG_440)
 
+#if defined(CONFIG_SYS_PCI_MASTER_INIT) || defined(CONFIG_SYS_PCI_TARGET_INIT)
 static struct pci_controller ppc440_hose = {0};
+#endif
 
 /*
  * This routine is called to determine if a pci scan should be
@@ -592,35 +594,35 @@ int __pci_pre_init(struct pci_controller *hose)
         * Set priority for all PLB3 devices to 0.
         * Set PLB3 arbiter to fair mode.
         */
-       mfsdr(SD0_AMP1, reg);
-       mtsdr(SD0_AMP1, (reg & 0x000000FF) | 0x0000FF00);
-       reg = mfdcr(PLB3_ACR);
-       mtdcr(PLB3_ACR, reg | 0x80000000);
+       mfsdr(SDR0_AMP1, reg);
+       mtsdr(SDR0_AMP1, (reg & 0x000000FF) | 0x0000FF00);
+       reg = mfdcr(PLB3A0_ACR);
+       mtdcr(PLB3A0_ACR, reg | 0x80000000);
 
        /*
         * Set priority for all PLB4 devices to 0.
         */
-       mfsdr(SD0_AMP0, reg);
-       mtsdr(SD0_AMP0, (reg & 0x000000FF) | 0x0000FF00);
-       reg = mfdcr(PLB4_ACR) | 0xa0000000;
-       mtdcr(PLB4_ACR, reg);
+       mfsdr(SDR0_AMP0, reg);
+       mtsdr(SDR0_AMP0, (reg & 0x000000FF) | 0x0000FF00);
+       reg = mfdcr(PLB4A0_ACR) | 0xa0000000;
+       mtdcr(PLB4A0_ACR, reg);
 
        /*
         * Set Nebula PLB4 arbiter to fair mode.
         */
        /* Segment0 */
-       reg = (mfdcr(PLB0_ACR) & ~PLB0_ACR_PPM_MASK) | PLB0_ACR_PPM_FAIR;
-       reg = (reg & ~PLB0_ACR_HBU_MASK) | PLB0_ACR_HBU_ENABLED;
-       reg = (reg & ~PLB0_ACR_RDP_MASK) | PLB0_ACR_RDP_4DEEP;
-       reg = (reg & ~PLB0_ACR_WRP_MASK) | PLB0_ACR_WRP_2DEEP;
-       mtdcr(PLB0_ACR, reg);
+       reg = (mfdcr(PLB4A0_ACR) & ~PLB4Ax_ACR_PPM_MASK) | PLB4Ax_ACR_PPM_FAIR;
+       reg = (reg & ~PLB4Ax_ACR_HBU_MASK) | PLB4Ax_ACR_HBU_ENABLED;
+       reg = (reg & ~PLB4Ax_ACR_RDP_MASK) | PLB4Ax_ACR_RDP_4DEEP;
+       reg = (reg & ~PLB4Ax_ACR_WRP_MASK) | PLB4Ax_ACR_WRP_2DEEP;
+       mtdcr(PLB4A0_ACR, reg);
 
        /* Segment1 */
-       reg = (mfdcr(PLB1_ACR) & ~PLB1_ACR_PPM_MASK) | PLB1_ACR_PPM_FAIR;
-       reg = (reg & ~PLB1_ACR_HBU_MASK) | PLB1_ACR_HBU_ENABLED;
-       reg = (reg & ~PLB1_ACR_RDP_MASK) | PLB1_ACR_RDP_4DEEP;
-       reg = (reg & ~PLB1_ACR_WRP_MASK) | PLB1_ACR_WRP_2DEEP;
-       mtdcr(PLB1_ACR, reg);
+       reg = (mfdcr(PLB4A1_ACR) & ~PLB4Ax_ACR_PPM_MASK) | PLB4Ax_ACR_PPM_FAIR;
+       reg = (reg & ~PLB4Ax_ACR_HBU_MASK) | PLB4Ax_ACR_HBU_ENABLED;
+       reg = (reg & ~PLB4Ax_ACR_RDP_MASK) | PLB4Ax_ACR_RDP_4DEEP;
+       reg = (reg & ~PLB4Ax_ACR_WRP_MASK) | PLB4Ax_ACR_WRP_2DEEP;
+       mtdcr(PLB4A1_ACR, reg);
 
 #if defined(CONFIG_SYS_PCI_BOARD_FIXUP_IRQ)
        hose->fixup_irq = board_pci_fixup_irq;
@@ -704,7 +706,8 @@ void pci_master_init(struct pci_controller *hose)
        __attribute__((weak, alias("__pci_master_init")));
 #endif /* CONFIG_SYS_PCI_MASTER_INIT */
 
-int pci_440_init (struct pci_controller *hose)
+#if defined(CONFIG_SYS_PCI_MASTER_INIT) || defined(CONFIG_SYS_PCI_TARGET_INIT)
+static int pci_440_init (struct pci_controller *hose)
 {
        int reg_num = 0;
 
@@ -845,12 +848,21 @@ int pci_440_init (struct pci_controller *hose)
        }
        return hose->last_busno;
 }
+#endif
 
 void pci_init_board(void)
 {
-       int busno;
+       int busno = 0;
 
-       busno = pci_440_init (&ppc440_hose);
+       /*
+        * Only init PCI when either master or target functionality
+        * is selected.
+        */
+#if defined(CONFIG_SYS_PCI_MASTER_INIT) || defined(CONFIG_SYS_PCI_TARGET_INIT)
+       busno = pci_440_init(&ppc440_hose);
+       if (busno < 0)
+               return;
+#endif
 #if (defined(CONFIG_440SPE) || \
     defined(CONFIG_460EX) || defined(CONFIG_460GT)) && \
     !defined(CONFIG_PCI_DISABLE_PCIE)