XIP support hooks for the AMD flash: updated
Greetings,
I'd like to introduce the updated version of the XIP support hooks for AMD flash.
Now the XIP support doesn't depend on spinlocks implementation. Therefore it's possible to use it with the preemption enhancements introduced by Ingo Molnar. The changes are based on the Intel flash XIP code fixups by Nicolas Pitre.
The patch 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 +313 -94
806 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 ; }
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); }
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 {
Best regards,
Vitaly
Quoted 1 line · Vitaly Wool
I'd like to introduce the updated version of the XIP support hooks for AMD flash.
[...]
Found an inconsistency:
drivers/mtd/chips/cfi_cmdset_0002.c line 1005
Quoted 8 lines
drivers/mtd/chips/cfi_cmdset_0002.c +2
-1@@ -786,9 +1000,10 @@ ret = -EIO ; op_done: - chip->state =FL_READY ; +xip_enable (map, chip, adr); + chip->state =FL_STATUS ;put_chip (map, chip, adr);
The flash may never be in status mode when XIP is enabled.
Nicolas
Quoted 19 lines · On Fri, 20 May 2005 13:46:34 -0400 (EDT) "Nicolas Pitre" <[email protected]> wrote:
Quoted 1 line · Vitaly Wool
I'd like to introduce the updated version of the XIP support hooks for AMD flash.
[...]
Found an inconsistency:
Review line 1005
Quoted 8 lines
(quoted diff) +2
-1@@ -786,9 +1000,10 @@ ret = -EIO; op_done: - chip->state = FL_READY; + xip_enable(map, chip, adr); + chip->state = FL_STATUS; put_chip(map, chip, adr);The flash may never be in status mode when XIP is enabled.
Quoted 2 lines
Nicolas
Yep, agreed. Corrected, see below.
Best regards,
Vitaly
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 +309 -90
800 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 ; }
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); }
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 {
Tny correction: len -> map->size in do_erase_chip
This patch has been verified on the other ARM platform w/ AMD flash.
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 +309 -90
800 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 ; }
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); }
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 {