Two patches needed for NSLU2 (arm).

svn path=/dists/trunk/linux-2.6/; revision=5433
This commit is contained in:
Martin Michlmayr 2006-01-14 02:06:46 +00:00
parent c49f43c457
commit c6af46e5b4
4 changed files with 177 additions and 0 deletions

4
debian/changelog vendored
View File

@ -18,6 +18,10 @@ linux-2.6 (2.6.15-3) UNRELEASED; urgency=low
* [arm/footbridge] Enable USB modules.
* [arm/nslu2] Add an image for Network Storage Link for USB 2.0 Disk
Drives.
* debian/patches/arm-memory-h-page-shift.patch: Fix error "PAGE_SHIFT
undeclared".
* debian/patches/mtdpart-redboot-fis-byteswap.patch: recognise a foreign
endian RedBoot partition table.
-- Martin Michlmayr <tbm@cyrius.com> Tue, 10 Jan 2006 22:59:19 +0000

View File

@ -0,0 +1,96 @@
## DP: Fix error "PAGE_SHIFT undeclared"
## DP: Patch author: Rod Whitby <rod@whitby.id.au>
## DP: Upstream status: in ARM tree
#
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=3218/1
PAGE_SHIFT is undeclared in include/asm-arm/arch-ixp4xx/memory.h, identified by the following kernel compilation error:
CC [M] sound/core/memory.o
In file included from include/asm/memory.h:27,
from include/asm/io.h:28,
from sound/core/memory.c:24:
include/asm/arch/memory.h: In function `__arch_adjust_zones':
include/asm/arch/memory.h:28: error: `PAGE_SHIFT' undeclared (first use
in this function)
This patch replaces my previous attempt at fixing this problem (Patch 3214/1) and is based on the following feedback:
Russell King wrote:
> The error you see came up on SA1100. The best solution was to move
> the __arch_adjust_zones() function out of line. I suggest ixp4xx
> does the same.
I have moved the function out of line into arch/arm/mach-ixp4xx/common-pci.c as suggested.
Signed-off-by: Rod Whitby <rod@whitby.id.au>
--- linux-2.6.15-rc7/include/asm-arm/arch-ixp4xx/memory.h~ 2005-12-30 05:18:27.000000000 +1030
+++ linux-2.6.15-rc7/include/asm-arm/arch-ixp4xx/memory.h 2005-12-30 05:36:04.000000000 +1030
@@ -16,31 +16,10 @@
#ifndef __ASSEMBLY__
-/*
- * Only first 64MB of memory can be accessed via PCI.
- * We use GFP_DMA to allocate safe buffers to do map/unmap.
- * This is really ugly and we need a better way of specifying
- * DMA-capable regions of memory.
- */
-static inline void __arch_adjust_zones(int node, unsigned long *zone_size,
- unsigned long *zhole_size)
-{
- unsigned int sz = SZ_64M >> PAGE_SHIFT;
-
- /*
- * Only adjust if > 64M on current system
- */
- if (node || (zone_size[0] <= sz))
- return;
-
- zone_size[1] = zone_size[0] - sz;
- zone_size[0] = sz;
- zhole_size[1] = zhole_size[0];
- zhole_size[0] = 0;
-}
+void ixp4xx_adjust_zones(int node, unsigned long *size, unsigned long *holes);
#define arch_adjust_zones(node, size, holes) \
- __arch_adjust_zones(node, size, holes)
+ ixp4xx_adjust_zones(node, size, holes)
#define ISA_DMA_THRESHOLD (SZ_64M - 1)
--- linux-2.6.15-rc7/arch/arm/mach-ixp4xx/common-pci.c~ 2005-12-30 05:16:03.000000000 +1030
+++ linux-2.6.15-rc7/arch/arm/mach-ixp4xx/common-pci.c 2005-12-30 05:43:55.000000000 +1030
@@ -341,6 +341,29 @@ int dma_needs_bounce(struct device *dev,
return (dev->bus == &pci_bus_type ) && ((dma_addr + size) >= SZ_64M);
}
+/*
+ * Only first 64MB of memory can be accessed via PCI.
+ * We use GFP_DMA to allocate safe buffers to do map/unmap.
+ * This is really ugly and we need a better way of specifying
+ * DMA-capable regions of memory.
+ */
+void __init ixp4xx_adjust_zones(int node, unsigned long *zone_size,
+ unsigned long *zhole_size)
+{
+ unsigned int sz = SZ_64M >> PAGE_SHIFT;
+
+ /*
+ * Only adjust if > 64M on current system
+ */
+ if (node || (zone_size[0] <= sz))
+ return;
+
+ zone_size[1] = zone_size[0] - sz;
+ zone_size[0] = sz;
+ zhole_size[1] = zhole_size[0];
+ zhole_size[0] = 0;
+}
+
void __init ixp4xx_pci_preinit(void)
{
unsigned long processor_id;

View File

@ -0,0 +1,75 @@
## DP: recognise a foreign byte sex partition table
## DP: Patch author: John Bowler <jbowler@acm.org>
## DP: Upstream status: in MTD tree
#
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.
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>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Modified slightly and
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Index: drivers/mtd/redboot.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/redboot.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -p -r1.18 -r1.19
--- linux-2.6.15/drivers/mtd/redboot.c 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.15/drivers/mtd/redboot.c 1970-01-01 00:00:00.000000000 +0000
@@ -89,8 +89,32 @@ static int parse_redboot_partitions(stru
i = numslots;
break;
}
- if (!memcmp(buf[i].name, "FIS directory", 14))
+ if (!memcmp(buf[i].name, "FIS directory", 14)) {
+ /* This is apparently the FIS directory entry for the
+ * FIS directory itself. The FIS directory size is
+ * one erase block; if the buf[i].size field is
+ * swab32(erasesize) then we know we are looking at
+ * a byte swapped FIS directory - swap all the entries!
+ * (NOTE: this is 'size' not 'data_length'; size is
+ * the full size of the entry.)
+ */
+ if (swab32(buf[i].size) == master->erasesize) {
+ int j;
+ for (j = 0; j < numslots && buf[j].name[0] != 0xff; ++j) {
+ /* The unsigned long fields were written with the
+ * wrong byte sex, name and pad have no byte sex.
+ */
+ swab32s(&buf[j].flash_base);
+ swab32s(&buf[j].mem_base);
+ swab32s(&buf[j].size);
+ swab32s(&buf[j].entry_point);
+ swab32s(&buf[j].data_length);
+ swab32s(&buf[j].desc_cksum);
+ swab32s(&buf[j].file_cksum);
+ }
+ }
break;
+ }
}
if (i == numslots) {
/* Didn't find it */

View File

@ -1 +1,3 @@
+ arm-fix-dc21285.patch
+ arm-memory-h-page-shift.patch
+ mtdpart-redboot-fis-byteswap.patch