public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 23/29] imx6: aristainetos: cleanup bootmode settings
Date: Sun,  1 Dec 2019 11:23:26 +0100	[thread overview]
Message-ID: <20191201102332.21397-24-hs@denx.de> (raw)
In-Reply-To: <20191201102332.21397-1-hs@denx.de>

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

Signed-off-by: Heiko Schocher <hs@denx.de>
---

 board/aristainetos/aristainetos.c | 43 +++++++++++++++++++++----------
 1 file changed, 30 insertions(+), 13 deletions(-)

diff --git a/board/aristainetos/aristainetos.c b/board/aristainetos/aristainetos.c
index 55d3ab6f44..ca6155947b 100644
--- a/board/aristainetos/aristainetos.c
+++ b/board/aristainetos/aristainetos.c
@@ -383,39 +383,44 @@ static int aristainetos_eeprom(void)
 	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 bootmode = 0;
-	struct gpio_desc *desc;
-	int x, y;
 	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,
 	 * disable bootdelay
 	 */
-	desc = gpio_hog_lookup_name("bootsel0");
-	if (desc)
+	ret = gpio_hog_lookup_name("bootsel0", &desc);
+	if (!ret)
 		bootmode |= (dm_gpio_get_value(desc) ? 1 : 0) << 0;
-	desc = gpio_hog_lookup_name("bootsel1");
-	if (desc)
+	ret = gpio_hog_lookup_name("bootsel1", &desc);
+	if (!ret)
 		bootmode |= (dm_gpio_get_value(desc) ? 1 : 0) << 1;
-	desc = gpio_hog_lookup_name("bootsel2");
-	if (desc)
+	ret = gpio_hog_lookup_name("bootsel2", &desc);
+	if (!ret)
 		bootmode |= (dm_gpio_get_value(desc) ? 1 : 0) << 2;
 
 	if (bootmode == 7) {
 		my_bootdelay = env_get("nor_bootdelay");
-		if (my_bootdelay != NULL)
+		if (my_bootdelay)
 			env_set("bootdelay", my_bootdelay);
 		else
 			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*/
 	ret = gpio_hog_lookup_name("env_reset", &desc);
 	if (!ret) {
@@ -431,6 +436,17 @@ int board_late_init(void)
 			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 */
 	aristainetos_eeprom();
@@ -440,6 +456,7 @@ int board_late_init(void)
 		env_set("board_type", ARI_BT_4);
 	else
 		env_set("board_type", ARI_BT_7);
+
 	return 0;
 }
 
-- 
2.21.0

  parent reply	other threads:[~2019-12-01 10:23 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-01 10:23 [U-Boot] [PATCH v1 00/29] convert aristainetos board to DM Heiko Schocher
2019-12-01 10:23 ` [U-Boot] [PATCH v1 01/29] imx6: remove aristainetos board Heiko Schocher
2019-12-29 10:25   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 02/29] video: lg4573: convert to DM Heiko Schocher
2019-12-29 10:25   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 03/29] imx6: aristainetos: move defines to Kconfig Heiko Schocher
2019-12-29 10:27   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 04/29] imx6: aristainetos: remove 2b version Heiko Schocher
2019-12-29 10:25   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 05/29] imx6: aristainetos: disable gigabit support Heiko Schocher
2019-12-29 10:24   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 06/29] imx6: aristainetos: add device tree from linux Heiko Schocher
2019-12-29 10:28   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 07/29] imx6: aristainetos: add thumb build Heiko Schocher
2019-12-29 10:26   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 08/29] imx6: aristainetos: remove aristainetos-v2.c Heiko Schocher
2019-12-29 10:25   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 09/29] imx6: aristainetos: prepare dts for other board versions Heiko Schocher
2019-12-29 10:27   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 10/29] imx6: aristainetos: add DM_SERIAL support Heiko Schocher
2019-12-29 10:27   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 11/29] imx6: aristainetos: convert to DM_MMC Heiko Schocher
2019-12-29 10:27   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 12/29] imx6: aristainetos: convert gpio pins to DM and DTS Heiko Schocher
2019-12-29 10:28   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 13/29] imx6: aristainetos: convert to DM_USB Heiko Schocher
2019-12-29 10:27   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 14/29] imx6: aristainetos: convert CONFIG_DM_SPI Heiko Schocher
2019-12-29 10:27   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 15/29] imx6: aristainetos: enable DM_ETH Heiko Schocher
2019-12-29 10:26   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 16/29] imx6: aristainetos: add DM_VIDEO support Heiko Schocher
2019-12-29 10:28   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 17/29] imx6: aristainetos: add DM_I2C support Heiko Schocher
2019-12-29 10:24   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 18/29] imx6: aristainetos: convert to DM_PWM/DM_BACKLIGHT Heiko Schocher
2019-12-29 10:26   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 19/29] imx6: aristainetos: get rid of CONFIG_BOARDNAME Heiko Schocher
2019-12-29 10:26   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 20/29] imx6: aristainetos: add i2c eeprom support Heiko Schocher
2019-12-29 10:28   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 21/29] imx6: aristainetos: add AUTOBOOT_KEYED Heiko Schocher
2019-12-29 10:28   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 22/29] imx6: aristainetos: add version variable Heiko Schocher
2019-12-29 10:24   ` sbabic at denx.de
2019-12-01 10:23 ` Heiko Schocher [this message]
2019-12-29 10:24   ` [U-Boot] [PATCH v1 23/29] imx6: aristainetos: cleanup bootmode settings sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 24/29] imx6: aristainetos: WDT DM conversion enable WDT reset Heiko Schocher
2019-12-29 10:27   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 25/29] imx6: aristainetos: cleanup default Environment Heiko Schocher
2019-12-29 10:28   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 26/29] imx6: aristainetos: enable HAB boot Heiko Schocher
2019-12-29 10:25   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 27/29] imx6: aristainetos: readd aristainetos 2b board Heiko Schocher
2019-12-29 10:26   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 28/29] imx6: aristainetos: add aristainetos 2b csl Heiko Schocher
2019-12-29 10:29   ` sbabic at denx.de
2019-12-01 10:23 ` [U-Boot] [PATCH v1 29/29] imx6: aristainetos: add support for rev C board Heiko Schocher
2019-12-29 10:25   ` sbabic at denx.de

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191201102332.21397-24-hs@denx.de \
    --to=hs@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox