[U-Boot] [PATCH v1 1/2] imx: add macro to detect whether USB has been initialized

From: Stefan Agner stefan.agner@toradex.com
This macro allows to detect whether the boot ROM initialized USB already (serial downloader). This is helpful to reliably detect if the system has been recovered via USB serial downloader.
Signed-off-by: Stefan Agner stefan.agner@toradex.com Acked-by: Marcel Ziswiler marcel.ziswiler@toradex.com --- Hi Stefano,
I noted already in my initial post that detection of serial downloader mode is somewhat brittle: https://lists.denx.de/pipermail/u-boot/2017-August/301952.html
This came up quite fast now also for other boards: https://www.mail-archive.com/u-boot@lists.denx.de/msg262234.html
We use this patches since quite some time. Also NXP uses this detection method to start their mfgr tools... Altough a hack, maybe we should still add it upstream?
-- Stefan
arch/arm/include/asm/arch-mx6/imx-regs.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h index 86e267087a..895ef4de83 100644 --- a/arch/arm/include/asm/arch-mx6/imx-regs.h +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h @@ -985,5 +985,12 @@ struct pwm_regs { u32 pr; u32 cnr; }; + +/* + * If ROM fell back to USB recover mode, USBPH0_PWD will be clear to use USB + * If boot from the other mode, USB0_PWD will keep reset value + */ +#define is_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20))) + #endif /* __ASSEMBLER__*/ #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */

