mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-13 05:55:02 -04:00
Merge with /home/wd/git/u-boot/custodian/u-boot-mpc5xxx
This commit is contained in:
commit
bf72a4ca9e
@ -28,10 +28,7 @@
|
|||||||
#include <mpc5xxx.h>
|
#include <mpc5xxx.h>
|
||||||
#include <pci.h>
|
#include <pci.h>
|
||||||
#include <asm/processor.h>
|
#include <asm/processor.h>
|
||||||
|
#include <libfdt.h>
|
||||||
#if defined(CONFIG_OF_FLAT_TREE)
|
|
||||||
#include <ft_build.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(CONFIG_LITE5200B)
|
#if defined(CONFIG_LITE5200B)
|
||||||
#include "mt46v32m16.h"
|
#include "mt46v32m16.h"
|
||||||
@ -386,7 +383,7 @@ void ide_set_reset (int idereset)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP)
|
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
|
||||||
void
|
void
|
||||||
ft_board_setup(void *blob, bd_t *bd)
|
ft_board_setup(void *blob, bd_t *bd)
|
||||||
{
|
{
|
||||||
|
@ -28,11 +28,7 @@
|
|||||||
#include <mpc5xxx.h>
|
#include <mpc5xxx.h>
|
||||||
#include <pci.h>
|
#include <pci.h>
|
||||||
#include <asm/processor.h>
|
#include <asm/processor.h>
|
||||||
|
#include <libfdt.h>
|
||||||
#if defined(CONFIG_OF_FLAT_TREE)
|
|
||||||
#include <ft_build.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define SDRAM_DDR 0
|
#define SDRAM_DDR 0
|
||||||
#if 1
|
#if 1
|
||||||
@ -308,7 +304,7 @@ void ide_set_reset (int idereset)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP)
|
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
|
||||||
void
|
void
|
||||||
ft_board_setup(void *blob, bd_t *bd)
|
ft_board_setup(void *blob, bd_t *bd)
|
||||||
{
|
{
|
||||||
|
@ -29,9 +29,7 @@
|
|||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <mpc5xxx.h>
|
#include <mpc5xxx.h>
|
||||||
#include <miiphy.h>
|
#include <miiphy.h>
|
||||||
#if defined(CONFIG_OF_FLAT_TREE)
|
#include <libfdt.h>
|
||||||
#include <ft_build.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(CONFIG_STATUS_LED)
|
#if defined(CONFIG_STATUS_LED)
|
||||||
#include <status_led.h>
|
#include <status_led.h>
|
||||||
@ -196,12 +194,12 @@ int checkboard(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP)
|
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
|
||||||
void ft_board_setup(void *blob, bd_t *bd)
|
void ft_board_setup(void *blob, bd_t *bd)
|
||||||
{
|
{
|
||||||
ft_cpu_setup(blob, bd);
|
ft_cpu_setup(blob, bd);
|
||||||
}
|
}
|
||||||
#endif /* defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP) */
|
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
|
||||||
|
|
||||||
|
|
||||||
#if defined(CONFIG_STATUS_LED)
|
#if defined(CONFIG_STATUS_LED)
|
||||||
|
@ -31,10 +31,7 @@
|
|||||||
#include <mpc5xxx.h>
|
#include <mpc5xxx.h>
|
||||||
#include <pci.h>
|
#include <pci.h>
|
||||||
#include <asm/processor.h>
|
#include <asm/processor.h>
|
||||||
|
#include <libfdt.h>
|
||||||
#if defined(CONFIG_OF_FLAT_TREE)
|
|
||||||
#include <ft_build.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_VIDEO_SM501
|
#ifdef CONFIG_VIDEO_SM501
|
||||||
#include <sm501.h>
|
#include <sm501.h>
|
||||||
@ -780,9 +777,9 @@ int board_get_height (void)
|
|||||||
|
|
||||||
#endif /* CONFIG_VIDEO_SM501 */
|
#endif /* CONFIG_VIDEO_SM501 */
|
||||||
|
|
||||||
#if defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP)
|
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
|
||||||
void ft_board_setup(void *blob, bd_t *bd)
|
void ft_board_setup(void *blob, bd_t *bd)
|
||||||
{
|
{
|
||||||
ft_cpu_setup(blob, bd);
|
ft_cpu_setup(blob, bd);
|
||||||
}
|
}
|
||||||
#endif /* defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP) */
|
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
|
||||||
|
@ -962,29 +962,31 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
|
|||||||
* Add the chosen node if it doesn't exist, add the env and bd_t
|
* Add the chosen node if it doesn't exist, add the env and bd_t
|
||||||
* if the user wants it (the logic is in the subroutines).
|
* if the user wants it (the logic is in the subroutines).
|
||||||
*/
|
*/
|
||||||
if (fdt_chosen(of_flat_tree, initrd_start, initrd_end, 0) < 0) {
|
if (of_flat_tree) {
|
||||||
puts ("ERROR: /chosen node create failed - "
|
if (fdt_chosen(of_flat_tree, initrd_start, initrd_end, 0) < 0) {
|
||||||
"must RESET the board to recover.\n");
|
puts ("ERROR: /chosen node create failed - "
|
||||||
do_reset (cmdtp, flag, argc, argv);
|
"must RESET the board to recover.\n");
|
||||||
}
|
do_reset (cmdtp, flag, argc, argv);
|
||||||
|
}
|
||||||
#ifdef CONFIG_OF_HAS_UBOOT_ENV
|
#ifdef CONFIG_OF_HAS_UBOOT_ENV
|
||||||
if (fdt_env(of_flat_tree) < 0) {
|
if (fdt_env(of_flat_tree) < 0) {
|
||||||
puts ("ERROR: /u-boot-env node create failed - "
|
puts ("ERROR: /u-boot-env node create failed - "
|
||||||
"must RESET the board to recover.\n");
|
"must RESET the board to recover.\n");
|
||||||
do_reset (cmdtp, flag, argc, argv);
|
do_reset (cmdtp, flag, argc, argv);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_OF_HAS_BD_T
|
#ifdef CONFIG_OF_HAS_BD_T
|
||||||
if (fdt_bd_t(of_flat_tree) < 0) {
|
if (fdt_bd_t(of_flat_tree) < 0) {
|
||||||
puts ("ERROR: /bd_t node create failed - "
|
puts ("ERROR: /bd_t node create failed - "
|
||||||
"must RESET the board to recover.\n");
|
"must RESET the board to recover.\n");
|
||||||
do_reset (cmdtp, flag, argc, argv);
|
do_reset (cmdtp, flag, argc, argv);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_OF_BOARD_SETUP
|
#ifdef CONFIG_OF_BOARD_SETUP
|
||||||
/* Call the board-specific fixup routine */
|
/* Call the board-specific fixup routine */
|
||||||
ft_board_setup(of_flat_tree, gd->bd);
|
ft_board_setup(of_flat_tree, gd->bd);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
#endif /* CONFIG_OF_LIBFDT */
|
#endif /* CONFIG_OF_LIBFDT */
|
||||||
#if defined(CONFIG_OF_FLAT_TREE)
|
#if defined(CONFIG_OF_FLAT_TREE)
|
||||||
#ifdef CFG_BOOTMAPSZ
|
#ifdef CFG_BOOTMAPSZ
|
||||||
|
@ -29,10 +29,12 @@
|
|||||||
#include <watchdog.h>
|
#include <watchdog.h>
|
||||||
#include <command.h>
|
#include <command.h>
|
||||||
#include <mpc5xxx.h>
|
#include <mpc5xxx.h>
|
||||||
|
#include <asm/io.h>
|
||||||
#include <asm/processor.h>
|
#include <asm/processor.h>
|
||||||
|
|
||||||
#if defined(CONFIG_OF_FLAT_TREE)
|
#if defined(CONFIG_OF_LIBFDT)
|
||||||
#include <ft_build.h>
|
#include <libfdt.h>
|
||||||
|
#include <libfdt_env.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
@ -111,29 +113,43 @@ unsigned long get_tbclk (void)
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifdef CONFIG_OF_FLAT_TREE
|
#ifdef CONFIG_OF_LIBFDT
|
||||||
void
|
static void do_fixup(void *fdt, const char *node, const char *prop,
|
||||||
ft_cpu_setup(void *blob, bd_t *bd)
|
const void *val, int len, int create)
|
||||||
{
|
{
|
||||||
u32 *p;
|
#if defined(DEBUG)
|
||||||
int len;
|
int i;
|
||||||
|
debug("Updating property '%s/%s' = ", node, prop);
|
||||||
|
for (i = 0; i < len; i++)
|
||||||
|
debug(" %.2x", *(u8*)(val+i));
|
||||||
|
debug("\n");
|
||||||
|
#endif
|
||||||
|
int rc = fdt_find_and_setprop(fdt, node, prop, val, len, create);
|
||||||
|
if (rc)
|
||||||
|
printf("Unable to update property %s:%s, err=%s\n",
|
||||||
|
node, prop, fdt_strerror(rc));
|
||||||
|
}
|
||||||
|
|
||||||
/* Core XLB bus frequency */
|
static void do_fixup_u32(void *fdt, const char *node, const char *prop,
|
||||||
p = ft_get_prop(blob, "/cpus/" OF_CPU "/bus-frequency", &len);
|
u32 val, int create)
|
||||||
if (p != NULL)
|
{
|
||||||
*p = cpu_to_be32(bd->bi_busfreq);
|
val = cpu_to_fdt32(val);
|
||||||
|
do_fixup(fdt, node, prop, &val, sizeof(val), create);
|
||||||
|
}
|
||||||
|
|
||||||
/* SOC peripherals use the IPB bus frequency */
|
void ft_cpu_setup(void *blob, bd_t *bd)
|
||||||
p = ft_get_prop(blob, "/" OF_SOC "/bus-frequency", &len);
|
{
|
||||||
if (p != NULL)
|
int div = in_8((void*)CFG_MBAR + 0x204) & 0x0020 ? 8 : 4;
|
||||||
*p = cpu_to_be32(bd->bi_ipbfreq);
|
char * cpu_path = "/cpus/" OF_CPU;
|
||||||
|
char * eth_path = "/" OF_SOC "/ethernet@3000";
|
||||||
|
|
||||||
p = ft_get_prop(blob, "/" OF_SOC "/ethernet@3000/mac-address", &len);
|
do_fixup_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK, 1);
|
||||||
if (p != NULL)
|
do_fixup_u32(blob, cpu_path, "bus-frequency", bd->bi_busfreq, 1);
|
||||||
memcpy(p, bd->bi_enetaddr, 6);
|
do_fixup_u32(blob, cpu_path, "clock-frequency", bd->bi_intfreq, 1);
|
||||||
|
do_fixup_u32(blob, "/" OF_SOC, "bus-frequency", bd->bi_ipbfreq, 1);
|
||||||
p = ft_get_prop(blob, "/" OF_SOC "/ethernet@3000/local-mac-address", &len);
|
do_fixup_u32(blob, "/" OF_SOC, "system-frequency",
|
||||||
if (p != NULL)
|
bd->bi_busfreq*div, 1);
|
||||||
memcpy(p, bd->bi_enetaddr, 6);
|
do_fixup(blob, eth_path, "mac-address", bd->bi_enetaddr, 6, 0);
|
||||||
|
do_fixup(blob, eth_path, "local-mac-address", bd->bi_enetaddr, 6, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -178,7 +178,7 @@
|
|||||||
#endif /* CONFIG_MPC5200 */
|
#endif /* CONFIG_MPC5200 */
|
||||||
|
|
||||||
/* pass open firmware flat tree */
|
/* pass open firmware flat tree */
|
||||||
#define CONFIG_OF_FLAT_TREE 1
|
#define CONFIG_OF_LIBFDT 1
|
||||||
#define CONFIG_OF_BOARD_SETUP 1
|
#define CONFIG_OF_BOARD_SETUP 1
|
||||||
|
|
||||||
#define OF_CPU "PowerPC,5200@0"
|
#define OF_CPU "PowerPC,5200@0"
|
||||||
|
@ -701,7 +701,7 @@
|
|||||||
* Open firmware flat tree support
|
* Open firmware flat tree support
|
||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#define CONFIG_OF_FLAT_TREE 1
|
#define CONFIG_OF_LIBFDT 1
|
||||||
#define CONFIG_OF_BOARD_SETUP 1
|
#define CONFIG_OF_BOARD_SETUP 1
|
||||||
|
|
||||||
#define OF_CPU "PowerPC,5200@0"
|
#define OF_CPU "PowerPC,5200@0"
|
||||||
|
@ -145,7 +145,7 @@
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* pass open firmware flat tree */
|
/* pass open firmware flat tree */
|
||||||
#define CONFIG_OF_FLAT_TREE 1
|
#define CONFIG_OF_LIBFDT 1
|
||||||
#define CONFIG_OF_BOARD_SETUP 1
|
#define CONFIG_OF_BOARD_SETUP 1
|
||||||
|
|
||||||
#define OF_CPU "PowerPC,5200@0"
|
#define OF_CPU "PowerPC,5200@0"
|
||||||
|
@ -417,7 +417,7 @@ extern void __led_set(led_id_t id, int state);
|
|||||||
#define CFG_RESET_ADDRESS 0xfff00100
|
#define CFG_RESET_ADDRESS 0xfff00100
|
||||||
|
|
||||||
/* pass open firmware flat tree */
|
/* pass open firmware flat tree */
|
||||||
#define CONFIG_OF_FLAT_TREE 1
|
#define CONFIG_OF_LIBFDT 1
|
||||||
#define CONFIG_OF_BOARD_SETUP 1
|
#define CONFIG_OF_BOARD_SETUP 1
|
||||||
|
|
||||||
#define OF_CPU "PowerPC,5200@0"
|
#define OF_CPU "PowerPC,5200@0"
|
||||||
|
@ -140,6 +140,8 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name,
|
|||||||
})
|
})
|
||||||
#define fdt_setprop_string(fdt, nodeoffset, name, str) \
|
#define fdt_setprop_string(fdt, nodeoffset, name, str) \
|
||||||
fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
|
fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
|
||||||
|
int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
|
||||||
|
const void *val, int len, int create);
|
||||||
int fdt_delprop(void *fdt, int nodeoffset, const char *name);
|
int fdt_delprop(void *fdt, int nodeoffset, const char *name);
|
||||||
int fdt_add_subnode_namelen(void *fdt, int parentoffset,
|
int fdt_add_subnode_namelen(void *fdt, int parentoffset,
|
||||||
const char *name, int namelen);
|
const char *name, int namelen);
|
||||||
|
@ -188,6 +188,32 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fdt_find_and_setprop: Find a node and set it's property
|
||||||
|
*
|
||||||
|
* @fdt: ptr to device tree
|
||||||
|
* @node: path of node
|
||||||
|
* @prop: property name
|
||||||
|
* @val: ptr to new value
|
||||||
|
* @len: length of new property value
|
||||||
|
* @create: flag to create the property if it doesn't exist
|
||||||
|
*
|
||||||
|
* Convenience function to directly set a property given the path to the node.
|
||||||
|
*/
|
||||||
|
int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
|
||||||
|
const void *val, int len, int create)
|
||||||
|
{
|
||||||
|
int nodeoff = fdt_find_node_by_path(fdt, node);
|
||||||
|
|
||||||
|
if (nodeoff < 0)
|
||||||
|
return nodeoff;
|
||||||
|
|
||||||
|
if ((!create) && (fdt_get_property(fdt, nodeoff, prop, 0) == NULL))
|
||||||
|
return 0; /* create flag not set; so exit quietly */
|
||||||
|
|
||||||
|
return fdt_setprop(fdt, nodeoff, prop, val, len);
|
||||||
|
}
|
||||||
|
|
||||||
int fdt_delprop(void *fdt, int nodeoffset, const char *name)
|
int fdt_delprop(void *fdt, int nodeoffset, const char *name)
|
||||||
{
|
{
|
||||||
struct fdt_property *prop;
|
struct fdt_property *prop;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user