blob: 6b8c73c92d3cb2ab8914fdd8ebe142e9d15c3b70 [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>
Kyösti Mälkki52769412016-06-17 07:55:03 +030025#include <cpu/amd/car.h>
Nikolay Petukhov202625e2008-04-24 13:37:01 +000026#include <cpu/amd/lxdef.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110027#include <southbridge/amd/cs5536/cs5536.h>
Patrick Georgi9bd9a902010-11-20 10:31:00 +000028#include <spd.h>
stepan836ae292010-12-08 05:42:47 +000029#include "southbridge/amd/cs5536/early_smbus.c"
30#include "southbridge/amd/cs5536/early_setup.c"
Edward O'Callaghan81998092014-04-28 18:07:33 +100031#include <superio/winbond/common/winbond.h>
32#include <superio/winbond/w83627hf/w83627hf.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110033#include <northbridge/amd/lx/raminit.h>
Nikolay Petukhov202625e2008-04-24 13:37:01 +000034
Uwe Hermann57b2ff82010-11-21 17:29:59 +000035#define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
36
Christian Gmeinerc4e07bb2013-06-04 17:34:35 +020037int spd_read_byte(unsigned int device, unsigned int address)
Nikolay Petukhov202625e2008-04-24 13:37:01 +000038{
39 return smbus_read_byte(device, address);
40}
41
Nikolay Petukhov202625e2008-04-24 13:37:01 +000042#include "northbridge/amd/lx/pll_reset.c"
Stefan Reinauerc13093b2009-09-23 18:51:03 +000043#include "lib/generic_sdram.c"
Kyösti Mälkki7916f4c2012-02-09 16:07:41 +020044#include "cpu/amd/geode_lx/cpureginit.c"
45#include "cpu/amd/geode_lx/syspreinit.c"
46#include "cpu/amd/geode_lx/msrinit.c"
Nikolay Petukhov202625e2008-04-24 13:37:01 +000047
Kyösti Mälkki8e1f9082017-03-07 11:10:55 +020048void asmlinkage mainboard_romstage_entry(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}