blob: d00573ab7e67845bc0d33ea18f49b81a595616d0 [file] [log] [blame]
Angel Pons54c54722020-04-05 13:20:54 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -08002
3#include <stdint.h>
Furquan Shaikh76cedd22020-05-02 10:24:23 -07004#include <acpi/acpi.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +11005#include <northbridge/intel/sandybridge/sandybridge.h>
Vladimir Serbinenko421b3402016-02-10 02:39:51 +01006#include <northbridge/intel/sandybridge/raminit.h>
Alexandru Gagniuc83b05eb2015-02-15 14:09:21 -06007#include <northbridge/intel/sandybridge/raminit_native.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +11008#include <southbridge/intel/bd82x6x/pch.h>
Patrick Rudolphe8e66f42016-02-06 17:42:42 +01009#include <southbridge/intel/common/gpio.h>
Julius Wernercd49cce2019-03-05 16:53:33 -080010#if CONFIG(CHROMEOS)
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -080011#include <vendorcode/google/chromeos/chromeos.h>
12#endif
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -080013
Arthur Heymans9c538342019-11-12 16:42:33 +010014void mainboard_late_rcba_config(void)
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -080015{
Kyösti Mälkki6f499062015-06-06 11:52:24 +030016 /*
17 * GFX INTA -> PIRQA (MSI)
18 * D28IP_P1IP WLAN INTA -> PIRQB
19 * D28IP_P2IP ETH0 INTB -> PIRQF
20 * D28IP_P3IP SDCARD INTC -> PIRQD
21 * D29IP_E1P EHCI1 INTA -> PIRQD
22 * D26IP_E2P EHCI2 INTA -> PIRQF
23 * D31IP_SIP SATA INTA -> PIRQB (MSI)
24 * D31IP_SMIP SMBUS INTB -> PIRQH
25 * D31IP_TTIP THRT INTC -> PIRQA
26 * D27IP_ZIP HDA INTA -> PIRQA (MSI)
27 *
28 * Trackpad interrupt is edge triggered and cannot be shared.
29 * TRACKPAD -> PIRQG
30
31 */
32
33 /* Device interrupt pin register (board specific) */
34 RCBA32(D31IP) = (INTC << D31IP_TTIP) | (NOINT << D31IP_SIP2) |
35 (INTB << D31IP_SMIP) | (INTA << D31IP_SIP);
36 RCBA32(D29IP) = (INTA << D29IP_E1P);
37 RCBA32(D28IP) = (INTA << D28IP_P1IP) | (INTB << D28IP_P2IP) |
38 (INTC << D28IP_P3IP);
39 RCBA32(D27IP) = (INTA << D27IP_ZIP);
40 RCBA32(D26IP) = (INTA << D26IP_E2P);
41 RCBA32(D25IP) = (NOINT << D25IP_LIP);
42 RCBA32(D22IP) = (NOINT << D22IP_MEI1IP);
43
44 /* Device interrupt route registers */
45 DIR_ROUTE(D31IR, PIRQB, PIRQH, PIRQA, PIRQC);
46 DIR_ROUTE(D29IR, PIRQD, PIRQE, PIRQF, PIRQG);
47 DIR_ROUTE(D28IR, PIRQB, PIRQF, PIRQD, PIRQE);
48 DIR_ROUTE(D27IR, PIRQA, PIRQH, PIRQA, PIRQB);
49 DIR_ROUTE(D26IR, PIRQF, PIRQE, PIRQG, PIRQH);
50 DIR_ROUTE(D25IR, PIRQA, PIRQB, PIRQC, PIRQD);
51 DIR_ROUTE(D22IR, PIRQA, PIRQB, PIRQC, PIRQD);
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -080052}
53
Alexandru Gagniuc83b05eb2015-02-15 14:09:21 -060054const struct southbridge_usb_port mainboard_usb_ports[] = {
Elyes HAOUAS44f558e2020-02-24 13:26:04 +010055 /* enabled power USB oc pin */
Vladimir Serbinenko4a84e472016-02-10 02:51:48 +010056 { 1, 0, -1 }, /* P0: Right USB 3.0 #1 (no OC) */
57 { 1, 0, -1 }, /* P1: Right USB 3.0 #2 (no OC) */
58 { 1, 0, -1 }, /* P2: Camera (no OC) */
59 { 0, 0, -1 }, /* P3: Empty */
60 { 0, 0, -1 }, /* P4: Empty */
61 { 0, 0, -1 }, /* P5: Empty */
62 { 0, 0, -1 }, /* P6: Empty */
63 { 0, 0, -1 }, /* P7: Empty */
64 { 0, 0, -1 }, /* P8: Empty */
65 { 1, 1, -1 }, /* P9: Left USB 1 (no OC) */
66 { 1, 0, -1 }, /* P10: Mini PCIe - WLAN / BT (no OC) */
67 { 0, 0, -1 }, /* P11: Empty */
68 { 0, 0, -1 }, /* P12: Empty */
69 { 0, 0, -1 }, /* P13: Empty */
Alexandru Gagniuc83b05eb2015-02-15 14:09:21 -060070};
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -080071
Peter Lemenkov498f1cc2019-02-07 10:48:10 +010072void mainboard_get_spd(spd_raw_data *spd, bool id_only)
73{
Kyösti Mälkkie258b9a2016-11-18 19:59:23 +020074 read_spd(&spd[0], 0x50, id_only);
75 read_spd(&spd[2], 0x52, id_only);
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -080076}
Vladimir Serbinenko609bd942016-01-31 14:00:54 +010077
Vladimir Serbinenko421b3402016-02-10 02:39:51 +010078void mainboard_fill_pei_data(struct pei_data *pei_data)
79{
80 struct pei_data pei_data_template = {
81 .pei_version = PEI_VERSION,
82 .mchbar = (uintptr_t)DEFAULT_MCHBAR,
83 .dmibar = (uintptr_t)DEFAULT_DMIBAR,
84 .epbar = DEFAULT_EPBAR,
85 .pciexbar = CONFIG_MMCONF_BASE_ADDRESS,
Angel Ponsb21bffa2020-07-03 01:02:28 +020086 .smbusbar = CONFIG_FIXED_SMBUS_IO_BASE,
Vladimir Serbinenko421b3402016-02-10 02:39:51 +010087 .wdbbar = 0x4000000,
88 .wdbsize = 0x1000,
89 .hpet_address = CONFIG_HPET_ADDRESS,
90 .rcba = (uintptr_t)DEFAULT_RCBABASE,
91 .pmbase = DEFAULT_PMBASE,
92 .gpiobase = DEFAULT_GPIOBASE,
93 .thermalbase = 0xfed08000,
94 .system_type = 0, // 0 Mobile, 1 Desktop/Server
95 .tseg_size = CONFIG_SMM_TSEG_SIZE,
96 .spd_addresses = { 0xA0, 0x00,0xA4,0x00 },
97 .ts_addresses = { 0x00, 0x00, 0x00, 0x00 },
98 .ec_present = 1,
99 .ddr3lv_support = 0,
100 // 0 = leave channel enabled
101 // 1 = disable dimm 0 on channel
102 // 2 = disable dimm 1 on channel
103 // 3 = disable dimm 0+1 on channel
104 .dimm_channel0_disabled = 2,
105 .dimm_channel1_disabled = 2,
106 .max_ddr3_freq = 1600,
107 .usb_port_config = {
Elyes HAOUAS44f558e2020-02-24 13:26:04 +0100108 /* enabled USB oc pin length */
Vladimir Serbinenko421b3402016-02-10 02:39:51 +0100109 { 1, 0, 0x0040 }, /* P0: Right USB 3.0 #1 (no OC) */
110 { 1, 0, 0x0040 }, /* P1: Right USB 3.0 #2 (no OC) */
111 { 1, 0, 0x0040 }, /* P2: Camera (no OC) */
112 { 0, 0, 0x0000 }, /* P3: Empty */
113 { 0, 0, 0x0000 }, /* P4: Empty */
114 { 0, 0, 0x0000 }, /* P5: Empty */
115 { 0, 0, 0x0000 }, /* P6: Empty */
116 { 0, 0, 0x0000 }, /* P7: Empty */
117 { 0, 4, 0x0000 }, /* P8: Empty */
118 { 1, 4, 0x0080 }, /* P9: Left USB 1 (no OC) */
119 { 1, 4, 0x0040 }, /* P10: Mini PCIe - WLAN / BT (no OC) */
120 { 0, 4, 0x0000 }, /* P11: Empty */
121 { 0, 4, 0x0000 }, /* P12: Empty */
122 { 0, 4, 0x0000 }, /* P13: Empty */
123 },
124 .ddr_refresh_rate_config = 2, /* Force double refresh rate */
125 };
126 *pei_data = pei_data_template;
127}
Matt DeVillierc35a1e82017-07-11 23:59:53 -0500128
129int mainboard_should_reset_usb(int s3resume)
130{
131 return !s3resume;
132}