blob: e40531dac153649e2b53ac669057264482162cfb [file] [log] [blame]
Angel Ponsfeedf232020-04-05 13:22:01 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauer49428d82013-02-21 15:48:37 -08002
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02003#include <device/pci_ops.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +11004#include <northbridge/intel/sandybridge/sandybridge.h>
5#include <northbridge/intel/sandybridge/raminit.h>
Patrick Rudolphda9302a2019-03-24 17:01:41 +01006#include <southbridge/intel/bd82x6x/pch.h>
Patrick Rudolphe8e66f42016-02-06 17:42:42 +01007#include <southbridge/intel/common/gpio.h>
Stefan Reinauer49428d82013-02-21 15:48:37 -08008#include "ec/google/chromeec/ec.h"
Stefan Reinauer49428d82013-02-21 15:48:37 -08009
10#include <southbridge/intel/bd82x6x/chip.h>
11
Arthur Heymans2b28a162019-11-12 17:21:08 +010012void mainboard_pch_lpc_setup(void)
Stefan Reinauer49428d82013-02-21 15:48:37 -080013{
Nico Hubere036aae2019-11-17 01:24:44 +010014 /* Enable additional 0x200..0x207 for EC */
15 pci_or_config16(PCH_LPC_DEV, LPC_EN, GAMEL_LPC_EN);
Stefan Reinauer49428d82013-02-21 15:48:37 -080016}
17
Arthur Heymans9c538342019-11-12 16:42:33 +010018void mainboard_late_rcba_config(void)
Stefan Reinauer49428d82013-02-21 15:48:37 -080019{
Kyösti Mälkki6f499062015-06-06 11:52:24 +030020 /*
21 * GFX INTA -> PIRQA (MSI)
22 * D28IP_P3IP WLAN INTA -> PIRQB
23 * D29IP_E1P EHCI1 INTA -> PIRQD
24 * D26IP_E2P EHCI2 INTA -> PIRQF
25 * D31IP_SIP SATA INTA -> PIRQF (MSI)
26 * D31IP_SMIP SMBUS INTB -> PIRQH
27 * D31IP_TTIP THRT INTC -> PIRQA
28 * D27IP_ZIP HDA INTA -> PIRQA (MSI)
29 *
30 * TRACKPAD -> PIRQE (Edge Triggered)
31 * TOUCHSCREEN -> PIRQG (Edge Triggered)
32 */
33
34 /* Device interrupt pin register (board specific) */
35 RCBA32(D31IP) = (INTC << D31IP_TTIP) | (NOINT << D31IP_SIP2) |
36 (INTB << D31IP_SMIP) | (INTA << D31IP_SIP);
37 RCBA32(D30IP) = (NOINT << D30IP_PIP);
38 RCBA32(D29IP) = (INTA << D29IP_E1P);
39 RCBA32(D28IP) = (INTA << D28IP_P3IP);
40 RCBA32(D27IP) = (INTA << D27IP_ZIP);
41 RCBA32(D26IP) = (INTA << D26IP_E2P);
42 RCBA32(D25IP) = (NOINT << D25IP_LIP);
43 RCBA32(D22IP) = (NOINT << D22IP_MEI1IP);
44
45 /* Device interrupt route registers */
46 DIR_ROUTE(D31IR, PIRQB, PIRQH, PIRQA, PIRQC);
47 DIR_ROUTE(D29IR, PIRQD, PIRQE, PIRQF, PIRQG);
48 DIR_ROUTE(D28IR, PIRQB, PIRQC, PIRQD, PIRQE);
49 DIR_ROUTE(D27IR, PIRQA, PIRQH, PIRQA, PIRQB);
50 DIR_ROUTE(D26IR, PIRQF, PIRQE, PIRQG, PIRQH);
51 DIR_ROUTE(D25IR, PIRQA, PIRQB, PIRQC, PIRQD);
52 DIR_ROUTE(D22IR, PIRQA, PIRQB, PIRQC, PIRQD);
Stefan Reinauer49428d82013-02-21 15:48:37 -080053}
54
Keith Hui45e4ab42023-07-22 12:49:05 -040055static unsigned int get_spd_index(void)
Stefan Reinauer49428d82013-02-21 15:48:37 -080056{
57 const int gpio_vector[] = {41, 42, 43, 10, -1};
Keith Hui45e4ab42023-07-22 12:49:05 -040058 return get_gpios(gpio_vector);
Stefan Reinauer49428d82013-02-21 15:48:37 -080059}
60
Vladimir Serbinenkoffbb3c02016-02-10 01:36:25 +010061void mainboard_fill_pei_data(struct pei_data *pei_data)
Stefan Reinauer49428d82013-02-21 15:48:37 -080062{
Keith Hui7039edd2023-07-21 10:12:05 -040063 /* TODO: Confirm if nortbridge_fill_pei_data() gets .system_type right (should be 0) */
Vladimir Serbinenkob2ad8102016-02-10 03:07:42 +010064}
65
66const struct southbridge_usb_port mainboard_usb_ports[] = {
Elyes HAOUAS44f558e2020-02-24 13:26:04 +010067 /* enabled power USB oc pin */
Vladimir Serbinenkob2ad8102016-02-10 03:07:42 +010068 { 0, 0, -1 }, /* P0: Empty */
69 { 1, 0, 0 }, /* P1: Left USB 1 (OC0) */
70 { 1, 0, 1 }, /* P2: Left USB 2 (OC1) */
71 { 1, 0, -1 }, /* P3: SDCARD (no OC) */
72 { 0, 0, -1 }, /* P4: Empty */
73 { 1, 0, -1 }, /* P5: WWAN (no OC) */
74 { 0, 0, -1 }, /* P6: Empty */
75 { 0, 0, -1 }, /* P7: Empty */
76 { 1, 0, -1 }, /* P8: Camera (no OC) */
77 { 1, 0, -1 }, /* P9: Bluetooth (no OC) */
78 { 0, 0, -1 }, /* P10: Empty */
79 { 0, 0, -1 }, /* P11: Empty */
80 { 0, 0, -1 }, /* P12: Empty */
81 { 0, 0, -1 }, /* P13: Empty */
82};
83
Keith Hui45e4ab42023-07-22 12:49:05 -040084void mb_get_spd_map(struct spd_info *spdi)
Peter Lemenkov498f1cc2019-02-07 10:48:10 +010085{
Keith Hui45e4ab42023-07-22 12:49:05 -040086 /* LINK has 2 channels of memory down */
87 spdi->addresses[0] = SPD_MEMORY_DOWN;
88 spdi->addresses[2] = SPD_MEMORY_DOWN;
89 spdi->spd_index = get_spd_index();
Vladimir Serbinenkoffbb3c02016-02-10 01:36:25 +010090}
Stefan Reinauer49428d82013-02-21 15:48:37 -080091
Vladimir Serbinenkoffbb3c02016-02-10 01:36:25 +010092void mainboard_early_init(int s3resume)
93{
94 if (!s3resume) {
Stefan Reinauer49428d82013-02-21 15:48:37 -080095 /* This is the fastest way to let users know
96 * the Intel CPU is now alive.
97 */
98 google_chromeec_kbbacklight(100);
99 }
Vladimir Serbinenkoffbb3c02016-02-10 01:36:25 +0100100}