summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/i3c/master/mipi-i3c-hci/core.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
index 8b8e3952d41d..fc0a47a36961 100644
--- a/drivers/i3c/master/mipi-i3c-hci/core.c
+++ b/drivers/i3c/master/mipi-i3c-hci/core.c
@@ -681,27 +681,31 @@ static int i3c_hci_reset_and_init(struct i3c_hci *hci)
}
}
- /* Try activating DMA operations first */
- if (hci->RHS_regs) {
- ret = i3c_hci_set_io_mode(hci, true);
- if (!ret) {
- hci->io = &mipi_i3c_hci_dma;
- dev_dbg(&hci->master.dev, "Using DMA\n");
+ if (hci->io) {
+ ret = i3c_hci_set_io_mode(hci, hci->io == &mipi_i3c_hci_dma);
+ } else {
+ /* Try activating DMA operations first */
+ if (hci->RHS_regs) {
+ ret = i3c_hci_set_io_mode(hci, true);
+ if (!ret) {
+ hci->io = &mipi_i3c_hci_dma;
+ dev_dbg(&hci->master.dev, "Using DMA\n");
+ }
}
- }
- /* If no DMA, try PIO */
- if (!hci->io && hci->PIO_regs) {
- ret = i3c_hci_set_io_mode(hci, false);
- if (!ret) {
- hci->io = &mipi_i3c_hci_pio;
- dev_dbg(&hci->master.dev, "Using PIO\n");
+ /* If no DMA, try PIO */
+ if (!hci->io && hci->PIO_regs) {
+ ret = i3c_hci_set_io_mode(hci, false);
+ if (!ret) {
+ hci->io = &mipi_i3c_hci_pio;
+ dev_dbg(&hci->master.dev, "Using PIO\n");
+ }
}
- }
- if (!hci->io) {
- dev_err(&hci->master.dev, "neither DMA nor PIO can be used\n");
- ret = ret ?: -EINVAL;
+ if (!hci->io) {
+ dev_err(&hci->master.dev, "neither DMA nor PIO can be used\n");
+ ret = ret ?: -EINVAL;
+ }
}
if (ret)
return ret;