From 4c642e7af5e9e605b9fb6b8130216548c7bc180b Mon Sep 17 00:00:00 2001 From: Haiying Wang Date: Fri, 2 Oct 2015 12:19:14 -0400 Subject: fsl_qbman: enable sending cscn to dcp for old qman revision Set CSCN_TARG with correct DCP portal in qman_create_cgr_to_dcp() funciton for the qman revision < qman_3.0 JIRA issue# QLINUX-3814 Signed-off-by: Haiying Wang diff --git a/drivers/staging/fsl_qbman/qman_high.c b/drivers/staging/fsl_qbman/qman_high.c index 334d9ed..d17d301 100644 --- a/drivers/staging/fsl_qbman/qman_high.c +++ b/drivers/staging/fsl_qbman/qman_high.c @@ -2549,6 +2549,7 @@ EXPORT_SYMBOL(qman_modify_cgr); #define TARG_MASK(n) (0x80000000 >> (n->config->public_cfg.channel - \ QM_CHANNEL_SWPORTAL0)) +#define TARG_DCP_MASK(n) (0x80000000 >> (10 + n)) #define PORTAL_IDX(n) (n->config->public_cfg.channel - QM_CHANNEL_SWPORTAL0) static u8 qman_cgr_cpus[__CGR_NUM]; @@ -2630,13 +2631,9 @@ int qman_create_cgr_to_dcp(struct qman_cgr *cgr, u32 flags, u16 dcp_portal, { unsigned long irqflags __maybe_unused; struct qm_mcc_initcgr local_opts; + struct qm_mcr_querycgr cgr_state; int ret; - if ((qman_ip_rev & 0xFF00) < QMAN_REV30) { - pr_warn("This QMan version doesn't support to send CSCN to" - " DCP portal\n"); - return -EINVAL; - } /* We have to check that the provided CGRID is within the limits of the * data-structures, for obvious reasons. However we'll let h/w take * care of determining whether it's within the limits of what exists on @@ -2645,12 +2642,21 @@ int qman_create_cgr_to_dcp(struct qman_cgr *cgr, u32 flags, u16 dcp_portal, if (cgr->cgrid >= __CGR_NUM) return -EINVAL; + ret = qman_query_cgr(cgr, &cgr_state); + if (ret) + return ret; + memset(&local_opts, 0, sizeof(struct qm_mcc_initcgr)); if (opts) local_opts = *opts; - local_opts.cgr.cscn_targ_upd_ctrl = QM_CGR_TARG_UDP_CTRL_WRITE_BIT | + if ((qman_ip_rev & 0xFF00) >= QMAN_REV30) + local_opts.cgr.cscn_targ_upd_ctrl = + QM_CGR_TARG_UDP_CTRL_WRITE_BIT | QM_CGR_TARG_UDP_CTRL_DCP | dcp_portal; + else + local_opts.cgr.cscn_targ = cgr_state.cgr.cscn_targ | + TARG_DCP_MASK(dcp_portal); local_opts.we_mask |= QM_CGR_WE_CSCN_TARG; /* send init if flags indicate so */ -- cgit v0.10.2