public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] Multiple Flash Devices
@ 2005-02-21 17:34 Zachary Landau
  2005-02-23  8:17 ` Shawn Jin
  2005-02-24 22:31 ` Wolfgang Denk
  0 siblings, 2 replies; 6+ messages in thread
From: Zachary Landau @ 2005-02-21 17:34 UTC (permalink / raw)
  To: u-boot

Hello,

I'm currently working on getting u-boot to work from the internal
flash of the 5282.  I have it booting. and now I am working on getting
all the flash programming stuff setup.

I want to be able to access two (very different) flash devices.  I
want to be able to write to the internal flash device so that I can
save environmental variables, but I also want to be able to write to
the external flash so I can program data into it.

Is there a good method of setting up two flash devices at once?  As
far as I can tell, all the flash functions (like flash_print_info, for
example) can only be defined for one type of flash at a time.

There are two solutions I have thought of so far.  One of them is pick
whichever flash device is used the most and set that up normally.  For
the other flash, I could create different functions for it and in the
code that calls it I can make the necessary changes to call the right
functions.  I don't like this as much, because I'd have to put special
code various commands/ files to handle this.

The other option might be to create my own flash function wrappers
that call the appropriate flash function based on, for example, the
address passed into the function.

Has anyone else ran into this problem?  Perhaps that is another board
config that already deals with this?  I looked around, but there are a
lot of configs and I easily could have missed what I was looking for.

-- 
Zachary P. Landau <kapheine@gmail.com>

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

* [U-Boot-Users] Multiple Flash Devices
  2005-02-21 17:34 [U-Boot-Users] Multiple Flash Devices Zachary Landau
@ 2005-02-23  8:17 ` Shawn Jin
  2005-02-23 15:30   ` Zachary Landau
  2005-02-24 22:31 ` Wolfgang Denk
  1 sibling, 1 reply; 6+ messages in thread
From: Shawn Jin @ 2005-02-23  8:17 UTC (permalink / raw)
  To: u-boot

Zachary,

> Is there a good method of setting up two flash devices at once?  As
> far as I can tell, all the flash functions (like flash_print_info, for
> example) can only be defined for one type of flash at a time.

You can use the addresses to differentiate which flash device are
accessed. Keep the same interfaces uboot has already had and just
develop your own functions to do the actual jobs.

> There are two solutions I have thought of so far.  One of them is pick
> whichever flash device is used the most and set that up normally.  For
> the other flash, I could create different functions for it and in the
> code that calls it I can make the necessary changes to call the right
> functions.  I don't like this as much, because I'd have to put special
> code various commands/ files to handle this.

Nah, I wouldn't do that.

> The other option might be to create my own flash function wrappers
> that call the appropriate flash function based on, for example, the
> address passed into the function.

That's what I did before on a EP8245 board. This way shields all the
differences.

Good luck,
-Shawn.

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

* [U-Boot-Users] Multiple Flash Devices
  2005-02-23  8:17 ` Shawn Jin
@ 2005-02-23 15:30   ` Zachary Landau
  2005-02-24 22:33     ` Wolfgang Denk
  0 siblings, 1 reply; 6+ messages in thread
From: Zachary Landau @ 2005-02-23 15:30 UTC (permalink / raw)
  To: u-boot

> > Is there a good method of setting up two flash devices at once?  As
> > far as I can tell, all the flash functions (like flash_print_info, for
> > example) can only be defined for one type of flash at a time.
> 
> You can use the addresses to differentiate which flash device are
> accessed. Keep the same interfaces uboot has already had and just
> develop your own functions to do the actual jobs.
> 
> > The other option might be to create my own flash function wrappers
> > that call the appropriate flash function based on, for example, the
> > address passed into the function.
> 
> That's what I did before on a EP8245 board. This way shields all the
> differences.

Shawn,

