]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/freescale/mpc8548cds/mpc8548cds.c
pci/fsl_pci_init: Fold pci_setup_indirect into fsl_pci_init
[karo-tx-uboot.git] / board / freescale / mpc8548cds / mpc8548cds.c
index 6eb62eab3b1380c0afd86b3ee43dbbe4d61cc983..d0856c43c0149052c39af5ac931be9b37d563c94 100644 (file)
@@ -27,7 +27,7 @@
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
-#include <asm/immap_fsl_pci.h>
+#include <asm/fsl_pci.h>
 #include <asm/fsl_ddr_sdram.h>
 #include <spd_sdram.h>
 #include <miiphy.h>
 #include "../common/eeprom.h"
 #include "../common/via.h"
 
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
-extern void ddr_enable_ecc(unsigned int dram_size);
-#endif
-
 DECLARE_GLOBAL_DATA_PTR;
 
 void local_bus_init(void);
@@ -56,7 +52,6 @@ int checkboard (void)
        uint pci_slot = get_pci_slot ();
 
        uint cpu_board_rev = get_cpu_board_revision ();
-       uint svr;
 
        printf ("Board: CDS Version 0x%02x, PCI Slot %d\n",
                get_board_version (), pci_slot);
@@ -69,17 +64,6 @@ int checkboard (void)
         */
        local_bus_init ();
 
-       svr = get_svr();
-
-       /*
-        * Fix CPU2 errata: A core hang possible while executing a
-        * msync instruction and a snoopable transaction from an I/O
-        * master tagged to make quick forward progress is present.
-        * Fixed in Silicon Rev.2.1
-        */
-       if (!(SVR_MAJ(svr) >= 2 && SVR_MIN(svr) >= 1))
-               ecm->eebpcr |= (1 << 16);
-
        /*
         * Hack TSEC 3 and 4 IO voltages.
         */
@@ -118,13 +102,6 @@ initdram(int board_type)
        dram_size = setup_ddr_tlbs(dram_size / 0x100000);
        dram_size *= 0x100000;
 
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
-       /*
-        * Initialize and enable DDR ECC.
-        */
-       ddr_enable_ecc(dram_size);
-#endif
-
        /*
         * SDRAM Initialization
         */
@@ -148,7 +125,7 @@ local_bus_init(void)
        sys_info_t sysinfo;
 
        get_sys_info(&sysinfo);
-       clkdiv = (lbc->lcrr & 0x0f) * 2;
+       clkdiv = (lbc->lcrr & LCRR_CLKDIV) * 2;
        lbc_hz = sysinfo.freqSystemBus / 1000000 / clkdiv;
 
        gur->lbiuiplldcr1 = 0x00078080;
@@ -208,12 +185,12 @@ sdram_init(void)
         */
        cpu_board_rev = get_cpu_board_revision();
        lsdmr_common = CONFIG_SYS_LBC_LSDMR_COMMON;
-       lsdmr_common |= CONFIG_SYS_LBC_LSDMR_BSMA1516;
+       lsdmr_common |= LSDMR_BSMA1516;
 
        /*
         * Issue PRECHARGE ALL command.
         */
-       lbc->lsdmr = lsdmr_common | CONFIG_SYS_LBC_LSDMR_OP_PCHALL;
+       lbc->lsdmr = lsdmr_common | LSDMR_OP_PCHALL;
        asm("sync;msync");
        *sdram_addr = 0xff;
        ppcDcbf((unsigned long) sdram_addr);
