diff options
| author | Claudiu Manoil <claudiu.manoil@nxp.com> | 2016-11-16 09:40:29 -0500 |
|---|---|---|
| committer | Scott Wood <oss@buserror.net> | 2016-11-23 02:23:49 -0500 |
| commit | 496bfa11de2e6805b63168d45c2f92edbeae54e2 (patch) | |
| tree | 14cfa18cc5eb54f82ddb2144c91203aa94977e44 | |
| parent | efe848cdb724be2d0cc61f6329997f9a7cd7948f (diff) | |
soc/qman: Clean up CGR CSCN target update operations
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: Scott Wood <oss@buserror.net>
| -rw-r--r-- | drivers/soc/fsl/qbman/qman.c | 37 | ||||
| -rw-r--r-- | include/soc/fsl/qman.h | 4 |
2 files changed, 25 insertions, 16 deletions
diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c index 8386acc1d37d..acee99da71a7 100644 --- a/drivers/soc/fsl/qbman/qman.c +++ b/drivers/soc/fsl/qbman/qman.c | |||
| @@ -2248,7 +2248,23 @@ out: | |||
| 2248 | } | 2248 | } |
| 2249 | 2249 | ||
| 2250 | #define PORTAL_IDX(n) (n->config->channel - QM_CHANNEL_SWPORTAL0) | 2250 | #define PORTAL_IDX(n) (n->config->channel - QM_CHANNEL_SWPORTAL0) |
| 2251 | #define TARG_MASK(n) (BIT(31) >> PORTAL_IDX(n)) | 2251 | |
| 2252 | /* congestion state change notification target update control */ | ||
| 2253 | static void qm_cgr_cscn_targ_set(struct __qm_mc_cgr *cgr, int pi, u32 val) | ||
| 2254 | { | ||
| 2255 | if (qman_ip_rev >= QMAN_REV30) | ||
| 2256 | cgr->cscn_targ_upd_ctrl = QM_CGR_TARG_UDP_CTRL_WRITE_BIT | pi; | ||
| 2257 | else | ||
| 2258 | cgr->cscn_targ = val | QM_CGR_TARG_PORTAL(pi); | ||
| 2259 | } | ||
| 2260 | |||
| 2261 | static void qm_cgr_cscn_targ_clear(struct __qm_mc_cgr *cgr, int pi, u32 val) | ||
| 2262 | { | ||
| 2263 | if (qman_ip_rev >= QMAN_REV30) | ||
| 2264 | cgr->cscn_targ_upd_ctrl = pi; | ||
| 2265 | else | ||
| 2266 | cgr->cscn_targ = val & ~QM_CGR_TARG_PORTAL(pi); | ||
| 2267 | } | ||
| 2252 | 2268 | ||
| 2253 | static u8 qman_cgr_cpus[CGR_NUM]; | 2269 | static u8 qman_cgr_cpus[CGR_NUM]; |
| 2254 | 2270 | ||
| @@ -2298,13 +2314,8 @@ int qman_create_cgr(struct qman_cgr *cgr, u32 flags, | |||
| 2298 | if (ret) | 2314 | if (ret) |
| 2299 | goto out; | 2315 | goto out; |
| 2300 | 2316 | ||
| 2301 | if ((qman_ip_rev & 0xFF00) >= QMAN_REV30) | 2317 | qm_cgr_cscn_targ_set(&local_opts.cgr, PORTAL_IDX(p), |
| 2302 | local_opts.cgr.cscn_targ_upd_ctrl = | 2318 | cgr_state.cgr.cscn_targ); |
| 2303 | QM_CGR_TARG_UDP_CTRL_WRITE_BIT | PORTAL_IDX(p); | ||
| 2304 | else | ||
| 2305 | /* Overwrite TARG */ | ||
| 2306 | local_opts.cgr.cscn_targ = cgr_state.cgr.cscn_targ | | ||
| 2307 | TARG_MASK(p); | ||
| 2308 | local_opts.we_mask |= QM_CGR_WE_CSCN_TARG; | 2319 | local_opts.we_mask |= QM_CGR_WE_CSCN_TARG; |
| 2309 | 2320 | ||
| 2310 | /* send init if flags indicate so */ | 2321 | /* send init if flags indicate so */ |
| @@ -2371,13 +2382,11 @@ int qman_delete_cgr(struct qman_cgr *cgr) | |||
| 2371 | list_add(&cgr->node, &p->cgr_cbs); | 2382 | list_add(&cgr->node, &p->cgr_cbs); |
| 2372 | goto release_lock; | 2383 | goto release_lock; |
| 2373 | } | 2384 | } |
| 2374 | /* Overwrite TARG */ | 2385 | |
| 2375 | local_opts.we_mask = QM_CGR_WE_CSCN_TARG; | 2386 | local_opts.we_mask = QM_CGR_WE_CSCN_TARG; |
| 2376 | if ((qman_ip_rev & 0xFF00) >= QMAN_REV30) | 2387 | qm_cgr_cscn_targ_clear(&local_opts.cgr, PORTAL_IDX(p), |
| 2377 | local_opts.cgr.cscn_targ_upd_ctrl = PORTAL_IDX(p); | 2388 | cgr_state.cgr.cscn_targ); |
| 2378 | else | 2389 | |
| 2379 | local_opts.cgr.cscn_targ = cgr_state.cgr.cscn_targ & | ||
| 2380 | ~(TARG_MASK(p)); | ||
| 2381 | ret = qm_modify_cgr(cgr, 0, &local_opts); | 2390 | ret = qm_modify_cgr(cgr, 0, &local_opts); |
| 2382 | if (ret) | 2391 | if (ret) |
| 2383 | /* add back to the list */ | 2392 | /* add back to the list */ |
diff --git a/include/soc/fsl/qman.h b/include/soc/fsl/qman.h index c80eccac64f6..d01d5a358945 100644 --- a/include/soc/fsl/qman.h +++ b/include/soc/fsl/qman.h | |||
| @@ -553,8 +553,8 @@ struct __qm_mc_cgr { | |||
| 553 | u8 cscn_en; /* boolean, use QM_CGR_EN */ | 553 | u8 cscn_en; /* boolean, use QM_CGR_EN */ |
| 554 | union { | 554 | union { |
| 555 | struct { | 555 | struct { |
| 556 | u16 cscn_targ_upd_ctrl; /* use QM_CSCN_TARG_UDP_ */ | 556 | u16 cscn_targ_upd_ctrl; /* use QM_CGR_TARG_UDP_* */ |
| 557 | u16 cscn_targ_dcp_low; /* CSCN_TARG_DCP low-16bits */ | 557 | u16 cscn_targ_dcp_low; |
| 558 | }; | 558 | }; |
| 559 | u32 cscn_targ; /* use QM_CGR_TARG_* */ | 559 | u32 cscn_targ; /* use QM_CGR_TARG_* */ |
| 560 | }; | 560 | }; |
