cache.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Port on Texas Instruments TMS320C6x architecture
  3. *
  4. * Copyright (C) 2005, 2006, 2009, 2010, 2012 Texas Instruments Incorporated
  5. * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef _ASM_C6X_CACHE_H
  12. #define _ASM_C6X_CACHE_H
  13. #include <linux/irqflags.h>
  14. #include <linux/init.h>
  15. /*
  16. * Cache line size
  17. */
  18. #define L1D_CACHE_SHIFT 6
  19. #define L1D_CACHE_BYTES (1 << L1D_CACHE_SHIFT)
  20. #define L1P_CACHE_SHIFT 5
  21. #define L1P_CACHE_BYTES (1 << L1P_CACHE_SHIFT)
  22. #define L2_CACHE_SHIFT 7
  23. #define L2_CACHE_BYTES (1 << L2_CACHE_SHIFT)
  24. /*
  25. * L2 used as cache
  26. */
  27. #define L2MODE_SIZE L2MODE_256K_CACHE
  28. /*
  29. * For practical reasons the L1_CACHE_BYTES defines should not be smaller than
  30. * the L2 line size
  31. */
  32. #define L1_CACHE_SHIFT L2_CACHE_SHIFT
  33. #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
  34. #define L2_CACHE_ALIGN_LOW(x) \
  35. (((x) & ~(L2_CACHE_BYTES - 1)))
  36. #define L2_CACHE_ALIGN_UP(x) \
  37. (((x) + (L2_CACHE_BYTES - 1)) & ~(L2_CACHE_BYTES - 1))
  38. #define L2_CACHE_ALIGN_CNT(x) \
  39. (((x) + (sizeof(int) - 1)) & ~(sizeof(int) - 1))
  40. #define ARCH_DMA_MINALIGN L1_CACHE_BYTES
  41. #define ARCH_SLAB_MINALIGN L1_CACHE_BYTES
  42. /*
  43. * This is the granularity of hardware cacheability control.
  44. */
  45. #define CACHEABILITY_ALIGN 0x01000000
  46. /*
  47. * Align a physical address to MAR regions
  48. */
  49. #define CACHE_REGION_START(v) \
  50. (((u32) (v)) & ~(CACHEABILITY_ALIGN - 1))
  51. #define CACHE_REGION_END(v) \
  52. (((u32) (v) + (CACHEABILITY_ALIGN - 1)) & ~(CACHEABILITY_ALIGN - 1))
  53. extern void __init c6x_cache_init(void);
  54. extern void enable_caching(unsigned long start, unsigned long end);
  55. extern void disable_caching(unsigned long start, unsigned long end);
  56. extern void L1_cache_off(void);
  57. extern void L1_cache_on(void);
  58. extern void L1P_cache_global_invalidate(void);
  59. extern void L1D_cache_global_invalidate(void);
  60. extern void L1D_cache_global_writeback(void);
  61. extern void L1D_cache_global_writeback_invalidate(void);
  62. extern void L2_cache_set_mode(unsigned int mode);
  63. extern void L2_cache_global_writeback_invalidate(void);
  64. extern void L2_cache_global_writeback(void);
  65. extern void L1P_cache_block_invalidate(unsigned int start, unsigned int end);
  66. extern void L1D_cache_block_invalidate(unsigned int start, unsigned int end);
  67. extern void L1D_cache_block_writeback_invalidate(unsigned int start,
  68. unsigned int end);
  69. extern void L1D_cache_block_writeback(unsigned int start, unsigned int end);
  70. extern void L2_cache_block_invalidate(unsigned int start, unsigned int end);
  71. extern void L2_cache_block_writeback(unsigned int start, unsigned int end);
  72. extern void L2_cache_block_writeback_invalidate(unsigned int start,
  73. unsigned int end);
  74. extern void L2_cache_block_invalidate_nowait(unsigned int start,
  75. unsigned int end);
  76. extern void L2_cache_block_writeback_nowait(unsigned int start,
  77. unsigned int end);
  78. extern void L2_cache_block_writeback_invalidate_nowait(unsigned int start,
  79. unsigned int end);
  80. #endif /* _ASM_C6X_CACHE_H */