Patchwork [U-Boot] da850evm: u-boot does not start without UBL since commit f1d2b313c9eb6808d30c16a9eb5251240452a56c

login
register
mail settings
Submitter Christian Riesch
Date June 20, 2011, 1:07 p.m.
Message ID <1308575272-30559-1-git-send-email-christian.riesch@omicron.at>
Download mbox | patch
Permalink /patch/101116/
State Not Applicable
Headers show

Comments

Christian Riesch - June 20, 2011, 1:07 p.m.
Hi Ben,

I had no hardware for a about a week but now I have an AM1808 experimenter's 
kit again and can continue investigating this issue.

On this board, older versions of u-boot (like v2009.11) boot perfectly,
even when TI's UBL boot loader is not used (instead the configuration of 
DDR memory was done using an AIS script). However, since commit 
f1d2b313c9eb6808d30c16a9eb5251240452a56c u-boot boots only when used in 
conjunction with TI's UBL boot loader. When used without UBL, u-boot showed
no sign of life on the serial port.

The content of the .ini file to build the AIS script using the
HexAIS tool was

[General]
busWidth=8
BootMode=SPIMASTER
crcCheckType=NO_CRC
[PLLANDCLOCKCONFIG]
PLL0CFG0 = 0x00180001
PLL0CFG1 = 0x00000205
PERIPHCLKCFG = 0x0000000a
[EMIF3DDR]
PLL1CFG0 = 0x15010001
PLL1CFG1 = 0x00000002
DDRPHYC1R = 0x000000C4
SDCR = 0x0A034622
SDTIMR = 0x184929C8
SDTIMR2 = 0xB80FC700
SDRCR = 0x00000406
CLK2XSRC = 0x00000000
[INPUTFILE]
FILENAME=u-boot.bin
LOADADDRESS=0xC1080000
ENTRYPOINTADDRESS=0xC1080000

After investigating the problem today I figured out that the reason for 
the problem is the configuration of LPSC for UART2. To make u-boot work,
the following lines must be added to the .ini file to enable the UART2
PSC module:

[PSCCONFIG]
LPSCCFG = 0x010D0003

This seems odd, since LPSC configuration is already done by board_init()
in board/davinci/da8xxevm/da850evm.c. However, I guess this initialization
is done too late, since arch/arm/lib/board.c calls other serial port related
functions before board_init() is executed. When I move the LPSC configuration
of UART2 to a board_early_init_f() function, u-boot boots even without the
[PSCCONFIG] section in the .ini file. The patch below does the required
modifications.

Ben, would you mind testing this patch on your board?
Is this the correct way to address this problem?

Best regards, Christian

 board/davinci/da8xxevm/da850evm.c |    7 ++++++-
 include/configs/da850evm.h        |    1 +
 2 files changed, 7 insertions(+), 1 deletions(-)
Wolfgang Denk - June 20, 2011, 1:46 p.m.
Dear Christian Riesch,

In message <1308575272-30559-1-git-send-email-christian.riesch@omicron.at> you wrote:
> 
> On this board, older versions of u-boot (like v2009.11) boot perfectly,
> even when TI's UBL boot loader is not used (instead the configuration of 
> DDR memory was done using an AIS script). However, since commit 

What is AIS ?

Best regards,

Wolfgang Denk
Christian Riesch - June 20, 2011, 2:15 p.m.
Hello Wolfgang,

On Mon, Jun 20, 2011 at 3:46 PM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Christian Riesch,
>
> In message <1308575272-30559-1-git-send-email-christian.riesch@omicron.at> you wrote:
>>
>> On this board, older versions of u-boot (like v2009.11) boot perfectly,
>> even when TI's UBL boot loader is not used (instead the configuration of
>> DDR memory was done using an AIS script). However, since commit
>
> What is AIS ?

I apologize for using that many abbreviations in my mail and not
explaining them :-/

AIS is short for Application Image Script [1]. It is a boot script
that is processed by the ROM bootloader on Texas Instrument's
AM1808/DA850/OMAP-L138 processors. The script allows configuration of
boot modes, PLLs, DDR memory, Pinmuxes etc and loading the an
application like u-boot from flash to RAM and executing it. Using a
suitable AIS one can configure PLL and DDR memory and then directly
start u-boot on these processors, without using Texas Instruments's
user boot loader (UBL) [2].

In the default configuration of the da850evm the boot sequence is like this:
1) ROM bootloader (RBL): starts reading from flash
2) In the SPI-flash, a very simple AIS is present. This AIS tells the
RBL to load the UBL from flash and to start it.
3) The UBL does a lot of hardware initialization and then loads u-boot
from flash and starts it.
4) u-boot does a lot of hardware initialization that has already been
done by the UBL and then loads the Linux kernel.

For my application I would like to get rid of the UBL since most of
the configuration it does is also done by u-boot (although there seems
to be a bug in it) or can be done by AIS (like PLL and DDR memory
configuration), the resulting boot sequence will be:
1) ROM bootloader (RBL): starts reading from flash
2) In the SPI-flash, an AIS is present. This AIS tells the RBL to
configure PLLs and DDR memory and to  load u-boot from flash and to
start it.
3) u-boot loads the Linux kernel.

Hope that helps :-)
Best regards, Christian


[1] Using the AM18xx Bootloader (Rev. A)
http://focus.ti.com/dsp/docs/litabsmultiplefilelist.tsp?sectionId=3&tabId=409&literatureNumber=spraba5a&docCategoryId=1&familyId=1877

[2] https://sourceforge.net/projects/dvflashutils/files
Wolfgang Denk - June 20, 2011, 2:35 p.m.
Dear Christian Riesch,

In message <BANLkTimhJSs_URkzB-q5y7GQzawSWe005g@mail.gmail.com> you wrote:
>
> > What is AIS ?
> 
> I apologize for using that many abbreviations in my mail and not
> explaining them :-/
> 
> AIS is short for Application Image Script [1]. It is a boot script
> that is processed by the ROM bootloader on Texas Instrument's
> AM1808/DA850/OMAP-L138 processors. The script allows configuration of
> boot modes, PLLs, DDR memory, Pinmuxes etc and loading the an
> application like u-boot from flash to RAM and executing it. Using a
> suitable AIS one can configure PLL and DDR memory and then directly
> start u-boot on these processors, without using Texas Instruments's
> user boot loader (UBL) [2].
> 
> In the default configuration of the da850evm the boot sequence is like this:
> 1) ROM bootloader (RBL): starts reading from flash
> 2) In the SPI-flash, a very simple AIS is present. This AIS tells the
> RBL to load the UBL from flash and to start it.
> 3) The UBL does a lot of hardware initialization and then loads u-boot
> from flash and starts it.
> 4) u-boot does a lot of hardware initialization that has already been
> done by the UBL and then loads the Linux kernel.
> 
> For my application I would like to get rid of the UBL since most of
> the configuration it does is also done by u-boot (although there seems
> to be a bug in it) or can be done by AIS (like PLL and DDR memory
> configuration), the resulting boot sequence will be:
> 1) ROM bootloader (RBL): starts reading from flash
> 2) In the SPI-flash, an AIS is present. This AIS tells the RBL to
> configure PLLs and DDR memory and to  load u-boot from flash and to
> start it.
> 3) u-boot loads the Linux kernel.

Thanks for the explanations.

You might want to synchronize your efforts with Heiko Schocher (on
cc:) who might be working on similar things.

Best regards,

Wolfgang Denk
Christian Riesch - June 21, 2011, 4:42 a.m.
Hello Wolfgang,

On Monday, June 20, 2011, Wolfgang Denk <wd@denx.de> wrote:
> You might want to synchronize your efforts with Heiko Schocher (on
> cc:) who might be working on similar things.

Thanks! I put Heiko on cc in my first email in this thread, but then
forgot it later. Sorry about that, Heiko, I am looking forward to your
comments.

Regards, Christian
Heiko Schocher - June 21, 2011, 7:29 a.m.
Hello Christian,

Sorry for the late answer ...

Wolfgang Denk wrote:
> Dear Christian Riesch,
> 
> In message <BANLkTimhJSs_URkzB-q5y7GQzawSWe005g@mail.gmail.com> you wrote:
>>> What is AIS ?
>> I apologize for using that many abbreviations in my mail and not
>> explaining them :-/
>>
>> AIS is short for Application Image Script [1]. It is a boot script
>> that is processed by the ROM bootloader on Texas Instrument's
>> AM1808/DA850/OMAP-L138 processors. The script allows configuration of
>> boot modes, PLLs, DDR memory, Pinmuxes etc and loading the an
>> application like u-boot from flash to RAM and executing it. Using a
>> suitable AIS one can configure PLL and DDR memory and then directly
>> start u-boot on these processors, without using Texas Instruments's
>> user boot loader (UBL) [2].
>>
>> In the default configuration of the da850evm the boot sequence is like this:
>> 1) ROM bootloader (RBL): starts reading from flash
>> 2) In the SPI-flash, a very simple AIS is present. This AIS tells the
>> RBL to load the UBL from flash and to start it.
>> 3) The UBL does a lot of hardware initialization and then loads u-boot
>> from flash and starts it.

Ok.

>> 4) u-boot does a lot of hardware initialization that has already been
>> done by the UBL and then loads the Linux kernel.

Hmm.. why does U-Boot code again such initialization? This is
wrong ... this should be cleaned up!

Ok, I do actually a similiar job for an TI DM368 based board,
booting from NAND flash. I am using instead the UBL, now the
nand_spl code from u-boot, bootsequence is:

1) ROM bootloader (RBL) searches for an UBL Header in NAND,
   which contains the info where to find in the NAND flash the
   "UBL" (User Boot Loader). If such an header is found:

2) loading the UBL(now nand_spl code) from NAND to internal RAM
   and start executing it.

3) The UBL (nand_spl code) inits RAM, clocks... and loads U-Boot
   from NAND to RAM and jumps to it ...


So I actually create with "make board_config" an u-boot.ubl image,
which contains this ubl header(created with mkimage), nand_spl code
and u-boot, burn this into nand, and boot it ...

>> For my application I would like to get rid of the UBL since most of
>> the configuration it does is also done by u-boot (although there seems
>> to be a bug in it) or can be done by AIS (like PLL and DDR memory
>> configuration), the resulting boot sequence will be:
>> 1) ROM bootloader (RBL): starts reading from flash

How detects the RBL that there is something in the SPI flash,
isn;t there such a header like on the DM368?

Ah, looked in [1] and there is nothing similiar ...

>> 2) In the SPI-flash, an AIS is present. This AIS tells the RBL to
>> configure PLLs and DDR memory and to  load u-boot from flash and to
>> start it.

Maybe you can use here the "simple AIS header" as above in step 2
(maybe create this simple header with the mkimage tool?) and use
something like the nand_spl code calling it spi_spl which do all
necessary setups (DDR, PLL,...) in C-Code? So we can get rid off
this external AIS tool, UBL and do *all* things in/with U-boot?

Please look also into the "SPL framework re-design" thread.

>> 3) u-boot loads the Linux kernel.

bye,
Heiko

[1]: http://focus.ti.com/lit/an/spraba5a/spraba5a.pdf

Patch

diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index 73eaa48..a864412 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -129,7 +129,6 @@  static const struct lpsc_resource lpsc[] = {
 	{ DAVINCI_LPSC_AEMIF },	/* NAND, NOR */
 	{ DAVINCI_LPSC_SPI1 },	/* Serial Flash */
 	{ DAVINCI_LPSC_EMAC },	/* image download */
-	{ DAVINCI_LPSC_UART2 },	/* console */
 	{ DAVINCI_LPSC_GPIO },
 };
 
@@ -166,6 +165,12 @@  u32 get_board_rev(void)
 	return rev;
 }
 
+int board_early_init_f(void)
+{
+	lpsc_on(DAVINCI_LPSC_UART2);
+	return 0;
+}
+
 int board_init(void)
 {
 #ifndef CONFIG_USE_IRQ
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index bbb5a9b..5d0f5bf 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -42,6 +42,7 @@ 
 #define CONFIG_SYS_HZ			1000
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_SYS_TEXT_BASE		0xc1080000
+#define CONFIG_BOARD_EARLY_INIT_F
 
 /*
  * Memory Info