public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] Atmel DataFlash hooks.
@ 2007-01-26 16:45 Peter.Pearse
  2007-01-26 19:11 ` Grant Likely
  0 siblings, 1 reply; 78+ messages in thread
From: Peter.Pearse @ 2007-01-26 16:45 UTC (permalink / raw)
  To: u-boot

As I said to Grant

> 	But I just found the original thread for the inclusion of this code
> (http://blog.gmane.org/gmane.comp.boot-loaders.u-boot)

Search for

 [PATCH] DataFlash for AT91RM9200DK board

Especially:-

<snip>
> 
> In this case I think we should offer an interface which looks 
>  to the user like mmeory.
<snip>

> Best regards,
> 
> Wolfgang Denk

Peter

^ permalink raw reply	[flat|nested] 78+ messages in thread
* [U-Boot-Users] Atmel DataFlash hooks.
@ 2007-01-26  8:44 Grant Likely
  2007-01-26  9:42 ` Peter.Pearse
                   ` (2 more replies)
  0 siblings, 3 replies; 78+ messages in thread
From: Grant Likely @ 2007-01-26  8:44 UTC (permalink / raw)
  To: u-boot

There is a mountain of stuff that should probably be reworked in
u-boot (notably the maze of #ifdefs), but all I've got is a small
spade.  So, I'll just pick things off as I come across them...

Issue: CONFIG_HAS_DATAFLASH hooks are invasive
Background: Atmel DataFlash is a serial FLASH device with an SPI
interface.  There is code in u-boot that pretends that it is
bus-addressable.

For all but a handful of boards, the commands in cmd_bootm.c,
cmd_flash.c and cmd_mem.c (md, mm, cp, bootm, etc) interface with bus
addressable memories.  However, when CONFIG_HAS_DATAFLASH is defined,
extra code is enabled to make it appear that SPI DataFlash is bus
addressable to those commands.

IMHO, pretending that a serial flash device occupies a range of bus
addresses is a bad precedence and a "Really Bad Idea".  It means that
every command that manipulates memory needs to have special hooks to
be aware of DataFlash.  The way the current hooks are implemented are
ugly and dangerous.  (search for CONFIG_HAS_DATAFLASH to see the
hooks).  Dangerous because code indentation is messed up which makes
the code flow hard to follow, and also it invites a great mess if
other non-bus-addressable memories are added in the same way.

The current hooks should be removed and the DataFlash support should
be reworked so it no longer pretends to be bus addressable memories.
This leaves the question, "then how should it be accessed?".  There
are other non-bus-addressable memories out there which have the same
problem.  For example, i2c eeproms, USB storage, CF, SCSI & IDE
drivers.  Currently USB storage, IDE, SCSI and MMC share the block
device infrastructure used by the filesystem drivers.  However it is
read-only at the moment (but I've got some patches to fix that).

Possible solutions:
1. Move DataFlash support over to the block device infrastructure and
add commands for direct manipulation of block devices.  This assumes
that it makes sense to look at a DataFlash device as just like any
other block device.
2. Create a new set of commands specifically for manipulating dataflash
3. Create an abstraction layer for accessing both bus addressable and
non bus addressable memories.  Add a naming convention for commands to
specify non-bus-addressable devices.  ie. "cp.b 00004000 DF:0000 100"
would copy 0x100 bytes from bus address 0x4000 to dataflash 0x0000.
(but I really don't think this is the route to go; far to complex.  I
don't think it is unreasonable to require a separate command to copy
to/from off-bus memories before comparing, booting, etc.)

and for completeness:
3. SImply remove the current hooks and leave DataFlash support out of mainline.
4. Grant is on drugs, do nothing.

Comments?  If I don't here anything, then I'll go ahead an generate a
patch to pull out the DataFlash hooks.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely at secretlab.ca
(403) 399-0195

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

end of thread, other threads:[~2007-02-01 12:40 UTC | newest]

Thread overview: 78+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-26 16:45 [U-Boot-Users] Atmel DataFlash hooks Peter.Pearse
2007-01-26 19:11 ` Grant Likely
2007-01-26 21:25   ` Wolfgang Denk
2007-01-26 22:34     ` Grant Likely
2007-01-27  0:42       ` Wolfgang Denk
2007-01-27  1:52         ` Grant Likely
2007-01-27  4:11           ` [U-Boot-Users] Arm-linux-gcc malloc get failure while arm-elf-gcc ok Rui.Zhou at nokia.com
2007-01-27 11:46             ` Rui.Zhou at nokia.com
2007-01-27 13:34           ` [U-Boot-Users] Atmel DataFlash hooks Andreas Schweigstill
2007-01-27 16:36             ` Wolfgang Denk
2007-01-27 17:04               ` Andreas Schweigstill
2007-01-27 17:17                 ` Ulf Samuelsson
2007-01-28 14:39                 ` Wolfgang Denk
2007-01-29  1:32                   ` Andreas Schweigstill
2007-01-29 12:52                     ` Wolfgang Denk
2007-01-27 22:19     ` Grant Likely
2007-01-28  1:47       ` J. William Campbell
2007-01-28 15:17         ` Wolfgang Denk
2007-01-28 22:21           ` J. William Campbell
2007-01-28 22:50             ` Wolfgang Denk
2007-01-29  2:50               ` Grant Likely
2007-01-29 13:07                 ` Wolfgang Denk
2007-01-29 21:06                   ` Haavard Skinnemoen
2007-01-29 22:57                     ` Ulf Samuelsson
2007-01-29 23:55                       ` Wolfgang Denk
2007-01-30  0:28                       ` Haavard Skinnemoen
2007-01-30  1:03                         ` Wolfgang Denk
2007-01-30  1:16                           ` Haavard Skinnemoen
2007-01-30 22:23                             ` Wolfgang Denk
2007-01-30  6:52                         ` Ulf Samuelsson
2007-01-31  7:44                     ` Tolunay Orkun
2007-01-29  3:17               ` J. William Campbell
2007-01-29  7:35                 ` Ulf Samuelsson
2007-01-29 13:36                   ` Wolfgang Denk
2007-01-29 13:29                 ` Wolfgang Denk
2007-01-29 20:45                   ` J. William Campbell
2007-01-29 21:48                     ` Wolfgang Denk
2007-01-29 23:03                       ` J. William Campbell
2007-01-30  0:01                         ` Wolfgang Denk
2007-01-29 23:08                   ` Ulf Samuelsson
2007-01-30  0:48                     ` J. William Campbell
2007-01-30  1:06                       ` Wolfgang Denk
2007-01-30  6:55                       ` Ulf Samuelsson
2007-01-31 17:11                   ` Grant Likely
2007-01-31 17:37                     ` Ulf Samuelsson
2007-01-31 21:55                       ` Wolfgang Denk
2007-01-31 23:13                         ` Ulf Samuelsson
2007-01-31 23:50                           ` Grant Likely
2007-02-01  0:06                           ` Wolfgang Denk
2007-02-01  2:46                             ` Tolunay Orkun
2007-01-29 11:10               ` Stefan Roese
2007-01-29  2:27         ` Grant Likely
2007-01-28 15:01       ` Wolfgang Denk
2007-01-29  2:33         ` Grant Likely
2007-01-29  7:49           ` Ulf Samuelsson
2007-01-29 13:38             ` Wolfgang Denk
     [not found]             ` <528646bc0701310848x4c63cf53gd228f860c0fd0444@mail.gmail.com>
2007-01-31 16:50               ` Grant Likely
2007-02-01 12:40             ` Andreas Schweigstill
2007-01-29 12:56           ` Wolfgang Denk
2007-01-29 10:43     ` Stefan Roese
  -- strict thread matches above, loose matches on Subject: below --
2007-01-26  8:44 Grant Likely
2007-01-26  9:42 ` Peter.Pearse
2007-01-26 13:53 ` Wolfgang Denk
2007-01-26 19:24   ` Grant Likely
2007-01-26 21:27     ` Wolfgang Denk
2007-01-26 22:35       ` Grant Likely
     [not found] ` <000001c7416f$fa61fed0$01c4af0a@atmel.com>
2007-01-26 19:02   ` Grant Likely
     [not found]     ` <02eb01c74180$c4911410$01c4af0a@atmel.com>
2007-01-26 20:27       ` Grant Likely
2007-01-26 21:21         ` Ulf Samuelsson
2007-01-26 22:40           ` Grant Likely
2007-01-26 23:01             ` Ulf Samuelsson
2007-01-26 23:46               ` Grant Likely
2007-01-27  9:44                 ` Ulf Samuelsson
2007-01-29 10:49               ` Stefan Roese
2007-01-29 13:44         ` Peter.Pearse
2007-01-29 14:47           ` Stefan Roese
2007-01-29 16:03             ` Wolfgang Denk
2007-01-29 10:33     ` Stefan Roese

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