Angel Pons | 64b5d97 | 2020-04-05 13:20:50 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 2 | |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 3 | #include <stdint.h> |
Kyösti Mälkki | cd7a70f | 2019-08-17 20:51:08 +0300 | [diff] [blame] | 4 | #include <arch/romstage.h> |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 5 | #include <cpu/intel/haswell/haswell.h> |
| 6 | #include <northbridge/intel/haswell/haswell.h> |
| 7 | #include <northbridge/intel/haswell/raminit.h> |
| 8 | #include <southbridge/intel/lynxpoint/lp_gpio.h> |
| 9 | #include <southbridge/intel/lynxpoint/pch.h> |
| 10 | #include <superio/ite/common/ite.h> |
| 11 | #include <superio/ite/it8772f/it8772f.h> |
| 12 | #include <variant/gpio.h> |
| 13 | #include "onboard.h" |
| 14 | |
Angel Pons | 6e1c471 | 2020-07-03 13:05:10 +0200 | [diff] [blame^] | 15 | void mainboard_config_rcba(void) |
| 16 | { |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 17 | /* |
| 18 | * GFX INTA -> PIRQA (MSI) |
| 19 | * D28IP_P1IP PCIE INTA -> PIRQA |
| 20 | * D29IP_E1P EHCI INTA -> PIRQD |
| 21 | * D20IP_XHCI XHCI INTA -> PIRQC (MSI) |
| 22 | * D31IP_SIP SATA INTA -> PIRQF (MSI) |
| 23 | * D31IP_SMIP SMBUS INTB -> PIRQG |
| 24 | * D31IP_TTIP THRT INTC -> PIRQA |
| 25 | * D27IP_ZIP HDA INTA -> PIRQG (MSI) |
| 26 | */ |
| 27 | |
| 28 | /* Device interrupt pin register (board specific) */ |
Angel Pons | 6e1c471 | 2020-07-03 13:05:10 +0200 | [diff] [blame^] | 29 | RCBA32(D31IP) = (INTC << D31IP_TTIP) | (NOINT << D31IP_SIP2) | |
| 30 | (INTB << D31IP_SMIP) | (INTA << D31IP_SIP); |
| 31 | RCBA32(D29IP) = (INTA << D29IP_E1P); |
| 32 | RCBA32(D28IP) = (INTA << D28IP_P1IP) | (INTC << D28IP_P3IP) | |
| 33 | (INTB << D28IP_P4IP); |
| 34 | RCBA32(D27IP) = (INTA << D27IP_ZIP); |
| 35 | RCBA32(D26IP) = (INTA << D26IP_E2P); |
| 36 | RCBA32(D22IP) = (NOINT << D22IP_MEI1IP); |
| 37 | RCBA32(D20IP) = (INTA << D20IP_XHCI); |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 38 | |
| 39 | /* Device interrupt route registers */ |
Angel Pons | 6e1c471 | 2020-07-03 13:05:10 +0200 | [diff] [blame^] | 40 | RCBA32(D31IR) = DIR_ROUTE(PIRQG, PIRQC, PIRQB, PIRQA); /* LPC */ |
| 41 | RCBA32(D29IR) = DIR_ROUTE(PIRQD, PIRQD, PIRQD, PIRQD); /* EHCI */ |
| 42 | RCBA32(D28IR) = DIR_ROUTE(PIRQA, PIRQB, PIRQC, PIRQD); /* PCIE */ |
| 43 | RCBA32(D27IR) = DIR_ROUTE(PIRQG, PIRQG, PIRQG, PIRQG); /* HDA */ |
| 44 | RCBA32(D22IR) = DIR_ROUTE(PIRQA, PIRQA, PIRQA, PIRQA); /* ME */ |
| 45 | RCBA32(D21IR) = DIR_ROUTE(PIRQE, PIRQF, PIRQF, PIRQF); /* SIO */ |
| 46 | RCBA32(D20IR) = DIR_ROUTE(PIRQC, PIRQC, PIRQC, PIRQC); /* XHCI */ |
| 47 | RCBA32(D23IR) = DIR_ROUTE(PIRQH, PIRQH, PIRQH, PIRQH); /* SDIO */ |
| 48 | } |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 49 | |
Kyösti Mälkki | 157b189 | 2019-08-16 14:02:25 +0300 | [diff] [blame] | 50 | void mainboard_romstage_entry(void) |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 51 | { |
| 52 | struct pei_data pei_data = { |
| 53 | .pei_version = PEI_VERSION, |
| 54 | .mchbar = (uintptr_t)DEFAULT_MCHBAR, |
| 55 | .dmibar = (uintptr_t)DEFAULT_DMIBAR, |
| 56 | .epbar = DEFAULT_EPBAR, |
Kyösti Mälkki | 503d324 | 2019-03-05 07:54:28 +0200 | [diff] [blame] | 57 | .pciexbar = CONFIG_MMCONF_BASE_ADDRESS, |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 58 | .smbusbar = SMBUS_IO_BASE, |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 59 | .hpet_address = HPET_ADDR, |
| 60 | .rcba = (uintptr_t)DEFAULT_RCBA, |
| 61 | .pmbase = DEFAULT_PMBASE, |
| 62 | .gpiobase = DEFAULT_GPIOBASE, |
| 63 | .temp_mmio_base = 0xfed08000, |
| 64 | .system_type = 5, /* ULT */ |
| 65 | .tseg_size = CONFIG_SMM_TSEG_SIZE, |
| 66 | .spd_addresses = { 0xa0, 0x00, 0xa4, 0x00 }, |
| 67 | .ec_present = 0, |
| 68 | // 0 = leave channel enabled |
| 69 | // 1 = disable dimm 0 on channel |
| 70 | // 2 = disable dimm 1 on channel |
| 71 | // 3 = disable dimm 0+1 on channel |
| 72 | .dimm_channel0_disabled = 2, |
| 73 | .dimm_channel1_disabled = 2, |
| 74 | // Enable 2x refresh mode |
| 75 | .ddr_refresh_2x = 1, |
| 76 | .dq_pins_interleaved = 1, |
| 77 | .max_ddr3_freq = 1600, |
| 78 | .usb_xhci_on_resume = 1, |
| 79 | .usb2_ports = { |
| 80 | /* Length, Enable, OCn#, Location */ |
| 81 | { 0x0064, 1, 0, /* P0: VP8 */ |
| 82 | USB_PORT_MINI_PCIE }, |
| 83 | { 0x0040, 1, 0, /* P1: Port A, CN22 */ |
| 84 | USB_PORT_INTERNAL }, |
| 85 | { 0x0040, 1, 1, /* P2: Port B, CN23 */ |
| 86 | USB_PORT_INTERNAL }, |
| 87 | { 0x0040, 1, USB_OC_PIN_SKIP, /* P3: WLAN */ |
| 88 | USB_PORT_INTERNAL }, |
| 89 | { 0x0040, 1, 2, /* P4: Port C, CN25 */ |
| 90 | USB_PORT_INTERNAL }, |
| 91 | { 0x0040, 1, 2, /* P5: Port D, CN25 */ |
| 92 | USB_PORT_INTERNAL }, |
| 93 | { 0x0040, 1, USB_OC_PIN_SKIP, /* P6: Card Reader */ |
| 94 | USB_PORT_INTERNAL }, |
| 95 | { 0x0000, 0, 0, /* P7: N/C */ |
| 96 | USB_PORT_SKIP }, |
| 97 | }, |
| 98 | .usb3_ports = { |
| 99 | /* Enable, OCn# */ |
| 100 | { 1, 0 }, /* P1; CN22 */ |
| 101 | { 1, 1 }, /* P2; CN23 */ |
| 102 | { 1, 2 }, /* P3; CN25 */ |
| 103 | { 1, 2 }, /* P4; CN25 */ |
| 104 | }, |
| 105 | }; |
| 106 | |
| 107 | struct romstage_params romstage_params = { |
| 108 | .pei_data = &pei_data, |
| 109 | .gpio_map = &mainboard_gpio_map, |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 110 | }; |
| 111 | |
| 112 | /* Early SuperIO setup */ |
| 113 | ite_kill_watchdog(IT8772F_GPIO_DEV); |
Elyes HAOUAS | f5f1b38 | 2018-04-26 09:43:03 +0200 | [diff] [blame] | 114 | it8772f_ac_resume_southbridge(IT8772F_SUPERIO_DEV); |
Matt DeVillier | 81ae67a | 2016-11-08 15:04:30 -0600 | [diff] [blame] | 115 | pch_enable_lpc(); |
| 116 | ite_enable_serial(IT8772F_SERIAL_DEV, CONFIG_TTYS0_BASE); |
| 117 | |
| 118 | /* Turn on Power LED */ |
| 119 | set_power_led(LED_ON); |
| 120 | |
| 121 | /* Call into the real romstage main with this board's attributes. */ |
| 122 | romstage_common(&romstage_params); |
| 123 | } |