Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Loading kernel from serial flash with U-boot on AT91SAM9G20
PostPosted: Wed Dec 29, 2010 2:55 am 
Offline
User avatar

Joined: Mon Jul 19, 2010 8:47 pm
Posts: 59
Hi all,

The custom AT91SAM9G20 board I've been working on is now close to working. I can load the Linux kernel via TFTP, but I'd like to pull it from a serial flash on CS0.

I can load U-boot from my serial flash with AT91Bootstrap, so I know the hardware works. I've customized U-boot v2010.09 with the changes you can see here: https://github.com/rascalmicro/u-boot-r ... 148d843a8a The spi.c I'm using is a duplicate of the same file found in board/calao/sbc35_a9g20/.

This seems like it should work. However, when I issue the sf probe command, I see this:
U-Boot> sf probe 0
SF: Unsupported manufacturer 00
Failed to initialize SPI flash at 0:0

My impression from the conclusion of this monster thread: http://www.at91.com/forum/viewtopic.php ... sk,t/sd,a/ is that what I'm trying to do is possible.

Any suggestions? Do I need to specify certain speeds or modes to make it work?

_________________
Brandon Stafford
Rascal Micro


Top
 Profile  
 
 Post subject: Re: Loading kernel from serial flash with U-boot on AT91SAM9G20
PostPosted: Wed Dec 29, 2010 3:18 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 574
Is there any code to initialize the GPIO pins? The Linux code treats the -CS pins as bit-banged GPIO pins, whereas ATMEL's code tends to set them in the SPI controller for it to control automatically. They might not be set in the way you need them.


Top
 Profile  
 
 Post subject: Re: Loading kernel from serial flash with U-boot on AT91SAM9G20
PostPosted: Thu Dec 30, 2010 9:40 pm 
Offline
User avatar

Joined: Mon Jul 19, 2010 8:47 pm
Posts: 59
It took a little bit of digging, but I figured this one out. CptTitanic, you were on the right track-- thanks.

As Titanic noted, the CS line can be controlled by the SPI hardware or by U-boot as GPIO. If the SPI hardware is allowed to control the CS line, when the "read id" command is issued, the CS line goes high briefly between the command and the 5 bytes of clock signal sent to crank out the ID in response. Unfortunately, this violates the spec of the Macronix serial flash, and even worse, it doesn't work. The CS line has to stay low for the duration of the command and response.

Switching to U-boot control of the CS line fixes the problem. I did this with the following line added to atmel_spi.c just before the return of spi_setup_slave():

at91_spi0_hw_init(1 << 4);

Thanks again for the hint, Titanic.

_________________
Brandon Stafford
Rascal Micro


Top
 Profile  
 
 Post subject: Re: Loading kernel from serial flash with U-boot on AT91SAM9G20
PostPosted: Fri Dec 31, 2010 12:52 am 
Offline

Joined: Thu Jul 08, 2010 9:36 pm
Posts: 28
That belongs into your board specific file. Do not modify common sources!
About like that:

int board_init(void)
{
...
#ifdef CONFIG_ATMEL_SPI0
/* (n+4) denotes to use nSPISEL(0) in GPIO mode! */
at91_spi0_hw_init(1 << (FRAM_CS_NUM + 4));
#endif
#ifdef CONFIG_ATMEL_SPI1
at91_spi1_hw_init(1 << (ENC_CS_NUM + 4));
#endif
...
return 0;
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: