Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2011 Kyösti Mälkki <kyosti.malkki@gmail.com> |
| 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; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <stdint.h> |
Kyösti Mälkki | 717b6e3 | 2018-05-17 14:16:03 +0300 | [diff] [blame] | 17 | #include <cbmem.h> |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 18 | #include <console/console.h> |
Kyösti Mälkki | 408d392 | 2016-06-17 10:43:48 +0300 | [diff] [blame] | 19 | #include <cpu/intel/romstage.h> |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 20 | |
Edward O'Callaghan | 77757c2 | 2015-01-04 21:33:39 +1100 | [diff] [blame] | 21 | #include <southbridge/intel/i82801dx/i82801dx.h> |
| 22 | #include <northbridge/intel/e7505/raminit.h> |
Kyösti Mälkki | 93b4ed9 | 2012-04-18 21:13:33 +0300 | [diff] [blame] | 23 | |
Elyes HAOUAS | dd35e2c | 2018-09-20 17:33:50 +0200 | [diff] [blame] | 24 | int spd_read_byte(unsigned int device, unsigned int address) |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 25 | { |
| 26 | return smbus_read_byte(device, address); |
| 27 | } |
| 28 | |
Kyösti Mälkki | 157b189 | 2019-08-16 14:02:25 +0300 | [diff] [blame^] | 29 | void mainboard_romstage_entry(void) |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 30 | { |
| 31 | static const struct mem_controller memctrl[] = { |
| 32 | { |
| 33 | .d0 = PCI_DEV(0, 0, 0), |
| 34 | .d0f1 = PCI_DEV(0, 0, 1), |
| 35 | .channel0 = { 0x50, 0x52, 0, 0 }, |
| 36 | .channel1 = { 0x51, 0x53, 0, 0 }, |
| 37 | }, |
| 38 | }; |
| 39 | |
Elyes HAOUAS | 4682986 | 2016-10-07 17:35:50 +0200 | [diff] [blame] | 40 | /* If this is a warm boot, some initialization can be skipped */ |
Kyösti Mälkki | 93b4ed9 | 2012-04-18 21:13:33 +0300 | [diff] [blame] | 41 | if (!e7505_mch_is_ready()) { |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 42 | enable_smbus(); |
Kyösti Mälkki | 97c064f | 2012-04-18 20:33:35 +0300 | [diff] [blame] | 43 | |
| 44 | /* The real MCH initialisation. */ |
| 45 | e7505_mch_init(memctrl); |
| 46 | |
Kyösti Mälkki | 97c064f | 2012-04-18 20:33:35 +0300 | [diff] [blame] | 47 | /* Hook for post ECC scrub settings and debug. */ |
| 48 | e7505_mch_done(memctrl); |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 49 | } |
| 50 | |
Kyösti Mälkki | 97c064f | 2012-04-18 20:33:35 +0300 | [diff] [blame] | 51 | printk(BIOS_DEBUG, "SDRAM is up.\n"); |
Kyösti Mälkki | 717b6e3 | 2018-05-17 14:16:03 +0300 | [diff] [blame] | 52 | |
| 53 | cbmem_recovery(0); |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 54 | } |