Gabe Black | 607c0b6 | 2013-05-16 05:45:57 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright 2013 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. |
Gabe Black | 607c0b6 | 2013-05-16 05:45:57 -0700 | [diff] [blame] | 14 | */ |
| 15 | |
Gabe Black | ee4bfbf | 2013-08-13 21:05:43 -0700 | [diff] [blame] | 16 | #include <arch/cache.h> |
Julius Werner | 80af442 | 2014-10-20 13:18:56 -0700 | [diff] [blame] | 17 | #include <bootblock_common.h> |
| 18 | #include <soc/clk.h> |
| 19 | #include <soc/wakeup.h> |
| 20 | #include <soc/cpu.h> |
Gabe Black | 607c0b6 | 2013-05-16 05:45:57 -0700 | [diff] [blame] | 21 | |
Gabe Black | ee4bfbf | 2013-08-13 21:05:43 -0700 | [diff] [blame] | 22 | /* convenient shorthand (in MB) */ |
Julius Werner | f0cd03c | 2013-09-19 20:15:45 -0700 | [diff] [blame] | 23 | #define SRAM_START (EXYNOS5_SRAM_BASE >> 20) |
Gabe Black | ee4bfbf | 2013-08-13 21:05:43 -0700 | [diff] [blame] | 24 | #define SRAM_SIZE 1 |
| 25 | #define SRAM_END (SRAM_START + SRAM_SIZE) /* plus one... */ |
| 26 | |
Vadim Bendebury | 0b341b3 | 2014-04-23 11:09:44 -0700 | [diff] [blame] | 27 | void bootblock_soc_init(void) |
Gabe Black | 607c0b6 | 2013-05-16 05:45:57 -0700 | [diff] [blame] | 28 | { |
Gabe Black | 607c0b6 | 2013-05-16 05:45:57 -0700 | [diff] [blame] | 29 | if (get_wakeup_state() == WAKEUP_DIRECT) { |
| 30 | wakeup(); |
| 31 | /* Never returns. */ |
| 32 | } |
| 33 | |
Gabe Black | ee4bfbf | 2013-08-13 21:05:43 -0700 | [diff] [blame] | 34 | /* set up dcache and MMU */ |
| 35 | mmu_init(); |
Julius Werner | f0cd03c | 2013-09-19 20:15:45 -0700 | [diff] [blame] | 36 | mmu_disable_range(0, SRAM_START); |
Gabe Black | ee4bfbf | 2013-08-13 21:05:43 -0700 | [diff] [blame] | 37 | mmu_config_range(SRAM_START, SRAM_SIZE, DCACHE_WRITEBACK); |
| 38 | mmu_config_range(SRAM_END, 4096 - SRAM_END, DCACHE_OFF); |
Gabe Black | ee4bfbf | 2013-08-13 21:05:43 -0700 | [diff] [blame] | 39 | dcache_mmu_enable(); |
| 40 | |
Gabe Black | 607c0b6 | 2013-05-16 05:45:57 -0700 | [diff] [blame] | 41 | /* For most ARM systems, we have to initialize firmware media source |
| 42 | * (ex, SPI, SD/MMC, or eMMC) now; but for Exynos platform, that is |
| 43 | * already handled by iROM so there's no need to setup again. |
| 44 | */ |
Gabe Black | 607c0b6 | 2013-05-16 05:45:57 -0700 | [diff] [blame] | 45 | } |