From: Stefan Agner stefan.agner@toradex.com
The current mechanism using SCR/GPR registers work well when the serial downloader boot mode has been selected explicitly (either via boot mode pins or using bmode command). However, in case the system entered boot ROM due to unbootable primary boot devices (e.g. empty eMMC), the SPL fails to detect that it has been downloaded through serial loader and tries to continue booting from eMMC: Trying to boot from MMC1 mmc_load_image_raw_sector: mmc block read error SPL: failed to boot from all boot devices ### ERROR ### Please RESET the board ###
The only known way to reliably detect USB serial downloader is by checking the USB PHY receiver block power state...
Signed-off-by: Stefan Agner stefan.agner@toradex.com Acked-by: Marcel Ziswiler marcel.ziswiler@toradex.com ---
arch/arm/mach-imx/spl.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index 258578ac25..8e8e2f755b 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -31,6 +31,10 @@ u32 spl_boot_device(void) if (((bmode >> 24) & 0x03) == 0x01) /* Serial Downloader */ return BOOT_DEVICE_BOARD;
+ /* Check USB state in case we entered serial downloader as fallback */ + if (is_boot_from_usb()) + return BOOT_DEVICE_BOARD; + /* BOOT_CFG1[7:4] - see IMX6DQRM Table 8-8 */ switch ((reg & IMX6_BMODE_MASK) >> IMX6_BMODE_SHIFT) { /* EIM: See 8.5.1, Table 8-9 */

On Mon, Sep 4, 2017 at 10:21 PM, Stefan Agner stefan@agner.ch wrote:
From: Stefan Agner stefan.agner@toradex.com
The current mechanism using SCR/GPR registers work well when the serial downloader boot mode has been selected explicitly (either via boot mode pins or using bmode command). However, in case the system entered boot ROM due to unbootable primary boot devices (e.g. empty eMMC), the SPL fails to detect that it has been downloaded through serial loader and tries to continue booting from eMMC: Trying to boot from MMC1 mmc_load_image_raw_sector: mmc block read error SPL: failed to boot from all boot devices ### ERROR ### Please RESET the board ###
The only known way to reliably detect USB serial downloader is by checking the USB PHY receiver block power state...
Signed-off-by: Stefan Agner stefan.agner@toradex.com Acked-by: Marcel Ziswiler marcel.ziswiler@toradex.com
This allows Serial Download Protocol to work on imx6q sabresd:
Tested-by: Fabio Estevam fabio.estevam@nxp.com

Hi Stefan,
On 09/04/2017 06:21 PM, Stefan Agner wrote:
From: Stefan Agner stefan.agner@toradex.com
This macro allows to detect whether the boot ROM initialized USB already (serial downloader). This is helpful to reliably detect if the system has been recovered via USB serial downloader.
Signed-off-by: Stefan Agner stefan.agner@toradex.com Acked-by: Marcel Ziswiler marcel.ziswiler@toradex.com
Hi Stefano,
I noted already in my initial post that detection of serial downloader mode is somewhat brittle: https://lists.denx.de/pipermail/u-boot/2017-August/301952.html
This came up quite fast now also for other boards: https://www.mail-archive.com/u-boot@lists.denx.de/msg262234.html
We use this patches since quite some time. Also NXP uses this detection method to start their mfgr tools... Altough a hack, maybe we should still add it upstream?
-- Stefan
arch/arm/include/asm/arch-mx6/imx-regs.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h index 86e267087a..895ef4de83 100644 --- a/arch/arm/include/asm/arch-mx6/imx-regs.h +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h @@ -985,5 +985,12 @@ struct pwm_regs { u32 pr; u32 cnr; };
It seems as if you've already named a constant, so you might as well #define and use it (USBPH0_PWD or USB0_PWD).
The reference manual seems to call it RXPWDRX though.
+/*
- If ROM fell back to USB recover mode, USBPH0_PWD will be clear to use USB
- If boot from the other mode, USB0_PWD will keep reset value
- */
+#define is_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20)))
- #endif /* __ASSEMBLER__*/ #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */
If I'm reading your comment correctly, the RXPWDRX bit will be set (the PHY will be powered down) unless it was enabled by the Boot ROM.
Won't this also be clear if you've run 'usb start' under U-Boot?
Please advise,
Eric

On 2017-09-04 19:57, Eric Nelson wrote:
Hi Stefan,
On 09/04/2017 06:21 PM, Stefan Agner wrote:
From: Stefan Agner stefan.agner@toradex.com
This macro allows to detect whether the boot ROM initialized USB already (serial downloader). This is helpful to reliably detect if the system has been recovered via USB serial downloader.
Signed-off-by: Stefan Agner stefan.agner@toradex.com Acked-by: Marcel Ziswiler marcel.ziswiler@toradex.com
Hi Stefano,
I noted already in my initial post that detection of serial downloader mode is somewhat brittle: https://lists.denx.de/pipermail/u-boot/2017-August/301952.html
This came up quite fast now also for other boards: https://www.mail-archive.com/u-boot@lists.denx.de/msg262234.html
We use this patches since quite some time. Also NXP uses this detection method to start their mfgr tools... Altough a hack, maybe we should still add it upstream?
-- Stefan
arch/arm/include/asm/arch-mx6/imx-regs.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h index 86e267087a..895ef4de83 100644 --- a/arch/arm/include/asm/arch-mx6/imx-regs.h +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h @@ -985,5 +985,12 @@ struct pwm_regs { u32 pr; u32 cnr; };
It seems as if you've already named a constant, so you might as well #define and use it (USBPH0_PWD or USB0_PWD).
Agreed.
The reference manual seems to call it RXPWDRX though.
I guess taking the latest naming from the manual make sense. Will update in v2.
Before I send out v2, I'd like to know from Stefano whether he agrees with the general direction of the patch.
+/*
- If ROM fell back to USB recover mode, USBPH0_PWD will be clear to use USB
- If boot from the other mode, USB0_PWD will keep reset value
- */
+#define is_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20)))
- #endif /* __ASSEMBLER__*/ #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */
If I'm reading your comment correctly, the RXPWDRX bit will be set (the PHY will be powered down) unless it was enabled by the Boot ROM.
Won't this also be clear if you've run 'usb start' under U-Boot?
Yes, this only works before a USB initialization...
This should be fine for the use case I have in mind (see patch 2).
Note this idea is borrowed from NXP downstream and seems to work here: http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/arch/arm/includ...
-- Stefan

Hi Stefan, Eric,
On 05/09/2017 06:50, Stefan Agner wrote:
On 2017-09-04 19:57, Eric Nelson wrote:
Hi Stefan,
On 09/04/2017 06:21 PM, Stefan Agner wrote:
From: Stefan Agner stefan.agner@toradex.com
This macro allows to detect whether the boot ROM initialized USB already (serial downloader). This is helpful to reliably detect if the system has been recovered via USB serial downloader.
Signed-off-by: Stefan Agner stefan.agner@toradex.com Acked-by: Marcel Ziswiler marcel.ziswiler@toradex.com
Hi Stefano,
I noted already in my initial post that detection of serial downloader mode is somewhat brittle: https://lists.denx.de/pipermail/u-boot/2017-August/301952.html
This came up quite fast now also for other boards: https://www.mail-archive.com/u-boot@lists.denx.de/msg262234.html
We use this patches since quite some time. Also NXP uses this detection method to start their mfgr tools... Altough a hack, maybe we should still add it upstream?
-- Stefan
arch/arm/include/asm/arch-mx6/imx-regs.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h index 86e267087a..895ef4de83 100644 --- a/arch/arm/include/asm/arch-mx6/imx-regs.h +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h @@ -985,5 +985,12 @@ struct pwm_regs { u32 pr; u32 cnr; };
It seems as if you've already named a constant, so you might as well #define and use it (USBPH0_PWD or USB0_PWD).
Agreed.
The reference manual seems to call it RXPWDRX though.
I guess taking the latest naming from the manual make sense. Will update in v2.
Before I send out v2, I'd like to know from Stefano whether he agrees with the general direction of the patch.
Green light from my side :-)
+/*
- If ROM fell back to USB recover mode, USBPH0_PWD will be clear to use USB
- If boot from the other mode, USB0_PWD will keep reset value
- */
+#define is_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20)))
- #endif /* __ASSEMBLER__*/ #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */
If I'm reading your comment correctly, the RXPWDRX bit will be set (the PHY will be powered down) unless it was enabled by the Boot ROM.
Won't this also be clear if you've run 'usb start' under U-Boot?
Yes, this only works before a USB initialization...
This should be fine for the use case I have in mind (see patch 2).
Agree. We want to detect just in SPL which was the (last) bootdevice and rather we cannot detect them from SCR/GPR that just reflect the configured booting device and not a fallback.
Note this idea is borrowed from NXP downstream and seems to work here: http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/arch/arm/includ...
Regards, Stefano

