[U-Boot] [PATCH] imx_common: check for Serial Downloader in spl_boot_device

Eric Nelson eric at nelint.com
Mon Dec 7 15:08:52 CET 2015


Hi Stefano,

On 12/07/2015 02:55 AM, Stefano Babic wrote:
> Hi Eric,
> 
> On 05/12/2015 21:13, Eric Nelson wrote:
>> Hi Stefano,
>>
>> On 12/04/2015 02:02 AM, Stefano Babic wrote:
>>> Check for bmode before reading the boot device
>>> to check if a serial downloader is started,
>>> and returns UART if the serial downloader is set,
>>> letting SPL to wait for an image if
>>> CONFIG_SPL_YMODEM_SUPPORT is set.
>>>
...

>> Separately, what's your thought about enabling this when the
>> system is reset through "bmode usb"?
>>
>> http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/cpu/armv7/mx6/soc.c;h=bf5ae8cdffd8b0887291249332b06f66dc644832;hb=HEAD#l389
>>
>> Since the gpr9 value in this mode is 0x00000001, the switch
>> statement currently falls into the NOR/OneNAND block, which
>> is pretty useless.
> 
> I agree with you, in fact it does not work  - but I do not see a way to
> inform the ROM that next time it should run with USB as boot device.
> From the fusemap, I tried to set BOOT_CFG4 as 0x40 ("Reserved for serial
> ROM"), and fixing BOOT_CFG1 to 0x30, but it was only a try. In fact, we
> need to change BMODE from internal to serial, and I do not see a way in
> the "official" documentation.
> 

It doesn't help that all of this is undocumented :), but reverse-
engineering the bmode command

The "bmode usb" command sets gpr9 to 1, which isn't used for anything
else, so something like this will work:

diff --git a/arch/arm/imx-common/spl.c b/arch/arm/imx-common/spl.c
index 28217d2..54f22e6 100644
--- a/arch/arm/imx-common/spl.c
+++ b/arch/arm/imx-common/spl.c
@@ -26,8 +26,10 @@ u32 spl_boot_device(void)
         * Check for BMODE if serial downloader is enabled
         * BOOT_MODE - see IMX6DQRM Table 8-1
         */
-       if ((bmode >> 24) == 0x01) /* Serial Downloader */
+       if (((bmode >> 24) == 0x01) /* Serial Downloader */
+           || (gpr10_boot && (1 == reg)))
                return BOOT_DEVICE_UART;

AFAIK, there isn't any other way to get a value of 1 into GPR9,
so the test is safe.

Secondarily, since the low four bits are discarded in the switch(),
this prevents an almost-always-wrong interpretation of 1 as
OneNAND/NOR (I think there are very few if any i.MX6 boards using
OneNAND or NOR for boot).

Regards,


Eric


More information about the U-Boot mailing list