Skip to contentSkip to conversation

ppc/p4080: Add p4080 platform immap definitions

PATCH Superseded Kumar Gala 2 participants 12 messages Sep 19, 2009 – Sep 23, 2009 Char and misc drivers

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH v4 1/7 ppc/p4080: Add p4080 platform immap definitions

The p4080 SoC has a significant amount of commonality with the 85xx/PQ3 platform. We reuse the 85xx immap and just add new definitions for local access and global utils. The global utils is now broken into global utils, clocking and run control/power management.

The offsets from CCSR for a number of blocks have also changed. We introduce the CONFIG_FSL_CORENET define to distinquish the PQ3 style of platform from the new p4080 platform. We don't use QoirQ as there are products (like p2020) that are PQ3 based platforms but have the QoirQ name.

---
 include/asm-ppc/fsl_lbc.h    |    4 +
 include/asm-ppc/immap_85xx.h |  287 +++++++++++++++++++++++++++++++++++++++---
 2 files changed, 271 insertions(+), 20 deletions(-)
include/asm-ppc/fsl_lbc.h +4 -0
index 08d31e1..5723de6 100644
@@ -317,6 +317,10 @@
 #define LCRR_CLKDIV_2			0x00000002
 #define LCRR_CLKDIV_4			0x00000004
 #define LCRR_CLKDIV_8			0x00000008
+#elif defined(CONFIG_FSL_CORENET)
+#define LCRR_CLKDIV_8			0x00000002
+#define LCRR_CLKDIV_16			0x00000004
+#define LCRR_CLKDIV_32			0x00000008
 #else
 #define LCRR_CLKDIV_4			0x00000002
 #define LCRR_CLKDIV_8			0x00000004
include/asm-ppc/immap_85xx.h +267 -20

328 lines not on this page · raw message

Signature · 1 line
1.6.0.6
author
#1 lore raw

PATCH v4 2/7 ppc/p4080: Add support for CoreNet style platform LAWs

On CoreNet based platforms the LAW address is split between an high & low register and we no longer shift the address. Also, the target IDs on CoreNet platforms have been completely re-assigned.

Additionally, added a new find_law() API to which LAW an address hits in. This is need for the CoreNet style boot release code since it will need to determine what the target ID should be set to for boot window translation.

Finally, enamed LAWAR_EN to LAW_EN and moved to header so we can use it elsewhere.

---
* Added rename of LAWAR_EN -> LAW_EN

 drivers/misc/fsl_law.c    |   96 +++++++++++++++++++++++++++++++++++++++++++-
 include/asm-ppc/fsl_law.h |   31 ++++++++++++++
 2 files changed, 124 insertions(+), 3 deletions(-)
drivers/misc/fsl_law.c +93 -3
index aa877c6..10cfbf8 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Freescale Semiconductor, Inc.
+ * Copyright 2008-2009 Freescale Semiconductor, Inc.
  *
  * (C) Copyright 2000
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
@@ -29,7 +29,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define LAWAR_EN	0x80000000
 /* number of LAWs in the hw implementation */
 #if defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
     defined(CONFIG_MPC8560) || defined(CONFIG_MPC8555)
@@ -48,6 +47,20 @@ DECLARE_GLOBAL_DATA_PTR;
 
 void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
 {
+#ifdef CONFIG_FSL_CORENET
+	volatile ccsr_local_t *ccm =
+		(void *)(CONFIG_SYS_FSL_CORENET_CCM_ADDR);
+
+	gd->used_laws |= (1 << idx);
+
+	out_be32(&ccm->law[idx].lawar, 0);
+	out_be32(&ccm->law[idx].lawbarh, ((u64)addr >> 32));
+	out_be32(&ccm->law[idx].lawbarl, addr & 0xffffffff);
+	out_be32(&ccm->law[idx].lawar, LAW_EN | ((u32)id << 20) | (u32)sz);
+
+	/* Read back so that we sync the writes */
+	in_be32(&ccm->law[idx].lawar);
+#else
 	volatile u32 *base = (volatile u32 *)(CONFIG_SYS_IMMR + 0xc08);
 	volatile u32 *lawbar = base + 8 * idx;
 	volatile u32 *lawar = base + 8 * idx + 2;
@@ -56,10 +69,11 @@ void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
 
 	out_be32(lawar, 0);
 	out_be32(lawbar, addr >> 12);
-	out_be32(lawar, LAWAR_EN | ((u32)id << 20) | (u32)sz);
+	out_be32(lawar, LAW_EN | ((u32)id << 20) | (u32)sz);
 
 	/* Read back so that we sync the writes */
 	in_be32(lawar);
+#endif
 }
 
 int set_next_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
