Christian Gmeiner | 86f992c | 2012-07-13 11:36:08 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2012 Bachmann electronic GmbH |
| 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 |
Paul Menzel | a46a712 | 2013-02-23 18:37:27 +0100 | [diff] [blame] | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Christian Gmeiner | 86f992c | 2012-07-13 11:36:08 +0200 | [diff] [blame] | 19 | */ |
| 20 | |
| 21 | |
| 22 | #include <stdlib.h> |
| 23 | #include <stdint.h> |
| 24 | #include <spd.h> |
| 25 | #include <device/pci_def.h> |
| 26 | #include <arch/io.h> |
| 27 | #include <device/pnp_def.h> |
| 28 | #include <arch/hlt.h> |
| 29 | #include <console/console.h> |
| 30 | #include "cpu/x86/bist.h" |
| 31 | #include "cpu/x86/msr.h" |
| 32 | #include <cpu/amd/lxdef.h> |
| 33 | #include "southbridge/amd/cs5536/cs5536.h" |
| 34 | #include "southbridge/amd/cs5536/early_smbus.c" |
| 35 | #include "southbridge/amd/cs5536/early_setup.c" |
Christian Gmeiner | 4eb5aa2 | 2013-06-04 17:27:22 +0200 | [diff] [blame] | 36 | #include "northbridge/amd/lx/raminit.h" |
Christian Gmeiner | 86f992c | 2012-07-13 11:36:08 +0200 | [diff] [blame] | 37 | |
Christian Gmeiner | c4e07bb | 2013-06-04 17:34:35 +0200 | [diff] [blame^] | 38 | int spd_read_byte(unsigned int device, unsigned int address) |
Christian Gmeiner | 86f992c | 2012-07-13 11:36:08 +0200 | [diff] [blame] | 39 | { |
| 40 | return smbus_read_byte(device, address); |
| 41 | } |
| 42 | |
Christian Gmeiner | 86f992c | 2012-07-13 11:36:08 +0200 | [diff] [blame] | 43 | #include "northbridge/amd/lx/pll_reset.c" |
| 44 | #include "northbridge/amd/lx/raminit.c" |
| 45 | #include "lib/generic_sdram.c" |
| 46 | #include "cpu/amd/geode_lx/cpureginit.c" |
| 47 | #include "cpu/amd/geode_lx/syspreinit.c" |
| 48 | #include "cpu/amd/geode_lx/msrinit.c" |
| 49 | |
| 50 | void main(unsigned long bist) |
| 51 | { |
| 52 | static const struct mem_controller memctrl[] = { |
| 53 | {.channel0 = {DIMM0}} |
| 54 | }; |
| 55 | |
| 56 | SystemPreInit(); |
| 57 | msr_init(); |
| 58 | |
| 59 | cs5536_early_setup(); |
| 60 | |
| 61 | /* Note: must do this AFTER the early_setup! It is counting on some |
| 62 | * early MSR setup for CS5536. |
| 63 | */ |
| 64 | /* cs5536_disable_internal_uart: disable them for now, set them |
| 65 | * up later... |
| 66 | */ |
| 67 | /* If debug. real setup done in chipset init via devicetree.cb. */ |
| 68 | cs5536_setup_onchipuart(1); |
| 69 | console_init(); |
| 70 | |
| 71 | /* Halt if there was a built in self test failure */ |
| 72 | report_bist_failure(bist); |
| 73 | |
Patrick Georgi | 7dc2864 | 2012-07-13 19:06:22 +0200 | [diff] [blame] | 74 | pll_reset(); |
Christian Gmeiner | 86f992c | 2012-07-13 11:36:08 +0200 | [diff] [blame] | 75 | |
| 76 | cpuRegInit(0, DIMM0, DIMM1, DRAM_TERMINATED); |
| 77 | |
| 78 | sdram_initialize(1, memctrl); |
| 79 | |
| 80 | /* Memory is setup. Return to cache_as_ram.inc and continue to boot. */ |
| 81 | return; |
| 82 | } |