Skip to contentSkip to conversation

mfd: rsmu: support 32-bit address space

PATCH In review Min Li 2 participants 2 messages Mar 23, 2023 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Min Li

author
#1 lore raw

PATCH 2/2 mfd: rsmu: support 32-bit address space

From: Min Li <[email protected]>

We used to assume 0x2010xxxx address. Now that we need to access 0x2011xxxx address, we need to support read/write the whole 32-bit address space.

---
Change log
- Have to re-write regmap code for clockmatrix since regmap_range_cfg can't handle offset register after 32-bit address is considered

 drivers/mfd/rsmu.h       |   2 +
 drivers/mfd/rsmu_i2c.c   | 172 +++++++++++++++++++++++++++++++--------
 drivers/mfd/rsmu_spi.c   |  52 +++++++-----
 include/linux/mfd/rsmu.h |   5 +-
 4 files changed, 175 insertions(+), 56 deletions(-)
drivers/mfd/rsmu.h +2 -0
index bb88597d189f..1bb04cafa45d 100644
@@ -10,6 +10,8 @@
 
 #include <linux/mfd/rsmu.h>
 
+#define RSMU_CM_SCSR_BASE		0x20100000
+
 int rsmu_core_init(struct rsmu_ddata *rsmu);
 void rsmu_core_exit(struct rsmu_ddata *rsmu);
 
drivers/mfd/rsmu_i2c.c +136 -36

228 lines not on this page · raw message

drivers/mfd/rsmu_spi.c +33 -19

110 lines not on this page · raw message

include/linux/mfd/rsmu.h +4 -1
index 6870de608233..0379aa207428 100644
@@ -8,6 +8,9 @@
 #ifndef __LINUX_MFD_RSMU_H
 #define __LINUX_MFD_RSMU_H
 
+#define RSMU_MAX_WRITE_COUNT	(255)
+#define RSMU_MAX_READ_COUNT	(255)
+
 /* The supported devices are ClockMatrix, Sabre and SnowLotus */
 enum rsmu_type {
 	RSMU_CM		= 0x34000,
@@ -31,6 +34,6 @@ struct rsmu_ddata {
 	struct regmap *regmap;
 	struct mutex lock;
 	enum rsmu_type type;
-	u16 page;
+	u32 page;
 };
 #endif /*  __LINUX_MFD_RSMU_H */
Signature · 1 line
2.39.2
maintainer
#2 lore raw

drivers/mfd/rsmu_spi.c line 35

Quoted 8 lines · On Thu, 23 Mar 2023 12:15:18 -0400 Min Li wrote:
drivers/mfd/rsmu_spi.c +4 -2
-	u8 cmd[256] = {0};
-	u8 rsp[256] = {0};
+	u8 cmd[RSMU_MAX_READ_COUNT + 1] = {0};
+	u8 rsp[RSMU_MAX_READ_COUNT + 1] = {0};
 	int ret;
 
+	if (bytes > RSMU_MAX_READ_COUNT)
+		return -EINVAL;

Why is defining the constant to MAX_READ and checking the requested size part of this patch, the commit message only talks about addresses operation size is not mentioned in any way...