blob: 401d362eca3d965c7becfcabae858ac2883f3987 [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.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
Paul Menzela46a7122013-02-23 18:37:27 +010018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Nikolay Petukhov202625e2008-04-24 13:37:01 +000019 */
20
Nikolay Petukhov202625e2008-04-24 13:37:01 +000021#include <stdint.h>
Edwin Beasantf333ba02010-06-10 15:24:57 +000022#include <stdlib.h>
Nikolay Petukhov202625e2008-04-24 13:37:01 +000023#include <device/pci_def.h>
24#include <arch/io.h>
25#include <device/pnp_def.h>
Patrick Georgi12584e22010-05-08 09:14:51 +000026#include <console/console.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110027#include <cpu/x86/bist.h>
28#include <cpu/x86/msr.h>
Nikolay Petukhov202625e2008-04-24 13:37:01 +000029#include <cpu/amd/lxdef.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110030#include <southbridge/amd/cs5536/cs5536.h>
Patrick Georgi9bd9a902010-11-20 10:31:00 +000031#include <spd.h>
stepan836ae292010-12-08 05:42:47 +000032#include "southbridge/amd/cs5536/early_smbus.c"
33#include "southbridge/amd/cs5536/early_setup.c"
Edward O'Callaghan81998092014-04-28 18:07:33 +100034#include <superio/winbond/common/winbond.h>
35#include <superio/winbond/w83627hf/w83627hf.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110036#include <northbridge/amd/lx/raminit.h>
Nikolay Petukhov202625e2008-04-24 13:37:01 +000037
Uwe Hermann57b2ff82010-11-21 17:29:59 +000038#define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
39
Christian Gmeinerc4e07bb2013-06-04 17:34:35 +020040int spd_read_byte(unsigned int device, unsigned int address)
Nikolay Petukhov202625e2008-04-24 13:37:01 +000041{
42 return smbus_read_byte(device, address);
43}
44
Nikolay Petukhov202625e2008-04-24 13:37:01 +000045#include "northbridge/amd/lx/pll_reset.c"
Stefan Reinauerc13093b2009-09-23 18:51:03 +000046#include "lib/generic_sdram.c"
Kyösti Mälkki7916f4c2012-02-09 16:07:41 +020047#include "cpu/amd/geode_lx/cpureginit.c"
48#include "cpu/amd/geode_lx/syspreinit.c"
49#include "cpu/amd/geode_lx/msrinit.c"
Nikolay Petukhov202625e2008-04-24 13:37:01 +000050
Aaron Durbina0a37272014-08-14 08:35:11 -050051#include <cpu/intel/romstage.h>
Stefan Reinauer9839cbd2010-04-21 20:06:10 +000052void main(unsigned long bist)
Nikolay Petukhov202625e2008-04-24 13:37:01 +000053{
Nikolay Petukhov202625e2008-04-24 13:37:01 +000054
55 static const struct mem_controller memctrl[] = {
Uwe Hermann6dc92f02010-11-21 11:36:03 +000056 {.channel0 = {DIMM0, DIMM1}}
Nikolay Petukhov202625e2008-04-24 13:37:01 +000057 };
58
59 SystemPreInit();
60 msr_init();
61
62 cs5536_early_setup();
63
64 /* Note: must do this AFTER the early_setup! It is counting on some
65 * early MSR setup for CS5536.
66 */
Edward O'Callaghan81998092014-04-28 18:07:33 +100067 winbond_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
Nikolay Petukhov202625e2008-04-24 13:37:01 +000068 console_init();
69
Stefan Reinauer9839cbd2010-04-21 20:06:10 +000070 /* Halt if there was a built in self test failure */
71 report_bist_failure(bist);
72
Patrick Georgi7dc28642012-07-13 19:06:22 +020073 pll_reset();
Nikolay Petukhov202625e2008-04-24 13:37:01 +000074
Edwin Beasantf333ba02010-06-10 15:24:57 +000075 cpuRegInit(0, DIMM0, DIMM1, DRAM_TERMINATED);
Nikolay Petukhov202625e2008-04-24 13:37:01 +000076
77 sdram_initialize(1, memctrl);
78
Nikolay Petukhov202625e2008-04-24 13:37:01 +000079 /* Memory is setup. Return to cache_as_ram.inc and continue to boot. */
Nikolay Petukhov202625e2008-04-24 13:37:01 +000080}