Lines Matching refs:hci

40 #define rhs_reg_read(r)		readl(hci->RHS_regs + (RHS_##r))
41 #define rhs_reg_write(r, v) writel(v, hci->RHS_regs + (RHS_##r))
165 static void hci_dma_cleanup(struct i3c_hci *hci) in hci_dma_cleanup() argument
167 struct hci_rings_data *rings = hci->io_data; in hci_dma_cleanup()
183 dma_free_coherent(&hci->master.dev, in hci_dma_cleanup()
187 dma_free_coherent(&hci->master.dev, in hci_dma_cleanup()
192 dma_free_coherent(&hci->master.dev, in hci_dma_cleanup()
196 dma_unmap_single(&hci->master.dev, rh->ibi_data_dma, in hci_dma_cleanup()
205 hci->io_data = NULL; in hci_dma_cleanup()
208 static int hci_dma_init(struct i3c_hci *hci) in hci_dma_init() argument
219 dev_info(&hci->master.dev, "%d DMA rings available\n", nr_rings); in hci_dma_init()
221 dev_err(&hci->master.dev, "number of rings should be <= 8\n"); in hci_dma_init()
229 hci->io_data = rings; in hci_dma_init()
235 dev_info(&hci->master.dev, "Ring %d at offset %#x\n", i, offset); in hci_dma_init()
240 rh->regs = hci->base_regs + offset; in hci_dma_init()
254 rh->xfer = dma_alloc_coherent(&hci->master.dev, xfers_sz, in hci_dma_init()
256 rh->resp = dma_alloc_coherent(&hci->master.dev, resps_sz, in hci_dma_init()
300 dma_alloc_coherent(&hci->master.dev, ibi_status_ring_sz, in hci_dma_init()
307 dma_map_single(&hci->master.dev, rh->ibi_data, in hci_dma_init()
309 if (dma_mapping_error(&hci->master.dev, rh->ibi_data_dma)) { in hci_dma_init()
336 hci_dma_cleanup(hci); in hci_dma_init()
340 static void hci_dma_unmap_xfer(struct i3c_hci *hci, in hci_dma_unmap_xfer() argument
348 dma_unmap_single(&hci->master.dev, in hci_dma_unmap_xfer()
354 static int hci_dma_queue_xfer(struct i3c_hci *hci, in hci_dma_queue_xfer() argument
357 struct hci_rings_data *rings = hci->io_data; in hci_dma_queue_xfer()
375 if (hci->cmd == &mipi_i3c_hci_cmd_v2) { in hci_dma_queue_xfer()
390 dma_map_single(&hci->master.dev, in hci_dma_queue_xfer()
396 if (dma_mapping_error(&hci->master.dev, in hci_dma_queue_xfer()
398 hci_dma_unmap_xfer(hci, xfer_list, i); in hci_dma_queue_xfer()
423 hci_dma_unmap_xfer(hci, xfer_list, i + 1); in hci_dma_queue_xfer()
439 static bool hci_dma_dequeue_xfer(struct i3c_hci *hci, in hci_dma_dequeue_xfer() argument
442 struct hci_rings_data *rings = hci->io_data; in hci_dma_dequeue_xfer()
455 dev_crit(&hci->master.dev, "unable to abort the ring\n"); in hci_dma_dequeue_xfer()
474 if (hci->cmd == &mipi_i3c_hci_cmd_v2) { in hci_dma_dequeue_xfer()
483 hci_dma_unmap_xfer(hci, xfer, 1); in hci_dma_dequeue_xfer()
495 static void hci_dma_xfer_done(struct i3c_hci *hci, struct hci_rh_data *rh) in hci_dma_xfer_done() argument
515 hci_dma_unmap_xfer(hci, xfer, 1); in hci_dma_xfer_done()
519 dev_err(&hci->master.dev, in hci_dma_xfer_done()
541 static int hci_dma_request_ibi(struct i3c_hci *hci, struct i3c_dev_desc *dev, in hci_dma_request_ibi() argument
562 static void hci_dma_free_ibi(struct i3c_hci *hci, struct i3c_dev_desc *dev) in hci_dma_free_ibi() argument
572 static void hci_dma_recycle_ibi_slot(struct i3c_hci *hci, in hci_dma_recycle_ibi_slot() argument
582 static void hci_dma_process_ibi(struct i3c_hci *hci, struct hci_rh_data *rh) in hci_dma_process_ibi() argument
650 dev_err(&hci->master.dev, "IBI error from %#x\n", ibi_addr); in hci_dma_process_ibi()
655 dev = i3c_hci_addr_to_dev(hci, ibi_addr); in hci_dma_process_ibi()
657 dev_err(&hci->master.dev, in hci_dma_process_ibi()
665 dev_err(&hci->master.dev, "IBI payload too big (%d > %d)\n", in hci_dma_process_ibi()
682 dev_err(&hci->master.dev, "no free slot for IBI\n"); in hci_dma_process_ibi()
694 dma_sync_single_for_cpu(&hci->master.dev, ring_ibi_data_dma, in hci_dma_process_ibi()
703 dma_sync_single_for_cpu(&hci->master.dev, ring_ibi_data_dma, in hci_dma_process_ibi()
731 static bool hci_dma_irq_handler(struct i3c_hci *hci, unsigned int mask) in hci_dma_irq_handler() argument
733 struct hci_rings_data *rings = hci->io_data; in hci_dma_irq_handler()
753 hci_dma_process_ibi(hci, rh); in hci_dma_irq_handler()
755 hci_dma_xfer_done(hci, rh); in hci_dma_irq_handler()
760 dev_notice_ratelimited(&hci->master.dev, in hci_dma_irq_handler()
763 dev_warn_ratelimited(&hci->master.dev, in hci_dma_irq_handler()
766 dev_err_ratelimited(&hci->master.dev, in hci_dma_irq_handler()