Andreas Schultz | 4c94c05 | 2010-08-30 16:22:22 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Original take from digitallogic/adl855pc |
| 5 | * |
| 6 | * Copyright (C) 2010 Travelping GmbH <info@travelping.com> |
| 7 | * |
| 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. |
| 12 | * |
| 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. |
Andreas Schultz | 4c94c05 | 2010-08-30 16:22:22 +0000 | [diff] [blame] | 17 | */ |
| 18 | |
| 19 | #include <stdint.h> |
| 20 | #include <device/pci_def.h> |
| 21 | #include <arch/io.h> |
| 22 | #include <device/pnp_def.h> |
Andreas Schultz | 4c94c05 | 2010-08-30 16:22:22 +0000 | [diff] [blame] | 23 | #include <stdlib.h> |
Uwe Hermann | 6e9ab97 | 2010-11-22 12:59:36 +0000 | [diff] [blame] | 24 | #include <lib.h> |
Uwe Hermann | 6dc92f0 | 2010-11-21 11:36:03 +0000 | [diff] [blame] | 25 | #include <spd.h> |
Andreas Schultz | 4c94c05 | 2010-08-30 16:22:22 +0000 | [diff] [blame] | 26 | #include <pc80/mc146818rtc.h> |
| 27 | #include <console/console.h> |
Edward O'Callaghan | 77757c2 | 2015-01-04 21:33:39 +1100 | [diff] [blame] | 28 | #include <southbridge/intel/i82801dx/i82801dx.h> |
| 29 | #include <northbridge/intel/i855/raminit.h> |
Andreas Schultz | 4c94c05 | 2010-08-30 16:22:22 +0000 | [diff] [blame] | 30 | #include "northbridge/intel/i855/debug.c" |
Edward O'Callaghan | 0dd0669 | 2014-04-29 13:59:54 +1000 | [diff] [blame] | 31 | #include <superio/winbond/common/winbond.h> |
Edward O'Callaghan | 4f5a525 | 2014-04-03 14:40:24 +1100 | [diff] [blame] | 32 | #include <superio/winbond/w83627thg/w83627thg.h> |
Edward O'Callaghan | 77757c2 | 2015-01-04 21:33:39 +1100 | [diff] [blame] | 33 | #include <cpu/x86/bist.h> |
Kyösti Mälkki | 07921540d | 2016-06-17 17:22:00 +0300 | [diff] [blame] | 34 | #include <cpu/intel/romstage.h> |
Andreas Schultz | 4c94c05 | 2010-08-30 16:22:22 +0000 | [diff] [blame] | 35 | |
Uwe Hermann | 2b6e93b | 2010-11-16 23:15:37 +0000 | [diff] [blame] | 36 | #define SERIAL_DEV PNP_DEV(0x2e, W83627THG_SP1) |
Andreas Schultz | 4c94c05 | 2010-08-30 16:22:22 +0000 | [diff] [blame] | 37 | |
| 38 | static inline int spd_read_byte(unsigned device, unsigned address) |
| 39 | { |
| 40 | return smbus_read_byte(device, address); |
| 41 | } |
| 42 | |
| 43 | #include "northbridge/intel/i855/raminit.c" |
| 44 | #include "northbridge/intel/i855/reset_test.c" |
Andreas Schultz | 4c94c05 | 2010-08-30 16:22:22 +0000 | [diff] [blame] | 45 | |
Kyösti Mälkki | 07921540d | 2016-06-17 17:22:00 +0300 | [diff] [blame] | 46 | void mainboard_romstage_entry(unsigned long bist) |
Andreas Schultz | 4c94c05 | 2010-08-30 16:22:22 +0000 | [diff] [blame] | 47 | { |
Andreas Schultz | 4c94c05 | 2010-08-30 16:22:22 +0000 | [diff] [blame] | 48 | if (bist == 0) { |
| 49 | #if 0 |
| 50 | enable_lapic(); |
| 51 | init_timer(); |
| 52 | #endif |
| 53 | } |
| 54 | |
Edward O'Callaghan | 0dd0669 | 2014-04-29 13:59:54 +1000 | [diff] [blame] | 55 | winbond_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE); |
| 56 | console_init(); |
Andreas Schultz | 4c94c05 | 2010-08-30 16:22:22 +0000 | [diff] [blame] | 57 | |
| 58 | /* Halt if there was a built in self test failure */ |
| 59 | report_bist_failure(bist); |
| 60 | |
| 61 | #if 0 |
| 62 | print_pci_devices(); |
| 63 | #endif |
| 64 | |
Uwe Hermann | 7b99705 | 2010-11-21 22:47:22 +0000 | [diff] [blame] | 65 | if (!bios_reset_detected()) { |
Elyes HAOUAS | aabd720 | 2016-09-28 21:10:08 +0200 | [diff] [blame^] | 66 | enable_smbus(); |
Andreas Schultz | 4c94c05 | 2010-08-30 16:22:22 +0000 | [diff] [blame] | 67 | #if 1 |
Uwe Hermann | 6e9ab97 | 2010-11-22 12:59:36 +0000 | [diff] [blame] | 68 | dump_spd_registers(); |
Andreas Schultz | 4c94c05 | 2010-08-30 16:22:22 +0000 | [diff] [blame] | 69 | dump_smbus_registers(); |
| 70 | #endif |
Uwe Hermann | 6e9ab97 | 2010-11-22 12:59:36 +0000 | [diff] [blame] | 71 | sdram_set_registers(); |
| 72 | sdram_set_spd_registers(); |
| 73 | sdram_enable(); |
Andreas Schultz | 4c94c05 | 2010-08-30 16:22:22 +0000 | [diff] [blame] | 74 | } |
Andreas Schultz | 4c94c05 | 2010-08-30 16:22:22 +0000 | [diff] [blame] | 75 | } |