blob: a985d8cfae769c6e5bd527fe4737ba033dc21e1d [file] [log] [blame]
Nathan Williams1a169d22010-05-20 07:35:17 +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.
Nathan Williams1a169d22010-05-20 07:35:17 +000015 */
16
17#include <stdint.h>
Edwin Beasant9fb55cb2010-06-10 16:19:02 +000018#include <stdlib.h>
Nathan Williams1a169d22010-05-20 07:35:17 +000019#include <device/pci_def.h>
20#include <arch/io.h>
21#include <device/pnp_def.h>
Nathan Williams1a169d22010-05-20 07:35:17 +000022#include <console/console.h>
Patrick Georgid0835952010-10-05 09:07:10 +000023#include <lib.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110024#include <cpu/x86/bist.h>
25#include <cpu/x86/msr.h>
Nathan Williams1a169d22010-05-20 07:35:17 +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'Callaghan77757c22015-01-04 21:33:39 +110031#include <northbridge/amd/lx/raminit.h>
Nathan Williams1a169d22010-05-20 07:35:17 +000032
Christian Gmeinerc4e07bb2013-06-04 17:34:35 +020033int spd_read_byte(unsigned int device, unsigned int address)
Nathan Williams1a169d22010-05-20 07:35:17 +000034{
35 return smbus_read_byte(device, address);
36}
37
Nathan Williams1a169d22010-05-20 07:35:17 +000038#include "northbridge/amd/lx/pll_reset.c"
Nathan Williams1a169d22010-05-20 07:35:17 +000039#include "lib/generic_sdram.c"
Kyösti Mälkki7916f4c2012-02-09 16:07:41 +020040#include "cpu/amd/geode_lx/cpureginit.c"
41#include "cpu/amd/geode_lx/syspreinit.c"
42#include "cpu/amd/geode_lx/msrinit.c"
Nathan Williams1a169d22010-05-20 07:35:17 +000043
Aaron Durbina0a37272014-08-14 08:35:11 -050044#include <cpu/intel/romstage.h>
Nathan Williams1a169d22010-05-20 07:35:17 +000045void main(unsigned long bist)
46{
Nathan Williams1a169d22010-05-20 07:35:17 +000047 static const struct mem_controller memctrl[] = {
Uwe Hermann6dc92f02010-11-21 11:36:03 +000048 {.channel0 = {DIMM0, DIMM1}}
Nathan Williams1a169d22010-05-20 07:35:17 +000049 };
50
51 SystemPreInit();
52 msr_init();
53
54 cs5536_early_setup();
55
56 /* Note: must do this AFTER the early_setup! It is counting on some
57 * early MSR setup for CS5536.
58 */
59 /* cs5536_disable_internal_uart: disable them for now, set them
60 * up later...
61 */
Uwe Hermann607614d2010-11-18 20:12:13 +000062 /* If debug. real setup done in chipset init via devicetree.cb. */
Nathan Williams1a169d22010-05-20 07:35:17 +000063 cs5536_setup_onchipuart(1);
Nathan Williams1a169d22010-05-20 07:35:17 +000064 console_init();
65
66 /* 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();
Nathan Williams1a169d22010-05-20 07:35:17 +000070
Edwin Beasantf333ba02010-06-10 15:24:57 +000071 cpuRegInit(0, DIMM0, DIMM1, DRAM_TERMINATED);
Nathan Williams1a169d22010-05-20 07:35:17 +000072
73 sdram_initialize(1, memctrl);
74
Nathan Williams1a169d22010-05-20 07:35:17 +000075 /* Memory is setup. Return to cache_as_ram.inc and continue to boot. */
76 return;
77}