Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

i3c: mipi-i3c-hci: Cache DAT in memory for Runtime PM restore

Prepare for Runtime PM support, which requires restoring the Device Address
Table (DAT) registers after resume. Maintain a copy of DAT in memory so it
can be reprogrammed when the controller is powered back up.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260113072702.16268-9-adrian.hunter@intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Adrian Hunter and committed by
Alexandre Belloni
a372cfac 29bf98a6

+29 -6
+23 -6
drivers/i3c/master/mipi-i3c-hci/dat_v1.c
··· 34 34 /* DAT_0_IBI_PAYLOAD W0_BIT_(12) */ 35 35 #define DAT_0_STATIC_ADDRESS W0_MASK(6, 0) 36 36 37 - #define dat_w0_read(i) readl(hci->DAT_regs + (i) * 8) 38 - #define dat_w1_read(i) readl(hci->DAT_regs + (i) * 8 + 4) 39 - #define dat_w0_write(i, v) writel(v, hci->DAT_regs + (i) * 8) 40 - #define dat_w1_write(i, v) writel(v, hci->DAT_regs + (i) * 8 + 4) 37 + #define dat_w0_read(i) hci->DAT[i].w0 38 + #define dat_w1_read(i) hci->DAT[i].w1 39 + #define dat_w0_write(i, v) hci_dat_w0_write(hci, i, v) 40 + #define dat_w1_write(i, v) hci_dat_w1_write(hci, i, v) 41 + 42 + static inline void hci_dat_w0_write(struct i3c_hci *hci, int i, u32 v) 43 + { 44 + hci->DAT[i].w0 = v; 45 + writel(v, hci->DAT_regs + i * 8); 46 + } 47 + 48 + static inline void hci_dat_w1_write(struct i3c_hci *hci, int i, u32 v) 49 + { 50 + hci->DAT[i].w1 = v; 51 + writel(v, hci->DAT_regs + i * 8 + 4); 52 + } 41 53 42 54 static int hci_dat_v1_init(struct i3c_hci *hci) 43 55 { 56 + struct device *dev = hci->master.dev.parent; 44 57 unsigned int dat_idx; 45 58 46 59 if (!hci->DAT_regs) { ··· 67 54 return -EOPNOTSUPP; 68 55 } 69 56 70 - if (!hci->DAT_data) { 71 - struct device *dev = hci->master.dev.parent; 57 + if (!hci->DAT) { 58 + hci->DAT = devm_kcalloc(dev, hci->DAT_entries, hci->DAT_entry_size, GFP_KERNEL); 59 + if (!hci->DAT) 60 + return -ENOMEM; 61 + } 72 62 63 + if (!hci->DAT_data) { 73 64 /* use a bitmap for faster free slot search */ 74 65 hci->DAT_data = devm_bitmap_zalloc(dev, hci->DAT_entries, GFP_KERNEL); 75 66 if (!hci->DAT_data)
+6
drivers/i3c/master/mipi-i3c-hci/hci.h
··· 31 31 32 32 struct hci_cmd_ops; 33 33 34 + struct dat_words { 35 + u32 w0; 36 + u32 w1; 37 + }; 38 + 34 39 /* Our main structure */ 35 40 struct i3c_hci { 36 41 struct i3c_master_controller master; ··· 56 51 unsigned int DAT_entries; 57 52 unsigned int DAT_entry_size; 58 53 void *DAT_data; 54 + struct dat_words *DAT; 59 55 unsigned int DCT_entries; 60 56 unsigned int DCT_entry_size; 61 57 u8 version_major;