[U-Boot] [PATCH 1/2] am335x, guardian: update guardian board

BollavarapuMoses.Christopher at in.bosch.com BollavarapuMoses.Christopher at in.bosch.com
Tue Sep 17 14:25:37 UTC 2019


From: Moses Christopher <BollavarapuMoses.Christopher at in.bosch.com>

  - add BOARD_LATE_INIT function calls in board.c
  - add swi_status detection in board.c
  - mux: add guardian interfaces to single pinmux structure
  - am33xx, kconfig: add BOARD_LATE_INIT for GUARDIAN board

Signed-off-by: Moses Christopher <BollavarapuMoses.Christopher at in.bosch.com>
---
 arch/arm/mach-omap2/am33xx/Kconfig |  1 +
 board/bosch/guardian/board.c       | 53 ++++++++++++++++++++++++++++++++++++++
 board/bosch/guardian/mux.c         | 32 ++++++++---------------
 3 files changed, 65 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-omap2/am33xx/Kconfig b/arch/arm/mach-omap2/am33xx/Kconfig
index 7f6b344..39d9c28 100644
--- a/arch/arm/mach-omap2/am33xx/Kconfig
+++ b/arch/arm/mach-omap2/am33xx/Kconfig
@@ -89,6 +89,7 @@ config TARGET_AM335X_SHC
 
 config TARGET_AM335X_GUARDIAN
 	bool "Support am335x based guardian board from bosch"
+	select BOARD_LATE_INIT
 	select DM
 	select DM_SERIAL
 	select DM_GPIO
diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c
index ec0c4a17..072aa4e 100644
--- a/board/bosch/guardian/board.c
+++ b/board/bosch/guardian/board.c
@@ -172,6 +172,8 @@ void sdram_init(void)
 
 int board_init(void)
 {
+	save_omap_boot_params();
+
 #if defined(CONFIG_HW_WATCHDOG)
 	hw_watchdog_init();
 #endif
@@ -183,3 +185,54 @@ int board_init(void)
 #endif
 	return 0;
 }
+
+#ifdef CONFIG_BOARD_LATE_INIT
+static void set_bootmode_env(void)
+{
+	char *boot_device_name = NULL;
+	char *boot_mode_gpio = "gpio at 44e07000_14";
+	int   ret;
+	int   value;
+
+	struct gpio_desc boot_mode_desc;
+
+	switch (gd->arch.omap_boot_device) {
+	case BOOT_DEVICE_NAND:
+		boot_device_name = "nand";
+		break;
+	case BOOT_DEVICE_USBETH:
+		boot_device_name = "usbeth";
+		break;
+	default:
+		break;
+	}
+
+	if (boot_device_name)
+		env_set("boot_device", boot_device_name);
+
+	ret = dm_gpio_lookup_name(boot_mode_gpio, &boot_mode_desc);
+	if (ret) {
+		printf("%s is not found\n", boot_mode_gpio);
+		goto err;
+	}
+
+	ret = dm_gpio_request(&boot_mode_desc, "setup_bootmode_env");
+	if (ret && ret != -EBUSY) {
+		printf("requesting gpio: %s failed\n", boot_mode_gpio);
+		goto err;
+	}
+
+	value = dm_gpio_get_value(&boot_mode_desc);
+	value ? env_set("swi_status", "0") : env_set("swi_status", "1");
+	return;
+
+err:
+	env_set("swi_status", "err");
+}
+
+int board_late_init(void)
+{
+	set_bootmode_env();
+	return 0;
+}
+#endif /* CONFIG_BOARD_LATE_INIT */
diff --git a/board/bosch/guardian/mux.c b/board/bosch/guardian/mux.c
index 708c3e7..20a1f25 100644
--- a/board/bosch/guardian/mux.c
+++ b/board/bosch/guardian/mux.c
@@ -26,24 +26,16 @@ static struct module_pin_mux i2c0_pin_mux[] = {
 	{-1},
 };
 
-static struct module_pin_mux adc_voltages_en[] = {
-	{OFFSET(mcasp0_ahclkx), (MODE(7) | PULLUP_EN)},
-	{-1},
-};
-
-static struct module_pin_mux asp_power_en[] = {
-	{OFFSET(mcasp0_aclkx), (MODE(7) | PULLUP_EN)},
-	{-1},
-};
-
-static struct module_pin_mux switch_off_3v6_pin_mux[] = {
-	{OFFSET(mii1_txd0), (MODE(7) | PULLUP_EN)},
-	/*
-	 * The uart1 lines are made floating inputs, based on the Guardian
-	 * A2 Sample Power Supply Schematics
-	 */
-	{OFFSET(uart1_rxd), (MODE(7) | PULLUDDIS)},
-	{OFFSET(uart1_txd), (MODE(7) | PULLUDDIS)},
+static struct module_pin_mux guardian_interfaces_pin_mux[] = {
+	{OFFSET(mcasp0_ahclkx), (MODE(7) | PULLDOWN_EN)},
+	{OFFSET(mcasp0_aclkx),  (MODE(7) | PULLUP_EN)},
+	{OFFSET(mii1_txd0),     (MODE(7) | PULLUP_EN)},
+	{OFFSET(uart1_rxd),     (MODE(7) | RXACTIVE | PULLUDDIS)},
+	{OFFSET(uart1_txd),     (MODE(7) | PULLUDDIS)},
+	{OFFSET(mii1_crs),      (MODE(7) | PULLDOWN_EN)},
+	{OFFSET(rmii1_refclk),  (MODE(7) | PULLDOWN_EN)},
+	{OFFSET(mii1_txd3),     (MODE(7) | PULLUDDIS)},
+	{OFFSET(mii1_rxdv),     (MODE(7) | PULLDOWN_EN)},
 	{-1},
 };
 
@@ -93,7 +85,5 @@ void enable_board_pin_mux(void)
 #ifdef CONFIG_NAND
 	configure_module_pin_mux(nand_pin_mux);
 #endif
-	configure_module_pin_mux(adc_voltages_en);
-	configure_module_pin_mux(asp_power_en);
-	configure_module_pin_mux(switch_off_3v6_pin_mux);
+	configure_module_pin_mux(guardian_interfaces_pin_mux);
 }
-- 
2.8.1



More information about the U-Boot mailing list