Hi Stefan,
On 09/04/2017 09:50 PM, Stefan Agner wrote:
On 2017-09-04 19:57, Eric Nelson wrote:
On 09/04/2017 06:21 PM, Stefan Agner wrote:
<snip>
+/*
- If ROM fell back to USB recover mode, USBPH0_PWD will be clear to use USB
- If boot from the other mode, USB0_PWD will keep reset value
- */
+#define is_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20)))
- #endif /* __ASSEMBLER__*/ #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */
If I'm reading your comment correctly, the RXPWDRX bit will be set (the PHY will be powered down) unless it was enabled by the Boot ROM.
Won't this also be clear if you've run 'usb start' under U-Boot?
Yes, this only works before a USB initialization...
Based on this, I'd recommend changing the macro name to something like "is_udc_active" to reflect it's true meaning.
This should be fine for the use case I have in mind (see patch 2).
Note this idea is borrowed from NXP downstream and seems to work here: http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/arch/arm/includ...
Understood.
Using this detection mechanism in SPL (where there isn't another path for initializing the UDC) makes sense.
Regards,
Eric

Hi Stefan,
On Tue, Sep 5, 2017 at 1:50 AM, Stefan Agner stefan@agner.ch wrote:
Note this idea is borrowed from NXP downstream and seems to work here: http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/arch/arm/includ...
Please mention the NXP patch in the commit log, so that it is clear where this idea is coming from.
Thanks

Hi Stefan,
On Mon, Sep 4, 2017 at 10:21 PM, Stefan Agner stefan@agner.ch wrote:
From: Stefan Agner stefan.agner@toradex.com
This macro allows to detect whether the boot ROM initialized USB already (serial downloader). This is helpful to reliably detect if the system has been recovered via USB serial downloader.
Signed-off-by: Stefan Agner stefan.agner@toradex.com Acked-by: Marcel Ziswiler marcel.ziswiler@toradex.com
This allows Serial Download Protocol to work on imx6q sabresd:
Tested-by: Fabio Estevam fabio.estevam@nxp.com
Hi Stefano,
I noted already in my initial post that detection of serial downloader mode is somewhat brittle: https://lists.denx.de/pipermail/u-boot/2017-August/301952.html
This came up quite fast now also for other boards: https://www.mail-archive.com/u-boot@lists.denx.de/msg262234.html
We use this patches since quite some time. Also NXP uses this detection method to start their mfgr tools... Altough a hack, maybe we should still add it upstream?
-- Stefan
arch/arm/include/asm/arch-mx6/imx-regs.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h index 86e267087a..895ef4de83 100644 --- a/arch/arm/include/asm/arch-mx6/imx-regs.h +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h @@ -985,5 +985,12 @@ struct pwm_regs { u32 pr; u32 cnr; };
+/*
- If ROM fell back to USB recover mode, USBPH0_PWD will be clear to use USB
- If boot from the other mode, USB0_PWD will keep reset value
- */
+#define is_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20)))
Minor nit: imx-regs.h is better suited for storing register layout definitions.
I think that arch/arm/include/asm/mach-imx/sys_proto.h would be a more appropriate location for this macro.
Also you could remove that tab between 'define' and the macro name.

On 2017-09-05 04:13, Fabio Estevam wrote:
Hi Stefan,
On Mon, Sep 4, 2017 at 10:21 PM, Stefan Agner stefan@agner.ch wrote:
From: Stefan Agner stefan.agner@toradex.com
This macro allows to detect whether the boot ROM initialized USB already (serial downloader). This is helpful to reliably detect if the system has been recovered via USB serial downloader.
Signed-off-by: Stefan Agner stefan.agner@toradex.com Acked-by: Marcel Ziswiler marcel.ziswiler@toradex.com
This allows Serial Download Protocol to work on imx6q sabresd:
Tested-by: Fabio Estevam fabio.estevam@nxp.com
Hi Stefano,
I noted already in my initial post that detection of serial downloader mode is somewhat brittle: https://lists.denx.de/pipermail/u-boot/2017-August/301952.html
This came up quite fast now also for other boards: https://www.mail-archive.com/u-boot@lists.denx.de/msg262234.html
We use this patches since quite some time. Also NXP uses this detection method to start their mfgr tools... Altough a hack, maybe we should still add it upstream?
-- Stefan
arch/arm/include/asm/arch-mx6/imx-regs.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h index 86e267087a..895ef4de83 100644 --- a/arch/arm/include/asm/arch-mx6/imx-regs.h +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h @@ -985,5 +985,12 @@ struct pwm_regs { u32 pr; u32 cnr; };
+/*
- If ROM fell back to USB recover mode, USBPH0_PWD will be clear to use USB
- If boot from the other mode, USB0_PWD will keep reset value
- */
+#define is_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20)))
Minor nit: imx-regs.h is better suited for storing register layout definitions.
I think that arch/arm/include/asm/mach-imx/sys_proto.h would be a more appropriate location for this macro.
Makes sense, will move it.
Also you could remove that tab between 'define' and the macro name.
Agreed.
-- Stefan

Hi Stefan,
On 05/09/2017 03:21, Stefan Agner wrote:
From: Stefan Agner stefan.agner@toradex.com
This macro allows to detect whether the boot ROM initialized USB already (serial downloader). This is helpful to reliably detect if the system has been recovered via USB serial downloader.
Signed-off-by: Stefan Agner stefan.agner@toradex.com Acked-by: Marcel Ziswiler marcel.ziswiler@toradex.com
Hi Stefano,
I noted already in my initial post that detection of serial downloader mode is somewhat brittle: https://lists.denx.de/pipermail/u-boot/2017-August/301952.html
This came up quite fast now also for other boards: https://www.mail-archive.com/u-boot@lists.denx.de/msg262234.html
We use this patches since quite some time. Also NXP uses this detection method to start their mfgr tools...
Then it seems to be an "undocumented feature" rather a hack.
Altough a hack, maybe we should still add it upstream?
If we can detect at runtime as this patch is thought to do, it is really an improvement and I will glad to merge it.
Maybe we get some further info from our "insider" (Fabio, Peng). It will be very interesting to know if we can apply this to all spectrum from i.MX6, or if there is some MX6 variant where the Bootrom is doing something different.
Regards, Stefano
-- Stefan
arch/arm/include/asm/arch-mx6/imx-regs.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h index 86e267087a..895ef4de83 100644 --- a/arch/arm/include/asm/arch-mx6/imx-regs.h +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h @@ -985,5 +985,12 @@ struct pwm_regs { u32 pr; u32 cnr; };
+/*
- If ROM fell back to USB recover mode, USBPH0_PWD will be clear to use USB
- If boot from the other mode, USB0_PWD will keep reset value
- */
+#define is_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20)))
#endif /* __ASSEMBLER__*/ #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */

Hi Stefano,
On Tue, Sep 5, 2017 at 8:16 AM, Stefano Babic sbabic@denx.de wrote:
Maybe we get some further info from our "insider" (Fabio, Peng). It will be very interesting to know if we can apply this to all spectrum from i.MX6, or if there is some MX6 variant where the Bootrom is doing something different.
Looking at NXP U-Boot code I see that this same mechanism applies not only to mx6, but it extends to mx7 and mx7ulp, so it seems like a good approach.
Thanks

On 2017-09-05 06:45, Fabio Estevam wrote:
Hi Stefano,
On Tue, Sep 5, 2017 at 8:16 AM, Stefano Babic sbabic@denx.de wrote:
Maybe we get some further info from our "insider" (Fabio, Peng). It will be very interesting to know if we can apply this to all spectrum from i.MX6, or if there is some MX6 variant where the Bootrom is doing something different.
Looking at NXP U-Boot code I see that this same mechanism applies not only to mx6, but it extends to mx7 and mx7ulp, so it seems like a good approach.
i.MX 7 has a Boot Information structure which is passed from the Boot ROM, so we have a much cleaner method there. http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=arch/arm/mach-imx/mx7/s...
As far as I can tell this boot information structure is also accurate when the Boot ROM entered serial downloader as a fallback.
Do we have boards using SPL on i.MX 7?
-- Stefan

On Tue, Sep 5, 2017 at 1:05 PM, Stefan Agner stefan@agner.ch wrote:
i.MX 7 has a Boot Information structure which is passed from the Boot ROM, so we have a much cleaner method there. http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=arch/arm/mach-imx/mx7/s...
As far as I can tell this boot information structure is also accurate when the Boot ROM entered serial downloader as a fallback.
What I meant is that the is_boot_from_usb() macro is also defined for MX7 and MX7ULP:
http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/arch/arm/includ...
http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/arch/arm/includ...
Do we have boards using SPL on i.MX 7?
No, we don't have it currently.

On 2017-09-05 09:18, Fabio Estevam wrote:
On Tue, Sep 5, 2017 at 1:05 PM, Stefan Agner stefan@agner.ch wrote:
i.MX 7 has a Boot Information structure which is passed from the Boot ROM, so we have a much cleaner method there. http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=arch/arm/mach-imx/mx7/s...
As far as I can tell this boot information structure is also accurate when the Boot ROM entered serial downloader as a fallback.
What I meant is that the is_boot_from_usb() macro is also defined for MX7 and MX7ULP:
http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/arch/arm/includ...
http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/arch/arm/includ...
Yes, I understand.
I am just saying, I don't see a point to use that macro over i.MX 7's Boot Information structure...
Do we have boards using SPL on i.MX 7?
No, we don't have it currently.
Ok.
-- Stefan

On Tue, Sep 5, 2017 at 1:26 PM, Stefan Agner stefan@agner.ch wrote:
Yes, I understand.
I am just saying, I don't see a point to use that macro over i.MX 7's Boot Information structure...
Correct, and I did not suggest this either :-)

