0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _ASM_BCACHE_H
0010 #define _ASM_BCACHE_H
0011
0012 #include <linux/types.h>
0013
0014
0015
0016
0017 struct bcache_ops {
0018 void (*bc_enable)(void);
0019 void (*bc_disable)(void);
0020 void (*bc_wback_inv)(unsigned long page, unsigned long size);
0021 void (*bc_inv)(unsigned long page, unsigned long size);
0022 void (*bc_prefetch_enable)(void);
0023 void (*bc_prefetch_disable)(void);
0024 bool (*bc_prefetch_is_enabled)(void);
0025 };
0026
0027 extern void indy_sc_init(void);
0028
0029 #ifdef CONFIG_BOARD_SCACHE
0030
0031 extern struct bcache_ops *bcops;
0032
0033 static inline void bc_enable(void)
0034 {
0035 bcops->bc_enable();
0036 }
0037
0038 static inline void bc_disable(void)
0039 {
0040 bcops->bc_disable();
0041 }
0042
0043 static inline void bc_wback_inv(unsigned long page, unsigned long size)
0044 {
0045 bcops->bc_wback_inv(page, size);
0046 }
0047
0048 static inline void bc_inv(unsigned long page, unsigned long size)
0049 {
0050 bcops->bc_inv(page, size);
0051 }
0052
0053 static inline void bc_prefetch_enable(void)
0054 {
0055 if (bcops->bc_prefetch_enable)
0056 bcops->bc_prefetch_enable();
0057 }
0058
0059 static inline void bc_prefetch_disable(void)
0060 {
0061 if (bcops->bc_prefetch_disable)
0062 bcops->bc_prefetch_disable();
0063 }
0064
0065 static inline bool bc_prefetch_is_enabled(void)
0066 {
0067 if (bcops->bc_prefetch_is_enabled)
0068 return bcops->bc_prefetch_is_enabled();
0069
0070 return false;
0071 }
0072
0073 #else
0074
0075
0076
0077 #define bc_enable() do { } while (0)
0078 #define bc_disable() do { } while (0)
0079 #define bc_wback_inv(page, size) do { } while (0)
0080 #define bc_inv(page, size) do { } while (0)
0081 #define bc_prefetch_enable() do { } while (0)
0082 #define bc_prefetch_disable() do { } while (0)
0083 #define bc_prefetch_is_enabled() 0
0084
0085 #endif
0086
0087 #endif