Message ID | 20170913212945.5659-2-stefan@agner.ch |
---|---|
State | Awaiting Upstream |
Delegated to: | Stefano Babic |
Headers | show |
Series | [U-Boot,v3,1/2] imx: add macro to detect whether USB PHY is active | expand |
Hi Stefan, Thanks for this patch. On 09/13/2017 02:29 PM, Stefan Agner 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> > Tested-by: Fabio Estevam <fabio.estevam@nxp.com> > --- > > Changes in v4: > - Rename macro to is_usbotg_phy_active() > > Changes in v3: > - Fix spelling and grammar > > Changes in v2: > - Add comment that we infer boot ROM behavior from USB PHY state > > arch/arm/mach-imx/spl.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c > index 258578ac25..534cc6504d 100644 > --- a/arch/arm/mach-imx/spl.c > +++ b/arch/arm/mach-imx/spl.c > @@ -31,6 +31,18 @@ u32 spl_boot_device(void) > 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_otgusb_phy_active()) > + 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 */ > Reviewed-by: Eric Nelson <eric@nelint.com>
Hi Stefan, On 14/09/2017 07:24, Eric Nelson wrote: > Hi Stefan, > > Thanks for this patch. > > On 09/13/2017 02:29 PM, Stefan Agner 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> >> Tested-by: Fabio Estevam <fabio.estevam@nxp.com> >> --- >> >> Changes in v4: >> - Rename macro to is_usbotg_phy_active() >> >> Changes in v3: >> - Fix spelling and grammar >> >> Changes in v2: >> - Add comment that we infer boot ROM behavior from USB PHY state >> >> arch/arm/mach-imx/spl.c | 12 ++++++++++++ >> 1 file changed, 12 insertions(+) >> >> diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c >> index 258578ac25..534cc6504d 100644 >> --- a/arch/arm/mach-imx/spl.c >> +++ b/arch/arm/mach-imx/spl.c >> @@ -31,6 +31,18 @@ u32 spl_boot_device(void) >> 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_otgusb_phy_active()) This is "otgusb", but in sys_proto.h is "usbotg". Can I fix it myself as "usbotg" by merging ? Best regards, Stefano >> + 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 */ >> > > Reviewed-by: Eric Nelson <eric@nelint.com>
On September 18, 2017 8:05:43 AM PDT, Stefano Babic <sbabic@denx.de> wrote: >Hi Stefan, > >On 14/09/2017 07:24, Eric Nelson wrote: >> Hi Stefan, >> >> Thanks for this patch. >> >> On 09/13/2017 02:29 PM, Stefan Agner 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> >>> Tested-by: Fabio Estevam <fabio.estevam@nxp.com> >>> --- >>> >>> Changes in v4: >>> - Rename macro to is_usbotg_phy_active() >>> >>> Changes in v3: >>> - Fix spelling and grammar >>> >>> Changes in v2: >>> - Add comment that we infer boot ROM behavior from USB PHY state >>> >>> arch/arm/mach-imx/spl.c | 12 ++++++++++++ >>> 1 file changed, 12 insertions(+) >>> >>> diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c >>> index 258578ac25..534cc6504d 100644 >>> --- a/arch/arm/mach-imx/spl.c >>> +++ b/arch/arm/mach-imx/spl.c >>> @@ -31,6 +31,18 @@ u32 spl_boot_device(void) >>> 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_otgusb_phy_active()) > >This is "otgusb", but in sys_proto.h is "usbotg". > >Can I fix it myself as "usbotg" by merging ? Good point, wonder why I did not notice, I usually build it again. Sure go ahead. -- Stefan > >Best regards, >Stefano > >>> + 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 */ >>> >> >> Reviewed-by: Eric Nelson <eric@nelint.com>
On 13/09/2017 23:29, Stefan Agner 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> > Tested-by: Fabio Estevam <fabio.estevam@nxp.com> > --- Applied to u-boot-imx, thanks ! Best regards, Stefano Babic
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index 258578ac25..534cc6504d 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -31,6 +31,18 @@ u32 spl_boot_device(void) 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_otgusb_phy_active()) + 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 */