ppc4xx: Add fdt support to Prodrive alpr
authorStefan Roese <sr@denx.de>
Wed, 19 Mar 2008 09:23:43 +0000 (10:23 +0100)
committerStefan Roese <sr@denx.de>
Thu, 27 Mar 2008 09:20:02 +0000 (10:20 +0100)
Since this board will probably be ported to arch/powerpc in the
near future, we add device tree support now. This way we are
"ready" for arch/powerpc from now on.

Signed-off-by: Stefan Roese <sr@denx.de>
board/prodrive/alpr/alpr.c
include/configs/alpr.h

index b76449989bc58238786b2c04bdbe1c859c19547d..287f32e587a0ec398d3280fbfdbf04e0d3f97a23 100644 (file)
 
 
 #include <common.h>
-#include <asm/processor.h>
+#include <libfdt.h>
+#include <fdt_support.h>
 #include <spd_sdram.h>
 #include <ppc4xx_enet.h>
 #include <miiphy.h>
+#include <asm/processor.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -315,3 +317,24 @@ int post_hotkeys_pressed(void)
        return (ctrlc());
 }
 #endif
+
+#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) */
index 2d04f698f1f37423da599cf9bd1646871316f36b..3e906c4251570833c7528db4de4356ded6a2193d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2006-2007
+ * (C) Copyright 2006-2008
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
  * See file CREDITS for list of people who contributed to this
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
        "netdev=eth3\0"                                                 \
        "hostname=alpr\0"                                               \
+       "fdt_file=alpr/alpr.dtb\0"                                      \
+       "fdt_addr=400000\0"                                             \
        "nfsargs=setenv bootargs root=/dev/nfs rw "                     \
                "nfsroot=${serverip}:${rootpath} ${init}\0"             \
        "ramargs=setenv bootargs root=/dev/ram rw\0"                    \
                "bootm ${kernel_addr} ${ramdisk_addr}\0"                \
        "net_nfs=tftp 200000 ${bootfile};run nfsargs addip addtty;"     \
                "bootm\0"                                               \
+       "net_nfs_fdt=tftp 200000 ${bootfile};"                          \
+               "tftp ${fdt_addr} ${fdt_file};"                         \
+               "run nfsargs addip addtty;"                             \
+               "bootm 200000 - ${fdt_addr}\0"                          \
        "rootpath=/opt/projects/alpr/nfs_root\0"                        \
        "bootfile=/alpr/uImage\0"                                       \
        "kernel_addr=fff00000\0"                                        \
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
 #define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
+
+/* pass open firmware flat tree */
+#define CONFIG_OF_LIBFDT       1
+#define CONFIG_OF_BOARD_SETUP  1
+
 #endif /* __CONFIG_H */