@@ -96,6 +110,19 @@ int set_last_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
 
 void disable_law(u8 idx)
 {
+#ifdef CONFIG_FSL_CORENET
+	volatile ccsr_local_t *ccm =
+		(void *)(CONFIG_SYS_FSL_CORENET_CCM_ADDR);
+
+	gd->used_laws &= ~(1 << idx);
+
+	out_be32(&ccm->law[idx].lawar, 0);
+	out_be32(&ccm->law[idx].lawbarh, 0);
+	out_be32(&ccm->law[idx].lawbarl, 0);
+
+	/* Read back so that we sync the writes */
+	in_be32(&ccm->law[idx].lawar);
+#else
 	volatile u32 *base = (volatile u32 *)(CONFIG_SYS_IMMR + 0xc08);
 	volatile u32 *lawbar = base + 8 * idx;
 	volatile u32 *lawar = base + 8 * idx + 2;
@@ -105,9 +132,66 @@ void disable_law(u8 idx)
 	out_be32(lawar, 0);
 	out_be32(lawbar, 0);
 
+	/* Read back so that we sync the writes */
+	in_be32(lawar);
+#endif
+
 	return;
 }
 
+#ifdef CONFIG_FSL_CORENET
+#define GET_LAW_ADDR ((u64)in_be32(lawbarh) << 32) | in_be32(lawbarl)
+#else
+#define GET_LAW_ADDR ((u64)in_be32(lawbar) << 12)
+#endif
+
+struct law_entry find_law(phys_addr_t addr)
+{
+	struct law_entry entry;
+	int i;
+
+	entry.index = -1;
+	entry.addr = 0;
+	entry.size = 0;
+	entry.trgt_id = 0;
+
+	for(i = 0; i < FSL_HW_NUM_LAWS; i++) {
+
+		u64 upper;
+		u32 temp;
+#ifdef CONFIG_FSL_CORENET
+		volatile ccsr_local_t *ccm;
+		volatile u32 *lawbarh, *lawbarl, *lawar;
+
+		ccm = (void *)(CONFIG_SYS_FSL_CORENET_CCM_ADDR);
+
+		lawbarh = &ccm->law[i].lawbarh;
+		lawbarl = &ccm->law[i].lawbarl;
+		lawar = &ccm->law[i].lawar;
+#else
+		volatile u32 *base = (volatile u32 *)(CONFIG_SYS_IMMR + 0xc08);
+		volatile u32 *lawbar = base + 8 * i;
+		volatile u32 *lawar = base + 8 * i + 2;
+#endif
+		temp = in_be32(lawar);
+
+		if (!(temp & LAW_EN))
+			continue;
+
+		entry.addr = GET_LAW_ADDR;
+		entry.size = temp & 0x3f;
+		entry.trgt_id = (temp >> 20) & 0xff;
+
+		upper = entry.addr + (2ull << entry.size);
+		if ((addr >= entry.addr) && (addr < upper)) {
+			entry.index = i;
+			break;
+		}
+	}
+
+	return entry;
+}
+
 void print_laws(void)
 {
 	volatile u32 *base = (volatile u32 *)(CONFIG_SYS_IMMR + 0xc08);
@@ -173,7 +257,13 @@ void init_laws(void)
 {
 	int i;
 
+#if FSL_HW_NUM_LAWS < 32
 	gd->used_laws = ~((1 << FSL_HW_NUM_LAWS) - 1);
+#elif FSL_HW_NUM_LAWS == 32
+	gd->used_laws = 0;
+#else
+#error FSL_HW_NUM_LAWS can not be greater than 32 w/o code changes
+#endif
 
 	for (i = 0; i < num_law_entries; i++) {
 		if (law_table[i].index == -1)
include/asm-ppc/fsl_law.h +31 -0
index e06a1a6..31bb754 100644
@@ -1,8 +1,18 @@
+/*
+ * Copyright 2008-2009 Freescale Semiconductor, Inc.
+ *
+ * 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.
+ */
+
 #ifndef _FSL_LAW_H_
 #define _FSL_LAW_H_
 
 #include <asm/io.h>
 
+#define LAW_EN	0x80000000
+
 #define SET_LAW_ENTRY(idx, a, sz, trgt) \
 	{ .index = idx, .addr = a, .size = sz, .trgt_id = trgt }
 
@@ -36,6 +46,25 @@ enum law_size {
 	LAW_SIZE_32G,
 };
 
+#ifdef CONFIG_FSL_CORENET
+enum law_trgt_if {
+	LAW_TRGT_IF_PCIE_1 = 0x00,
+	LAW_TRGT_IF_PCIE_2 = 0x01,
+	LAW_TRGT_IF_PCIE_3 = 0x02,
+	LAW_TRGT_IF_RIO_1 = 0x08,
+	LAW_TRGT_IF_RIO_2 = 0x09,
+
+	LAW_TRGT_IF_DDR_1 = 0x10,
+	LAW_TRGT_IF_DDR_2 = 0x11,	/* 2nd controller */
+	LAW_TRGT_IF_DDR_INTRLV = 0x14,
+
+	LAW_TRGT_IF_BMAN = 0x18,
+	LAW_TRGT_IF_DCSR = 0x1d,
+	LAW_TRGT_IF_LBC = 0x1f,
+	LAW_TRGT_IF_QMAN = 0x3c,
+};
+#define LAW_TRGT_IF_DDR		LAW_TRGT_IF_DDR_1
+#else
 enum law_trgt_if {
 	LAW_TRGT_IF_PCI = 0x00,
 	LAW_TRGT_IF_PCI_2 = 0x01,
@@ -64,6 +93,7 @@ enum law_trgt_if {
 #if defined(CONFIG_MPC8572) || defined(CONFIG_P2020)
 #define LAW_TRGT_IF_PCIE_3	LAW_TRGT_IF_PCI
 #endif
+#endif /* CONFIG_FSL_CORENET */
 
 struct law_entry {
 	int index;
@@ -76,6 +106,7 @@ extern void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if
 extern int set_next_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id);
 extern int set_last_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id);
 extern int set_ddr_laws(u64 start, u64 sz, enum law_trgt_if id);
+extern struct law_entry find_law(phys_addr_t addr);
 extern void disable_law(u8 idx);
 extern void init_laws(void);
 extern void print_laws(void);
Signature · 1 line
1.6.0.6
author
#2 lore raw

PATCH v4 3/7 ppc/p4080: CoreNet platfrom style CCSRBAR setting

On CoreNet based platforms the CCSRBAR address is split between an high & low register and we no longer shift the address.

---
* Fixup for LAW_EN

 cpu/mpc85xx/cpu_init_early.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
cpu/mpc85xx/cpu_init_early.c +29 -0
index 7886f86..a12847d 100644
@@ -54,6 +54,9 @@ void cpu_init_early_f(void)
 		u32 temp;
 		volatile u32 *ccsr_virt =
 			(volatile u32 *)(CONFIG_SYS_CCSRBAR + 0x1000);
+#ifdef CONFIG_FSL_CORENET
+		volatile ccsr_local_t *ccm;
+#endif
 
 		mas0 = MAS0_TLBSEL(0) | MAS0_ESEL(1);
 		/* mas1 is the same as above */
@@ -64,9 +67,35 @@ void cpu_init_early_f(void)
 
 		write_tlb(mas0, mas1, mas2, mas3, mas7);
 
+#ifdef CONFIG_FSL_CORENET
+		/*
+		 * We can't call set_law() because we haven't moved
+		 * CCSR yet.
+		 */
+		ccm = (void *)ccsr_virt;
+
+		out_be32(&ccm->law[0].lawbarh,
+			(u64)CONFIG_SYS_CCSRBAR_PHYS >> 32);
+		out_be32(&ccm->law[0].lawbarl, (u32)CONFIG_SYS_CCSRBAR_PHYS);
+		out_be32(&ccm->law[0].lawar,
+			LAW_EN | (0x1e << 20) | LAW_SIZE_4K);
+
+		in_be32((u32 *)(ccsr_virt + 0));
+		in_be32((u32 *)(ccsr_virt + 1));
+		isync();
+
+		ccm = (void *)CONFIG_SYS_CCSRBAR;
+		/* Now use the temporary LAW to move CCSR */
+		out_be32(&ccm->ccsrbarh, (u64)CONFIG_SYS_CCSRBAR_PHYS >> 32);
+		out_be32(&ccm->ccsrbarl, (u32)CONFIG_SYS_CCSRBAR_PHYS);
+		out_be32(&ccm->ccsrar, CCSRAR_C);
+		temp = in_be32(&ccm->ccsrar);
+		disable_law(0);
+#else
 		temp = in_be32(ccsr_virt);
 		out_be32(ccsr_virt, CONFIG_SYS_CCSRBAR_PHYS >> 12);
 		temp = in_be32((volatile u32 *)CONFIG_SYS_CCSRBAR);
+#endif
 	}
 #endif
 
Signature · 1 line
1.6.0.6
author
#3 lore raw

PATCH v4 4/7 ppc/p4080: CoreNet platfrom style secondary core release

The CoreNet platform style of bringing secondary cores out of reset is a bit different that the PQ3 style. Mostly the registers that we use to setup boot translation, enable time bases, and boot release the cores have moved around.

---
* Fix up for LAW_EN, and use LAW_SIZE_4K instead of LAWAR_SIZE_4K

 cpu/mpc85xx/mp.c |   68 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 67 insertions(+), 1 deletions(-)
cpu/mpc85xx/mp.c +67 -1
index fa65bed..59c4fb6 100644
@@ -26,6 +26,7 @@
 #include <lmb.h>
 #include <asm/io.h>
 #include <asm/mmu.h>
+#include <asm/fsl_law.h>
 #include "mp.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -135,6 +136,66 @@ ulong get_spin_addr(void)
 	return addr;
 }
 
+#ifdef CONFIG_FSL_CORENET
+static void corenet_mp_up(unsigned long bootpg)
+{
+	u32 up, cpu_up_mask, whoami;
+	u32 *table = (u32 *)get_spin_addr();
+	volatile ccsr_gur_t *gur;
+	volatile ccsr_local_t *ccm;
+	volatile ccsr_rcpm_t *rcpm;
+	volatile ccsr_pic_t *pic;
+	int timeout = 10;
+	u32 nr_cpus;
+	struct law_entry e;
+
+	gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+	ccm = (void *)(CONFIG_SYS_FSL_CORENET_CCM_ADDR);
+	rcpm = (void *)(CONFIG_SYS_FSL_CORENET_RCPM_ADDR);
+	pic = (void *)(CONFIG_SYS_MPC85xx_PIC_ADDR);
+
+	nr_cpus = ((in_be32(&pic->frr) >> 8) & 0xff) + 1;
+
+	whoami = in_be32(&pic->whoami);
+	cpu_up_mask = 1 << whoami;
+	out_be32(&ccm->bstrl, bootpg);
+
+	e = find_law(bootpg);
+	out_be32(&ccm->bstrar, LAW_EN | e.trgt_id << 20 | LAW_SIZE_4K);
+
+	/* disable time base@the platform */
+	out_be32(&rcpm->ctbenrl, cpu_up_mask);
+
+	/* release the hounds */
+	up = ((1 << nr_cpus) - 1);
+	out_be32(&gur->brrl, up);
+
+	/* wait for everyone */
+	while (timeout) {
+		int i;
+		for (i = 0; i < nr_cpus; i++) {
+			if (table[i * NUM_BOOT_ENTRY + BOOT_ENTRY_ADDR_LOWER])
+				cpu_up_mask |= (1 << i);
+		};
+
+		if ((cpu_up_mask & up) == up)
+			break;
+
+		udelay(100);
+		timeout--;
+	}
+
+	if (timeout == 0)
+		printf("CPU up timeout. CPU up mask is %x should be %x\n",
+			cpu_up_mask, up);
+
+	/* enable time base@the platform */
+	out_be32(&rcpm->ctbenrl, 0);
+	mtspr(SPRN_TBWU, 0);
+	mtspr(SPRN_TBWL, 0);
+	out_be32(&rcpm->ctbenrl, (1 << nr_cpus) - 1);
+}
+#else
 static void pq3_mp_up(unsigned long bootpg)
 {
 	u32 up, cpu_up_mask, whoami;
@@ -196,6 +257,7 @@ static void pq3_mp_up(unsigned long bootpg)
 	devdisr &= ~(MPC85xx_DEVDISR_TB0 | MPC85xx_DEVDISR_TB1);
 	out_be32(&gur->devdisr, devdisr);
 }
+#endif
 
 void cpu_mp_lmb_reserve(struct lmb *lmb)
 {
@@ -217,7 +279,7 @@ void setup_mp(void)
 	if (i != -1) {
 		/* map reset page to bootpg so we can copy code there */
 		disable_tlb(i);
-	
+
 		set_tlb(1, 0xfffff000, bootpg, /* tlb, epn, rpn */
 			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M, /* perms, wimge */
 			0, i, BOOKE_PAGESZ_4K, 1); /* ts, esel, tsize, iprot */
@@ -234,7 +296,11 @@ void setup_mp(void)
 			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I, /* perms, wimge */
 			0, i, BOOKE_PAGESZ_4K, 1); /* ts, esel, tsize, iprot */
 
+#ifdef CONFIG_FSL_CORENET
+		corenet_mp_up(bootpg);
+#else
 		pq3_mp_up(bootpg);
+#endif
 	} else {
 		puts("WARNING: No reset page TLB. "
 			"Skipping secondary core setup\n");
Signature · 1 line
1.6.0.6
author
#4 lore raw

PATCH v4 5/7 ppc/p4080: Add various p4080 related defines (and p4040)

There are various locations that we have chip specific info:

* Makefile for which ddr code to build
* Added p4080 & p4040 to cpu_type_list and SVR list
* Added number of LAWs for p4080
* Set CONFIG_MAX_CPUS to 8 for p4080

---
 cpu/mpc85xx/Makefile        |    1 +
 cpu/mpc8xxx/cpu.c           |    4 ++++
 drivers/misc/fsl_law.c      |    2 ++
 include/asm-ppc/config.h    |    6 ++++--
 include/asm-ppc/processor.h |    4 ++++
 5 files changed, 15 insertions(+), 2 deletions(-)
cpu/mpc85xx/Makefile +1 -0
index 3ef00e8..56de7eb 100644
@@ -53,6 +53,7 @@ COBJS-$(CONFIG_P1011)	+= ddr-gen3.o
 COBJS-$(CONFIG_P1020)	+= ddr-gen3.o
 COBJS-$(CONFIG_P2010)	+= ddr-gen3.o
 COBJS-$(CONFIG_P2020)	+= ddr-gen3.o
+COBJS-$(CONFIG_PPC_P4080)	+= ddr-gen3.o
 
 COBJS-$(CONFIG_CPM2)	+= ether_fcc.o
 COBJS-$(CONFIG_OF_LIBFDT) += fdt.o
cpu/mpc8xxx/cpu.c +4 -0
index 00791e1..d191263 100644
@@ -72,6 +72,10 @@ struct cpu_type cpu_type_list [] = {
 	CPU_TYPE_ENTRY(P2010, P2010_E, 1),
 	CPU_TYPE_ENTRY(P2020, P2020, 2),
 	CPU_TYPE_ENTRY(P2020, P2020_E, 2),
+	CPU_TYPE_ENTRY(P4040, P4040, 4),
+	CPU_TYPE_ENTRY(P4040, P4040_E, 4),
+	CPU_TYPE_ENTRY(P4080, P4080, 8),
+	CPU_TYPE_ENTRY(P4080, P4080_E, 8),
 #elif defined(CONFIG_MPC86xx)
 	CPU_TYPE_ENTRY(8610, 8610, 1),
 	CPU_TYPE_ENTRY(8641, 8641, 2),
drivers/misc/fsl_law.c +2 -0
index c61e1f5..1d16fd1 100644
@@ -41,6 +41,8 @@ DECLARE_GLOBAL_DATA_PTR;
       defined(CONFIG_P1011) || defined(CONFIG_P1020) || \
       defined(CONFIG_P2010) || defined(CONFIG_P2020)
 #define FSL_HW_NUM_LAWS 12
+#elif defined(CONFIG_PPC_P4080)
+#define FSL_HW_NUM_LAWS 32
 #else
 #error FSL_HW_NUM_LAWS not defined for this platform
 #endif
include/asm-ppc/config.h +4 -2
index 5670d06..e35b0b7 100644
@@ -40,9 +40,11 @@
 
 #if defined(CONFIG_MPC8572) || defined(CONFIG_P1020) || \
 	defined(CONFIG_P2020) || defined(CONFIG_MPC8641)
-#define CONFIG_MAX_CPUS        2
+#define CONFIG_MAX_CPUS		2
+#elif defined(CONFIG_PPC_P4080)
+#define CONFIG_MAX_CPUS		8
 #else
-#define CONFIG_MAX_CPUS        1
+#define CONFIG_MAX_CPUS		1
 #endif
 
 #endif /* _ASM_CONFIG_H_ */
include/asm-ppc/processor.h +4 -0
index 3764a5a..d009957 100644
@@ -1031,6 +1031,10 @@
 #define SVR_P2010_E	0x80EB00
 #define SVR_P2020	0x80E200
 #define SVR_P2020_E	0x80EA00
+#define SVR_P4040	0x820100
+#define SVR_P4040_E	0x820900
+#define SVR_P4080	0x820000
+#define SVR_P4080_E	0x820800
 
 #define SVR_8610	0x80A000
 #define SVR_8641	0x809000
Signature · 1 line
1.6.0.6
author
#5 lore raw

PATCH v4 6/7 ppc/p4080: Handle timebase enabling and frequency reporting

On CoreNet style platforms the timebase frequency is the bus frequency defined by 16 (on PQ3 it is divide by 8). Also on the CoreNet platforms the core not longer controls the enabling of the timebase. We now need to enable the boot core's timebase via CCSR register writes.

---
 cpu/mpc85xx/cpu.c      |    4 ++++
 cpu/mpc85xx/cpu_init.c |   12 ++++++++++++
 cpu/mpc85xx/fdt.c      |    4 ++--
 3 files changed, 18 insertions(+), 2 deletions(-)
cpu/mpc85xx/cpu.c +4 -0
index bdd9ee4..25c0416 100644
@@ -184,7 +184,11 @@ int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
  */
 unsigned long get_tbclk (void)
 {
+#ifdef CONFIG_FSL_CORENET
+	return (gd->bus_clk + 8) / 16;
+#else
 	return (gd->bus_clk + 4UL)/8UL;
+#endif
 }
 
 
cpu/mpc85xx/cpu_init.c +12 -0
index a6d1e99..428b461 100644
@@ -229,6 +229,18 @@ void cpu_init_f (void)
 #if defined(CONFIG_FSL_DMA)
 	dma_init();
 #endif
+#ifdef CONFIG_FSL_CORENET
+	{
+		volatile ccsr_rcpm_t *rcpm =
+			(void *)(CONFIG_SYS_FSL_CORENET_RCPM_ADDR);
+		volatile ccsr_pic_t *pic =
+			(void *)(CONFIG_SYS_MPC85xx_PIC_ADDR);
+		u32 whoami = in_be32(&pic->whoami);
+
+		/* Enable the timebase register for this core */
+		out_be32(&rcpm->ctbenrl, (1 << whoami));
+	}
+#endif
 }
 
 
cpu/mpc85xx/fdt.c +2 -2
index 723f473..64a1710 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Freescale Semiconductor, Inc.
+ * Copyright 2007-2009 Freescale Semiconductor, Inc.
  *
  * (C) Copyright 2000
  * Wolfgang Denk, DENX Software Engineering, [email protected].
@@ -287,7 +287,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	fdt_add_enet_stashing(blob);
 
 	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
-		"timebase-frequency", bd->bi_busfreq / 8, 1);
+		"timebase-frequency", get_tbclk(), 1);
 	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
 		"bus-frequency", bd->bi_busfreq, 1);
 	get_sys_info(&sysinfo);
