Lines Matching refs:p
62 #define QBMAN_IDX_FROM_DQRR(p) (((unsigned long)(p) & 0x1ff) >> 6) argument
176 static inline u32 qbman_read_register(struct qbman_swp *p, u32 offset) in qbman_read_register() argument
178 return readl_relaxed(p->addr_cinh + offset); in qbman_read_register()
181 static inline void qbman_write_register(struct qbman_swp *p, u32 offset, in qbman_write_register() argument
184 writel_relaxed(value, p->addr_cinh + offset); in qbman_write_register()
187 static inline void *qbman_get_cmd(struct qbman_swp *p, u32 offset) in qbman_get_cmd() argument
189 return p->addr_cena + offset; in qbman_get_cmd()
249 struct qbman_swp *p = kzalloc(sizeof(*p), GFP_KERNEL); in qbman_swp_init() local
254 if (!p) in qbman_swp_init()
257 spin_lock_init(&p->access_spinlock); in qbman_swp_init()
259 p->desc = d; in qbman_swp_init()
260 p->mc.valid_bit = QB_VALID_BIT; in qbman_swp_init()
261 p->sdq = 0; in qbman_swp_init()
262 p->sdq |= qbman_sdqcr_dct_prio_ics << QB_SDQCR_DCT_SHIFT; in qbman_swp_init()
263 p->sdq |= qbman_sdqcr_fc_up_to_3 << QB_SDQCR_FC_SHIFT; in qbman_swp_init()
264 p->sdq |= QMAN_SDQCR_TOKEN << QB_SDQCR_TOK_SHIFT; in qbman_swp_init()
265 if ((p->desc->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000) in qbman_swp_init()
266 p->mr.valid_bit = QB_VALID_BIT; in qbman_swp_init()
268 atomic_set(&p->vdq.available, 1); in qbman_swp_init()
269 p->vdq.valid_bit = QB_VALID_BIT; in qbman_swp_init()
270 p->dqrr.next_idx = 0; in qbman_swp_init()
271 p->dqrr.valid_bit = QB_VALID_BIT; in qbman_swp_init()
273 if ((p->desc->qman_version & QMAN_REV_MASK) < QMAN_REV_4100) { in qbman_swp_init()
274 p->dqrr.dqrr_size = 4; in qbman_swp_init()
275 p->dqrr.reset_bug = 1; in qbman_swp_init()
277 p->dqrr.dqrr_size = 8; in qbman_swp_init()
278 p->dqrr.reset_bug = 0; in qbman_swp_init()
281 p->addr_cena = d->cena_bar; in qbman_swp_init()
282 p->addr_cinh = d->cinh_bar; in qbman_swp_init()
284 if ((p->desc->qman_version & QMAN_REV_MASK) < QMAN_REV_5000) { in qbman_swp_init()
286 reg = qbman_set_swp_cfg(p->dqrr.dqrr_size, in qbman_swp_init()
299 memset(p->addr_cena, 0, 64 * 1024); in qbman_swp_init()
300 reg = qbman_set_swp_cfg(p->dqrr.dqrr_size, in qbman_swp_init()
317 qbman_write_register(p, QBMAN_CINH_SWP_CFG, reg); in qbman_swp_init()
318 reg = qbman_read_register(p, QBMAN_CINH_SWP_CFG); in qbman_swp_init()
321 kfree(p); in qbman_swp_init()
325 if ((p->desc->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000) { in qbman_swp_init()
326 qbman_write_register(p, QBMAN_CINH_SWP_EQCR_PI, QMAN_RT_MODE); in qbman_swp_init()
327 qbman_write_register(p, QBMAN_CINH_SWP_RCR_PI, QMAN_RT_MODE); in qbman_swp_init()
335 qbman_write_register(p, QBMAN_CINH_SWP_SDQCR, 0); in qbman_swp_init()
337 p->eqcr.pi_ring_size = 8; in qbman_swp_init()
338 if ((p->desc->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000) { in qbman_swp_init()
339 p->eqcr.pi_ring_size = 32; in qbman_swp_init()
351 for (mask_size = p->eqcr.pi_ring_size; mask_size > 0; mask_size >>= 1) in qbman_swp_init()
352 p->eqcr.pi_ci_mask = (p->eqcr.pi_ci_mask << 1) + 1; in qbman_swp_init()
353 eqcr_pi = qbman_read_register(p, QBMAN_CINH_SWP_EQCR_PI); in qbman_swp_init()
354 p->eqcr.pi = eqcr_pi & p->eqcr.pi_ci_mask; in qbman_swp_init()
355 p->eqcr.pi_vb = eqcr_pi & QB_VALID_BIT; in qbman_swp_init()
356 p->eqcr.ci = qbman_read_register(p, QBMAN_CINH_SWP_EQCR_CI) in qbman_swp_init()
357 & p->eqcr.pi_ci_mask; in qbman_swp_init()
358 p->eqcr.available = p->eqcr.pi_ring_size; in qbman_swp_init()
361 qbman_swp_set_irq_coalescing(p, p->dqrr.dqrr_size - 1, 0); in qbman_swp_init()
363 return p; in qbman_swp_init()
371 void qbman_swp_finish(struct qbman_swp *p) in qbman_swp_finish() argument
373 kfree(p); in qbman_swp_finish()
382 u32 qbman_swp_interrupt_read_status(struct qbman_swp *p) in qbman_swp_interrupt_read_status() argument
384 return qbman_read_register(p, QBMAN_CINH_SWP_ISR); in qbman_swp_interrupt_read_status()
392 void qbman_swp_interrupt_clear_status(struct qbman_swp *p, u32 mask) in qbman_swp_interrupt_clear_status() argument
394 qbman_write_register(p, QBMAN_CINH_SWP_ISR, mask); in qbman_swp_interrupt_clear_status()
403 u32 qbman_swp_interrupt_get_trigger(struct qbman_swp *p) in qbman_swp_interrupt_get_trigger() argument
405 return qbman_read_register(p, QBMAN_CINH_SWP_IER); in qbman_swp_interrupt_get_trigger()
413 void qbman_swp_interrupt_set_trigger(struct qbman_swp *p, u32 mask) in qbman_swp_interrupt_set_trigger() argument
415 qbman_write_register(p, QBMAN_CINH_SWP_IER, mask); in qbman_swp_interrupt_set_trigger()
424 int qbman_swp_interrupt_get_inhibit(struct qbman_swp *p) in qbman_swp_interrupt_get_inhibit() argument
426 return qbman_read_register(p, QBMAN_CINH_SWP_IIR); in qbman_swp_interrupt_get_inhibit()
434 void qbman_swp_interrupt_set_inhibit(struct qbman_swp *p, int inhibit) in qbman_swp_interrupt_set_inhibit() argument
436 qbman_write_register(p, QBMAN_CINH_SWP_IIR, inhibit ? 0xffffffff : 0); in qbman_swp_interrupt_set_inhibit()
448 void *qbman_swp_mc_start(struct qbman_swp *p) in qbman_swp_mc_start() argument
450 if ((p->desc->qman_version & QMAN_REV_MASK) < QMAN_REV_5000) in qbman_swp_mc_start()
451 return qbman_get_cmd(p, QBMAN_CENA_SWP_CR); in qbman_swp_mc_start()
453 return qbman_get_cmd(p, QBMAN_CENA_SWP_CR_MEM); in qbman_swp_mc_start()
460 void qbman_swp_mc_submit(struct qbman_swp *p, void *cmd, u8 cmd_verb) in qbman_swp_mc_submit() argument
464 if ((p->desc->qman_version & QMAN_REV_MASK) < QMAN_REV_5000) { in qbman_swp_mc_submit()
466 *v = cmd_verb | p->mc.valid_bit; in qbman_swp_mc_submit()
468 *v = cmd_verb | p->mc.valid_bit; in qbman_swp_mc_submit()
470 qbman_write_register(p, QBMAN_CINH_SWP_CR_RT, QMAN_RT_MODE); in qbman_swp_mc_submit()
478 void *qbman_swp_mc_result(struct qbman_swp *p) in qbman_swp_mc_result() argument
482 if ((p->desc->qman_version & QMAN_REV_MASK) < QMAN_REV_5000) { in qbman_swp_mc_result()
483 ret = qbman_get_cmd(p, QBMAN_CENA_SWP_RR(p->mc.valid_bit)); in qbman_swp_mc_result()
490 p->mc.valid_bit ^= QB_VALID_BIT; in qbman_swp_mc_result()
492 ret = qbman_get_cmd(p, QBMAN_CENA_SWP_RR_MEM); in qbman_swp_mc_result()
494 if (p->mr.valid_bit != (ret[0] & QB_VALID_BIT)) in qbman_swp_mc_result()
500 p->mr.valid_bit ^= QB_VALID_BIT; in qbman_swp_mc_result()
651 uint32_t *p = NULL; in qbman_swp_enqueue_multiple_direct() local
662 p = s->addr_cena + QBMAN_CENA_SWP_EQCR_CI; in qbman_swp_enqueue_multiple_direct()
680 p = (s->addr_cena + QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask)); in qbman_swp_enqueue_multiple_direct()
682 memcpy(&p[1], &cl[1], EQ_DESC_SIZE_WITHOUT_FD - 1); in qbman_swp_enqueue_multiple_direct()
683 memcpy(&p[EQ_DESC_SIZE_FD_START/sizeof(uint32_t)], in qbman_swp_enqueue_multiple_direct()
693 p = (s->addr_cena + QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask)); in qbman_swp_enqueue_multiple_direct()
694 p[0] = cl[0] | s->eqcr.pi_vb; in qbman_swp_enqueue_multiple_direct()
696 struct qbman_eq_desc *eq_desc = (struct qbman_eq_desc *)p; in qbman_swp_enqueue_multiple_direct()
734 uint32_t *p = NULL; in qbman_swp_enqueue_multiple_mem_back() local
762 p = (s->addr_cena + QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask)); in qbman_swp_enqueue_multiple_mem_back()
764 memcpy(&p[1], &cl[1], EQ_DESC_SIZE_WITHOUT_FD - 1); in qbman_swp_enqueue_multiple_mem_back()
765 memcpy(&p[EQ_DESC_SIZE_FD_START/sizeof(uint32_t)], in qbman_swp_enqueue_multiple_mem_back()
773 p = (s->addr_cena + QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask)); in qbman_swp_enqueue_multiple_mem_back()
774 p[0] = cl[0] | s->eqcr.pi_vb; in qbman_swp_enqueue_multiple_mem_back()
776 struct qbman_eq_desc *eq_desc = (struct qbman_eq_desc *)p; in qbman_swp_enqueue_multiple_mem_back()
811 uint32_t *p; in qbman_swp_enqueue_multiple_desc_direct() local
820 p = s->addr_cena + QBMAN_CENA_SWP_EQCR_CI; in qbman_swp_enqueue_multiple_desc_direct()
834 p = (s->addr_cena + QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask)); in qbman_swp_enqueue_multiple_desc_direct()
837 memcpy(&p[1], &cl[1], EQ_DESC_SIZE_WITHOUT_FD - 1); in qbman_swp_enqueue_multiple_desc_direct()
838 memcpy(&p[EQ_DESC_SIZE_FD_START/sizeof(uint32_t)], in qbman_swp_enqueue_multiple_desc_direct()
848 p = (s->addr_cena + QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask)); in qbman_swp_enqueue_multiple_desc_direct()
850 p[0] = cl[0] | s->eqcr.pi_vb; in qbman_swp_enqueue_multiple_desc_direct()
881 uint32_t *p; in qbman_swp_enqueue_multiple_desc_mem_back() local
904 p = (s->addr_cena + QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask)); in qbman_swp_enqueue_multiple_desc_mem_back()
907 memcpy(&p[1], &cl[1], EQ_DESC_SIZE_WITHOUT_FD - 1); in qbman_swp_enqueue_multiple_desc_mem_back()
908 memcpy(&p[EQ_DESC_SIZE_FD_START/sizeof(uint32_t)], in qbman_swp_enqueue_multiple_desc_mem_back()
916 p = (s->addr_cena + QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask)); in qbman_swp_enqueue_multiple_desc_mem_back()
918 p[0] = cl[0] | s->eqcr.pi_vb; in qbman_swp_enqueue_multiple_desc_mem_back()
1102 struct qbman_pull_desc *p; in qbman_swp_pull_direct() local
1110 p = qbman_get_cmd(s, QBMAN_CENA_SWP_VDQCR); in qbman_swp_pull_direct()
1112 p = qbman_get_cmd(s, QBMAN_CENA_SWP_VDQCR_MEM); in qbman_swp_pull_direct()
1113 p->numf = d->numf; in qbman_swp_pull_direct()
1114 p->tok = QMAN_DQ_TOKEN_VALID; in qbman_swp_pull_direct()
1115 p->dq_src = d->dq_src; in qbman_swp_pull_direct()
1116 p->rsp_addr = d->rsp_addr; in qbman_swp_pull_direct()
1117 p->rsp_addr_virt = d->rsp_addr_virt; in qbman_swp_pull_direct()
1120 p->verb = d->verb | s->vdq.valid_bit; in qbman_swp_pull_direct()
1138 struct qbman_pull_desc *p; in qbman_swp_pull_mem_back() local
1146 p = qbman_get_cmd(s, QBMAN_CENA_SWP_VDQCR); in qbman_swp_pull_mem_back()
1148 p = qbman_get_cmd(s, QBMAN_CENA_SWP_VDQCR_MEM); in qbman_swp_pull_mem_back()
1149 p->numf = d->numf; in qbman_swp_pull_mem_back()
1150 p->tok = QMAN_DQ_TOKEN_VALID; in qbman_swp_pull_mem_back()
1151 p->dq_src = d->dq_src; in qbman_swp_pull_mem_back()
1152 p->rsp_addr = d->rsp_addr; in qbman_swp_pull_mem_back()
1153 p->rsp_addr_virt = d->rsp_addr_virt; in qbman_swp_pull_mem_back()
1156 p->verb = d->verb | s->vdq.valid_bit; in qbman_swp_pull_mem_back()
1179 struct dpaa2_dq *p; in qbman_swp_dqrr_next_direct() local
1217 p = qbman_get_cmd(s, QBMAN_CENA_SWP_DQRR(s->dqrr.next_idx)); in qbman_swp_dqrr_next_direct()
1218 verb = p->dq.verb; in qbman_swp_dqrr_next_direct()
1246 flags = p->dq.stat; in qbman_swp_dqrr_next_direct()
1255 return p; in qbman_swp_dqrr_next_direct()
1271 struct dpaa2_dq *p; in qbman_swp_dqrr_next_mem_back() local
1309 p = qbman_get_cmd(s, QBMAN_CENA_SWP_DQRR_MEM(s->dqrr.next_idx)); in qbman_swp_dqrr_next_mem_back()
1310 verb = p->dq.verb; in qbman_swp_dqrr_next_mem_back()
1338 flags = p->dq.stat; in qbman_swp_dqrr_next_mem_back()
1347 return p; in qbman_swp_dqrr_next_mem_back()
1456 struct qbman_release_desc *p; in qbman_swp_release_direct() local
1467 p = qbman_get_cmd(s, QBMAN_CENA_SWP_RCR(RAR_IDX(rar))); in qbman_swp_release_direct()
1471 p->buf[i] = cpu_to_le64(buffers[i]); in qbman_swp_release_direct()
1472 p->bpid = d->bpid; in qbman_swp_release_direct()
1479 p->verb = d->verb | RAR_VB(rar) | num_buffers; in qbman_swp_release_direct()
1498 struct qbman_release_desc *p; in qbman_swp_release_mem_back() local
1509 p = qbman_get_cmd(s, QBMAN_CENA_SWP_RCR_MEM(RAR_IDX(rar))); in qbman_swp_release_mem_back()
1513 p->buf[i] = cpu_to_le64(buffers[i]); in qbman_swp_release_mem_back()
1514 p->bpid = d->bpid; in qbman_swp_release_mem_back()
1516 p->verb = d->verb | RAR_VB(rar) | num_buffers; in qbman_swp_release_mem_back()
1554 struct qbman_acquire_desc *p; in qbman_swp_acquire() local
1562 p = qbman_swp_mc_start(s); in qbman_swp_acquire()
1564 if (!p) in qbman_swp_acquire()
1568 p->bpid = cpu_to_le16(bpid); in qbman_swp_acquire()
1569 p->num = num_buffers; in qbman_swp_acquire()
1572 r = qbman_swp_mc_complete(s, p, QBMAN_MC_ACQUIRE); in qbman_swp_acquire()
1616 struct qbman_alt_fq_state_desc *p; in qbman_swp_alt_fq_state() local
1620 p = qbman_swp_mc_start(s); in qbman_swp_alt_fq_state()
1621 if (!p) in qbman_swp_alt_fq_state()
1624 p->fqid = cpu_to_le32(fqid & ALT_FQ_FQID_MASK); in qbman_swp_alt_fq_state()
1627 r = qbman_swp_mc_complete(s, p, alt_fq_verb); in qbman_swp_alt_fq_state()
1670 struct qbman_cdan_ctrl_desc *p = NULL; in qbman_swp_CDAN_set() local
1674 p = qbman_swp_mc_start(s); in qbman_swp_CDAN_set()
1675 if (!p) in qbman_swp_CDAN_set()
1679 p->ch = cpu_to_le16(channelid); in qbman_swp_CDAN_set()
1680 p->we = we_mask; in qbman_swp_CDAN_set()
1682 p->ctrl = 1; in qbman_swp_CDAN_set()
1684 p->ctrl = 0; in qbman_swp_CDAN_set()
1685 p->cdan_ctx = cpu_to_le64(ctx); in qbman_swp_CDAN_set()
1688 r = qbman_swp_mc_complete(s, p, QBMAN_WQCHAN_CONFIGURE); in qbman_swp_CDAN_set()
1720 struct qbman_fq_query_desc *p; in qbman_fq_query_state() local
1723 p = (struct qbman_fq_query_desc *)qbman_swp_mc_start(s); in qbman_fq_query_state()
1724 if (!p) in qbman_fq_query_state()
1728 p->fqid = cpu_to_le32(fqid & 0x00FFFFFF); in qbman_fq_query_state()
1729 resp = qbman_swp_mc_complete(s, p, QBMAN_FQ_QUERY_NP); in qbman_fq_query_state()
1742 p->fqid, r->rslt); in qbman_fq_query_state()
1769 struct qbman_bp_query_desc *p; in qbman_bp_query() local
1772 p = (struct qbman_bp_query_desc *)qbman_swp_mc_start(s); in qbman_bp_query()
1773 if (!p) in qbman_bp_query()
1776 p->bpid = cpu_to_le16(bpid); in qbman_bp_query()
1777 resp = qbman_swp_mc_complete(s, p, QBMAN_BP_QUERY); in qbman_bp_query()
1810 int qbman_swp_set_irq_coalescing(struct qbman_swp *p, u32 irq_threshold, in qbman_swp_set_irq_coalescing() argument
1818 itp = (irq_holdoff * 1000) / p->desc->qman_256_cycles_per_ns; in qbman_swp_set_irq_coalescing()
1820 max_holdoff = (p->desc->qman_256_cycles_per_ns * 4096) / 1000; in qbman_swp_set_irq_coalescing()
1825 if (irq_threshold >= p->dqrr.dqrr_size) { in qbman_swp_set_irq_coalescing()
1826 pr_err("irq_threshold must be < %u\n", p->dqrr.dqrr_size - 1); in qbman_swp_set_irq_coalescing()
1830 p->irq_threshold = irq_threshold; in qbman_swp_set_irq_coalescing()
1831 p->irq_holdoff = irq_holdoff; in qbman_swp_set_irq_coalescing()
1833 qbman_write_register(p, QBMAN_CINH_SWP_DQRR_ITR, irq_threshold); in qbman_swp_set_irq_coalescing()
1834 qbman_write_register(p, QBMAN_CINH_SWP_ITPR, itp); in qbman_swp_set_irq_coalescing()
1846 void qbman_swp_get_irq_coalescing(struct qbman_swp *p, u32 *irq_threshold, in qbman_swp_get_irq_coalescing() argument
1850 *irq_threshold = p->irq_threshold; in qbman_swp_get_irq_coalescing()
1852 *irq_holdoff = p->irq_holdoff; in qbman_swp_get_irq_coalescing()