linux/drivers/mtd
John Bowler 9cff3372bf [PATCH] drivers/mtd/redboot.c: recognise a foreign byte sex partition table
The RedBoot boot loader writes flash partition tables containing native
byte sex 32 bit values.  When booting an opposite byte sex kernel (e.g.  an
LE kernel from BE RedBoot) the current MTD driver fails to handle the
partition table and therefore is unable to generate the correct partition
map for the flash.

So far as I am aware this problem is ARM specific, because only ARM
supports software change of the CPU (memory system) byte sex, however the
partition table parsing is in generic MTD code.  The patch below has been
tested on NSLU2 (an IXP4XX based system) with a patch,
10-ixp4xx-copy-from.patch (submitted to linux-arm-kernel - it's ARM
specific) required to make the maps/ixp4xx.c driver work with an LE kernel.

Builds of the patched system are in the 'unstable' release of OpenSlug and
UcSlugC available from www.nslu2-linux.org.  These builds are BE, the
archives at www.nslu2-linux.org and www.handhelds.org (see
monotone.vanille.de) can be built LE (currently DISTRO targets
nslu-ltu.conf for LE thumb uclibc (32 bit kernel) and nslu2-lau.conf,
nslu2-lag.conf for LE arm uclibc/glibc) and this patch has been tested
extensively will both BE and LE systems on the NSLU2 (including swapping
between BE and LE by reflashing from both RedBoot and Linux).

The patch recognises that the FIS directory (the partition table) is
byte-reversed by examining the partition table size, which is known to be
one erase block (this is an assumption made elsewhere in redboot.c).  If
the size matches the erase block after byte swapping the value then
byte-reversal is assumed, if not no further action is taken.  The patched
code is fail safe; should redboot.c be changed to support a partition table
with a modified size field the test will fail and the partition table will
be assumed to have the host byte sex.

If byte-reversal is detected the patch byte swaps the remainder of the 32
bit fields in the copy of the table; this copy is then used to set up the
MTD partition map.

Signed-off-by: John Bowler <jbowler@acm.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Martin Michlmayr <tbm@cyrius.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-28 20:53:43 -08:00
..
chips [PATCH] cfi: init wait queue in chip struct 2006-02-24 14:31:37 -08:00
devices [PATCH] build kernel/intermodule.c only when required 2006-01-16 23:15:26 -08:00
maps [PATCH] Fix compilation errors in maps/dc21285.c 2006-02-03 08:32:01 -08:00
nand [PATCH] Unlinline a bunch of other functions 2006-01-14 18:27:06 -08:00
onenand [PATCH] fix more missing includes 2006-01-08 20:13:45 -08:00
afs.c [MTD] core: Clean up trailing white spaces 2005-11-07 13:37:38 +01:00
cmdlinepart.c [MTD] core: Clean up trailing white spaces 2005-11-07 13:37:38 +01:00
ftl.c [MTD] Make functions static, include header files with prototypes 2005-11-29 19:54:58 +01:00
inftlcore.c Merge master.kernel.org:/pub/scm/linux/kernel/git/tglx/mtd-2.6 2005-11-07 10:24:08 -08:00
inftlmount.c Merge master.kernel.org:/pub/scm/linux/kernel/git/tglx/mtd-2.6 2005-11-07 10:24:08 -08:00
Kconfig [MTD] core: Clean up trailing white spaces 2005-11-07 13:37:38 +01:00
Makefile [MTD] Add initial support for OneNAND flash chips 2005-11-06 21:17:24 +01:00
mtd_blkdevs.c [PATCH] Add block_device_operations.getgeo block device method 2006-01-08 20:13:54 -08:00
mtdblock.c [MTD] core: Clean up trailing white spaces 2005-11-07 13:37:38 +01:00
mtdblock_ro.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mtdchar.c [MTD] core: Clean up trailing white spaces 2005-11-07 13:37:38 +01:00
mtdconcat.c [MTD] core: Clean up trailing white spaces 2005-11-07 13:37:38 +01:00
mtdcore.c [MTD] core: Clean up trailing white spaces 2005-11-07 13:37:38 +01:00
mtdpart.c [MTD] core: Clean up trailing white spaces 2005-11-07 13:37:38 +01:00
nftlcore.c Merge master.kernel.org:/pub/scm/linux/kernel/git/tglx/mtd-2.6 2005-11-07 10:24:08 -08:00
nftlmount.c [MTD] core: Clean up trailing white spaces 2005-11-07 13:37:38 +01:00
redboot.c [PATCH] drivers/mtd/redboot.c: recognise a foreign byte sex partition table 2006-02-28 20:53:43 -08:00
rfd_ftl.c [PATCH] fix more missing includes 2006-01-08 20:13:45 -08:00