aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/mips-cm.h
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2015-07-10 05:12:52 -0400
committerRalf Baechle <ralf@linux-mips.org>2015-08-26 09:23:08 -0400
commit197e89e0984a2aaf1a5a998887b22e53051e3b6d (patch)
tree6d923695b9b1622fc1b52fc1bac6dc4127289c3e /arch/mips/include/asm/mips-cm.h
parent5676319c91c8d668635ac0b9b6d9145c4fa418ac (diff)
MIPS: mips-cm: Implement mips_cm_revision
Provide a function to trivially return the version of the CM present in the system, or 0 if no CM is present. The mips_cm_revision() will be used later on to determine the CM register width, so it must not use the regular CM accessors to read the revision register since that will lead to build failures due to recursive inlines. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/10655/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/include/asm/mips-cm.h')
-rw-r--r--arch/mips/include/asm/mips-cm.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h
index edc7ee95269e..c70ba21e62f0 100644
--- a/arch/mips/include/asm/mips-cm.h
+++ b/arch/mips/include/asm/mips-cm.h
@@ -189,6 +189,13 @@ BUILD_CM_Cx_R_(tcid_8_priority, 0x80)
189#define CM_GCR_REV_MINOR_SHF 0 189#define CM_GCR_REV_MINOR_SHF 0
190#define CM_GCR_REV_MINOR_MSK (_ULCAST_(0xff) << 0) 190#define CM_GCR_REV_MINOR_MSK (_ULCAST_(0xff) << 0)
191 191
192#define CM_ENCODE_REV(major, minor) \
193 (((major) << CM_GCR_REV_MAJOR_SHF) | \
194 ((minor) << CM_GCR_REV_MINOR_SHF))
195
196#define CM_REV_CM2 CM_ENCODE_REV(6, 0)
197#define CM_REV_CM3 CM_ENCODE_REV(8, 0)
198
192/* GCR_ERROR_CAUSE register fields */ 199/* GCR_ERROR_CAUSE register fields */
193#define CM_GCR_ERROR_CAUSE_ERRTYPE_SHF 27 200#define CM_GCR_ERROR_CAUSE_ERRTYPE_SHF 27
194#define CM_GCR_ERROR_CAUSE_ERRTYPE_MSK (_ULCAST_(0x1f) << 27) 201#define CM_GCR_ERROR_CAUSE_ERRTYPE_MSK (_ULCAST_(0x1f) << 27)
@@ -324,4 +331,18 @@ static inline int mips_cm_l2sync(void)
324 return 0; 331 return 0;
325} 332}
326 333
334/**
335 * mips_cm_revision() - return CM revision
336 *
337 * Return: The revision of the CM, from GCR_REV, or 0 if no CM is present. The
338 * return value should be checked against the CM_REV_* macros.
339 */
340static inline int mips_cm_revision(void)
341{
342 if (!mips_cm_present())
343 return 0;
344
345 return read_gcr_rev();
346}
347
327#endif /* __MIPS_ASM_MIPS_CM_H__ */ 348#endif /* __MIPS_ASM_MIPS_CM_H__ */