All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mingkai Hu <Mingkai.hu@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 01/14] powerpc/p4080: Add function to report which lane is used for a prtcl
Date: Thu, 27 Jan 2011 12:52:39 +0800	[thread overview]
Message-ID: <1296103972-2696-2-git-send-email-Mingkai.hu@freescale.com> (raw)
In-Reply-To: <1296103972-2696-1-git-send-email-Mingkai.hu@freescale.com>

From: Kumar Gala <galak@kernel.crashing.org>

Also rename serdes_get_bank() to serdes_get_bank_by_lane().

Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
---
 arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c |   33 +++++++++++++++++++++++-
 arch/powerpc/include/asm/fsl_serdes.h         |    4 +++
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
index 7fc00d8..c4c595e 100644
--- a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
@@ -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;
 }
@@ -263,6 +264,34 @@ static void p4080_erratum_serdes8(serdes_corenet_t *regs, ccsr_gur_t *gur,
 }
 #endif
 
+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;
+}
+
+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);
+}
+
 void fsl_serdes_init(void)
 {
 	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
@@ -318,7 +347,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);
 		}
 	}
diff --git a/arch/powerpc/include/asm/fsl_serdes.h b/arch/powerpc/include/asm/fsl_serdes.h
index 85518eb..9d9f2e4 100644
--- a/arch/powerpc/include/asm/fsl_serdes.h
+++ b/arch/powerpc/include/asm/fsl_serdes.h
@@ -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 */
-- 
1.6.4

  reply	other threads:[~2011-01-27  4:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-27  4:52 [U-Boot] [PATCH 00/14] powerpc/p4080: add support for FMan ethernet in Independent mode Mingkai Hu
2011-01-27  4:52 ` Mingkai Hu [this message]
2011-01-27  4:52   ` [U-Boot] [PATCH 02/14] powerpc/fman: add PHY support for dTSEC Mingkai Hu
2011-01-27  4:52     ` [U-Boot] [PATCH 03/14] powerpc/fman: add dTSEC controller support Mingkai Hu
2011-01-27  4:52       ` [U-Boot] [PATCH 04/14] powerpc/fman: add 10GEC controller and PHY support Mingkai Hu
2011-01-27  4:52         ` [U-Boot] [PATCH 05/14] powerpc/qoirq: Add support for FMan ethernet in Independent mode Mingkai Hu
2011-01-27  4:52           ` [U-Boot] [PATCH 06/14] powerpc/corenet_ds: Add fman support Mingkai Hu
2011-01-27  4:52             ` [U-Boot] [PATCH 07/14] tsec: use IO accessories to access the register Mingkai Hu
2011-01-27  4:52               ` [U-Boot] [PATCH 08/14] tsec: arrange the code to avoid useless function declaration Mingkai Hu
2011-01-27  4:52                 ` [U-Boot] [PATCH 09/14] tsec: use general ethernet MII register struct(tsec_mii_t) Mingkai Hu
2011-01-27  4:52                   ` [U-Boot] [PATCH 10/14] tsec: refactor the PHY code to make it reuseable Mingkai Hu
2011-01-27  4:52                     ` [U-Boot] [PATCH 11/14] PHY: add some Vitesse phy support Mingkai Hu
2011-01-27  4:52                       ` [U-Boot] [PATCH 12/14] PHY: add some Broadcom " Mingkai Hu
2011-01-27  4:52                         ` [U-Boot] [PATCH 13/14] PHY: add some Marvell " Mingkai Hu
2011-01-27  4:52                           ` [U-Boot] [PATCH 14/14] PHY: add some misc phy code support Mingkai Hu
2011-01-27  5:44                           ` [U-Boot] [PATCH 13/14] PHY: add some Marvell phy support Macpaul Lin
2011-02-02 22:48                 ` [U-Boot] [PATCH 08/14] tsec: arrange the code to avoid useless function declaration Andy Fleming
2011-02-05 20:26                 ` Kumar Gala
2011-02-02 22:47               ` [U-Boot] [PATCH 07/14] tsec: use IO accessories to access the register Andy Fleming
2011-02-05 20:26               ` Kumar Gala
2011-01-27 17:42             ` [U-Boot] [PATCH 06/14] powerpc/corenet_ds: Add fman support Timur Tabi
2011-01-27 17:40           ` [U-Boot] [PATCH 05/14] powerpc/qoirq: Add support for FMan ethernet in Independent mode Timur Tabi
2011-01-27  6:15     ` [U-Boot] [PATCH 02/14] powerpc/fman: add PHY support for dTSEC Kumar Gala
2011-01-27 16:10     ` Timur Tabi
2011-01-27  6:04 ` [U-Boot] [PATCH 00/14] powerpc/p4080: add support for FMan ethernet in Independent mode Kumar Gala
2011-01-27  6:09   ` Hu Mingkai-B21284

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1296103972-2696-2-git-send-email-Mingkai.hu@freescale.com \
    --to=mingkai.hu@freescale.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.