Signature · 1 line
1.6.0.6
author
#6 lore raw

PATCH v4 7/7 ppc/p4080: Determine various chip frequencies on CoreNet platforms

The means to determine the core, bus, and DDR frequencies are completely new on CoreNet style platforms. Additionally on p4080 we can have different frequencies for FMAN and PME IP blocks. We need to keep track of the FMAN & PME frequencies since they are used for time stamping capabilities inside each block.

---
 cpu/mpc85xx/cpu.c   |   29 +++++++++++++++++
 cpu/mpc85xx/speed.c |   85 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/e500.h      |    6 +++
 3 files changed, 120 insertions(+), 0 deletions(-)
cpu/mpc85xx/cpu.c +29 -0
index 25c0416..1c0f2b2 100644
@@ -46,11 +46,20 @@ int checkcpu (void)
 	char buf1[32], buf2[32];
 #ifdef CONFIG_DDR_CLK_FREQ
 	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+#ifdef CONFIG_FSL_CORENET
+	u32 ddr_sync = ((gur->rcwsr[5]) & FSL_CORENET_RCWSR5_DDR_SYNC)
+		>> FSL_CORENET_RCWSR5_DDR_SYNC_SHIFT;
+#else
 	u32 ddr_ratio = ((gur->porpllsr) & MPC85xx_PORPLLSR_DDR_RATIO)
 		>> MPC85xx_PORPLLSR_DDR_RATIO_SHIFT;
