imx_common: check for Serial Downloader in spl_boot_device
Subsystems (2)
PATCH 1/1 imx_common: check for Serial Downloader in spl_boot_device
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.
This allows to load again a SPL based board with imx_usb_loader together with a tool such as kermit.
---
Note: I know we have already discussed more complicated solution
for adding multilple files to imx_usb_loader. However, fixing ymodem support for i.MX6
was trivial and imx_usb_loader is working again.
arch/arm/imx-common/spl.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/imx-common/spl.c +7 -0
@@ -20,7 +20,14 @@ u32 spl_boot_device(void)struct src *psrc = (struct src *)SRC_BASE_ADDR ;unsigned int gpr10_boot =readl (&psrc->gpr10) & (1 <<28 );unsigned reg = gpr10_boot ?readl (&psrc->gpr9) :readl (&psrc->sbmr1); +unsigned int bmode =readl (&psrc->sbmr2); +/* +* Check for BMODE if serial downloader is enabled +* BOOT_MODE - see IMX6DQRM Table 8-1 +*/ +if ((bmode >>24 ) ==0x01 )/* Serial Downloader */ +return BOOT_DEVICE_UART ;/* BOOT_CFG1[7:4] - see IMX6DQRM Table 8-8 */ switch ((reg &0x000000FF ) >>4 ) {/* EIM: See 8.5.1, Table 8-9 */
Signature · 1 line
1.9.1
Fabio Estevam
reviewerPATCH 1/1 imx_common: check for Serial Downloader in spl_boot_device
Hi Stefano,
Quoted 9 lines · Stefano Babic
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_SUPPORTis set.This allows to load again a SPL based board with
imx_usb_loadertogether with a tool such as kermit.
Just curious: what were the commands you usned with imx_usb_loader to load SPL + u-boot.img?
Thanks,
Fabio Estevam
PATCH 1/1 imx_common: check for Serial Downloader in spl_boot_device
Hi Fabio,
Quoted 9 lines · Fabio Estevam
Hi Stefano,
Quoted 6 lines · Stefano Babic
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_SUPPORTis set.
Quoted 7 lines
Quoted 3 lines
This allows to load again a SPL based board with
imx_usb_loadertogether with a tool such as kermit.Just curious: what were the commands you usned with
imx_usb_loaderto load SPL + u-boot.img?
I did in this way:
sudo ../imx_usb_loader/imx_usb -v SPL
kermit kermit_uboot
And kermit_uboot (a kermit script) contains the lines:
set line /dev/ttyUSB1
set speed 115200
SET CARRIER-WATCH OFF
set flow-control none
set handshake none
set prefixing all
set file type bin
set protocol ymodem
send u-boot.img
c
The last "c" command tells kermit (from ckermit package in most distro) to switch from command line mode to communication mode, and when the script is finished, I get U-Boot prompt in the same shell. I tested on a custom board booting from SPI (when internal mode is used), and changing BOOT_MODE to serial, SPL starts automatically a download with y-modem.
Best regards,
Stefano
Signature · 5 lines
===================================================================== 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 =====================================================================
PATCH 1/1 imx_common: check for Serial Downloader in spl_boot_device
Hi Stefano,
Quoted 36 lines · Stefano Babic
Quoted 9 lines · Fabio Estevam
Hi Stefano,
Quoted 6 lines · Stefano Babic
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_SUPPORTis set.Quoted 7 lines
Quoted 3 lines
This allows to load again a SPL based board with
imx_usb_loadertogether with a tool such as kermit.Just curious: what were the commands you usned with
imx_usb_loaderto load SPL + u-boot.img?I did in this way:
sudo ../imx_usb_loader/imx_usb -v SPL
kermitkermit_ubootAnd
kermit_uboot(a kermit script) contains the lines:set line
/dev/ttyUSB1
set speed 115200
SET CARRIER-WATCH OFF
set flow-control none
set handshake none
set prefixing all
set file type bin
set protocol ymodem
send u-boot.img
c
Quoted 5 lines
The last "c" command tells kermit (from ckermit package in most distro) to switch from command line mode to communication mode, and when the script is finished, I get U-Boot prompt in the same shell. I tested on a custom board booting from SPI (when internal mode is used), and changing
BOOT_MODEto serial, SPL starts automatically a download with y-modem.
Could you please add this description to some imx README in the U-Boot source tree? I'm pretty sure this could be helpful to others as well.
Thanks,
Stefan
PATCH 1/1 imx_common: check for Serial Downloader in spl_boot_device
Quoted 51 lines · Stefan Roese
Hi Stefano,
Quoted 40 lines · Stefano Babic
Quoted 11 lines · Fabio Estevam
Hi Stefano,
Quoted 7 lines · Stefano Babic
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_SUPPORTis set.Quoted 8 lines
Quoted 3 lines
This allows to load again a SPL based board with
imx_usb_loadertogether with a tool such as kermit.Just curious: what were the commands you usned with
imx_usb_loaderto load SPL + u-boot.img?I did in this way:
sudo ../imx_usb_loader/imx_usb -v SPL
kermitkermit_ubootAnd
kermit_uboot(a kermit script) contains the lines:set line
/dev/ttyUSB1
set speed 115200
SET CARRIER-WATCH OFF
set flow-control none
set handshake none
set prefixing all
set file type bin
set protocol ymodem
send u-boot.img
cQuoted 5 lines
The last "c" command tells kermit (from ckermit package in most distro) to switch from command line mode to communication mode, and when the script is finished, I get U-Boot prompt in the same shell. I tested on a custom board booting from SPI (when internal mode is used), and changing
BOOT_MODEto serial, SPL starts automatically a download with y-modem.
Quoted 4 lines
Could you please add this description to some imx README in the U-Boot source tree? I'm pretty sure this could be helpful to others as well.
Stefano,
Agreed - this sounds like an excellent thing to document for IMX6 SPL!
Nice work!
Tim
PATCH 1/1 imx_common: check for Serial Downloader in spl_boot_device
In reply to Stefan RoeseQuoted 45 lines · Stefan Roese
Hi Stefano,
Quoted 36 lines · Stefano Babic
Quoted 9 lines · Fabio Estevam
Hi Stefano,
Quoted 6 lines · Stefano Babic
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_SUPPORTis set.Quoted 7 lines
Quoted 3 lines
This allows to load again a SPL based board with
imx_usb_loadertogether with a tool such as kermit.Just curious: what were the commands you usned with
imx_usb_loaderto load SPL + u-boot.img?I did in this way:
sudo ../imx_usb_loader/imx_usb -v SPL
kermitkermit_ubootAnd
kermit_uboot(a kermit script) contains the lines:set line
/dev/ttyUSB1
set speed 115200
SET CARRIER-WATCH OFF
set flow-control none
set handshake none
set prefixing all
set file type bin
set protocol ymodem
send u-boot.img
cQuoted 5 lines
The last "c" command tells kermit (from ckermit package in most distro) to switch from command line mode to communication mode, and when the script is finished, I get U-Boot prompt in the same shell. I tested on a custom board booting from SPI (when internal mode is used), and changing
BOOT_MODEto serial, SPL starts automatically a download with y-modem.
Quoted 4 lines
Could you please add this description to some imx README in the U-Boot source tree? I'm pretty sure this could be helpful to others as well.
Sure, it will be done in V2.
Stefano
Signature · 5 lines
===================================================================== 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 =====================================================================
PATCH 1/1 imx_common: check for Serial Downloader in spl_boot_device
In reply to Stefano BabicHi Stefano,
Quoted 30 lines · Stefano Babic
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_SUPPORTis set.This allows to load again a SPL based board with
imx_usb_loadertogether with a tool such as kermit.Signed-off-by Stefano Babic <[email protected]>CC Tim Harvey <[email protected]>CC Fabio Estevam <[email protected]>CC Eric Nelson <[email protected]>---
Note: I know we have already discussed more complicated solution
for adding multilple files toimx_usb_loader. However, fixing ymodem support for i.MX6
was trivial andimx_usb_loaderis working again.arch/arm/imx-common/spl.c | 7 +++++++ 1 file changed, 7 insertions(+)arch/arm/imx-common/spl.c +0
-0
arch/arm/imx-common/spl.c u32 spl_boot_device(void) · line 28
Quoted 9 lines
arch/arm/imx-common/spl.c +5
-0@@ -20,7 +20,14 @@ u32 spl_boot_device(void)struct src *psrc = (struct src *)SRC_BASE_ADDR ;unsigned int gpr10_boot =readl (&psrc->gpr10) & (1 <<28 );unsigned reg = gpr10_boot ?readl (&psrc->gpr9) :readl (&psrc->sbmr1); +unsigned int bmode =readl (&psrc->sbmr2); +/* +* Check for BMODE if serial downloader is enabled +* BOOT_MODE - see IMX6DQRM Table 8-1 +*/
I think you may need to check only bits 24 and 25 here.
arch/arm/imx-common/spl.c u32 spl_boot_device(void) · line 30
Quoted 2 lines
arch/arm/imx-common/spl.c +2
-0+if ((bmode >>24 ) ==0x01 )/* Serial Downloader */ +return BOOT_DEVICE_UART ;
Even though the data sheet says the high bits should be zero, I'm seeing some other bits set on an i.MX6SL:
=> mm 0x020d801c 020d801c: 22000001 ? x
Separately, what's your thought about enabling this when the system is reset through "bmode usb"?
Since the gpr9 value in this mode is 0x00000001, the switch statement currently falls into the NOR/OneNAND block, which is pretty useless.
PATCH 1/1 imx_common: check for Serial Downloader in spl_boot_device
Hi Eric,
Quoted 45 lines · Eric Nelson
Hi Stefano,
Quoted 30 lines · Stefano Babic
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_SUPPORTis set.This allows to load again a SPL based board with
imx_usb_loadertogether with a tool such as kermit.Signed-off-by Stefano Babic <[email protected]>CC Tim Harvey <[email protected]>CC Fabio Estevam <[email protected]>CC Eric Nelson <[email protected]>---
Note: I know we have already discussed more complicated solution
for adding multilple files toimx_usb_loader. However, fixing ymodem support for i.MX6
was trivial andimx_usb_loaderis working again.arch/arm/imx-common/spl.c | 7 +++++++ 1 file changed, 7 insertions(+)arch/arm/imx-common/spl.c +0
-0arch/arm/imx-common/spl.c u32 spl_boot_device(void) · line 28
Quoted 9 lines
arch/arm/imx-common/spl.c +5
-0@@ -20,7 +20,14 @@ u32 spl_boot_device(void)struct src *psrc = (struct src *)SRC_BASE_ADDR ;unsigned int gpr10_boot =readl (&psrc->gpr10) & (1 <<28 );unsigned reg = gpr10_boot ?readl (&psrc->gpr9) :readl (&psrc->sbmr1); +unsigned int bmode =readl (&psrc->sbmr2); +/* +* Check for BMODE if serial downloader is enabled +* BOOT_MODE - see IMX6DQRM Table 8-1 +*/ I think you may need to check only bits 24 and 25 here.
Quoted 9 lines
arch/arm/imx-common/spl.c u32 spl_boot_device(void) · line 30
Quoted 2 lines
arch/arm/imx-common/spl.c +2
-0+if ((bmode >>24 ) ==0x01 )/* Serial Downloader */ +return BOOT_DEVICE_UART ;Even though the data sheet says the high bits should be zero, I'm seeing some other bits set on an i.MX6SL:
=> mm 0x020d801c 020d801c: 22000001 ? x
Agree - I checked on Solo / DL, and bits were zero. I fix it in V2.
Quoted 8 lines
Separately, what's your thought about enabling this when the system is reset through "bmode usb"?
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.
Regards,
Stefano
Signature · 5 lines
===================================================================== 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 =====================================================================
PATCH 1/1 imx_common: check for Serial Downloader in spl_boot_device
Hi Eric,
Quoted 7 lines · Stefano Babic
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_CFG4as0x40("Reserved for serial ROM"), and fixingBOOT_CFG1to0x30, 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.
Ok, it was quite confused - forget it ;-).
Anyway, the fact is that when "bmode usb" is issued, the board announces itself correctly to the USB bus, but reading SBMR2 we get again internal mode. It is like another information to be stored, we should require a bit in some of the GPR registers to store it.
Regards,
Stefano
Signature · 5 lines
===================================================================== 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 =====================================================================
PATCH 1/1 imx_common: check for Serial Downloader in spl_boot_device
In reply to Stefano BabicHi Stefano,
Quoted 12 lines · Stefano Babic
Hi Eric,
Quoted 9 lines · Eric Nelson
Hi Stefano,
Quoted 6 lines · Stefano Babic
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_SUPPORTis set.
...
Quoted 9 lines
Quoted 8 lines
Separately, what's your thought about enabling this when the system is reset through "bmode usb"?
Since the gpr9 value in this mode is
0x00000001, the switch statement currently falls into the NOR/OneNAND block, which is pretty useless.
Quoted 7 lines
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_CFG4as0x40("Reserved for serial ROM"), and fixingBOOT_CFG1to0x30, 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:
arch/arm/imx-common/spl.c +2 -1
@@ -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
PATCH 1/1 imx_common: check for Serial Downloader in spl_boot_device
Hi Eric,
Quoted 10 lines · Eric Nelson
Quoted 7 lines
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_CFG4as0x40("Reserved for serial ROM"), and fixingBOOT_CFG1to0x30, 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
:-)
Quoted 18 lines
The "bmode usb" command sets gpr9 to 1, which isn't used for anything else, so something like this will work:
arch/arm/imx-common/spl.c +2
-1@@ -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,
Quoted 2 lines
so the test is safe.
This is a nice trick - I cannot see as well any combination for obtaining a 0x01 in GPR9.
Quoted 4 lines
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).
Agree.
I add your proposal in V2, thanks !
Best regards,
Stefano
Signature · 5 lines
===================================================================== 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 =====================================================================