blob: e8897ac44f4854d5b8975633a41eaf1bc8d2ca99 [file] [log] [blame]
Christian Gmeiner86f992c2012-07-13 11:36:08 +02001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2012 Bachmann electronic GmbH
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; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Christian Gmeiner86f992c2012-07-13 11:36:08 +020015 */
16
17
18#include <stdlib.h>
19#include <stdint.h>
20#include <spd.h>
21#include <device/pci_def.h>
22#include <arch/io.h>
23#include <device/pnp_def.h>
Christian Gmeiner86f992c2012-07-13 11:36:08 +020024#include <console/console.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110025#include <cpu/x86/bist.h>
26#include <cpu/x86/msr.h>
Christian Gmeiner86f992c2012-07-13 11:36:08 +020027#include <cpu/amd/lxdef.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110028#include <southbridge/amd/cs5536/cs5536.h>
Christian Gmeiner86f992c2012-07-13 11:36:08 +020029#include "southbridge/amd/cs5536/early_smbus.c"
30#include "southbridge/amd/cs5536/early_setup.c"
Edward O'Callaghan77757c22015-01-04 21:33:39 +110031#include <northbridge/amd/lx/raminit.h>
Christian Gmeiner86f992c2012-07-13 11:36:08 +020032
Christian Gmeinerc4e07bb2013-06-04 17:34:35 +020033int spd_read_byte(unsigned int device, unsigned int address)
Christian Gmeiner86f992c2012-07-13 11:36:08 +020034{
35 return smbus_read_byte(device, address);
36}
37
Christian Gmeiner86f992c2012-07-13 11:36:08 +020038#include "northbridge/amd/lx/pll_reset.c"
Christian Gmeiner86f992c2012-07-13 11:36:08 +020039#include "lib/generic_sdram.c"
40#include "cpu/amd/geode_lx/cpureginit.c"
41#include "cpu/amd/geode_lx/syspreinit.c"
42#include "cpu/amd/geode_lx/msrinit.c"
43
Aaron Durbina0a37272014-08-14 08:35:11 -050044#include <cpu/intel/romstage.h>
Christian Gmeiner86f992c2012-07-13 11:36:08 +020045void main(unsigned long bist)
46{
47 static const struct mem_controller memctrl[] = {
48 {.channel0 = {DIMM0}}
49 };
50
51 SystemPreInit();
52 msr_init();
53
54 cs5536_early_setup();
55
56 /* Note: must do this AFTER the early_setup! It is counting on some
57 * early MSR setup for CS5536.
58 */
59 /* cs5536_disable_internal_uart: disable them for now, set them
60 * up later...
61 */
62 /* If debug. real setup done in chipset init via devicetree.cb. */
63 cs5536_setup_onchipuart(1);
64 console_init();
65
66 /* Halt if there was a built in self test failure */
67 report_bist_failure(bist);
68
Patrick Georgi7dc28642012-07-13 19:06:22 +020069 pll_reset();
Christian Gmeiner86f992c2012-07-13 11:36:08 +020070
71 cpuRegInit(0, DIMM0, DIMM1, DRAM_TERMINATED);
72
73 sdram_initialize(1, memctrl);
74
75 /* Memory is setup. Return to cache_as_ram.inc and continue to boot. */
76 return;
77}