Hi Stefano,
On 09/05/2017 04:16 AM, Stefano Babic wrote:
Hi Stefan, On 05/09/2017 03:21, Stefan Agner wrote:
From: Stefan Agner stefan.agner@toradex.com
This macro allows to detect whether the boot ROM initialized USB already (serial downloader). This is helpful to reliably detect if the system has been recovered via USB serial downloader.
Signed-off-by: Stefan Agner stefan.agner@toradex.com Acked-by: Marcel Ziswiler marcel.ziswiler@toradex.com
Hi Stefano,
I noted already in my initial post that detection of serial downloader mode is somewhat brittle: https://lists.denx.de/pipermail/u-boot/2017-August/301952.html
This came up quite fast now also for other boards: https://www.mail-archive.com/u-boot@lists.denx.de/msg262234.html
We use this patches since quite some time. Also NXP uses this detection method to start their mfgr tools...
Then it seems to be an "undocumented feature" rather a hack.
This patch only detects that the OTG PHY is active, so it's not really a hack.
The next patch uses this to infer how it happened (booted using SDP), and since I don't think there's another way for that to happen, it also seems to be reasonable.
Can you think of another way that the OTG PHY could be alive when the code is hit in SPL?
... A comment to that effect is probably in order though.
Please advise,
Eric

