summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2026-01-13 10:26:50 +0300
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2026-01-14 19:21:09 +0300
commitf180524a4877329bca4285e36f1fad63b70577ea (patch)
tree4aaad0e9039c909ed5d503bf7ca1373193cfea04
parenta372cfac056abb555d6c70c08af548aea0ab5cde (diff)
downloadlinux-f180524a4877329bca4285e36f1fad63b70577ea.tar.xz
i3c: mipi-i3c-hci: Introduce helper to restore DAT
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>
-rw-r--r--drivers/i3c/master/mipi-i3c-hci/dat.h1
-rw-r--r--drivers/i3c/master/mipi-i3c-hci/dat_v1.c9
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/i3c/master/mipi-i3c-hci/dat.h b/drivers/i3c/master/mipi-i3c-hci/dat.h
index 5277c65fc601..6881f19da77f 100644
--- a/drivers/i3c/master/mipi-i3c-hci/dat.h
+++ b/drivers/i3c/master/mipi-i3c-hci/dat.h
@@ -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;
diff --git a/drivers/i3c/master/mipi-i3c-hci/dat_v1.c b/drivers/i3c/master/mipi-i3c-hci/dat_v1.c
index 644ab939be1c..852966aa20d9 100644
--- a/drivers/i3c/master/mipi-i3c-hci/dat_v1.c
+++ b/drivers/i3c/master/mipi-i3c-hci/dat_v1.c
@@ -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,
};