From: Zhang Wei <wei.zhang@freescale.com>
To: mporter@kernel.crashing.org, akpm@linux-foundation.org,
galak@kernel.crashing.org
Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH 10/17] Add RapidIO connection info print out and re-training for break connection.
Date: Tue, 11 Mar 2008 17:07:51 +0800 [thread overview]
Message-ID: <1205226478-7641-10-git-send-email-wei.zhang@freescale.com> (raw)
In-Reply-To: <1205226478-7641-9-git-send-email-wei.zhang@freescale.com>
Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
---
arch/powerpc/sysdev/fsl_rio.c | 71 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 71 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 935822a..dca8eea 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -942,6 +942,48 @@ static int fsl_rio_get_cmdline(char *s)
__setup("riohdid=", fsl_rio_get_cmdline);
+static inline void fsl_rio_info(struct device *dev, u32 ccsr)
+{
+ const char *str;
+ if (ccsr & 1) {
+ /* Serial phy */
+ switch (ccsr >> 30) {
+ case 0:
+ str = "1";
+ break;
+ case 1:
+ str = "4";
+ break;
+ default:
+ str = "Unknown";
+ break;;
+ }
+ dev_info(dev, "Hardware port width: %s\n", str);
+
+ switch ((ccsr >> 27) & 7) {
+ case 0:
+ str = "Single-lane 0";
+ break;
+ case 1:
+ str = "Single-lane 2";
+ break;
+ case 2:
+ str = "Four-lane";
+ break;
+ default:
+ str = "Unknown";
+ break;
+ }
+ dev_info(dev, "Training connection status: %s\n", str);
+ } else {
+ /* Parallel phy */
+ if (!(ccsr & 0x80000000))
+ dev_info(dev, "Output port operating in 8-bit mode\n");
+ if (!(ccsr & 0x08000000))
+ dev_info(dev, "Input port operating in 8-bit mode\n");
+ }
+}
+
/**
* fsl_rio_setup - Setup MPC85xx RapidIO interface
* @fsl_rio_setup - Setup Freescale PowerPC RapidIO interface
@@ -1055,6 +1097,35 @@ int fsl_rio_setup(struct of_device *dev)
(port->phy_type == RIO_PHY_PARALLEL) ? "parallel" :
((port->phy_type == RIO_PHY_SERIAL) ? "serial" :
"unknown"));
+ /* Checking the port training status */
+ if (in_be32((priv->regs_win + RIO_ESCSR)) & 1) {
+ dev_err(&dev->dev, "Port is not ready. "
+ "Try to restart connection...\n");
+ switch (port->phy_type) {
+ case RIO_PHY_SERIAL:
+ /* Disable ports */
+ out_be32(priv->regs_win + RIO_CCSR, 0);
+ /* Set 1x lane */
+ setbits32(priv->regs_win + RIO_CCSR, 0x02000000);
+ /* Enable ports */
+ setbits32(priv->regs_win + RIO_CCSR, 0x00600000);
+ break;
+ case RIO_PHY_PARALLEL:
+ /* Disable ports */
+ out_be32(priv->regs_win + RIO_CCSR, 0x22000000);
+ /* Enable ports */
+ out_be32(priv->regs_win + RIO_CCSR, 0x44000000);
+ break;
+ }
+ msleep(100);
+ if (in_be32((priv->regs_win + RIO_ESCSR)) & 1) {
+ dev_err(&dev->dev, "Port restart failed.\n");
+ rc = -ENOLINK;
+ goto err;
+ }
+ dev_info(&dev->dev, "Port restart success!\n");
+ }
+ fsl_rio_info(&dev->dev, ccsr);
port->sys_size = (in_be32((priv->regs_win + RIO_PEF_CAR))
& RIO_PEF_CTLS) >> 4;
--
1.5.4
next prev parent reply other threads:[~2008-03-11 9:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-11 9:07 [PATCH 01/17] Change RIO function mpc85xx_ to fsl_ Zhang Wei
2008-03-11 9:07 ` [PATCH 02/17] Add RapidIO option to kernel configuration Zhang Wei
2008-03-11 9:07 ` [PATCH 03/17] Move include/asm-ppc/rio.h to include/asm-powerpc/rio.h Zhang Wei
2008-03-11 9:07 ` [PATCH 04/17] Add RapidIO multi mport support Zhang Wei
2008-03-11 9:07 ` [PATCH 05/17] Add OF-tree support to RapidIO controller driver Zhang Wei
2008-03-11 9:07 ` [PATCH 06/17] Change the kernel configurated RapidIO system size to auto-probing Zhang Wei
2008-03-11 9:07 ` [PATCH 07/17] Add RapidIO node into MPC8641HPCN dts file Zhang Wei
2008-03-11 9:07 ` [PATCH 08/17] Add RapidIO node probing into MPC86xx_HPCN board id table Zhang Wei
2008-03-11 9:07 ` [PATCH 09/17] Add serial RapidIO controller support, which includes MPC8548, MPC8641 Zhang Wei
2008-03-11 9:07 ` Zhang Wei [this message]
2008-03-11 9:07 ` [PATCH 11/17] Add memory mapping driver to RapidIO Zhang Wei
2008-03-11 9:07 ` [PATCH 12/17] Add RapidIO space allocation bitmap arithmetic Zhang Wei
2008-03-11 9:07 ` [PATCH 13/17] Add FSL RapidIO controller memory ops functions Zhang Wei
2008-03-11 9:07 ` [PATCH 14/17] Add the RapidIO master port maintance and doorbell window to space resources Zhang Wei
2008-03-11 9:07 ` [PATCH 15/17] Add RapidIO proc fs for memory mapping debugging Zhang Wei
2008-03-11 9:07 ` [PATCH 16/17] Change RapidIO doorbell source and target ID field to 16-bit Zhang Wei
2008-03-11 9:07 ` [PATCH 17/17] Add the memory mapping support in rionet driver Zhang Wei
-- strict thread matches above, loose matches on Subject: below --
2008-03-04 16:29 [PATCH 01/17] Change RIO function mpc85xx_ to fsl_ Zhang Wei
2008-03-04 16:29 ` [PATCH 02/17] Add RapidIO option to kernel configuration Zhang Wei
2008-03-04 16:29 ` [PATCH 03/17] Move include/asm-ppc/rio.h to include/asm-powerpc/rio.h Zhang Wei
2008-03-04 16:29 ` [PATCH 04/17] Add RapidIO multi mport support Zhang Wei
2008-03-04 16:29 ` [PATCH 05/17] Add OF-tree support to RapidIO controller driver Zhang Wei
2008-03-04 16:29 ` [PATCH 06/17] Change the kernel configurated RapidIO system size to auto-probing Zhang Wei
2008-03-04 16:29 ` [PATCH 07/17] Add RapidIO node into MPC8641HPCN dts file Zhang Wei
2008-03-04 16:29 ` [PATCH 08/17] Add RapidIO node probing into MPC86xx_HPCN board id table Zhang Wei
2008-03-04 16:29 ` [PATCH 09/17] Add serial RapidIO controller support, which includes MPC8548, MPC8641 Zhang Wei
2008-03-04 16:29 ` [PATCH 10/17] Add RapidIO connection info print out and re-training for break connection Zhang Wei
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=1205226478-7641-10-git-send-email-wei.zhang@freescale.com \
--to=wei.zhang@freescale.com \
--cc=akpm@linux-foundation.org \
--cc=galak@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=mporter@kernel.crashing.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).