Lines Matching defs:hci

14 #include "hci.h"
23 #define pio_reg_read(r) readl(hci->PIO_regs + (PIO_##r))
24 #define pio_reg_write(r, v) writel(v, hci->PIO_regs + (PIO_##r))
139 static int hci_pio_init(struct i3c_hci *hci)
148 hci->io_data = pio;
152 dev_info(&hci->master.dev, "CMD/RESP FIFO = %ld entries\n",
154 dev_info(&hci->master.dev, "IBI FIFO = %ld bytes\n",
156 dev_info(&hci->master.dev, "RX data FIFO = %d bytes\n",
158 dev_info(&hci->master.dev, "TX data FIFO = %d bytes\n",
168 if (hci->version_major == 1) {
209 static void hci_pio_cleanup(struct i3c_hci *hci)
211 struct hci_pio_data *pio = hci->io_data;
223 hci->io_data = NULL;
227 static void hci_pio_write_cmd(struct i3c_hci *hci, struct hci_xfer *xfer)
233 if (hci->cmd == &mipi_i3c_hci_cmd_v2) {
241 static bool hci_pio_do_rx(struct i3c_hci *hci, struct hci_pio_data *pio)
266 static void hci_pio_do_trailing_rx(struct i3c_hci *hci,
307 static bool hci_pio_do_tx(struct i3c_hci *hci, struct hci_pio_data *pio)
347 static bool hci_pio_process_rx(struct i3c_hci *hci, struct hci_pio_data *pio)
349 while (pio->curr_rx && hci_pio_do_rx(hci, pio))
354 static bool hci_pio_process_tx(struct i3c_hci *hci, struct hci_pio_data *pio)
356 while (pio->curr_tx && hci_pio_do_tx(hci, pio))
361 static void hci_pio_queue_data(struct i3c_hci *hci, struct hci_pio_data *pio)
378 if (!hci_pio_process_rx(hci, pio))
388 if (!hci_pio_process_tx(hci, pio))
394 static void hci_pio_push_to_next_rx(struct i3c_hci *hci, struct hci_xfer *xfer,
417 dev_err(&hci->master.dev, "pushing RX data to unexistent xfer\n");
425 hci_pio_push_to_next_rx(hci, xfer, chunk - left);
473 static void hci_pio_err(struct i3c_hci *hci, struct hci_pio_data *pio,
476 static bool hci_pio_process_resp(struct i3c_hci *hci, struct hci_pio_data *pio)
486 dev_err(&hci->master.dev,
490 hci_pio_err(hci, pio, STAT_PROG_ERRORS);
506 hci_pio_do_trailing_rx(hci, pio,
511 hci_pio_push_to_next_rx(hci, xfer, to_keep);
515 if (hci_pio_process_rx(hci, pio))
542 static void hci_pio_queue_resp(struct i3c_hci *hci, struct hci_pio_data *pio)
556 if (!hci_pio_process_resp(hci, pio))
561 static bool hci_pio_process_cmd(struct i3c_hci *hci, struct hci_pio_data *pio)
569 hci_pio_queue_data(hci, pio);
575 hci_pio_queue_resp(hci, pio);
579 hci_pio_write_cmd(hci, pio->curr_xfer);
588 static int hci_pio_queue_xfer(struct i3c_hci *hci, struct hci_xfer *xfer, int n)
590 struct hci_pio_data *pio = hci->io_data;
611 if (!hci_pio_process_cmd(hci, pio))
621 static bool hci_pio_dequeue_xfer_common(struct i3c_hci *hci,
683 static bool hci_pio_dequeue_xfer(struct i3c_hci *hci, struct hci_xfer *xfer, int n)
685 struct hci_pio_data *pio = hci->io_data;
692 readl(hci->base_regs + 0x20), readl(hci->base_regs + 0x28));
694 ret = hci_pio_dequeue_xfer_common(hci, pio, xfer, n);
699 static void hci_pio_err(struct i3c_hci *hci, struct hci_pio_data *pio,
708 dev_err(&hci->master.dev,
717 dev_err(&hci->master.dev,
728 hci_pio_dequeue_xfer_common(hci, pio, pio->curr_resp, 1);
731 hci_pio_dequeue_xfer_common(hci, pio, pio->curr_tx, 1);
733 mipi_i3c_hci_pio_reset(hci);
734 mipi_i3c_hci_resume(hci);
740 static void hci_pio_set_ibi_thresh(struct i3c_hci *hci,
756 static bool hci_pio_get_ibi_segment(struct i3c_hci *hci,
769 hci_pio_set_ibi_thresh(hci, pio, thresh_val);
791 hci_pio_set_ibi_thresh(hci, pio, 1);
806 static bool hci_pio_prep_new_ibi(struct i3c_hci *hci, struct hci_pio_data *pio)
826 dev_err(&hci->master.dev, "IBI error from %#x\n", ibi->addr);
834 dev = i3c_hci_addr_to_dev(hci, ibi->addr);
836 dev_err(&hci->master.dev,
846 dev_err(&hci->master.dev, "IBI payload too big (%d > %d)\n",
853 dev_err(&hci->master.dev, "no free slot for IBI\n");
861 static void hci_pio_free_ibi_slot(struct i3c_hci *hci, struct hci_pio_data *pio)
873 static bool hci_pio_process_ibi(struct i3c_hci *hci, struct hci_pio_data *pio)
878 if (!hci_pio_prep_new_ibi(hci, pio))
886 if (!hci_pio_get_ibi_segment(hci, pio))
894 hci_pio_set_ibi_thresh(hci, pio, 1);
904 hci_pio_set_ibi_thresh(hci, pio, 1);
915 hci_pio_set_ibi_thresh(hci, pio, 1);
922 dev_err(&hci->master.dev,
925 hci_pio_free_ibi_slot(hci, pio);
931 dev_err(&hci->master.dev,
934 hci_pio_free_ibi_slot(hci, pio);
941 static int hci_pio_request_ibi(struct i3c_hci *hci, struct i3c_dev_desc *dev,
962 static void hci_pio_free_ibi(struct i3c_hci *hci, struct i3c_dev_desc *dev)
972 static void hci_pio_recycle_ibi_slot(struct i3c_hci *hci,
982 static bool hci_pio_irq_handler(struct i3c_hci *hci, unsigned int unused)
984 struct hci_pio_data *pio = hci->io_data;
997 hci_pio_process_ibi(hci, pio);
1000 if (hci_pio_process_rx(hci, pio))
1003 if (hci_pio_process_tx(hci, pio))
1006 if (hci_pio_process_resp(hci, pio))
1011 dev_warn_ratelimited(&hci->master.dev,
1018 hci_pio_err(hci, pio, status & STAT_ALL_ERRORS);
1022 if (hci_pio_process_cmd(hci, pio))