blob: 83be0c7f868ba988fb3406e7cf1859f6d58cedc2 [file] [log] [blame]
Zaolina823f9b2014-05-06 21:31:45 +02001/*
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 * Copyright (C) 2014 Vladimir Serbinenko
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include <stdint.h>
23#include <string.h>
24#include <lib.h>
25#include <timestamp.h>
26#include <arch/byteorder.h>
27#include <arch/io.h>
28#include <device/pci_def.h>
29#include <device/pnp_def.h>
30#include <cpu/x86/lapic.h>
31#include <pc80/mc146818rtc.h>
Kyösti Mälkki6722f8d2014-06-16 09:14:49 +030032#include <arch/acpi.h>
Zaolina823f9b2014-05-06 21:31:45 +020033#include <cbmem.h>
34#include <console/console.h>
35#include <northbridge/intel/sandybridge/sandybridge.h>
Nicolas Reinecke30d0aa92014-10-17 12:08:05 +020036#include <northbridge/intel/sandybridge/raminit_native.h>
Zaolina823f9b2014-05-06 21:31:45 +020037#include <southbridge/intel/bd82x6x/pch.h>
38#include <southbridge/intel/bd82x6x/gpio.h>
39#include <arch/cpu.h>
Zaolina823f9b2014-05-06 21:31:45 +020040#include <cpu/x86/msr.h>
41#include <cbfs.h>
42
Vladimir Serbinenkofa1d6882014-10-19 02:50:45 +020043void pch_enable_lpc(void)
Zaolina823f9b2014-05-06 21:31:45 +020044{
45 /* T520 EC Decode Range Port60/64, Port62/66 */
46 /* Enable EC, PS/2 Keyboard/Mouse */
47 pci_write_config16(PCH_LPC_DEV, LPC_EN,
48 CNF2_LPC_EN | CNF1_LPC_EN | MC_LPC_EN | KBC_LPC_EN |
49 COMA_LPC_EN);
50
51 pci_write_config32(PCH_LPC_DEV, LPC_GEN1_DEC, 0x7c1601);
52 pci_write_config32(PCH_LPC_DEV, LPC_GEN2_DEC, 0xc15e1);
53 pci_write_config32(PCH_LPC_DEV, LPC_GEN4_DEC, 0x0c06a1);
54
55 pci_write_config16(PCH_LPC_DEV, LPC_IO_DEC, 0x10);
56
57 pci_write_config32(PCH_LPC_DEV, 0xac,
58 0x80010000);
59}
60
Vladimir Serbinenkofa1d6882014-10-19 02:50:45 +020061void rcba_config(void)
Zaolina823f9b2014-05-06 21:31:45 +020062{
63 /*
64 * GFX INTA -> PIRQA (MSI)
Nicolas Reineckea41e5c72014-08-24 19:49:35 +020065 * D28IP_P2IP WLAN INTA -> PIRQB
66 * D28IP_P4IP EXC INTB -> PIRQF
67 * D28IP_P5IP SDCARD INTC -> PIRQD
Zaolina823f9b2014-05-06 21:31:45 +020068 * D29IP_E1P EHCI1 INTA -> PIRQD
69 * D26IP_E2P EHCI2 INTA -> PIRQF
70 * D31IP_SIP SATA INTA -> PIRQB (MSI)
71 * D31IP_SMIP SMBUS INTB -> PIRQH
72 * D31IP_TTIP THRT INTC -> PIRQA
73 * D27IP_ZIP HDA INTA -> PIRQA (MSI)
74 *
75 * Trackpad interrupt is edge triggered and cannot be shared.
76 * TRACKPAD -> PIRQG
77
78 */
79
80 /* Device interrupt pin register (board specific) */
81 RCBA32(D31IP) = (INTC << D31IP_TTIP) | (NOINT << D31IP_SIP2) |
82 (INTB << D31IP_SMIP) | (INTA << D31IP_SIP);
83 RCBA32(D29IP) = (INTA << D29IP_E1P);
Nicolas Reineckea41e5c72014-08-24 19:49:35 +020084 RCBA32(D28IP) = (INTA << D28IP_P2IP) | (INTB << D28IP_P4IP) |
85 (INTC << D28IP_P5IP);
Zaolina823f9b2014-05-06 21:31:45 +020086 RCBA32(D27IP) = (INTA << D27IP_ZIP);
87 RCBA32(D26IP) = (INTA << D26IP_E2P);
88 RCBA32(D25IP) = (NOINT << D25IP_LIP);
89 RCBA32(D22IP) = (NOINT << D22IP_MEI1IP);
90
91 /* Device interrupt route registers */
92 DIR_ROUTE(D31IR, PIRQB, PIRQH, PIRQA, PIRQC);
93 DIR_ROUTE(D29IR, PIRQD, PIRQE, PIRQF, PIRQG);
94 DIR_ROUTE(D28IR, PIRQB, PIRQF, PIRQD, PIRQE);
95 DIR_ROUTE(D27IR, PIRQA, PIRQH, PIRQA, PIRQB);
96 DIR_ROUTE(D26IR, PIRQF, PIRQE, PIRQG, PIRQH);
97 DIR_ROUTE(D25IR, PIRQA, PIRQB, PIRQC, PIRQD);
98 DIR_ROUTE(D22IR, PIRQA, PIRQB, PIRQC, PIRQD);
99
100 /* Enable IOAPIC (generic) */
101 RCBA16(OIC) = 0x0100;
102 /* PCH BWG says to read back the IOAPIC enable register */
103 (void) RCBA16(OIC);
104
105 /* Disable unused devices (board specific) */
Nicolas Reineckea41e5c72014-08-24 19:49:35 +0200106 RCBA32(FD) = 0x1ee51fe3;
Zaolina823f9b2014-05-06 21:31:45 +0200107 RCBA32(BUC) = 0;
108}
109
Vladimir Serbinenkofa1d6882014-10-19 02:50:45 +0200110const struct southbridge_usb_port mainboard_usb_ports[] = {
111 { 1, 1, 0 }, /* P0 left dual conn, OC 0 */
112 { 1, 1, 1 }, /* P1 system onboard USB port (eSATA), (EHCI debug), OC 1 */
113 { 1, 2, -1 }, /* P2: wimax / WLAN */
114 { 1, 1, -1 }, /* P3: WWAN, no OC */
115 { 1, 1, -1 }, /* P4: smartcard, no OC */
116 { 1, 1, -1 }, /* P5: ExpressCard, no OC */
117 { 0, 2, -1 }, /* P6: empty */
118 { 0, 2, -1 }, /* P7: to touch panel, no OC */
119 { 1, 1, 4 }, /* P8: left dual conn, OC4 */
120 { 1, 4, 5 }, /* P9: to system subcard back right, (EHCI debug), OC 5 */
121 { 1, 1, -1 }, /* P10: fingerprint reader, no OC */
122 { 1, 2, -1 }, /* P11: bluetooth, no OC. */
123 { 1, 1, -1 }, /* P12: docking, no OC */
124 { 1, 1, -1 }, /* P13: CAMERA (LCD), no OC */
125};
Zaolina823f9b2014-05-06 21:31:45 +0200126
Vladimir Serbinenkofa1d6882014-10-19 02:50:45 +0200127void mainboard_get_spd(spd_raw_data *spd) {
128 read_spd (&spd[0], 0x50);
129 read_spd (&spd[2], 0x51);
Zaolina823f9b2014-05-06 21:31:45 +0200130}