mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] ARM: i.MX8M: nxp-imx8mn-evk: use regular i2c read for device detection
@ 2021-10-30 14:19 Ahmad Fatoum
  2021-11-01  9:10 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2021-10-30 14:19 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The barebox-nxp-imx8mn-evk image supports both DDR4 and LPDDR4 variants
by probing for the PMIC in use as the former uses a BD71847 and the
latter a PCA9450B.

The PCA9450B was observed to hang on the 0-byte (probe) reads.
This results in I/O errors during later PMIC writes and the image
would only boot on the EVKs with DDR4, which have the other PMIC.

Fix this by switching to a 1 byte read instead. Change tested on
i.MX8MN DDR4 EVK as well as another board with LPDDR4.

While at it, note the address of the PMIC in the error message, so it's
clear, what the result of the i2c probe was.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/nxp-imx8mn-evk/lowlevel.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/nxp-imx8mn-evk/lowlevel.c b/arch/arm/boards/nxp-imx8mn-evk/lowlevel.c
index bac632aa431b..de53213ebc77 100644
--- a/arch/arm/boards/nxp-imx8mn-evk/lowlevel.c
+++ b/arch/arm/boards/nxp-imx8mn-evk/lowlevel.c
@@ -56,7 +56,7 @@ static void pmic_reg_write(void *i2c, int addr, int reg, uint8_t val)
 
 	ret = i2c_fsl_xfer(i2c, msgs, ARRAY_SIZE(msgs));
 	if (ret != 1)
-		pr_err("Failed to write to pmic %d\n", ret);
+		pr_err("Failed to write to pmic@%x: %d\n", addr, ret);
 }
 
 static int power_init_board_pca9450(void *i2c, int addr)
@@ -66,7 +66,8 @@ static int power_init_board_pca9450(void *i2c, int addr)
 		{
 			.addr = addr,
 			.buf = buf,
-			.flags = I2C_M_RD
+			.flags = I2C_M_RD,
+			.len = 1,
 		},
 	};
 
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH master] ARM: i.MX8M: nxp-imx8mn-evk: use regular i2c read for device detection
  2021-10-30 14:19 [PATCH master] ARM: i.MX8M: nxp-imx8mn-evk: use regular i2c read for device detection Ahmad Fatoum
@ 2021-11-01  9:10 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-11-01  9:10 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Sat, Oct 30, 2021 at 04:19:34PM +0200, Ahmad Fatoum wrote:
> The barebox-nxp-imx8mn-evk image supports both DDR4 and LPDDR4 variants
> by probing for the PMIC in use as the former uses a BD71847 and the
> latter a PCA9450B.
> 
> The PCA9450B was observed to hang on the 0-byte (probe) reads.
> This results in I/O errors during later PMIC writes and the image
> would only boot on the EVKs with DDR4, which have the other PMIC.
> 
> Fix this by switching to a 1 byte read instead. Change tested on
> i.MX8MN DDR4 EVK as well as another board with LPDDR4.
> 
> While at it, note the address of the PMIC in the error message, so it's
> clear, what the result of the i2c probe was.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/boards/nxp-imx8mn-evk/lowlevel.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-01  9:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-30 14:19 [PATCH master] ARM: i.MX8M: nxp-imx8mn-evk: use regular i2c read for device detection Ahmad Fatoum
2021-11-01  9:10 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox