blob: 186d16d354a3d7dddd0ba3d2582da6e0de2bac77 [file] [log] [blame]
Stefan Reinauera7198b32012-12-11 16:00:47 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007-2010 coresystems GmbH
5 * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
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.
Stefan Reinauera7198b32012-12-11 16:00:47 -080015 */
16
17#include <stdint.h>
18#include <string.h>
Stefan Reinauera7198b32012-12-11 16:00:47 -080019#include <timestamp.h>
20#include <arch/io.h>
Stefan Reinauera7198b32012-12-11 16:00:47 -080021#include <device/pci_def.h>
Stefan Reinauera7198b32012-12-11 16:00:47 -080022#include <cpu/x86/lapic.h>
Kyösti Mälkki6722f8d2014-06-16 09:14:49 +030023#include <arch/acpi.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110024#include <northbridge/intel/sandybridge/sandybridge.h>
25#include <northbridge/intel/sandybridge/raminit.h>
Vladimir Serbinenko144eea02016-02-10 02:36:04 +010026#include <northbridge/intel/sandybridge/raminit_native.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110027#include <southbridge/intel/bd82x6x/pch.h>
Patrick Rudolphe8e66f42016-02-06 17:42:42 +010028#include <southbridge/intel/common/gpio.h>
Patrick Georgibd79c5e2014-11-28 22:35:36 +010029#include <halt.h>
Stefan Reinauera7198b32012-12-11 16:00:47 -080030#include "ec/compal/ene932/ec.h"
31
Vladimir Serbinenkoffbb3c02016-02-10 01:36:25 +010032void pch_enable_lpc(void)
Stefan Reinauera7198b32012-12-11 16:00:47 -080033{
34 /* Parrot EC Decode Range Port60/64, Port62/66 */
35 /* Enable EC, PS/2 Keyboard/Mouse */
36 pci_write_config16(PCH_LPC_DEV, LPC_EN, KBC_LPC_EN | MC_LPC_EN);
37
38 /* Map EC_IO decode to the LPC bus */
39 pci_write_config32(PCH_LPC_DEV, LPC_GEN1_DEC, (EC_IO & ~3) | 0x00040001);
40
41 /* Map EC registers 68/6C decode to the LPC bus */
42 pci_write_config32(PCH_LPC_DEV, LPC_GEN2_DEC, (68 & ~3) | 0x00040001);
43}
44
Nico Huberff4025c2018-01-14 12:34:43 +010045void mainboard_rcba_config(void)
Stefan Reinauera7198b32012-12-11 16:00:47 -080046{
47 u32 reg32;
48
Kyösti Mälkki6f499062015-06-06 11:52:24 +030049 /*
50 * GFX INTA -> PIRQA (MSI)
51 * D28IP_P2IP WLAN INTA -> PIRQB
52 * D28IP_P3IP ETH0 INTC -> PIRQD
53 * D29IP_E1P EHCI1 INTA -> PIRQE
54 * D26IP_E2P EHCI2 INTA -> PIRQE
55 * D31IP_SIP SATA INTA -> PIRQF (MSI)
56 * D31IP_SMIP SMBUS INTB -> PIRQG
57 * D31IP_TTIP THRT INTC -> PIRQH
58 * D27IP_ZIP HDA INTA -> PIRQG (MSI)
59 *
60 * Trackpad DVT PIRQA (16)
61 * Trackpad DVT PIRQE (20)
62 */
63
64 /* Device interrupt pin register (board specific) */
65 RCBA32(D31IP) = (INTC << D31IP_TTIP) | (NOINT << D31IP_SIP2) |
66 (INTB << D31IP_SMIP) | (INTA << D31IP_SIP);
67 RCBA32(D30IP) = (NOINT << D30IP_PIP);
68 RCBA32(D29IP) = (INTA << D29IP_E1P);
69 RCBA32(D28IP) = (NOINT << D28IP_P1IP) | (INTA << D28IP_P2IP) |
70 (INTC << D28IP_P3IP) | (NOINT << D28IP_P4IP) |
71 (NOINT << D28IP_P5IP) | (NOINT << D28IP_P6IP) |
72 (NOINT << D28IP_P7IP) | (NOINT << D28IP_P8IP);
73 RCBA32(D27IP) = (INTA << D27IP_ZIP);
74 RCBA32(D26IP) = (INTA << D26IP_E2P);
75 RCBA32(D25IP) = (NOINT << D25IP_LIP);
76 RCBA32(D22IP) = (NOINT << D22IP_MEI1IP);
77
78 /* Device interrupt route registers */
79 DIR_ROUTE(D31IR, PIRQB, PIRQH, PIRQA, PIRQC);
80 DIR_ROUTE(D29IR, PIRQD, PIRQE, PIRQF, PIRQG);
81 DIR_ROUTE(D28IR, PIRQB, PIRQC, PIRQD, PIRQE);
82 DIR_ROUTE(D27IR, PIRQA, PIRQH, PIRQA, PIRQB);
83 DIR_ROUTE(D26IR, PIRQF, PIRQE, PIRQG, PIRQH);
84 DIR_ROUTE(D25IR, PIRQA, PIRQB, PIRQC, PIRQD);
85 DIR_ROUTE(D22IR, PIRQA, PIRQB, PIRQC, PIRQD);
86
87 /* Enable IOAPIC (generic) */
Arthur Heymans58a89532018-06-12 22:58:19 +020088 RCBA16(OIC) = 0x0100;
Kyösti Mälkki6f499062015-06-06 11:52:24 +030089 /* PCH BWG says to read back the IOAPIC enable register */
Arthur Heymans58a89532018-06-12 22:58:19 +020090 (void) RCBA16(OIC);
Stefan Reinauera7198b32012-12-11 16:00:47 -080091
92 /* Disable unused devices (board specific) */
93 reg32 = RCBA32(FD);
Stefan Reinauera7198b32012-12-11 16:00:47 -080094 /* Disable PCI bridge so MRC does not probe this bus */
95 reg32 |= PCH_DISABLE_P2P;
96 RCBA32(FD) = reg32;
97}
98
Vladimir Serbinenkoffbb3c02016-02-10 01:36:25 +010099void mainboard_early_init(int s3resume)
Stefan Reinauera7198b32012-12-11 16:00:47 -0800100{
Vladimir Serbinenkoffbb3c02016-02-10 01:36:25 +0100101}
Stefan Reinauera7198b32012-12-11 16:00:47 -0800102
Vladimir Serbinenkoffbb3c02016-02-10 01:36:25 +0100103void mainboard_fill_pei_data(struct pei_data *pei_data)
104{
105 struct pei_data pei_data_template = {
Edward O'Callaghanf5037bd2014-05-23 08:36:01 +1000106 .pei_version = PEI_VERSION,
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -0800107 .mchbar = (uintptr_t)DEFAULT_MCHBAR,
108 .dmibar = (uintptr_t)DEFAULT_DMIBAR,
Edward O'Callaghanf5037bd2014-05-23 08:36:01 +1000109 .epbar = DEFAULT_EPBAR,
110 .pciexbar = CONFIG_MMCONF_BASE_ADDRESS,
111 .smbusbar = SMBUS_IO_BASE,
112 .wdbbar = 0x4000000,
113 .wdbsize = 0x1000,
114 .hpet_address = CONFIG_HPET_ADDRESS,
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -0800115 .rcba = (uintptr_t)DEFAULT_RCBABASE,
Edward O'Callaghanf5037bd2014-05-23 08:36:01 +1000116 .pmbase = DEFAULT_PMBASE,
117 .gpiobase = DEFAULT_GPIOBASE,
118 .thermalbase = 0xfed08000,
119 .system_type = 0, // 0 Mobile, 1 Desktop/Server
120 .tseg_size = CONFIG_SMM_TSEG_SIZE,
121 .spd_addresses = { 0xA0, 0x00,0xA4,0x00 },
122 .ts_addresses = { 0x00, 0x00, 0x00, 0x00 },
123 .ec_present = 1,
Stefan Reinauera7198b32012-12-11 16:00:47 -0800124 // 0 = leave channel enabled
125 // 1 = disable dimm 0 on channel
126 // 2 = disable dimm 1 on channel
127 // 3 = disable dimm 0+1 on channel
Edward O'Callaghanf5037bd2014-05-23 08:36:01 +1000128 .dimm_channel0_disabled = 2,
129 .dimm_channel1_disabled = 2,
130 .max_ddr3_freq = 1600,
131 .usb_port_config = {
Stefan Reinauera7198b32012-12-11 16:00:47 -0800132 /* Empty and onboard Ports 0-7, set to un-used pin OC3 */
133 { 0, 3, 0x0000 }, /* P0: Empty */
134 { 1, 0, 0x0040 }, /* P1: Left USB 1 (OC0) */
135 { 1, 1, 0x0040 }, /* P2: Left USB 2 (OC1) */
136 { 1, 1, 0x0040 }, /* P3: Left USB 3 (OC1) */
137 { 0, 3, 0x0000 }, /* P4: Empty */
138 { 0, 3, 0x0000 }, /* P5: Empty */
139 { 0, 3, 0x0000 }, /* P6: Empty */
140 { 0, 3, 0x0000 }, /* P7: Empty */
141 /* Empty and onboard Ports 8-13, set to un-used pin OC4 */
142 { 1, 4, 0x0040 }, /* P8: MiniPCIe (WLAN) (no OC) */
143 { 0, 4, 0x0000 }, /* P9: Empty */
144 { 1, 4, 0x0040 }, /* P10: Camera (no OC) */
145 { 0, 4, 0x0000 }, /* P11: Empty */
146 { 0, 4, 0x0000 }, /* P12: Empty */
147 { 0, 4, 0x0000 }, /* P13: Empty */
148 },
149 };
Vladimir Serbinenkoffbb3c02016-02-10 01:36:25 +0100150 *pei_data = pei_data_template;
151}
Stefan Reinauera7198b32012-12-11 16:00:47 -0800152
Vladimir Serbinenko144eea02016-02-10 02:36:04 +0100153const struct southbridge_usb_port mainboard_usb_ports[] = {
154 /* enabled power usb oc pin */
155 { 0, 0, -1 }, /* P0: Empty */
156 { 1, 0, 0 }, /* P1: Left USB 1 (OC0) */
157 { 1, 0, 1 }, /* P2: Left USB 2 (OC1) */
158 { 1, 0, 1 }, /* P3: Left USB 3 (OC1) */
159 { 0, 0, -1 }, /* P4: Empty */
160 { 0, 0, -1 }, /* P5: Empty */
161 { 0, 0, -1 }, /* P6: Empty */
162 { 0, 0, -1 }, /* P7: Empty */
163 /* Empty and onboard Ports 8-13, set to un-used pin OC4 */
164 { 1, 0, -1 }, /* P8: MiniPCIe (WLAN) (no OC) */
165 { 0, 0, -1 }, /* P9: Empty */
166 { 1, 0, -1 }, /* P10: Camera (no OC) */
167 { 0, 0, -1 }, /* P11: Empty */
168 { 0, 0, -1 }, /* P12: Empty */
169 { 0, 0, -1 }, /* P13: Empty */
170};
171
Peter Lemenkov498f1cc2019-02-07 10:48:10 +0100172void mainboard_get_spd(spd_raw_data *spd, bool id_only)
173{
Kyösti Mälkkie258b9a2016-11-18 19:59:23 +0200174 read_spd(&spd[0], 0x50, id_only);
175 read_spd(&spd[2], 0x52, id_only);
Vladimir Serbinenko144eea02016-02-10 02:36:04 +0100176}
177
Vladimir Serbinenkoffbb3c02016-02-10 01:36:25 +0100178void mainboard_config_superio(void)
179{
180}
Stefan Reinauera7198b32012-12-11 16:00:47 -0800181
Vladimir Serbinenkoffbb3c02016-02-10 01:36:25 +0100182int mainboard_should_reset_usb(int s3resume)
183{
184 return !s3resume;
Stefan Reinauera7198b32012-12-11 16:00:47 -0800185}