Skip to content

Commit 45357c9

Browse files
jhnikulaalexandrebelloni
authored andcommitted
i3c: mipi-i3c-hci: Handle interrupts according to current specifications
Current MIPI I3C HCI specification versions pre-1.0, 1.0. 1.1 and 1.2 don't have cascaded interrupt bits for the PIO and DMA (ring headers) in the INTR_STATUS register as implemented currently in the code. Instead bits 9:0 are marked as reserved with unspecified reset value. To my understanding they were planned to be introduced in the version 2 and the original commit 9ad9a52 ("i3c/master: introduce the mipi-i3c-hci driver") was coding ahead according to a draft. With remarks though. This is causing that the DMA handler is not called until at least one reserved bit 7:0 is set in the INTR_STATUS. Since it looks that idea was dropped in later official versions and to make able to handle DMA interrupts on an HW that is implemented according to current specifications call assigned PIO or DMA IO handler unconditionally. While doing so remove cascaded interrupt bit definitions and the mask argument passed to the handler functions. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Link: https://lore.kernel.org/r/20240920144432.62370-3-jarkko.nikula@linux.intel.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 6ca2738 commit 45357c9

File tree

4 files changed

+7
-21
lines changed

4 files changed

+7
-21
lines changed

drivers/i3c/master/mipi-i3c-hci/core.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@
8080
#define INTR_HC_CMD_SEQ_UFLOW_STAT BIT(12) /* Cmd Sequence Underflow */
8181
#define INTR_HC_RESET_CANCEL BIT(11) /* HC Cancelled Reset */
8282
#define INTR_HC_INTERNAL_ERR BIT(10) /* HC Internal Error */
83-
#define INTR_HC_PIO BIT(8) /* cascaded PIO interrupt */
84-
#define INTR_HC_RINGS GENMASK(7, 0)
8583

8684
#define DAT_SECTION 0x30 /* Device Address Table */
8785
#define DAT_ENTRY_SIZE GENMASK(31, 28)
@@ -597,9 +595,6 @@ static irqreturn_t i3c_hci_irq_handler(int irq, void *dev_id)
597595

598596
if (val) {
599597
reg_write(INTR_STATUS, val);
600-
} else {
601-
/* v1.0 does not have PIO cascaded notification bits */
602-
val |= INTR_HC_PIO;
603598
}
604599

605600
if (val & INTR_HC_RESET_CANCEL) {
@@ -610,14 +605,9 @@ static irqreturn_t i3c_hci_irq_handler(int irq, void *dev_id)
610605
dev_err(&hci->master.dev, "Host Controller Internal Error\n");
611606
val &= ~INTR_HC_INTERNAL_ERR;
612607
}
613-
if (val & INTR_HC_PIO) {
614-
hci->io->irq_handler(hci, 0);
615-
val &= ~INTR_HC_PIO;
616-
}
617-
if (val & INTR_HC_RINGS) {
618-
hci->io->irq_handler(hci, val & INTR_HC_RINGS);
619-
val &= ~INTR_HC_RINGS;
620-
}
608+
609+
hci->io->irq_handler(hci);
610+
621611
if (val)
622612
dev_err(&hci->master.dev, "unexpected INTR_STATUS %#x\n", val);
623613
else

drivers/i3c/master/mipi-i3c-hci/dma.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -733,20 +733,16 @@ static void hci_dma_process_ibi(struct i3c_hci *hci, struct hci_rh_data *rh)
733733
rh_reg_write(CHUNK_CONTROL, rh_reg_read(CHUNK_CONTROL) + ibi_chunks);
734734
}
735735

736-
static bool hci_dma_irq_handler(struct i3c_hci *hci, unsigned int mask)
736+
static bool hci_dma_irq_handler(struct i3c_hci *hci)
737737
{
738738
struct hci_rings_data *rings = hci->io_data;
739739
unsigned int i;
740740
bool handled = false;
741741

742-
for (i = 0; mask && i < rings->total; i++) {
742+
for (i = 0; i < rings->total; i++) {
743743
struct hci_rh_data *rh;
744744
u32 status;
745745

746-
if (!(mask & BIT(i)))
747-
continue;
748-
mask &= ~BIT(i);
749-
750746
rh = &rings->headers[i];
751747
status = rh_reg_read(INTR_STATUS);
752748
DBG("rh%d status: %#x", i, status);

drivers/i3c/master/mipi-i3c-hci/hci.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static inline void hci_free_xfer(struct hci_xfer *xfer, unsigned int n)
115115

116116
/* This abstracts PIO vs DMA operations */
117117
struct hci_io_ops {
118-
bool (*irq_handler)(struct i3c_hci *hci, unsigned int mask);
118+
bool (*irq_handler)(struct i3c_hci *hci);
119119
int (*queue_xfer)(struct i3c_hci *hci, struct hci_xfer *xfer, int n);
120120
bool (*dequeue_xfer)(struct i3c_hci *hci, struct hci_xfer *xfer, int n);
121121
int (*request_ibi)(struct i3c_hci *hci, struct i3c_dev_desc *dev,

drivers/i3c/master/mipi-i3c-hci/pio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ static void hci_pio_recycle_ibi_slot(struct i3c_hci *hci,
979979
i3c_generic_ibi_recycle_slot(dev_ibi->pool, slot);
980980
}
981981

982-
static bool hci_pio_irq_handler(struct i3c_hci *hci, unsigned int unused)
982+
static bool hci_pio_irq_handler(struct i3c_hci *hci)
983983
{
984984
struct hci_pio_data *pio = hci->io_data;
985985
u32 status;

0 commit comments

Comments
 (0)