diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2022-08-05 14:54:11 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-08-08 14:32:08 +0200 |
commit | dbbe6037f5cafc42d97c3b577f1d617f41495816 (patch) | |
tree | 7dc2a86c993734431f57b03cc8fd2acd39a060e1 /arch/arm/boards/mnt-reform | |
parent | cd5fc818a2d79d0a477b57dbd64f36dc876f4abb (diff) | |
download | barebox-dbbe6037f5cafc42d97c3b577f1d617f41495816.tar.gz barebox-dbbe6037f5cafc42d97c3b577f1d617f41495816.tar.xz |
pbl: generalize fsl i2c_early API into pbl_i2c
The prebootloader is inherently board-specific, so it's natural to
hardcode the i2c driver used and we only support fsl_i2c at the moment
anyway. For abstractions used by different prebootloaders though
(e.g. PMIC writing, SPD EEPROM decoding), it would be good for generic
code to use a pbl_i2c abstraction, so it can be reused across PBLs using
different I2C controllers. Add such an abstraction and use it where
appropriate.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.barebox.org/20220805125413.1046239-8-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/boards/mnt-reform')
-rw-r--r-- | arch/arm/boards/mnt-reform/lowlevel.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/arm/boards/mnt-reform/lowlevel.c b/arch/arm/boards/mnt-reform/lowlevel.c index 644c42269d..a845d36263 100644 --- a/arch/arm/boards/mnt-reform/lowlevel.c +++ b/arch/arm/boards/mnt-reform/lowlevel.c @@ -7,7 +7,7 @@ #include <common.h> #include <debug_ll.h> #include <firmware.h> -#include <i2c/i2c-early.h> +#include <pbl/i2c.h> #include <mach/atf.h> #include <mach/esdctl.h> #include <mach/generic.h> @@ -36,7 +36,7 @@ static void mnt_reform_setup_uart(void) putc_ll('>'); } -static void i2c_mux_set(void *i2c, u8 channel) +static void i2c_mux_set(struct pbl_i2c *i2c, u8 channel) { int ret; u8 buf[1]; @@ -50,12 +50,12 @@ static void i2c_mux_set(void *i2c, u8 channel) buf[0] = 1 << channel; - ret = i2c_fsl_xfer(i2c, msgs, ARRAY_SIZE(msgs)); + ret = pbl_i2c_xfer(i2c, msgs, ARRAY_SIZE(msgs)); if (ret != 1) pr_err("failed to set i2c mux\n"); } -static void i2c_regulator_set_voltage(void *i2c, u8 reg, u8 voffs) +static void i2c_regulator_set_voltage(struct pbl_i2c *i2c, u8 reg, u8 voffs) { int ret; u8 buf[2]; @@ -70,7 +70,7 @@ static void i2c_regulator_set_voltage(void *i2c, u8 reg, u8 voffs) buf[0] = reg; buf[1] = 0x80 + voffs; - ret = i2c_fsl_xfer(i2c, msgs, ARRAY_SIZE(msgs)); + ret = pbl_i2c_xfer(i2c, msgs, ARRAY_SIZE(msgs)); if (ret != 1) pr_err("failed to set voltage\n"); } @@ -81,7 +81,7 @@ static void i2c_regulator_set_voltage(void *i2c, u8 reg, u8 voffs) static void mnt_reform_init_power(void) { - void *i2c; + struct pbl_i2c *i2c; imx8mq_setup_pad(IMX8MQ_PAD_I2C1_SCL__I2C1_SCL | I2C_PAD_CTRL); imx8mq_setup_pad(IMX8MQ_PAD_I2C1_SDA__I2C1_SDA | I2C_PAD_CTRL); |