diff options
author | Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com> | 2021-06-11 16:13:43 +0000 |
---|---|---|
committer | Lokesh Vutla <lokeshvutla@ti.com> | 2021-07-15 17:56:03 +0530 |
commit | d364926da3f9680cbaaabc7f976efe05b62d8c76 (patch) | |
tree | d38e787f2b6afdaafcd232b0307b6614f9de3a39 | |
parent | da09ba6f733cf252fd0c366b4cbe9803f14155ef (diff) | |
download | u-boot-d364926da3f9680cbaaabc7f976efe05b62d8c76.zip u-boot-d364926da3f9680cbaaabc7f976efe05b62d8c76.tar.gz u-boot-d364926da3f9680cbaaabc7f976efe05b62d8c76.tar.bz2 |
am335x, guardian: update swi logic
read boot mode gpio and set the swi status
Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-12-Gireesh.Hiremath@in.bosch.com
-rw-r--r-- | board/bosch/guardian/board.c | 16 | ||||
-rw-r--r-- | include/configs/am335x_guardian.h | 2 |
2 files changed, 15 insertions, 3 deletions
diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c index 12d047b..f14ceaa 100644 --- a/board/bosch/guardian/board.c +++ b/board/bosch/guardian/board.c @@ -15,6 +15,7 @@ #include <i2c.h> #include <led.h> #include <panel.h> +#include <linux/delay.h> #include <asm/global_data.h> #include <power/tps65217.h> #include <spl.h> @@ -205,8 +206,19 @@ static void set_bootmode_env(void) goto err; } - value = dm_gpio_get_value(&boot_mode_desc); - value ? env_set("swi_status", "0") : env_set("swi_status", "1"); + dm_gpio_set_dir_flags(&boot_mode_desc, GPIOD_IS_IN); + udelay(10); + + ret = dm_gpio_get_value(&boot_mode_desc); + if (ret == 0) { + env_set("swi_status", "1"); + } else if (ret == 1) { + env_set("swi_status", "0"); + } else { + printf("swi status gpio error\n"); + goto err; + } + return; err: diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h index 814048b..c76f9b2 100644 --- a/include/configs/am335x_guardian.h +++ b/include/configs/am335x_guardian.h @@ -64,13 +64,13 @@ "setenv rootflags \"bulk_read,chk_data_crc\"; " \ "setenv ethact usb_ether; " \ "if test \"${swi_status}\" -eq 1; then " \ - "setenv extrabootargs \"swi_attached\"; " \ "if dhcp; then " \ "sleep 1; " \ "if tftp \"${tftp_load_addr}\" \"bootscript.scr\"; then " \ "source \"${tftp_load_addr}\"; " \ "fi; " \ "fi; " \ + "setenv extrabootargs $extrabootargs \"swi_attached\"; " \ "fi;" \ "run bootcmd_ubifs0;\0" \ "altbootcmd=" \ |