2 * This file is part of the coreboot project.
4 * Copyright (C) 2007 Advanced Micro Devices, Inc.
5 * Copyright (C) 2010 Win Enterprises, Inc (anishp@win-ent.com)
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 #include <device/pci_def.h>
29 #include <device/pnp_def.h>
31 #include "pc80/serial.c"
32 #include "arch/i386/lib/console.c"
33 #include "lib/ramtest.c"
34 #include "cpu/x86/bist.h"
35 #include "cpu/x86/msr.h"
36 #include <cpu/amd/lxdef.h>
37 #include <cpu/amd/geode_post_code.h>
38 #include "southbridge/amd/cs5536/cs5536.h"
40 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
41 #define POST_CODE(x) outb(x, 0x80)
42 #define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
44 #include "southbridge/amd/cs5536/cs5536_early_smbus.c"
45 #include "southbridge/amd/cs5536/cs5536_early_setup.c"
46 #include "superio/winbond/w83627hf/w83627hf_early_serial.c"
48 static inline int spd_read_byte(unsigned int device, unsigned int address)
50 return smbus_read_byte(device, address);
53 #define ManualConf 0 /* Do automatic strapped PLL config */
54 #define PLLMSRhi 0x00001490 /* Manual settings for the PLL */
55 #define PLLMSRlo 0x02000030
59 #include "northbridge/amd/lx/raminit.h"
60 #include "northbridge/amd/lx/pll_reset.c"
61 #include "northbridge/amd/lx/raminit.c"
62 #include "lib/generic_sdram.c"
63 #include "cpu/amd/model_lx/cpureginit.c"
64 #include "cpu/amd/model_lx/syspreinit.c"
71 static const struct msrinit msr_table[] =
73 {CPU_RCONF_DEFAULT, {.hi = 0x24fffc02,.lo = 0x1000A000}}, /* Setup access to cache under 1MB.
74 * Rom Properties: Write Serialize, WriteProtect.
76 * SysTop to RomBase Properties: Write Serialize, Cache Disable.
78 * System Memory Properties: (Write Back) */
79 {CPU_RCONF_A0_BF, {.hi = 0x00000000,.lo = 0x00000000}}, /* 0xA0000-0xBFFFF : (Write Back) */
80 {CPU_RCONF_C0_DF, {.hi = 0x00000000,.lo = 0x00000000}}, /* 0xC0000-0xDFFFF : (Write Back) */
81 {CPU_RCONF_E0_FF, {.hi = 0x00000000,.lo = 0x00000000}}, /* 0xE0000-0xFFFFF : (Write Back) */
83 /* Setup access to memory under 1MB. Note: VGA hole at 0xA0000-0xBFFFF */
84 {MSR_GLIU0_BASE1, {.hi = 0x20000000,.lo = 0x000fff80}}, // 0x00000-0x7FFFF
85 {MSR_GLIU0_BASE2, {.hi = 0x20000000,.lo = 0x080fffe0}}, // 0x80000-0x9FFFF
86 {MSR_GLIU0_SHADOW, {.hi = 0x2000FFFF,.lo = 0xFFFF0003}}, // 0xC0000-0xFFFFF
87 {MSR_GLIU1_BASE1, {.hi = 0x20000000,.lo = 0x000fff80}}, // 0x00000-0x7FFFF
88 {MSR_GLIU1_BASE2, {.hi = 0x20000000,.lo = 0x080fffe0}}, // 0x80000-0x9FFFF
89 {MSR_GLIU1_SHADOW, {.hi = 0x2000FFFF,.lo = 0xFFFF0003}}, // 0xC0000-0xFFFFF
93 static void msr_init(void)
96 for (i = 0; i < ARRAY_SIZE(msr_table); i++)
97 wrmsr(msr_table[i].msrnum, msr_table[i].msr);
100 static void mb_gpio_init(void)
102 /* Early mainboard specific GPIO setup. */
105 void cache_as_ram_main(void)
109 static const struct mem_controller memctrl[] = {
110 {.channel0 = {(0xa << 3) | 0, (0xa << 3) | 1}}
116 cs5536_early_setup();
118 /* Note: must do this AFTER the early_setup! It is counting on some
119 * early MSR setup for CS5536.
121 w83627hf_set_clksel_48(SERIAL_DEV);
122 w83627hf_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
127 pll_reset(ManualConf);
131 sdram_initialize(1, memctrl);
134 /* ram_check(0x00000000, 640 * 1024); */
136 /* Memory is setup. Return to cache_as_ram.inc and continue to boot. */