diff options
author | Pali Rohár <pali@kernel.org> | 2022-07-28 11:07:13 +0800 |
---|---|---|
committer | Peng Fan <peng.fan@nxp.com> | 2022-07-29 19:49:13 +0800 |
commit | 78aa3fb15eb7f9c0a1b646a5e54c3dd2195b4afb (patch) | |
tree | dc61d92c7fa0be126fb338857782d8798dcf2eb5 /board/freescale | |
parent | 3480879a5598735753e8dffda8c38791d19fd467 (diff) | |
download | u-boot-78aa3fb15eb7f9c0a1b646a5e54c3dd2195b4afb.tar.gz |
board: freescale: p1_p2_rdb_pc: Fix parsing inverted bits from boot input data
On some boards upper 4 bits of i2c boot input data (register 0) are
inverted. Information which bits are inverted is stored in register 2.
So invert read input data back according to register 2 prior processing
them. This fixes printing "rom_loc: value" line during booting.
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'board/freescale')
-rw-r--r-- | board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c index 56bc355d21..a71952dcf3 100644 --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c @@ -182,7 +182,7 @@ int checkboard(void) { struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE); ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); - u8 in, out, io_config, val; + u8 in, out, invert, io_config, val; int bus_num = CONFIG_SYS_SPD_BUS_NUM; /* FIXME: This should just use the model from the device tree or similar */ @@ -210,6 +210,7 @@ int checkboard(void) if (dm_i2c_read(dev, 0, &in, 1) < 0 || dm_i2c_read(dev, 1, &out, 1) < 0 || + dm_i2c_read(dev, 2, &invert, 1) < 0 || dm_i2c_read(dev, 3, &io_config, 1) < 0) { printf("Error reading i2c boot information!\n"); return 0; /* Don't want to hang() on this error */ @@ -219,13 +220,14 @@ int checkboard(void) if (i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 0, 1, &in, 1) < 0 || i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 1, 1, &out, 1) < 0 || + i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 2, 1, &invert, 1) < 0 || i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 3, 1, &io_config, 1) < 0) { printf("Error reading i2c boot information!\n"); return 0; /* Don't want to hang() on this error */ } #endif - val = (in & io_config) | (out & (~io_config)); + val = ((in ^ invert) & io_config) | (out & (~io_config)); puts("rom_loc: "); if (0) { |