All of lore.kernel.org
 help / color / mirror / Atom feed
From: Madalin Bucur <madalin.bucur@nxp.com>
To: leoyang.li@nxp.com
Cc: roy.pledge@nxp.com, claudiu.manoil@nxp.com,
	catalin.marinas@arm.com, oss@buserror.net,
	linux-arm-kernel@lists.infradead.org,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	Madalin Bucur <madalin.bucur@nxp.com>
Subject: [PATCH v2 4/5] soc/fsl/qbman: Use last response to determine valid bit
Date: Fri, 28 Sep 2018 11:43:23 +0300	[thread overview]
Message-ID: <1538124204-31406-5-git-send-email-madalin.bucur@nxp.com> (raw)
In-Reply-To: <1538124204-31406-1-git-send-email-madalin.bucur@nxp.com>

From: Roy Pledge <roy.pledge@nxp.com>

Use the last valid response when determining what valid bit
to use next for management commands. This is needed in the
case that the portal was previously used by other software
like a bootloader or if the kernel is restarted without a
hardware reset.

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
 drivers/soc/fsl/qbman/qman.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c
index 0ffe7a1d0eae..99d0f87889b8 100644
--- a/drivers/soc/fsl/qbman/qman.c
+++ b/drivers/soc/fsl/qbman/qman.c
@@ -850,12 +850,24 @@ static inline void qm_mr_set_ithresh(struct qm_portal *portal, u8 ithresh)
 
 static inline int qm_mc_init(struct qm_portal *portal)
 {
+	u8 rr0, rr1;
 	struct qm_mc *mc = &portal->mc;
 
 	mc->cr = portal->addr.ce + QM_CL_CR;
 	mc->rr = portal->addr.ce + QM_CL_RR0;
-	mc->rridx = (mc->cr->_ncw_verb & QM_MCC_VERB_VBIT)
-		    ? 0 : 1;
+	/*
+	 * The expected valid bit polarity for the next CR command is 0
+	 * if RR1 contains a valid response, and is 1 if RR0 contains a
+	 * valid response. If both RR contain all 0, this indicates either
+	 * that no command has been executed since reset (in which case the
+	 * expected valid bit polarity is 1)
+	 */
+	rr0 = mc->rr->verb;
+	rr1 = (mc->rr+1)->verb;
+	if ((rr0 == 0 && rr1 == 0) || rr0 != 0)
+		mc->rridx = 1;
+	else
+		mc->rridx = 0;
 	mc->vbit = mc->rridx ? QM_MCC_VERB_VBIT : 0;
 #ifdef CONFIG_FSL_DPAA_CHECKING
 	mc->state = qman_mc_idle;
-- 
2.1.0


WARNING: multiple messages have this Message-ID (diff)
From: Madalin Bucur <madalin.bucur@nxp.com>
To: leoyang.li@nxp.com
Cc: Madalin Bucur <madalin.bucur@nxp.com>,
	catalin.marinas@arm.com, roy.pledge@nxp.com,
	linux-kernel@vger.kernel.org, oss@buserror.net,
	claudiu.manoil@nxp.com, linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 4/5] soc/fsl/qbman: Use last response to determine valid bit
Date: Fri, 28 Sep 2018 11:43:23 +0300	[thread overview]
Message-ID: <1538124204-31406-5-git-send-email-madalin.bucur@nxp.com> (raw)
In-Reply-To: <1538124204-31406-1-git-send-email-madalin.bucur@nxp.com>

From: Roy Pledge <roy.pledge@nxp.com>

Use the last valid response when determining what valid bit
to use next for management commands. This is needed in the
case that the portal was previously used by other software
like a bootloader or if the kernel is restarted without a
hardware reset.

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
 drivers/soc/fsl/qbman/qman.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c
index 0ffe7a1d0eae..99d0f87889b8 100644
--- a/drivers/soc/fsl/qbman/qman.c
+++ b/drivers/soc/fsl/qbman/qman.c
@@ -850,12 +850,24 @@ static inline void qm_mr_set_ithresh(struct qm_portal *portal, u8 ithresh)
 
 static inline int qm_mc_init(struct qm_portal *portal)
 {
+	u8 rr0, rr1;
 	struct qm_mc *mc = &portal->mc;
 
 	mc->cr = portal->addr.ce + QM_CL_CR;
 	mc->rr = portal->addr.ce + QM_CL_RR0;
-	mc->rridx = (mc->cr->_ncw_verb & QM_MCC_VERB_VBIT)
-		    ? 0 : 1;
+	/*
+	 * The expected valid bit polarity for the next CR command is 0
+	 * if RR1 contains a valid response, and is 1 if RR0 contains a
+	 * valid response. If both RR contain all 0, this indicates either
+	 * that no command has been executed since reset (in which case the
+	 * expected valid bit polarity is 1)
+	 */
+	rr0 = mc->rr->verb;
+	rr1 = (mc->rr+1)->verb;
+	if ((rr0 == 0 && rr1 == 0) || rr0 != 0)
+		mc->rridx = 1;
+	else
+		mc->rridx = 0;
 	mc->vbit = mc->rridx ? QM_MCC_VERB_VBIT : 0;
 #ifdef CONFIG_FSL_DPAA_CHECKING
 	mc->state = qman_mc_idle;
-- 
2.1.0


WARNING: multiple messages have this Message-ID (diff)
From: madalin.bucur@nxp.com (Madalin Bucur)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 4/5] soc/fsl/qbman: Use last response to determine valid bit
Date: Fri, 28 Sep 2018 11:43:23 +0300	[thread overview]
Message-ID: <1538124204-31406-5-git-send-email-madalin.bucur@nxp.com> (raw)
In-Reply-To: <1538124204-31406-1-git-send-email-madalin.bucur@nxp.com>

