* [U-Boot] [PATCH 2/2] imx7: spl: Check for Serial Downloader in spl_boot_device
@ 2018-03-06 14:38 Eran Matityahu
2018-03-29 15:58 ` Stefano Babic
0 siblings, 1 reply; 2+ messages in thread
From: Eran Matityahu @ 2018-03-06 14:38 UTC (permalink / raw)
To: u-boot
Similarly to imx6, before reading the boot device, first check
bmode to see if the serial downloader has been selected
explicitly, then check whether the serial downloader has been
activated due to unbootable primary boot devices (e.g. empty eMMC).
If the serial downloader is activated, return BOOT_DEVICE_BOARD.
This allows SPL with SDP support to wait for the U-Boot image
to be loaded via the serial download protocol using imx_usb_loader.
Signed-off-by: Eran Matityahu <eran.m@variscite.com>
---
arch/arm/mach-imx/spl.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index b2521b2..6fc2463 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -101,6 +101,29 @@ u32 spl_boot_device(void)
/* Translate iMX7/MX8M boot device to the SPL boot device enumeration */
u32 spl_boot_device(void)
{
+#if defined(CONFIG_MX7)
+ unsigned int bmode = readl(&src_base->sbmr2);
+
+ /*
+ * Check for BMODE if serial downloader is enabled
+ * BOOT_MODE - see IMX7DRM Table 6-24
+ */
+ if (((bmode >> 24) & 0x03) == 0x01) /* Serial Downloader */
+ return BOOT_DEVICE_BOARD;
+
+ /*
+ * The above method does not detect that the boot ROM used
+ * serial downloader in case the boot ROM decided to use the
+ * serial downloader as a fall back (primary boot source failed).
+ *
+ * Infer that the boot ROM used the USB serial downloader by
+ * checking whether the USB PHY is currently active... This
+ * assumes that SPL did not (yet) initialize the USB PHY...
+ */
+ if (is_boot_from_usb())
+ return BOOT_DEVICE_BOARD;
+#endif
+
enum boot_device boot_device_spl = get_boot_device();
switch (boot_device_spl) {
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH 2/2] imx7: spl: Check for Serial Downloader in spl_boot_device
2018-03-06 14:38 [U-Boot] [PATCH 2/2] imx7: spl: Check for Serial Downloader in spl_boot_device Eran Matityahu
@ 2018-03-29 15:58 ` Stefano Babic
0 siblings, 0 replies; 2+ messages in thread
From: Stefano Babic @ 2018-03-29 15:58 UTC (permalink / raw)
To: u-boot
On 06/03/2018 15:38, Eran Matityahu wrote:
> Similarly to imx6, before reading the boot device, first check
> bmode to see if the serial downloader has been selected
> explicitly, then check whether the serial downloader has been
> activated due to unbootable primary boot devices (e.g. empty eMMC).
>
> If the serial downloader is activated, return BOOT_DEVICE_BOARD.
> This allows SPL with SDP support to wait for the U-Boot image
> to be loaded via the serial download protocol using imx_usb_loader.
>
> Signed-off-by: Eran Matityahu <eran.m@variscite.com>
> ---
> arch/arm/mach-imx/spl.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
> index b2521b2..6fc2463 100644
> --- a/arch/arm/mach-imx/spl.c
> +++ b/arch/arm/mach-imx/spl.c
> @@ -101,6 +101,29 @@ u32 spl_boot_device(void)
> /* Translate iMX7/MX8M boot device to the SPL boot device enumeration */
> u32 spl_boot_device(void)
> {
> +#if defined(CONFIG_MX7)
> + unsigned int bmode = readl(&src_base->sbmr2);
> +
> + /*
> + * Check for BMODE if serial downloader is enabled
> + * BOOT_MODE - see IMX7DRM Table 6-24
> + */
> + if (((bmode >> 24) & 0x03) == 0x01) /* Serial Downloader */
> + return BOOT_DEVICE_BOARD;
> +
> + /*
> + * The above method does not detect that the boot ROM used
> + * serial downloader in case the boot ROM decided to use the
> + * serial downloader as a fall back (primary boot source failed).
> + *
> + * Infer that the boot ROM used the USB serial downloader by
> + * checking whether the USB PHY is currently active... This
> + * assumes that SPL did not (yet) initialize the USB PHY...
> + */
> + if (is_boot_from_usb())
> + return BOOT_DEVICE_BOARD;
> +#endif
> +
> enum boot_device boot_device_spl = get_boot_device();
>
> switch (boot_device_spl) {
>
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-29 15:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-06 14:38 [U-Boot] [PATCH 2/2] imx7: spl: Check for Serial Downloader in spl_boot_device Eran Matityahu
2018-03-29 15:58 ` Stefano Babic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox