2011-06-22 12:43:25     Latest u-boot + SPI flash boot problem

Document created by Aaronwu Employee on Sep 25, 2013
Version 1Show Document
  • View in full screen mode

2011-06-22 12:43:25     Latest u-boot + SPI flash boot problem


Message: 101572   




We are using u-boot for our BF548 based product.


We use it from nand for customer and application developpers, but we also use it from SPI for the factory and kernel developpers.


We have succesffully switched from the 2009 u-boot release (with *dirty* directories layout) to the *new* directory layout (we are currently using the 2010R1 u-boot release). As we didn't had much to do on the kernel these month, we didn't tried it for the SPI boot mode, and in fact, it's not working anymore:


If I use the latest release or 2010R1 with early debug enabled, it goes up to :


Early:start.S: Init Registers

Early:start.S: Find ourselves

Early:start.S: Lower to 15


then stops (no matter if I do a cold boot or a reboot from the kernel).




I've compared the start.S and the only one difference was the way the registers are set. After having played a little bit with *old* (2009) and new (2010/2011) start.S files, Ive been able to boot u-boot partially by changing the lines (in start.S) :


    p3.l = .LWAIT_HERE;

    p3.h = .LWAIT_HERE;

    reti = p3;




    p4.l = .LWAIT_HERE;

    p4.h = .LWAIT_HERE;

    reti = p4;


I've checked and p4 is no more used after we jump to the user program, but p3 seems to be used to hold the GD table pointer. If I change these lines, then I can partially boot u-boot by booting on a working kernel (nand boot), then typing 'reboot' (and set the bootmode to spy).


I say I can partially boo u-boot because it stops after '*** Warning - bad CRC, using default environment',  but that might be a non-related problem.




I've seen that post : http://blackfin.uclinux.org/gf/forumthread/36348


but the workaround doesn't seem to work for us.




I've been looking at the initcode.c file also and except the uart init function being a little bit different, I've not seen any major changes, so I don't understand what can cause this issue.




Can you help me ?


