]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i3c: mipi-i3c-hci: Introduce helper to restore DAT
authorAdrian Hunter <adrian.hunter@intel.com>
Tue, 13 Jan 2026 07:26:50 +0000 (09:26 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 14 Jan 2026 16:21:09 +0000 (17:21 +0100)
Add a dedicated function to restore the Device Address Table (DAT) in
preparation for Runtime PM support.  This will allow reprogramming the DAT
after the controller resumes from a low-power state.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260113072702.16268-10-adrian.hunter@intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/i3c/master/mipi-i3c-hci/dat.h
drivers/i3c/master/mipi-i3c-hci/dat_v1.c

index 5277c65fc601f8a71dfecb024c15f000382cc414..6881f19da77f20c3536fed029d38bdcd9d8cb07a 100644 (file)
@@ -24,6 +24,7 @@ struct hci_dat_ops {
        void (*set_flags)(struct i3c_hci *hci, unsigned int dat_idx, u32 w0, u32 w1);
        void (*clear_flags)(struct i3c_hci *hci, unsigned int dat_idx, u32 w0, u32 w1);
        int (*get_index)(struct i3c_hci *hci, u8 address);
+       void (*restore)(struct i3c_hci *hci);
 };
 
 extern const struct hci_dat_ops mipi_i3c_hci_dat_v1;
index 644ab939be1ce4b1ab21174b8d08272cc6b9fbb1..852966aa20d9804d7b00f31dd91d15f76a0b40b7 100644 (file)
@@ -181,6 +181,14 @@ static int hci_dat_v1_get_index(struct i3c_hci *hci, u8 dev_addr)
        return -ENODEV;
 }
 
+static void hci_dat_v1_restore(struct i3c_hci *hci)
+{
+       for (int i = 0; i < hci->DAT_entries; i++) {
+               writel(hci->DAT[i].w0, hci->DAT_regs + i * 8);
+               writel(hci->DAT[i].w1, hci->DAT_regs + i * 8 + 4);
+       }
+}
+
 const struct hci_dat_ops mipi_i3c_hci_dat_v1 = {
        .init                   = hci_dat_v1_init,
        .alloc_entry            = hci_dat_v1_alloc_entry,
@@ -190,4 +198,5 @@ const struct hci_dat_ops mipi_i3c_hci_dat_v1 = {
        .set_flags              = hci_dat_v1_set_flags,
        .clear_flags            = hci_dat_v1_clear_flags,
        .get_index              = hci_dat_v1_get_index,
+       .restore                = hci_dat_v1_restore,
 };