bmips.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2011 by Kevin Cernekee (cernekee@gmail.com)
  7. *
  8. * Definitions for BMIPS processors
  9. */
  10. #ifndef _ASM_BMIPS_H
  11. #define _ASM_BMIPS_H
  12. #include <linux/compiler.h>
  13. #include <linux/linkage.h>
  14. #include <asm/addrspace.h>
  15. #include <asm/mipsregs.h>
  16. #include <asm/hazards.h>
  17. /* NOTE: the CBR register returns a PA, and it can be above 0xff00_0000 */
  18. #define BMIPS_GET_CBR() ((void __iomem *)(CKSEG1 | \
  19. (unsigned long) \
  20. ((read_c0_brcm_cbr() >> 18) << 18)))
  21. #define BMIPS_RAC_CONFIG 0x00000000
  22. #define BMIPS_RAC_ADDRESS_RANGE 0x00000004
  23. #define BMIPS_RAC_CONFIG_1 0x00000008
  24. #define BMIPS_L2_CONFIG 0x0000000c
  25. #define BMIPS_LMB_CONTROL 0x0000001c
  26. #define BMIPS_SYSTEM_BASE 0x00000020
  27. #define BMIPS_PERF_GLOBAL_CONTROL 0x00020000
  28. #define BMIPS_PERF_CONTROL_0 0x00020004
  29. #define BMIPS_PERF_CONTROL_1 0x00020008
  30. #define BMIPS_PERF_COUNTER_0 0x00020010
  31. #define BMIPS_PERF_COUNTER_1 0x00020014
  32. #define BMIPS_PERF_COUNTER_2 0x00020018
  33. #define BMIPS_PERF_COUNTER_3 0x0002001c
  34. #define BMIPS_RELO_VECTOR_CONTROL_0 0x00030000
  35. #define BMIPS_RELO_VECTOR_CONTROL_1 0x00038000
  36. #define BMIPS_NMI_RESET_VEC 0x80000000
  37. #define BMIPS_WARM_RESTART_VEC 0x80000380
  38. #define ZSCM_REG_BASE 0x97000000
  39. #if !defined(__ASSEMBLY__)
  40. #include <linux/cpumask.h>
  41. #include <asm/r4kcache.h>
  42. extern struct plat_smp_ops bmips_smp_ops;
  43. extern char bmips_reset_nmi_vec;
  44. extern char bmips_reset_nmi_vec_end;
  45. extern char bmips_smp_movevec;
  46. extern char bmips_smp_int_vec;
  47. extern char bmips_smp_int_vec_end;
  48. extern int bmips_smp_enabled;
  49. extern int bmips_cpu_offset;
  50. extern cpumask_t bmips_booted_mask;
  51. extern void bmips_ebase_setup(void);
  52. extern asmlinkage void plat_wired_tlb_setup(void);
  53. static inline unsigned long bmips_read_zscm_reg(unsigned int offset)
  54. {
  55. unsigned long ret;
  56. __asm__ __volatile__(
  57. ".set push\n"
  58. ".set noreorder\n"
  59. "cache %1, 0(%2)\n"
  60. "sync\n"
  61. "_ssnop\n"
  62. "_ssnop\n"
  63. "_ssnop\n"
  64. "_ssnop\n"
  65. "_ssnop\n"
  66. "_ssnop\n"
  67. "_ssnop\n"
  68. "mfc0 %0, $28, 3\n"
  69. "_ssnop\n"
  70. ".set pop\n"
  71. : "=&r" (ret)
  72. : "i" (Index_Load_Tag_S), "r" (ZSCM_REG_BASE + offset)
  73. : "memory");
  74. return ret;
  75. }
  76. static inline void bmips_write_zscm_reg(unsigned int offset, unsigned long data)
  77. {
  78. __asm__ __volatile__(
  79. ".set push\n"
  80. ".set noreorder\n"
  81. "mtc0 %0, $28, 3\n"
  82. "_ssnop\n"
  83. "_ssnop\n"
  84. "_ssnop\n"
  85. "cache %1, 0(%2)\n"
  86. "_ssnop\n"
  87. "_ssnop\n"
  88. "_ssnop\n"
  89. : /* no outputs */
  90. : "r" (data),
  91. "i" (Index_Store_Tag_S), "r" (ZSCM_REG_BASE + offset)
  92. : "memory");
  93. }
  94. #endif /* !defined(__ASSEMBLY__) */
  95. #endif /* _ASM_BMIPS_H */