Commit Graph

198 Commits

Author SHA1 Message Date
Stefan Roese
d558107c18 mtd: Introduce CONFIG_MTD_DEVICE to select compilation of mtdcore.o
This new define enables mtdcore.c compilation and with this we can
select the MTD device infrastructure needed for the reworked mtdparts
command.

We now have the 2 MTD infrastructure defines, CONFIG_MTD_DEVICE and
CONFIG_MTD_PARTITIONS. CONFIG_MTD_DEVICE is needed (as explained above)
for the "mtdparts" command and CONFIG_MTD_PARTITIONS is needed for UBI.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Scott Wood <scottwood@freescale.com>
2009-06-12 20:45:47 +02:00
Stefan Roese
8d2effea23 mtd: Update MTD infrastructure to support 64bit device size
This patch brings the U-Boot MTD infrastructure in sync with the current
Linux MTD version (2.6.30-rc3). Biggest change is the 64bit device size
support and a resync of the mtdpart.c file which has seen multiple fixes
meanwhile.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Kyungmin Park <kmpark@infradead.org>
2009-06-12 20:45:47 +02:00
Stefan Roese
0a57265533 mtd: Add MTD concat support to concatenate multiple MTD NOR devices
This patch adds concatenation support to the U-Boot MTD infrastructure.
By enabling CONFIG_MTD_CONCAT this MTD CFI wrapper will concatenate
all found NOR devices into one single MTD device. This can be used by
e.g by UBI to access a partition that spans over multiple NOR chips.

Signed-off-by: Stefan Roese <sr@denx.de>
2009-06-12 20:45:47 +02:00
Wolfgang Denk
dfcd7f2160 Redundant Environment: protect full sector size
Several boards used different ways to specify the size of the
protected area when enabling flash write protection for the sectors
holding the environment variables: some used CONFIG_ENV_SIZE and
CONFIG_ENV_SIZE_REDUND, some used CONFIG_ENV_SECT_SIZE, and some even
a mix of both for the "normal" and the "redundant" areas.

Normally, this makes no difference at all. However, things are
different when you have to deal with boards that can come with
different types of flash chips, which may have different sector
sizes.

Here we may have to chose CONFIG_ENV_SECT_SIZE such that it fits the
biggest sector size, which may include several sectors on boards using
the smaller sector flash types. In such a case, using CONFIG_ENV_SIZE
or CONFIG_ENV_SIZE_REDUND to enable the protection may lead to the
case that only the first of these sectors get protected, while the
following ones aren't.

This is no real problem, but it can be confusing for the user -
especially on boards that use CONFIG_ENV_SECT_SIZE to protect the
"normal" areas, while using CONFIG_ENV_SIZE_REDUND for the
"redundant" area.

To avoid such inconsistencies, I changed all sucn boards that I found
to consistently use CONFIG_ENV_SECT_SIZE for protection. This should
not cause any functional changes to the code.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Paul Ruhland
Cc: Pantelis Antoniou <panto@intracom.gr>
Cc: Stefan Roese <sr@denx.de>
Cc: Gary Jennejohn <garyj@denx.de>
Cc: Dave Ellis <DGE@sixnetio.com>
Acked-by: Stefan Roese <sr@denx.de>
2009-06-04 00:16:16 +02:00
Stefan Roese
dba6fcf651 cfi_mtd: Fix bug in last sector detection
This patch now enabled this cfi-mtd wrapper to correctly detect and
erase the last sector in an NOR FLASH device.

Signed-off-by: Stefan Roese <sr@denx.de>
2009-06-03 23:45:27 +02:00
Stefan Roese
f40f6db278 nand: Fix problem with ECC ordering for PPC4xx NDFC platforms
This patch enables Smart Media (SMC) ECC byte ordering which is used
on the PPC4xx NAND FLASH controller (NDFC). Without this patch we have
incompatible ECC byte ordering to the Linux kernel NDFC driver.

