imx6: aristainetos: cleanup bootmode settings

on the aristainetos there are some jumpers for
changing behaviour setting up Environment. Clean
this up.

Signed-off-by: Heiko Schocher <hs@denx.de>
This commit is contained in:
Heiko Schocher
2019-12-01 11:23:26 +01:00
committed by Stefano Babic
parent a450859af5
commit 0ed133a6c4

View File

@@ -383,39 +383,44 @@ static int aristainetos_eeprom(void)
return 0; return 0;
}; };
int board_late_init(void) static void aristainetos_bootmode_settings(void)
{ {
struct gpio_desc *desc;
struct src *psrc = (struct src *)SRC_BASE_ADDR;
unsigned int sbmr1 = readl(&psrc->sbmr1);
char *my_bootdelay; char *my_bootdelay;
char bootmode = 0; char bootmode = 0;
struct gpio_desc *desc;
int x, y;
int ret; int ret;
led_default_state();
splash_get_pos(&x, &y);
bmp_display((ulong)&bmp_logo_bitmap[0], x, y);
/* /*
* Check the boot-source. If booting from NOR Flash, * Check the boot-source. If booting from NOR Flash,
* disable bootdelay * disable bootdelay
*/ */
desc = gpio_hog_lookup_name("bootsel0"); ret = gpio_hog_lookup_name("bootsel0", &desc);
if (desc) if (!ret)
bootmode |= (dm_gpio_get_value(desc) ? 1 : 0) << 0; bootmode |= (dm_gpio_get_value(desc) ? 1 : 0) << 0;
desc = gpio_hog_lookup_name("bootsel1"); ret = gpio_hog_lookup_name("bootsel1", &desc);
if (desc) if (!ret)
bootmode |= (dm_gpio_get_value(desc) ? 1 : 0) << 1; bootmode |= (dm_gpio_get_value(desc) ? 1 : 0) << 1;
desc = gpio_hog_lookup_name("bootsel2"); ret = gpio_hog_lookup_name("bootsel2", &desc);
if (desc) if (!ret)
bootmode |= (dm_gpio_get_value(desc) ? 1 : 0) << 2; bootmode |= (dm_gpio_get_value(desc) ? 1 : 0) << 2;
if (bootmode == 7) { if (bootmode == 7) {
my_bootdelay = env_get("nor_bootdelay"); my_bootdelay = env_get("nor_bootdelay");
if (my_bootdelay != NULL) if (my_bootdelay)
env_set("bootdelay", my_bootdelay); env_set("bootdelay", my_bootdelay);
else else
env_set("bootdelay", "-2"); env_set("bootdelay", "-2");
} }
if (sbmr1 & 0x40) {
env_set("bootmode", "1");
printf("SD bootmode jumper set!\n");
} else {
env_set("bootmode", "0");
}
/* read out some jumper values*/ /* read out some jumper values*/
ret = gpio_hog_lookup_name("env_reset", &desc); ret = gpio_hog_lookup_name("env_reset", &desc);
if (!ret) { if (!ret) {
@@ -431,6 +436,17 @@ int board_late_init(void)
run_command("run rescue_xload_boot", 0); run_command("run rescue_xload_boot", 0);
} }
} }
}
int board_late_init(void)
{
int x, y;
led_default_state();
splash_get_pos(&x, &y);
bmp_display((ulong)&bmp_logo_bitmap[0], x, y);
aristainetos_bootmode_settings();
/* eeprom work */ /* eeprom work */
aristainetos_eeprom(); aristainetos_eeprom();
@@ -440,6 +456,7 @@ int board_late_init(void)
env_set("board_type", ARI_BT_4); env_set("board_type", ARI_BT_4);
else else
env_set("board_type", ARI_BT_7); env_set("board_type", ARI_BT_7);
return 0; return 0;
} }