Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 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. |
Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 17 | #include <stdint.h> |
Patrick Georgi | 12584e2 | 2010-05-08 09:14:51 +0000 | [diff] [blame] | 18 | #include <stdlib.h> |
Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 19 | #include <device/pci_def.h> |
| 20 | #include <arch/io.h> |
| 21 | #include <device/pnp_def.h> |
Stefan Reinauer | 720297c | 2010-04-02 22:11:20 +0000 | [diff] [blame] | 22 | #include <console/console.h> |
Edward O'Callaghan | 77757c2 | 2015-01-04 21:33:39 +1100 | [diff] [blame] | 23 | #include <cpu/x86/bist.h> |
| 24 | #include <cpu/x86/msr.h> |
Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 25 | #include <cpu/amd/lxdef.h> |
Edward O'Callaghan | 77757c2 | 2015-01-04 21:33:39 +1100 | [diff] [blame] | 26 | #include <southbridge/amd/cs5536/cs5536.h> |
Patrick Georgi | 9bd9a90 | 2010-11-20 10:31:00 +0000 | [diff] [blame] | 27 | #include <spd.h> |
stepan | 836ae29 | 2010-12-08 05:42:47 +0000 | [diff] [blame] | 28 | #include "southbridge/amd/cs5536/early_smbus.c" |
| 29 | #include "southbridge/amd/cs5536/early_setup.c" |
Edward O'Callaghan | 8199809 | 2014-04-28 18:07:33 +1000 | [diff] [blame] | 30 | #include <superio/winbond/common/winbond.h> |
| 31 | #include <superio/winbond/w83627hf/w83627hf.h> |
Edward O'Callaghan | 77757c2 | 2015-01-04 21:33:39 +1100 | [diff] [blame] | 32 | #include <northbridge/amd/lx/raminit.h> |
Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 33 | |
Uwe Hermann | 57b2ff8 | 2010-11-21 17:29:59 +0000 | [diff] [blame] | 34 | #define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1) |
| 35 | |
Christian Gmeiner | c4e07bb | 2013-06-04 17:34:35 +0200 | [diff] [blame] | 36 | int spd_read_byte(unsigned int device, unsigned int address) |
Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 37 | { |
| 38 | return smbus_read_byte(device, address); |
| 39 | } |
| 40 | |
Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 41 | #include "northbridge/amd/lx/pll_reset.c" |
Stefan Reinauer | c13093b | 2009-09-23 18:51:03 +0000 | [diff] [blame] | 42 | #include "lib/generic_sdram.c" |
Kyösti Mälkki | 7916f4c | 2012-02-09 16:07:41 +0200 | [diff] [blame] | 43 | #include "cpu/amd/geode_lx/cpureginit.c" |
| 44 | #include "cpu/amd/geode_lx/syspreinit.c" |
| 45 | #include "cpu/amd/geode_lx/msrinit.c" |
Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 46 | |
Aaron Durbin | a0a3727 | 2014-08-14 08:35:11 -0500 | [diff] [blame] | 47 | #include <cpu/intel/romstage.h> |
Stefan Reinauer | 9839cbd | 2010-04-21 20:06:10 +0000 | [diff] [blame] | 48 | void main(unsigned long bist) |
Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 49 | { |
Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 50 | |
| 51 | static const struct mem_controller memctrl[] = { |
Uwe Hermann | 6dc92f0 | 2010-11-21 11:36:03 +0000 | [diff] [blame] | 52 | {.channel0 = {DIMM0, DIMM1}} |
Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 53 | }; |
| 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'Callaghan | 8199809 | 2014-04-28 18:07:33 +1000 | [diff] [blame] | 63 | winbond_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE); |
Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 64 | console_init(); |
| 65 | |
Stefan Reinauer | 9839cbd | 2010-04-21 20:06:10 +0000 | [diff] [blame] | 66 | /* Halt if there was a built in self test failure */ |
| 67 | report_bist_failure(bist); |
| 68 | |
Patrick Georgi | 7dc2864 | 2012-07-13 19:06:22 +0200 | [diff] [blame] | 69 | pll_reset(); |
Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 70 | |
Edwin Beasant | f333ba0 | 2010-06-10 15:24:57 +0000 | [diff] [blame] | 71 | cpuRegInit(0, DIMM0, DIMM1, DRAM_TERMINATED); |
Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 72 | |
| 73 | sdram_initialize(1, memctrl); |
| 74 | |
Marc Jones | bd88057 | 2007-06-12 22:54:41 +0000 | [diff] [blame] | 75 | /* Memory is setup. Return to cache_as_ram.inc and continue to boot. */ |
| 76 | return; |
| 77 | } |