Signed-off-by: Stefan Roese <sr@denx.de>
Acked-by: Scott Wood <scottwood@freescale.com>
2009-05-23 12:51:39 +02:00
Stefan Roese
f8e2b3107e MTD: Change cfi-mtd to accept non-uniform sector sizes
With this patch non-uniform NOR FLASH chips (chips with multiple erase
regions) can be exported via the cfi-mtd layer and therefor used by UBI.
We select the largest sector size as erasesize. The cfi driver will make
sure that the smaller sectors are handled correctly.

Signed-off-by: Stefan Roese <sr@denx.de>
2009-04-29 11:06:06 +02:00
Stefan Roese
dbe29e36a4 mtd: nand/onenand: Register mtd device upon device scanning
With this patch the NAND and OneNAND devices are registered in the MTD
subsystem and can then be referenced by the mtdcore code (e.g.
get_mtd_device_nm()). This is needed for the new "ubi part" command
syntax without the flash type parameter (nor|nand|onenand).

Signed-off-by: Stefan Roese <sr@denx.de>
2009-04-28 01:15:38 +02:00
Stefan Roese
10bb62d85a mtd: nand: Include linux/mtd/partitions.h in nand_base.h
This patch removes this compilation warning when CONFIG_MTD_PARTITIONS is
defined:

nand_base.c: In function 'nand_release':
nand_base.c:2922: warning: implicit declaration of function 'del_mtd_partitions'

Signed-off-by: Stefan Roese <sr@denx.de>
2009-04-28 01:15:37 +02:00
David Brownell
7732cef2ee CMD_UBI != MTD_PARTITIONS
Fix dependency goofage:  it should certainly be possible to have the
partition support without bringing in UBI commands.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Stefan Roese <sr@denx.de>
2009-04-16 23:03:27 +02:00
Graf Yang
a343ba87ea Blackfin: nand: flush peripheral before polling it
We need to make sure the data written to the nand flash controller makes
it there before we start polling its status register.  Otherwise, we may
get stale data and return before the controller is actually ready.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Scott Wood <scottwood@freescale.com>
2009-04-06 17:37:37 -04:00
Andreas Huber
c203ef5db0 UBI/cfi-mtd: Fix mtd name for multiple chips
On platforms with multiple NOR chips, currently only the first one
can be selected using the "ubi part" command. This patch fixes this
problem by using different names for the NOR "mtd devices".

It also changes the name of the NOR MTD device from "cfi-mtd" to
"norX" (X indexing the device numer) to better match the mtdparts
defaults.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Andreas Huber <andreas.huber@keymile.com>
2009-04-04 23:25:40 +02:00
Ulf Samuelsson
cb82a53266 Add support for the AT91RM9200EK Board.
The AT91RM9200-EK Evaluation Board supports the AT91RM9200
ARM9-based 32-bit RISC microcontroller and enables real-time code development
and evaluation.

Here is the chip page on Atmel website:
http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3507

with
	- NOR (cfi driver)
	- DataFlash
	- USB OHCI
	- Net
	- I2C (hard)

Signed-off-by: Ulf Samuelsson <ulf@atmel.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2009-04-04 20:42:20 +02:00
Wolfgang Denk
8ddfe804c4 Merge branch 'master' of git://git.denx.de/u-boot-nand-flash 2009-04-03 22:48:05 +02:00
Scott Wood
99067b08f4 Noisily disable the legacy NAND subsystem.
Legacy NAND is marked for feature removal after April 2009 (i.e. this
upcoming release).  There are still several boards that reference it
(though many do so only for disk-on-chip support which has been silently
disabled for a while now).  These boards will now fail to build
with #error, though the code is still there if the user removes #error.

The plan is to remove the code outright in the next release, along with
any board code that refers to it (such as board/esd/common/auto_update.c).

Also, remove the legacy NAND API description from README.nand.

