Angel Pons | 54c5472 | 2020-04-05 13:20:54 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 2 | |
| 3 | #include <stdint.h> |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 4 | #include <acpi/acpi.h> |
Edward O'Callaghan | 77757c2 | 2015-01-04 21:33:39 +1100 | [diff] [blame] | 5 | #include <northbridge/intel/sandybridge/sandybridge.h> |
Vladimir Serbinenko | 421b340 | 2016-02-10 02:39:51 +0100 | [diff] [blame] | 6 | #include <northbridge/intel/sandybridge/raminit.h> |
Alexandru Gagniuc | 83b05eb | 2015-02-15 14:09:21 -0600 | [diff] [blame] | 7 | #include <northbridge/intel/sandybridge/raminit_native.h> |
Edward O'Callaghan | 77757c2 | 2015-01-04 21:33:39 +1100 | [diff] [blame] | 8 | #include <southbridge/intel/bd82x6x/pch.h> |
Patrick Rudolph | e8e66f4 | 2016-02-06 17:42:42 +0100 | [diff] [blame] | 9 | #include <southbridge/intel/common/gpio.h> |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 10 | |
Arthur Heymans | 9c53834 | 2019-11-12 16:42:33 +0100 | [diff] [blame] | 11 | void mainboard_late_rcba_config(void) |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 12 | { |
Kyösti Mälkki | 6f49906 | 2015-06-06 11:52:24 +0300 | [diff] [blame] | 13 | /* |
| 14 | * GFX INTA -> PIRQA (MSI) |
| 15 | * D28IP_P1IP WLAN INTA -> PIRQB |
| 16 | * D28IP_P2IP ETH0 INTB -> PIRQF |
| 17 | * D28IP_P3IP SDCARD INTC -> PIRQD |
| 18 | * D29IP_E1P EHCI1 INTA -> PIRQD |
| 19 | * D26IP_E2P EHCI2 INTA -> PIRQF |
| 20 | * D31IP_SIP SATA INTA -> PIRQB (MSI) |
| 21 | * D31IP_SMIP SMBUS INTB -> PIRQH |
| 22 | * D31IP_TTIP THRT INTC -> PIRQA |
| 23 | * D27IP_ZIP HDA INTA -> PIRQA (MSI) |
| 24 | * |
| 25 | * Trackpad interrupt is edge triggered and cannot be shared. |
| 26 | * TRACKPAD -> PIRQG |
| 27 | |
| 28 | */ |
| 29 | |
| 30 | /* Device interrupt pin register (board specific) */ |
| 31 | RCBA32(D31IP) = (INTC << D31IP_TTIP) | (NOINT << D31IP_SIP2) | |
| 32 | (INTB << D31IP_SMIP) | (INTA << D31IP_SIP); |
| 33 | RCBA32(D29IP) = (INTA << D29IP_E1P); |
| 34 | RCBA32(D28IP) = (INTA << D28IP_P1IP) | (INTB << D28IP_P2IP) | |
| 35 | (INTC << D28IP_P3IP); |
| 36 | RCBA32(D27IP) = (INTA << D27IP_ZIP); |
| 37 | RCBA32(D26IP) = (INTA << D26IP_E2P); |
| 38 | RCBA32(D25IP) = (NOINT << D25IP_LIP); |
| 39 | RCBA32(D22IP) = (NOINT << D22IP_MEI1IP); |
| 40 | |
| 41 | /* Device interrupt route registers */ |
| 42 | DIR_ROUTE(D31IR, PIRQB, PIRQH, PIRQA, PIRQC); |
| 43 | DIR_ROUTE(D29IR, PIRQD, PIRQE, PIRQF, PIRQG); |
| 44 | DIR_ROUTE(D28IR, PIRQB, PIRQF, PIRQD, PIRQE); |
| 45 | DIR_ROUTE(D27IR, PIRQA, PIRQH, PIRQA, PIRQB); |
| 46 | DIR_ROUTE(D26IR, PIRQF, PIRQE, PIRQG, PIRQH); |
| 47 | DIR_ROUTE(D25IR, PIRQA, PIRQB, PIRQC, PIRQD); |
| 48 | DIR_ROUTE(D22IR, PIRQA, PIRQB, PIRQC, PIRQD); |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 49 | } |
| 50 | |
Alexandru Gagniuc | 83b05eb | 2015-02-15 14:09:21 -0600 | [diff] [blame] | 51 | const struct southbridge_usb_port mainboard_usb_ports[] = { |
Elyes HAOUAS | 44f558e | 2020-02-24 13:26:04 +0100 | [diff] [blame] | 52 | /* enabled power USB oc pin */ |
Vladimir Serbinenko | 4a84e47 | 2016-02-10 02:51:48 +0100 | [diff] [blame] | 53 | { 1, 0, -1 }, /* P0: Right USB 3.0 #1 (no OC) */ |
| 54 | { 1, 0, -1 }, /* P1: Right USB 3.0 #2 (no OC) */ |
| 55 | { 1, 0, -1 }, /* P2: Camera (no OC) */ |
| 56 | { 0, 0, -1 }, /* P3: Empty */ |
| 57 | { 0, 0, -1 }, /* P4: Empty */ |
| 58 | { 0, 0, -1 }, /* P5: Empty */ |
| 59 | { 0, 0, -1 }, /* P6: Empty */ |
| 60 | { 0, 0, -1 }, /* P7: Empty */ |
| 61 | { 0, 0, -1 }, /* P8: Empty */ |
| 62 | { 1, 1, -1 }, /* P9: Left USB 1 (no OC) */ |
| 63 | { 1, 0, -1 }, /* P10: Mini PCIe - WLAN / BT (no OC) */ |
| 64 | { 0, 0, -1 }, /* P11: Empty */ |
| 65 | { 0, 0, -1 }, /* P12: Empty */ |
| 66 | { 0, 0, -1 }, /* P13: Empty */ |
Alexandru Gagniuc | 83b05eb | 2015-02-15 14:09:21 -0600 | [diff] [blame] | 67 | }; |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 68 | |
Peter Lemenkov | 498f1cc | 2019-02-07 10:48:10 +0100 | [diff] [blame] | 69 | void mainboard_get_spd(spd_raw_data *spd, bool id_only) |
| 70 | { |
Kyösti Mälkki | e258b9a | 2016-11-18 19:59:23 +0200 | [diff] [blame] | 71 | read_spd(&spd[0], 0x50, id_only); |
| 72 | read_spd(&spd[2], 0x52, id_only); |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 73 | } |
Vladimir Serbinenko | 609bd94 | 2016-01-31 14:00:54 +0100 | [diff] [blame] | 74 | |
Vladimir Serbinenko | 421b340 | 2016-02-10 02:39:51 +0100 | [diff] [blame] | 75 | void mainboard_fill_pei_data(struct pei_data *pei_data) |
| 76 | { |
| 77 | struct pei_data pei_data_template = { |
| 78 | .pei_version = PEI_VERSION, |
Angel Pons | c802745 | 2020-09-14 16:36:28 +0200 | [diff] [blame] | 79 | .mchbar = DEFAULT_MCHBAR, |
| 80 | .dmibar = DEFAULT_DMIBAR, |
Vladimir Serbinenko | 421b340 | 2016-02-10 02:39:51 +0100 | [diff] [blame] | 81 | .epbar = DEFAULT_EPBAR, |
| 82 | .pciexbar = CONFIG_MMCONF_BASE_ADDRESS, |
Angel Pons | b21bffa | 2020-07-03 01:02:28 +0200 | [diff] [blame] | 83 | .smbusbar = CONFIG_FIXED_SMBUS_IO_BASE, |
Vladimir Serbinenko | 421b340 | 2016-02-10 02:39:51 +0100 | [diff] [blame] | 84 | .wdbbar = 0x4000000, |
| 85 | .wdbsize = 0x1000, |
| 86 | .hpet_address = CONFIG_HPET_ADDRESS, |
Angel Pons | 92717ff | 2020-09-14 16:22:22 +0200 | [diff] [blame] | 87 | .rcba = (uintptr_t)DEFAULT_RCBA, |
Vladimir Serbinenko | 421b340 | 2016-02-10 02:39:51 +0100 | [diff] [blame] | 88 | .pmbase = DEFAULT_PMBASE, |
| 89 | .gpiobase = DEFAULT_GPIOBASE, |
| 90 | .thermalbase = 0xfed08000, |
| 91 | .system_type = 0, // 0 Mobile, 1 Desktop/Server |
| 92 | .tseg_size = CONFIG_SMM_TSEG_SIZE, |
| 93 | .spd_addresses = { 0xA0, 0x00,0xA4,0x00 }, |
| 94 | .ts_addresses = { 0x00, 0x00, 0x00, 0x00 }, |
| 95 | .ec_present = 1, |
| 96 | .ddr3lv_support = 0, |
| 97 | // 0 = leave channel enabled |
| 98 | // 1 = disable dimm 0 on channel |
| 99 | // 2 = disable dimm 1 on channel |
| 100 | // 3 = disable dimm 0+1 on channel |
| 101 | .dimm_channel0_disabled = 2, |
| 102 | .dimm_channel1_disabled = 2, |
| 103 | .max_ddr3_freq = 1600, |
| 104 | .usb_port_config = { |
Elyes HAOUAS | 44f558e | 2020-02-24 13:26:04 +0100 | [diff] [blame] | 105 | /* enabled USB oc pin length */ |
Vladimir Serbinenko | 421b340 | 2016-02-10 02:39:51 +0100 | [diff] [blame] | 106 | { 1, 0, 0x0040 }, /* P0: Right USB 3.0 #1 (no OC) */ |
| 107 | { 1, 0, 0x0040 }, /* P1: Right USB 3.0 #2 (no OC) */ |
| 108 | { 1, 0, 0x0040 }, /* P2: Camera (no OC) */ |
| 109 | { 0, 0, 0x0000 }, /* P3: Empty */ |
| 110 | { 0, 0, 0x0000 }, /* P4: Empty */ |
| 111 | { 0, 0, 0x0000 }, /* P5: Empty */ |
| 112 | { 0, 0, 0x0000 }, /* P6: Empty */ |
| 113 | { 0, 0, 0x0000 }, /* P7: Empty */ |
| 114 | { 0, 4, 0x0000 }, /* P8: Empty */ |
| 115 | { 1, 4, 0x0080 }, /* P9: Left USB 1 (no OC) */ |
| 116 | { 1, 4, 0x0040 }, /* P10: Mini PCIe - WLAN / BT (no OC) */ |
| 117 | { 0, 4, 0x0000 }, /* P11: Empty */ |
| 118 | { 0, 4, 0x0000 }, /* P12: Empty */ |
| 119 | { 0, 4, 0x0000 }, /* P13: Empty */ |
| 120 | }, |
| 121 | .ddr_refresh_rate_config = 2, /* Force double refresh rate */ |
| 122 | }; |
| 123 | *pei_data = pei_data_template; |
| 124 | } |
Matt DeVillier | c35a1e8 | 2017-07-11 23:59:53 -0500 | [diff] [blame] | 125 | |
| 126 | int mainboard_should_reset_usb(int s3resume) |
| 127 | { |
| 128 | return !s3resume; |
| 129 | } |