Skip to contentSkip to conversation

Added support for FDT.

PATCH New Grzegorz Bernacki 2 participants 6 messages Jan 12, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Added support for FDT.

---
 board/ads5121/ads5121.c   |    8 ++++++++
 cpu/mpc512x/cpu.c         |   21 +++++++++++++++++++++
 include/asm-ppc/u-boot.h  |    3 +++
 include/configs/ads5121.h |    8 ++++++++
 lib_ppc/board.c           |    3 +++
 5 files changed, 43 insertions(+), 0 deletions(-)
board/ads5121/ads5121.c +8 -0
index f275ce7..46be6a5 100644
@@ -184,3 +184,11 @@ int checkboard (void)
 		brd_rev, cpld_rev);
 	return 0;
 }
+
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+void ft_board_setup(void *blob, bd_t *bd)
+{
+	ft_cpu_setup(blob, bd);
+	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+}
+#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
cpu/mpc512x/cpu.c +21 -0
index accae6e..6421a51 100644
@@ -32,6 +32,10 @@
 #include <mpc512x.h>
 #include <asm/processor.h>
 
+#if defined(CONFIG_OF_LIBFDT)
+#include <fdt_support.h>
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 int checkcpu (void)
@@ -125,3 +129,20 @@ void watchdog_reset (void)
 		enable_interrupts ();
 }
 #endif