+#endif
+#else
+#ifdef CONFIG_FSL_CORENET
+	u32 ddr_sync = 0;
 #else
 	u32 ddr_ratio = 0;
 #endif
+#endif
 	int i;
 
 	svr = get_svr();
@@ -111,6 +120,16 @@ int checkcpu (void)
 	}
 	printf("\n       CCB:%-4s MHz,\n", strmhz(buf1, sysinfo.freqSystemBus));
 
+#ifdef CONFIG_FSL_CORENET
+	if (ddr_sync == 1)
+		printf("       DDR:%-4s MHz (%s MT/s data rate) (Synchronous), ",
+			strmhz(buf1, sysinfo.freqDDRBus/2),
+			strmhz(buf2, sysinfo.freqDDRBus));
+	else
+		printf("       DDR:%-4s MHz (%s MT/s data rate) (Asynchronous), ",
+			strmhz(buf1, sysinfo.freqDDRBus/2),
+			strmhz(buf2, sysinfo.freqDDRBus));
+#else
 	switch (ddr_ratio) {
 	case 0x0:
 		printf("       DDR:%-4s MHz (%s MT/s data rate), ",
@@ -128,6 +147,7 @@ int checkcpu (void)
 			strmhz(buf2, sysinfo.freqDDRBus));
 		break;
 	}
