* [U-Boot] [PATCH] mvebu: turris_omnia: Fix PEX vs SATA detection for board topology
@ 2017-08-04 13:28 Marek Behún
2017-08-08 12:23 ` Stefan Roese
0 siblings, 1 reply; 2+ messages in thread
From: Marek Behún @ 2017-08-04 13:28 UTC (permalink / raw)
To: u-boot
The I2C reading in the PEX vs SATA detection code often fails on the
first try. Try three times, as the code for EEPROM reading does.
Signed-off-by: Marek Behun <marek.behun@nic.cz>
---
board/CZ.NIC/turris_omnia/turris_omnia.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
index 86926f8050..a4275091d2 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -90,7 +90,7 @@ static struct serdes_map board_serdes_map_sata[] = {
static bool omnia_detect_sata(void)
{
struct udevice *bus, *dev;
- int ret;
+ int ret, retry = 3;
u16 mode;
puts("SERDES0 card detect: ");
@@ -106,8 +106,13 @@ static bool omnia_detect_sata(void)
return false;
}
- ret = dm_i2c_read(dev, OMNIA_I2C_MCU_ADDR_STATUS, (uchar *) &mode, 2);
- if (ret) {
+ for (; retry > 0; --retry) {
+ ret = dm_i2c_read(dev, OMNIA_I2C_MCU_ADDR_STATUS, (uchar *) &mode, 2);
+ if (!ret)
+ break;
+ }
+
+ if (!retry) {
puts("I2C read failed! Default PEX\n");
return false;
}
--
2.13.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] mvebu: turris_omnia: Fix PEX vs SATA detection for board topology
2017-08-04 13:28 [U-Boot] [PATCH] mvebu: turris_omnia: Fix PEX vs SATA detection for board topology Marek Behún
@ 2017-08-08 12:23 ` Stefan Roese
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Roese @ 2017-08-08 12:23 UTC (permalink / raw)
To: u-boot
On 04.08.2017 15:28, Marek Behún wrote:
> The I2C reading in the PEX vs SATA detection code often fails on the
> first try. Try three times, as the code for EEPROM reading does.
>
> Signed-off-by: Marek Behun <marek.behun@nic.cz>
> ---
> board/CZ.NIC/turris_omnia/turris_omnia.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
> index 86926f8050..a4275091d2 100644
> --- a/board/CZ.NIC/turris_omnia/turris_omnia.c
> +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
> @@ -90,7 +90,7 @@ static struct serdes_map board_serdes_map_sata[] = {
> static bool omnia_detect_sata(void)
> {
> struct udevice *bus, *dev;
> - int ret;
> + int ret, retry = 3;
> u16 mode;
>
> puts("SERDES0 card detect: ");
> @@ -106,8 +106,13 @@ static bool omnia_detect_sata(void)
> return false;
> }
>
> - ret = dm_i2c_read(dev, OMNIA_I2C_MCU_ADDR_STATUS, (uchar *) &mode, 2);
> - if (ret) {
> + for (; retry > 0; --retry) {
> + ret = dm_i2c_read(dev, OMNIA_I2C_MCU_ADDR_STATUS, (uchar *) &mode, 2);
> + if (!ret)
> + break;
> + }
> +
> + if (!retry) {
> puts("I2C read failed! Default PEX\n");
> return false;
> }
>
Applied to u-boot-marvell/master.
Thanks,
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-08 12:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-04 13:28 [U-Boot] [PATCH] mvebu: turris_omnia: Fix PEX vs SATA detection for board topology Marek Behún
2017-08-08 12:23 ` Stefan Roese
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.