[U-Boot] [PATCH] Powerpc/85xx: set liodn for srio in device tree

Shaohui Xie Shaohui.Xie at freescale.com
Fri Aug 19 03:43:05 CEST 2011


Previous, U-boot did not set fsl,liodn for rapidio in device tree, which is
needed by HV(hypervisor), and HV needs fsl,liodn of rapidio have more values,
for ex for P4080, fsl,liodn = <198 199 200>; while P2040/P3041/P5020 has 4
LIODNs respectivelly.

This patch using a generic mechanism which allow a device have mutilple liodns.

Reported-and-tested-by: Diana CRACIUN <Diana.Craciun at freescale.com>
Signed-off-by: Shaohui Xie <Shaohui.Xie at freescale.com>
---
 arch/powerpc/cpu/mpc85xx/liodn.c     |   20 +++++++++++++++++---
 arch/powerpc/cpu/mpc85xx/p2041_ids.c |    8 ++++----
 arch/powerpc/cpu/mpc85xx/p3041_ids.c |    8 ++++----
 arch/powerpc/cpu/mpc85xx/p4080_ids.c |    6 +++---
 arch/powerpc/cpu/mpc85xx/p5020_ids.c |    8 ++++----
 5 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/liodn.c b/arch/powerpc/cpu/mpc85xx/liodn.c