+#endif
 
 	if (sysinfo.freqLocalBus > LCRR_CLKDIV)
 		printf("LBC:%-4s MHz\n", strmhz(buf1, sysinfo.freqLocalBus));
@@ -143,6 +163,15 @@ int checkcpu (void)
 	printf("       QE:%-4s MHz\n", strmhz(buf1, sysinfo.freqQE));
 #endif
 
+#ifdef CONFIG_SYS_DPAA_FMAN
+	for (i = 0; i < CONFIG_SYS_NUM_FMAN; i++)
+		printf("       FMAN%d: %s MHz\n", i, strmhz(buf1, sysinfo.freqFMan[i]));
+#endif
+
+#ifdef CONFIG_SYS_DPAA_PME
+	printf("       PME:   %s MHz\n", strmhz(buf1, sysinfo.freqPME));
+#endif
+
 	puts("L1:    D-cache 32 kB enabled\n       I-cache 32 kB enabled\n");
 
 	return 0;
cpu/mpc85xx/speed.c +85 -0

102 lines not on this page · raw message

include/e500.h +6 -0
index f8c8266..e1708b9 100644
@@ -15,6 +15,12 @@ typedef struct
   unsigned long freqDDRBus;
   unsigned long freqLocalBus;
   unsigned long freqQE;
