]> 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 a14db5ad2c4f8bfcf0517fd3f67d63830e86fca0..6625d3afba0911f9c0333b07f4b99629c8a14f4b 100644 (file)
@@ -166,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);
@@ -185,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);
@@ -215,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");
@@ -234,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);
@@ -252,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);
@@ -287,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)){
@@ -305,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);
@@ -356,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 */
 
@@ -538,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);
 
@@ -552,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);
 
@@ -570,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