index bd19094..5ccaaf5 100644
--- a/arch/powerpc/cpu/mpc85xx/liodn.c
+++ b/arch/powerpc/cpu/mpc85xx/liodn.c
@@ -149,7 +149,11 @@ void set_liodns(void)
 
 static void fdt_fixup_liodn_tbl(void *blob, struct liodn_id_table *tbl, int sz)
 {
-	int i;
+	int i, j;
+	int fdt_liodn[8];
+	int *p = fdt_liodn;
+	char *p_compat = NULL;
+	phys_addr_t cmp_offset = 0;
 
 	for (i = 0; i < sz; i++) {
 		int off;
@@ -160,9 +164,19 @@ static void fdt_fixup_liodn_tbl(void *blob, struct liodn_id_table *tbl, int sz)
 		off = fdt_node_offset_by_compat_reg(blob,
 				tbl[i].compat, tbl[i].compat_offset);
 		if (off >= 0) {
+			if (p_compat != NULL) {
+				if (strcmp(tbl[i].compat, p_compat))
+					p = fdt_liodn;
+				else if (cmp_offset != tbl[i].compat_offset)
+					p = fdt_liodn;
+			}
+			for (j = 0; j < tbl[i].num_ids; j++)
+				*p++ = tbl[i].id[j];
 			off = fdt_setprop(blob, off, "fsl,liodn",
-				&tbl[i].id[0],
-				sizeof(u32) * tbl[i].num_ids);
+					fdt_liodn,
+					sizeof(u32) * (p - fdt_liodn));
+			p_compat = (char *)tbl[i].compat;
+			cmp_offset = tbl[i].compat_offset;
 			if (off > 0)
 				printf("WARNING unable to set fsl,liodn for "
 					"%s: %s\n",
diff --git a/arch/powerpc/cpu/mpc85xx/p2041_ids.c b/arch/powerpc/cpu/mpc85xx/p2041_ids.c
index 112ea56..f3b2e7f 100644
--- a/arch/powerpc/cpu/mpc85xx/p2041_ids.c
+++ b/arch/powerpc/cpu/mpc85xx/p2041_ids.c
@@ -63,10 +63,10 @@ struct liodn_id_table liodn_tbl[] = {
 	SET_DMA_LIODN(1, 197),
 	SET_DMA_LIODN(2, 198),
 
-	SET_GUTS_LIODN("fsl,rapidio-delta", 199, rio1liodnr, 0),
-	SET_GUTS_LIODN(NULL, 200, rio2liodnr, 0),
-	SET_GUTS_LIODN(NULL, 201, rio1maintliodnr, 0),
-	SET_GUTS_LIODN(NULL, 202, rio2maintliodnr, 0),
+	SET_GUTS_LIODN("fsl,rapidio-delta", 199, rio1liodnr, 0xc0000),
+	SET_GUTS_LIODN("fsl,rapidio-delta", 200, rio2liodnr, 0xc0000),
+	SET_GUTS_LIODN("fsl,rapidio-delta", 201, rio1maintliodnr, 0xc0000),
+	SET_GUTS_LIODN("fsl,rapidio-delta", 202, rio2maintliodnr, 0xc0000),
 };
 int liodn_tbl_sz = ARRAY_SIZE(liodn_tbl);
 
diff --git a/arch/powerpc/cpu/mpc85xx/p3041_ids.c b/arch/powerpc/cpu/mpc85xx/p3041_ids.c
index 9836588..b1fbd74 100644
--- a/arch/powerpc/cpu/mpc85xx/p3041_ids.c
+++ b/arch/powerpc/cpu/mpc85xx/p3041_ids.c
@@ -64,10 +64,10 @@ struct liodn_id_table liodn_tbl[] = {
 	SET_DMA_LIODN(1, 197),
 	SET_DMA_LIODN(2, 198),
 
-	SET_GUTS_LIODN("fsl,rapidio-delta", 199, rio1liodnr, 0),
-	SET_GUTS_LIODN(NULL, 200, rio2liodnr, 0),
-	SET_GUTS_LIODN(NULL, 201, rio1maintliodnr, 0),
-	SET_GUTS_LIODN(NULL, 202, rio2maintliodnr, 0),
+	SET_GUTS_LIODN("fsl,rapidio-delta", 199, rio1liodnr, 0xc0000),
+	SET_GUTS_LIODN("fsl,rapidio-delta", 200, rio2liodnr, 0xc0000),
+	SET_GUTS_LIODN("fsl,rapidio-delta", 201, rio1maintliodnr, 0xc0000),
+	SET_GUTS_LIODN("fsl,rapidio-delta", 202, rio2maintliodnr, 0xc0000),
 };
 int liodn_tbl_sz = ARRAY_SIZE(liodn_tbl);
 
diff --git a/arch/powerpc/cpu/mpc85xx/p4080_ids.c b/arch/powerpc/cpu/mpc85xx/p4080_ids.c
index 560c02a..04164ba 100644
--- a/arch/powerpc/cpu/mpc85xx/p4080_ids.c
+++ b/arch/powerpc/cpu/mpc85xx/p4080_ids.c
@@ -53,9 +53,9 @@ struct liodn_id_table liodn_tbl[] = {
 	SET_DMA_LIODN(1, 196),
 	SET_DMA_LIODN(2, 197),
 
-	SET_GUTS_LIODN("fsl,rapidio-delta", 198, rio1liodnr, 0),
-	SET_GUTS_LIODN(NULL, 199, rio2liodnr, 0),
-	SET_GUTS_LIODN(NULL, 200, rmuliodnr, 0),
+	SET_GUTS_LIODN("fsl,rapidio-delta", 198, rio1liodnr, 0xc0000),
+	SET_GUTS_LIODN("fsl,rapidio-delta", 199, rio2liodnr, 0xc0000),
+	SET_GUTS_LIODN("fsl,rapidio-delta", 200, rio1maintliodnr, 0xc0000),
 
 #ifdef CONFIG_SYS_DPAA_QBMAN
 	SET_QMAN_LIODN(31),
diff --git a/arch/powerpc/cpu/mpc85xx/p5020_ids.c b/arch/powerpc/cpu/mpc85xx/p5020_ids.c
index 9836588..b1fbd74 100644
--- a/arch/powerpc/cpu/mpc85xx/p5020_ids.c
+++ b/arch/powerpc/cpu/mpc85xx/p5020_ids.c
@@ -64,10 +64,10 @@ struct liodn_id_table liodn_tbl[] = {
 	SET_DMA_LIODN(1, 197),
 	SET_DMA_LIODN(2, 198),
 
-	SET_GUTS_LIODN("fsl,rapidio-delta", 199, rio1liodnr, 0),
-	SET_GUTS_LIODN(NULL, 200, rio2liodnr, 0),
-	SET_GUTS_LIODN(NULL, 201, rio1maintliodnr, 0),
-	SET_GUTS_LIODN(NULL, 202, rio2maintliodnr, 0),
+	SET_GUTS_LIODN("fsl,rapidio-delta", 199, rio1liodnr, 0xc0000),
+	SET_GUTS_LIODN("fsl,rapidio-delta", 200, rio2liodnr, 0xc0000),
+	SET_GUTS_LIODN("fsl,rapidio-delta", 201, rio1maintliodnr, 0xc0000),
+	SET_GUTS_LIODN("fsl,rapidio-delta", 202, rio2maintliodnr, 0xc0000),
 };
 int liodn_tbl_sz = ARRAY_SIZE(liodn_tbl);
 
-- 
1.6.4




More information about the U-Boot mailing list