Skip to contentSkip to conversation

omap-common: SYS_BOOT fallback logic correction and support for more devices

PATCH New Paul Kocialkowski 3 participants 3 messages Aug 27, 2015 – Aug 28, 2015 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 omap-common: SYS_BOOT fallback logic correction and support for more devices

The SYS_BOOT-based fallback shouldn't only check for one of the conditions of use and then let the switch/case handle each boot device without enforcing the conditions for each type of boot device again.

For instance, this behaviour would trigger the fallback for UART when BOOT_DEVICE_UART is defined, CONFIG_SPL_YMODEM_SUPPORT is enabled (which should be a show-stopper) and e.g. BOOT_DEVICE_USB is enabled and not CONFIG_SPL_USB_SUPPORT.
Separating the logic for USB and UART solves this.

In addition, this adds support for more peripheral devices (USBETH and CPGMAC) to the fallback mechanism. Note that the USBETH boot device should always be different from the USB boot device (each should match a different bootrom handoff case).

---
 arch/arm/cpu/armv7/omap-common/boot-common.c | 32 +++++++++++++++++++---------
 1 file changed, 22 insertions(+), 10 deletions(-)
arch/arm/cpu/armv7/omap-common/boot-common.c +22 -10
index 5ec46fa..8e5d5c9 100644
@@ -30,6 +30,7 @@ void save_omap_boot_params(void)
 {
 	u32 boot_params = *((u32 *)OMAP_SRAM_SCRATCH_BOOT_PARAMS);
 	struct omap_boot_parameters *omap_boot_params;
+	int sys_boot_device = 0;
 	u32 boot_device;
 	u32 boot_mode;
 
@@ -64,31 +65,42 @@ void save_omap_boot_params(void)
 	if (boot_device == BOOT_DEVICE_QSPI_4)
 		boot_device = BOOT_DEVICE_SPI;
 #endif
-#if (defined(BOOT_DEVICE_UART) && !defined(CONFIG_SPL_YMODEM_SUPPORT)) || \
-    (defined(BOOT_DEVICE_USB) && !defined(CONFIG_SPL_USB_SUPPORT)) || \
-    (defined(BOOT_DEVICE_USBETH) && !defined(CONFIG_SPL_USBETH_SUPPORT))
 	/*
 	 * When booting from peripheral booting, the boot device is not usable
 	 * as-is (unless there is support for it), so the boot device is instead
 	 * figured out using the SYS_BOOT pins.
 	 */
 	switch (boot_device) {
-#ifdef BOOT_DEVICE_UART
-	case BOOT_DEVICE_UART:
+#if defined(BOOT_DEVICE_UART) && !defined(CONFIG_SPL_YMODEM_SUPPORT)
+		case BOOT_DEVICE_UART:
+			sys_boot_device = 1;
+			break;
+#endif
+#if defined(BOOT_DEVICE_USB) && !defined(CONFIG_SPL_USB_SUPPORT)
+		case BOOT_DEVICE_USB:
+			sys_boot_device = 1;
+			break;
 #endif
-#ifdef BOOT_DEVICE_USB
-	case BOOT_DEVICE_USB:
+#if defined(BOOT_DEVICE_USBETH) && !defined(CONFIG_SPL_USBETH_SUPPORT)
+		case BOOT_DEVICE_USBETH:
+			sys_boot_device = 1;
+			break;
+#endif
+#if defined(BOOT_DEVICE_CPGMAC) && !defined(CONFIG_SPL_ETH_SUPPORT)
+		case BOOT_DEVICE_CPGMAC:
+			sys_boot_device = 1;
+			break;
 #endif
+	}
+
+	if (sys_boot_device) {
 		boot_device = omap_sys_boot_device();
 
 		/* MMC raw mode will fallback to FS mode. */
 		if ((boot_device >= MMC_BOOT_DEVICES_START) &&
 		    (boot_device <= MMC_BOOT_DEVICES_END))
 			boot_mode = MMCSD_MODE_RAW;
-
-		break;
 	}
-#endif
 
 	gd->arch.omap_boot_device = boot_device;
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/1 omap-common: SYS_BOOT fallback logic correction and support for more devices

Quoted 10 lines · Paul Kocialkowski

The SYS_BOOT-based fallback shouldn't only check for one of the conditions of use and then let the switch/case handle each boot device without enforcing the conditions for each type of boot device again.

For instance, this behaviour would trigger the fallback for UART when BOOT_DEVICE_UART is defined, CONFIG_SPL_YMODEM_SUPPORT is enabled (which should be a show-stopper) and e.g. BOOT_DEVICE_USB is enabled and not CONFIG_SPL_USB_SUPPORT.
Separating the logic for USB and UART solves this.

Quoted 7 lines

In addition, this adds support for more peripheral devices (USBETH and CPGMAC) to the fallback mechanism. Note that the USBETH boot device should always be different from the USB boot device (each should match a different bootrom handoff case).

---

Very well. Everything now works fine.

best regards,
Hannes

#2 lore raw

PATCH v2 1/1 omap-common: SYS_BOOT fallback logic correction and support for more devices

In reply to Paul Kocialkowski
Quoted 10 lines · Paul Kocialkowski

The SYS_BOOT-based fallback shouldn't only check for one of the conditions of use and then let the switch/case handle each boot device without enforcing the conditions for each type of boot device again.

For instance, this behaviour would trigger the fallback for UART when BOOT_DEVICE_UART is defined, CONFIG_SPL_YMODEM_SUPPORT is enabled (which should be a show-stopper) and e.g. BOOT_DEVICE_USB is enabled and not CONFIG_SPL_USB_SUPPORT.
Separating the logic for USB and UART solves this.

Quoted 8 lines

In addition, this adds support for more peripheral devices (USBETH and CPGMAC) to the fallback mechanism. Note that the USBETH boot device should always be different from the USB boot device (each should match a different bootrom handoff case).

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150828/8d404ed8/attachment.sig>