Skip to content
Snippets Groups Projects
Commit bb719751 authored by Troy Kisky's avatar Troy Kisky
Browse files

arm: mach-imx: cpu: add is_usb_boot

parent 53fe4b47
No related branches found
No related tags found
No related merge requests found
......@@ -8,4 +8,5 @@
#include <asm/mach-imx/sys_proto.h>
bool is_usb_boot(void);
#endif /* __SYS_PROTO_IMX5_ */
......@@ -30,4 +30,5 @@ static inline void iomuxc_set_rgmii_io_voltage(int io_vol)
__raw_writel(io_vol, IOMUXC_SW_PAD_CTL_GRP_DDR_TYPE_RGMII);
}
bool is_usb_boot(void);
#endif /* __SYS_PROTO_IMX6_ */
......@@ -9,5 +9,6 @@
void set_wdog_reset(struct wdog_regs *wdog);
enum boot_device get_boot_device(void);
bool is_usb_boot(void);
#endif /* __SYS_PROTO_IMX7_ */
......@@ -471,6 +471,47 @@ enum boot_device get_boot_device(void)
return boot_dev;
}
bool is_usb_boot(void)
{
return get_boot_device() == USB_BOOT;
}
#elif defined(CONFIG_MX6)
bool is_usb_boot(void)
{
unsigned int bmode = readl(&src_base->sbmr2);
u32 reg;
/*
* Check for BMODE if serial downloader is enabled
* BOOT_MODE - see IMX6DQRM Table 8-1
*/
if (((bmode >> 24) & 0x03) == 0x01) /* Serial Downloader */
return true;
/*
* 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_usbotg_phy_active())
return true;
reg = (imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >> IMX6_BMODE_SHIFT;
if (reg == IMX6_BMODE_RESERVED)
return true;
return false;
}
#else
bool is_usb_boot(void)
{
return false;
}
#endif
#ifdef CONFIG_NXP_BOARD_REVISION
......
......@@ -167,11 +167,6 @@ int arch_cpu_init(void)
return 0;
}
bool is_usb_boot(void)
{
return get_boot_device() == USB_BOOT;
}
#ifdef CONFIG_OF_SYSTEM_SETUP
int ft_system_setup(void *blob, bd_t *bd)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment