summaryrefslogtreecommitdiff
path: root/board/atmel
diff options
context:
space:
mode:
authorEugen Hristev <eugen.hristev@microchip.com>2019-06-12 13:16:18 +0300
committerEugen Hristev <eugen.hristev@microchip.com>2019-06-27 09:47:49 +0300
commitad371d8cd111126ad844f257b723f2f9df45351b (patch)
tree7cf2c1269c08769a15ac975f324802567ac8369b /board/atmel
parent5eea874b5e989e62519824ad140aa086432d01ee (diff)
downloadu-boot-ad371d8cd111126ad844f257b723f2f9df45351b.tar.gz
u-boot-ad371d8cd111126ad844f257b723f2f9df45351b.tar.bz2
u-boot-ad371d8cd111126ad844f257b723f2f9df45351b.zip
board: atmel: fix pda variable not being reset
In case someone detects a PDA and u-boot sets the 'pda' variable, and the user does a saveenv, the pda is set in env, and if the screen is removed, u-boot will still have in the env the 'pda' variable, even if no screen is attached. In order to fix this, we have to reset the 'pda' variable, such that it's not just set if the screen is detected, but also unset if no screen is detected. Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Diffstat (limited to 'board/atmel')
-rw-r--r--board/atmel/common/board.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/board/atmel/common/board.c b/board/atmel/common/board.c
index fc300a4210..20c3b8c086 100644
--- a/board/atmel/common/board.c
+++ b/board/atmel/common/board.c
@@ -29,7 +29,7 @@ void at91_pda_detect(void)
ret = w1_get_bus(AT91_PDA_EEPROM_DEFAULT_BUS, &bus);
if (ret)
- return;
+ goto pda_detect_err;
for (device_find_first_child(bus, &dev);
dev;
@@ -41,7 +41,7 @@ void at91_pda_detect(void)
ret = w1_eeprom_read_buf(dev, AT91_PDA_EEPROM_ID_OFFSET,
(u8 *)buf, AT91_PDA_EEPROM_ID_LENGTH);
if (ret)
- return;
+ goto pda_detect_err;
break;
}
}
@@ -61,6 +61,8 @@ void at91_pda_detect(void)
printf("PDA TM5000 detected\n");
break;
}
+
+pda_detect_err:
env_set("pda", (const char *)buf);
}
#else