From: Roy Pledge <roy.pledge@nxp.com>

Use the last valid response when determining what valid bit
to use next for management commands. This is needed in the
case that the portal was previously used by other software
like a bootloader or if the kernel is restarted without a
hardware reset.

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
 drivers/soc/fsl/qbman/qman.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c
index 0ffe7a1d0eae..99d0f87889b8 100644
--- a/drivers/soc/fsl/qbman/qman.c
+++ b/drivers/soc/fsl/qbman/qman.c
@@ -850,12 +850,24 @@ static inline void qm_mr_set_ithresh(struct qm_portal *portal, u8 ithresh)
 
 static inline int qm_mc_init(struct qm_portal *portal)
 {
+	u8 rr0, rr1;
 	struct qm_mc *mc = &portal->mc;
 
 	mc->cr = portal->addr.ce + QM_CL_CR;
 	mc->rr = portal->addr.ce + QM_CL_RR0;
-	mc->rridx = (mc->cr->_ncw_verb & QM_MCC_VERB_VBIT)
-		    ? 0 : 1;
+	/*
+	 * The expected valid bit polarity for the next CR command is 0
+	 * if RR1 contains a valid response, and is 1 if RR0 contains a
+	 * valid response. If both RR contain all 0, this indicates either
+	 * that no command has been executed since reset (in which case the
+	 * expected valid bit polarity is 1)
+	 */
+	rr0 = mc->rr->verb;
+	rr1 = (mc->rr+1)->verb;
+	if ((rr0 == 0 && rr1 == 0) || rr0 != 0)
+		mc->rridx = 1;
+	else
+		mc->rridx = 0;
 	mc->vbit = mc->rridx ? QM_MCC_VERB_VBIT : 0;
 #ifdef CONFIG_FSL_DPAA_CHECKING
 	mc->state = qman_mc_idle;
-- 
2.1.0

  parent reply	other threads:[~2018-09-28  8:43 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-28  8:43 [PATCH v2 0/5] soc/fsl/qbman: DPAA QBMan fixes and additions Madalin Bucur
2018-09-28  8:43 ` Madalin Bucur
2018-09-28  8:43 ` Madalin Bucur
2018-09-28  8:43 ` [PATCH v2 1/5] soc/fsl/qbman: Check if CPU is offline when initializing portals Madalin Bucur
2018-09-28  8:43   ` Madalin Bucur
2018-09-28  8:43   ` Madalin Bucur
2018-09-28  8:43 ` [PATCH v2 2/5] soc/fsl/qbman: replace CPU 0 with any online CPU in hotplug handlers Madalin Bucur
2018-09-28  8:43   ` Madalin Bucur
2018-09-28  8:43   ` Madalin Bucur
2018-09-28  8:43 ` [PATCH v2 3/5] soc/fsl/qbman: Add 64 bit DMA addressing requirement to QBMan Madalin Bucur
2018-09-28  8:43   ` Madalin Bucur
2018-09-28  8:43   ` Madalin Bucur
2018-09-28  8:43 ` Madalin Bucur [this message]
2018-09-28  8:43   ` [PATCH v2 4/5] soc/fsl/qbman: Use last response to determine valid bit Madalin Bucur
2018-09-28  8:43   ` Madalin Bucur
2018-09-28  8:43 ` [PATCH v2 5/5] soc/fsl_qbman: export coalesce change API Madalin Bucur
2018-09-28  8:43   ` Madalin Bucur
2018-09-28  8:43   ` Madalin Bucur
2018-10-01 21:50   ` Li Yang
2018-10-01 21:50     ` Li Yang
2018-10-01 21:50     ` Li Yang
2018-10-02  6:07     ` Madalin-cristian Bucur
2018-10-02  6:07       ` Madalin-cristian Bucur
2018-10-02  6:07       ` Madalin-cristian Bucur
2018-10-02  6:07       ` Madalin-cristian Bucur
2018-10-02 20:07       ` Li Yang
2018-10-02 20:07         ` Li Yang
2018-10-02 20:07         ` Li Yang
2018-10-02 20:07         ` Li Yang
2018-10-01 22:29 ` [PATCH v2 0/5] soc/fsl/qbman: DPAA QBMan fixes and additions Li Yang
2018-10-01 22:29   ` Li Yang
2018-10-01 22:29   ` Li Yang
2018-10-02  6:28   ` Madalin-cristian Bucur
2018-10-02  6:28     ` Madalin-cristian Bucur
2018-10-02  6:28     ` Madalin-cristian Bucur
2018-10-02 19:45     ` Li Yang
2018-10-02 19:45       ` Li Yang
2018-10-02 19:45       ` Li Yang

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=1538124204-31406-5-git-send-email-madalin.bucur@nxp.com \
    --to=madalin.bucur@nxp.com \
    --cc=catalin.marinas@arm.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=leoyang.li@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=oss@buserror.net \
    --cc=roy.pledge@nxp.com \
    /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.