mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-10 04:26:19 -04:00
mpc83xx: move common /memory node update mechanism to cpu.c
also adds common prototypes to include/common.h. Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
This commit is contained in:
parent
8f9e0e9f33
commit
6a16e0dfcc
@ -17,7 +17,6 @@
|
|||||||
#include <miiphy.h>
|
#include <miiphy.h>
|
||||||
#include <command.h>
|
#include <command.h>
|
||||||
#include <libfdt.h>
|
#include <libfdt.h>
|
||||||
#include <libfdt_env.h>
|
|
||||||
#if defined(CONFIG_PCI)
|
#if defined(CONFIG_PCI)
|
||||||
#include <pci.h>
|
#include <pci.h>
|
||||||
#endif
|
#endif
|
||||||
@ -185,31 +184,10 @@ void pci_init_board(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_OF_BOARD_SETUP)
|
#if defined(CONFIG_OF_BOARD_SETUP)
|
||||||
|
|
||||||
/*
|
|
||||||
* Prototypes of functions that we use.
|
|
||||||
*/
|
|
||||||
void ft_cpu_setup(void *blob, bd_t *bd);
|
|
||||||
|
|
||||||
#ifdef CONFIG_PCI
|
|
||||||
void ft_pci_setup(void *blob, bd_t *bd);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ft_board_setup(void *blob, bd_t *bd)
|
ft_board_setup(void *blob, bd_t *bd)
|
||||||
{
|
{
|
||||||
int nodeoffset;
|
|
||||||
int tmp[2];
|
|
||||||
|
|
||||||
nodeoffset = fdt_find_node_by_path(blob, "/memory");
|
|
||||||
if (nodeoffset >= 0) {
|
|
||||||
tmp[0] = cpu_to_be32(bd->bi_memstart);
|
|
||||||
tmp[1] = cpu_to_be32(bd->bi_memsize);
|
|
||||||
fdt_setprop(blob, nodeoffset, "reg", tmp, sizeof(tmp));
|
|
||||||
}
|
|
||||||
|
|
||||||
ft_cpu_setup(blob, bd);
|
ft_cpu_setup(blob, bd);
|
||||||
|
|
||||||
#ifdef CONFIG_PCI
|
#ifdef CONFIG_PCI
|
||||||
ft_pci_setup(blob, bd);
|
ft_pci_setup(blob, bd);
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#include <ft_build.h>
|
#include <ft_build.h>
|
||||||
#elif defined(CONFIG_OF_LIBFDT)
|
#elif defined(CONFIG_OF_LIBFDT)
|
||||||
#include <libfdt.h>
|
#include <libfdt.h>
|
||||||
#include <libfdt_env.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const qe_iop_conf_t qe_iop_conf_tab[] = {
|
const qe_iop_conf_t qe_iop_conf_tab[] = {
|
||||||
@ -287,38 +286,10 @@ void sdram_init(void)
|
|||||||
|
|
||||||
#if (defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)) \
|
#if (defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)) \
|
||||||
&& defined(CONFIG_OF_BOARD_SETUP)
|
&& defined(CONFIG_OF_BOARD_SETUP)
|
||||||
|
|
||||||
/*
|
|
||||||
* Prototypes of functions that we use.
|
|
||||||
*/
|
|
||||||
void ft_cpu_setup(void *blob, bd_t *bd);
|
|
||||||
|
|
||||||
#ifdef CONFIG_PCI
|
|
||||||
void ft_pci_setup(void *blob, bd_t *bd);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ft_board_setup(void *blob, bd_t *bd)
|
ft_board_setup(void *blob, bd_t *bd)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_OF_LIBFDT)
|
#if defined(CONFIG_OF_FLAT_TREE)
|
||||||
int nodeoffset;
|
|
||||||
int tmp[2];
|
|
||||||
|
|
||||||
nodeoffset = fdt_find_node_by_path(blob, "/memory");
|
|
||||||
if (nodeoffset < 0) {
|
|
||||||
nodeoffset = fdt_add_subnode(blob, 0, "memory");
|
|
||||||
if (nodeoffset < 0)
|
|
||||||
printf("WARNING: failed to add /memory node: %s\n",
|
|
||||||
fdt_strerror(nodeoffset));
|
|
||||||
}
|
|
||||||
if (nodeoffset >= 0) {
|
|
||||||
fdt_setprop(blob, nodeoffset, "device_type",
|
|
||||||
"memory", sizeof("memory"));
|
|
||||||
tmp[0] = cpu_to_be32(bd->bi_memstart);
|
|
||||||
tmp[1] = cpu_to_be32(bd->bi_memsize);
|
|
||||||
fdt_setprop(blob, nodeoffset, "reg", tmp, sizeof(tmp));
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
u32 *p;
|
u32 *p;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
@ -526,6 +526,7 @@ ft_cpu_setup(void *blob, bd_t *bd)
|
|||||||
int nodeoffset;
|
int nodeoffset;
|
||||||
int err;
|
int err;
|
||||||
int j;
|
int j;
|
||||||
|
int tmp[2];
|
||||||
|
|
||||||
for (j = 0; j < (sizeof(fixup_props) / sizeof(fixup_props[0])); j++) {
|
for (j = 0; j < (sizeof(fixup_props) / sizeof(fixup_props[0])); j++) {
|
||||||
nodeoffset = fdt_find_node_by_path(blob, fixup_props[j].node);
|
nodeoffset = fdt_find_node_by_path(blob, fixup_props[j].node);
|
||||||
@ -534,14 +535,28 @@ ft_cpu_setup(void *blob, bd_t *bd)
|
|||||||
fixup_props[j].prop, bd);
|
fixup_props[j].prop, bd);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
debug("Problem setting %s = %s: %s\n",
|
debug("Problem setting %s = %s: %s\n",
|
||||||
fixup_props[j].node,
|
fixup_props[j].node, fixup_props[j].prop,
|
||||||
fixup_props[j].prop,
|
|
||||||
fdt_strerror(err));
|
fdt_strerror(err));
|
||||||
} else {
|
} else {
|
||||||
debug("Couldn't find %s: %s\n",
|
debug("Couldn't find %s: %s\n",
|
||||||
fixup_props[j].node,
|
fixup_props[j].node, fdt_strerror(nodeoffset));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* update, or add and update /memory node */
|
||||||
|
nodeoffset = fdt_find_node_by_path(blob, "/memory");
|
||||||
|
if (nodeoffset < 0) {
|
||||||
|
nodeoffset = fdt_add_subnode(blob, 0, "memory");
|
||||||
|
if (nodeoffset < 0)
|
||||||
|
debug("failed to add /memory node: %s\n",
|
||||||
fdt_strerror(nodeoffset));
|
fdt_strerror(nodeoffset));
|
||||||
}
|
}
|
||||||
|
if (nodeoffset >= 0) {
|
||||||
|
fdt_setprop(blob, nodeoffset, "device_type",
|
||||||
|
"memory", sizeof("memory"));
|
||||||
|
tmp[0] = cpu_to_be32(bd->bi_memstart);
|
||||||
|
tmp[1] = cpu_to_be32(bd->bi_memsize);
|
||||||
|
fdt_setprop(blob, nodeoffset, "reg", tmp, sizeof(tmp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(CONFIG_OF_FLAT_TREE)
|
#elif defined(CONFIG_OF_FLAT_TREE)
|
||||||
|
@ -434,6 +434,13 @@ int checkdcache (void);
|
|||||||
void upmconfig (unsigned int, unsigned int *, unsigned int);
|
void upmconfig (unsigned int, unsigned int *, unsigned int);
|
||||||
ulong get_tbclk (void);
|
ulong get_tbclk (void);
|
||||||
void reset_cpu (ulong addr);
|
void reset_cpu (ulong addr);
|
||||||
|
#if defined (CONFIG_OF_LIBFDT) && defined (CONFIG_OF_BOARD_SETUP)
|
||||||
|
void ft_cpu_setup(void *blob, bd_t *bd);
|
||||||
|
#ifdef CONFIG_PCI
|
||||||
|
void ft_pci_setup(void *blob, bd_t *bd);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $(CPU)/serial.c */
|
/* $(CPU)/serial.c */
|
||||||
int serial_init (void);
|
int serial_init (void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user