blob: eab4e609a1c2fa2d8cf7bc6e08bb2abaea54587e [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.
Daisuke Nojiria6712f32015-01-23 10:06:19 -080014 */
15
16#include <arch/cache.h>
17#include <arch/exception.h>
18#include <arch/stages.h>
19#include <armv7.h>
20#include <cbfs.h>
21#include <cbmem.h>
22#include <console/console.h>
23#include <delay.h>
24#include <program_loading.h>
Icarus Chau98558952015-03-03 19:36:03 -080025#include <soc/gpio.h>
Daisuke Nojiria6712f32015-01-23 10:06:19 -080026#include <soc/sdram.h>
27#include <stdlib.h>
28#include <symbols.h>
29#include <timestamp.h>
30#include <types.h>
31#include <vendorcode/google/chromeos/chromeos.h>
32
33void main(void)
34{
Daisuke Nojiri73dd7b62015-03-04 11:01:36 -080035 timestamp_add_now(TS_START_ROMSTAGE);
Daisuke Nojiria6712f32015-01-23 10:06:19 -080036
37 console_init();
38
Daisuke Nojiri73dd7b62015-03-04 11:01:36 -080039 timestamp_add_now(TS_BEFORE_INITRAM);
Daisuke Nojiria6712f32015-01-23 10:06:19 -080040 sdram_init();
Daisuke Nojiri73dd7b62015-03-04 11:01:36 -080041 timestamp_add_now(TS_AFTER_INITRAM);
Daisuke Nojiria6712f32015-01-23 10:06:19 -080042
Daisuke Nojiri99d39562015-03-02 14:38:37 -080043 /* Now that DRAM is up, add mappings for it and DMA coherency buffer. */
44 mmu_config_range((uintptr_t)_dram/MiB,
45 sdram_size_mb(), DCACHE_WRITEBACK);
46 mmu_config_range((uintptr_t)_dma_coherent/MiB,
47 _dma_coherent_size/MiB, DCACHE_OFF);
Icarus Chau98558952015-03-03 19:36:03 -080048 gpio_init();
Daisuke Nojiria6712f32015-01-23 10:06:19 -080049
50 cbmem_initialize_empty();
51
Daisuke Nojiria6712f32015-01-23 10:06:19 -080052 run_ramstage();
53}