]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/freescale/mpc8572ds/mpc8572ds.c
Fixup SGMII PHY ids in the device tree
[karo-tx-uboot.git] / board / freescale / mpc8572ds / mpc8572ds.c
index 3a78c98d14db943bf04419e1ed2170d0ff859421..6625d3afba0911f9c0333b07f4b99629c8a14f4b 100644 (file)
 #include "../common/pixis.h"
 #include "../common/sgmii_riser.h"
 
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
-extern void ddr_enable_ecc(unsigned int dram_size);
-#endif
-
 long int fixed_sdram(void);
 
 int checkboard (void)
@@ -61,20 +57,12 @@ phys_size_t initdram(int board_type)
 
 #ifdef CONFIG_SPD_EEPROM
        dram_size = fsl_ddr_sdram();
-
-       dram_size = setup_ddr_tlbs(dram_size / 0x100000);
-
-       dram_size *= 0x100000;
 #else
        dram_size = fixed_sdram();
 #endif
+       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
        puts("    DDR: ");
        return dram_size;
 }
@@ -178,11 +166,11 @@ void pci_init_board(void)
                struct pci_controller *hose = &pcie3_hose;
                int pcie_ep = (host_agent == 0) || (host_agent == 3) ||
                        (host_agent == 5) || (host_agent == 6);
-               int pcie_configured  = io_sel >= 1;
+               int pcie_configured  = (io_sel == 0x7);
                struct pci_region *r = hose->regions;
                u32 temp32;
 
-               if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE)){
+               if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE3)){
                        printf ("\n    PCIE3 connected to ULI as %s (base address %x)",
                                        pcie_ep ? "End Point" : "Root Complex",
                                        (uint)pci);
@@ -197,14 +185,14 @@ void pci_init_board(void)
 
                        /* outbound memory */
                        pci_set_region(r++,
-                                       CONFIG_SYS_PCIE3_MEM_BASE,
+                                       CONFIG_SYS_PCIE3_MEM_BUS,
                                        CONFIG_SYS_PCIE3_MEM_PHYS,
                                        CONFIG_SYS_PCIE3_MEM_SIZE,
                                        PCI_REGION_MEM);
 
                        /* outbound io */
                        pci_set_region(r++,
-                                       CONFIG_SYS_PCIE3_IO_BASE,
+                                       CONFIG_SYS_PCIE3_IO_BUS,
                                        CONFIG_SYS_PCIE3_IO_PHYS,
                                        CONFIG_SYS_PCIE3_IO_SIZE,
                                        PCI_REGION_IO);
@@ -227,9 +215,11 @@ void pci_init_board(void)
 
                        pci_hose_read_config_dword(hose, PCI_BDF(2, 0x1d, 0 ),
                                        PCI_BASE_ADDRESS_1, &temp32);
-                       if (temp32 >= CONFIG_SYS_PCIE3_MEM_PHYS) {
-                               debug(" uli1572 read to %x\n", temp32);
-                               in_be32((unsigned *)temp32);
+                       if (temp32 >= CONFIG_SYS_PCIE3_MEM_BUS) {
+                               void *p = pci_mem_to_virt(PCI_BDF(2, 0x1d, 0),
+                                                               temp32, 4, 0);
+                               debug(" uli1572 read to %p\n", p);
+                               in_be32(p);
                        }
                } else {
                        printf ("    PCIE3: disabled\n");
@@ -246,10 +236,10 @@ void pci_init_board(void)
                struct pci_controller *hose = &pcie2_hose;
                int pcie_ep = (host_agent == 2) || (host_agent == 4) ||
                        (host_agent == 6) || (host_agent == 0);
-               int pcie_configured  = io_sel & 4;
+               int pcie_configured  = (io_sel == 0x3) || (io_sel == 0x7);
                struct pci_region *r = hose->regions;
 
-               if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE)){
+               if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE2)){
                        printf ("\n    PCIE2 connected to Slot 1 as %s (base address %x)",
                                        pcie_ep ? "End Point" : "Root Complex",
                                        (uint)pci);
@@ -264,14 +254,14 @@ void pci_init_board(void)
 
                        /* outbound memory */
                        pci_set_region(r++,
-                                       CONFIG_SYS_PCIE2_MEM_BASE,
+                                       CONFIG_SYS_PCIE2_MEM_BUS,
                                        CONFIG_SYS_PCIE2_MEM_PHYS,
                                        CONFIG_SYS_PCIE2_MEM_SIZE,
                                        PCI_REGION_MEM);
 
                        /* outbound io */
                        pci_set_region(r++,
-                                       CONFIG_SYS_PCIE2_IO_BASE,
+                                       CONFIG_SYS_PCIE2_IO_BUS,
                                        CONFIG_SYS_PCIE2_IO_PHYS,
                                        CONFIG_SYS_PCIE2_IO_SIZE,
                                        PCI_REGION_IO);
@@ -299,7 +289,9 @@ void pci_init_board(void)
                struct pci_controller *hose = &pcie1_hose;
                int pcie_ep = (host_agent <= 1) || (host_agent == 4) ||
                        (host_agent == 5);
-               int pcie_configured  = io_sel & 6;
+               int pcie_configured  = (io_sel == 0x2) || (io_sel == 0x3) ||
+                                       (io_sel == 0x7) || (io_sel == 0xb) ||
+                                       (io_sel == 0xc) || (io_sel == 0xf);
                struct pci_region *r = hose->regions;
 
                if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE)){
@@ -317,14 +309,14 @@ void 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);
@@ -368,7 +360,7 @@ int board_early_init_r(void)
        /* invalidate existing TLB entry for flash + promjet */
        disable_tlb(flash_esel);
 
-       set_tlb(1, flashbase, flashbase,                /* tlb, epn, rpn */
+       set_tlb(1, flashbase, CONFIG_SYS_FLASH_BASE_PHYS,       /* tlb, epn, rpn */
                        MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, /* perms, wimge */
                        0, flash_esel, BOOKE_PAGESZ_256M, 1);   /* ts, esel, tsize, iprot */
 
@@ -550,7 +542,9 @@ int board_eth_init(bd_t *bis)
                return 0;
        }
 
+#ifdef CONFIG_FSL_SGMII_RISER
        fsl_sgmii_riser_init(tsec_info, num);
+#endif
 
        tsec_eth_init(bis, tsec_info, num);
 
@@ -564,7 +558,8 @@ extern void ft_fsl_pci_setup(void *blob, const char *pci_alias,
 
 void ft_board_setup(void *blob, bd_t *bd)
 {
-       ulong base, size;
+       phys_addr_t base;
+       phys_size_t size;
 
        ft_cpu_setup(blob, bd);
 
@@ -582,6 +577,9 @@ void ft_board_setup(void *blob, bd_t *bd)
 #ifdef CONFIG_PCIE1
        ft_fsl_pci_setup(blob, "pci2", &pcie1_hose);
 #endif
+#ifdef CONFIG_FSL_SGMII_RISER
+       fsl_sgmii_riser_fdt_fixup(blob);
+#endif
 }
 #endif