ppc4xx: Bring 4xx fdt support up-to-date
[platform/kernel/u-boot.git] / board / amcc / sequoia / sequoia.c
index 930fa71..f81f071 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2006
+ * (C) Copyright 2006-2007
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
  * (C) Copyright 2006
  */
 
 #include <common.h>
-#include <asm/processor.h>
+#include <libfdt.h>
+#include <fdt_support.h>
 #include <ppc440.h>
-#include "sequoia.h"
+#include <asm/processor.h>
+#include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -226,7 +228,7 @@ int misc_init_r(void)
        if (act == NULL || strcmp(act, "hostdev") == 0) {
                /* SDR Setting */
                mfsdr(SDR0_PFC1, sdr0_pfc1);
-               mfsdr(SDR0_USB0, usb2d0cr);
+               mfsdr(SDR0_USB2D0CR, usb2d0cr);
                mfsdr(SDR0_USB2PHY0CR, usb2phy0cr);
                mfsdr(SDR0_USB2H0CR, usb2h0cr);
 
@@ -254,7 +256,7 @@ int misc_init_r(void)
                sdr0_pfc1 = sdr0_pfc1 | SDR0_PFC1_UES_USB2D_SEL;                /*0*/
 
                mtsdr(SDR0_PFC1, sdr0_pfc1);
-               mtsdr(SDR0_USB0, usb2d0cr);
+               mtsdr(SDR0_USB2D0CR, usb2d0cr);
                mtsdr(SDR0_USB2PHY0CR, usb2phy0cr);
                mtsdr(SDR0_USB2H0CR, usb2h0cr);
 
@@ -298,7 +300,7 @@ int misc_init_r(void)
                /* SDR Setting */
                mfsdr(SDR0_USB2PHY0CR, usb2phy0cr);
                mfsdr(SDR0_USB2H0CR, usb2h0cr);
-               mfsdr(SDR0_USB0, usb2d0cr);
+               mfsdr(SDR0_USB2D0CR, usb2d0cr);
                mfsdr(SDR0_PFC1, sdr0_pfc1);
 
                usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_XOCLK_MASK;
@@ -323,7 +325,7 @@ int misc_init_r(void)
 
                mtsdr(SDR0_USB2H0CR, usb2h0cr);
                mtsdr(SDR0_USB2PHY0CR, usb2phy0cr);
-               mtsdr(SDR0_USB0, usb2d0cr);
+               mtsdr(SDR0_USB2D0CR, usb2d0cr);
                mtsdr(SDR0_PFC1, sdr0_pfc1);
 
                /*clear resets*/
@@ -363,8 +365,8 @@ int checkboard(void)
        printf("Board: Rainier - AMCC PPC440GRx Evaluation Board");
 #endif
 
-       rev = *(u8 *)(CFG_BCSR_BASE + 0);
-       val = *(u8 *)(CFG_BCSR_BASE + 5) & 0x01;
+       rev = in_8((void *)(CFG_BCSR_BASE + 0));
+       val = in_8((void *)(CFG_BCSR_BASE + 5)) & CFG_BCSR5_PCI66EN;
        printf(", Rev. %X, PCI=%d MHz", rev, val ? 66 : 33);
 
        if (s != NULL) {
@@ -426,23 +428,10 @@ int testdram(void)
  *     certain pre-initialization actions.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI)
 int pci_pre_init(struct pci_controller *hose)
 {
        unsigned long addr;
-#if 0
-       /*--------------------------------------------------------------------------+
-        *      Cactus is always configured as the host & requires the
-        *      PCI arbiter to be enabled ???
-        *--------------------------------------------------------------------------*/
-       unsigned long strap;
-       mfsdr(sdr_sdstp1, strap);
-       if ((strap & SDR0_SDSTP1_PAE_MASK) == 0) {
-               printf("PCI: SDR0_STRP1[PAE] not set.\n");
-               printf("PCI: Configuration aborted.\n");
-               return 0;
-       }
-#endif
 
        /*-------------------------------------------------------------------------+
          | Set priority for all PLB3 devices to 0.
@@ -480,7 +469,7 @@ int pci_pre_init(struct pci_controller *hose)
 
        return 1;
 }
-#endif                         /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
+#endif /* defined(CONFIG_PCI) */
 
 /*************************************************************************
  *  pci_target_init
@@ -586,3 +575,34 @@ int is_pci_host(struct pci_controller *hose)
        return (1);
 }
 #endif                         /* defined(CONFIG_PCI) */
+#if defined(CONFIG_POST)
+/*
+ * Returns 1 if keys pressed to start the power-on long-running tests
+ * Called from board_init_f().
+ */
+int post_hotkeys_pressed(void)
+{
+       return 0;       /* No hotkeys supported */
+}
+#endif /* CONFIG_POST */
+
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+void ft_board_setup(void *blob, bd_t *bd)
+{
+       u32 val[4];
+       int rc;
+
+       ft_cpu_setup(blob, bd);
+
+       /* Fixup NOR mapping */
+       val[0] = 0;                             /* chip select number */
+       val[1] = 0;                             /* always 0 */
+       val[2] = gd->bd->bi_flashstart;
+       val[3] = gd->bd->bi_flashsize;
+       rc = fdt_find_and_setprop(blob, "/plb/opb/ebc", "ranges",
+                                 val, sizeof(val), 1);
+       if (rc)
+               printf("Unable to update property NOR mapping, err=%s\n",
+                      fdt_strerror(rc));
+}
+#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */