public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] OMAP3: NAND init problems
@ 2011-06-17 10:03 Simon Schwarz
  2011-06-17 14:41 ` Andreas Bießmann
  2011-06-17 19:27 ` Sughosh Ganu
  0 siblings, 2 replies; 5+ messages in thread
From: Simon Schwarz @ 2011-06-17 10:03 UTC (permalink / raw)
  To: u-boot

Hi list,

I'am trying to get the NAND-flash to work in my OMAP3 SPL. I
essentially call these functions after the base init:
gpmc_init();
nand_init();

But in nand_init() the cpu jumps somewhere in memory. I tracked that
down to nand_get_flash_type() to the call chip->select_chip(mtd, 0);
Some digging shows that the select_chip function pointer isn't
initialized -> just garbage.

Just before the call to nand_get_flash_type() is a call to
nand_set_defaults(chip, busw) which IMHO should be responsible to set
the function-pointers. But this function tests for non-zero value ->
garbage is non-zero.

Do I miss something for NAND init?

Thanks in advance!
Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] OMAP3: NAND init problems
  2011-06-17 10:03 [U-Boot] OMAP3: NAND init problems Simon Schwarz
@ 2011-06-17 14:41 ` Andreas Bießmann
       [not found]   ` <BANLkTi=91rBGKWnRaQxkdPj5aGNARy687Q@mail.gmail.com>
  2011-06-17 19:27 ` Sughosh Ganu
  1 sibling, 1 reply; 5+ messages in thread
From: Andreas Bießmann @ 2011-06-17 14:41 UTC (permalink / raw)
  To: u-boot

Dear Simon Schwarz,

Am 17.06.2011 um 12:03 schrieb Simon Schwarz:

> Hi list,
> 
> I'am trying to get the NAND-flash to work in my OMAP3 SPL. I
> essentially call these functions after the base init:
> gpmc_init();
> nand_init();
> 
> But in nand_init() the cpu jumps somewhere in memory. I tracked that
> down to nand_get_flash_type() to the call chip->select_chip(mtd, 0);
> Some digging shows that the select_chip function pointer isn't
> initialized -> just garbage.
> 
> Just before the call to nand_get_flash_type() is a call to
> nand_set_defaults(chip, busw) which IMHO should be responsible to set
> the function-pointers. But this function tests for non-zero value ->
> garbage is non-zero.

so is this uninitialized? Why don't you set this to an explicit value (e.g. zero) just before going into the nand_init() chain.
Where is your 'struct nand_chip' instance located (in .bss, in .data)?

regards

Andreas Bie?mann

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] OMAP3: NAND init problems
       [not found]   ` <BANLkTi=91rBGKWnRaQxkdPj5aGNARy687Q@mail.gmail.com>
@ 2011-06-17 17:13     ` Andreas Bießmann
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Bießmann @ 2011-06-17 17:13 UTC (permalink / raw)
  To: u-boot

Dear Simon Schwarz,

please don't use TOFU, use inline quoting and also send to the list.

Am 17.06.2011 um 17:18 schrieb Simon Schwarz:

> Dear Andreas,
> 
> i tried setting it - but this should be already working code -
> therefore if I have to set the values manually it is very likely that
> I did something wrong while adapting it for the SPL.

Sounds correct.

> I can't find
> anything in the devkit8000 implementation which sets these values -
> and NAND is working nonetheless.

Yes, armv7 start.S initializes .bss to zero in normal case (after relocation -> see clear_bss). Is that called in your case (SPL with not mainline code) too?

> nand_chip is in bss (which is in RAM). IMHO this shouldn't be a
> problem because RAM is initialized before, right?

Yes, if it is initialized correctly (zero out the bss section!), remember our talk some days ago.

But I just guessing cause of your statement 'the function pointer are initialized to garbage' in your first mail, it may be a completely other cause. Please let us know what it was.

regards

Andreas Bie?mann

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] OMAP3: NAND init problems
  2011-06-17 10:03 [U-Boot] OMAP3: NAND init problems Simon Schwarz
  2011-06-17 14:41 ` Andreas Bießmann
@ 2011-06-17 19:27 ` Sughosh Ganu
  2011-06-20 16:17   ` Simon Schwarz
  1 sibling, 1 reply; 5+ messages in thread
From: Sughosh Ganu @ 2011-06-17 19:27 UTC (permalink / raw)
  To: u-boot

hi,
On Fri Jun 17, 2011 at 12:03:31PM +0200, Simon Schwarz wrote:

> I'am trying to get the NAND-flash to work in my OMAP3 SPL. I
> essentially call these functions after the base init:
> gpmc_init();
> nand_init();

  I guess this is the same as nand_spl. Do you use nand_boot.c in the
  spl code. This file has the nand_chip object declared as a local
  variable on the stack, and not bss.


> But in nand_init() the cpu jumps somewhere in memory. I tracked that
> down to nand_get_flash_type() to the call chip->select_chip(mtd, 0);
> Some digging shows that the select_chip function pointer isn't
> initialized -> just garbage.

  If you check the nand_boot function in the nand_boot.c, it calls
  board_nand_init, and not nand_init, so i guess you are using a
  different path here.

-sughosh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] OMAP3: NAND init problems
  2011-06-17 19:27 ` Sughosh Ganu
@ 2011-06-20 16:17   ` Simon Schwarz
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Schwarz @ 2011-06-20 16:17 UTC (permalink / raw)
  To: u-boot

Dear Sughosh,

> ?I guess this is the same as nand_spl. Do you use nand_boot.c in the
> ?spl code. This file has the nand_chip object declared as a local
> ?variable on the stack, and not bss.
I first tried to use the standard NAND implementation - but I think
you are right - using nand_spl implementation is much smaller. the
auto recognition functions are nice but the trade-off in size is huge.

I solved the problem - it was the .bss section not initialized to zero
- thanks for the hint!

Regards
Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-06-20 16:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-17 10:03 [U-Boot] OMAP3: NAND init problems Simon Schwarz
2011-06-17 14:41 ` Andreas Bießmann
     [not found]   ` <BANLkTi=91rBGKWnRaQxkdPj5aGNARy687Q@mail.gmail.com>
2011-06-17 17:13     ` Andreas Bießmann
2011-06-17 19:27 ` Sughosh Ganu
2011-06-20 16:17   ` Simon Schwarz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox