cpu_sh4.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  4. */
  5. #ifndef _ASM_CPU_SH4_H_
  6. #define _ASM_CPU_SH4_H_
  7. /* cache control */
  8. #define CCR_CACHE_STOP 0x00000808
  9. #define CCR_CACHE_ENABLE 0x00000101
  10. #define CCR_CACHE_ICI 0x00000800
  11. #define CACHE_OC_ADDRESS_ARRAY 0xf4000000
  12. #if defined (CONFIG_CPU_SH7750) || \
  13. defined(CONFIG_CPU_SH7751)
  14. #define CACHE_OC_WAY_SHIFT 14
  15. #define CACHE_OC_NUM_ENTRIES 512
  16. #else
  17. #define CACHE_OC_WAY_SHIFT 13
  18. #define CACHE_OC_NUM_ENTRIES 256
  19. #endif
  20. #define CACHE_OC_ENTRY_SHIFT 5
  21. #if defined (CONFIG_CPU_SH7750) || \
  22. defined(CONFIG_CPU_SH7751)
  23. # include <asm/cpu_sh7750.h>
  24. #elif defined (CONFIG_CPU_SH7722)
  25. # include <asm/cpu_sh7722.h>
  26. #elif defined (CONFIG_CPU_SH7723)
  27. # include <asm/cpu_sh7723.h>
  28. #elif defined (CONFIG_CPU_SH7724)
  29. # include <asm/cpu_sh7724.h>
  30. #elif defined (CONFIG_CPU_SH7734)
  31. # include <asm/cpu_sh7734.h>
  32. #elif defined (CONFIG_CPU_SH7752)
  33. # include <asm/cpu_sh7752.h>
  34. #elif defined (CONFIG_CPU_SH7753)
  35. # include <asm/cpu_sh7753.h>
  36. #elif defined (CONFIG_CPU_SH7757)
  37. # include <asm/cpu_sh7757.h>
  38. #elif defined (CONFIG_CPU_SH7763)
  39. # include <asm/cpu_sh7763.h>
  40. #elif defined (CONFIG_CPU_SH7780)
  41. # include <asm/cpu_sh7780.h>
  42. #elif defined (CONFIG_CPU_SH7785)
  43. # include <asm/cpu_sh7785.h>
  44. #else
  45. # error "Unknown SH4 variant"
  46. #endif
  47. #if defined(CONFIG_SH_32BIT)
  48. #define PMB_ADDR_ARRAY 0xf6100000
  49. #define PMB_ADDR_ENTRY 8
  50. #define PMB_VPN 24
  51. #define PMB_DATA_ARRAY 0xf7100000
  52. #define PMB_DATA_ENTRY 8
  53. #define PMB_PPN 24
  54. #define PMB_UB 9 /* Buffered write */
  55. #define PMB_V 8 /* Valid */
  56. #define PMB_SZ1 7 /* Page size (upper bit) */
  57. #define PMB_SZ0 4 /* Page size (lower bit) */
  58. #define PMB_C 3 /* Cacheability */
  59. #define PMB_WT 0 /* Write-through */
  60. #define PMB_ADDR_BASE(entry) (PMB_ADDR_ARRAY + (entry << PMB_ADDR_ENTRY))
  61. #define PMB_DATA_BASE(entry) (PMB_DATA_ARRAY + (entry << PMB_DATA_ENTRY))
  62. #define mk_pmb_addr_val(vpn) ((vpn << PMB_VPN))
  63. #define mk_pmb_data_val(ppn, ub, v, sz1, sz0, c, wt) \
  64. ((ppn << PMB_PPN) | (ub << PMB_UB) | \
  65. (v << PMB_V) | (sz1 << PMB_SZ1) | \
  66. (sz0 << PMB_SZ0) | (c << PMB_C) | \
  67. (wt << PMB_WT))
  68. #endif
  69. #endif /* _ASM_CPU_SH4_H_ */