Commit Graph

114 Commits

Author SHA1 Message Date
Antonio Borneo
f49283a062 NAND/ORION: remove private "target" copy
Remove "target" form private data, and use
common one in struct nand_block.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2011-01-02 19:58:40 +01:00
Antonio Borneo
5e27647e22 NAND/NUC910: remove private "target" copy
Remove "target" form private data, and use
common one in struct nand_block.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2011-01-02 19:58:26 +01:00
Antonio Borneo
457556b146 NAND/MX3: remove private "target" copy
Remove "target" form private data, and use
common one in struct nand_block.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2011-01-02 19:58:19 +01:00
Antonio Borneo
b7b9ad755e NAND/MX2: remove private "target" copy
Remove "target" form private data, and use
common one in struct nand_block.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2011-01-02 19:57:58 +01:00
Antonio Borneo
35c30e9ee7 NAND/LPC3180: remove private "target" copy
Remove "target" form private data, and use
common one in struct nand_block.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2011-01-02 19:57:45 +01:00
Antonio Borneo
3db34f8447 NAND/DAVINCI: remove private "target" copy
Remove "target" form private data, and use
common one in struct nand_block.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2011-01-02 19:57:30 +01:00
Antonio Borneo
2e1f2b50fd NAND/AT91SAM9: remove private "target" copy
Remove "target" form private data, and use
common one in struct nand_block.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2011-01-02 19:57:15 +01:00
Antonio Borneo
5f3603b8ef NAND/TCL: prepare for common "target" reference
Every NAND driver keeps private copy of "target"
structure.
Prepare infostructure to move private "target"
copy in common/shared struct nand_device.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2011-01-02 19:56:59 +01:00
Antonio Borneo
21a1c6ec33 NAND/TCL: fix segfault on syntax error
Fix segfault if incomplete command "nand device dummy"
is executed.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2011-01-02 19:54:20 +01:00
Antonio Borneo
7bb79f0f51 NAND/CORE: Comment use of alive_sleep()
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2011-01-02 19:53:55 +01:00
Antonio Borneo
52044a17ce NAND/CORE: Replace decimal dot in messages
Table of NAND devices reports operating voltage.
Replace comma with proper decimal dot.

Øyvind: "." is correct for UK/US, but incorrect for
many other languages. OpenOCD is not localized at this
point, so sticking to "." for US/UK should be OK.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-01-02 19:52:53 +01:00
Antonio Borneo
b0759dfc53 flash/nand: review NAND driver interface
From struct nand_flash_controller :
- remove unused field register_commands;
- remove field controller_ready, exported but
  never referenced.
Remove dead code pointed by controller_ready.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2011-01-02 19:49:36 +01:00
Øyvind Harboe
4f9a9b8eba warnings: use more 'const' for char *
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-12-29 22:07:39 +01:00
Paul Richards
5787853bc1 Fix for segfault in handle_nand_dump_command. 2010-12-15 14:14:02 +01:00
Spencer Oliver
838cd58e24 build: add common.mk
Rather than specifying common makefile variables move
them all to a common.mk.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-11-18 14:05:56 +00:00
Øyvind Harboe
3931b99d14 fileio: fileio_size() can now fail
Part of making the fileio API more robust.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-29 18:56:07 +02:00
Øyvind Harboe
3a693ef526 fileio: refactor struct fileio to be an opaque structure
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-29 08:43:27 +02:00
Øyvind Harboe
22911a3aed flash: fix error handling
sensible error must be reported at failure site

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-21 22:17:38 +02:00
Øyvind Harboe
f6a3fc818b warnings: fix alignment warnings
These warnings are for architectures that do not
support non-aligned word access.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-20 13:12:35 +02:00
Spencer Oliver
4611f87f0a flash: add nuc910 nand driver
This adds a nand driver support for the nuc910 target.
Note that ECC is not currently supported by this driver, although
it is supported by the peripheral.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-07-19 12:22:18 +01:00
Spencer Oliver
0345667642 nand: nand probe also outputs manufacturer
The nand probe now outputs the manufacturer if found.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-07-19 09:10:55 +01:00
Antonio Borneo
f747b16e4e nand/mx2: review scope of symbols
Add "static" qualifier to private variable.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-06-21 22:14:24 +08:00
Øyvind Harboe
94f373b404 arm_io: -Wshadow warning fix
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-16 07:41:43 +02:00
Øyvind Harboe
6de2b2d14b nand: when verify failed, it didn't return an error
when the verify failed, it didn't return an error,
which breaks e.g. tcl scripts that rely on this for
exceptions to work.

