Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47866 )
Change subject: drivers/i2c/sx9324: Add more registers and reorder ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/47866/2/src/drivers/i2c/sx9324/regi... File src/drivers/i2c/sx9324/registers.h:
https://review.coreboot.org/c/coreboot/+/47866/2/src/drivers/i2c/sx9324/regi... PS2, Line 7: REGISTER(reg_adv_ctrl0); : REGISTER(reg_adv_ctrl1); : REGISTER(reg_adv_ctrl2); : REGISTER(reg_adv_ctrl3); : REGISTER(reg_adv_ctrl4); : REGISTER(reg_adv_ctrl5); : REGISTER(reg_adv_ctrl6); : REGISTER(reg_adv_ctrl7); : REGISTER(reg_adv_ctrl8); : REGISTER(reg_adv_ctrl9); : REGISTER(reg_adv_ctrl10); : REGISTER(reg_adv_ctrl11); : REGISTER(reg_adv_ctrl12); : REGISTER(reg_adv_ctrl13); : REGISTER(reg_adv_ctrl14); : REGISTER(reg_adv_ctrl15); : REGISTER(reg_adv_ctrl16); : REGISTER(reg_adv_ctrl17); : REGISTER(reg_adv_ctrl18); : REGISTER(reg_adv_ctrl19); : REGISTER(reg_adv_ctrl20); : : REGISTER(reg_afe_ctrl0); : REGISTER(reg_afe_ctrl1); : REGISTER(reg_afe_ctrl2); : REGISTER(reg_afe_ctrl3); : REGISTER(reg_afe_ctrl4); : REGISTER(reg_afe_ctrl5); : REGISTER(reg_afe_ctrl6); : REGISTER(reg_afe_ctrl7); : REGISTER(reg_afe_ctrl8); : REGISTER(reg_afe_ctrl9); : : REGISTER(reg_afe_ph0); : REGISTER(reg_afe_ph1); : REGISTER(reg_afe_ph2); : REGISTER(reg_afe_ph3); : : REGISTER(reg_gnrl_ctrl0); : REGISTER(reg_gnrl_ctrl1); : : REGISTER(reg_irq_msk); : REGISTER(reg_irq_cfg0); : REGISTER(reg_irq_cfg2); : : REGISTER(reg_prox_ctrl0); : REGISTER(reg_prox_ctrl1); : REGISTER(reg_prox_ctrl2); : REGISTER(reg_prox_ctrl3); : REGISTER(reg_prox_ctrl4); : REGISTER(reg_prox_ctrl5); : REGISTER(reg_prox_ctrl6); : REGISTER(reg_prox_ctrl7); Hey Eric, I wonder if maybe viewing this mostly as separate arrays would make this cleaner than resorting to X macros (https://en.wikipedia.org/wiki/X_Macro).
For example: ``` struct drivers_i2c_sx9234_config { .... uint8_t adv_ctrl[21]; uint8_t afe_ctrl[10]; uint8_t afe_ph[4]; uint8_t gnrl_ctrl[2]; uint8_t irq_mask; uint8_t irq_cfg0; uint8_t irq_cfg2; uint8_t prox_ctrl[8]; } ```
This comes with the advantage that many of the register settings can be "collapsed" in the devicetree, e.g.: instead of: ``` register "reg_afe_ctrl0" = "0x00" register "reg_afe_ctrl1" = "0x10" register "reg_afe_ctrl2" = "0x00" register "reg_afe_ctrl3" = "0x00" register "reg_afe_ctrl4" = "0x07" register "reg_afe_ctrl5" = "0x00" register "reg_afe_ctrl6" = "0x00" register "reg_afe_ctrl7" = "0x07" register "reg_afe_ctrl8" = "0x12" register "reg_afe_ctrl9" = "0x0f" ``` it looks like: ``` register "reg_afe_ctrl" = "{0x00, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x12, 0x0f}" ```
what do you think?