Skip to contentSkip to conversation

powerpc/85xx: Fix SRIO LAW setup on corenet_ds boards

PATCH New Kumar Gala 2 participants 3 messages Aug 18, 2010 – Aug 19, 2010

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 powerpc/85xx: Fix SRIO LAW setup on corenet_ds boards

From: Lian Minghuan <[email protected]>

In funciton board_early_init_r(), serdes does not initialize yet. variable "serdes_prtcl_map" in function is_serdes_configured() does not initialize. sRIO will always be disable.

In the original code, there is a undefined variable gur if SRIO is not defined.

---
 board/freescale/corenet_ds/corenet_ds.c |   47 ++++++++++++++++--------------
 1 files changed, 25 insertions(+), 22 deletions(-)
board/freescale/corenet_ds/corenet_ds.c +25 -22
index 3cdefb3..48d95d6 100644
@@ -23,6 +23,7 @@
 #include <common.h>
 #include <command.h>
 #include <netdev.h>
+#include <linux/compiler.h>
 #include <asm/mmu.h>
 #include <asm/processor.h>
 #include <asm/cache.h>
@@ -120,28 +121,6 @@ int board_early_init_r(void)
 	set_liodns();
 	setup_portals();
 
-#ifdef CONFIG_SRIO1
-	if (is_serdes_configured(SRIO1)) {
-		set_next_law(CONFIG_SYS_RIO1_MEM_PHYS, LAW_SIZE_256M,
-				LAW_TRGT_IF_RIO_1);
-	} else {
-		printf ("    SRIO1: disabled\n");
-	}
-#else
-	setbits_be32(&gur->devdisr, FSL_CORENET_DEVDISR_SRIO1); /* disable */
-#endif
-
-#ifdef CONFIG_SRIO2
-	if (is_serdes_configured(SRIO2)) {
-		set_next_law(CONFIG_SYS_RIO2_MEM_PHYS, LAW_SIZE_256M,
-				LAW_TRGT_IF_RIO_2);
-	} else {
-		printf ("    SRIO2: disabled\n");
-	}
-#else
-	setbits_be32(&gur->devdisr, FSL_CORENET_DEVDISR_SRIO2); /* disable */
-#endif
-
 	return 0;
 }
 
@@ -164,10 +143,34 @@ static const char *serdes_clock_to_string(u32 clock)
 int misc_init_r(void)
 {
 	serdes_corenet_t *srds_regs = (void *)CONFIG_SYS_FSL_CORENET_SERDES_ADDR;
+	__maybe_unused ccsr_gur_t *gur;
 	u32 actual[NUM_SRDS_BANKS];
 	unsigned int i;
 	u8 sw3;
 
+	gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+#ifdef CONFIG_SRIO1
+	if (is_serdes_configured(SRIO1)) {
+		set_next_law(CONFIG_SYS_RIO1_MEM_PHYS, LAW_SIZE_256M,
+				LAW_TRGT_IF_RIO_1);
+	} else {
+		printf ("    SRIO1: disabled\n");
+	}
+#else
+	setbits_be32(&gur->devdisr, FSL_CORENET_DEVDISR_SRIO1); /* disable */
+#endif
+
+#ifdef CONFIG_SRIO2
+	if (is_serdes_configured(SRIO2)) {
+		set_next_law(CONFIG_SYS_RIO2_MEM_PHYS, LAW_SIZE_256M,
+				LAW_TRGT_IF_RIO_2);
+	} else {
+		printf ("    SRIO2: disabled\n");
+	}
+#else
+	setbits_be32(&gur->devdisr, FSL_CORENET_DEVDISR_SRIO2); /* disable */
+#endif
+
 	/* Warn if the expected SERDES reference clocks don't match the
 	 * actual reference clocks.  This needs to be done after calling
 	 * p4080_erratum_serdes8(), since that function may modify the clocks.
Signature · 1 line
1.6.0.6
#1 lore raw

PATCH 1/1 powerpc/85xx: Fix SRIO LAW setup on corenet_ds boards

Dear Kumar Gala,

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

From: Lian Minghuan <[email protected]>

In funciton board_early_init_r(), serdes does not initialize yet. variable "serdes_prtcl_map" in function is_serdes_configured() does not initialize. sRIO will always be disable.

In the original code, there is a undefined variable gur if SRIO is not defined.

Please fix the typos when applying. Thanks.

Best regards,

Wolfgang Denk

Signature · 8 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 secure program has to be robust: it  must  be  able  to  deal  with
conditions  that "can't happen", whether user input, program error or
library/etc. This is basic damage  control.  Buffer  overflow  errors
have nothing to do with security, but everything with stupidity.
                 -- Wietse Venema in <[email protected]>
author
#2 lore raw

PATCH 1/1 powerpc/85xx: Fix SRIO LAW setup on corenet_ds boards

Quoted 9 lines · Wolfgang Denk

Dear Kumar Gala,

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

From: Lian Minghuan <[email protected]>

In funciton board_early_init_r(), serdes does not initialize yet. variable "serdes_prtcl_map" in function is_serdes_configured() does not initialize. sRIO will always be disable.

Quoted 7 lines
Quoted 1 line

In the original code, there is a undefined variable gur if SRIO is not defined.

Please fix the typos when applying. Thanks.

Best regards,

Wolfgang Denk

applied and fixed commit message.

- k