XIP support hooks for the AMD flash
Hi all,
I've implemented the XIP support hooks for cfi_cmdset_0002 (AMD NOR flash) and it kinda works on Philips PNX0105 (Integrator-like) board. The patch itself is the following:
drivers/mtd/chips/Kconfig +1 -1
@@ -300,7 +300,7 @@ config MTD_XIP bool "XIP aware MTD support" - depends on !SMP && MTD_CFI_INTELEXT && EXPERIMENTAL + depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL default y if XIP_KERNEL help This allows MTD support to work with flash memory which is also
drivers/mtd/chips/cfi_cmdset_0002.c +312 -91
812 lines not on this page · raw message
drivers/mtd/chips/fwh_lock.h +3 -3
@@ -58,10 +58,10 @@* to flash memory - that means that we don't have to check status * and timeout. */ -cfi_spin_lock (chip->mutex); +spin_lock (chip->mutex); ret =get_chip (map, chip, adr,FL_LOCKING );if (ret) { -cfi_spin_unlock (chip->mutex); +spin_unlock (chip->mutex);return ret; }
@@ -71,7 +71,7 @@/* Done and happy. */ chip->state =FL_READY ;put_chip (map, chip, adr); -cfi_spin_unlock (chip->mutex); +spin_unlock (chip->mutex);return 0 ; }
include/linux/mtd/cfi.h +0 -10
@@ -365,16 +365,6 @@ } } -static inline void cfi_spin_lock (spinlock_t *mutex) -{ -spin_lock_bh (mutex); -} - -static inline void cfi_spin_unlock (spinlock_t *mutex) -{ -spin_unlock_bh (mutex); -} -struct cfi_extquery *cfi_read_pri (struct map_info *map,uint16_t adr,uint16_t size,const char * name);struct cfi_fixup {
Please also note that during the debugging of this stuff I've come across of necessity of having simple_map_XXX functions in RAM not NOR flash. The corresponding patch is the following:
drivers/mtd/maps/map_funcs.c +5 -4
@@ -9,23 +9,24 @@#include <linux/module.h> #include <linux/mtd/map.h> +#include <linux/mtd/xip.h> -static map_word simple_map_read (struct map_info *map,unsigned long ofs) +static map_word __xipram simple_map_read(struct map_info *map, unsigned long ofs) {return inline_map_read (map, ofs); } -static void simple_map_write (struct map_info *map,const map_word datum,unsigned long ofs) +static void __xipram simple_map_write(struct map_info *map, const map_word datum, unsigned long ofs) {inline_map_write (map, datum, ofs); } -static void simple_map_copy_from (struct map_info *map,void *to,unsigned long from,ssize_t len) +static void __xipram simple_map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) {inline_map_copy_from (map, to, from, len); } -static void simple_map_copy_to (struct map_info *map,unsigned long to,const void *from,ssize_t len) +static void __xipram simple_map_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) {inline_map_copy_to (map, to, from, len); }
Any comments/suggestions are greaty appreciated.
TIA,
Vitaly