public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] u-boot boot sequence
@ 2010-09-26 22:11 Marcel
  2010-09-27  2:06 ` [U-Boot] How to do pci_init in flash sywang
  2010-09-27  7:25 ` [U-Boot] u-boot boot sequence Wolfgang Denk
  0 siblings, 2 replies; 8+ messages in thread
From: Marcel @ 2010-09-26 22:11 UTC (permalink / raw)
  To: u-boot

Hi,

I'm working on u-boot-usb and I think I get along quite well so far for the 
Atmel g45, thanks to this list. Slowly I do like the u-boot structure although 
it has a steep learning curve (I guess one week is considered steep by me).
I've got the my Atmel Sam9G45 working for most parts (it boots well) and I 
hope to contribute some code soon (after usb is working well). 

I do however have some questions about the u-boot startup behaviour.

What I want to create is the following :

1) u-boot starts and checks if it can start my application (either CRC check 
or whatever). This is the first thing u-boot should do.
2) if it can't boot it will listen on USB or ethernet for someone to upload a 
valid image or boot via NFS or whatever has been configured.
3) If it can boot, it will boot immediately (there may be a GPIO pin to 
override this behaviour)
4) once within the application (linux or whatever) I must be able to set a flag 
that lets u-boot wait for uploading a new image file when I soft-reset my 
device. This is needed for firmware upgrading of course. I still need to check 
if this flag is supported by the CPU or needs other support (eeprom perhaps).
5) After uploading an image the soft-reset is cleared and the whole sequence 
start over again, so it should boot the new image.

In short I want the application to be in control and only if there's no 
application installed or it's corrupt or when the application let's u-boot 
know, u-boot is in control. I know at step 2 there are some complications for 
testing purposes, so there must be a way to change the behavior (change the 
order of doing things).
Maybe a kind of boot sequence added to u-boot would be fine. But the boot 
sequence only needs two items than. Either boot the image or stay in u-boot.

I know it's possible to do this but I wonder if it has been done before and if 
there any examples of it ?

Since I'm working on USB device support for my G45 and I want the above 
behaviour (or something very similar) I'm very much interested in any work 
that implements this or comes close to this. If it hasn't been done before I'm 
interested to work on this of course and contribute the work. In that case I'd 
be interested in anyone's opinion on this topic (I mean the way to implement 
it and stay consistent with the current u-boot code).

Best regards,
Marcel

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

* [U-Boot] How to do pci_init in flash
  2010-09-26 22:11 [U-Boot] u-boot boot sequence Marcel
@ 2010-09-27  2:06 ` sywang
  2010-09-27  7:27   ` Wolfgang Denk
  2010-09-27  7:25 ` [U-Boot] u-boot boot sequence Wolfgang Denk
  1 sibling, 1 reply; 8+ messages in thread
From: sywang @ 2010-09-27  2:06 UTC (permalink / raw)
  To: u-boot

 

Hello everyone, 

 

I want to do pci configuration in the function 'board_init_f'.  How to do
this? 

 

Could I call the function "pci_init" in the function 'board_init_f' or add
the function "pci_init" into the function array " init_sequence "? 

 

In other words, what pre-conditions there are before calling pci_init? How
to check the condition is ready? 

 

 

Thanks!

Shuyou 

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

* [U-Boot] u-boot boot sequence
  2010-09-26 22:11 [U-Boot] u-boot boot sequence Marcel
  2010-09-27  2:06 ` [U-Boot] How to do pci_init in flash sywang
@ 2010-09-27  7:25 ` Wolfgang Denk
  2010-09-29 20:33   ` Marcel
  1 sibling, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2010-09-27  7:25 UTC (permalink / raw)
  To: u-boot

Dear Marcel,

In message <201009270011.32850.korgull@home.nl> you wrote:
> 
> I do however have some questions about the u-boot startup behaviour.

Please read the manual; it should cover most of your questions.

> What I want to create is the following :
> 
> 1) u-boot starts and checks if it can start my application (either CRC check 
> or whatever). This is the first thing u-boot should do.
> 2) if it can't boot it will listen on USB or ethernet for someone to upload a 
> valid image or boot via NFS or whatever has been configured.

This is standard behaviour. See 7.4. Boot Arguments Unleashed etc.,
http://www.denx.de/wiki/view/DULG/LinuxBootArgs

> 3) If it can boot, it will boot immediately (there may be a GPIO pin to 
> override this behaviour)

setenv bootdelay 0

> 4) once within the application (linux or whatever) I must be able to set a flag 
> that lets u-boot wait for uploading a new image file when I soft-reset my 
> device. This is needed for firmware upgrading of course. I still need to check 
> if this flag is supported by the CPU or needs other support (eeprom perhaps).

see tools/env for tools to read and write the U-Boot environment
settings from Linux. This can be used to change the boot command, boot
delay etc.

> 5) After uploading an image the soft-reset is cleared and the whole sequence 
> start over again, so it should boot the new image.

You can script all these things in U-Boot.

> I know it's possible to do this but I wonder if it has been done before and if 
> there any examples of it ?

There is all kinds of more or less complext stuff around. Read the
manual. Read the default configurations set in other board config
files. Read the code available in board/*/auto_update.c etc.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The first 90% of a project takes 90% of the time, the last 10%  takes
the other 90% of the time.

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

* [U-Boot] How to do pci_init in flash
  2010-09-27  2:06 ` [U-Boot] How to do pci_init in flash sywang
@ 2010-09-27  7:27   ` Wolfgang Denk
  2010-09-27  8:03     ` sywang
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2010-09-27  7:27 UTC (permalink / raw)
  To: u-boot

Dear "sywang",

In message <20100927020635.0547228176@theia.denx.de> you wrote:
> 
> I want to do pci configuration in the function 'board_init_f'.  How to do
> this? 

Why would you want to do that? Why cannot you wait until U-Boot has
relocateditself to RAM so you have full access to all resources?

> Could I call the function "pci_init" in the function 'board_init_f' or add
> the function "pci_init" into the function array " init_sequence "? 

This might be difficult, as you still have a very limted runtime
environment only, with just a minimal stack, without writable data,
without valid BSS.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The more complex the mind, the greater the need for the simplicity of
play.
	-- Kirk, "Shore Leave", stardate 3025.8

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

* [U-Boot] How to do pci_init in flash
  2010-09-27  7:27   ` Wolfgang Denk
@ 2010-09-27  8:03     ` sywang
  0 siblings, 0 replies; 8+ messages in thread
From: sywang @ 2010-09-27  8:03 UTC (permalink / raw)
  To: u-boot


Wolfgang, 

Thanks for your feedback. 

Because the CPU-hang issue when pci_init still puzzle me, I want to check if
the issue is caused by relocate_code, in spite of the very probability. 

Do you have any suggestions about how to identify the root cause of PCI Init
configuration hang?  

Thanks!
Shuyou

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de] 
Sent: 2010?9?27? 15:27
To: sywang
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] How to do pci_init in flash

Dear "sywang",

In message <20100927020635.0547228176@theia.denx.de> you wrote:
> 
> I want to do pci configuration in the function 'board_init_f'.  How to do
> this? 

Why would you want to do that? Why cannot you wait until U-Boot has
relocateditself to RAM so you have full access to all resources?

> Could I call the function "pci_init" in the function 'board_init_f' or add
> the function "pci_init" into the function array " init_sequence "? 

This might be difficult, as you still have a very limted runtime
environment only, with just a minimal stack, without writable data,
without valid BSS.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The more complex the mind, the greater the need for the simplicity of
play.
	-- Kirk, "Shore Leave", stardate 3025.8

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

* [U-Boot] u-boot boot sequence
  2010-09-27  7:25 ` [U-Boot] u-boot boot sequence Wolfgang Denk
@ 2010-09-29 20:33   ` Marcel
  2010-09-29 20:51     ` Wolfgang Denk
  0 siblings, 1 reply; 8+ messages in thread
From: Marcel @ 2010-09-29 20:33 UTC (permalink / raw)
  To: u-boot

On Monday, September 27, 2010 09:25:36 am Wolfgang Denk wrote:
> Dear Marcel,
> 
> In message <201009270011.32850.korgull@home.nl> you wrote:
> > I do however have some questions about the u-boot startup behaviour.
> 
> Please read the manual; it should cover most of your questions.

Thanks for your kind reply. 
I do honestly have to say that I read a lot of u-boot code but actually only a 
parts of the manual. 

> > What I want to create is the following :
> > 
> > 1) u-boot starts and checks if it can start my application (either CRC
> > check or whatever). This is the first thing u-boot should do.
> > 2) if it can't boot it will listen on USB or ethernet for someone to
> > upload a valid image or boot via NFS or whatever has been configured.
> 
> This is standard behaviour. See 7.4. Boot Arguments Unleashed etc.,
> http://www.denx.de/wiki/view/DULG/LinuxBootArgs

I noticed that but had a different behavior in mind but was probably focused 
too much on USB instead of really looking at u-boot's behavior. Now that I 
read it again it does make a bit more sense and I think this will work out 
fine.

> > 3) If it can boot, it will boot immediately (there may be a GPIO pin to
> > override this behaviour)
> 
> setenv bootdelay 0
> 
> > 4) once within the application (linux or whatever) I must be able to set
> > a flag that lets u-boot wait for uploading a new image file when I
> > soft-reset my device. This is needed for firmware upgrading of course. I
> > still need to check if this flag is supported by the CPU or needs other
> > support (eeprom perhaps).
> 
> see tools/env for tools to read and write the U-Boot environment
> settings from Linux. This can be used to change the boot command, boot
> delay etc.

I used an AVR processor before and did this in the environment settings but 
currently that doesn't work for me yet.
My env is in nor flash and I don't have a driver in linux yet to communicate 
with it. I'll look into this.
Currently I write settings to eeprom but have no idea if it can be read from 
u-boot. I currently only use it for items that I need in Linux. I did see some 
drivers in u-boot for it, so I guess it should work as well and I'll have to 
try it or write a driver for my NOR flash.
 
> > 5) After uploading an image the soft-reset is cleared and the whole
> > sequence start over again, so it should boot the new image.
> 
> You can script all these things in U-Boot.

Great, that should solve it.

> > I know it's possible to do this but I wonder if it has been done before
> > and if there any examples of it ?
> 
> There is all kinds of more or less complext stuff around. Read the
> manual. Read the default configurations set in other board config
> files. Read the code available in board/*/auto_update.c etc.