In that case, did both flash devices use the same driver?  My two
flash devices use different drivers.  So what I am currently doing is
adding a prefix to the different flash driver functions (ie: change
CFI's write_buff to cfi_write_buff) and then adding function pointers
to each flash bank structure indicating which function to use.

This seems to be a decent approach.  The main problem is that the
flash calls are a bit scattered, and also it will require all flash
devices to be changed.  But I'll continue with it unless someone has a
better solution?

-- 
Zachary P. Landau <kapheine@gmail.com>

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

* [U-Boot-Users] Multiple Flash Devices
  2005-02-21 17:34 [U-Boot-Users] Multiple Flash Devices Zachary Landau
  2005-02-23  8:17 ` Shawn Jin
@ 2005-02-24 22:31 ` Wolfgang Denk
  2005-02-25  2:20   ` Zachary Landau
  1 sibling, 1 reply; 6+ messages in thread
From: Wolfgang Denk @ 2005-02-24 22:31 UTC (permalink / raw)
  To: u-boot

In message <a04f56da05022109345c7fb8fc@mail.gmail.com> you wrote:
> 
> I want to be able to access two (very different) flash devices.  I

Just do it, then.

> Is there a good method of setting up two flash devices at once?  As

Yes, U-Boot has always been capable of doing this. Your flash devices
will form spearate "banks" of flash memory. Thee  is  no  requirement
that  all  banks  must  be  identical.  In  fact,  several boards use
different flash types on different banks.

> far as I can tell, all the flash functions (like flash_print_info, for
> example) can only be defined for one type of flash at a time.

You are wrong.

> There are two solutions I have thought of so far.  One of them is pick
> whichever flash device is used the most and set that up normally.  For
> the other flash, I could create different functions for it and in the

This is not accetable, and not necessary.

> The other option might be to create my own flash function wrappers
> that call the appropriate flash function based on, for example, the
> address passed into the function.

You don't have to create any new interfaces. The existing code  which
provides  a  flash_info  struncture  per  bank  of  flash  memory  is
sufficient.

> Has anyone else ran into this problem?  Perhaps that is another board

It's not a problem. It's somthiong that is working  fine  on  several
boards.

> config that already deals with this?  I looked around, but there are a
> lot of configs and I easily could have missed what I was looking for.

See for example "board/cpu86/flash.c"

Best regards,

Wolfgang Denk

-- 
See us @ Embedded World, Nuremberg, Feb 22 - 24,  Hall 10.0 Booth 310
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Your csh still thinks true is false. Write to your vendor  today  and
tell them that next year Configure ought to "rm /bin/csh" unless they
fix  their blasted shell. :-)
                 - Larry Wall in Configure from the perl distribution

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

* [U-Boot-Users] Multiple Flash Devices
  2005-02-23 15:30   ` Zachary Landau
@ 2005-02-24 22:33     ` Wolfgang Denk
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Denk @ 2005-02-24 22:33 UTC (permalink / raw)
  To: u-boot

In message <a04f56da050223073036aa7551@mail.gmail.com>
Zachary Landau wrote:
> 
> In that case, did both flash devices use the same driver?  My two

There is always only one flash driver.

> flash devices use different drivers.  So what I am currently doing is
> adding a prefix to the different flash driver functions (ie: change
> CFI's write_buff to cfi_write_buff) and then adding function pointers
> to each flash bank structure indicating which function to use.

Why do you think this is necessary?

> This seems to be a decent approach.  The main problem is that the
> flash calls are a bit scattered, and also it will require all flash
> devices to be changed.  But I'll continue with it unless someone has a

Such a change will never be accepted for the common source tree.

Best regards,

Wolfgang Denk

-- 
See us @ Embedded World, Nuremberg, Feb 22 - 24,  Hall 10.0 Booth 310
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Clothes make the man. Naked people have little  or  no  influence  on
society.                                                 - Mark Twain

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

* [U-Boot-Users] Multiple Flash Devices
  2005-02-24 22:31 ` Wolfgang Denk
@ 2005-02-25  2:20   ` Zachary Landau
  0 siblings, 0 replies; 6+ messages in thread
From: Zachary Landau @ 2005-02-25  2:20 UTC (permalink / raw)
  To: u-boot

> > config that already deals with this?  I looked around, but there are a
> > lot of configs and I easily could have missed what I was looking for.
> 
> See for example "board/cpu86/flash.c"

The difference in my case is that I would like to make use of the
drivers already included with u-boot for one of the flash devices.  In
my case, the external flash uses the CFI driver.  I then wrote another
flash driver to access the internal flash.

In the cpu86 example, they wrote drivers for both flash devices.  I
could do that, if necessary, but it seems better to reuse as much of
the existing code as possible.

-- 
Zachary P. Landau <kapheine@gmail.com>

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

end of thread, other threads:[~2005-02-25  2:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-21 17:34 [U-Boot-Users] Multiple Flash Devices Zachary Landau
2005-02-23  8:17 ` Shawn Jin
2005-02-23 15:30   ` Zachary Landau
2005-02-24 22:33     ` Wolfgang Denk
2005-02-24 22:31 ` Wolfgang Denk
2005-02-25  2:20   ` Zachary Landau

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