blob: c1a18349cff44cc45c2ace91bf3018688368fbe4 [file] [log] [blame]
Nikolay Petukhov202625e2008-04-24 13:37:01 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007 Advanced Micro Devices, 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; 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.
Nikolay Petukhov202625e2008-04-24 13:37:01 +000015 */
16
Nikolay Petukhov202625e2008-04-24 13:37:01 +000017#include <stdint.h>
Edwin Beasantf333ba02010-06-10 15:24:57 +000018#include <stdlib.h>
Nikolay Petukhov202625e2008-04-24 13:37:01 +000019#include <device/pci_def.h>
20#include <arch/io.h>
21#include <device/pnp_def.h>
Patrick Georgi12584e22010-05-08 09:14:51 +000022#include <console/console.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110023#include <cpu/x86/bist.h>
24#include <cpu/x86/msr.h>
Nikolay Petukhov202625e2008-04-24 13:37:01 +000025#include <cpu/amd/lxdef.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110026#include <southbridge/amd/cs5536/cs5536.h>
Patrick Georgi9bd9a902010-11-20 10:31:00 +000027#include <spd.h>
stepan836ae292010-12-08 05:42:47 +000028#include "southbridge/amd/cs5536/early_smbus.c"
29#include "southbridge/amd/cs5536/early_setup.c"
Edward O'Callaghan81998092014-04-28 18:07:33 +100030#include <superio/winbond/common/winbond.h>
31#include <superio/winbond/w83627hf/w83627hf.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110032#include <northbridge/amd/lx/raminit.h>
Nikolay Petukhov202625e2008-04-24 13:37:01 +000033
Uwe Hermann57b2ff82010-11-21 17:29:59 +000034#define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
35
Christian Gmeinerc4e07bb2013-06-04 17:34:35 +020036int spd_read_byte(unsigned int device, unsigned int address)
Nikolay Petukhov202625e2008-04-24 13:37:01 +000037{
38 return smbus_read_byte(device, address);
39}
40
Nikolay Petukhov202625e2008-04-24 13:37:01 +000041#include "northbridge/amd/lx/pll_reset.c"
Stefan Reinauerc13093b2009-09-23 18:51:03 +000042#include "lib/generic_sdram.c"
Kyösti Mälkki7916f4c2012-02-09 16:07:41 +020043#include "cpu/amd/geode_lx/cpureginit.c"
44#include "cpu/amd/geode_lx/syspreinit.c"
45#include "cpu/amd/geode_lx/msrinit.c"
Nikolay Petukhov202625e2008-04-24 13:37:01 +000046
Aaron Durbina0a37272014-08-14 08:35:11 -050047#include <cpu/intel/romstage.h>
Stefan Reinauer9839cbd2010-04-21 20:06:10 +000048void main(unsigned long bist)
Nikolay Petukhov202625e2008-04-24 13:37:01 +000049{
Nikolay Petukhov202625e2008-04-24 13:37:01 +000050
51 static const struct mem_controller memctrl[] = {
Uwe Hermann6dc92f02010-11-21 11:36:03 +000052 {.channel0 = {DIMM0, DIMM1}}
Nikolay Petukhov202625e2008-04-24 13:37:01 +000053 };
54
55 SystemPreInit();
56 msr_init();
57
58 cs5536_early_setup();
59
60 /* Note: must do this AFTER the early_setup! It is counting on some
61 * early MSR setup for CS5536.
62 */
Edward O'Callaghan81998092014-04-28 18:07:33 +100063 winbond_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
Nikolay Petukhov202625e2008-04-24 13:37:01 +000064 console_init();
65
Stefan Reinauer9839cbd2010-04-21 20:06:10 +000066 /* 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();
Nikolay Petukhov202625e2008-04-24 13:37:01 +000070
Edwin Beasantf333ba02010-06-10 15:24:57 +000071 cpuRegInit(0, DIMM0, DIMM1, DRAM_TERMINATED);
Nikolay Petukhov202625e2008-04-24 13:37:01 +000072
73 sdram_initialize(1, memctrl);
74
Nikolay Petukhov202625e2008-04-24 13:37:01 +000075 /* Memory is setup. Return to cache_as_ram.inc and continue to boot. */
Nikolay Petukhov202625e2008-04-24 13:37:01 +000076}