+#ifdef CONFIG_SYS_DPAA_FMAN
+  unsigned long freqFMan[CONFIG_SYS_NUM_FMAN];
+#endif
+#ifdef CONFIG_SYS_DPAA_PME
+  unsigned long freqPME;
+#endif
 } MPC85xx_SYS_INFO;
 
 #endif  /* _ASMLANGUAGE */
Signature · 1 line
1.6.0.6
#7 lore raw

PATCH v4 7/7 ppc/p4080: Determine various chip frequencies on CoreNet platforms

Dear Kumar Gala,

Quoted 25 lines · In message <[email protected]> you…

The means to determine the core, bus, and DDR frequencies are completely new on CoreNet style platforms. Additionally on p4080 we can have different frequencies for FMAN and PME IP blocks. We need to keep track of the FMAN & PME frequencies since they are used for time stamping capabilities inside each block.

---
 cpu/mpc85xx/cpu.c   |   29 +++++++++++++++++
 cpu/mpc85xx/speed.c |   85 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/e500.h      |    6 +++
 3 files changed, 120 insertions(+), 0 deletions(-)
cpu/mpc85xx/cpu.c +4 -0
index 25c0416..1c0f2b2 100644
@@ -46,11 +46,20 @@ int checkcpu (void)
 	char buf1[32], buf2[32];
 #ifdef CONFIG_DDR_CLK_FREQ
 	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+#ifdef CONFIG_FSL_CORENET
+	u32 ddr_sync = ((gur->rcwsr[5]) & FSL_CORENET_RCWSR5_DDR_SYNC)
+		>> FSL_CORENET_RCWSR5_DDR_SYNC_SHIFT;
+#else

cpu/mpc85xx/cpu.c int checkcpu (void) · line 62

Quoted 10 lines
cpu/mpc85xx/cpu.c +5 -0
 	u32 ddr_ratio = ((gur->porpllsr) & MPC85xx_PORPLLSR_DDR_RATIO)
 		>> MPC85xx_PORPLLSR_DDR_RATIO_SHIFT;