Signed-off-by: Scott Wood <scottwood@freescale.com>
2009-04-03 15:27:26 -05:00
Mike Frysinger
d9596ffbdc sf: stmicro: dont send 4 bytes when reading status register
I can't find anywhere in the datasheet that says the status register needs
3 dummy bytes sent to it before being able to read back the first real
result.  Tests on a Blackfin board show that after writing the opcode, the
status register starts coming back immediately.  So only write out the
read status register opcode before polling the result.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
CC: Jason McMullan <mcmullan@netapp.com>
CC: TsiChung Liew <Tsi-Chung.Liew@freescale.com>
2009-04-02 12:51:28 -04:00
Mike Frysinger
1abe365ffc sf: set common timeouts in seconds, not milliseconds
Since timeouts are only hit when there is a problem in the system, we
don't want to prematurely timeout on a functioning setup.  Thus having
low timeouts (in milliseconds) doesn't gain us anything in the production
case, but rather increases likely hood of causing problems where none
otherwise exist.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
CC: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
2009-04-02 08:11:31 -04:00
Mike Frysinger
2a6ce1115b sf: stmicro: use common page timeout define
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
CC: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
2009-04-02 06:51:55 -04:00
Mike Frysinger
0dcdbb172c sf: always read 5 bytes for the idcode
Some SPI flash drivers like to have extended id information available
(like the spansion flash), so rather than making it re-issue the ID cmd
to get at the last 2 bytes, have the common code read 5 bytes rather than
just 3.  This also matches the Linux behavior where it always reads 5 id
bytes from all flashes.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
CC: Mingkai Hu <Mingkai.hu@freescale.com>
2009-04-02 06:50:21 -04:00
Mike Frysinger
9726ba4aba sf: stmicro: drop redundant id read
The common SPI flash code reads the idcode and passes it down to the SPI
flash driver, so there is no need to read it again ourselves.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
CC: Jason McMullan <mcmullan@netapp.com>
CC: TsiChung Liew <Tsi-Chung.Liew@freescale.com>
2009-04-02 06:50:17 -04:00
Mike Frysinger
1c5874374e sf: add driver for SST flashes
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
2009-04-02 06:49:58 -04:00
Mike Frysinger
f773a1bbdb sf: drop DEBUG defines
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
2009-04-02 06:49:49 -04:00
Jean-Christophe PLAGNIOL-VILLARD
6b850a9fa8 mtd: add some at45 spi flash support
- AT45DB321D
 - AT45DB161D
 - AT45DB081D
 - AT45DB041D
 - AT45DB021D
 - AT45DB011D

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-04-02 06:49:38 -04:00
Mingkai Hu
6805e4bf83 mtd: SPI Flash: Support the Spansion Flash
Add MTD SPI Flash support for S25FL008A, S25FL016A,
S25FL032A, S25FL064A, S25FL128P.

Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-04-02 06:49:30 -04:00
Jean-Christophe PLAGNIOL-VILLARD
b3f66b0ba0 s3c2410: move nand driver to drivers/mtd/nand
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2009-03-30 18:58:40 +02:00
Jean-Christophe PLAGNIOL-VILLARD
ee4f3e2765 davinci: move nand driver to drivers/mtd/nand
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2009-03-30 18:58:39 +02:00
Wolfgang Denk
aaa0e0812f Merge branch 'master' of git://git.denx.de/u-boot-at91 2009-03-26 22:27:45 +01:00
Wolfgang Grandegger
33846df28f Add wait flags to support board/chip specific delays
The NAND flash on the TQM8548_BE modules requires a short delay after
running the UPM pattern like the MPC8360ERDK board does. The TQM8548_BE
requires a further short delay after writing out a buffer. Normally the
R/B pin should be checked, but it's not connected on the TQM8548_BE.
The corresponding Linux FSL UPM driver uses similar delay points at the
same locations. To manage these extra delays in a more general way, I
introduced the "wait_flags" field allowing the board-specific driver to
specify various types of extra delay.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
2009-03-23 15:53:40 -05:00
Wolfgang Grandegger
06e9f7df05 Add support for TQM-specific chip select logic to FSL-UPM
For the NAND chips on the TQM8548 modules, a special chip-select logic is
used. It uses dedicated address lines to be set via UPM machine address
register (mar). This patch adds such support to the FSL-UPM driver.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
2009-03-23 15:53:39 -05:00
Wolfgang Grandegger
e93c1c169d Add multi chip support to the FSL-UPM driver
This patch adds support for multi-chip NAND devices to the FSL-UPM
driver. The "dev_ready" callback of the "struct fsl_upm_nand" is now
called with the argument "chip_nr" to allow testing the proper chip
select line. The NAND support of the MPC8360ERDK is updated as well.
No other boards are currently using the FSL UPM driver.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
2009-03-23 15:53:38 -05:00
Wolfgang Grandegger
672ed2aee9 Enable multi chip support in the NAND layer
This patch adds support for NAND_MAX_CHIPS to the MTD NAND layer.
Multi-chips devices are displayed as shown:

  Device 0: 2x NAND 512MiB 3,3V 8-bit, sector size 128 KiB

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
2009-03-23 15:53:37 -05:00
Eric Schumann
3a3baf3ee6 Make flash protection work, when the environment is in EEPROM
On the pcm030 the environment is located in the onboard EEPROM. But we want
to handle flash sector protection in a safe manner. So we must read the
unlock environment variable from EEPROM instead from flash.

