blob: 7bd1b74ba1ce6707abe1979972ccb35a7264990d [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
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
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>
26#include <arch/hlt.h>
Patrick Georgi12584e22010-05-08 09:14:51 +000027#include <console/console.h>
Nikolay Petukhov202625e2008-04-24 13:37:01 +000028#include "cpu/x86/bist.h"
29#include "cpu/x86/msr.h"
30#include <cpu/amd/lxdef.h>
Nikolay Petukhov202625e2008-04-24 13:37:01 +000031#include "southbridge/amd/cs5536/cs5536.h"
Patrick Georgi9bd9a902010-11-20 10:31:00 +000032#include <spd.h>
stepan836ae292010-12-08 05:42:47 +000033#include "southbridge/amd/cs5536/early_smbus.c"
34#include "southbridge/amd/cs5536/early_setup.c"
stepan8301d832010-12-08 07:07:33 +000035#include "superio/winbond/w83627hf/early_serial.c"
Nikolay Petukhov202625e2008-04-24 13:37:01 +000036
Uwe Hermann57b2ff82010-11-21 17:29:59 +000037#define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
38
Nikolay Petukhov202625e2008-04-24 13:37:01 +000039static inline int spd_read_byte(unsigned int device, unsigned int address)
40{
41 return smbus_read_byte(device, address);
42}
43
Nikolay Petukhov202625e2008-04-24 13:37:01 +000044#include "northbridge/amd/lx/raminit.h"
45#include "northbridge/amd/lx/pll_reset.c"
46#include "northbridge/amd/lx/raminit.c"
Stefan Reinauerc13093b2009-09-23 18:51:03 +000047#include "lib/generic_sdram.c"
Kyösti Mälkki7916f4c2012-02-09 16:07:41 +020048#include "cpu/amd/geode_lx/cpureginit.c"
49#include "cpu/amd/geode_lx/syspreinit.c"
50#include "cpu/amd/geode_lx/msrinit.c"
Nikolay Petukhov202625e2008-04-24 13:37:01 +000051
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 */
Stefan Reinauer08670622009-06-30 15:17:49 +000067 w83627hf_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}