Skip to content

Commit 88c5cf4

Browse files
claudiubezneaAndi Shyti
authored andcommitted
i2c: riic: Define individual arrays to describe the register offsets
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 <[email protected]> Signed-off-by: Claudiu Beznea <[email protected]> Signed-off-by: Andi Shyti <[email protected]>
1 parent 5332613 commit 88c5cf4

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

drivers/i2c/busses/i2c-riic.c

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ enum riic_reg_list {
9191
};
9292

9393
struct riic_of_data {
94-
u8 regs[RIIC_REG_END];
94+
const u8 *regs;
9595
};
9696

9797
struct riic_dev {
@@ -522,36 +522,40 @@ static void riic_i2c_remove(struct platform_device *pdev)
522522
pm_runtime_dont_use_autosuspend(dev);
523523
}
524524

525+
static const u8 riic_rz_a_regs[RIIC_REG_END] = {
526+
[RIIC_ICCR1] = 0x00,
527+
[RIIC_ICCR2] = 0x04,
528+
[RIIC_ICMR1] = 0x08,
529+
[RIIC_ICMR3] = 0x10,
530+
[RIIC_ICSER] = 0x18,
531+
[RIIC_ICIER] = 0x1c,
532+
[RIIC_ICSR2] = 0x24,
533+
[RIIC_ICBRL] = 0x34,
534+
[RIIC_ICBRH] = 0x38,
535+
[RIIC_ICDRT] = 0x3c,
536+
[RIIC_ICDRR] = 0x40,
537+
};
538+
525539
static const struct riic_of_data riic_rz_a_info = {
526-
.regs = {
527-
[RIIC_ICCR1] = 0x00,
528-
[RIIC_ICCR2] = 0x04,
529-
[RIIC_ICMR1] = 0x08,
530-
[RIIC_ICMR3] = 0x10,
531-
[RIIC_ICSER] = 0x18,
532-
[RIIC_ICIER] = 0x1c,
533-
[RIIC_ICSR2] = 0x24,
534-
[RIIC_ICBRL] = 0x34,
535-
[RIIC_ICBRH] = 0x38,
536-
[RIIC_ICDRT] = 0x3c,
537-
[RIIC_ICDRR] = 0x40,
538-
},
540+
.regs = riic_rz_a_regs,
541+
};
542+
543+
static const u8 riic_rz_v2h_regs[RIIC_REG_END] = {
544+
[RIIC_ICCR1] = 0x00,
545+
[RIIC_ICCR2] = 0x01,
546+
[RIIC_ICMR1] = 0x02,
547+
[RIIC_ICMR3] = 0x04,
548+
[RIIC_ICSER] = 0x06,
549+
[RIIC_ICIER] = 0x07,
550+
[RIIC_ICSR2] = 0x09,
551+
[RIIC_ICBRL] = 0x10,
552+
[RIIC_ICBRH] = 0x11,
553+
[RIIC_ICDRT] = 0x12,
554+
[RIIC_ICDRR] = 0x13,
539555
};
540556

541557
static const struct riic_of_data riic_rz_v2h_info = {
542-
.regs = {
543-
[RIIC_ICCR1] = 0x00,
544-
[RIIC_ICCR2] = 0x01,
545-
[RIIC_ICMR1] = 0x02,
546-
[RIIC_ICMR3] = 0x04,
547-
[RIIC_ICSER] = 0x06,
548-
[RIIC_ICIER] = 0x07,
549-
[RIIC_ICSR2] = 0x09,
550-
[RIIC_ICBRL] = 0x10,
551-
[RIIC_ICBRH] = 0x11,
552-
[RIIC_ICDRT] = 0x12,
553-
[RIIC_ICDRR] = 0x13,
554-
},
558+
.regs = riic_rz_v2h_regs,
555559
};
556560

557561
static int riic_i2c_suspend(struct device *dev)

0 commit comments

Comments
 (0)