Angel Pons | 96d93d1 | 2020-04-05 13:22:23 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 3 | |
| 4 | #include <stdint.h> |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 5 | #include <cpu/x86/lapic.h> |
Kyösti Mälkki | 6722f8d | 2014-06-16 09:14:49 +0300 | [diff] [blame] | 6 | #include <arch/acpi.h> |
Edward O'Callaghan | 77757c2 | 2015-01-04 21:33:39 +1100 | [diff] [blame] | 7 | #include <northbridge/intel/sandybridge/sandybridge.h> |
| 8 | #include <northbridge/intel/sandybridge/raminit.h> |
Vladimir Serbinenko | 144eea0 | 2016-02-10 02:36:04 +0100 | [diff] [blame] | 9 | #include <northbridge/intel/sandybridge/raminit_native.h> |
Edward O'Callaghan | 77757c2 | 2015-01-04 21:33:39 +1100 | [diff] [blame] | 10 | #include <southbridge/intel/bd82x6x/pch.h> |
Patrick Rudolph | e8e66f4 | 2016-02-06 17:42:42 +0100 | [diff] [blame] | 11 | #include <southbridge/intel/common/gpio.h> |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 12 | #include "ec/compal/ene932/ec.h" |
| 13 | |
Arthur Heymans | 9c53834 | 2019-11-12 16:42:33 +0100 | [diff] [blame] | 14 | void mainboard_late_rcba_config(void) |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 15 | { |
Kyösti Mälkki | 6f49906 | 2015-06-06 11:52:24 +0300 | [diff] [blame] | 16 | /* |
| 17 | * GFX INTA -> PIRQA (MSI) |
| 18 | * D28IP_P2IP WLAN INTA -> PIRQB |
| 19 | * D28IP_P3IP ETH0 INTC -> PIRQD |
| 20 | * D29IP_E1P EHCI1 INTA -> PIRQE |
| 21 | * D26IP_E2P EHCI2 INTA -> PIRQE |
| 22 | * D31IP_SIP SATA INTA -> PIRQF (MSI) |
| 23 | * D31IP_SMIP SMBUS INTB -> PIRQG |
| 24 | * D31IP_TTIP THRT INTC -> PIRQH |
| 25 | * D27IP_ZIP HDA INTA -> PIRQG (MSI) |
| 26 | * |
| 27 | * Trackpad DVT PIRQA (16) |
| 28 | * Trackpad DVT PIRQE (20) |
| 29 | */ |
| 30 | |
| 31 | /* Device interrupt pin register (board specific) */ |
| 32 | RCBA32(D31IP) = (INTC << D31IP_TTIP) | (NOINT << D31IP_SIP2) | |
| 33 | (INTB << D31IP_SMIP) | (INTA << D31IP_SIP); |
| 34 | RCBA32(D30IP) = (NOINT << D30IP_PIP); |
| 35 | RCBA32(D29IP) = (INTA << D29IP_E1P); |
| 36 | RCBA32(D28IP) = (NOINT << D28IP_P1IP) | (INTA << D28IP_P2IP) | |
| 37 | (INTC << D28IP_P3IP) | (NOINT << D28IP_P4IP) | |
| 38 | (NOINT << D28IP_P5IP) | (NOINT << D28IP_P6IP) | |
| 39 | (NOINT << D28IP_P7IP) | (NOINT << D28IP_P8IP); |
| 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 Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 53 | } |
| 54 | |
Vladimir Serbinenko | ffbb3c0 | 2016-02-10 01:36:25 +0100 | [diff] [blame] | 55 | void mainboard_fill_pei_data(struct pei_data *pei_data) |
| 56 | { |
| 57 | struct pei_data pei_data_template = { |
Edward O'Callaghan | f5037bd | 2014-05-23 08:36:01 +1000 | [diff] [blame] | 58 | .pei_version = PEI_VERSION, |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 59 | .mchbar = (uintptr_t)DEFAULT_MCHBAR, |
| 60 | .dmibar = (uintptr_t)DEFAULT_DMIBAR, |
Edward O'Callaghan | f5037bd | 2014-05-23 08:36:01 +1000 | [diff] [blame] | 61 | .epbar = DEFAULT_EPBAR, |
| 62 | .pciexbar = CONFIG_MMCONF_BASE_ADDRESS, |
| 63 | .smbusbar = SMBUS_IO_BASE, |
| 64 | .wdbbar = 0x4000000, |
| 65 | .wdbsize = 0x1000, |
| 66 | .hpet_address = CONFIG_HPET_ADDRESS, |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 67 | .rcba = (uintptr_t)DEFAULT_RCBABASE, |
Edward O'Callaghan | f5037bd | 2014-05-23 08:36:01 +1000 | [diff] [blame] | 68 | .pmbase = DEFAULT_PMBASE, |
| 69 | .gpiobase = DEFAULT_GPIOBASE, |
| 70 | .thermalbase = 0xfed08000, |
| 71 | .system_type = 0, // 0 Mobile, 1 Desktop/Server |
| 72 | .tseg_size = CONFIG_SMM_TSEG_SIZE, |
| 73 | .spd_addresses = { 0xA0, 0x00,0xA4,0x00 }, |
| 74 | .ts_addresses = { 0x00, 0x00, 0x00, 0x00 }, |
| 75 | .ec_present = 1, |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 76 | // 0 = leave channel enabled |
| 77 | // 1 = disable dimm 0 on channel |
| 78 | // 2 = disable dimm 1 on channel |
| 79 | // 3 = disable dimm 0+1 on channel |
Edward O'Callaghan | f5037bd | 2014-05-23 08:36:01 +1000 | [diff] [blame] | 80 | .dimm_channel0_disabled = 2, |
| 81 | .dimm_channel1_disabled = 2, |
| 82 | .max_ddr3_freq = 1600, |
| 83 | .usb_port_config = { |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 84 | /* Empty and onboard Ports 0-7, set to un-used pin OC3 */ |
| 85 | { 0, 3, 0x0000 }, /* P0: Empty */ |
| 86 | { 1, 0, 0x0040 }, /* P1: Left USB 1 (OC0) */ |
| 87 | { 1, 1, 0x0040 }, /* P2: Left USB 2 (OC1) */ |
| 88 | { 1, 1, 0x0040 }, /* P3: Left USB 3 (OC1) */ |
| 89 | { 0, 3, 0x0000 }, /* P4: Empty */ |
| 90 | { 0, 3, 0x0000 }, /* P5: Empty */ |
| 91 | { 0, 3, 0x0000 }, /* P6: Empty */ |
| 92 | { 0, 3, 0x0000 }, /* P7: Empty */ |
| 93 | /* Empty and onboard Ports 8-13, set to un-used pin OC4 */ |
| 94 | { 1, 4, 0x0040 }, /* P8: MiniPCIe (WLAN) (no OC) */ |
| 95 | { 0, 4, 0x0000 }, /* P9: Empty */ |
| 96 | { 1, 4, 0x0040 }, /* P10: Camera (no OC) */ |
| 97 | { 0, 4, 0x0000 }, /* P11: Empty */ |
| 98 | { 0, 4, 0x0000 }, /* P12: Empty */ |
| 99 | { 0, 4, 0x0000 }, /* P13: Empty */ |
| 100 | }, |
| 101 | }; |
Vladimir Serbinenko | ffbb3c0 | 2016-02-10 01:36:25 +0100 | [diff] [blame] | 102 | *pei_data = pei_data_template; |
| 103 | } |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 104 | |
Vladimir Serbinenko | 144eea0 | 2016-02-10 02:36:04 +0100 | [diff] [blame] | 105 | const struct southbridge_usb_port mainboard_usb_ports[] = { |
Elyes HAOUAS | 44f558e | 2020-02-24 13:26:04 +0100 | [diff] [blame] | 106 | /* enabled power USB oc pin */ |
Vladimir Serbinenko | 144eea0 | 2016-02-10 02:36:04 +0100 | [diff] [blame] | 107 | { 0, 0, -1 }, /* P0: Empty */ |
| 108 | { 1, 0, 0 }, /* P1: Left USB 1 (OC0) */ |
| 109 | { 1, 0, 1 }, /* P2: Left USB 2 (OC1) */ |
| 110 | { 1, 0, 1 }, /* P3: Left USB 3 (OC1) */ |
| 111 | { 0, 0, -1 }, /* P4: Empty */ |
| 112 | { 0, 0, -1 }, /* P5: Empty */ |
| 113 | { 0, 0, -1 }, /* P6: Empty */ |
| 114 | { 0, 0, -1 }, /* P7: Empty */ |
| 115 | /* Empty and onboard Ports 8-13, set to un-used pin OC4 */ |
| 116 | { 1, 0, -1 }, /* P8: MiniPCIe (WLAN) (no OC) */ |
| 117 | { 0, 0, -1 }, /* P9: Empty */ |
| 118 | { 1, 0, -1 }, /* P10: Camera (no OC) */ |
| 119 | { 0, 0, -1 }, /* P11: Empty */ |
| 120 | { 0, 0, -1 }, /* P12: Empty */ |
| 121 | { 0, 0, -1 }, /* P13: Empty */ |
| 122 | }; |
| 123 | |
Peter Lemenkov | 498f1cc | 2019-02-07 10:48:10 +0100 | [diff] [blame] | 124 | void mainboard_get_spd(spd_raw_data *spd, bool id_only) |
| 125 | { |
Kyösti Mälkki | e258b9a | 2016-11-18 19:59:23 +0200 | [diff] [blame] | 126 | read_spd(&spd[0], 0x50, id_only); |
| 127 | read_spd(&spd[2], 0x52, id_only); |
Vladimir Serbinenko | 144eea0 | 2016-02-10 02:36:04 +0100 | [diff] [blame] | 128 | } |
| 129 | |
Vladimir Serbinenko | ffbb3c0 | 2016-02-10 01:36:25 +0100 | [diff] [blame] | 130 | int mainboard_should_reset_usb(int s3resume) |
| 131 | { |
| 132 | return !s3resume; |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 133 | } |