mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-29 09:55:54 +02:00
add-jtag-detection.patch
This adds capability to use single qi image for JTAG load action as well as execution from NAND. It requires JTAG script to load the image at 0x0 and 0x33000000 addresses, then set data at 0x04 address to 0xffffffff. This eliminates the lowlevel_foo stuff from U-Boot world. Signed-off-by: Andy Green <andy@openmoko.com>
This commit is contained in:
parent
ec8ea0c281
commit
a560858377
@ -24,6 +24,9 @@
|
||||
|
||||
.globl _start
|
||||
_start: b start_code
|
||||
/* if we are injected by JTAG, the script sets _istag content to nonzero */
|
||||
_is_jtag:
|
||||
.word 0
|
||||
|
||||
_TEXT_BASE:
|
||||
.word TEXT_BASE
|
||||
|
@ -47,20 +47,38 @@ void start_qi(void)
|
||||
int n = 0;
|
||||
int board = 0;
|
||||
const struct board_variant * board_variant;
|
||||
const u32 * p_is_jtag = (const u32 *)4;
|
||||
|
||||
/*
|
||||
* well, we can be running on this CPU two different ways.
|
||||
*
|
||||
* 1) We were copied into steppingstone and TEXT_BASE already
|
||||
* by JTAG. We don't have to do anything else. JTAG script
|
||||
* then sets data at address 0x4 to 0xffffffff as a signal we
|
||||
* are running by JTAG.
|
||||
*
|
||||
* 2) We only got our first 4K into steppingstone, we need to copy
|
||||
* the rest of ourselves into TEXT_BASE.
|
||||
*
|
||||
* So we do the copy out of NAND only if we see we did not come up
|
||||
* under control of JTAG.
|
||||
*/
|
||||
|
||||
if (!*p_is_jtag)
|
||||
/*
|
||||
* We got the first 4KBytes of the bootloader pulled into the
|
||||
* steppingstone SRAM for free. Now we pull the whole bootloader
|
||||
* image into SDRAM.
|
||||
*
|
||||
* This code and the .S files are arranged by the linker script to
|
||||
* expect to run from 0x0. But the linker script has told everything
|
||||
* else to expect to run from 0x33000000+. That's why we are going to
|
||||
* be able to copy this code and not have it crash when we run it from
|
||||
* there.
|
||||
* This code and the .S files are arranged by the linker script
|
||||
* to expect to run from 0x0. But the linker script has told
|
||||
* everything else to expect to run from 0x33000000+. That's
|
||||
* why we are going to be able to copy this code and not have it
|
||||
* crash when we run it from there.
|
||||
*/
|
||||
|
||||
/* We randomly pull 24KBytes of bootloader */
|
||||
if (nand_read_ll((unsigned char *)TEXT_BASE, 0, 24 * 1024 / 512) < 0)
|
||||
/* We randomly pull 32KBytes of bootloader */
|
||||
if (nand_read_ll((u8 *)TEXT_BASE, 0, 32 * 1024 / 512) < 0)
|
||||
goto unhappy;
|
||||
|
||||
/* ask all the boards we support in turn if they recognize this
|
||||
@ -69,7 +87,7 @@ void start_qi(void)
|
||||
|
||||
this_board = boards[board];
|
||||
while (!n) {
|
||||
if (board >= ARRAY_SIZE(boards))
|
||||
if (board > ARRAY_SIZE(boards))
|
||||
/* can't put diagnostic on serial... too early */
|
||||
goto unhappy;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user