i2c: riic: Define individual arrays to describe the register offsets
authorClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Tue, 20 Aug 2024 10:19:13 +0000 (13:19 +0300)
committerAndi Shyti <andi.shyti@kernel.org>
Mon, 9 Sep 2024 22:34:01 +0000 (00:34 +0200)
Define individual arrays to describe the register offsets. In this way
we can describe different IP variants that share the same register offsets
but have differences in other characteristics. Commit prepares for the
addition of fast mode plus.

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
drivers/i2c/busses/i2c-riic.c

index eb741d4b1005ebc1a3960859f479998e19760ec3..f7293bf4b585942c6f4d4db55d6c9b3ccd044b6e 100644 (file)
@@ -91,7 +91,7 @@ enum riic_reg_list {
 };
 
 struct riic_of_data {
-       u8 regs[RIIC_REG_END];
+       const u8 *regs;
 };
 
 struct riic_dev {
@@ -522,36 +522,40 @@ static void riic_i2c_remove(struct platform_device *pdev)
        pm_runtime_dont_use_autosuspend(dev);
 }
 
+static const u8 riic_rz_a_regs[RIIC_REG_END] = {
+       [RIIC_ICCR1] = 0x00,
+       [RIIC_ICCR2] = 0x04,
+       [RIIC_ICMR1] = 0x08,
+       [RIIC_ICMR3] = 0x10,
+       [RIIC_ICSER] = 0x18,
+       [RIIC_ICIER] = 0x1c,
+       [RIIC_ICSR2] = 0x24,
+       [RIIC_ICBRL] = 0x34,
+       [RIIC_ICBRH] = 0x38,
+       [RIIC_ICDRT] = 0x3c,
+       [RIIC_ICDRR] = 0x40,
+};
+
 static const struct riic_of_data riic_rz_a_info = {
-       .regs = {
-               [RIIC_ICCR1] = 0x00,
-               [RIIC_ICCR2] = 0x04,
-               [RIIC_ICMR1] = 0x08,
-               [RIIC_ICMR3] = 0x10,
-               [RIIC_ICSER] = 0x18,
-               [RIIC_ICIER] = 0x1c,
-               [RIIC_ICSR2] = 0x24,
-               [RIIC_ICBRL] = 0x34,
-               [RIIC_ICBRH] = 0x38,
-               [RIIC_ICDRT] = 0x3c,
-               [RIIC_ICDRR] = 0x40,
-       },
+       .regs = riic_rz_a_regs,
+};
+
+static const u8 riic_rz_v2h_regs[RIIC_REG_END] = {
+       [RIIC_ICCR1] = 0x00,
+       [RIIC_ICCR2] = 0x01,
+       [RIIC_ICMR1] = 0x02,
+       [RIIC_ICMR3] = 0x04,
+       [RIIC_ICSER] = 0x06,
+       [RIIC_ICIER] = 0x07,
+       [RIIC_ICSR2] = 0x09,
+       [RIIC_ICBRL] = 0x10,
+       [RIIC_ICBRH] = 0x11,
+       [RIIC_ICDRT] = 0x12,
+       [RIIC_ICDRR] = 0x13,
 };
 
 static const struct riic_of_data riic_rz_v2h_info = {
-       .regs = {
-               [RIIC_ICCR1] = 0x00,
-               [RIIC_ICCR2] = 0x01,
-               [RIIC_ICMR1] = 0x02,
-               [RIIC_ICMR3] = 0x04,
-               [RIIC_ICSER] = 0x06,
-               [RIIC_ICIER] = 0x07,
-               [RIIC_ICSR2] = 0x09,
-               [RIIC_ICBRL] = 0x10,
-               [RIIC_ICBRH] = 0x11,
-               [RIIC_ICDRT] = 0x12,
-               [RIIC_ICDRR] = 0x13,
-       },
+       .regs = riic_rz_v2h_regs,
 };
 
 static int riic_i2c_suspend(struct device *dev)