+
+#ifdef CONFIG_OF_LIBFDT
+void ft_cpu_setup(void *blob, bd_t *bd)
+{
+	char * cpu_path = "/cpus/" OF_CPU;
+	char * eth_path = "/" OF_SOC "/ethernet at 2800";
+
+	do_fixup_by_path_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK, 1);
+	do_fixup_by_path_u32(blob, cpu_path, "bus-frequency", bd->bi_busfreq, 1);
+	do_fixup_by_path_u32(blob, cpu_path, "ref-frequency", CFG_MPC512X_CLKIN, 1);
+	do_fixup_by_path_u32(blob, cpu_path, "clock-frequency", bd->bi_intfreq, 1);
+	do_fixup_by_path_u32(blob, "/" OF_SOC, "bus-frequency", bd->bi_ipsfreq, 1);
+	do_fixup_by_path_u32(blob, "/" OF_SOC, "ref-frequency", CFG_MPC512X_CLKIN, 1);
+	do_fixup_by_path(blob, eth_path, "address", bd->bi_enetaddr, 6, 0);
+	do_fixup_by_path(blob, eth_path, "local-mac-address", bd->bi_enetaddr, 6, 0);
+}
+#endif
include/asm-ppc/u-boot.h +3 -0
index bd9b6f7..2b31814 100644
@@ -74,6 +74,9 @@ typedef struct bd_info {
 	unsigned long	bi_sccfreq;	/* SCC_CLK Freq, in MHz */
 	unsigned long	bi_vco;		/* VCO Out from PLL, in MHz */
 #endif
+#if defined(CONFIG_MPC512X)
+	unsigned long	bi_ipsfreq;	/* IPS Bus Freq, in MHz */
+#endif /* CONFIG_MPC512X */
 #if defined(CONFIG_MPC5xxx)
 	unsigned long	bi_ipbfreq;	/* IPB Bus Freq, in MHz */
 	unsigned long	bi_pcifreq;	/* PCI Bus Freq, in MHz */
include/configs/ads5121.h +8 -0
index 58060a8..11e7e44 100644
@@ -407,4 +407,12 @@
 
 #define CONFIG_BOOTCOMMAND	"run flash_self"
 
+#define CONFIG_OF_LIBFDT	1
+#define CONFIG_OF_BOARD_SETUP	1
+
+#define OF_CPU			"PowerPC,5121 at 0"
+#define OF_SOC			"soc5121 at 80000000"
+#define OF_TBCLK		(bd->bi_busfreq / 4)
+#define OF_STDOUT_PATH		"/soc5121 at 80000000/serial at 11300"
+
 #endif	/* __CONFIG_H */
lib_ppc/board.c +3 -0
index 9aa67f9..207cf36 100644
@@ -555,6 +555,9 @@ void board_init_f (ulong bootflag)
 	bd->bi_sccfreq = gd->scc_clk;
 	bd->bi_vco     = gd->vco_out;
 #endif /* CONFIG_CPM2 */
+#if defined(CONFIG_MPC512X)
+	bd->bi_ipsfreq = gd->ipb_clk;
+#endif /* CONFIG_MPC512X */
 #if defined(CONFIG_MPC5xxx)
 	bd->bi_ipbfreq = gd->ipb_clk;
 	bd->bi_pcifreq = gd->pci_clk;
Signature · 1 line
1.5.2.2
#1 lore raw

PATCH 1/1 Fixed typo in macro.

---
 include/common.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/common.h +1 -1
index 493417f..1bc33f5 100644
@@ -462,7 +462,7 @@ int	prt_8260_clks (void);
 #elif defined(CONFIG_MPC5xxx)
 int	prt_mpc5xxx_clks (void);
 #endif
-#if defined(CONFIG_MPC512x)
+#if defined(CONFIG_MPC512X)
 int	prt_mpc512xxx_clks (void);
 #endif
 #if defined(CONFIG_MPC8220)
Signature · 1 line
1.5.2.2
#2 lore raw

PATCH 1/1 Cleanup bus clock names.

---
 cpu/mpc512x/fec.c             |    2 +-
 cpu/mpc512x/i2c.c             |   12 ++++++------
 cpu/mpc512x/serial.c          |    2 +-
 cpu/mpc512x/speed.c           |    4 ++--
 include/asm-ppc/global_data.h |    2 +-
 lib_ppc/board.c               |    2 +-
 6 files changed, 12 insertions(+), 12 deletions(-)
cpu/mpc512x/fec.c +1 -1
index 675b7a2..c226a8a 100644
@@ -299,7 +299,7 @@ int mpc512x_fec_init_phy (struct eth_device *dev, bd_t * bis)
 		 * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
 		 * and do not drop the Preamble.
 		 */
-		fec->eth->mii_speed = (((gd->ipb_clk / 1000000) / 5) + 1) << 1;
+		fec->eth->mii_speed = (((gd->ips_clk / 1000000) / 5) + 1) << 1;
 
 		/*
 		 * Reset PHY, then delay 300ns
cpu/mpc512x/i2c.c +6 -6
index 00e28d6..56ba443 100644
@@ -236,7 +236,7 @@ static int mpc_get_fdr (int speed)
 	if (fdr == -1) {
 		ulong best_speed = 0;
 		ulong divider;
-		ulong ipb, scl;
+		ulong ips, scl;
 		ulong bestmatch = 0xffffffffUL;
 		int best_i = 0, best_j = 0, i, j;
 		int SCL_Tap[] = { 9, 10, 12, 15, 5, 6, 7, 8};
@@ -251,18 +251,18 @@ static int mpc_get_fdr (int speed)
 			{126, 128}
 		};
 
-		ipb = gd->ipb_clk;
+		ips = gd->ips_clk;
 		for (i = 7; i >= 0; i--) {
 			for (j = 7; j >= 0; j--) {
 				scl = 2 * (scltap[j].scl2tap +
 					   (SCL_Tap[i] - 1) * scltap[j].tap2tap
 					   + 2);
-				if (ipb <= speed*scl) {
-					if ((speed*scl - ipb) < bestmatch) {
-						bestmatch = speed*scl - ipb;
+				if (ips <= speed*scl) {
+					if ((speed*scl - ips) < bestmatch) {
+						bestmatch = speed*scl - ips;
 						best_i = i;
 						best_j = j;
-						best_speed = ipb/scl;
+						best_speed = ips/scl;
 					}
 				}
 			}
cpu/mpc512x/serial.c +1 -1
index 200ff2c..8a21404 100644
@@ -86,7 +86,7 @@ int serial_init(void)
 	psc->mode = PSC_MODE_1_STOPBIT;
 
 	/* calculate dividor for setting PSC CTUR and CTLR registers */
-	baseclk = (gd->ipb_clk + 8) / 16;
+	baseclk = (gd->ips_clk + 8) / 16;
 	div = (baseclk + (gd->baudrate / 2)) / gd->baudrate;
 
 	psc->ctur = (div >> 8) & 0xff;
cpu/mpc512x/speed.c +2 -2
index a609827..99e3495 100644
@@ -96,7 +96,7 @@ int get_clocks (void)
 		ips_clk = 0;
 	}
 
