2008-02-18 20:01:56 +00:00
|
|
|
/*
|
2011-01-04 23:07:54 +00:00
|
|
|
* Copyright 2008, 2011 Freescale Semiconductor, Inc.
|
2008-02-18 20:01:56 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* Version 2 as published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <libfdt.h>
|
|
|
|
#include <fdt_support.h>
|
2009-04-01 04:02:38 +00:00
|
|
|
#include <asm/mp.h>
|
2008-11-03 21:44:01 +00:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
2008-02-18 20:01:56 +00:00
|
|
|
|
2009-09-02 14:10:36 +00:00
|
|
|
extern void ft_fixup_num_cores(void *blob);
|
2011-01-04 23:07:54 +00:00
|
|
|
extern void ft_srio_setup(void *blob);
|
2009-09-02 14:10:36 +00:00
|
|
|
|
2008-02-18 20:01:56 +00:00
|
|
|
void ft_cpu_setup(void *blob, bd_t *bd)
|
|
|
|
{
|
2009-04-01 04:02:38 +00:00
|
|
|
#ifdef CONFIG_MP
|
2008-11-03 21:44:01 +00:00
|
|
|
int off;
|
2012-10-08 07:44:25 +00:00
|
|
|
u32 bootpg = determine_mp_bootpg(NULL);
|
2008-11-03 21:44:01 +00:00
|
|
|
#endif
|
|
|
|
|
2008-02-18 20:01:56 +00:00
|
|
|
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", bd->bi_intfreq, 1);
|
|
|
|
do_fixup_by_prop_u32(blob, "device_type", "soc", 4,
|
|
|
|
"bus-frequency", bd->bi_busfreq, 1);
|
|
|
|
|
mpc8[56]xx: Put localbus clock in device tree
Export the localbus frequency in the device tree, the same way the CPU, TB,
CCB, and various other frequencies are exported in their respective device
tree nodes.
Some localbus devices need this information to be programed correctly, so
it makes sense to export it along with the other frequencies.
Unfortunately, when someone wrote the localbus dts bindings, they didn't
bother to define what the "compatible" property should be. So it seems no
one was quite sure what to put in their dts files.
Based on current existing dts files in the kernel source, I've used
"fsl,pq3-localbus" and "fsl,elbc" for MPC85xx, which are used by almost all
of the 85xx devices, and are looked for by the Linux code. The eLBC is
apparently not entirely backward compatible with the pq3 LBC and so eLBC
equipped platforms like 8572 won't use pq3-localbus.
For MPC86xx, I've used "fsl,elbc" which is used by some of the 86xx systems
and is also looked for by the Linux code. On MPC8641, I've also used
"fsl,mpc8641-localbus" as it is also commonly used in dts files, some of
which don't use "fsl,elbc" or any other acceptable name to match on.
Signed-off-by: Trent Piepho <tpiepho@freescale.com>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Jon Loeliger <jdl@freescale.com>
2008-12-03 23:16:38 +00:00
|
|
|
#if defined(CONFIG_MPC8641)
|
|
|
|
do_fixup_by_compat_u32(blob, "fsl,mpc8641-localbus",
|
2012-12-13 20:48:48 +00:00
|
|
|
"bus-frequency", gd->arch.lbc_clk, 1);
|
mpc8[56]xx: Put localbus clock in device tree
Export the localbus frequency in the device tree, the same way the CPU, TB,
CCB, and various other frequencies are exported in their respective device
tree nodes.
Some localbus devices need this information to be programed correctly, so
it makes sense to export it along with the other frequencies.
Unfortunately, when someone wrote the localbus dts bindings, they didn't
bother to define what the "compatible" property should be. So it seems no
one was quite sure what to put in their dts files.
Based on current existing dts files in the kernel source, I've used
"fsl,pq3-localbus" and "fsl,elbc" for MPC85xx, which are used by almost all
of the 85xx devices, and are looked for by the Linux code. The eLBC is
apparently not entirely backward compatible with the pq3 LBC and so eLBC
equipped platforms like 8572 won't use pq3-localbus.
For MPC86xx, I've used "fsl,elbc" which is used by some of the 86xx systems
and is also looked for by the Linux code. On MPC8641, I've also used
"fsl,mpc8641-localbus" as it is also commonly used in dts files, some of
which don't use "fsl,elbc" or any other acceptable name to match on.
Signed-off-by: Trent Piepho <tpiepho@freescale.com>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Jon Loeliger <jdl@freescale.com>
2008-12-03 23:16:38 +00:00
|
|
|
#endif
|
|
|
|
do_fixup_by_compat_u32(blob, "fsl,elbc",
|
2012-12-13 20:48:48 +00:00
|
|
|
"bus-frequency", gd->arch.lbc_clk, 1);
|
mpc8[56]xx: Put localbus clock in device tree
Export the localbus frequency in the device tree, the same way the CPU, TB,
CCB, and various other frequencies are exported in their respective device
tree nodes.
Some localbus devices need this information to be programed correctly, so
it makes sense to export it along with the other frequencies.
Unfortunately, when someone wrote the localbus dts bindings, they didn't
bother to define what the "compatible" property should be. So it seems no
one was quite sure what to put in their dts files.
Based on current existing dts files in the kernel source, I've used
"fsl,pq3-localbus" and "fsl,elbc" for MPC85xx, which are used by almost all
of the 85xx devices, and are looked for by the Linux code. The eLBC is
apparently not entirely backward compatible with the pq3 LBC and so eLBC
equipped platforms like 8572 won't use pq3-localbus.
For MPC86xx, I've used "fsl,elbc" which is used by some of the 86xx systems
and is also looked for by the Linux code. On MPC8641, I've also used
"fsl,mpc8641-localbus" as it is also commonly used in dts files, some of
which don't use "fsl,elbc" or any other acceptable name to match on.
Signed-off-by: Trent Piepho <tpiepho@freescale.com>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Jon Loeliger <jdl@freescale.com>
2008-12-03 23:16:38 +00:00
|
|
|
|
2008-02-18 20:01:56 +00:00
|
|
|
fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
|
|
|
|
|
|
|
|
#if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) \
|
|
|
|
|| defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
|
2008-08-19 20:41:18 +00:00
|
|
|
fdt_fixup_ethernet(blob);
|
2008-02-18 20:01:56 +00:00
|
|
|
#endif
|
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
#ifdef CONFIG_SYS_NS16550
|
2008-02-18 20:01:56 +00:00
|
|
|
do_fixup_by_compat_u32(blob, "ns16550",
|
2008-10-16 13:01:15 +00:00
|
|
|
"clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
|
2008-02-18 20:01:56 +00:00
|
|
|
#endif
|
2008-11-03 21:44:01 +00:00
|
|
|
|
2009-04-01 04:02:38 +00:00
|
|
|
#ifdef CONFIG_MP
|
2008-11-03 21:44:01 +00:00
|
|
|
/* Reserve the boot page so OSes dont use it */
|
|
|
|
off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
|
|
|
|
if (off < 0)
|
|
|
|
printf("%s: %s\n", __FUNCTION__, fdt_strerror(off));
|
2010-06-10 03:33:53 +00:00
|
|
|
|
2009-09-02 14:10:36 +00:00
|
|
|
ft_fixup_num_cores(blob);
|
2010-06-10 03:33:53 +00:00
|
|
|
#endif
|
2011-01-04 23:07:54 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_SYS_SRIO
|
|
|
|
ft_srio_setup(blob);
|
|
|
|
#endif
|
2008-02-18 20:01:56 +00:00
|
|
|
}
|