This patch is required as long the evironment is saved into the EEPROM.

Stefan: Additional change as suggested by Wolfgang, use bigger char array
(instead of 4).

Signed-off-by: Eric Schumann <E.Schumann@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
2009-03-23 09:50:45 +01:00
Jean-Christophe PLAGNIOL-VILLARD
74c076d6c3 at91sam9/at91cap: move nand drivers to drivers/mtd/nand
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2009-03-22 13:22:24 +01:00
Richard Retanubun
7a88601a34 CFI: geometry reversal for STMicro M29W320DT
Follow up to the flash_fixup_stm to fix geometry reversal
on STMicro M29W320ET flash chip. The M29W320DT has 4 erase region.

Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2009-03-19 15:00:32 +01:00
Jean-Christophe PLAGNIOL-VILLARD
0176c03a24 nomadik/nand: fix 'ecc512' discards qualifiers from pointer target type
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2009-02-22 17:56:50 +01:00
Alessandro Rubini
0d8c6eab24 Nand driver for Nomadik SoC
This driver implements the ECC algorithm described in
the CPU data sheet and uses the OOB layout chosen in
already-released development systems (shipped with a custom-made
u-boot 1.3.1).

Signed-off-by: Alessandro Rubini <rubini@unipv.it>
Acked-by: Andrea Gallo <andrea.gallo@stnwireless.com>
2009-02-22 13:40:28 +01:00
Heiko Schocher
4f975678de cfi: make flash_get_info() non static
If on your board is more than one flash, you must know
the size of every single flash, for example, for updating
the DTS before booting Linux. So make this function
flash_get_info() extern, and you can have all info
about your flashes.

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
2009-02-11 17:01:17 +01:00
Wolfgang Denk
f8306cb94f Merge branch 'master' of ssh://gemini/home/wd/git/u-boot/master 2009-02-07 23:51:52 +01:00
Wolfgang Denk
64ace0d1e5 Merge branch 'master' of git://git.denx.de/u-boot-nand-flash 2009-02-07 23:37:10 +01:00
Peter Tyser
8da601280a NAND: Add timeout for reset command
Without the timeout present an infinite loop can occur if the
NAND device is broken or not present.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
2009-02-06 17:29:38 -06:00
Peter Tyser
10dc6a9bef NAND: Silence warning when CONFIG_SYS_NAND_QUIET_TEST
Commit cfa460adfd removed support
for disabling the "No NAND device found!!!" warning when
CONFIG_SYS_NAND_QUIET_TEST was defined.  This re-adds support
for silencing the warning.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
2009-02-06 17:29:29 -06:00
Valeriy Glushkov
ad09ab2e3a NAND: Fixed invalid pointers to static relocated chip names
Dear Wolfgang,

