blob: 93740696e3aae7ce172f018545908f3a546a746b [file] [log] [blame]
Marc Jones9c9083b2007-05-04 18:47:52 +00001/*
Stefan Reinauer7e61e452008-01-18 10:35:56 +00002 * This file is part of the coreboot project.
Jordan Crouse50b0b872007-05-07 22:26:46 +00003 *
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.
Jordan Crouse50b0b872007-05-07 22:26:46 +000015 */
Marc Jones9c9083b2007-05-04 18:47:52 +000016
Marc Jones9c9083b2007-05-04 18:47:52 +000017#include <stdint.h>
Edwin Beasantf333ba02010-06-10 15:24:57 +000018#include <stdlib.h>
Marc Jones9c9083b2007-05-04 18:47:52 +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>
Marc Jones9c9083b2007-05-04 18:47:52 +000025#include <cpu/amd/lxdef.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110026#include <southbridge/amd/cs5536/cs5536.h>
Patrick Georgi9bd9a902010-11-20 10:31:00 +000027#include <spd.h>
stepan836ae292010-12-08 05:42:47 +000028#include "southbridge/amd/cs5536/early_smbus.c"
29#include "southbridge/amd/cs5536/early_setup.c"
Edward O'Callaghan77757c22015-01-04 21:33:39 +110030#include <northbridge/amd/lx/raminit.h>
Marc Jones9c9083b2007-05-04 18:47:52 +000031
Christian Gmeinerc4e07bb2013-06-04 17:34:35 +020032int spd_read_byte(unsigned int device, unsigned int address)
Marc Jones9c9083b2007-05-04 18:47:52 +000033{
Jordan Crouse89d7cd22007-05-10 18:00:24 +000034 return smbus_read_byte(device, address);
Marc Jones9c9083b2007-05-04 18:47:52 +000035}
36
Marc Jones9c9083b2007-05-04 18:47:52 +000037#include "northbridge/amd/lx/pll_reset.c"
Stefan Reinauerc13093b2009-09-23 18:51:03 +000038#include "lib/generic_sdram.c"
Kyösti Mälkki7916f4c2012-02-09 16:07:41 +020039#include "cpu/amd/geode_lx/cpureginit.c"
40#include "cpu/amd/geode_lx/syspreinit.c"
41#include "cpu/amd/geode_lx/msrinit.c"
Marc Jones9c9083b2007-05-04 18:47:52 +000042
Aaron Durbina0a37272014-08-14 08:35:11 -050043#include <cpu/intel/romstage.h>
Stefan Reinauer9839cbd2010-04-21 20:06:10 +000044void main(unsigned long bist)
Marc Jones9c9083b2007-05-04 18:47:52 +000045{
Marc Jones9c9083b2007-05-04 18:47:52 +000046
Jordan Crouse89d7cd22007-05-10 18:00:24 +000047 static const struct mem_controller memctrl[] = {
Uwe Hermann6dc92f02010-11-21 11:36:03 +000048 {.channel0 = {DIMM0, DIMM1}}
Marc Jones9c9083b2007-05-04 18:47:52 +000049 };
50
51 SystemPreInit();
52 msr_init();
53
54 cs5536_early_setup();
55
Uwe Hermann1e79f122007-05-21 21:33:24 +000056 /* Note: must do this AFTER the early_setup! It is counting on some
57 * early MSR setup for CS5536.
Marc Jones9c9083b2007-05-04 18:47:52 +000058 */
Uwe Hermann1e79f122007-05-21 21:33:24 +000059 /* 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. */
Edwin Beasante30db0e2010-02-09 10:22:33 +000063 cs5536_setup_onchipuart(1);
Marc Jones9c9083b2007-05-04 18:47:52 +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();
Marc Jones9c9083b2007-05-04 18:47:52 +000070
Edwin Beasantf333ba02010-06-10 15:24:57 +000071 cpuRegInit(0, DIMM0, DIMM1, DRAM_TERMINATED);
Marc Jones9c9083b2007-05-04 18:47:52 +000072
73 sdram_initialize(1, memctrl);
74
Uwe Hermannd83f79f2007-05-14 11:33:41 +000075 /* Memory is setup. Return to cache_as_ram.inc and continue to boot. */
Marc Jones9c9083b2007-05-04 18:47:52 +000076 return;
77}