]> Pileus Git - ~andy/linux/commitdiff
ARM: coresight: common definition for (OS) Lock Access Register key value
authorDietmar Eggemann <dietmar.eggemann@arm.com>
Sun, 14 Oct 2012 19:23:04 +0000 (20:23 +0100)
committerWill Deacon <will.deacon@arm.com>
Thu, 10 Jan 2013 21:13:05 +0000 (21:13 +0000)
Coresight components and debug are using a common lock control mechansim.
Writing 0xC5ACCE55 to the Lock Access Register (LAR) in case of a coresight
components enables further access to the coresight device registers. Writing
any other value to it removes the write access.
Writing 0xC5ACCE55 to the OS Lock Access Register (OSLAR) in case of debug
locks the debug register for further access to the debug registers. Writing
any other value to it unlocks the debug registers.

Unfortunately, the existing coresight code uses the terms lock and unlock the
other way around. Unlocking stands for enabling write access and locking for
removing write access.

That is why the definition of the LAR and OSLAR key value has been changed to
CS_LAR_KEY.

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm/include/asm/cti.h
arch/arm/include/asm/hardware/coresight.h
arch/arm/kernel/hw_breakpoint.c

index f2e5cad3f30655369b57edecf88d5c03c895e5f1..2381199acb7de9b7b32c1fdcc05663d34cd32f09 100644 (file)
@@ -2,6 +2,7 @@
 #define __ASMARM_CTI_H
 
 #include       <asm/io.h>
+#include       <asm/hardware/coresight.h>
 
 /* The registers' definition is from section 3.2 of
  * Embedded Cross Trigger Revision: r0p0
 #define                LOCKACCESS              0xFB0
 #define                LOCKSTATUS              0xFB4
 
-/* write this value to LOCKACCESS will unlock the module, and
- * other value will lock the module
- */
-#define                LOCKCODE                0xC5ACCE55
-
 /**
  * struct cti - cross trigger interface struct
  * @base: mapped virtual address for the cti base
@@ -146,7 +142,7 @@ static inline void cti_irq_ack(struct cti *cti)
  */
 static inline void cti_unlock(struct cti *cti)
 {
-       __raw_writel(LOCKCODE, cti->base + LOCKACCESS);
+       __raw_writel(CS_LAR_KEY, cti->base + LOCKACCESS);
 }
 
 /**
@@ -158,6 +154,6 @@ static inline void cti_unlock(struct cti *cti)
  */
 static inline void cti_lock(struct cti *cti)
 {
-       __raw_writel(~LOCKCODE, cti->base + LOCKACCESS);
+       __raw_writel(~CS_LAR_KEY, cti->base + LOCKACCESS);
 }
 #endif
index 7ecd793b8f5a94ebdbba19ee26ac9a75eaaa33d6..0cf7a6b842ff4ad40847394ea5ff8fd77bce29e7 100644 (file)
@@ -36,7 +36,7 @@
 /* CoreSight Component Registers */
 #define CSCR_CLASS     0xff4
 
-#define UNLOCK_MAGIC   0xc5acce55
+#define CS_LAR_KEY     0xc5acce55
 
 /* ETM control register, "ETM Architecture", 3.3.1 */
 #define ETMR_CTRL              0
 
 #define etm_lock(t) do { etm_writel((t), 0, CSMR_LOCKACCESS); } while (0)
 #define etm_unlock(t) \
-       do { etm_writel((t), UNLOCK_MAGIC, CSMR_LOCKACCESS); } while (0)
+       do { etm_writel((t), CS_LAR_KEY, CSMR_LOCKACCESS); } while (0)
 
 #define etb_lock(t) do { etb_writel((t), 0, CSMR_LOCKACCESS); } while (0)
 #define etb_unlock(t) \
-       do { etb_writel((t), UNLOCK_MAGIC, CSMR_LOCKACCESS); } while (0)
+       do { etb_writel((t), CS_LAR_KEY, CSMR_LOCKACCESS); } while (0)
 
 #endif /* __ASM_HARDWARE_CORESIGHT_H */
 
index 5ff2e77782b185cdcaf18a1636e00ce25b0cf733..34e9375d96a62fa67969b19c7d19686f78bcf3a2 100644 (file)
@@ -35,6 +35,7 @@
 #include <asm/hw_breakpoint.h>
 #include <asm/kdebug.h>
 #include <asm/traps.h>
+#include <asm/hardware/coresight.h>
 
 /* Breakpoint currently in use for each BRP. */
 static DEFINE_PER_CPU(struct perf_event *, bp_on_reg[ARM_MAX_BRP]);
@@ -955,9 +956,9 @@ static void reset_ctrl_regs(void *unused)
 
        /*
         * Unconditionally clear the OS lock by writing a value
-        * other than 0xC5ACCE55 to the access register.
+        * other than CS_LAR_KEY to the access register.
         */
-       ARM_DBG_WRITE(c1, c0, 4, 0);
+       ARM_DBG_WRITE(c1, c0, 4, ~CS_LAR_KEY);
        isb();
 
        /*