Found by -Wshadow

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-16 07:39:46 +02:00
Øyvind Harboe
3e51d893ed -Wshadow fixes
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-14 22:12:04 +02:00
gcembed
f40faeb349 nand : Add Freescale iMX27 nand flash controller support
This patch add support of iMX27 nand flash controller. This is based on
driver for imx31 nand flash controller.
OOB functionality is not fully working. As in mx31 controller, mx2 NFC
has a bug that swap two bytes between SPARE and MAIN buffer.
I used this driver for several months and no problems appear.
2010-05-20 08:28:36 +02:00
Jon Povey
dc464ad88e NAND/davinci: Fix segfault for hwecc4_infix reads
Page reads using hwecc4_infix layout segfaulted for check_bad_blocks because
the read assumed a valid data buffer, which check_bad_blocks does not use
(it only passes a 6 byte buffer for the start of OOB).

This version copes with undersized or missing data or oob buffers and uses
random read commands within the page to skip unwanted areas of data/OOB for
speed.

NOTE: Running check_bad_blocks with this layout will be reading infix
OOB locations, not manufacturer bad block markers. This means that if you
check blocks written in infix layout they will appear good, but manufacturer-
marked bad blocks may also appear good.
If you want to scan for manufactuer-marked bad blocks, you need to enable
raw_access before running check_bad_blocks, or use the non-infix layout.

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
CC: David Brownell <dbrownell@users.sourceforge.net>
2010-05-18 09:25:03 +02:00
Jon Povey
fafed75d98 NAND: catch read errors when building BBT
nand_build_bbt() was ignoring the return value from nand_read_page() and
blindly continuing.
It now passes the return value up to the caller if the read fails.

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
2010-05-18 09:23:48 +02:00
Jon Povey
5fd1c2db9a Change kb/s to KiB/s in messages about kibibytes
Change download rate messages about kibibytes from "kb/s" to "KiB/s" units.
See: http://en.wikipedia.org/wiki/Data_rate_units

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
2010-05-16 13:55:01 +02:00
Jon Povey
dcca0b7694 NAND: fix first and last handling in nand_build_bbt
Last block was being skipped, fix by changing the loop test from "<" to "<="

First block argument was ignored, always started from block 0 (and counted
the wrong blocks as bad if first was nonzero). Now we use it.

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-05-14 13:23:01 +02:00
Jon Povey
0eb7fb59a0 NAND: fix off-by-one error in erase command argument range
The last_block argument to nand_erase() is checked against nand->num_blocks,
but the highest valid block number is (total - 1), the test for invalid should
be ">=" rather than ">".

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-05-14 13:22:59 +02:00
Antonio Borneo
c936cb334b NAND/TCL: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 21:50:15 +08:00
Antonio Borneo
a6307fed91 NAND/ARM_IO: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 20:09:59 +08:00
Antonio Borneo
617811ac66 NAND/CORE: review scope of functions
Add "static" qualifier to private functions.
Move function's comment from core.h to core.c.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 20:08:41 +08:00
Antonio Borneo
aaf848596c NAND/MX3: review scope of data
Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 20:03:19 +08:00
Daniel Bäder
010492a1ed change %x and %d to PRIx32 and PRId32 where needed for cygwin 2010-03-25 12:45:32 +01:00
richard vegh
ab5f98edcd lpc3180: LPC3180(LPC3250) SLC driver implemented
Until this time only basic  SLC functionality exists when you want to use SLC to access external nand flash.
Basic functionality can be selected with command:
     lpc3180 select 0 slc
