Merge with /home/sr/git/u-boot
[oweals/u-boot.git] / cpu / ppc4xx / 405gp_pci.c
index ff9215f3b211ad6945325bca4a119b6f2f5028f7..ebbcfd573ac9bfc7518c4d22b9f5747f807844b1 100644 (file)
@@ -95,9 +95,10 @@ void pci_405gp_init(struct pci_controller *hose)
 
        unsigned short temp_short;
        unsigned long ptmpcila[2] = {CFG_PCI_PTM1PCI, CFG_PCI_PTM2PCI};
-#if defined(CONFIG_CPCI405)
+#if defined(CONFIG_CPCI405) || defined(CONFIG_PMC405)
        unsigned long ptmla[2]    = {bd->bi_memstart, bd->bi_flashstart};
        unsigned long ptmms[2]    = {~(bd->bi_memsize - 1) | 1, ~(bd->bi_flashsize - 1) | 1};
+       char *ptmla_str, *ptmms_str;
 #else
        unsigned long ptmla[2]    = {CFG_PCI_PTM1LA, CFG_PCI_PTM2LA};
        unsigned long ptmms[2]    = {CFG_PCI_PTM1MS, CFG_PCI_PTM2MS};
@@ -113,6 +114,27 @@ void pci_405gp_init(struct pci_controller *hose)
        unsigned long pmmpcila[3] = {0x80000000, 0,0};
        unsigned long pmmpciha[3] = {0x00000000, 0,0};
 #endif
+#ifdef CONFIG_PCI_PNP
+#if (CONFIG_PCI_HOST == PCI_HOST_AUTO)
+       char *s;
+#endif
+#endif
+
+#if defined(CONFIG_CPCI405) || defined(CONFIG_PMC405)
+       ptmla_str = getenv("ptm1la");
+       ptmms_str = getenv("ptm1ms");
+       if(NULL != ptmla_str && NULL != ptmms_str ) {
+               ptmla[0] = simple_strtoul (ptmla_str, NULL, 16);
+               ptmms[0] = simple_strtoul (ptmms_str, NULL, 16);
+       }
+
+       ptmla_str = getenv("ptm2la");
+       ptmms_str = getenv("ptm2ms");
+       if(NULL != ptmla_str && NULL != ptmms_str ) {
+               ptmla[1] = simple_strtoul (ptmla_str, NULL, 16);
+               ptmms[1] = simple_strtoul (ptmms_str, NULL, 16);
+       }
+#endif
 
        /*
         * Register the hose
@@ -255,7 +277,8 @@ void pci_405gp_init(struct pci_controller *hose)
 
 #if (CONFIG_PCI_HOST != PCI_HOST_ADAPTER)
 #if (CONFIG_PCI_HOST == PCI_HOST_AUTO)
-       if (mfdcr(strap) & PSR_PCI_ARBIT_EN)
+       if ((mfdcr(strap) & PSR_PCI_ARBIT_EN) ||
+           (((s = getenv("pciscan")) != NULL) && (strcmp(s, "yes") == 0)))
 #endif
        {
                /*--------------------------------------------------------------------------+
@@ -284,7 +307,8 @@ void pci_405gp_init(struct pci_controller *hose)
         * Scan the PCI bus and configure devices found.
         *--------------------------------------------------------------------------*/
 #if (CONFIG_PCI_HOST == PCI_HOST_AUTO)
-       if (mfdcr(strap) & PSR_PCI_ARBIT_EN)
+       if ((mfdcr(strap) & PSR_PCI_ARBIT_EN) ||
+           (((s = getenv("pciscan")) != NULL) && (strcmp(s, "yes") == 0)))
 #endif
        {
 #ifdef CONFIG_PCI_SCAN_SHOW
@@ -413,7 +437,7 @@ void pci_440_init (struct pci_controller *hose)
         * The PCI initialization sequence enable bit must be set ... if not abort
         * pci setup since updating the bit requires chip reset.
         *--------------------------------------------------------------------------*/
-#if defined (CONFIG_440_GX)
+#if defined (CONFIG_440_GX) || defined (CONFIG_440_EP) || defined(CONFIG_440_GR)
        mfsdr(sdr_sdstp1,strap);
        if ( (strap & 0x00010000) == 0 ){
                printf("PCI: SDR0_STRP1[PISE] not set.\n");
@@ -474,7 +498,7 @@ void pci_440_init (struct pci_controller *hose)
 #if defined(CONFIG_440_GX)
        out32r( PCIX0_BRDGOPT1, 0x04000060 );               /* PLB Rq pri highest   */
        out32r( PCIX0_BRDGOPT2, in32(PCIX0_BRDGOPT2) | 0x83 ); /* Enable host config, clear Timeout, ensure int src1  */
-#else
+#elif defined(PCIX0_BRDGOPT1)
        out32r( PCIX0_BRDGOPT1, 0x10000060 );               /* PLB Rq pri highest   */
        out32r( PCIX0_BRDGOPT2, in32(PCIX0_BRDGOPT2) | 1 ); /* Enable host config   */
 #endif
@@ -507,7 +531,9 @@ void pci_440_init (struct pci_controller *hose)
 #ifdef CONFIG_PCI_SCAN_SHOW
        printf("PCI:   Bus Dev VenId DevId Class Int\n");
 #endif
+#if !defined(CONFIG_440_EP) && !defined(CONFIG_440_GR)
        out16r( PCIX0_CMD, in16r( PCIX0_CMD ) | PCI_COMMAND_MASTER);
+#endif
        hose->last_busno = pci_hose_scan(hose);
     }
 }