diff options
author | John Bowler <jbowler@nslu2-linux.org> | 2005-10-08 03:47:45 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2005-10-08 03:47:45 +0000 |
commit | df6d07a8e6644e02304b4aa577d658000307c818 (patch) | |
tree | 2cac9de884213c07803f9ec3b636fd2196272282 | |
parent | cf6bb61067dbcf3511164209452c0b2e7600ffe1 (diff) |
nslu2-kernel_2.6.14-rc3.bb: better fix for LE flash access
patch "packages/linux/nslu2-kernel/2.6.14/10-ixp4xx-copy-from.patch"
Change to use the cfi16 APIs to byte swap the 16 bit values read from
the flash as required.
patch "packages/linux/nslu2-kernel/2.6.14/defconfig"
patch "packages/linux/openslug-kernel-2.6.14-rc3/defconfig"
Change to switch on BIG_ENDIAN for the flash.
patch "packages/linux/nslu2-kernel_2.6.14-rc3.bb"
New revision
4 files changed, 46 insertions, 20 deletions
diff --git a/packages/linux/nslu2-kernel/2.6.14/10-ixp4xx-copy-from.patch b/packages/linux/nslu2-kernel/2.6.14/10-ixp4xx-copy-from.patch index 51d7e0113f..db71342ab0 100644 --- a/packages/linux/nslu2-kernel/2.6.14/10-ixp4xx-copy-from.patch +++ b/packages/linux/nslu2-kernel/2.6.14/10-ixp4xx-copy-from.patch @@ -1,6 +1,14 @@ ---- linux-2.6.14-rc3/drivers/mtd/maps/ixp4xx.c 2005-10-05 20:35:42.916786530 -0700 -+++ linux-2.6.14-rc3/drivers/mtd/maps/ixp4xx.c 2005-10-05 22:42:25.811206514 -0700 -@@ -30,18 +30,29 @@ +--- linux-2.6.13/.pc/10-ixp4xx-copy-from.patch/drivers/mtd/maps/ixp4xx.c 2005-10-07 15:55:08.958509801 -0700 ++++ linux-2.6.13/drivers/mtd/maps/ixp4xx.c 2005-10-07 19:06:22.352484966 -0700 +@@ -22,6 +22,7 @@ + #include <linux/string.h> + #include <linux/mtd/mtd.h> + #include <linux/mtd/map.h> ++#include <linux/mtd/cfi_endian.h> + #include <linux/mtd/partitions.h> + #include <linux/ioport.h> + #include <linux/device.h> +@@ -30,18 +31,45 @@ #include <linux/reboot.h> @@ -9,20 +17,36 @@ + * This causes the cfi commands (sent to the command address, 0xAA for + * 16 bit flash) to fail. This is fixed here by XOR'ing the address + * before use with 10b. The cost of this is that the flash layout ends -+ * up consistently big-endian, however this is not a problem as the -+ * access code consistently only accesses half words - so the endianness -+ * is not determinable. ++ * up with pdp-endiannes (on an LE syste), however this is not a problem ++ * as the access code consistently only accesses half words - so the ++ * endianness is not determinable on stuff which is written and read ++ * consistently in the little endian world. ++ * ++ * For flash data from the big-endian world, however, the results are ++ * weird - the pdp-endianness results in the data apparently being ++ * 2-byte swapped (as in dd conv=swab). To work round this the 16 ++ * bit values are written and read using cpu_to_cfi16 and cfi16_to_cpu, ++ * by default these are no-ops, but if the MTD driver is configed with ++ * CONFIG_MTD_CFI_BE_BYTE_SWAP the macros will byte swap the data, ++ * resulting in a consistently BE view of the flash on both BE (no ++ * op) and LE systems. This config setting also causes the command ++ * data from the CFI implementation to get swapped - as is required ++ * so that this code will *unswap* it and give the correct command ++ * data to the flash. + */ #ifndef __ARMEB__ #define BYTE0(h) ((h) & 0xFF) #define BYTE1(h) (((h) >> 8) & 0xFF) -+#define FLASHW(a) (*(__u16*)((u32)(a) ^ 2)) ++#define FLASHWORD(a) (*(__u16*)((u32)(a) ^ 2)) #else #define BYTE0(h) (((h) >> 8) & 0xFF) #define BYTE1(h) ((h) & 0xFF) -+#define FLASHW(a) (*(__u16*)(a)) ++#define FLASHWORD(a) (*(__u16*)(a)) #endif ++#define FLASHW(a) cfi16_to_cpu(FLASHWORD(a)) ++#define FLASHSET(a,v) (FLASHWORD(a) = cpu_to_cfi16(v)) ++ static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs) { map_word val; @@ -31,7 +55,7 @@ return val; } -@@ -53,19 +64,23 @@ +@@ -53,19 +81,23 @@ static void ixp4xx_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) { @@ -65,21 +89,21 @@ } /* -@@ -75,7 +90,7 @@ +@@ -75,7 +107,7 @@ static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr) { if (!(adr & 1)) - *(__u16 *) (map->map_priv_1 + adr) = d.x[0]; -+ FLASHW(map->map_priv_1 + adr) = d.x[0]; ++ FLASHSET(map->map_priv_1 + adr, d.x[0]); } /* -@@ -83,7 +98,7 @@ +@@ -83,7 +115,7 @@ */ static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr) { - *(__u16 *) (map->map_priv_1 + adr) = d.x[0]; -+ FLASHW(map->map_priv_1 + adr) = d.x[0]; ++ FLASHSET(map->map_priv_1 + adr, d.x[0]); } struct ixp4xx_flash_info { diff --git a/packages/linux/nslu2-kernel/2.6.14/defconfig b/packages/linux/nslu2-kernel/2.6.14/defconfig index 7b1dd207a5..78261828f0 100644 --- a/packages/linux/nslu2-kernel/2.6.14/defconfig +++ b/packages/linux/nslu2-kernel/2.6.14/defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.14-rc3 -# Wed Oct 5 20:33:54 2005 +# Fri Oct 7 19:32:33 2005 # CONFIG_ARM=y CONFIG_MMU=y @@ -150,6 +150,7 @@ CONFIG_FLATMEM_MANUAL=y CONFIG_FLATMEM=y CONFIG_FLAT_NODE_MEM_MAP=y # CONFIG_SPARSEMEM_STATIC is not set +# CONFIG_LEDS is not set CONFIG_ALIGNMENT_TRAP=y # @@ -412,8 +413,8 @@ CONFIG_MTD_CFI=y # CONFIG_MTD_JEDECPROBE is not set CONFIG_MTD_GEN_PROBE=y CONFIG_MTD_CFI_ADV_OPTIONS=y -CONFIG_MTD_CFI_NOSWAP=y -# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set +# CONFIG_MTD_CFI_NOSWAP is not set +CONFIG_MTD_CFI_BE_BYTE_SWAP=y # CONFIG_MTD_CFI_LE_BYTE_SWAP is not set CONFIG_MTD_CFI_GEOMETRY=y # CONFIG_MTD_MAP_BANK_WIDTH_1 is not set diff --git a/packages/linux/nslu2-kernel_2.6.14-rc3.bb b/packages/linux/nslu2-kernel_2.6.14-rc3.bb index c59c0db385..549128f064 100644 --- a/packages/linux/nslu2-kernel_2.6.14-rc3.bb +++ b/packages/linux/nslu2-kernel_2.6.14-rc3.bb @@ -8,7 +8,7 @@ PR_CONFIG = "0" # Increment the number below (i.e. the digits after PR) when # making changes within this file or for changes to the patches # applied to the kernel. -PR = "r2.${PR_CONFIG}" +PR = "r3.${PR_CONFIG}" include nslu2-kernel.inc diff --git a/packages/linux/openslug-kernel-2.6.14-rc3/defconfig b/packages/linux/openslug-kernel-2.6.14-rc3/defconfig index 7b1dd207a5..78261828f0 100644 --- a/packages/linux/openslug-kernel-2.6.14-rc3/defconfig +++ b/packages/linux/openslug-kernel-2.6.14-rc3/defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.14-rc3 -# Wed Oct 5 20:33:54 2005 +# Fri Oct 7 19:32:33 2005 # CONFIG_ARM=y CONFIG_MMU=y @@ -150,6 +150,7 @@ CONFIG_FLATMEM_MANUAL=y CONFIG_FLATMEM=y CONFIG_FLAT_NODE_MEM_MAP=y # CONFIG_SPARSEMEM_STATIC is not set +# CONFIG_LEDS is not set CONFIG_ALIGNMENT_TRAP=y # @@ -412,8 +413,8 @@ CONFIG_MTD_CFI=y # CONFIG_MTD_JEDECPROBE is not set CONFIG_MTD_GEN_PROBE=y CONFIG_MTD_CFI_ADV_OPTIONS=y -CONFIG_MTD_CFI_NOSWAP=y -# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set +# CONFIG_MTD_CFI_NOSWAP is not set +CONFIG_MTD_CFI_BE_BYTE_SWAP=y # CONFIG_MTD_CFI_LE_BYTE_SWAP is not set CONFIG_MTD_CFI_GEOMETRY=y # CONFIG_MTD_MAP_BANK_WIDTH_1 is not set |