blob: 6f169b35e94dea6124c51874cc6ee797720226f4 [file] [log] [blame]
Daisuke Nojiria6712f32015-01-23 10:06:19 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2015 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.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#include <arch/cache.h>
21#include <arch/exception.h>
22#include <arch/stages.h>
23#include <armv7.h>
24#include <cbfs.h>
25#include <cbmem.h>
26#include <console/console.h>
27#include <delay.h>
28#include <program_loading.h>
Icarus Chau98558952015-03-03 19:36:03 -080029#include <soc/gpio.h>
Daisuke Nojiria6712f32015-01-23 10:06:19 -080030#include <soc/sdram.h>
31#include <stdlib.h>
32#include <symbols.h>
33#include <timestamp.h>
34#include <types.h>
35#include <vendorcode/google/chromeos/chromeos.h>
36
37void main(void)
38{
Daisuke Nojiri73dd7b62015-03-04 11:01:36 -080039 timestamp_add_now(TS_START_ROMSTAGE);
Daisuke Nojiria6712f32015-01-23 10:06:19 -080040
41 console_init();
42
Daisuke Nojiri73dd7b62015-03-04 11:01:36 -080043 timestamp_add_now(TS_BEFORE_INITRAM);
Daisuke Nojiria6712f32015-01-23 10:06:19 -080044 sdram_init();
Daisuke Nojiri73dd7b62015-03-04 11:01:36 -080045 timestamp_add_now(TS_AFTER_INITRAM);
Daisuke Nojiria6712f32015-01-23 10:06:19 -080046
Daisuke Nojiri99d39562015-03-02 14:38:37 -080047 /* Now that DRAM is up, add mappings for it and DMA coherency buffer. */
48 mmu_config_range((uintptr_t)_dram/MiB,
49 sdram_size_mb(), DCACHE_WRITEBACK);
50 mmu_config_range((uintptr_t)_dma_coherent/MiB,
51 _dma_coherent_size/MiB, DCACHE_OFF);
Icarus Chau98558952015-03-03 19:36:03 -080052 gpio_init();
Daisuke Nojiria6712f32015-01-23 10:06:19 -080053
54 cbmem_initialize_empty();
55
Daisuke Nojiria6712f32015-01-23 10:06:19 -080056 run_ramstage();
57}