mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-25 22:44:39 +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
|
.globl _start
|
||||||
_start: b start_code
|
_start: b start_code
|
||||||
|
/* if we are injected by JTAG, the script sets _istag content to nonzero */
|
||||||
|
_is_jtag:
|
||||||
|
.word 0
|
||||||
|
|
||||||
_TEXT_BASE:
|
_TEXT_BASE:
|
||||||
.word TEXT_BASE
|
.word TEXT_BASE
|
||||||
|
@ -47,21 +47,39 @@ void start_qi(void)
|
|||||||
int n = 0;
|
int n = 0;
|
||||||
int board = 0;
|
int board = 0;
|
||||||
const struct board_variant * board_variant;
|
const struct board_variant * board_variant;
|
||||||
|
const u32 * p_is_jtag = (const u32 *)4;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We got the first 4KBytes of the bootloader pulled into the
|
* well, we can be running on this CPU two different ways.
|
||||||
* 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
|
* 1) We were copied into steppingstone and TEXT_BASE already
|
||||||
* expect to run from 0x0. But the linker script has told everything
|
* by JTAG. We don't have to do anything else. JTAG script
|
||||||
* else to expect to run from 0x33000000+. That's why we are going to
|
* then sets data at address 0x4 to 0xffffffff as a signal we
|
||||||
* be able to copy this code and not have it crash when we run it from
|
* are running by JTAG.
|
||||||
* there.
|
*
|
||||||
|
* 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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* We randomly pull 24KBytes of bootloader */
|
if (!*p_is_jtag)
|
||||||
if (nand_read_ll((unsigned char *)TEXT_BASE, 0, 24 * 1024 / 512) < 0)
|
/*
|
||||||
goto unhappy;
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 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
|
/* ask all the boards we support in turn if they recognize this
|
||||||
* hardware we are running on, accept the first positive answer
|
* hardware we are running on, accept the first positive answer
|
||||||
@ -69,7 +87,7 @@ void start_qi(void)
|
|||||||
|
|
||||||
this_board = boards[board];
|
this_board = boards[board];
|
||||||
while (!n) {
|
while (!n) {
|
||||||
if (board >= ARRAY_SIZE(boards))
|
if (board > ARRAY_SIZE(boards))
|
||||||
/* can't put diagnostic on serial... too early */
|
/* can't put diagnostic on serial... too early */
|
||||||
goto unhappy;
|
goto unhappy;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user