aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRoy Pledge <roy.pledge@nxp.com>2018-09-28 04:43:23 -0400
committerLi Yang <leoyang.li@nxp.com>2018-10-05 15:01:46 -0400
commitf1c98ee699314c6512522703b2bc0ed0afd08ad1 (patch)
tree807a9d461fe848d5e6c60b47c12b777d41c10d62 /drivers
parent06cc59386c9aae8d88efb60af27efea34755c23c (diff)
soc: fsl: qbman: Use last response to determine valid bit
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> Signed-off-by: Li Yang <leoyang.li@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/soc/fsl/qbman/qman.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c
index 1897144b9281..b10a5880a468 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)
850 850
851static inline int qm_mc_init(struct qm_portal *portal) 851static inline int qm_mc_init(struct qm_portal *portal)
852{ 852{
853 u8 rr0, rr1;
853 struct qm_mc *mc = &portal->mc; 854 struct qm_mc *mc = &portal->mc;
854 855
855 mc->cr = portal->addr.ce + QM_CL_CR; 856 mc->cr = portal->addr.ce + QM_CL_CR;
856 mc->rr = portal->addr.ce + QM_CL_RR0; 857 mc->rr = portal->addr.ce + QM_CL_RR0;
857 mc->rridx = (mc->cr->_ncw_verb & QM_MCC_VERB_VBIT) 858 /*
858 ? 0 : 1; 859 * The expected valid bit polarity for the next CR command is 0
860 * if RR1 contains a valid response, and is 1 if RR0 contains a
861 * valid response. If both RR contain all 0, this indicates either
862 * that no command has been executed since reset (in which case the
863 * expected valid bit polarity is 1)
864 */
865 rr0 = mc->rr->verb;
866 rr1 = (mc->rr+1)->verb;
867 if ((rr0 == 0 && rr1 == 0) || rr0 != 0)
868 mc->rridx = 1;
869 else
870 mc->rridx = 0;
859 mc->vbit = mc->rridx ? QM_MCC_VERB_VBIT : 0; 871 mc->vbit = mc->rridx ? QM_MCC_VERB_VBIT : 0;
860#ifdef CONFIG_FSL_DPAA_CHECKING 872#ifdef CONFIG_FSL_DPAA_CHECKING
861 mc->state = qman_mc_idle; 873 mc->state = qman_mc_idle;