blob: 7c0423ab2ca41b4290733a279e77761dc84b272e [file] [log] [blame]
Mohammed Habibulla05497d02013-10-24 16:44:06 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007-2010 coresystems GmbH
5 * Copyright (C) 2012 Google Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
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.
Mohammed Habibulla05497d02013-10-24 16:44:06 -070015 */
16
Matt DeVillierae141dd2014-07-13 18:51:28 -050017#include <cbfs.h>
Mohammed Habibulla05497d02013-10-24 16:44:06 -070018#include <stdint.h>
19#include <stdlib.h>
20#include <string.h>
Mohammed Habibulla05497d02013-10-24 16:44:06 -070021#include <console/console.h>
22#include <cpu/intel/haswell/haswell.h>
23#include <northbridge/intel/haswell/haswell.h>
24#include <northbridge/intel/haswell/raminit.h>
Mohammed Habibulla05497d02013-10-24 16:44:06 -070025#include <southbridge/intel/lynxpoint/lp_gpio.h>
Matt DeVillierae141dd2014-07-13 18:51:28 -050026#include <southbridge/intel/lynxpoint/pch.h>
27#include <superio/ite/common/ite.h>
28#include <superio/ite/it8772f/it8772f.h>
Mohammed Habibulla05497d02013-10-24 16:44:06 -070029#include "gpio.h"
Mohammed Habibulla05497d02013-10-24 16:44:06 -070030
31#define SERIAL_DEV PNP_DEV(0x2e, IT8772F_SP1)
32#define GPIO_DEV PNP_DEV(0x2e, IT8772F_GPIO)
Edward O'Callaghan1f9653a2014-07-14 16:31:25 +100033#define DUMMY_DEV PNP_DEV(0x2e, 0)
Mohammed Habibulla05497d02013-10-24 16:44:06 -070034
35
36const struct rcba_config_instruction rcba_config[] = {
37
38 /*
39 * GFX INTA -> PIRQA (MSI)
40 * D28IP_P1IP PCIE INTA -> PIRQA
41 * D29IP_E1P EHCI INTA -> PIRQD
42 * D20IP_XHCI XHCI INTA -> PIRQC (MSI)
43 * D31IP_SIP SATA INTA -> PIRQF (MSI)
44 * D31IP_SMIP SMBUS INTB -> PIRQG
45 * D31IP_TTIP THRT INTC -> PIRQA
46 * D27IP_ZIP HDA INTA -> PIRQG (MSI)
47 */
48
49 /* Device interrupt pin register (board specific) */
50 RCBA_SET_REG_32(D31IP, (INTC << D31IP_TTIP) | (NOINT << D31IP_SIP2) |
51 (INTB << D31IP_SMIP) | (INTA << D31IP_SIP)),
52 RCBA_SET_REG_32(D29IP, (INTA << D29IP_E1P)),
53 RCBA_SET_REG_32(D28IP, (INTA << D28IP_P1IP) | (INTC << D28IP_P3IP) |
54 (INTB << D28IP_P4IP)),
55 RCBA_SET_REG_32(D27IP, (INTA << D27IP_ZIP)),
56 RCBA_SET_REG_32(D26IP, (INTA << D26IP_E2P)),
57 RCBA_SET_REG_32(D22IP, (NOINT << D22IP_MEI1IP)),
58 RCBA_SET_REG_32(D20IP, (INTA << D20IP_XHCI)),
59
60 /* Device interrupt route registers */
61 RCBA_SET_REG_32(D31IR, DIR_ROUTE(PIRQG, PIRQC, PIRQB, PIRQA)),/* LPC */
62 RCBA_SET_REG_32(D29IR, DIR_ROUTE(PIRQD, PIRQD, PIRQD, PIRQD)),/* EHCI */
63 RCBA_SET_REG_32(D28IR, DIR_ROUTE(PIRQA, PIRQB, PIRQC, PIRQD)),/* PCIE */
64 RCBA_SET_REG_32(D27IR, DIR_ROUTE(PIRQG, PIRQG, PIRQG, PIRQG)),/* HDA */
65 RCBA_SET_REG_32(D22IR, DIR_ROUTE(PIRQA, PIRQA, PIRQA, PIRQA)),/* ME */
66 RCBA_SET_REG_32(D21IR, DIR_ROUTE(PIRQE, PIRQF, PIRQF, PIRQF)),/* SIO */
67 RCBA_SET_REG_32(D20IR, DIR_ROUTE(PIRQC, PIRQC, PIRQC, PIRQC)),/* XHCI */
68 RCBA_SET_REG_32(D23IR, DIR_ROUTE(PIRQH, PIRQH, PIRQH, PIRQH)),/* SDIO */
69
70 /* Disable unused devices (board specific) */
71 RCBA_RMW_REG_32(FD, ~0, PCH_DISABLE_ALWAYS),
72
73 RCBA_END_CONFIG,
74};
75
76void mainboard_romstage_entry(unsigned long bist)
77{
78 struct pei_data pei_data = {
Matt DeVillier0fccebb2014-06-12 12:21:07 -050079 .pei_version = PEI_VERSION,
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080080 .mchbar = (uintptr_t)DEFAULT_MCHBAR,
81 .dmibar = (uintptr_t)DEFAULT_DMIBAR,
Matt DeVillier0fccebb2014-06-12 12:21:07 -050082 .epbar = DEFAULT_EPBAR,
83 .pciexbar = DEFAULT_PCIEXBAR,
84 .smbusbar = SMBUS_IO_BASE,
85 .wdbbar = 0x4000000,
86 .wdbsize = 0x1000,
87 .hpet_address = HPET_ADDR,
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080088 .rcba = (uintptr_t)DEFAULT_RCBA,
Matt DeVillier0fccebb2014-06-12 12:21:07 -050089 .pmbase = DEFAULT_PMBASE,
90 .gpiobase = DEFAULT_GPIOBASE,
91 .temp_mmio_base = 0xfed08000,
92 .system_type = 5, /* ULT */
93 .tseg_size = CONFIG_SMM_TSEG_SIZE,
94 .spd_addresses = { 0xa0, 0x00, 0xa4, 0x00 },
95 .ec_present = 0,
Mohammed Habibulla05497d02013-10-24 16:44:06 -070096 // 0 = leave channel enabled
97 // 1 = disable dimm 0 on channel
98 // 2 = disable dimm 1 on channel
99 // 3 = disable dimm 0+1 on channel
Matt DeVillier0fccebb2014-06-12 12:21:07 -0500100 .dimm_channel0_disabled = 2,
101 .dimm_channel1_disabled = 2,
Mohammed Habibulla05497d02013-10-24 16:44:06 -0700102 // Enable 2x refresh mode
Matt DeVillier0fccebb2014-06-12 12:21:07 -0500103 .ddr_refresh_2x = 1,
104 .dq_pins_interleaved = 1,
105 .max_ddr3_freq = 1600,
106 .usb_xhci_on_resume = 1,
107 .usb2_ports = {
Mohammed Habibulla05497d02013-10-24 16:44:06 -0700108 /* Length, Enable, OCn#, Location */
109 { 0x0064, 1, 0, /* P0: VP8 */
110 USB_PORT_MINI_PCIE },
111 { 0x0040, 1, 0, /* P1: Port A, CN22 */
112 USB_PORT_INTERNAL },
113 { 0x0040, 1, 1, /* P2: Port B, CN23 */
114 USB_PORT_INTERNAL },
115 { 0x0040, 1, USB_OC_PIN_SKIP, /* P3: WLAN */
116 USB_PORT_INTERNAL },
117 { 0x0040, 1, 2, /* P4: Port C, CN25 */
118 USB_PORT_INTERNAL },
119 { 0x0040, 1, 2, /* P5: Port D, CN25 */
120 USB_PORT_INTERNAL },
121 { 0x0040, 1, USB_OC_PIN_SKIP, /* P6: Card Reader */
122 USB_PORT_INTERNAL },
123 { 0x0000, 0, 0, /* P7: N/C */
124 USB_PORT_SKIP },
125 },
Matt DeVillier0fccebb2014-06-12 12:21:07 -0500126 .usb3_ports = {
Mohammed Habibulla05497d02013-10-24 16:44:06 -0700127 /* Enable, OCn# */
128 { 1, 0 }, /* P1; CN22 */
129 { 1, 1 }, /* P2; CN23 */
130 { 1, 2 }, /* P3; CN25 */
131 { 1, 2 }, /* P4; CN25 */
132 },
133 };
134
135 struct romstage_params romstage_params = {
136 .pei_data = &pei_data,
137 .gpio_map = &mainboard_gpio_map,
138 .rcba_config = &rcba_config[0],
139 .bist = bist,
140 };
141
142 /* Early SuperIO setup */
143 ite_kill_watchdog(GPIO_DEV);
Edward O'Callaghan1f9653a2014-07-14 16:31:25 +1000144 it8772f_ac_resume_southbridge(DUMMY_DEV);
Mohammed Habibulla05497d02013-10-24 16:44:06 -0700145 pch_enable_lpc();
146 ite_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
147
148 /* Call into the real romstage main with this board's attributes. */
149 romstage_common(&romstage_params);
150}