blob: 7d12e872d29e3aa543c5582d2e09b37cf070c15e [file] [log] [blame]
Uwe Hermann2e5a9d92008-10-12 11:58:26 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2008 Uwe Hermann <uwe@hermann-uwe.de>
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.
Uwe Hermann2e5a9d92008-10-12 11:58:26 +000015 */
16
Uwe Hermann2e5a9d92008-10-12 11:58:26 +000017#include <stdint.h>
18#include <device/pci_def.h>
19#include <device/pci_ids.h>
20#include <arch/io.h>
21#include <device/pnp_def.h>
Edwin Beasanteb50c7d2010-07-06 21:05:04 +000022#include <pc80/mc146818rtc.h>
Patrick Georgi12584e22010-05-08 09:14:51 +000023#include <console/console.h>
Patrick Georgid0835952010-10-05 09:07:10 +000024#include <lib.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110025#include <northbridge/via/cn700/raminit.h>
26#include <cpu/x86/bist.h>
Kyösti Mälkki52769412016-06-17 07:55:03 +030027#include <cpu/amd/car.h>
Edward O'Callaghanebe3a7a2015-01-05 00:27:54 +110028#include <delay.h>
stepan836ae292010-12-08 05:42:47 +000029#include "southbridge/via/vt8237r/early_smbus.c"
Edward O'Callaghanf2920022014-04-27 00:41:50 +100030#include <superio/ite/common/ite.h>
Edward O'Callaghan5c41ee62014-04-23 01:43:38 +100031#include <superio/ite/it8716f/it8716f.h>
Uwe Hermann6dc92f02010-11-21 11:36:03 +000032#include <spd.h>
Uwe Hermann2e5a9d92008-10-12 11:58:26 +000033
34#define SERIAL_DEV PNP_DEV(0x2e, IT8716F_SP1)
35
36static int spd_read_byte(u16 device, u16 address)
37{
38 return smbus_read_byte(device, address);
39}
40
41#include "northbridge/via/cn700/raminit.c"
42
43static const struct mem_controller ctrl = {
44 .d0f0 = 0x0000,
45 .d0f2 = 0x2000,
46 .d0f3 = 0x3000,
47 .d0f4 = 0x4000,
48 .d0f7 = 0x7000,
49 .d1f0 = 0x8000,
Uwe Hermannd773fd32010-11-20 20:23:08 +000050 .channel0 = { DIMM0 }, /* TODO: CN700 currently only supports 1 DIMM. */
Uwe Hermann2e5a9d92008-10-12 11:58:26 +000051};
52
Stefan Reinauer314e5512010-04-09 20:36:29 +000053void main(unsigned long bist)
Uwe Hermann2e5a9d92008-10-12 11:58:26 +000054{
55 /* Enable multifunction for northbridge. */
56 pci_write_config8(ctrl.d0f0, 0x4f, 0x01);
57
Edward O'Callaghanf2920022014-04-27 00:41:50 +100058 ite_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
Uwe Hermann2e5a9d92008-10-12 11:58:26 +000059 console_init();
Uwe Hermann2e5a9d92008-10-12 11:58:26 +000060 enable_smbus();
61 smbus_fixup(&ctrl);
Uwe Hermann2e5a9d92008-10-12 11:58:26 +000062 report_bist_failure(bist);
Uwe Hermann2e5a9d92008-10-12 11:58:26 +000063 ddr_ram_setup(&ctrl);
Uwe Hermann2e5a9d92008-10-12 11:58:26 +000064}