Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: OMAP: Move omap1 specific code to local sram.c

Let's make the omap1 specific parts private to mach-omap1.
These should not be in the shared code.

Signed-off-by: Tony Lindgren <tony@atomide.com>

+81 -47
+2 -1
arch/arm/mach-omap1/Makefile
··· 3 3 # 4 4 5 5 # Common support 6 - obj-y := io.o id.o sram.o time.o irq.o mux.o flash.o serial.o devices.o dma.o 6 + obj-y := io.o id.o sram-init.o sram.o time.o irq.o mux.o flash.o \ 7 + serial.o devices.o dma.o 7 8 obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o 8 9 9 10 ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
+76
arch/arm/mach-omap1/sram-init.c
··· 1 + /* 2 + * OMAP SRAM detection and management 3 + * 4 + * Copyright (C) 2005 Nokia Corporation 5 + * Written by Tony Lindgren <tony@atomide.com> 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License version 2 as 9 + * published by the Free Software Foundation. 10 + */ 11 + 12 + #include <linux/module.h> 13 + #include <linux/kernel.h> 14 + #include <linux/init.h> 15 + #include <linux/io.h> 16 + 17 + #include <asm/fncpy.h> 18 + #include <asm/tlb.h> 19 + #include <asm/cacheflush.h> 20 + 21 + #include <asm/mach/map.h> 22 + 23 + #include "soc.h" 24 + #include "sram.h" 25 + 26 + #define OMAP1_SRAM_PA 0x20000000 27 + #define SRAM_BOOTLOADER_SZ 0x80 28 + 29 + /* 30 + * The amount of SRAM depends on the core type. 31 + * Note that we cannot try to test for SRAM here because writes 32 + * to secure SRAM will hang the system. Also the SRAM is not 33 + * yet mapped at this point. 34 + */ 35 + static void __init omap_detect_and_map_sram(void) 36 + { 37 + unsigned long omap_sram_skip = SRAM_BOOTLOADER_SZ; 38 + unsigned long omap_sram_start = OMAP1_SRAM_PA; 39 + unsigned long omap_sram_size; 40 + 41 + if (cpu_is_omap7xx()) 42 + omap_sram_size = 0x32000; /* 200K */ 43 + else if (cpu_is_omap15xx()) 44 + omap_sram_size = 0x30000; /* 192K */ 45 + else if (cpu_is_omap1610() || cpu_is_omap1611() || 46 + cpu_is_omap1621() || cpu_is_omap1710()) 47 + omap_sram_size = 0x4000; /* 16K */ 48 + else { 49 + pr_err("Could not detect SRAM size\n"); 50 + omap_sram_size = 0x4000; 51 + } 52 + 53 + omap_map_sram(omap_sram_start, omap_sram_size, 54 + omap_sram_skip, 1); 55 + } 56 + 57 + static void (*_omap_sram_reprogram_clock)(u32 dpllctl, u32 ckctl); 58 + 59 + void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl) 60 + { 61 + BUG_ON(!_omap_sram_reprogram_clock); 62 + /* On 730, bit 13 must always be 1 */ 63 + if (cpu_is_omap7xx()) 64 + ckctl |= 0x2000; 65 + _omap_sram_reprogram_clock(dpllctl, ckctl); 66 + } 67 + 68 + int __init omap_sram_init(void) 69 + { 70 + omap_detect_and_map_sram(); 71 + _omap_sram_reprogram_clock = 72 + omap_sram_push(omap1_sram_reprogram_clock, 73 + omap1_sram_reprogram_clock_sz); 74 + 75 + return 0; 76 + }
+3 -46
arch/arm/plat-omap/sram.c
··· 26 26 27 27 #include <asm/mach/map.h> 28 28 29 - #include "../mach-omap1/soc.h" 30 - #include "../mach-omap1/sram.h" 31 29 #include "../mach-omap2/soc.h" 32 30 #include "../mach-omap2/sram.h" 33 31 ··· 34 36 #include "../mach-omap2/prm2xxx_3xxx.h" 35 37 #include "../mach-omap2/sdrc.h" 36 38 37 - #define OMAP1_SRAM_PA 0x20000000 38 39 #define OMAP2_SRAM_PUB_PA (OMAP2_SRAM_PA + 0xf800) 39 40 #define OMAP3_SRAM_PUB_PA (OMAP3_SRAM_PA + 0x8000) 40 41 #ifdef CONFIG_OMAP4_ERRATA_I688 ··· 147 150 omap_sram_size = 0x10000; /* 64K */ 148 151 } 149 152 } 150 - } else { 151 - omap_sram_start = OMAP1_SRAM_PA; 152 - 153 - if (cpu_is_omap7xx()) 154 - omap_sram_size = 0x32000; /* 200K */ 155 - else if (cpu_is_omap15xx()) 156 - omap_sram_size = 0x30000; /* 192K */ 157 - else if (cpu_is_omap1610() || cpu_is_omap1611() || 158 - cpu_is_omap1621() || cpu_is_omap1710()) 159 - omap_sram_size = 0x4000; /* 16K */ 160 - else { 161 - pr_err("Could not detect SRAM size\n"); 162 - omap_sram_size = 0x4000; 163 - } 164 153 } 165 154 } 166 155 ··· 239 256 memset_io(omap_sram_base + omap_sram_skip, 0, 240 257 omap_sram_size - omap_sram_skip); 241 258 } 242 - 243 - #ifdef CONFIG_ARCH_OMAP1 244 - 245 - static void (*_omap_sram_reprogram_clock)(u32 dpllctl, u32 ckctl); 246 - 247 - void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl) 248 - { 249 - BUG_ON(!_omap_sram_reprogram_clock); 250 - /* On 730, bit 13 must always be 1 */ 251 - if (cpu_is_omap7xx()) 252 - ckctl |= 0x2000; 253 - _omap_sram_reprogram_clock(dpllctl, ckctl); 254 - } 255 - 256 - static int __init omap1_sram_init(void) 257 - { 258 - _omap_sram_reprogram_clock = 259 - omap_sram_push(omap1_sram_reprogram_clock, 260 - omap1_sram_reprogram_clock_sz); 261 - 262 - return 0; 263 - } 264 - 265 - #else 266 - #define omap1_sram_init() do {} while (0) 267 - #endif 268 259 269 260 #if defined(CONFIG_ARCH_OMAP2) 270 261 ··· 364 407 return 0; 365 408 } 366 409 410 + #ifdef CONFIG_ARCH_OMAP2PLUS 367 411 int __init omap_sram_init(void) 368 412 { 369 413 omap_detect_sram(); 370 414 omap_fix_and_map_sram(); 371 415 372 - if (!(cpu_class_is_omap2())) 373 - omap1_sram_init(); 374 - else if (cpu_is_omap242x()) 416 + if (cpu_is_omap242x()) 375 417 omap242x_sram_init(); 376 418 else if (cpu_is_omap2430()) 377 419 omap243x_sram_init(); ··· 381 425 382 426 return 0; 383 427 } 428 + #endif