Hi Eric,
On 05/09/2017 15:49, Eric Nelson wrote:
Hi Stefano,
On 09/05/2017 04:16 AM, Stefano Babic wrote:
Hi Stefan, On 05/09/2017 03:21, Stefan Agner wrote:
From: Stefan Agner stefan.agner@toradex.com
This macro allows to detect whether the boot ROM initialized USB already (serial downloader). This is helpful to reliably detect if the system has been recovered via USB serial downloader.
Signed-off-by: Stefan Agner stefan.agner@toradex.com Acked-by: Marcel Ziswiler marcel.ziswiler@toradex.com
Hi Stefano,
I noted already in my initial post that detection of serial downloader mode is somewhat brittle: https://lists.denx.de/pipermail/u-boot/2017-August/301952.html
This came up quite fast now also for other boards: https://www.mail-archive.com/u-boot@lists.denx.de/msg262234.html
We use this patches since quite some time. Also NXP uses this detection method to start their mfgr tools...
Then it seems to be an "undocumented feature" rather a hack.
This patch only detects that the OTG PHY is active, so it's not really a hack.
Agree.
The next patch uses this to infer how it happened (booted using SDP), and since I don't think there's another way for that to happen, it also seems to be reasonable.
Right. It is absolutely reasonable.
Can you think of another way that the OTG PHY could be alive when the code is hit in SPL?
No, I can't - nothing that makes sense ;-)
... A comment to that effect is probably in order though.
Please advise,
Regards, Stefano
participants (4)
-
Eric Nelson
-
Fabio Estevam
-
Stefan Agner
-
Stefano Babic