Lines Matching refs:udma_q
107 static int al_udma_q_config(struct al_udma_q *udma_q) in al_udma_q_config() argument
112 if (udma_q->udma->type == UDMA_TX) { in al_udma_q_config()
113 reg_addr = &udma_q->q_regs->m2s_q.rlimit.mask; in al_udma_q_config()
130 static int al_udma_q_config_compl(struct al_udma_q *udma_q) in al_udma_q_config_compl() argument
135 if (udma_q->udma->type == UDMA_TX) in al_udma_q_config_compl()
136 reg_addr = &udma_q->q_regs->m2s_q.comp_cfg; in al_udma_q_config_compl()
138 reg_addr = &udma_q->q_regs->s2m_q.comp_cfg; in al_udma_q_config_compl()
142 if (udma_q->flags & AL_UDMA_Q_FLAGS_NO_COMP_UPDATE) in al_udma_q_config_compl()
147 if (udma_q->flags & AL_UDMA_Q_FLAGS_EN_COMP_COAL) in al_udma_q_config_compl()
155 if (udma_q->udma->type == UDMA_RX) { in al_udma_q_config_compl()
157 &udma_q->udma->udma_regs->s2m.s2m_comp.cfg_1c); in al_udma_q_config_compl()
160 val |= (udma_q->cdesc_size >> 2) in al_udma_q_config_compl()
162 al_reg_write32(&udma_q->udma->udma_regs->s2m.s2m_comp.cfg_1c in al_udma_q_config_compl()
173 static int al_udma_q_set_pointers(struct al_udma_q *udma_q) in al_udma_q_set_pointers() argument
177 al_assert((AL_ADDR_LOW(udma_q->desc_phy_base) & in al_udma_q_set_pointers()
179 al_reg_write32(&udma_q->q_regs->rings.drbp_low, in al_udma_q_set_pointers()
180 AL_ADDR_LOW(udma_q->desc_phy_base)); in al_udma_q_set_pointers()
181 al_reg_write32(&udma_q->q_regs->rings.drbp_high, in al_udma_q_set_pointers()
182 AL_ADDR_HIGH(udma_q->desc_phy_base)); in al_udma_q_set_pointers()
184 al_reg_write32(&udma_q->q_regs->rings.drl, udma_q->size); in al_udma_q_set_pointers()
187 if (udma_q->cdesc_base_ptr == NULL) { in al_udma_q_set_pointers()
188 udma_q->flags |= AL_UDMA_Q_FLAGS_NO_COMP_UPDATE; in al_udma_q_set_pointers()
192 al_assert((AL_ADDR_LOW(udma_q->cdesc_phy_base) & in al_udma_q_set_pointers()
194 al_reg_write32(&udma_q->q_regs->rings.crbp_low, in al_udma_q_set_pointers()
195 AL_ADDR_LOW(udma_q->cdesc_phy_base)); in al_udma_q_set_pointers()
196 al_reg_write32(&udma_q->q_regs->rings.crbp_high, in al_udma_q_set_pointers()
197 AL_ADDR_HIGH(udma_q->cdesc_phy_base)); in al_udma_q_set_pointers()
199 al_udma_q_config_compl(udma_q); in al_udma_q_set_pointers()
211 static int al_udma_q_enable(struct al_udma_q *udma_q, int enable) in al_udma_q_enable() argument
213 uint32_t reg = al_reg_read32(&udma_q->q_regs->rings.cfg); in al_udma_q_enable()
217 udma_q->status = AL_QUEUE_ENABLED; in al_udma_q_enable()
220 udma_q->status = AL_QUEUE_DISABLED; in al_udma_q_enable()
222 al_reg_write32(&udma_q->q_regs->rings.cfg, reg); in al_udma_q_enable()
262 udma->udma_q[i].status = AL_QUEUE_NOT_INITIALIZED; in al_udma_init()
277 struct al_udma_q *udma_q; in al_udma_q_init() local
287 if (udma->udma_q[qid].status == AL_QUEUE_ENABLED) { in al_udma_q_init()
308 udma_q = &udma->udma_q[qid]; in al_udma_q_init()
311 udma_q->q_regs = (union udma_q_regs __iomem *) in al_udma_q_init()
314 udma_q->q_regs = (union udma_q_regs __iomem *) in al_udma_q_init()
317 udma_q->adapter_rev_id = q_params->adapter_rev_id; in al_udma_q_init()
318 udma_q->size = q_params->size; in al_udma_q_init()
319 udma_q->size_mask = q_params->size - 1; in al_udma_q_init()
320 udma_q->desc_base_ptr = q_params->desc_base; in al_udma_q_init()
321 udma_q->desc_phy_base = q_params->desc_phy_base; in al_udma_q_init()
322 udma_q->cdesc_base_ptr = q_params->cdesc_base; in al_udma_q_init()
323 udma_q->cdesc_phy_base = q_params->cdesc_phy_base; in al_udma_q_init()
324 udma_q->cdesc_size = q_params->cdesc_size; in al_udma_q_init()
326 udma_q->next_desc_idx = 0; in al_udma_q_init()
327 udma_q->next_cdesc_idx = 0; in al_udma_q_init()
328 udma_q->end_cdesc_ptr = (uint8_t *) udma_q->cdesc_base_ptr + in al_udma_q_init()
329 (udma_q->size - 1) * udma_q->cdesc_size; in al_udma_q_init()
330 udma_q->comp_head_idx = 0; in al_udma_q_init()
331 udma_q->comp_head_ptr = (union al_udma_cdesc *)udma_q->cdesc_base_ptr; in al_udma_q_init()
332 udma_q->desc_ring_id = AL_UDMA_INITIAL_RING_ID; in al_udma_q_init()
333 udma_q->comp_ring_id = AL_UDMA_INITIAL_RING_ID; in al_udma_q_init()
335 udma_q->desc_ctrl_bits = AL_UDMA_INITIAL_RING_ID << in al_udma_q_init()
338 udma_q->pkt_crnt_descs = 0; in al_udma_q_init()
339 udma_q->flags = 0; in al_udma_q_init()
340 udma_q->status = AL_QUEUE_DISABLED; in al_udma_q_init()
341 udma_q->udma = udma; in al_udma_q_init()
342 udma_q->qid = qid; in al_udma_q_init()
345 al_udma_q_config(udma_q); in al_udma_q_init()
347 al_udma_q_set_pointers(udma_q); in al_udma_q_init()
350 al_udma_q_enable(udma_q, 1); in al_udma_q_init()
354 udma_q->udma->name, udma_q->qid, in al_udma_q_init()
370 int al_udma_q_reset(struct al_udma_q *udma_q) in al_udma_q_reset() argument
378 al_assert(udma_q); in al_udma_q_reset()
381 al_udma_q_enable(udma_q, 0); in al_udma_q_reset()
384 status_reg = &udma_q->q_regs->rings.status; in al_udma_q_reset()
399 "scheduler disable\n", udma_q->udma->name, udma_q->qid, in al_udma_q_reset()
406 dcp_reg = &udma_q->q_regs->rings.dcp; in al_udma_q_reset()
407 crhp_reg = &udma_q->q_regs->rings.crhp; in al_udma_q_reset()
422 udma_q->udma->name, udma_q->qid, __func__); in al_udma_q_reset()
427 if (udma_q->udma->type == UDMA_TX) in al_udma_q_reset()
428 q_sw_ctrl_reg = &udma_q->q_regs->m2s_q.q_sw_ctrl; in al_udma_q_reset()
430 q_sw_ctrl_reg = &udma_q->q_regs->s2m_q.q_sw_ctrl; in al_udma_q_reset()
451 *q_handle = &udma->udma_q[qid]; in al_udma_q_handle_get()
554 struct al_udma_q *udma_q, in al_udma_cdesc_packet_get() argument
562 al_assert(!(udma_q->flags & AL_UDMA_Q_FLAGS_NO_COMP_UPDATE)); in al_udma_cdesc_packet_get()
565 curr = udma_q->comp_head_ptr; in al_udma_cdesc_packet_get()
569 if (unlikely(al_udma_new_cdesc(udma_q, comp_flags) == AL_FALSE)) in al_udma_cdesc_packet_get()
572 count = udma_q->pkt_crnt_descs + 1; in al_udma_cdesc_packet_get()
574 curr = al_cdesc_next_update(udma_q, curr); in al_udma_cdesc_packet_get()
576 if (unlikely(al_udma_new_cdesc(udma_q, comp_flags) in al_udma_cdesc_packet_get()
582 udma_q->pkt_crnt_descs = count; in al_udma_cdesc_packet_get()
583 udma_q->comp_head_ptr = curr; in al_udma_cdesc_packet_get()
588 al_assert(count <= udma_q->size); in al_udma_cdesc_packet_get()
591 *cdesc = al_udma_cdesc_idx_to_ptr(udma_q, udma_q->next_cdesc_idx); in al_udma_cdesc_packet_get()
592 udma_q->pkt_crnt_descs = 0; in al_udma_cdesc_packet_get()
593 udma_q->comp_head_ptr = al_cdesc_next_update(udma_q, curr); in al_udma_cdesc_packet_get()
596 " descs %d\n", udma_q->udma->name, udma_q->qid, *cdesc, in al_udma_cdesc_packet_get()
597 udma_q->next_cdesc_idx, count); in al_udma_cdesc_packet_get()