+#endif
+#else
+#ifdef CONFIG_FSL_CORENET
+	u32 ddr_sync = 0;
 #else
 	u32 ddr_ratio = 0;
 #endif
+#endif

Please make this

	#endif /* CONFIG_DDR_CLK_FREQ */

so we can see more easily what ends wher ein this #ifdef hell.

cpu/mpc85xx/cpu.c int checkcpu (void) · line 131

Quoted 9 lines
cpu/mpc85xx/cpu.c +9 -0
+#ifdef CONFIG_FSL_CORENET
+	if (ddr_sync == 1)
+		printf("       DDR:%-4s MHz (%s MT/s data rate) (Synchronous), ",
+			strmhz(buf1, sysinfo.freqDDRBus/2),
+			strmhz(buf2, sysinfo.freqDDRBus));
+	else
+		printf("       DDR:%-4s MHz (%s MT/s data rate) (Asynchronous), ",
+			strmhz(buf1, sysinfo.freqDDRBus/2),
+			strmhz(buf2, sysinfo.freqDDRBus));

Please use braces around multi-line statements.

...

cpu/mpc85xx/cpu.c

Quoted 6 lines
cpu/mpc85xx/cpu.c +6 -0
+	rcw_tmp = in_be32(&gur->rcwsr[3]);
+	for (i = 0; i < cpu_numcores(); i++) {
+		u32 c_pll_sel = (in_be32(&clk->clkc0csr + i*8) >> 27) & 0xf;
+		u32 cplx_pll = core_cplx_PLL[c_pll_sel];
+
+		sysInfo->freqProcessor[i] = freqCC_PLL[cplx_pll] / core_cplx_PLL_div[c_pll_sel];

Line too long, please check globally.

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
What about WRITING it first and rationalizing it afterwords?  :-)
                       - Larry Wall in <[email protected]>
#8 lore raw

PATCH v4 6/7 ppc/p4080: Handle timebase enabling and frequency reporting

In reply to Kumar Gala

Dear Kumar Gala,

Quoted 6 lines · In message <[email protected]> you…

On CoreNet style platforms the timebase frequency is the bus frequency defined by 16 (on PQ3 it is divide by 8). Also on the CoreNet platforms the core not longer controls the enabling of the timebase. We now need to enable the boot core's timebase via CCSR register writes.

...

Quoted 10 lines
cpu/mpc85xx/cpu_init.c +2 -0
index a6d1e99..428b461 100644
@@ -229,6 +229,18 @@ void cpu_init_f (void)
 #if defined(CONFIG_FSL_DMA)
 	dma_init();
 #endif
+#ifdef CONFIG_FSL_CORENET
+	{

cpu/mpc85xx/cpu_init.c void cpu_init_f (void) · line 243

Quoted 10 lines
cpu/mpc85xx/cpu_init.c +10 -0
+		volatile ccsr_rcpm_t *rcpm =
+			(void *)(CONFIG_SYS_FSL_CORENET_RCPM_ADDR);
+		volatile ccsr_pic_t *pic =
+			(void *)(CONFIG_SYS_MPC85xx_PIC_ADDR);
+		u32 whoami = in_be32(&pic->whoami);
+
+		/* Enable the timebase register for this core */
+		out_be32(&rcpm->ctbenrl, (1 << whoami));
+	}
+#endif

Please do not add variable declarations right in the middle of a function.

Best regards,

Wolfgang Denk

Signature · 4 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
panic: kernel trap (ignored)
#9 lore raw

PATCH v4 1/7 ppc/p4080: Add p4080 platform immap definitions

In reply to Kumar Gala

Dear Kumar Gala,

Quoted 11 lines · In message <[email protected]> you…

The p4080 SoC has a significant amount of commonality with the 85xx/PQ3 platform. We reuse the 85xx immap and just add new definitions for local access and global utils. The global utils is now broken into global utils, clocking and run control/power management.

The offsets from CCSR for a number of blocks have also changed. We introduce the CONFIG_FSL_CORENET define to distinquish the PQ3 style of platform from the new p4080 platform. We don't use QoirQ as there are products (like p2020) that are PQ3 based platforms but have the QoirQ name.

Quoted 5 lines
---
 include/asm-ppc/fsl_lbc.h    |    4 +
 include/asm-ppc/immap_85xx.h |  287 +++++++++++++++++++++++++++++++++++++++---
 2 files changed, 271 insertions(+), 20 deletions(-)

Why are you reposting? What was changed compared to v3?

Quoted 20 lines
include/asm-ppc/fsl_lbc.h +4 -0
index 08d31e1..5723de6 100644
@@ -317,6 +317,10 @@
 #define LCRR_CLKDIV_2			0x00000002
 #define LCRR_CLKDIV_4			0x00000004
 #define LCRR_CLKDIV_8			0x00000008
+#elif defined(CONFIG_FSL_CORENET)
+#define LCRR_CLKDIV_8			0x00000002
+#define LCRR_CLKDIV_16			0x00000004
+#define LCRR_CLKDIV_32			0x00000008
 #else
 #define LCRR_CLKDIV_4			0x00000002
 #define LCRR_CLKDIV_8			0x00000004