(I've attached my board config file, if it can help)




Regards, Jerome






2011-06-22 13:04:32     Re: Latest u-boot + SPI flash boot problem

Mike Frysinger (UNITED STATES)

Message: 101573   


p3 is used for the GD table, but that doesnt get setup until much later -- in board_init_f().  so p3 can be used for whatever before that point.


unless you have custom code which attempts to utilize the global data earlier on ?  that'd be bad.  but stock u-boot doesnt ...




2011-06-23 03:53:40     Re: Latest u-boot + SPI flash boot problem


Message: 101603   


blackfin early serial initialisation and baudrate setting indeed use gd->baudrate to setup the baudrate (it get called by the macros serial_early_set_baud & serial_early_init). And by the way, when serial_early_set_baud is called in start.S, the gd table isn't initialized and the baudrate is corrupted. I've tried both disable it (it keeps the initialized status of the initcode.c and works), and made a patch to test the baudrate value for an "standard" value, and now this part of code works.




Anyway, it doesn't change the fact that using SPI master boot, I can't get it to go further than the "Lower to 15" step on cold boot. Seems like the interrupt raised by 'raise 15' isn't working. We don't have custom code which use p3, our changes are made in the our board files and are not in the basic startup process.


Are you able to get a bf548 booting from SPI master using either 2010R1 or the latest git version ?


Why using p4 help a little bit to make the blackfin being able to go further in the boot process (maybe booting on linux sets up some irq stuffs that are still present on reboot, which helps to trigger the EVT_15 IRQ ?). Does the bootrom differs between NAND and SPI master boot (for the irq setup) ?


Regards, Jerome




2011-06-23 06:35:26     Re: Latest u-boot + SPI flash boot problem


Message: 101609   






Using the 2010RC2, I was able to make the SPI boot working. I'm going to check the differences between the 2010RC2 and the latest git version (master branch).


Also, you can try to compile the latest git with early serial debug (CONFIG_DEBUG_SERIAL = 1 and CONFIG_DEBUG_EARLY_SERIAL = 1), and you should get this error :


arch/blackfin/cpu/start.S:84: undefined reference to `serial_set_baud'


(done on a fresh git copy with make bf548-ezkit + defining the two debug defines above)




Regards, Jerome




2011-06-23 13:38:58     Re: Latest u-boot + SPI flash boot problem

Mike Frysinger (UNITED STATES)

Message: 101626   


you cant enable early debug and multi serial support at the same time.  i'll add a patch to do this automatically in the adi boards config.




2011-06-23 13:44:05     Re: Latest u-boot + SPI flash boot problem

Mike Frysinger (UNITED STATES)

Message: 101627   


i dont think it is touching gd.  gd->baudrate is only referenced by serial_setbrg(), and serial_setbrg() is only referenced by serial_init().  neither of which are referenced by the serial_early_* code (by design).

  start.S:serial_early_init -> hits MMRs

  start.S:serial_early_set_baud(ASSEMBLY) -> serial.c:serial_set_baud(C) -> serial.h:serial_early_set_baud(C) -> programs the MMRs


if you see an exact code path where the early serial code references gd, please post the exact call path (func names/files/etc...) so i can check/fix.


do you have JTAG ?  i wonder if IVG5 is being set before the lowering.


i just tested u-boot-bf548-ezkit-spi-2010R1-RC2.ldr on my board and it loaded fine:


U-Boot 2010.06 (ADI-2010R1-RC2) (Oct 20 2010 - 04:41:17)


CPU:   ADSP bf548-0.0 (Detected Rev: 0.2) (spi flash boot)

Board: ADI BF548 EZ-Kit board

       Support: http://blackfin.uclinux.org/

Clock: VCO: 525 MHz, Core: 525 MHz, System: 131.250 MHz

RAM:   64 MiB

Flash: 16 MiB

NAND:  256 MiB

MMC:  Blackfin SDH: 0

SF: Detected M25P16 with page size 256, total 2 MiB

In:    serial

Out:   serial

Err:   serial

KGDB:  [on serial] ready

Net:   smc911x-0

Hit any key to stop autoboot:  0




2011-06-24 04:04:30     Re: Latest u-boot + SPI flash boot problem


Message: 101652   


Indeed, gd->baudrate is unsed in serial_setbrg which I redirected to in the serial_early_set_baud, because of the compilation error, but even with this disabled, it couldn't boot.


We are currently trying to find back the JTAG we bought a few years ago.


The 2010RC2 build in now running fine, but the latest git doesn't. That's not a big problem as 2010RC2 does what we want, but something might have been broken in the latest versions.


I will let you know if I can get the JTAG and look at IVG5.


Thanks, Jerome




2011-06-24 14:26:30     Re: Latest u-boot + SPI flash boot problem

Mike Frysinger (UNITED STATES)

Message: 101665   


what'd you change in the 2010R1 release to make it work ?  anything ?




2011-06-27 04:02:10     Re: Latest u-boot + SPI flash boot problem


Message: 101706   


Nothing was changed in the 2010RC2. It builds fine and I just changed the boot mode at first (on the bf548-ezkit).


After tests, I've merge our changes with tests for every changes and it works. I guess, the first attempt with 2010RC2 might failed because of a *dirty* local tree.




2011-06-27 13:22:58     Re: Latest u-boot + SPI flash boot problem

Mike Frysinger (UNITED STATES)

Message: 101716   


ok, that's good to know.  one thing that trips up people is that you have to run `make clean` sometimes if your changes affect like the initcode.




2011-06-28 03:57:07     Re: Latest u-boot + SPI flash boot problem


Message: 101786   


Sometimes, even make clean wasn't enought when I did some changes in the header files. For *security*, I was doing make distclean && make <boardname>