It is anyway very slow to write/read to/from nand flash.

With the new command, SLC speed improved about 20 times, and hardware ECC info also read/written from/to nand flash OOB area:
     lpc3180 select 0 slc bulk
Speed improvement achieved by using working are in SRAM of the LPC3250 chip and controlling DMA controller to interact between SRAM and SLC peripheral.

Here are the patches, and if they are ok than take them.
Tested with hitex LPC3250 usb stick.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-16 10:46:41 +01:00
richard vegh
daa1ff3535 NAND: lpc3180 crashes on LPC3250
The LPC3180 NAND driver was crashing on some large page chips.
Fix:

 - Crash and related functionality (don't memset too much OOB data)
 - Some debug messages
 - Command handling now works

[dbrownell@users.sourceforge.net: whitespace/linelength/message cleanup]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-16 12:27:45 -08:00
Peter Korsgaard
000a1cfd01 nand flash support for s3c64xx
Identical to the existing 2412/2443 support except for the base address
and NFCONF value (bit 2 is reserved and should be written as 1 ref UM).

Tested on a s3c6410 board, but controller is identical in 6400/6410
except for 8bit MLC ECC support in 6410 which isn't supported by the
driver.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-01-14 21:07:46 +01:00
David Brownell
2a76c1bcf9 NAND: help/usage/doc updates
Usage messages should use the same EBNF as the User's Guide;
no angle brackets.  Be more complete too ... some params were
missing.  Improve and correct various helptexts.

Make user's guide refer to the NAND "driver" name, not the
controller name; that's a bit more precise.

Don't use "&function"; its name is its address.  Line up struct
initializers properly.  Remove some blank lines.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-08 23:18:46 -08:00
Freddie Chopin
6b1eeb92fe MinGW build fixes
Print "ssize_t" as "%ld" (+ cast to long) not as "%zu".
Official MinGW (gcc 3.4.5) doesn't understand "z" flag.

Signed-off-by: Freddie Chopin <freddie_chopin@op.pl>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-28 13:09:31 -08:00
David Brownell
07c06ec5e2 Packaging fix, NEWS update
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-21 12:50:17 -08:00
David Brownell
b72bfabf0d cygwin build fixes
and shrink some too-long lines

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-19 15:43:55 -08:00
Dean Glazeski
3ac2a44041 AT91SAM9 NAND flash driver.
This creates the TCL interface for configuring an AT91SAM9 NAND flash
controller and implements the necessary functions to correctly work with
a NAND flash device connected to the chip.  This includes updates to the
driver list and the Makefile.am to support building the driver and also
houses the documentation update in openocd.texi.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-19 13:26:33 -08:00
Dean Glazeski
ef4fbd36d4 NAND write data page refactoring.
Refactored the write page raw function into two new functions
for writing data to a NAND device and then another function to
finish up a write to a NAND device.  This includes some new
updates to introduce more error checking to existing code.

[dbrownell@users.sourceforge.net: fix fault handling, whitespace]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-18 01:33:19 -08:00
Dean Glazeski
b8b4bb0745 NAND read data page refactor.
Added a new function to encapsulate reading a page of data from
a NAND device using either the read_block_data function of a NAND
controller or to use direct reading of data from the NAND device.

This also adds some performance enhancements and uses the read_data
function if the read_block_data function fails safely (because it
can't allocate a buffer in the working area).

[dbrownell@users.sourceforge.net: fix fault handling, whitespace]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-18 01:33:19 -08:00
Zachary T Welch
75892bfc6e add missing call to add new NAND devices
I forgot to add a call to the newly factored nand_device_add(), along
with its forward declaration.
2009-12-11 18:45:34 -08:00
David Brownell
910dd664ce Comment and doxygen fixes
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-09 10:25:52 -08:00
Øyvind Harboe
eb1bc657ae build: add build/src to include path
This allows including generated include files.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-12-08 10:16:10 +01:00
David Brownell
0a1b7dcfc4 ARM: use <target/arm.h> not armv4_5.h
Move most declarations in <target/armv4_5.h> to <target/arm.h>
and update users.

What's left in the older file is stuff that I think should be
removed ... the old register cache access stuff, which makes it
awkward to support microcontroller profile (Cortex-M) cores.

The armv4_5_run_algorithm() declaration was moved too, even
though it's not yet as generic as it probably ought to be.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-07 14:57:44 -08:00
Zachary T Welch
899c9975e7 rename nand.h to flash//nand/core.h
Rename nand.h as flash/nand/core.h, chase consumers.  The public APIs
need to be sorted out with imp.h, but this allows other changes to
begin improving the separation between policy and mechanism.

Moves #include <target/target.h> and #include "driver.h" into the
internal headers or source files, removing it from <flash/nand/core.h>.
2009-12-04 22:26:25 -08:00
Zachary T Welch
da3bcb392e move remaining nand helper files
Move remaining NAND implementation files into src/flash/nand/.
2009-12-04 21:47:47 -08:00
Zachary T Welch
747d6f2286 split nand.c into nand/{core,fileio,tcl}.c
Moves commands into nand/tcl.c and core implementation to 'nand/core.c'
and 'nand/fileio.c'.  Eliminates 'flash/nand.c'.

Adds 'nand/imp.h' to share routines between TCL commands and core.
2009-12-04 21:41:23 -08:00
Zachary T Welch
a7fd30c07f split NAND driver handling into nand/driver.[ch]
This work parallels the NOR directory, encapsulating the NAND drivers
into a separate file.  This takes an extra step by encapsulating the
type of data structure used to manage the drivers, allowing it to be
changed from an array to a dynamic list in the future.
2009-12-04 21:41:23 -08:00
Dean Glazeski
66985bb306 ARM NAND I/O interface update
Modify the arm_nand_data struct to better support both read and
write operations while using the same struct.  An additional
field was added, and initialized, to record the last operation
so that the correct code can be loaded to the working area.

[dbrownell@users.sourceforge.net: merge init patch, tweak GPL note]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-03 17:29:41 -08:00
Zachary T Welch
822c06d9e3 remove tertiary include paths
With all #include directives converted, we only need to have the
top-level src/ directory in the search path.
2009-12-03 04:24:50 -08:00
Zachary T Welch
f7bd1e8f3a change #include "../hello.h" to "hello.h"
Before we can -I the top-level src/ directory alone, references to
"hello.h" must be updated.  This is an internal header, so it does
not need angle brackets.
2009-12-03 04:24:50 -08:00
Zachary T Welch
2a402ae2c7 change #include "s3c24xx_regs.h" to <flash/nand/s3c24xx_regs.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "s3c24xx_regs.h"

the following form should be used.

	#include <flash/nand/s3c24xx_regs.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:49 -08:00
Zachary T Welch
450ceda9ae change #include "nand.h" to <flash/nand.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "nand.h"

the following form should be used.

	#include <flash/nand.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:42 -08:00
Zachary T Welch
eac262e5d2 change #include "arm_nandio.h" to <flash/arm_nandio.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "arm_nandio.h"

the following form should be used.

	#include <flash/arm_nandio.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:42 -08:00
Zachary T Welch
ddea033043 change #include "armv4_5.h" to <target/armv4_5.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "armv4_5.h"

the following form should be used.

	#include <target/armv4_5.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
5d57cad001 normalize headers to make changing easier
These headers need minor tweaks to paves the way for wholesale
scripted coversion of the header files.
2009-12-03 04:20:31 -08:00
Zachary T Welch
896ac8d4ef allow #include directives to use module name
Includes the src directory in the search path, so header files may be
migrated from:

  #include "foo.h"

to
  #include <module/foo.h>

which is more conducive for installation.
2009-12-03 01:54:15 -08:00
Zachary T Welch
e1ec02bb05 move nand drivers to src/flash/nand/
Moves NAND drivers to src/flash/nand/.
Adds src/flash/nand/Makefile.am.
Builds libocdflashnand.la.
2009-12-02 23:27:09 -08:00