summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaura Lawrence <Laura.Lawrence@freescale.com>2008-04-15 12:19:07 -0500
committerDaniel Schaeffer <daniel.schaeffer@timesys.com>2008-08-25 15:21:01 -0400
commit2ac500ab6c3b7d00e7be61d8a6a70b4133840e6e (patch)
treec5187455144b3665867daf0d6da746b9948d30b9
parentea9d5465164f0fbb95b7de15c8b41393375b8f02 (diff)
ENGR00072757 Enable Access to IRAM on i.MX37
Enable access to IRAM through the SCC2 module Signed-off-by: Laura Lawrence <Laura.Lawrence@freescale.com>
-rw-r--r--arch/arm/mach-mx37/devices.c55
-rw-r--r--include/asm-arm/arch-mxc/mx37.h2
-rw-r--r--include/asm-arm/arch-mxc/mxc_scc2_driver.h4
3 files changed, 58 insertions, 3 deletions
diff --git a/arch/arm/mach-mx37/devices.c b/arch/arm/mach-mx37/devices.c
index cbe9f9649fe3..7561e1b9cf47 100644
--- a/arch/arm/mach-mx37/devices.c
+++ b/arch/arm/mach-mx37/devices.c
@@ -25,6 +25,7 @@
#include "iomux.h"
#include <asm/arch/sdma.h>
#include "sdma_script_code.h"
+#include <asm/arch/mxc_scc2_driver.h>
extern void gpio_spdif_active(void);
@@ -210,6 +211,60 @@ static void mxc_init_scc(void)
#else
static inline void mxc_init_scc(void)
{
+ uint32_t reg_value;
+ uint8_t *UMID_base;
+ uint32_t *MAP_base;
+ uint8_t i;
+ uint32_t partition_no;
+ void *scm_ram_base;
+ void *scc_base;
+
+ scc_base = ioremap((uint32_t) SCC_BASE_ADDR, 0x140);
+ if (scc_base == NULL) {
+ printk(KERN_ERR "FAILED TO MAP IRAM REGS\n");
+ return;
+ }
+ scm_ram_base = ioremap((uint32_t) IRAM_BASE_ADDR, IRAM_SIZE);
+ if (scm_ram_base == NULL) {
+ printk(KERN_ERR "FAILED TO MAP IRAM\n");
+ return;
+ }
+
+ for (partition_no = 0; partition_no < 9; partition_no++) {
+ reg_value = ((partition_no << SCM_ZCMD_PART_SHIFT) &
+ SCM_ZCMD_PART_MASK) | ((0x03 <<
+ SCM_ZCMD_CCMD_SHIFT)
+ & SCM_ZCMD_CCMD_MASK);
+ __raw_writel(reg_value, scc_base + SCM_ZCMD_REG);
+
+ while ((__raw_readl(scc_base + SCM_STATUS_REG) &
+ SCM_STATUS_SRS_READY) != SCM_STATUS_SRS_READY) ;
+
+ __raw_writel(0, scc_base + (SCM_SMID0_REG + 8 * partition_no));
+
+ reg_value = __raw_readl(scc_base + SCM_PART_OWNERS_REG);
+
+ if (((reg_value >> (2 * (partition_no))) & 3) != 3) {
+ printk(KERN_ERR "FAILED TO ACQUIRE IRAM PARTITION\n");
+ iounmap(scm_ram_base);
+ return;
+ }
+
+ MAP_base = scm_ram_base + (partition_no * 0x2000);
+ UMID_base = (uint8_t *) MAP_base + 0x10;
+
+ for (i = 0; i < 16; i++)
+ UMID_base[i] = 0;
+
+ MAP_base[0] = SCM_PERM_NO_ZEROIZE | SCM_PERM_HD_SUP_DISABLE |
+ SCM_PERM_HD_READ | SCM_PERM_HD_WRITE |
+ SCM_PERM_TH_READ | SCM_PERM_TH_WRITE;
+
+ }
+ iounmap(scm_ram_base);
+ iounmap(scc_base);
+ printk(KERN_INFO "IRAM READY\n");
+
}
#endif
diff --git a/include/asm-arm/arch-mxc/mx37.h b/include/asm-arm/arch-mxc/mx37.h
index 33f5a4606f44..e654835fcff7 100644
--- a/include/asm-arm/arch-mxc/mx37.h
+++ b/include/asm-arm/arch-mxc/mx37.h
@@ -70,7 +70,7 @@
*/
#define IRAM_BASE_ADDR 0x10000000 /* internal ram */
#define IRAM_BASE_ADDR_VIRT 0xF8000000
-#define IRAM_SIZE SZ_128K
+#define IRAM_SIZE (9*SZ_8K) /* 72KB */
/*
* NFC
diff --git a/include/asm-arm/arch-mxc/mxc_scc2_driver.h b/include/asm-arm/arch-mxc/mxc_scc2_driver.h
index ff26529fcde3..8898176850fa 100644
--- a/include/asm-arm/arch-mxc/mxc_scc2_driver.h
+++ b/include/asm-arm/arch-mxc/mxc_scc2_driver.h
@@ -1,6 +1,6 @@
/*
- * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2004-2008 Freescale Semiconductor, Inc. All Rights Reserved.
*/
/*
@@ -834,7 +834,7 @@ extern "C" {
/* MASTER ACCESS PERMISSIONS REGISTER */
/*! SCM Access Permission: Do not zeroize/deallocate partition on SMN Fail state */
-#define SCM_PERM_NO_ZEROIZE 0x10000000
+#define SCM_PERM_NO_ZEROIZE 0x80000000
/*! SCM Access Permission: Ignore Supervisor/User mode in permission determination */
#define SCM_PERM_HD_SUP_DISABLE 0x00000800
/*! SCM Access Permission: Allow Read Access to Host Domain */