Skip to contentSkip to conversation

MTD-XIP: Use generic xip_iprefetch() instead of asm volatile (...)

PATCH In review Paulius Zaleckas 2 participants 2 messages Feb 27, 2008 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MTD-XIP: Use generic xip_iprefetch() instead of asm volatile (...)

Untested, but shouldn't break anything...
Makes MTD_XIP arch independent. I guess this is why xip_iprefetch() was made for.

---
 drivers/mtd/chips/cfi_cmdset_0001.c |    4 ++--
 drivers/mtd/chips/cfi_cmdset_0002.c |    4 ++--
 drivers/mtd/chips/cfi_probe.c       |    2 +-
 drivers/mtd/chips/cfi_util.c        |    2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
drivers/mtd/chips/cfi_cmdset_0001.c +2 -2
index 1707f98..c54d0b6 100644
@@ -1007,10 +1007,10 @@ static int __xipram xip_wait_for_operation(
 			chip->state = newstate;
 			map_write(map, CMD(0xff), adr);
 			(void) map_read(map, adr);
-			asm volatile (".rep 8; nop; .endr");
+			xip_iprefetch();
 			local_irq_enable();
 			spin_unlock(chip->mutex);
-			asm volatile (".rep 8; nop; .endr");
+			xip_iprefetch();
 			cond_resched();
 
 			/*
drivers/mtd/chips/cfi_cmdset_0002.c +2 -2
index 389acc6..f71cd70 100644
@@ -717,10 +717,10 @@ static void __xipram xip_udelay(struct map_info *map, struct flchip *chip,
 			chip->erase_suspended = 1;
 			map_write(map, CMD(0xf0), adr);
 			(void) map_read(map, adr);
-			asm volatile (".rep 8; nop; .endr");
+			xip_iprefetch();
 			local_irq_enable();
 			spin_unlock(chip->mutex);
-			asm volatile (".rep 8; nop; .endr");
+			xip_iprefetch();
 			cond_resched();
 
 			/*
drivers/mtd/chips/cfi_probe.c +1 -1
index 60e11a0..648a0a5 100644
@@ -39,7 +39,7 @@ struct mtd_info *cfi_probe(struct map_info *map);
 #define xip_allowed(base, map) \
 do { \
 	(void) map_read(map, base); \
-	asm volatile (".rep 8; nop; .endr"); \
+	xip_iprefetch(); \
 	local_irq_enable(); \
 } while (0)
 
drivers/mtd/chips/cfi_util.c +1 -1
index 2e51496..72e0022 100644
@@ -65,7 +65,7 @@ __xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* n
 
 #ifdef CONFIG_MTD_XIP
 	(void) map_read(map, base);
-	asm volatile (".rep 8; nop; .endr");
+	xip_iprefetch();
 	local_irq_enable();
 #endif
 
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Paulius Zaleckas

Untested, but shouldn't break anything...
Makes MTD_XIP arch independent. I guess this is why xip_iprefetch() was made for.

Quoted 75 lines
---
  drivers/mtd/chips/cfi_cmdset_0001.c |    4 ++--
  drivers/mtd/chips/cfi_cmdset_0002.c |    4 ++--
  drivers/mtd/chips/cfi_probe.c       |    2 +-
  drivers/mtd/chips/cfi_util.c        |    2 +-
  4 files changed, 6 insertions(+), 6 deletions(-)
drivers/mtd/chips/cfi_cmdset_0001.c +2 -2
index 1707f98..c54d0b6 100644
@@ -1007,10 +1007,10 @@ static int __xipram xip_wait_for_operation(
  			chip->state = newstate;
  			map_write(map, CMD(0xff), adr);
  			(void) map_read(map, adr);
-			asm volatile (".rep 8; nop; .endr");
+			xip_iprefetch();
  			local_irq_enable();
  			spin_unlock(chip->mutex);
-			asm volatile (".rep 8; nop; .endr");
+			xip_iprefetch();
  			cond_resched();
 
  			/*
drivers/mtd/chips/cfi_cmdset_0002.c +2 -2
index 389acc6..f71cd70 100644
@@ -717,10 +717,10 @@ static void __xipram xip_udelay(struct map_info *map, struct flchip *chip,
  			chip->erase_suspended = 1;
  			map_write(map, CMD(0xf0), adr);
  			(void) map_read(map, adr);
-			asm volatile (".rep 8; nop; .endr");
+			xip_iprefetch();
  			local_irq_enable();
  			spin_unlock(chip->mutex);
-			asm volatile (".rep 8; nop; .endr");
+			xip_iprefetch();
  			cond_resched();
 
  			/*
drivers/mtd/chips/cfi_probe.c +1 -1
index 60e11a0..648a0a5 100644
@@ -39,7 +39,7 @@ struct mtd_info *cfi_probe(struct map_info *map);
  #define xip_allowed(base, map) \
  do { \
  	(void) map_read(map, base); \
-	asm volatile (".rep 8; nop; .endr"); \
+	xip_iprefetch(); \
  	local_irq_enable(); \
  } while (0)
 
drivers/mtd/chips/cfi_util.c +1 -1
index 2e51496..72e0022 100644
@@ -65,7 +65,7 @@ __xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* n
 
  #ifdef CONFIG_MTD_XIP
  	(void) map_read(map, base);
-	asm volatile (".rep 8; nop; .endr");
+	xip_iprefetch();
  	local_irq_enable();
  #endif
 
Signature · 3 lines
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

Nicolas