jinkun.hong | 692a2c0 | 2015-01-07 08:57:48 +0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright 2014 Google Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
jinkun.hong | 692a2c0 | 2015-01-07 08:57:48 +0800 | [diff] [blame] | 14 | */ |
| 15 | #include <arch/io.h> |
| 16 | #include <boardid.h> |
| 17 | #include <console/console.h> |
| 18 | #include <gpio.h> |
| 19 | #include <soc/sdram.h> |
| 20 | #include <string.h> |
| 21 | #include <types.h> |
| 22 | |
| 23 | static struct rk3288_sdram_params sdram_configs[] = { |
| 24 | #include "sdram_inf/sdram-lpddr3-K4E8E304EE-1GB.inc" /* ram_code = 0000 */ |
| 25 | #include "sdram_inf/sdram-unused.inc" /* ram_code = 0001 */ |
| 26 | #include "sdram_inf/sdram-unused.inc" /* ram_code = 0010 */ |
| 27 | #include "sdram_inf/sdram-unused.inc" /* ram_code = 0011 */ |
| 28 | #include "sdram_inf/sdram-unused.inc" /* ram_code = 0100 */ |
| 29 | #include "sdram_inf/sdram-unused.inc" /* ram_code = 0101 */ |
| 30 | #include "sdram_inf/sdram-unused.inc" /* ram_code = 0110 */ |
| 31 | #include "sdram_inf/sdram-unused.inc" /* ram_code = 0111 */ |
| 32 | #include "sdram_inf/sdram-unused.inc" /* ram_code = 1000 */ |
| 33 | #include "sdram_inf/sdram-unused.inc" /* ram_code = 1001 */ |
| 34 | #include "sdram_inf/sdram-unused.inc" /* ram_code = 1010 */ |
| 35 | #include "sdram_inf/sdram-unused.inc" /* ram_code = 1011 */ |
| 36 | #include "sdram_inf/sdram-unused.inc" /* ram_code = 1100 */ |
| 37 | #include "sdram_inf/sdram-unused.inc" /* ram_code = 1101 */ |
| 38 | #include "sdram_inf/sdram-unused.inc" /* ram_code = 1110 */ |
| 39 | #include "sdram_inf/sdram-unused.inc" /* ram_code = 1111 */ |
| 40 | }; |
| 41 | |
| 42 | const struct rk3288_sdram_params *get_sdram_config() |
| 43 | { |
| 44 | u32 ramcode = ram_code(); |
| 45 | |
| 46 | if (ramcode >= ARRAY_SIZE(sdram_configs) |
| 47 | || sdram_configs[ramcode].dramtype == UNUSED) |
| 48 | die("Invalid RAMCODE."); |
| 49 | return &sdram_configs[ramcode]; |
| 50 | } |