blob: 1b3c70b59e017051275df392a3e1d346a7429916 [file] [log] [blame]
Duy Truongf3ac7b32013-02-13 01:07:28 -08001/* Copyright (c) 2009-2010, The Linux Foundation. All rights reserved.
Shashank Mittal23b8f422010-04-16 19:27:21 -07002 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are met:
5 * * Redistributions of source code must retain the above copyright
6 * notice, this list of conditions and the following disclaimer.
7 * * Redistributions in binary form must reproduce the above copyright
8 * notice, this list of conditions and the following disclaimer in the
9 * documentation and/or other materials provided with the distribution.
Duy Truongf3ac7b32013-02-13 01:07:28 -080010 * * Neither the name of The Linux Foundation nor
Shashank Mittal23b8f422010-04-16 19:27:21 -070011 * the names of its contributors may be used to endorse or promote
12 * products derived from this software without specific prior written
13 * permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 */
28
29#include <reg.h>
30#include <debug.h>
31#include <smem.h>
32
Ajay Dudanib01e5062011-12-03 23:23:42 -080033#define SIZE_44M 0x02C00000 // 44M
Subbaraman Narayanamurthy34d71172010-09-13 13:54:36 -070034#define EBI1_ADDR_1026M 0x40200000
Ajay Dudanib3af4172010-05-26 18:47:17 -070035
Ajay Dudanib01e5062011-12-03 23:23:42 -080036#define SIZE_128M 0x08000000 // 128M
Subbaraman Narayanamurthy34d71172010-09-13 13:54:36 -070037#define EBI1_ADDR_1152M 0x48000000
Shashank Mittal23b8f422010-04-16 19:27:21 -070038
Ajay Dudanib01e5062011-12-03 23:23:42 -080039#define SIZE_256M 0x10000000 // 256M
Subbaraman Narayanamurthy34d71172010-09-13 13:54:36 -070040#define EBI1_ADDR_1280M 0x50000000
41
Ajay Dudanib01e5062011-12-03 23:23:42 -080042#define SIZE_768M 0x30000000 // 256M + 512M
43#define SIZE_1792M 0x70000000 // 256M + 512M + 1G
Subbaraman Narayanamurthye2e081c2010-07-02 18:22:41 -070044
45#define EBI1_CS1_ADDR_BASE 0x00A40024
46
Ajay Dudanib01e5062011-12-03 23:23:42 -080047unsigned *target_atag_mem(unsigned *ptr)
Shashank Mittal23b8f422010-04-16 19:27:21 -070048{
Ajay Dudanib01e5062011-12-03 23:23:42 -080049 unsigned value = 0;
Subbaraman Narayanamurthye2e081c2010-07-02 18:22:41 -070050
Ajay Dudanib01e5062011-12-03 23:23:42 -080051 /* ATAG_MEM */
52 *ptr++ = 4;
53 *ptr++ = 0x54410002;
54 *ptr++ = SIZE_44M;
55 *ptr++ = EBI1_ADDR_1026M;
Ajay Dudanib3af4172010-05-26 18:47:17 -070056
Ajay Dudanib01e5062011-12-03 23:23:42 -080057 *ptr++ = 4;
58 *ptr++ = 0x54410002;
59 *ptr++ = SIZE_128M;
60 *ptr++ = EBI1_ADDR_1152M;
Subbaraman Narayanamurthye2e081c2010-07-02 18:22:41 -070061
Ajay Dudanib01e5062011-12-03 23:23:42 -080062 value = readl(EBI1_CS1_ADDR_BASE);
63 value = (value >> 8) & 0xFF;
Subbaraman Narayanamurthy34d71172010-09-13 13:54:36 -070064
Ajay Dudanib01e5062011-12-03 23:23:42 -080065 if (value == 0x50) {
66 /* For 512MB RAM */
67 *ptr++ = 4;
68 *ptr++ = 0x54410002;
69 *ptr++ = SIZE_256M;
70 *ptr++ = EBI1_ADDR_1280M;
71 } else if (value == 0x60) {
72 /* For 1GB RAM */
73 *ptr++ = 4;
74 *ptr++ = 0x54410002;
75 *ptr++ = SIZE_768M;
76 *ptr++ = EBI1_ADDR_1280M;
77 } else if (value == 0x80) {
78 /* For 2GB RAM */
79 *ptr++ = 4;
80 *ptr++ = 0x54410002;
81 //*ptr++ = SIZE_1792M;
82 *ptr++ = SIZE_768M;
83 *ptr++ = EBI1_ADDR_1280M;
84 }
Subbaraman Narayanamurthye2e081c2010-07-02 18:22:41 -070085
Ajay Dudanib01e5062011-12-03 23:23:42 -080086 return ptr;
Shashank Mittal23b8f422010-04-16 19:27:21 -070087}
88
89void *target_get_scratch_address(void)
90{
Ajay Dudanib01e5062011-12-03 23:23:42 -080091 return ((void *)SCRATCH_ADDR);
Shashank Mittal23b8f422010-04-16 19:27:21 -070092}
Vivek Mehta5f1c9d42011-04-01 20:11:59 -070093
94unsigned target_get_max_flash_size(void)
95{
Channagoud Kadabic83581f2011-12-13 12:32:35 +053096 return (384 * 1024 * 1024);
Vivek Mehta5f1c9d42011-04-01 20:11:59 -070097}