Skip to contentSkip to conversation

powerpc/85xx: fsl_corenet_serdes code rework

PATCH New Kumar Gala 1 participant 4 messages Apr 9, 2011 – Apr 29, 2011 PowerPC

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/2 powerpc/85xx: fsl_corenet_serdes code rework

From: Emil Medve <[email protected]>

Rework and add some new APIs to the fsl_corenet_serdes code for use by erratum and drivers.

* Rename serdes_get_bank() to serdes_get_bank_by_lane()
* Add serdes_get_first_lane returns which SERDES lane is used by device

---
 arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c |   40 +++++++++++++++++++++++-
 arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.h |    2 +-
 arch/powerpc/include/asm/fsl_serdes.h         |    4 ++
 3 files changed, 43 insertions(+), 3 deletions(-)
arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c +38 -2
index f58d6d6..1177247 100644
@@ -29,6 +29,7 @@
 #include <asm/io.h>
 #include <asm/processor.h>
 #include <asm/fsl_law.h>
+#include <asm/errno.h>
 #include "fsl_corenet_serdes.h"
 
 static u32 serdes_prtcl_map;
@@ -91,7 +92,7 @@ int serdes_get_lane_idx(int lane)
 	return lanes[lane].idx;
 }
 
-int serdes_get_bank(int lane)
+int serdes_get_bank_by_lane(int lane)
 {
 	return lanes[lane].bank;
 }
@@ -132,6 +133,41 @@ int is_serdes_configured(enum srds_prtcl device)
 	return (1 << device) & serdes_prtcl_map;
 }
 
+static int __serdes_get_first_lane(uint32_t prtcl, enum srds_prtcl device)
+{
+	int i;
+
+	for (i = 0; i < SRDS_MAX_LANES; i++) {
+		if (serdes_get_prtcl(prtcl, i) == device)
+			return i;
+	}
+
+	return -ENODEV;
+}
+
+/*
+ * Returns the SERDES lane (0..SRDS_MAX_LANES-1) that routes to the given
+ * device. This depends on the current SERDES protocol, as defined in the RCW.
+ *
+ * Returns a negative error code if SERDES is disabled or the given device is
+ * not supported in the current SERDES protocol.
+ */
+int serdes_get_first_lane(enum srds_prtcl device)
+{
+	u32 prtcl;
+	const ccsr_gur_t *gur;
+
+	gur = (typeof(gur))CONFIG_SYS_MPC85xx_GUTS_ADDR;
+
+	/* Is serdes enabled@all? */
+	if (unlikely((in_be32(&gur->rcwsr[5]) & 0x2000) == 0))
+		return -ENODEV;
+
+	prtcl = (in_be32(&gur->rcwsr[4]) & FSL_CORENET_RCWSR4_SRDS_PRTCL) >> 26;
+
+	return __serdes_get_first_lane(prtcl, device);
+}
+
 #ifndef CONFIG_SYS_DCSRBAR_PHYS
 #define CONFIG_SYS_DCSRBAR_PHYS	0x80000000 /* Must be 1GB-aligned for rev1.0 */
 #define CONFIG_SYS_DCSRBAR	0x80000000
@@ -325,7 +361,7 @@ void fsl_serdes_init(void)
 	for (lane = 0; lane < SRDS_MAX_LANES; lane++) {
 		enum srds_prtcl lane_prtcl = serdes_get_prtcl(cfg, lane);
 		if (serdes_lane_enabled(lane)) {
-			have_bank[serdes_get_bank(lane)] = 1;
+			have_bank[serdes_get_bank_by_lane(lane)] = 1;
 			serdes_prtcl_map |= (1 << lane_prtcl);
 		}
 	}
arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.h +1 -1
index 42d771e..f261351 100644
@@ -33,7 +33,7 @@ enum srds_bank {
 
 int is_serdes_prtcl_valid(u32 prtcl);
 int serdes_get_lane_idx(int lane);
-int serdes_get_bank(int lane);
+int serdes_get_bank_by_lane(int lane);
 int serdes_lane_enabled(int lane);
 enum srds_prtcl serdes_get_prtcl(int cfg, int lane);
 
arch/powerpc/include/asm/fsl_serdes.h +4 -0
index 85518eb..9d9f2e4 100644
@@ -53,4 +53,8 @@ enum srds_prtcl {
 int is_serdes_configured(enum srds_prtcl device);
 void fsl_serdes_init(void);
 
+#ifdef CONFIG_FSL_CORENET
+int serdes_get_first_lane(enum srds_prtcl device);
+#endif
+
 #endif /* __FSL_SERDES_H */
Signature · 1 line
1.7.3.4
author
#2 lore raw

PATCH 2/2 p4080/serdes: Implement the XAUI workaround for SERDES9 erratum

From: Emil Medve <[email protected]>

---
 arch/powerpc/cpu/mpc85xx/cmd_errata.c         |    3 +
 arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c |  107 +++++++++++++++++++++++++
 arch/powerpc/include/asm/config_mpc85xx.h     |    1 +
 arch/powerpc/include/asm/fsl_serdes.h         |    3 +
 arch/powerpc/include/asm/immap_85xx.h         |    2 +
 5 files changed, 116 insertions(+), 0 deletions(-)
arch/powerpc/cpu/mpc85xx/cmd_errata.c +3 -0
index e94975a..0564816 100644
@@ -44,6 +44,9 @@ static int do_errata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #if defined(CONFIG_SYS_P4080_ERRATUM_SERDES8)
 	puts("Work-around for Erratum SERDES8 enabled\n");
 #endif
+#if defined(CONFIG_SYS_P4080_ERRATUM_SERDES9)
+	puts("Work-around for Erratum SERDES9 enabled\n");
+#endif
 #if defined(CONFIG_SYS_P4080_ERRATUM_CPU22)
 	puts("Work-around for Erratum CPU22 enabled\n");
 #endif
arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c +107 -0

135 lines not on this page · raw message

arch/powerpc/include/asm/config_mpc85xx.h +1 -0
index 41fd86c..88bc030 100644
@@ -304,6 +304,7 @@
 #define CONFIG_SYS_FSL_ERRATUM_ESDHC136
 #define CONFIG_SYS_P4080_ERRATUM_CPU22
 #define CONFIG_SYS_P4080_ERRATUM_SERDES8
+#define CONFIG_SYS_P4080_ERRATUM_SERDES9
 
 /* P5010 is single core version of P5020 */
 #elif defined(CONFIG_PPC_P5010)
arch/powerpc/include/asm/fsl_serdes.h +3 -0
index 9d9f2e4..0f31af1 100644
@@ -55,6 +55,9 @@ void fsl_serdes_init(void);
 
 #ifdef CONFIG_FSL_CORENET
 int serdes_get_first_lane(enum srds_prtcl device);
+#ifdef CONFIG_SYS_P4080_ERRATUM_SERDES9
+void serdes_reset_rx(enum srds_prtcl device);
+#endif
 #endif
 
 #endif /* __FSL_SERDES_H */
arch/powerpc/include/asm/immap_85xx.h +2 -0
index c39c95f..4c71057 100644
@@ -2138,6 +2138,8 @@ typedef struct serdes_corenet {
 #define SRDS_TECR0_TEQ_TYPE_2LVL	0x10000000
 		u32	res3;
 		u32	ttlcr0;	/* Transition Tracking Loop Ctrl 0 */
+#define SRDS_TTLCR0_FLT_SEL_MASK	0x3f000000
+#define SRDS_TTLCR0_PM_DIS		0x00004000
 		u32	res4[7];
 	} lane[24];
 	u32 res6[384];
Signature · 1 line
1.7.3.4
author Applied
#1 lore raw

PATCH 1/2 powerpc/85xx: fsl_corenet_serdes code rework

In reply to Kumar Gala
Quoted 8 lines · Kumar Gala

From: Emil Medve <[email protected]>

Rework and add some new APIs to the fsl_corenet_serdes code for use by erratum and drivers.

* Rename serdes_get_bank() to serdes_get_bank_by_lane()
* Add serdes_get_first_lane returns which SERDES lane is used by device

Quoted 8 lines

---

arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c |   40 +++++++++++++++++++++++-
arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.h |    2 +-
arch/powerpc/include/asm/fsl_serdes.h         |    4 ++
3 files changed, 43 insertions(+), 3 deletions(-)

applied to 85xx

- k

author Applied
#3 lore raw

PATCH 2/2 p4080/serdes: Implement the XAUI workaround for SERDES9 erratum

In reply to Kumar Gala
Quoted 5 lines · Kumar Gala

From: Emil Medve <[email protected]>

Quoted 7 lines

---

arch/powerpc/cpu/mpc85xx/cmd_errata.c         |    3 +
arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c |  107 +++++++++++++++++++++++++
arch/powerpc/include/asm/config_mpc85xx.h     |    1 +
arch/powerpc/include/asm/fsl_serdes.h         |    3 +
arch/powerpc/include/asm/immap_85xx.h         |    2 +
5 files changed, 116 insertions(+), 0 deletions(-)

applied to 85xx

- k