i3c: mipi-i3c-hci: Set number of SW enabled Ring Bundles earlier
authorJarkko Nikula <jarkko.nikula@linux.intel.com>
Thu, 21 Sep 2023 05:57:00 +0000 (08:57 +0300)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 25 Sep 2023 21:35:14 +0000 (23:35 +0200)
Number of software enabled Ring Bundles must be set before using them.
Otherwise Ring will not start and may be power-gated by the Host
Controller.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Link: https://lore.kernel.org/r/20230921055704.1087277-9-jarkko.nikula@linux.intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/i3c/master/mipi-i3c-hci/dma.c

index d2dbbcd..cb41d00 100644 (file)
@@ -229,6 +229,9 @@ static int hci_dma_init(struct i3c_hci *hci)
        hci->io_data = rings;
        rings->total = nr_rings;
 
+       regval = FIELD_PREP(MAX_HEADER_COUNT, rings->total);
+       rhs_reg_write(CONTROL, regval);
+
        for (i = 0; i < rings->total; i++) {
                u32 offset = rhs_reg_read(RHn_OFFSET(i));
 
@@ -329,8 +332,6 @@ ring_ready:
                                           RING_CTRL_RUN_STOP);
        }
 
-       regval = FIELD_PREP(MAX_HEADER_COUNT, rings->total);
-       rhs_reg_write(CONTROL, regval);
        return 0;
 
 err_out: