arm:omap: Add SRAM support for AM33xx
authorVaibhav Bedia <vaibhav.bedia@ti.com>
Wed, 28 Dec 2011 13:38:10 +0000 (19:08 +0530)
committerVaibhav Hiremath <hvaibhav@ti.com>
Mon, 23 Jan 2012 19:14:43 +0000 (00:44 +0530)
Just creates a gen_pool of 64KB which points to
OCMC RAM in AM33xx. A subsequent patch will add
code for copying the suspend code to SRAM

Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
arch/arm/plat-omap/include/plat/sram.h
arch/arm/plat-omap/sram.c

index bfe33ee795e64a74dab14d95e23f0d0655821f76..a60f643560a48cc595a8989f39a00abcf9d039fd 100644 (file)
@@ -108,4 +108,5 @@ static inline void omap_push_sram_idle(void) {}
 #else
 #define OMAP4_SRAM_PA          0x40300000
 #endif
 #else
 #define OMAP4_SRAM_PA          0x40300000
 #endif
+#define AM33XX_SRAM_PA         0x40300000
 #endif
 #endif
index 24100b528f88666e77795b0953aa22751aab7349..46378a22f6be99d3e89178623e75d0b08d428749 100644 (file)
@@ -85,7 +85,7 @@ static int is_sram_locked(void)
                        __raw_writel(0xCFDE, OMAP24XX_VA_READPERM0);  /* all i-read */
                        __raw_writel(0xCFDE, OMAP24XX_VA_WRITEPERM0); /* all i-write */
                }
                        __raw_writel(0xCFDE, OMAP24XX_VA_READPERM0);  /* all i-read */
                        __raw_writel(0xCFDE, OMAP24XX_VA_WRITEPERM0); /* all i-write */
                }
-               if (cpu_is_omap34xx()) {
+               if (cpu_is_omap34xx() && !cpu_is_am33xx()) {
                        __raw_writel(0xFFFF, OMAP34XX_VA_REQINFOPERM0); /* all q-vects */
                        __raw_writel(0xFFFF, OMAP34XX_VA_READPERM0);  /* all i-read */
                        __raw_writel(0xFFFF, OMAP34XX_VA_WRITEPERM0); /* all i-write */
                        __raw_writel(0xFFFF, OMAP34XX_VA_REQINFOPERM0); /* all q-vects */
                        __raw_writel(0xFFFF, OMAP34XX_VA_READPERM0);  /* all i-read */
                        __raw_writel(0xFFFF, OMAP34XX_VA_WRITEPERM0); /* all i-write */
@@ -110,7 +110,7 @@ static void __init omap_detect_sram(void)
 {
        if (cpu_class_is_omap2()) {
                if (is_sram_locked()) {
 {
        if (cpu_class_is_omap2()) {
                if (is_sram_locked()) {
-                       if (cpu_is_omap34xx()) {
+                       if (cpu_is_omap34xx() && !cpu_is_am33xx()) {
                                omap_sram_start = OMAP3_SRAM_PUB_PA;
                                if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||
                                    (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {
                                omap_sram_start = OMAP3_SRAM_PUB_PA;
                                if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||
                                    (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {
@@ -126,12 +126,15 @@ static void __init omap_detect_sram(void)
                                omap_sram_size = 0x800; /* 2K */
                        }
                } else {
                                omap_sram_size = 0x800; /* 2K */
                        }
                } else {
-                       if (cpu_is_omap34xx()) {
+                       if (cpu_is_omap34xx() && !cpu_is_am33xx()) {
                                omap_sram_start = OMAP3_SRAM_PA;
                                omap_sram_size = 0x10000; /* 64K */
                        } else if (cpu_is_omap44xx()) {
                                omap_sram_start = OMAP4_SRAM_PA;
                                omap_sram_size = 0xe000; /* 56K */
                                omap_sram_start = OMAP3_SRAM_PA;
                                omap_sram_size = 0x10000; /* 64K */
                        } else if (cpu_is_omap44xx()) {
                                omap_sram_start = OMAP4_SRAM_PA;
                                omap_sram_size = 0xe000; /* 56K */
+                       } else if (cpu_is_am33xx()) {
+                               omap_sram_start = AM33XX_SRAM_PA;
+                               omap_sram_size = 0x10000; /* 64K */
                        } else {
                                omap_sram_start = OMAP2_SRAM_PA;
                                if (cpu_is_omap242x())
                        } else {
                                omap_sram_start = OMAP2_SRAM_PA;
                                if (cpu_is_omap242x())
@@ -353,11 +356,13 @@ static inline int omap34xx_sram_init(void)
        return 0;
 }
 
        return 0;
 }
 
-int __init omap_sram_init(void)
+static inline int am33xx_sram_init(void)
 {
 {
-       if (cpu_is_am33xx())
-               return 0;
+       return 0;
+}
 
 
+int __init omap_sram_init(void)
+{
        omap_detect_sram();
        omap_map_sram();
 
        omap_detect_sram();
        omap_map_sram();
 
@@ -367,8 +372,10 @@ int __init omap_sram_init(void)
                omap242x_sram_init();
        else if (cpu_is_omap2430())
                omap243x_sram_init();
                omap242x_sram_init();
        else if (cpu_is_omap2430())
                omap243x_sram_init();
-       else if (cpu_is_omap34xx())
+       else if (cpu_is_omap34xx() && !cpu_is_am33xx())
                omap34xx_sram_init();
                omap34xx_sram_init();
+       else if (!cpu_is_am33xx())
+               am33xx_sram_init();
 
        return 0;
 }
 
        return 0;
 }