mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-09-21 07:01:57 +00:00
mpc83xx: convert to using do_fixup_*()
convert to using simpler mpc85xx style fdt update code; streamline by eliminating macros OF_SOC, OF_CPU, etc. which allows us to rm the old school FLAT_TREE code from 83xx (since the sbc8349 was just converted over to using libfdt). Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
This commit is contained in:
parent
e496865ecc
commit
5b8bc606c6
18 changed files with 255 additions and 605 deletions
|
@ -22,6 +22,7 @@
|
||||||
#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 <fdt_support.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <asm/fsl_i2c.h>
|
#include <asm/fsl_i2c.h>
|
||||||
|
@ -262,23 +263,28 @@ void pci_init_board(void)
|
||||||
#endif /* CONFIG_PCISLAVE */
|
#endif /* CONFIG_PCISLAVE */
|
||||||
|
|
||||||
#if defined(CONFIG_OF_LIBFDT)
|
#if defined(CONFIG_OF_LIBFDT)
|
||||||
void
|
void ft_pci_setup(void *blob, bd_t *bd)
|
||||||
ft_pci_setup(void *blob, bd_t *bd)
|
|
||||||
{
|
{
|
||||||
int nodeoffset;
|
int nodeoffset;
|
||||||
int err;
|
|
||||||
int tmp[2];
|
int tmp[2];
|
||||||
|
const char *path;
|
||||||
|
|
||||||
nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8500");
|
if (pci_num_buses < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
nodeoffset = fdt_path_offset(blob, "/aliases");
|
||||||
if (nodeoffset >= 0) {
|
if (nodeoffset >= 0) {
|
||||||
tmp[0] = cpu_to_be32(hose[0].first_busno);
|
path = fdt_getprop(blob, nodeoffset, "pci0", NULL);
|
||||||
tmp[1] = cpu_to_be32(hose[0].last_busno);
|
if (path) {
|
||||||
err = fdt_setprop(blob, nodeoffset, "bus-range",
|
tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
|
||||||
tmp, sizeof(tmp));
|
tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
|
||||||
|
do_fixup_by_path(blob, path, "bus-range",
|
||||||
|
&tmp, sizeof(tmp), 1);
|
||||||
|
|
||||||
tmp[0] = cpu_to_be32(gd->pci_clk);
|
tmp[0] = cpu_to_be32(gd->pci_clk);
|
||||||
err = fdt_setprop(blob, nodeoffset, "clock-frequency",
|
do_fixup_by_path(blob, path, "clock-frequency",
|
||||||
tmp, sizeof(tmp[0]));
|
&tmp, sizeof(tmp[0]), 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(CONFIG_OF_FLAT_TREE)
|
#elif defined(CONFIG_OF_FLAT_TREE)
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#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 <fdt_support.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -389,37 +390,39 @@ pci_init_board(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_OF_LIBFDT)
|
#if defined(CONFIG_OF_LIBFDT)
|
||||||
void
|
void ft_pci_setup(void *blob, bd_t *bd)
|
||||||
ft_pci_setup(void *blob, bd_t *bd)
|
|
||||||
{
|
{
|
||||||
int nodeoffset;
|
int nodeoffset;
|
||||||
int err;
|
|
||||||
int tmp[2];
|
int tmp[2];
|
||||||
|
const char *path;
|
||||||
|
|
||||||
nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8500");
|
nodeoffset = fdt_path_offset(blob, "/aliases");
|
||||||
if (nodeoffset >= 0) {
|
if (nodeoffset >= 0) {
|
||||||
tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
|
path = fdt_getprop(blob, nodeoffset, "pci0", NULL);
|
||||||
tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
|
if (path) {
|
||||||
err = fdt_setprop(blob, nodeoffset, "bus-range",
|
tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
|
||||||
tmp, sizeof(tmp));
|
tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
|
||||||
|
do_fixup_by_path(blob, path, "bus-range",
|
||||||
|
&tmp, sizeof(tmp), 1);
|
||||||
|
|
||||||
tmp[0] = cpu_to_be32(gd->pci_clk);
|
tmp[0] = cpu_to_be32(gd->pci_clk);
|
||||||
err = fdt_setprop(blob, nodeoffset, "clock-frequency",
|
do_fixup_by_path(blob, path, "clock-frequency",
|
||||||
tmp, sizeof(tmp[0]));
|
&tmp, sizeof(tmp[0]), 1);
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_MPC83XX_PCI2
|
#ifdef CONFIG_MPC83XX_PCI2
|
||||||
nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8600");
|
path = fdt_getprop(blob, nodeoffset, "pci1", NULL);
|
||||||
if (nodeoffset >= 0) {
|
if (path) {
|
||||||
tmp[0] = cpu_to_be32(pci_hose[1].first_busno);
|
tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
|
||||||
tmp[1] = cpu_to_be32(pci_hose[1].last_busno);
|
tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
|
||||||
err = fdt_setprop(blob, nodeoffset, "bus-range",
|
do_fixup_by_path(blob, path, "bus-range",
|
||||||
tmp, sizeof(tmp));
|
&tmp, sizeof(tmp), 1);
|
||||||
|
|
||||||
tmp[0] = cpu_to_be32(gd->pci_clk);
|
tmp[0] = cpu_to_be32(gd->pci_clk);
|
||||||
err = fdt_setprop(blob, nodeoffset, "clock-frequency",
|
do_fixup_by_path(blob, path, "clock-frequency",
|
||||||
tmp, sizeof(tmp[0]));
|
&tmp, sizeof(tmp[0]), 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#elif defined(CONFIG_OF_FLAT_TREE)
|
#elif defined(CONFIG_OF_FLAT_TREE)
|
||||||
void
|
void
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#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 <fdt_support.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
@ -335,37 +336,39 @@ void pci_init_board(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_OF_LIBFDT)
|
#if defined(CONFIG_OF_LIBFDT)
|
||||||
void
|
void ft_pci_setup(void *blob, bd_t *bd)
|
||||||
ft_pci_setup(void *blob, bd_t *bd)
|
|
||||||
{
|
{
|
||||||
int nodeoffset;
|
int nodeoffset;
|
||||||
int err;
|
|
||||||
int tmp[2];
|
int tmp[2];
|
||||||
|
const char *path;
|
||||||
|
|
||||||
nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8500");
|
nodeoffset = fdt_path_offset(blob, "/aliases");
|
||||||
if (nodeoffset >= 0) {
|
if (nodeoffset >= 0) {
|
||||||
tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
|
path = fdt_getprop(blob, nodeoffset, "pci0", NULL);
|
||||||
tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
|
if (path) {
|
||||||
err = fdt_setprop(blob, nodeoffset, "bus-range",
|
tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
|
||||||
tmp, sizeof(tmp));
|
tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
|
||||||
|
do_fixup_by_path(blob, path, "bus-range",
|
||||||
|
&tmp, sizeof(tmp), 1);
|
||||||
|
|
||||||
tmp[0] = cpu_to_be32(gd->pci_clk);
|
tmp[0] = cpu_to_be32(gd->pci_clk);
|
||||||
err = fdt_setprop(blob, nodeoffset, "clock-frequency",
|
do_fixup_by_path(blob, path, "clock-frequency",
|
||||||
tmp, sizeof(tmp[0]));
|
&tmp, sizeof(tmp[0]), 1);
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_MPC83XX_PCI2
|
#ifdef CONFIG_MPC83XX_PCI2
|
||||||
nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8500");
|
path = fdt_getprop(blob, nodeoffset, "pci1", NULL);
|
||||||
if (nodeoffset >= 0) {
|
if (path) {
|
||||||
tmp[0] = cpu_to_be32(pci_hose[1].first_busno);
|
tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
|
||||||
tmp[1] = cpu_to_be32(pci_hose[1].last_busno);
|
tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
|
||||||
err = fdt_setprop(blob, nodeoffset, "bus-range",
|
do_fixup_by_path(blob, path, "bus-range",
|
||||||
tmp, sizeof(tmp));
|
&tmp, sizeof(tmp), 1);
|
||||||
|
|
||||||
tmp[0] = cpu_to_be32(gd->pci_clk);
|
tmp[0] = cpu_to_be32(gd->pci_clk);
|
||||||
err = fdt_setprop(blob, nodeoffset, "clock-frequency",
|
do_fixup_by_path(blob, path, "clock-frequency",
|
||||||
tmp, sizeof(tmp[0]));
|
&tmp, sizeof(tmp[0]), 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#elif defined(CONFIG_OF_FLAT_TREE)
|
#elif defined(CONFIG_OF_FLAT_TREE)
|
||||||
void
|
void
|
||||||
|
|
|
@ -327,25 +327,32 @@ void ft_board_setup(void *blob, bd_t *bd)
|
||||||
immr->sysconf.spridr == SPR_8360E_REV21) {
|
immr->sysconf.spridr == SPR_8360E_REV21) {
|
||||||
int nodeoffset;
|
int nodeoffset;
|
||||||
const char *prop;
|
const char *prop;
|
||||||
|
const char *path;
|
||||||
|
|
||||||
/* fixup UCC 1 if using rgmii-id mode */
|
nodeoffset = fdt_path_offset(fdt, "/aliases");
|
||||||
nodeoffset = fdt_path_offset(blob, "/" OF_QE "/ucc@2000");
|
|
||||||
if (nodeoffset >= 0) {
|
if (nodeoffset >= 0) {
|
||||||
prop = fdt_getprop(blob, nodeoffset,
|
#if defined(CONFIG_HAS_ETH0)
|
||||||
"phy-connection-type", 0);
|
/* fixup UCC 1 if using rgmii-id mode */
|
||||||
if (prop && (strcmp(prop, "rgmii-id") == 0))
|
path = fdt_getprop(blob, nodeoffset, "ethernet0", NULL);
|
||||||
fdt_setprop(blob, nodeoffset, "phy-connection-type",
|
if (path) {
|
||||||
"rgmii-rxid", sizeof("rgmii-rxid"));
|
prop = fdt_getprop(blob, nodeoffset,
|
||||||
}
|
"phy-connection-type", 0);
|
||||||
|
if (prop && (strcmp(prop, "rgmii-id") == 0))
|
||||||
/* fixup UCC 2 if using rgmii-id mode */
|
fdt_setprop(blob, nodeoffset, "phy-connection-type",
|
||||||
nodeoffset = fdt_path_offset(blob, "/" OF_QE "/ucc@3000");
|
"rgmii-rxid", sizeof("rgmii-rxid"));
|
||||||
if (nodeoffset >= 0) {
|
}
|
||||||
prop = fdt_getprop(blob, nodeoffset,
|
#endif
|
||||||
"phy-connection-type", 0);
|
#if defined(CONFIG_HAS_ETH1)
|
||||||
if (prop && (strcmp(prop, "rgmii-id") == 0))
|
/* fixup UCC 2 if using rgmii-id mode */
|
||||||
fdt_setprop(blob, nodeoffset, "phy-connection-type",
|
path = fdt_getprop(blob, nodeoffset, "ethernet1", NULL);
|
||||||
"rgmii-rxid", sizeof("rgmii-rxid"));
|
if (path) {
|
||||||
|
prop = fdt_getprop(blob, nodeoffset,
|
||||||
|
"phy-connection-type", 0);
|
||||||
|
if (prop && (strcmp(prop, "rgmii-id") == 0))
|
||||||
|
fdt_setprop(blob, nodeoffset, "phy-connection-type",
|
||||||
|
"rgmii-rxid", sizeof("rgmii-rxid"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#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 <fdt_support.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <asm/fsl_i2c.h>
|
#include <asm/fsl_i2c.h>
|
||||||
|
@ -262,23 +263,25 @@ void pci_init_board(void)
|
||||||
#endif /* CONFIG_PCISLAVE */
|
#endif /* CONFIG_PCISLAVE */
|
||||||
|
|
||||||
#if defined(CONFIG_OF_LIBFDT)
|
#if defined(CONFIG_OF_LIBFDT)
|
||||||
void
|
void ft_pci_setup(void *blob, bd_t *bd)
|
||||||
ft_pci_setup(void *blob, bd_t *bd)
|
|
||||||
{
|
{
|
||||||
int nodeoffset;
|
int nodeoffset;
|
||||||
int err;
|
|
||||||
int tmp[2];
|
int tmp[2];
|
||||||
|
const char *path;
|
||||||
|
|
||||||
nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8500");
|
nodeoffset = fdt_path_offset(blob, "/aliases");
|
||||||
if (nodeoffset >= 0) {
|
if (nodeoffset >= 0) {
|
||||||
tmp[0] = cpu_to_be32(hose[0].first_busno);
|
path = fdt_getprop(blob, nodeoffset, "pci0", NULL);
|
||||||
tmp[1] = cpu_to_be32(hose[0].last_busno);
|
if (path) {
|
||||||
err = fdt_setprop(blob, nodeoffset, "bus-range",
|
tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
|
||||||
tmp, sizeof(tmp));
|
tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
|
||||||
|
do_fixup_by_path(blob, path, "bus-range",
|
||||||
|
&tmp, sizeof(tmp), 1);
|
||||||
|
|
||||||
tmp[0] = cpu_to_be32(gd->pci_clk);
|
tmp[0] = cpu_to_be32(gd->pci_clk);
|
||||||
err = fdt_setprop(blob, nodeoffset, "clock-frequency",
|
do_fixup_by_path(blob, path, "clock-frequency",
|
||||||
tmp, sizeof(tmp[0]));
|
&tmp, sizeof(tmp[0]), 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(CONFIG_OF_FLAT_TREE)
|
#elif defined(CONFIG_OF_FLAT_TREE)
|
||||||
|
|
|
@ -30,6 +30,12 @@
|
||||||
#include <pci.h>
|
#include <pci.h>
|
||||||
#include <asm/mpc8349_pci.h>
|
#include <asm/mpc8349_pci.h>
|
||||||
#include <i2c.h>
|
#include <i2c.h>
|
||||||
|
#if defined(CONFIG_OF_FLAT_TREE)
|
||||||
|
#include <ft_build.h>
|
||||||
|
#elif defined(CONFIG_OF_LIBFDT)
|
||||||
|
#include <libfdt.h>
|
||||||
|
#include <fdt_support.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
@ -323,7 +329,42 @@ pci_init_board(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_OF_FLAT_TREE
|
#if defined(CONFIG_OF_LIBFDT)
|
||||||
|
void ft_pci_setup(void *blob, bd_t *bd)
|
||||||
|
{
|
||||||
|
int nodeoffset;
|
||||||
|
int tmp[2];
|
||||||
|
const char *path;
|
||||||
|
|
||||||
|
nodeoffset = fdt_path_offset(blob, "/aliases");
|
||||||
|
if (nodeoffset >= 0) {
|
||||||
|
path = fdt_getprop(blob, nodeoffset, "pci0", NULL);
|
||||||
|
if (path) {
|
||||||
|
tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
|
||||||
|
tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
|
||||||
|
do_fixup_by_path(blob, path, "bus-range",
|
||||||
|
&tmp, sizeof(tmp), 1);
|
||||||
|
|
||||||
|
tmp[0] = cpu_to_be32(gd->pci_clk);
|
||||||
|
do_fixup_by_path(blob, path, "clock-frequency",
|
||||||
|
&tmp, sizeof(tmp[0]), 1);
|
||||||
|
}
|
||||||
|
#ifdef CONFIG_MPC83XX_PCI2
|
||||||
|
path = fdt_getprop(blob, nodeoffset, "pci1", NULL);
|
||||||
|
if (path) {
|
||||||
|
tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
|
||||||
|
tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
|
||||||
|
do_fixup_by_path(blob, path, "bus-range",
|
||||||
|
&tmp, sizeof(tmp), 1);
|
||||||
|
|
||||||
|
tmp[0] = cpu_to_be32(gd->pci_clk);
|
||||||
|
do_fixup_by_path(blob, path, "clock-frequency",
|
||||||
|
&tmp, sizeof(tmp[0]), 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#elif defined(CONFIG_OF_FLAT_TREE)
|
||||||
void
|
void
|
||||||
ft_pci_setup(void *blob, bd_t *bd)
|
ft_pci_setup(void *blob, bd_t *bd)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,7 @@ LIB = $(obj)lib$(CPU).a
|
||||||
|
|
||||||
START = start.o
|
START = start.o
|
||||||
COBJS = traps.o cpu.o cpu_init.o speed.o interrupts.o \
|
COBJS = traps.o cpu.o cpu_init.o speed.o interrupts.o \
|
||||||
spd_sdram.o ecc.o qe_io.o pci.o
|
spd_sdram.o ecc.o qe_io.o pci.o fdt.o
|
||||||
|
|
||||||
SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
|
SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
|
||||||
OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
|
OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
|
||||||
|
|
|
@ -31,12 +31,7 @@
|
||||||
#include <command.h>
|
#include <command.h>
|
||||||
#include <mpc83xx.h>
|
#include <mpc83xx.h>
|
||||||
#include <asm/processor.h>
|
#include <asm/processor.h>
|
||||||
#if defined(CONFIG_OF_FLAT_TREE)
|
|
||||||
#include <ft_build.h>
|
|
||||||
#elif defined(CONFIG_OF_LIBFDT)
|
|
||||||
#include <libfdt.h>
|
#include <libfdt.h>
|
||||||
#include <fdt_support.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
@ -359,427 +354,6 @@ void watchdog_reset (void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_OF_LIBFDT)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* "Setter" functions used to add/modify FDT entries.
|
|
||||||
*/
|
|
||||||
static int fdt_set_eth0(void *blob, int nodeoffset, const char *name, bd_t *bd)
|
|
||||||
{
|
|
||||||
/* Fix it up if it exists, don't create it if it doesn't exist */
|
|
||||||
if (fdt_get_property(blob, nodeoffset, name, 0)) {
|
|
||||||
return fdt_setprop(blob, nodeoffset, name, bd->bi_enetaddr, 6);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#ifdef CONFIG_HAS_ETH1
|
|
||||||
/* second onboard ethernet port */
|
|
||||||
static int fdt_set_eth1(void *blob, int nodeoffset, const char *name, bd_t *bd)
|
|
||||||
{
|
|
||||||
/* Fix it up if it exists, don't create it if it doesn't exist */
|
|
||||||
if (fdt_get_property(blob, nodeoffset, name, 0)) {
|
|
||||||
return fdt_setprop(blob, nodeoffset, name, bd->bi_enet1addr, 6);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_HAS_ETH2
|
|
||||||
/* third onboard ethernet port */
|
|
||||||
static int fdt_set_eth2(void *blob, int nodeoffset, const char *name, bd_t *bd)
|
|
||||||
{
|
|
||||||
/* Fix it up if it exists, don't create it if it doesn't exist */
|
|
||||||
if (fdt_get_property(blob, nodeoffset, name, 0)) {
|
|
||||||
return fdt_setprop(blob, nodeoffset, name, bd->bi_enet2addr, 6);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_HAS_ETH3
|
|
||||||
/* fourth onboard ethernet port */
|
|
||||||
static int fdt_set_eth3(void *blob, int nodeoffset, const char *name, bd_t *bd)
|
|
||||||
{
|
|
||||||
/* Fix it up if it exists, don't create it if it doesn't exist */
|
|
||||||
if (fdt_get_property(blob, nodeoffset, name, 0)) {
|
|
||||||
return fdt_setprop(blob, nodeoffset, name, bd->bi_enet3addr, 6);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int fdt_set_busfreq(void *blob, int nodeoffset, const char *name, bd_t *bd)
|
|
||||||
{
|
|
||||||
u32 tmp;
|
|
||||||
/* Create or update the property */
|
|
||||||
tmp = cpu_to_be32(bd->bi_busfreq);
|
|
||||||
return fdt_setprop(blob, nodeoffset, name, &tmp, sizeof(tmp));
|
|
||||||
}
|
|
||||||
|
|
||||||
static int fdt_set_tbfreq(void *blob, int nodeoffset, const char *name, bd_t *bd)
|
|
||||||
{
|
|
||||||
u32 tmp;
|
|
||||||
/* Create or update the property */
|
|
||||||
tmp = cpu_to_be32(OF_TBCLK);
|
|
||||||
return fdt_setprop(blob, nodeoffset, name, &tmp, sizeof(tmp));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int fdt_set_clockfreq(void *blob, int nodeoffset, const char *name, bd_t *bd)
|
|
||||||
{
|
|
||||||
u32 tmp;
|
|
||||||
/* Create or update the property */
|
|
||||||
tmp = cpu_to_be32(gd->core_clk);
|
|
||||||
return fdt_setprop(blob, nodeoffset, name, &tmp, sizeof(tmp));
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_QE
|
|
||||||
static int fdt_set_qe_busfreq(void *blob, int nodeoffset, const char *name, bd_t *bd)
|
|
||||||
{
|
|
||||||
u32 tmp;
|
|
||||||
/* Create or update the property */
|
|
||||||
tmp = cpu_to_be32(gd->qe_clk);
|
|
||||||
return fdt_setprop(blob, nodeoffset, name, &tmp, sizeof(tmp));
|
|
||||||
}
|
|
||||||
|
|
||||||
static int fdt_set_qe_brgfreq(void *blob, int nodeoffset, const char *name, bd_t *bd)
|
|
||||||
{
|
|
||||||
u32 tmp;
|
|
||||||
/* Create or update the property */
|
|
||||||
tmp = cpu_to_be32(gd->brg_clk);
|
|
||||||
return fdt_setprop(blob, nodeoffset, name, &tmp, sizeof(tmp));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fixups to the fdt.
|
|
||||||
*/
|
|
||||||
static const struct {
|
|
||||||
char *node;
|
|
||||||
char *prop;
|
|
||||||
int (*set_fn)(void *blob, int nodeoffset, const char *name, bd_t *bd);
|
|
||||||
} fixup_props[] = {
|
|
||||||
{ "/cpus/" OF_CPU,
|
|
||||||
"timebase-frequency",
|
|
||||||
fdt_set_tbfreq
|
|
||||||
},
|
|
||||||
{ "/cpus/" OF_CPU,
|
|
||||||
"bus-frequency",
|
|
||||||
fdt_set_busfreq
|
|
||||||
},
|
|
||||||
{ "/cpus/" OF_CPU,
|
|
||||||
"clock-frequency",
|
|
||||||
fdt_set_clockfreq
|
|
||||||
},
|
|
||||||
{ "/" OF_SOC,
|
|
||||||
"bus-frequency",
|
|
||||||
fdt_set_busfreq
|
|
||||||
},
|
|
||||||
{ "/" OF_SOC "/serial@4500",
|
|
||||||
"clock-frequency",
|
|
||||||
fdt_set_busfreq
|
|
||||||
},
|
|
||||||
{ "/" OF_SOC "/serial@4600",
|
|
||||||
"clock-frequency",
|
|
||||||
fdt_set_busfreq
|
|
||||||
},
|
|
||||||
#ifdef CONFIG_TSEC1
|
|
||||||
{ "/" OF_SOC "/ethernet@24000",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth0
|
|
||||||
},
|
|
||||||
{ "/" OF_SOC "/ethernet@24000",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth0
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_TSEC2
|
|
||||||
{ "/" OF_SOC "/ethernet@25000",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth1
|
|
||||||
},
|
|
||||||
{ "/" OF_SOC "/ethernet@25000",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth1
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_QE
|
|
||||||
{ "/" OF_QE,
|
|
||||||
"brg-frequency",
|
|
||||||
fdt_set_qe_brgfreq
|
|
||||||
},
|
|
||||||
{ "/" OF_QE,
|
|
||||||
"bus-frequency",
|
|
||||||
fdt_set_qe_busfreq
|
|
||||||
},
|
|
||||||
#ifdef CONFIG_UEC_ETH1
|
|
||||||
#if CFG_UEC1_UCC_NUM == 0 /* UCC1 */
|
|
||||||
{ "/" OF_QE "/ucc@2000",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth0
|
|
||||||
},
|
|
||||||
{ "/" OF_QE "/ucc@2000",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth0
|
|
||||||
},
|
|
||||||
#elif CFG_UEC1_UCC_NUM == 1 /* UCC2 */
|
|
||||||
{ "/" OF_QE "/ucc@3000",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth0
|
|
||||||
},
|
|
||||||
{ "/" OF_QE "/ucc@3000",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth0
|
|
||||||
},
|
|
||||||
#elif CFG_UEC1_UCC_NUM == 2 /* UCC3 */
|
|
||||||
{ "/" OF_QE "/ucc@2200",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth0
|
|
||||||
},
|
|
||||||
{ "/" OF_QE "/ucc@2200",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth0
|
|
||||||
},
|
|
||||||
#elif CFG_UEC1_UCC_NUM == 3 /* UCC4 */
|
|
||||||
{ "/" OF_QE "/ucc@3200",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth0
|
|
||||||
},
|
|
||||||
{ "/" OF_QE "/ucc@3200",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth0
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
#endif /* CONFIG_UEC_ETH1 */
|
|
||||||
#ifdef CONFIG_UEC_ETH2
|
|
||||||
#if CFG_UEC2_UCC_NUM == 0 /* UCC1 */
|
|
||||||
{ "/" OF_QE "/ucc@2000",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth1
|
|
||||||
},
|
|
||||||
{ "/" OF_QE "/ucc@2000",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth1
|
|
||||||
},
|
|
||||||
#elif CFG_UEC2_UCC_NUM == 1 /* UCC2 */
|
|
||||||
{ "/" OF_QE "/ucc@3000",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth1
|
|
||||||
},
|
|
||||||
{ "/" OF_QE "/ucc@3000",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth1
|
|
||||||
},
|
|
||||||
#elif CFG_UEC2_UCC_NUM == 2 /* UCC3 */
|
|
||||||
{ "/" OF_QE "/ucc@2200",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth1
|
|
||||||
},
|
|
||||||
{ "/" OF_QE "/ucc@2200",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth1
|
|
||||||
},
|
|
||||||
#elif CFG_UEC2_UCC_NUM == 3 /* UCC4 */
|
|
||||||
{ "/" OF_QE "/ucc@3200",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth1
|
|
||||||
},
|
|
||||||
{ "/" OF_QE "/ucc@3200",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth1
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
#endif /* CONFIG_UEC_ETH2 */
|
|
||||||
#ifdef CONFIG_UEC_ETH3
|
|
||||||
#if CFG_UEC3_UCC_NUM == 0 /* UCC1 */
|
|
||||||
{ "/" OF_QE "/ucc@2000",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth2
|
|
||||||
},
|
|
||||||
{ "/" OF_QE "/ucc@2000",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth2
|
|
||||||
},
|
|
||||||
#elif CFG_UEC3_UCC_NUM == 1 /* UCC2 */
|
|
||||||
{ "/" OF_QE "/ucc@3000",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth2
|
|
||||||
},
|
|
||||||
{ "/" OF_QE "/ucc@3000",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth2
|
|
||||||
},
|
|
||||||
#elif CFG_UEC3_UCC_NUM == 2 /* UCC3 */
|
|
||||||
{ "/" OF_QE "/ucc@2200",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth2
|
|
||||||
},
|
|
||||||
{ "/" OF_QE "/ucc@2200",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth2
|
|
||||||
},
|
|
||||||
#elif CFG_UEC3_UCC_NUM == 3 /* UCC4 */
|
|
||||||
{ "/" OF_QE "/ucc@3200",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth2
|
|
||||||
},
|
|
||||||
{ "/" OF_QE "/ucc@3200",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth2
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
#endif /* CONFIG_UEC_ETH3 */
|
|
||||||
#ifdef CONFIG_UEC_ETH4
|
|
||||||
#if CFG_UEC4_UCC_NUM == 0 /* UCC1 */
|
|
||||||
{ "/" OF_QE "/ucc@2000",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth3
|
|
||||||
},
|
|
||||||
{ "/" OF_QE "/ucc@2000",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth3
|
|
||||||
},
|
|
||||||
#elif CFG_UEC4_UCC_NUM == 1 /* UCC2 */
|
|
||||||
{ "/" OF_QE "/ucc@3000",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth3
|
|
||||||
},
|
|
||||||
{ "/" OF_QE "/ucc@3000",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth3
|
|
||||||
},
|
|
||||||
#elif CFG_UEC4_UCC_NUM == 2 /* UCC3 */
|
|
||||||
{ "/" OF_QE "/ucc@2200",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth3
|
|
||||||
},
|
|
||||||
{ "/" OF_QE "/ucc@2200",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth3
|
|
||||||
},
|
|
||||||
#elif CFG_UEC4_UCC_NUM == 3 /* UCC4 */
|
|
||||||
{ "/" OF_QE "/ucc@3200",
|
|
||||||
"mac-address",
|
|
||||||
fdt_set_eth3
|
|
||||||
},
|
|
||||||
{ "/" OF_QE "/ucc@3200",
|
|
||||||
"local-mac-address",
|
|
||||||
fdt_set_eth3
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
#endif /* CONFIG_UEC_ETH4 */
|
|
||||||
#endif /* CONFIG_QE */
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
ft_cpu_setup(void *blob, bd_t *bd)
|
|
||||||
{
|
|
||||||
int nodeoffset;
|
|
||||||
int err;
|
|
||||||
int j;
|
|
||||||
|
|
||||||
for (j = 0; j < (sizeof(fixup_props) / sizeof(fixup_props[0])); j++) {
|
|
||||||
nodeoffset = fdt_path_offset(blob, fixup_props[j].node);
|
|
||||||
if (nodeoffset >= 0) {
|
|
||||||
err = fixup_props[j].set_fn(blob, nodeoffset,
|
|
||||||
fixup_props[j].prop, bd);
|
|
||||||
if (err < 0)
|
|
||||||
debug("Problem setting %s = %s: %s\n",
|
|
||||||
fixup_props[j].node, fixup_props[j].prop,
|
|
||||||
fdt_strerror(err));
|
|
||||||
} else {
|
|
||||||
debug("Couldn't find %s: %s\n",
|
|
||||||
fixup_props[j].node, fdt_strerror(nodeoffset));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
|
|
||||||
}
|
|
||||||
#elif defined(CONFIG_OF_FLAT_TREE)
|
|
||||||
void
|
|
||||||
ft_cpu_setup(void *blob, bd_t *bd)
|
|
||||||
{
|
|
||||||
u32 *p;
|
|
||||||
int len;
|
|
||||||
ulong clock;
|
|
||||||
|
|
||||||
clock = bd->bi_busfreq;
|
|
||||||
p = ft_get_prop(blob, "/cpus/" OF_CPU "/bus-frequency", &len);
|
|
||||||
if (p != NULL)
|
|
||||||
*p = cpu_to_be32(clock);
|
|
||||||
|
|
||||||
p = ft_get_prop(blob, "/" OF_SOC "/bus-frequency", &len);
|
|
||||||
if (p != NULL)
|
|
||||||
*p = cpu_to_be32(clock);
|
|
||||||
|
|
||||||
p = ft_get_prop(blob, "/" OF_SOC "/serial@4500/clock-frequency", &len);
|
|
||||||
if (p != NULL)
|
|
||||||
*p = cpu_to_be32(clock);
|
|
||||||
|
|
||||||
p = ft_get_prop(blob, "/" OF_SOC "/serial@4600/clock-frequency", &len);
|
|
||||||
if (p != NULL)
|
|
||||||
*p = cpu_to_be32(clock);
|
|
||||||
|
|
||||||
#ifdef CONFIG_TSEC1
|
|
||||||
p = ft_get_prop(blob, "/" OF_SOC "/ethernet@24000/mac-address", &len);
|
|
||||||
if (p != NULL)
|
|
||||||
memcpy(p, bd->bi_enetaddr, 6);
|
|
||||||
|
|
||||||
p = ft_get_prop(blob, "/" OF_SOC "/ethernet@24000/local-mac-address", &len);
|
|
||||||
if (p != NULL)
|
|
||||||
memcpy(p, bd->bi_enetaddr, 6);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_TSEC2
|
|
||||||
p = ft_get_prop(blob, "/" OF_SOC "/ethernet@25000/mac-address", &len);
|
|
||||||
if (p != NULL)
|
|
||||||
memcpy(p, bd->bi_enet1addr, 6);
|
|
||||||
|
|
||||||
p = ft_get_prop(blob, "/" OF_SOC "/ethernet@25000/local-mac-address", &len);
|
|
||||||
if (p != NULL)
|
|
||||||
memcpy(p, bd->bi_enet1addr, 6);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_UEC_ETH1
|
|
||||||
#if CFG_UEC1_UCC_NUM == 0 /* UCC1 */
|
|
||||||
p = ft_get_prop(blob, "/" OF_QE "/ucc@2000/mac-address", &len);
|
|
||||||
if (p != NULL)
|
|
||||||
memcpy(p, bd->bi_enetaddr, 6);
|
|
||||||
|
|
||||||
p = ft_get_prop(blob, "/" OF_QE "/ucc@2000/local-mac-address", &len);
|
|
||||||
if (p != NULL)
|
|
||||||
memcpy(p, bd->bi_enetaddr, 6);
|
|
||||||
#elif CFG_UEC1_UCC_NUM == 2 /* UCC3 */
|
|
||||||
p = ft_get_prop(blob, "/" OF_QE "/ucc@2200/mac-address", &len);
|
|
||||||
if (p != NULL)
|
|
||||||
memcpy(p, bd->bi_enetaddr, 6);
|
|
||||||
|
|
||||||
p = ft_get_prop(blob, "/" OF_QE "/ucc@2200/local-mac-address", &len);
|
|
||||||
if (p != NULL)
|
|
||||||
memcpy(p, bd->bi_enetaddr, 6);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_UEC_ETH2
|
|
||||||
#if CFG_UEC2_UCC_NUM == 1 /* UCC2 */
|
|
||||||
p = ft_get_prop(blob, "/" OF_QE "/ucc@3000/mac-address", &len);
|
|
||||||
if (p != NULL)
|
|
||||||
memcpy(p, bd->bi_enet1addr, 6);
|
|
||||||
|
|
||||||
p = ft_get_prop(blob, "/" OF_QE "/ucc@3000/local-mac-address", &len);
|
|
||||||
if (p != NULL)
|
|
||||||
memcpy(p, bd->bi_enet1addr, 6);
|
|
||||||
#elif CFG_UEC2_UCC_NUM == 3 /* UCC4 */
|
|
||||||
p = ft_get_prop(blob, "/" OF_QE "/ucc@3200/mac-address", &len);
|
|
||||||
if (p != NULL)
|
|
||||||
memcpy(p, bd->bi_enet1addr, 6);
|
|
||||||
|
|
||||||
p = ft_get_prop(blob, "/" OF_QE "/ucc@3200/local-mac-address", &len);
|
|
||||||
if (p != NULL)
|
|
||||||
memcpy(p, bd->bi_enet1addr, 6);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(CONFIG_DDR_ECC)
|
#if defined(CONFIG_DDR_ECC)
|
||||||
void dma_init(void)
|
void dma_init(void)
|
||||||
{
|
{
|
||||||
|
|
72
cpu/mpc83xx/fdt.c
Normal file
72
cpu/mpc83xx/fdt.c
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2007 Freescale Semiconductor, Inc.
|
||||||
|
*
|
||||||
|
* (C) Copyright 2000
|
||||||
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||||
|
*
|
||||||
|
* See file CREDITS for list of people who contributed to this
|
||||||
|
* project.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||||
|
* MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <common.h>
|
||||||
|
|
||||||
|
#if defined(CONFIG_OF_LIBFDT)
|
||||||
|
|
||||||
|
#include <libfdt.h>
|
||||||
|
#include <fdt_support.h>
|
||||||
|
|
||||||
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
void ft_cpu_setup(void *blob, bd_t *bd)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) ||\
|
||||||
|
defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
|
||||||
|
fdt_fixup_ethernet(blob, bd);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
|
||||||
|
"timebase-frequency", (bd->bi_busfreq / 4), 1);
|
||||||
|
do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
|
||||||
|
"bus-frequency", bd->bi_busfreq, 1);
|
||||||
|
do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
|
||||||
|
"clock-frequency", gd->core_clk, 1);
|
||||||
|
do_fixup_by_prop_u32(blob, "device_type", "soc", 4,
|
||||||
|
"bus-frequency", bd->bi_busfreq, 1);
|
||||||
|
#ifdef CONFIG_QE
|
||||||
|
do_fixup_by_prop_u32(blob, "device_type", "qe", 4,
|
||||||
|
"bus-frequency", gd->qe_clk, 1);
|
||||||
|
do_fixup_by_prop_u32(blob, "device_type", "qe", 4,
|
||||||
|
"brg-frequency", gd->brg_clk, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CFG_NS16550
|
||||||
|
do_fixup_by_compat_u32(blob, "ns16550",
|
||||||
|
"clock-frequency", bd->bi_busfreq, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_CPM2
|
||||||
|
do_fixup_by_compat_u32(blob, "fsl,cpm2-scc-uart",
|
||||||
|
"current-speed", bd->bi_baudrate, 1);
|
||||||
|
|
||||||
|
do_fixup_by_compat_u32(blob, "fsl,cpm2-brg",
|
||||||
|
"clock-frequency", bd->bi_brgfreq, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_OF_LIBFDT */
|
|
@ -28,8 +28,7 @@
|
||||||
|
|
||||||
#if defined(CONFIG_OF_LIBFDT)
|
#if defined(CONFIG_OF_LIBFDT)
|
||||||
#include <libfdt.h>
|
#include <libfdt.h>
|
||||||
#elif defined(CONFIG_OF_FLAT_TREE)
|
#include <fdt_support.h>
|
||||||
#include <ft_build.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <asm/mpc8349_pci.h>
|
#include <asm/mpc8349_pci.h>
|
||||||
|
@ -173,63 +172,41 @@ void mpc83xx_pci_init(int num_buses, struct pci_region **reg, int warmboot)
|
||||||
void ft_pci_setup(void *blob, bd_t *bd)
|
void ft_pci_setup(void *blob, bd_t *bd)
|
||||||
{
|
{
|
||||||
int nodeoffset;
|
int nodeoffset;
|
||||||
int err;
|
|
||||||
int tmp[2];
|
int tmp[2];
|
||||||
|
const char *path;
|
||||||
|
|
||||||
if (pci_num_buses < 1)
|
if (pci_num_buses < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8500");
|
nodeoffset = fdt_path_offset(blob, "/aliases");
|
||||||
if (nodeoffset >= 0) {
|
if (nodeoffset >= 0) {
|
||||||
tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
|
path = fdt_getprop(blob, nodeoffset, "pci0", NULL);
|
||||||
tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
|
if (path) {
|
||||||
err = fdt_setprop(blob, nodeoffset, "bus-range",
|
tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
|
||||||
tmp, sizeof(tmp));
|
tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
|
||||||
|
do_fixup_by_path(blob, path, "bus-range",
|
||||||
|
&tmp, sizeof(tmp), 1);
|
||||||
|
|
||||||
tmp[0] = cpu_to_be32(gd->pci_clk);
|
tmp[0] = cpu_to_be32(gd->pci_clk);
|
||||||
err = fdt_setprop(blob, nodeoffset, "clock-frequency",
|
do_fixup_by_path(blob, path, "clock-frequency",
|
||||||
tmp, sizeof(tmp[0]));
|
&tmp, sizeof(tmp[0]), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pci_num_buses < 2)
|
if (pci_num_buses < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nodeoffset = fdt_path_offset(blob, "/" OF_SOC "/pci@8600");
|
path = fdt_getprop(blob, nodeoffset, "pci1", NULL);
|
||||||
if (nodeoffset >= 0) {
|
if (path) {
|
||||||
tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
|
tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
|
||||||
tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
|
tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
|
||||||
err = fdt_setprop(blob, nodeoffset, "bus-range",
|
do_fixup_by_path(blob, path, "bus-range",
|
||||||
tmp, sizeof(tmp));
|
&tmp, sizeof(tmp), 1);
|
||||||
|
|
||||||
tmp[0] = cpu_to_be32(gd->pci_clk);
|
tmp[0] = cpu_to_be32(gd->pci_clk);
|
||||||
err = fdt_setprop(blob, nodeoffset, "clock-frequency",
|
do_fixup_by_path(blob, path, "clock-frequency",
|
||||||
tmp, sizeof(tmp[0]));
|
&tmp, sizeof(tmp[0]), 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif CONFIG_OF_FLAT_TREE
|
#endif /* CONFIG_OF_LIBFDT */
|
||||||
void ft_pci_setup(void *blob, bd_t *bd)
|
|
||||||
{
|
|
||||||
u32 *p;
|
|
||||||
int len;
|
|
||||||
|
|
||||||
if (pci_num_buses < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
p = (u32 *)ft_get_prop(blob, "/" OF_SOC "/pci@8500/bus-range", &len);
|
|
||||||
if (p) {
|
|
||||||
p[0] = pci_hose[0].first_busno;
|
|
||||||
p[1] = pci_hose[0].last_busno;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pci_num_buses < 2)
|
|
||||||
return;
|
|
||||||
|
|
||||||
p = (u32 *)ft_get_prop(blob, "/" OF_SOC "/pci@8600/bus-range", &len);
|
|
||||||
if (p) {
|
|
||||||
p[0] = pci_hose[1].first_busno;
|
|
||||||
p[1] = pci_hose[1].last_busno;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_OF_FLAT_TREE */
|
|
||||||
|
|
||||||
#endif /* CONFIG_83XX_GENERIC_PCI */
|
#endif /* CONFIG_83XX_GENERIC_PCI */
|
||||||
|
|
|
@ -231,11 +231,7 @@
|
||||||
/* pass open firmware flat tree */
|
/* pass open firmware flat tree */
|
||||||
#define CONFIG_OF_LIBFDT 1
|
#define CONFIG_OF_LIBFDT 1
|
||||||
#define CONFIG_OF_BOARD_SETUP 1
|
#define CONFIG_OF_BOARD_SETUP 1
|
||||||
|
#define CONFIG_OF_STDOUT_VIA_ALIAS 1
|
||||||
#define OF_CPU "PowerPC,8313@0"
|
|
||||||
#define OF_SOC "soc8313@e0000000"
|
|
||||||
#define OF_TBCLK (bd->bi_busfreq / 4)
|
|
||||||
#define OF_STDOUT_PATH "/soc8313@e0000000/serial@4500"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Serial Port
|
* Serial Port
|
||||||
|
|
|
@ -270,12 +270,7 @@
|
||||||
/* pass open firmware flat tree */
|
/* pass open firmware flat tree */
|
||||||
#define CONFIG_OF_LIBFDT 1
|
#define CONFIG_OF_LIBFDT 1
|
||||||
#define CONFIG_OF_BOARD_SETUP 1
|
#define CONFIG_OF_BOARD_SETUP 1
|
||||||
|
#define CONFIG_OF_STDOUT_VIA_ALIAS 1
|
||||||
#define OF_CPU "PowerPC,8323@0"
|
|
||||||
#define OF_SOC "soc8323@e0000000"
|
|
||||||
#define OF_QE "qe@e0100000"
|
|
||||||
#define OF_TBCLK (bd->bi_busfreq / 4)
|
|
||||||
#define OF_STDOUT_PATH "/soc8323@e0000000/serial@4500"
|
|
||||||
|
|
||||||
/* I2C */
|
/* I2C */
|
||||||
#define CONFIG_HARD_I2C /* I2C with hardware support */
|
#define CONFIG_HARD_I2C /* I2C with hardware support */
|
||||||
|
|
|
@ -321,12 +321,7 @@
|
||||||
/* pass open firmware flat tree */
|
/* pass open firmware flat tree */
|
||||||
#define CONFIG_OF_LIBFDT 1
|
#define CONFIG_OF_LIBFDT 1
|
||||||
#define CONFIG_OF_BOARD_SETUP 1
|
#define CONFIG_OF_BOARD_SETUP 1
|
||||||
|
#define CONFIG_OF_STDOUT_VIA_ALIAS 1
|
||||||
#define OF_CPU "PowerPC,8323@0"
|
|
||||||
#define OF_SOC "soc8323@e0000000"
|
|
||||||
#define OF_QE "qe@e0100000"
|
|
||||||
#define OF_TBCLK (bd->bi_busfreq / 4)
|
|
||||||
#define OF_STDOUT_PATH "/soc8323@e0000000/serial@4500"
|
|
||||||
|
|
||||||
/* I2C */
|
/* I2C */
|
||||||
#define CONFIG_HARD_I2C /* I2C with hardware support */
|
#define CONFIG_HARD_I2C /* I2C with hardware support */
|
||||||
|
|
|
@ -341,11 +341,7 @@
|
||||||
/* pass open firmware flat tree */
|
/* pass open firmware flat tree */
|
||||||
#define CONFIG_OF_LIBFDT 1
|
#define CONFIG_OF_LIBFDT 1
|
||||||
#define CONFIG_OF_BOARD_SETUP 1
|
#define CONFIG_OF_BOARD_SETUP 1
|
||||||
|
#define CONFIG_OF_STDOUT_VIA_ALIAS 1
|
||||||
#define OF_CPU "PowerPC,8349@0"
|
|
||||||
#define OF_SOC "soc8349@e0000000"
|
|
||||||
#define OF_TBCLK (bd->bi_busfreq / 4)
|
|
||||||
#define OF_STDOUT_PATH "/soc8349@e0000000/serial@4500"
|
|
||||||
|
|
||||||
/* I2C */
|
/* I2C */
|
||||||
#define CONFIG_HARD_I2C /* I2C with hardware support*/
|
#define CONFIG_HARD_I2C /* I2C with hardware support*/
|
||||||
|
|
|
@ -298,12 +298,8 @@ boards, we say we have two, but don't display a message if we find only one. */
|
||||||
|
|
||||||
/* pass open firmware flat tree */
|
/* pass open firmware flat tree */
|
||||||
#define CONFIG_OF_LIBFDT 1
|
#define CONFIG_OF_LIBFDT 1
|
||||||
#define CONFIG_OF_BOARD_SETUP
|
#define CONFIG_OF_BOARD_SETUP 1
|
||||||
|
#define CONFIG_OF_STDOUT_VIA_ALIAS 1
|
||||||
#define OF_CPU "PowerPC,8349@0"
|
|
||||||
#define OF_SOC "soc8349@e0000000"
|
|
||||||
#define OF_TBCLK (bd->bi_busfreq / 4)
|
|
||||||
#define OF_STDOUT_PATH "/soc8349@e0000000/serial@4500"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PCI
|
* PCI
|
||||||
|
|
|
@ -347,14 +347,8 @@
|
||||||
|
|
||||||
/* pass open firmware flat tree */
|
/* pass open firmware flat tree */
|
||||||
#define CONFIG_OF_LIBFDT 1
|
#define CONFIG_OF_LIBFDT 1
|
||||||
#undef CONFIG_OF_FLAT_TREE
|
|
||||||
#define CONFIG_OF_BOARD_SETUP 1
|
#define CONFIG_OF_BOARD_SETUP 1
|
||||||
|
#define CONFIG_OF_STDOUT_VIA_ALIAS 1
|
||||||
#define OF_CPU "PowerPC,8360@0"
|
|
||||||
#define OF_SOC "soc8360@e0000000"
|
|
||||||
#define OF_QE "qe@e0100000"
|
|
||||||
#define OF_TBCLK (bd->bi_busfreq / 4)
|
|
||||||
#define OF_STDOUT_PATH "/soc8360@e0000000/serial@4500"
|
|
||||||
|
|
||||||
/* I2C */
|
/* I2C */
|
||||||
#define CONFIG_HARD_I2C /* I2C with hardware support */
|
#define CONFIG_HARD_I2C /* I2C with hardware support */
|
||||||
|
|
|
@ -297,11 +297,7 @@
|
||||||
/* Pass open firmware flat tree */
|
/* Pass open firmware flat tree */
|
||||||
#define CONFIG_OF_LIBFDT 1
|
#define CONFIG_OF_LIBFDT 1
|
||||||
#define CONFIG_OF_BOARD_SETUP 1
|
#define CONFIG_OF_BOARD_SETUP 1
|
||||||
|
#define CONFIG_OF_STDOUT_VIA_ALIAS 1
|
||||||
#define OF_CPU "PowerPC,837x@0"
|
|
||||||
#define OF_SOC "soc837x@e0000000"
|
|
||||||
#define OF_TBCLK (bd->bi_busfreq / 4)
|
|
||||||
#define OF_STDOUT_PATH "/soc837x@e0000000/serial@4500"
|
|
||||||
|
|
||||||
/* I2C */
|
/* I2C */
|
||||||
#define CONFIG_HARD_I2C /* I2C with hardware support */
|
#define CONFIG_HARD_I2C /* I2C with hardware support */
|
||||||
|
|
|
@ -312,11 +312,7 @@
|
||||||
/* pass open firmware flat tree */
|
/* pass open firmware flat tree */
|
||||||
#define CONFIG_OF_LIBFDT 1
|
#define CONFIG_OF_LIBFDT 1
|
||||||
#define CONFIG_OF_BOARD_SETUP 1
|
#define CONFIG_OF_BOARD_SETUP 1
|
||||||
|
#define CONFIG_OF_STDOUT_VIA_ALIAS 1
|
||||||
#define OF_CPU "PowerPC,8349@0"
|
|
||||||
#define OF_SOC "soc8349@e0000000"
|
|
||||||
#define OF_TBCLK (bd->bi_busfreq / 4)
|
|
||||||
#define OF_STDOUT_PATH "/soc8349@e0000000/serial@4500"
|
|
||||||
|
|
||||||
/* I2C */
|
/* I2C */
|
||||||
#define CONFIG_HARD_I2C /* I2C with hardware support*/
|
#define CONFIG_HARD_I2C /* I2C with hardware support*/
|
||||||
|
|
Loading…
Reference in a new issue