Nikolay Petukhov | 202625e | 2008-04-24 13:37:01 +0000 | [diff] [blame] | 1 | /* |
| 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 Petukhov | 202625e | 2008-04-24 13:37:01 +0000 | [diff] [blame] | 21 | #include <stdint.h> |
Edwin Beasant | f333ba0 | 2010-06-10 15:24:57 +0000 | [diff] [blame] | 22 | #include <stdlib.h> |
Nikolay Petukhov | 202625e | 2008-04-24 13:37:01 +0000 | [diff] [blame] | 23 | #include <device/pci_def.h> |
| 24 | #include <arch/io.h> |
| 25 | #include <device/pnp_def.h> |
| 26 | #include <arch/hlt.h> |
Patrick Georgi | 12584e2 | 2010-05-08 09:14:51 +0000 | [diff] [blame] | 27 | #include <console/console.h> |
Nikolay Petukhov | 202625e | 2008-04-24 13:37:01 +0000 | [diff] [blame] | 28 | #include "cpu/x86/bist.h" |
| 29 | #include "cpu/x86/msr.h" |
| 30 | #include <cpu/amd/lxdef.h> |
| 31 | #include <cpu/amd/geode_post_code.h> |
| 32 | #include "southbridge/amd/cs5536/cs5536.h" |
Patrick Georgi | 9bd9a90 | 2010-11-20 10:31:00 +0000 | [diff] [blame] | 33 | #include <spd.h> |
stepan | 836ae29 | 2010-12-08 05:42:47 +0000 | [diff] [blame^] | 34 | #include "southbridge/amd/cs5536/early_smbus.c" |
| 35 | #include "southbridge/amd/cs5536/early_setup.c" |
Nikolay Petukhov | 202625e | 2008-04-24 13:37:01 +0000 | [diff] [blame] | 36 | #include "superio/winbond/w83627hf/w83627hf_early_serial.c" |
| 37 | |
Uwe Hermann | 57b2ff8 | 2010-11-21 17:29:59 +0000 | [diff] [blame] | 38 | #define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1) |
| 39 | |
Nikolay Petukhov | 202625e | 2008-04-24 13:37:01 +0000 | [diff] [blame] | 40 | static inline int spd_read_byte(unsigned int device, unsigned int address) |
| 41 | { |
| 42 | return smbus_read_byte(device, address); |
| 43 | } |
| 44 | |
| 45 | #define ManualConf 1 /* Do automatic strapped PLL config */ |
| 46 | //#define PLLMSRhi 0x0000059C /* CPU and GLIU mult/div 500/400*/ |
| 47 | //#define PLLMSRhi 0x0000049C /* CPU and GLIU mult/div 500/333*/ |
| 48 | #define PLLMSRhi 0x0000039C /* CPU and GLIU mult/div 500/266*/ |
| 49 | //0x0000059C 0000 0000 0000 0000 0000 |0101 1|0|01 110|0 |
| 50 | /* Hold Count - how long we will sit in reset */ |
| 51 | #define PLLMSRlo 0x00DE6000 |
| 52 | |
Nikolay Petukhov | 202625e | 2008-04-24 13:37:01 +0000 | [diff] [blame] | 53 | #include "northbridge/amd/lx/raminit.h" |
| 54 | #include "northbridge/amd/lx/pll_reset.c" |
| 55 | #include "northbridge/amd/lx/raminit.c" |
Stefan Reinauer | c13093b | 2009-09-23 18:51:03 +0000 | [diff] [blame] | 56 | #include "lib/generic_sdram.c" |
Nikolay Petukhov | 202625e | 2008-04-24 13:37:01 +0000 | [diff] [blame] | 57 | #include "cpu/amd/model_lx/cpureginit.c" |
| 58 | #include "cpu/amd/model_lx/syspreinit.c" |
Stefan Reinauer | 9839cbd | 2010-04-21 20:06:10 +0000 | [diff] [blame] | 59 | #include "cpu/amd/model_lx/msrinit.c" |
Nikolay Petukhov | 202625e | 2008-04-24 13:37:01 +0000 | [diff] [blame] | 60 | |
Stefan Reinauer | 9839cbd | 2010-04-21 20:06:10 +0000 | [diff] [blame] | 61 | void main(unsigned long bist) |
Nikolay Petukhov | 202625e | 2008-04-24 13:37:01 +0000 | [diff] [blame] | 62 | { |
Stefan Reinauer | 0c781b2 | 2010-04-01 09:50:32 +0000 | [diff] [blame] | 63 | post_code(0x01); |
Nikolay Petukhov | 202625e | 2008-04-24 13:37:01 +0000 | [diff] [blame] | 64 | |
| 65 | static const struct mem_controller memctrl[] = { |
Uwe Hermann | 6dc92f0 | 2010-11-21 11:36:03 +0000 | [diff] [blame] | 66 | {.channel0 = {DIMM0, DIMM1}} |
Nikolay Petukhov | 202625e | 2008-04-24 13:37:01 +0000 | [diff] [blame] | 67 | }; |
| 68 | |
| 69 | SystemPreInit(); |
| 70 | msr_init(); |
| 71 | |
| 72 | cs5536_early_setup(); |
| 73 | |
| 74 | /* Note: must do this AFTER the early_setup! It is counting on some |
| 75 | * early MSR setup for CS5536. |
| 76 | */ |
Stefan Reinauer | 0867062 | 2009-06-30 15:17:49 +0000 | [diff] [blame] | 77 | w83627hf_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE); |
Nikolay Petukhov | 202625e | 2008-04-24 13:37:01 +0000 | [diff] [blame] | 78 | uart_init(); |
| 79 | console_init(); |
| 80 | |
Stefan Reinauer | 9839cbd | 2010-04-21 20:06:10 +0000 | [diff] [blame] | 81 | /* Halt if there was a built in self test failure */ |
| 82 | report_bist_failure(bist); |
| 83 | |
Nikolay Petukhov | 202625e | 2008-04-24 13:37:01 +0000 | [diff] [blame] | 84 | pll_reset(ManualConf); |
| 85 | |
Edwin Beasant | f333ba0 | 2010-06-10 15:24:57 +0000 | [diff] [blame] | 86 | cpuRegInit(0, DIMM0, DIMM1, DRAM_TERMINATED); |
Nikolay Petukhov | 202625e | 2008-04-24 13:37:01 +0000 | [diff] [blame] | 87 | |
| 88 | sdram_initialize(1, memctrl); |
| 89 | |
Nikolay Petukhov | 202625e | 2008-04-24 13:37:01 +0000 | [diff] [blame] | 90 | /* Memory is setup. Return to cache_as_ram.inc and continue to boot. */ |
| 91 | return; |
| 92 | } |