blob: 37b70e1fd116b56bdc3eaec0e07c64a50c6ca1b4 [file] [log] [blame]
Anish K. Patel3a54ac92010-02-24 16:36:56 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007 Advanced Micro Devices, Inc.
5 * Copyright (C) 2010 Win Enterprises, Inc (anishp@win-ent.com)
6 *
Anish K. Patel3a54ac92010-02-24 16:36:56 +00007 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
Anish K. Patel3a54ac92010-02-24 16:36:56 +000016 */
17
Anish K. Patel3a54ac92010-02-24 16:36:56 +000018#include <stdint.h>
Patrick Georgi12584e22010-05-08 09:14:51 +000019#include <stdlib.h>
Anish K. Patel3a54ac92010-02-24 16:36:56 +000020#include <device/pci_def.h>
21#include <arch/io.h>
22#include <device/pnp_def.h>
Patrick Georgi12584e22010-05-08 09:14:51 +000023#include <console/console.h>
Patrick Georgid0835952010-10-05 09:07:10 +000024#include <lib.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110025#include <cpu/x86/bist.h>
26#include <cpu/x86/msr.h>
Anish K. Patel3a54ac92010-02-24 16:36:56 +000027#include <cpu/amd/lxdef.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110028#include <southbridge/amd/cs5536/cs5536.h>
Patrick Georgi9bd9a902010-11-20 10:31:00 +000029#include <spd.h>
stepan836ae292010-12-08 05:42:47 +000030#include "southbridge/amd/cs5536/early_smbus.c"
31#include "southbridge/amd/cs5536/early_setup.c"
Edward O'Callaghanbeb0f262014-04-29 13:09:50 +100032#include <superio/winbond/common/winbond.h>
33#include <superio/winbond/w83627hf/w83627hf.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110034#include <northbridge/amd/lx/raminit.h>
Anish K. Patel3a54ac92010-02-24 16:36:56 +000035
Uwe Hermann57b2ff82010-11-21 17:29:59 +000036#define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
37
Christian Gmeinerc4e07bb2013-06-04 17:34:35 +020038int spd_read_byte(unsigned int device, unsigned int address)
Anish K. Patel3a54ac92010-02-24 16:36:56 +000039{
40 return smbus_read_byte(device, address);
41}
42
Anish K. Patel3a54ac92010-02-24 16:36:56 +000043#include "northbridge/amd/lx/pll_reset.c"
Anish K. Patel3a54ac92010-02-24 16:36:56 +000044#include "lib/generic_sdram.c"
Kyösti Mälkki7916f4c2012-02-09 16:07:41 +020045#include "cpu/amd/geode_lx/cpureginit.c"
46#include "cpu/amd/geode_lx/syspreinit.c"
47#include "cpu/amd/geode_lx/msrinit.c"
Anish K. Patel3a54ac92010-02-24 16:36:56 +000048
Aaron Durbina0a37272014-08-14 08:35:11 -050049#include <cpu/intel/romstage.h>
Stefan Reinauer9839cbd2010-04-21 20:06:10 +000050void main(unsigned long bist)
Anish K. Patel3a54ac92010-02-24 16:36:56 +000051{
Anish K. Patel3a54ac92010-02-24 16:36:56 +000052
53 static const struct mem_controller memctrl[] = {
Uwe Hermann6dc92f02010-11-21 11:36:03 +000054 {.channel0 = {DIMM0, DIMM1}}
Anish K. Patel3a54ac92010-02-24 16:36:56 +000055 };
56
57 SystemPreInit();
58 msr_init();
59
60 cs5536_early_setup();
61
62 /* Note: must do this AFTER the early_setup! It is counting on some
63 * early MSR setup for CS5536.
64 */
65 w83627hf_set_clksel_48(SERIAL_DEV);
Edward O'Callaghanbeb0f262014-04-29 13:09:50 +100066 winbond_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
Anish K. Patel3a54ac92010-02-24 16:36:56 +000067 console_init();
68
Stefan Reinauer9839cbd2010-04-21 20:06:10 +000069 /* Halt if there was a built in self test failure */
70 report_bist_failure(bist);
71
Patrick Georgi7dc28642012-07-13 19:06:22 +020072 pll_reset();
Anish K. Patel3a54ac92010-02-24 16:36:56 +000073
Edwin Beasantf333ba02010-06-10 15:24:57 +000074 cpuRegInit(0, DIMM0, DIMM1, DRAM_TERMINATED);
Anish K. Patel3a54ac92010-02-24 16:36:56 +000075
76 sdram_initialize(1, memctrl);
77
Anish K. Patel3a54ac92010-02-24 16:36:56 +000078 /* Memory is setup. Return to cache_as_ram.inc and continue to boot. */
Anish K. Patel3a54ac92010-02-24 16:36:56 +000079}