This does solve a lot of my questions.
Thanks a lot for pointing me to that code and the other answers. 

best regards,
Marcel

> Best regards,
> 
> Wolfgang Denk

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

* [U-Boot] u-boot boot sequence
  2010-09-29 20:33   ` Marcel
@ 2010-09-29 20:51     ` Wolfgang Denk
  2010-09-29 20:58       ` Marcel
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2010-09-29 20:51 UTC (permalink / raw)
  To: u-boot

Dear Marcel,

In message <201009292233.04020.korgull@home.nl> you wrote:
>
> > see tools/env for tools to read and write the U-Boot environment
> > settings from Linux. This can be used to change the boot command, boot
> > delay etc.
> 
> I used an AVR processor before and did this in the environment settings but 
> currently that doesn't work for me yet.
> My env is in nor flash and I don't have a driver in linux yet to communicate 
> with it. I'll look into this.

Linux MTD drivers for NOR flash are really standard; they should work
out of the box on all architectures.

> Currently I write settings to eeprom but have no idea if it can be read from 
> u-boot. I currently only use it for items that I need in Linux. I did see some 

Yes, you can do this. Use the "eeprom read" (or raw "i2c" commands) to
read the eemprom content into RAM; then you can use "env import" to
import it into the environment.

Or you can combine "env export" with "eeprom write" for the opposite
direction.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Who is the oldest inhabitant of this village?"
"We haven't got one; we had one, but he died three weeks ago."

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

* [U-Boot] u-boot boot sequence
  2010-09-29 20:51     ` Wolfgang Denk
@ 2010-09-29 20:58       ` Marcel
  0 siblings, 0 replies; 8+ messages in thread
From: Marcel @ 2010-09-29 20:58 UTC (permalink / raw)
  To: u-boot

On Wednesday, September 29, 2010 10:51:06 pm Wolfgang Denk wrote:
> Dear Marcel,
> 
> In message <201009292233.04020.korgull@home.nl> you wrote:
> > > see tools/env for tools to read and write the U-Boot environment
> > > settings from Linux. This can be used to change the boot command, boot
> > > delay etc.
> > 
> > I used an AVR processor before and did this in the environment settings
> > but currently that doesn't work for me yet.
> > My env is in nor flash and I don't have a driver in linux yet to
> > communicate with it. I'll look into this.
> 
> Linux MTD drivers for NOR flash are really standard; they should work
> out of the box on all architectures.

ok. The vendor of my board must have overseen it and me too. I'll check it and 
try if I can make it work. This does have some advantage over using the eeprom 
although I guess I can still use the eeprom for some purpose. It's always good 
to have a choice. 

> > Currently I write settings to eeprom but have no idea if it can be read
> > from u-boot. I currently only use it for items that I need in Linux. I
> > did see some
> 
> Yes, you can do this. Use the "eeprom read" (or raw "i2c" commands) to
> read the eemprom content into RAM; then you can use "env import" to
> import it into the environment.
> 
> Or you can combine "env export" with "eeprom write" for the opposite
> direction.

It looks like all I need is available or at least within reach. Thanks so much 
for your answers, it will save quite lot of time for me to move on in my 
project.

Best regards,
Marcel

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

end of thread, other threads:[~2010-09-29 20:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-26 22:11 [U-Boot] u-boot boot sequence Marcel
2010-09-27  2:06 ` [U-Boot] How to do pci_init in flash sywang
2010-09-27  7:27   ` Wolfgang Denk
2010-09-27  8:03     ` sywang
2010-09-27  7:25 ` [U-Boot] u-boot boot sequence Wolfgang Denk
2010-09-29 20:33   ` Marcel
2010-09-29 20:51     ` Wolfgang Denk
2010-09-29 20:58       ` Marcel

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