include/asm-ppc/immap_85xx.h +0 -0
index e7d412d..3e6ed85 100644

include/asm-ppc/immap_85xx.h line 23

Quoted 8 lines
include/asm-ppc/immap_85xx.h +5 -0
@@ -16,6 +16,29 @@
 #include <asm/fsl_i2c.h>
 #include <asm/fsl_lbc.h>
 
+typedef struct ccsr_local {
+	u32	ccsrbarh;	/* 0x0 - Control Configuration Status Registers Base Address Register High */
+	u32	ccsrbarl;	/* 0x4 - Control Configuration Status Registers Base Address Register Low */
+	u32	ccsrar;		/* 0x8 - Configuration, Control, and Status Attribute Register */
+#define CCSRAR_C	0x80000000	/* Commit */

Seems my previous comments still apply - lines are wayyyyy to long.

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
Don't tell me how hard you work.  Tell me how much you get done.
                                                     -- James J. Ling
author
#10 lore raw

PATCH v4 1/7 ppc/p4080: Add p4080 platform immap definitions

Quoted 51 lines · Wolfgang Denk

Dear Kumar Gala,

In message <[email protected]

Quoted 15 lines

you wrote:
The p4080 SoC has a significant amount of commonality with the 85xx/ PQ3
platform. We reuse the 85xx immap and just add new definitions for local access and global utils. The global utils is now broken into global utils, clocking and run control/power management.

The offsets from CCSR for a number of blocks have also changed. We introduce the CONFIG_FSL_CORENET define to distinquish the PQ3 style of
platform from the new p4080 platform. We don't use QoirQ as there are
products (like p2020) that are PQ3 based platforms but have the QoirQ name.

Quoted 6 lines

---
include/asm-ppc/fsl_lbc.h | 4 +
include/asm-ppc/immap_85xx.h | 287 ++++++++++++++++++++++++++++++++
+++++++---

2 files changed, 271 insertions(+), 20 deletions(-)

Why are you reposting? What was changed compared to v3?

Quoted 24 lines
include/asm-ppc/fsl_lbc.h +4 -0
index 08d31e1..5723de6 100644
@@ -317,6 +317,10 @@
 #define LCRR_CLKDIV_2			0x00000002
 #define LCRR_CLKDIV_4			0x00000004
 #define LCRR_CLKDIV_8			0x00000008
+#elif defined(CONFIG_FSL_CORENET)
+#define LCRR_CLKDIV_8			0x00000002
+#define LCRR_CLKDIV_16			0x00000004
+#define LCRR_CLKDIV_32			0x00000008
 #else
 #define LCRR_CLKDIV_4			0x00000002
 #define LCRR_CLKDIV_8			0x00000004
include/asm-ppc/ renamed from include/asm-ppc/immap_85xx.h +0 -0

immap_85xx.h
index e7d412d..3e6ed85 100644

include/asm-ppc/immap_85xx.h +0 -0
@@ -16,6 +16,29 @@
 #include <asm/fsl_i2c.h>
 #include <asm/fsl_lbc.h>
 
Quoted 10 lines
Quoted 8 lines
include/asm-ppc/immap_85xx.h +2 -0
+typedef struct ccsr_local {
+	u32	ccsrbarh;	/* 0x0 - Control Configuration Status Registers  

Base Address Register High */

include/asm-ppc/immap_85xx.h +1 -0
+	u32	ccsrbarl;	/* 0x4 - Control Configuration Status Registers  

Base Address Register Low */

include/asm-ppc/immap_85xx.h +1 -0
+	u32	ccsrar;		/* 0x8 - Configuration, Control, and Status  

Attribute Register */
+#define CCSRAR_C 0x80000000 /* Commit */

Seems my previous comments still apply - lines are wayyyyy to long.

Dope, posted the wrong version. I agree w/the long lines, not sure what to do about it. Move to something like:

typedef struct ccsr_local {
	/* 0x0 - Control Configuration Status Registers Base Address Register  
High */
	u32	ccsrbarh;	
	/* 0x4 - Control Configuration Status Registers Base Address Register  
Low */
	u32	ccsrbarl;	

...

even this exceeds the 80 column limit.

- k

#11 lore raw

PATCH v4 1/7 ppc/p4080: Add p4080 platform immap definitions

Dear Kumar Gala,

Quoted 12 lines · In message <[email protected]> you wrote:

Dope, posted the wrong version. I agree w/the long lines, not sure what to do about it. Move to something like:

typedef struct ccsr_local {
	/* 0x0 - Control Configuration Status Registers Base Address Register  
High */
	u32	ccsrbarh;	
	/* 0x4 - Control Configuration Status Registers Base Address Register  
Low */
	u32	ccsrbarl;	
Quoted 3 lines

...

even this exceeds the 80 column limit.

Why do you need to carry the offset in the comment?

What about:

Control Config Status Regs Base Addr Reg ?

or

BAR = Base Address Register (once initially)

Control Config Status Regs BAR ?

Best regards,

Wolfgang Denk

Signature · 4 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
Time is an illusion perpetrated by the manufacturers of space.