@@ -223,7 +200,7 @@ sdram_init(void)
         * Issue 8 AUTO REFRESH commands.
         */
        for (idx = 0; idx < 8; idx++) {
-               lbc->lsdmr = lsdmr_common | CONFIG_SYS_LBC_LSDMR_OP_ARFRSH;
+               lbc->lsdmr = lsdmr_common | LSDMR_OP_ARFRSH;
                asm("sync;msync");
                *sdram_addr = 0xff;
                ppcDcbf((unsigned long) sdram_addr);
@@ -233,7 +210,7 @@ sdram_init(void)
        /*
         * Issue 8 MODE-set command.
         */
-       lbc->lsdmr = lsdmr_common | CONFIG_SYS_LBC_LSDMR_OP_MRW;
+       lbc->lsdmr = lsdmr_common | LSDMR_OP_MRW;
        asm("sync;msync");
        *sdram_addr = 0xff;
        ppcDcbf((unsigned long) sdram_addr);
@@ -242,7 +219,7 @@ sdram_init(void)
        /*
         * Issue NORMAL OP command.
         */
-       lbc->lsdmr = lsdmr_common | CONFIG_SYS_LBC_LSDMR_OP_NORMAL;
+       lbc->lsdmr = lsdmr_common | LSDMR_OP_NORMAL;
        asm("sync;msync");
        *sdram_addr = 0xff;
        ppcDcbf((unsigned long) sdram_addr);
@@ -285,9 +262,6 @@ static struct pci_controller pci2_hose;
 static struct pci_controller pcie1_hose;
 #endif /* CONFIG_PCIE1 */
 
-extern int fsl_pci_setup_inbound_windows(struct pci_region *r);
-extern void fsl_pci_init(struct pci_controller *hose);
-
 int first_free_busno=0;
 
 void
@@ -329,14 +303,14 @@ pci_init_board(void)
 
                /* outbound memory */
                pci_set_region(r++,
-                              CONFIG_SYS_PCI1_MEM_BASE,
+                              CONFIG_SYS_PCI1_MEM_BUS,
                               CONFIG_SYS_PCI1_MEM_PHYS,
                               CONFIG_SYS_PCI1_MEM_SIZE,
                               PCI_REGION_MEM);
 
                /* outbound io */
                pci_set_region(r++,
-                              CONFIG_SYS_PCI1_IO_BASE,
+                              CONFIG_SYS_PCI1_IO_BUS,
                               CONFIG_SYS_PCI1_IO_PHYS,
                               CONFIG_SYS_PCI1_IO_SIZE,
                               PCI_REGION_IO);
@@ -349,13 +323,12 @@ pci_init_board(void)
                        table->config_device += gd->reloc_off;
 
                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);
                first_free_busno=hose->last_busno+1;
                printf ("PCI on bus %02x - %02x\n",hose->first_busno,hose->last_busno);
 #ifdef CONFIG_PCIX_CHECK
-               if (!(gur->pordevsr & PORDEVSR_PCI)) {
+               if (!(gur->pordevsr & MPC85xx_PORDEVSR_PCI1)) {
                        /* PCI-X init */
                        if (CONFIG_SYS_CLK_FREQ < 66000000)
                                printf("PCI-X will only work at 66 MHz\n");
@@ -413,14 +386,14 @@ pci_init_board(void)
 
                /* outbound memory */
                pci_set_region(r++,
-                              CONFIG_SYS_PCIE1_MEM_BASE,
+                              CONFIG_SYS_PCIE1_MEM_BUS,
                               CONFIG_SYS_PCIE1_MEM_PHYS,
                               CONFIG_SYS_PCIE1_MEM_SIZE,
                               PCI_REGION_MEM);
 
                /* outbound io */
                pci_set_region(r++,
-                              CONFIG_SYS_PCIE1_IO_BASE,
+                              CONFIG_SYS_PCIE1_IO_BUS,
                               CONFIG_SYS_PCIE1_IO_PHYS,
                               CONFIG_SYS_PCIE1_IO_SIZE,
                               PCI_REGION_IO);
@@ -428,9 +401,8 @@ pci_init_board(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 %d - %d\n",hose->first_busno,hose->last_busno);
 
                first_free_busno=hose->last_busno+1;
@@ -478,9 +450,6 @@ int last_stage_init(void)
 
 
 #if defined(CONFIG_OF_BOARD_SETUP)
-extern void ft_fsl_pci_setup(void *blob, const char *pci_alias,
-                        struct pci_controller *hose);
-
 void ft_pci_setup(void *blob, bd_t *bd)
 {
 #ifdef CONFIG_PCI1