blob: 7f66fc5aea4e69691aa8e02a35501ed224bd5f61 [file] [log] [blame]
Kyösti Mälkki91162702011-11-03 15:22:01 +02001/*
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älkki91162702011-11-03 15:22:01 +020014 */
15
16#include <stdint.h>
Kyösti Mälkki717b6e32018-05-17 14:16:03 +030017#include <cbmem.h>
Kyösti Mälkki91162702011-11-03 15:22:01 +020018#include <console/console.h>
Kyösti Mälkkicd7a70f2019-08-17 20:51:08 +030019#include <arch/romstage.h>
Kyösti Mälkki91162702011-11-03 15:22:01 +020020
Edward O'Callaghan77757c22015-01-04 21:33:39 +110021#include <southbridge/intel/i82801dx/i82801dx.h>
22#include <northbridge/intel/e7505/raminit.h>
Kyösti Mälkki93b4ed92012-04-18 21:13:33 +030023
Elyes HAOUASdd35e2c2018-09-20 17:33:50 +020024int spd_read_byte(unsigned int device, unsigned int address)
Kyösti Mälkki91162702011-11-03 15:22:01 +020025{
26 return smbus_read_byte(device, address);
27}
28
Kyösti Mälkki157b1892019-08-16 14:02:25 +030029void mainboard_romstage_entry(void)
Kyösti Mälkki91162702011-11-03 15:22:01 +020030{
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 HAOUAS46829862016-10-07 17:35:50 +020040 /* If this is a warm boot, some initialization can be skipped */
Kyösti Mälkki93b4ed92012-04-18 21:13:33 +030041 if (!e7505_mch_is_ready()) {
Kyösti Mälkki91162702011-11-03 15:22:01 +020042 enable_smbus();
Kyösti Mälkki97c064f2012-04-18 20:33:35 +030043
44 /* The real MCH initialisation. */
45 e7505_mch_init(memctrl);
46
Kyösti Mälkki97c064f2012-04-18 20:33:35 +030047 /* Hook for post ECC scrub settings and debug. */
48 e7505_mch_done(memctrl);
Kyösti Mälkki91162702011-11-03 15:22:01 +020049 }
50
Kyösti Mälkki97c064f2012-04-18 20:33:35 +030051 printk(BIOS_DEBUG, "SDRAM is up.\n");
Kyösti Mälkki717b6e32018-05-17 14:16:03 +030052
53 cbmem_recovery(0);
Kyösti Mälkki91162702011-11-03 15:22:01 +020054}