]> git.sur5r.net Git - u-boot/blobdiff - arch/arm/include/asm/armv7.h
arm: imx: hab: Define HAB_RVT_BASE according to the processor version
[u-boot] / arch / arm / include / asm / armv7.h
index a20702e612b1b0a9fd31cc5a5eb141e1fa0894b1..efc515eb3348c902844d165f42f12e6c55ce177e 100644 (file)
 #include <asm/io.h>
 #include <asm/barriers.h>
 
+/* read L2 control register (L2CTLR) */
+static inline uint32_t read_l2ctlr(void)
+{
+       uint32_t val = 0;
+
+       asm volatile ("mrc p15, 1, %0, c9, c0, 2" : "=r" (val));
+
+       return val;
+}
+
+/* write L2 control register (L2CTLR) */
+static inline void write_l2ctlr(uint32_t val)
+{
+       /*
+        * Note: L2CTLR can only be written when the L2 memory system
+        * is idle, ie before the MMU is enabled.
+        */
+       asm volatile("mcr p15, 1, %0, c9, c0, 2" : : "r" (val) : "memory");
+       isb();
+}
+
 /*
  * Workaround for ARM errata # 798870
  * Set L2ACTLR[7] to reissue any memory transaction in the L2 that has been