You are right, the patch was ugly.
The new one seems to be better.

Signed-off-by: Valeriy Glushkov <gvv@lstec.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
2009-02-06 17:28:31 -06:00
Stefan Roese
e1fb6d0d52 cfi_flash: Fix typo in cfi_flash.c
Patch "flash/cfi_flash: Use virtual sector start address, not phys"
introduced a small typo and compilation warning for systems with CFI
legacy support (e.g. hcu4). This patch fixes it.

Signed-off-by: Stefan Roese <sr@denx.de>
2009-02-05 11:44:52 +01:00
Stefan Roese
28745db969 jedec_flash: Only use manufacturer defines from common flash.h
This patch removes the double defined manufacturer defines from
jedec_flash.c. Since the common defines in flash.h are 32bit
we now need the (16) cast. This patch also removes the compilation
warning (e.g. seen on hcu5):

./MAKEALL hcu5
Configuring for hcu5 board...
jedec_flash.c:219: warning: large integer implicitly truncated to unsigned type

Signed-off-by: Stefan Roese <sr@denx.de>
2009-02-05 11:27:58 +01:00
Stefan Roese
ec21d5cfcb cfi_flash: Silence compilation warning
Patch "flash/cfi_flash: Use virtual sector start address, not phys"
introduced a small compilation warning. This patch fixes it.

Signed-off-by: Stefan Roese <sr@denx.de>
2009-02-05 11:25:57 +01:00
Becky Bruce
09ce9921a7 flash/cfi_flash: Use virtual sector start address, not phys
include/flash.h was commented to say that the address in
flash_info->start was a physical address.  However, from u-boot's
point of view, and looking at most flash code, it makes more
sense for this to be a virtual address.  So I corrected the
comment to indicate that this was a virtual address.

The only flash driver that was actually treating the address
as physical was the mtd/cfi_flash driver.  However, this code
was using it inconsistently as it actually directly dereferenced
the "start" element, while it used map_physmem to get a
virtual address in other places.  I changed this driver so
that the code which initializes the info->start field calls
map_physmem to get a virtual address, eliminating the need for
further map_physmem calls.  The code is now consistent.

The *only* place a physical address should be used is when defining the
flash banks list that is used to initialize the flash_info struct,
usually found in the board config file.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Stefan Roese <sr@denx.de>
2009-02-05 11:20:05 +01:00
Wolfgang Denk
657f2062d8 Fix compiler warning
(shows up only when DEBUG is enabled)

Signed-off-by: Wolfgang Denk <wd@denx.de>
2009-02-04 12:09:20 +01:00
Mike Frysinger
be9d8c780e Blackfin: add driver for on-chip NAND controller
This is a port of the Linux Blackfin on-chip NFC driver to U-Boot.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-02-02 12:27:07 -05:00
Wolfgang Denk
6c6e042ab3 Merge branch 'master' of git://git.denx.de/u-boot-arm 2009-02-01 21:38:07 +01:00
Richard Retanubun
e8eac43718 CFI: Add geometry reversal for STMicro M29W320ET
Added flash_fixup_stm to fix geometry reversal on STMicro M29W320ET flash chip.

Modeled after flash_fixup_amd, this patch handles the geometry reversal
or erase sectors that exist for ST Micro (now Numonyx) M29W320ET flash.
Since I cannot test all STM's chips, the detection is implemented as
narrow as possible for now.

Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2009-01-26 10:59:48 +01:00