-	gd->ipb_clk = ips_clk;
+	gd->ips_clk = ips_clk;
 	gd->csb_clk = csb_clk;
 	gd->cpu_clk = core_clk;
 	gd->bus_clk = csb_clk;
@@ -118,7 +118,7 @@ int do_clocks (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 	printf ("Clock configuration:\n");
 	printf ("  CPU:                 %4d MHz\n", gd->cpu_clk / 1000000);
 	printf ("  Coherent System Bus: %4d MHz\n", gd->csb_clk / 1000000);
-	printf ("  IPS Bus:             %4d MHz\n", gd->ipb_clk / 1000000);
+	printf ("  IPS Bus:             %4d MHz\n", gd->ips_clk / 1000000);
 	printf ("  DDR:                 %4d MHz\n", 2 * gd->csb_clk / 1000000);
 	return 0;
 }
include/asm-ppc/global_data.h +1 -1
index 05aee74..46bc0b2 100644
@@ -86,7 +86,7 @@ typedef	struct	global_data {
 	unsigned long	pci_clk;
 #endif
 #if defined(CONFIG_MPC512X)
-	u32 ipb_clk;
+	u32 ips_clk;
 	u32 csb_clk;
 #endif /* CONFIG_MPC512X */
 #if defined(CONFIG_MPC8220)
lib_ppc/board.c +1 -1
index 207cf36..f6b8bdc 100644
@@ -556,7 +556,7 @@ void board_init_f (ulong bootflag)
 	bd->bi_vco     = gd->vco_out;
 #endif /* CONFIG_CPM2 */
 #if defined(CONFIG_MPC512X)
-	bd->bi_ipsfreq = gd->ipb_clk;
+	bd->bi_ipsfreq = gd->ips_clk;
 #endif /* CONFIG_MPC512X */
 #if defined(CONFIG_MPC5xxx)
 	bd->bi_ipbfreq = gd->ipb_clk;
Signature · 1 line
1.5.2.2
#3 lore raw

PATCH 1/1 Cleanup bus clock names.

Quoted 9 lines · In message <[email protected]> you wrote:
---
 cpu/mpc512x/fec.c             |    2 +-
 cpu/mpc512x/i2c.c             |   12 ++++++------
 cpu/mpc512x/serial.c          |    2 +-
 cpu/mpc512x/speed.c           |    4 ++--
 include/asm-ppc/global_data.h |    2 +-
 lib_ppc/board.c               |    2 +-
 6 files changed, 12 insertions(+), 12 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A fanatic is a person who can't change his mind and won't change  the
subject.                                          - Winston Churchill
#4 lore raw

PATCH 1/1 Fixed typo in macro.

In reply to Grzegorz Bernacki
Quoted 4 lines · In message <[email protected]> you wrote:
---
 include/common.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"My name is Linus Torvalds, you messed with my kernel, prepare to die"
                                                  - Linus Torvalds in
      <[email protected]>
#5 lore raw

PATCH 1/1 Added support for FDT.

In reply to Grzegorz Bernacki
Quoted 8 lines · In message <[email protected]> you wrote:
---
 board/ads5121/ads5121.c   |    8 ++++++++
 cpu/mpc512x/cpu.c         |   21 +++++++++++++++++++++
 include/asm-ppc/u-boot.h  |    3 +++
 include/configs/ads5121.h |    8 ++++++++
 lib_ppc/board.c           |    3 +++
 5 files changed, 43 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Women are more easily and more deeply terrified ...  generating  more
sheer horror than the male of the species.
	-- Spock, "Wolf in the Fold", stardate 3615.4