]> git.sur5r.net Git - u-boot/blobdiff - board/amcc/canyonlands/canyonlands.c
Merge branch 'master' into next
[u-boot] / board / amcc / canyonlands / canyonlands.c
index 5071c8d4e6dc94fd9ada0ec16b30fea7163ebc70..13a0daced774ae24ebeb579df73f0fb4633998f7 100644 (file)
@@ -28,6 +28,7 @@
 #include <asm/mmu.h>
 #include <asm/4xx_pcie.h>
 #include <asm/gpio.h>
+#include <asm/errno.h>
 
 extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips */
 
@@ -94,49 +95,59 @@ static inline void board_cpld_write(int offset, int data)
        out_8((void *)(CONFIG_SYS_CPLD_ADDR), offset);
        out_8((void *)(CONFIG_SYS_CPLD_DATA), data);
 }
+#else
+static int pvr_460ex(void)
+{
+       u32 pvr = get_pvr();
+
+       if ((pvr == PVR_460EX_RA) || (pvr == PVR_460EX_SE_RA) ||
+           (pvr == PVR_460EX_RB))
+               return 1;
+
+       return 0;
+}
 #endif /* defined(CONFIG_ARCHES) */
 
 int board_early_init_f(void)
 {
 #if !defined(CONFIG_ARCHES)
        u32 sdr0_cust0;
-       u32 pvr = get_pvr();
 #endif
 
        /*
         * Setup the interrupt controller polarities, triggers, etc.
         */
-       mtdcr(uic0sr, 0xffffffff);      /* clear all */
-       mtdcr(uic0er, 0x00000000);      /* disable all */
-       mtdcr(uic0cr, 0x00000005);      /* ATI & UIC1 crit are critical */
-       mtdcr(uic0pr, 0xffffffff);      /* per ref-board manual */
-       mtdcr(uic0tr, 0x00000000);      /* per ref-board manual */
-       mtdcr(uic0vr, 0x00000000);      /* int31 highest, base=0x000 */
-       mtdcr(uic0sr, 0xffffffff);      /* clear all */
-
-       mtdcr(uic1sr, 0xffffffff);      /* clear all */
-       mtdcr(uic1er, 0x00000000);      /* disable all */
-       mtdcr(uic1cr, 0x00000000);      /* all non-critical */
-       mtdcr(uic1pr, 0xffffffff);      /* per ref-board manual */
-       mtdcr(uic1tr, 0x00000000);      /* per ref-board manual */
-       mtdcr(uic1vr, 0x00000000);      /* int31 highest, base=0x000 */
-       mtdcr(uic1sr, 0xffffffff);      /* clear all */
-
-       mtdcr(uic2sr, 0xffffffff);      /* clear all */
-       mtdcr(uic2er, 0x00000000);      /* disable all */
-       mtdcr(uic2cr, 0x00000000);      /* all non-critical */
-       mtdcr(uic2pr, 0xffffffff);      /* per ref-board manual */
-       mtdcr(uic2tr, 0x00000000);      /* per ref-board manual */
-       mtdcr(uic2vr, 0x00000000);      /* int31 highest, base=0x000 */
-       mtdcr(uic2sr, 0xffffffff);      /* clear all */
-
-       mtdcr(uic3sr, 0xffffffff);      /* clear all */
-       mtdcr(uic3er, 0x00000000);      /* disable all */
-       mtdcr(uic3cr, 0x00000000);      /* all non-critical */
-       mtdcr(uic3pr, 0xffffffff);      /* per ref-board manual */
-       mtdcr(uic3tr, 0x00000000);      /* per ref-board manual */
-       mtdcr(uic3vr, 0x00000000);      /* int31 highest, base=0x000 */
-       mtdcr(uic3sr, 0xffffffff);      /* clear all */
+       mtdcr(UIC0SR, 0xffffffff);      /* clear all */
+       mtdcr(UIC0ER, 0x00000000);      /* disable all */
+       mtdcr(UIC0CR, 0x00000005);      /* ATI & UIC1 crit are critical */
+       mtdcr(UIC0PR, 0xffffffff);      /* per ref-board manual */
+       mtdcr(UIC0TR, 0x00000000);      /* per ref-board manual */
+       mtdcr(UIC0VR, 0x00000000);      /* int31 highest, base=0x000 */
+       mtdcr(UIC0SR, 0xffffffff);      /* clear all */
+
+       mtdcr(UIC1SR, 0xffffffff);      /* clear all */
+       mtdcr(UIC1ER, 0x00000000);      /* disable all */
+       mtdcr(UIC1CR, 0x00000000);      /* all non-critical */
+       mtdcr(UIC1PR, 0xffffffff);      /* per ref-board manual */
+       mtdcr(UIC1TR, 0x00000000);      /* per ref-board manual */
+       mtdcr(UIC1VR, 0x00000000);      /* int31 highest, base=0x000 */
+       mtdcr(UIC1SR, 0xffffffff);      /* clear all */
+
+       mtdcr(UIC2SR, 0xffffffff);      /* clear all */
+       mtdcr(UIC2ER, 0x00000000);      /* disable all */
+       mtdcr(UIC2CR, 0x00000000);      /* all non-critical */
+       mtdcr(UIC2PR, 0xffffffff);      /* per ref-board manual */
+       mtdcr(UIC2TR, 0x00000000);      /* per ref-board manual */
+       mtdcr(UIC2VR, 0x00000000);      /* int31 highest, base=0x000 */
+       mtdcr(UIC2SR, 0xffffffff);      /* clear all */
+
+       mtdcr(UIC3SR, 0xffffffff);      /* clear all */
+       mtdcr(UIC3ER, 0x00000000);      /* disable all */
+       mtdcr(UIC3CR, 0x00000000);      /* all non-critical */
+       mtdcr(UIC3PR, 0xffffffff);      /* per ref-board manual */
+       mtdcr(UIC3TR, 0x00000000);      /* per ref-board manual */
+       mtdcr(UIC3VR, 0x00000000);      /* int31 highest, base=0x000 */
+       mtdcr(UIC3SR, 0xffffffff);      /* clear all */
 
 #if !defined(CONFIG_ARCHES)
        /* SDR Setting - enable NDFC */
@@ -175,7 +186,7 @@ int board_early_init_f(void)
        mtdcr(AHB_TOP, 0x8000004B);
        mtdcr(AHB_BOT, 0x8000004B);
 
-       if ((pvr == PVR_460EX_RA) || (pvr == PVR_460EX_SE_RA)) {
+       if (pvr_460ex()) {
                /*
                 * Configure USB-STP pins as alternate and not GPIO
                 * It seems to be neccessary to configure the STP pins as GPIO
@@ -234,17 +245,16 @@ int get_cpu_num(void)
 int checkboard(void)
 {
        char *s = getenv("serial#");
-       u32 pvr = get_pvr();
 
-       if ((pvr == PVR_460GT_RA) || (pvr == PVR_460GT_SE_RA)) {
-               printf("Board: Glacier - AMCC PPC460GT Evaluation Board");
-               gd->board_type = BOARD_GLACIER;
-       } else {
+       if (pvr_460ex()) {
                printf("Board: Canyonlands - AMCC PPC460EX Evaluation Board");
                if (in_8((void *)(CONFIG_SYS_BCSR_BASE + 3)) & CONFIG_SYS_BCSR3_PCIE)
                        gd->board_type = BOARD_CANYONLANDS_PCIE;
                else
                        gd->board_type = BOARD_CANYONLANDS_SATA;
+       } else {
+               printf("Board: Glacier - AMCC PPC460GT Evaluation Board");
+               gd->board_type = BOARD_GLACIER;
        }
 
        switch (gd->board_type) {
@@ -316,139 +326,17 @@ phys_size_t initdram(int board_type)
 }
 #endif
 
-/*
- *  pci_target_init
- *
- *     The bootstrap configuration provides default settings for the pci
- *     inbound map (PIM). But the bootstrap config choices are limited and
- *     may not be sufficient for a given board.
- */
-#if defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT)
-void pci_target_init(struct pci_controller * hose )
-{
-       /*
-        * Disable everything
-        */
-       out_le32((void *)PCIX0_PIM0SA, 0); /* disable */
-       out_le32((void *)PCIX0_PIM1SA, 0); /* disable */
-       out_le32((void *)PCIX0_PIM2SA, 0); /* disable */
-       out_le32((void *)PCIX0_EROMBA, 0); /* disable expansion rom */
-
-       /*
-        * Map all of SDRAM to PCI address 0x0000_0000. Note that the 440
-        * strapping options to not support sizes such as 128/256 MB.
-        */
-       out_le32((void *)PCIX0_PIM0LAL, CONFIG_SYS_SDRAM_BASE);
-       out_le32((void *)PCIX0_PIM0LAH, 0);
-       out_le32((void *)PCIX0_PIM0SA, ~(gd->ram_size - 1) | 1);
-       out_le32((void *)PCIX0_BAR0, 0);
-
-       /*
-        * Program the board's subsystem id/vendor id
-        */
-       out_le16((void *)PCIX0_SBSYSVID, CONFIG_SYS_PCI_SUBSYS_VENDORID);
-       out_le16((void *)PCIX0_SBSYSID, CONFIG_SYS_PCI_SUBSYS_DEVICEID);
-
-       out_le16((void *)PCIX0_CMD, in16r(PCIX0_CMD) | PCI_COMMAND_MEMORY);
-}
-#endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT) */
-
 #if defined(CONFIG_PCI)
-/*
- * is_pci_host
- *
- * This routine is called to determine if a pci scan should be
- * performed. With various hardware environments (especially cPCI and
- * PPMC) it's insufficient to depend on the state of the arbiter enable
- * bit in the strap register, or generic host/adapter assumptions.
- *
- * Rather than hard-code a bad assumption in the general 440 code, the
- * 440 pci code requires the board to decide at runtime.
- *
- * Return 0 for adapter mode, non-zero for host (monarch) mode.
- */
-int is_pci_host(struct pci_controller *hose)
-{
-       /* Board is always configured as host. */
-       return (1);
-}
-
-static struct pci_controller pcie_hose[2] = {{0},{0}};
-
-void pcie_setup_hoses(int busno)
+int board_pcie_first(void)
 {
-       struct pci_controller *hose;
-       int i, bus;
-       int ret = 0;
-       char *env;
-       unsigned int delay;
-       int start;
-
-       /*
-        * assume we're called after the PCIX hose is initialized, which takes
-        * bus ID 0 and therefore start numbering PCIe's from 1.
-        */
-       bus = busno;
-
        /*
         * Canyonlands with SATA enabled has only one PCIe slot
         * (2nd one).
         */
        if (gd->board_type == BOARD_CANYONLANDS_SATA)
-               start = 1;
-       else
-               start = 0;
-
-       for (i = start; i <= 1; i++) {
+               return 1;
 
-               if (is_end_point(i))
-                       ret = ppc4xx_init_pcie_endport(i);
-               else
-                       ret = ppc4xx_init_pcie_rootport(i);
-               if (ret) {
-                       printf("PCIE%d: initialization as %s failed\n", i,
-                              is_end_point(i) ? "endpoint" : "root-complex");
-                       continue;
-               }
-
-               hose = &pcie_hose[i];
-               hose->first_busno = bus;
-               hose->last_busno = bus;
-               hose->current_busno = bus;
-
-               /* setup mem resource */
-               pci_set_region(hose->regions + 0,
-                              CONFIG_SYS_PCIE_MEMBASE + i * CONFIG_SYS_PCIE_MEMSIZE,
-                              CONFIG_SYS_PCIE_MEMBASE + i * CONFIG_SYS_PCIE_MEMSIZE,
-                              CONFIG_SYS_PCIE_MEMSIZE,
-                              PCI_REGION_MEM);
-               hose->region_count = 1;
-               pci_register_hose(hose);
-
-               if (is_end_point(i)) {
-                       ppc4xx_setup_pcie_endpoint(hose, i);
-                       /*
-                        * Reson for no scanning is endpoint can not generate
-                        * upstream configuration accesses.
-                        */
-               } else {
-                       ppc4xx_setup_pcie_rootpoint(hose, i);
-                       env = getenv ("pciscandelay");
-                       if (env != NULL) {
-                               delay = simple_strtoul(env, NULL, 10);
-                               if (delay > 5)
-                                       printf("Warning, expect noticable delay before "
-                                              "PCIe scan due to 'pciscandelay' value!\n");
-                               mdelay(delay * 1000);
-                       }
-
-                       /*
-                        * Config access can only go down stream
-                        */
-                       hose->last_busno = pci_hose_scan(hose);
-                       bus = hose->last_busno + 1;
-               }
-       }
+       return 0;
 }
 #endif /* CONFIG_PCI */
 
@@ -466,9 +354,9 @@ int board_early_init_r (void)
 
        /* Remap the NOR FLASH to 0xcc00.0000 ... 0xcfff.ffff */
 #if defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL)
-       mtebc(pb3cr, CONFIG_SYS_FLASH_BASE_PHYS_L | 0xda000);
+       mtebc(PB3CR, CONFIG_SYS_FLASH_BASE_PHYS_L | 0xda000);
 #else
-       mtebc(pb0cr, CONFIG_SYS_FLASH_BASE_PHYS_L | 0xda000);
+       mtebc(PB0CR, CONFIG_SYS_FLASH_BASE_PHYS_L | 0xda000);
 #endif
 
        /* Remove TLB entry of boot EBC mapping */
@@ -498,7 +386,6 @@ int misc_init_r(void)
 {
        u32 sdr0_srst1 = 0;
        u32 eth_cfg;
-       u32 pvr = get_pvr();
        u8 val;
 
        /*
@@ -513,7 +400,7 @@ int misc_init_r(void)
        /* Set the for 2 RGMII mode */
        /* GMC0 EMAC4_0, GMC0 EMAC4_1, RGMII Bridge 0 */
        eth_cfg &= ~SDR0_ETH_CFG_GMC0_BRIDGE_SEL;
-       if ((pvr == PVR_460EX_RA) || (pvr == PVR_460EX_SE_RA))
+       if (pvr_460ex())
                eth_cfg |= SDR0_ETH_CFG_GMC1_BRIDGE_SEL;
        else
                eth_cfg &= ~SDR0_ETH_CFG_GMC1_BRIDGE_SEL;