Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[MTD] XIP cleanup

Move the architecture dependend code into include/asm/mtd-xip.h

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Thomas Gleixner and committed by
Thomas Gleixner
97f927a4 b9c86d59

+104 -20
+1 -1
drivers/mtd/chips/cfi_cmdset_0001.c
··· 845 845 chip->state = FL_READY; 846 846 } 847 847 (void) map_read(map, adr); 848 - asm volatile (".rep 8; nop; .endr"); /* fill instruction prefetch */ 848 + xip_iprefetch(); 849 849 local_irq_enable(); 850 850 } 851 851
+1 -1
drivers/mtd/chips/cfi_cmdset_0002.c
··· 600 600 chip->state = FL_READY; 601 601 } 602 602 (void) map_read(map, adr); 603 - asm volatile (".rep 8; nop; .endr"); /* fill instruction prefetch */ 603 + xip_iprefetch(); 604 604 local_irq_enable(); 605 605 } 606 606
+37
include/asm-arm/arch-pxa/mtd-xip.h
··· 1 + /* 2 + * MTD primitives for XIP support. Architecture specific functions 3 + * 4 + * Do not include this file directly. It's included from linux/mtd/xip.h 5 + * 6 + * Author: Nicolas Pitre 7 + * Created: Nov 2, 2004 8 + * Copyright: (C) 2004 MontaVista Software, Inc. 9 + * 10 + * This program is free software; you can redistribute it and/or modify 11 + * it under the terms of the GNU General Public License version 2 as 12 + * published by the Free Software Foundation. 13 + * 14 + * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $ 15 + */ 16 + 17 + #ifndef __ARCH_PXA_MTD_XIP_H__ 18 + #define __ARCH_PXA_MTD_XIP_H__ 19 + 20 + #include <asm/arch/pxa-regs.h> 21 + 22 + #define xip_irqpending() (ICIP & ICMR) 23 + 24 + /* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */ 25 + #define xip_currtime() (OSCR) 26 + #define xip_elapsed_since(x) (signed)((OSCR - (x)) / 4) 27 + 28 + /* 29 + * xip_cpu_idle() is used when waiting for a delay equal or larger than 30 + * the system timer tick period. This should put the CPU into idle mode 31 + * to save power and to be woken up only when some interrupts are pending. 32 + * As above, this should not rely upon standard kernel code. 33 + */ 34 + 35 + #define xip_cpu_idle() asm volatile ("mcr p14, 0, %0, c7, c0, 0" :: "r" (1)) 36 + 37 + #endif /* __ARCH_PXA_MTD_XIP_H__ */
+26
include/asm-arm/arch-sa1100/mtd-xip.h
··· 1 + /* 2 + * MTD primitives for XIP support. Architecture specific functions 3 + * 4 + * Do not include this file directly. It's included from linux/mtd/xip.h 5 + * 6 + * Author: Nicolas Pitre 7 + * Created: Nov 2, 2004 8 + * Copyright: (C) 2004 MontaVista Software, Inc. 9 + * 10 + * This program is free software; you can redistribute it and/or modify 11 + * it under the terms of the GNU General Public License version 2 as 12 + * published by the Free Software Foundation. 13 + * 14 + * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $ 15 + */ 16 + 17 + #ifndef __ARCH_SA1100_MTD_XIP_H__ 18 + #define __ARCH_SA1100_MTD_XIP_H__ 19 + 20 + #define xip_irqpending() (ICIP & ICMR) 21 + 22 + /* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */ 23 + #define xip_currtime() (OSCR) 24 + #define xip_elapsed_since(x) (signed)((OSCR - (x)) / 4) 25 + 26 + #endif /* __ARCH_SA1100_MTD_XIP_H__ */
+26
include/asm-arm/mtd-xip.h
··· 1 + /* 2 + * MTD primitives for XIP support. Architecture specific functions 3 + * 4 + * Do not include this file directly. It's included from linux/mtd/xip.h 5 + * 6 + * Author: Nicolas Pitre 7 + * Created: Nov 2, 2004 8 + * Copyright: (C) 2004 MontaVista Software, Inc. 9 + * 10 + * This program is free software; you can redistribute it and/or modify 11 + * it under the terms of the GNU General Public License version 2 as 12 + * published by the Free Software Foundation. 13 + * 14 + * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $ 15 + */ 16 + 17 + #ifndef __ARM_MTD_XIP_H__ 18 + #define __ARM_MTD_XIP_H__ 19 + 20 + #include <asm/hardware.h> 21 + #include <asm/arch/mtd-xip.h> 22 + 23 + /* fill instruction prefetch */ 24 + #define xip_iprefetch() do { asm volatile (".rep 8; nop; .endr"); } while (0) 25 + 26 + #endif /* __ARM_MTD_XIP_H__ */
+13 -18
include/linux/mtd/xip.h
··· 58 58 * returned value is <= the real elapsed time. 59 59 * note 2: this should be able to cope with a few seconds without 60 60 * overflowing. 61 + * 62 + * xip_iprefetch() 63 + * 64 + * Macro to fill instruction prefetch 65 + * e.g. a series of nops: asm volatile (".rep 8; nop; .endr"); 61 66 */ 62 67 63 - #if defined(CONFIG_ARCH_SA1100) || defined(CONFIG_ARCH_PXA) 68 + #include <asm/mtd-xip.h> 64 69 65 - #include <asm/hardware.h> 66 - #ifdef CONFIG_ARCH_PXA 67 - #include <asm/arch/pxa-regs.h> 68 - #endif 69 - 70 - #define xip_irqpending() (ICIP & ICMR) 71 - 72 - /* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */ 73 - #define xip_currtime() (OSCR) 74 - #define xip_elapsed_since(x) (signed)((OSCR - (x)) / 4) 75 - 76 - #else 70 + #ifndef xip_irqpending 77 71 78 72 #warning "missing IRQ and timer primitives for XIP MTD support" 79 73 #warning "some of the XIP MTD support code will be disabled" ··· 79 85 80 86 #endif 81 87 88 + #ifndef xip_iprefetch 89 + #define xip_iprefetch() do { } while (0) 90 + #endif 91 + 82 92 /* 83 93 * xip_cpu_idle() is used when waiting for a delay equal or larger than 84 94 * the system timer tick period. This should put the CPU into idle mode 85 95 * to save power and to be woken up only when some interrupts are pending. 86 - * As above, this should not rely upon standard kernel code. 96 + * This should not rely upon standard kernel code. 87 97 */ 88 - 89 - #if defined(CONFIG_CPU_XSCALE) 90 - #define xip_cpu_idle() asm volatile ("mcr p14, 0, %0, c7, c0, 0" :: "r" (1)) 91 - #else 98 + #ifndef xip_cpu_idle 92 99 #define xip_cpu_idle() do { } while (0) 93 100 #endif 94 101