blob: f3865fc359588b6441d3ba815488238969bbd578 [file] [log] [blame]
Dennis Wassenbergbd105162015-09-10 12:20:58 +02001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2016 secunet Security Networks AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
Arthur Heymansfa5d0f82019-11-12 19:11:50 +010016#include <bootblock_common.h>
Dennis Wassenbergbd105162015-09-10 12:20:58 +020017#include <stdint.h>
18#include <device/pci.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +020019#include <device/pci_ops.h>
Kyösti Mälkki3855c012019-03-03 08:45:19 +020020#include <device/pnp_ops.h>
Dennis Wassenbergbd105162015-09-10 12:20:58 +020021#include <device/pnp.h>
22#include <northbridge/intel/sandybridge/raminit.h>
23#include <northbridge/intel/sandybridge/raminit_native.h>
24#include <northbridge/intel/sandybridge/sandybridge.h>
25#include <southbridge/intel/bd82x6x/pch.h>
26#include <superio/ite/it8783ef/it8783ef.h>
27#include <superio/ite/common/ite.h>
28
Arthur Heymansfa5d0f82019-11-12 19:11:50 +010029void bootblock_mainboard_early_init(void)
Dennis Wassenbergbd105162015-09-10 12:20:58 +020030{
31 const pnp_devfn_t dev = PNP_DEV(0x2e, IT8783EF_GPIO);
32
33 pnp_enter_conf_state(dev);
34 pnp_set_logical_device(dev);
35
36 pnp_write_config(dev, 0x23, ITE_UART_CLK_PREDIVIDE_24);
37
38 /* Switch multi function for UART4 */
39 pnp_write_config(dev, 0x2a, 0x04);
40 /* Switch multi function for UART3 */
41 pnp_write_config(dev, 0x2c, 0x13);
42
43 /* No GPIOs used: Clear any output / pull-up that's set by default */
44 pnp_write_config(dev, 0xb8, 0x00);
45 pnp_write_config(dev, 0xc0, 0x00);
46 pnp_write_config(dev, 0xc3, 0x00);
47 pnp_write_config(dev, 0xc8, 0x00);
48 pnp_write_config(dev, 0xcb, 0x00);
49 pnp_write_config(dev, 0xef, 0x00);
50
51 pnp_exit_conf_state(dev);
52}
53
54void mainboard_fill_pei_data(struct pei_data *const pei_data)
55{
56 const struct pei_data pei_data_template = {
57 .pei_version = PEI_VERSION,
58 .mchbar = (uintptr_t)DEFAULT_MCHBAR,
59 .dmibar = (uintptr_t)DEFAULT_DMIBAR,
60 .epbar = DEFAULT_EPBAR,
61 .pciexbar = CONFIG_MMCONF_BASE_ADDRESS,
62 .smbusbar = SMBUS_IO_BASE,
63 .wdbbar = 0x4000000,
64 .wdbsize = 0x1000,
65 .hpet_address = CONFIG_HPET_ADDRESS,
66 .rcba = (uintptr_t)DEFAULT_RCBABASE,
67 .pmbase = DEFAULT_PMBASE,
68 .gpiobase = DEFAULT_GPIOBASE,
69 .thermalbase = 0xfed08000,
70 .system_type = 0, // 0 Mobile, 1 Desktop/Server
71 .tseg_size = CONFIG_SMM_TSEG_SIZE,
72 .spd_addresses = { 0xA0, 0xA2, 0xA4, 0xA6 },
73 .ts_addresses = { 0x00, 0x00, 0x00, 0x00 },
74 .ec_present = 1,
75 .gbe_enable = 1,
76 .ddr3lv_support = 0,
77 // 0 = leave channel enabled
78 // 1 = disable dimm 0 on channel
79 // 2 = disable dimm 1 on channel
80 // 3 = disable dimm 0+1 on channel
81 .dimm_channel0_disabled = 0,
82 .dimm_channel1_disabled = 0,
83 .max_ddr3_freq = 1600,
84 .usb_port_config = {
85 /* Enabled / OC PIN / Length */
86 { 1, 0, 0x0080 }, /* P00: 1st (left) USB3 (OC #0) */
87 { 1, 0, 0x0080 }, /* P01: 2nd (left) USB3 (OC #0) */
88 { 1, 1, 0x0080 }, /* P02: 1st Multibay USB3 (OC #1) */
89 { 1, 1, 0x0080 }, /* P03: 2nd Multibay USB3 (OC #1) */
90 { 1, 8, 0x0040 }, /* P04: MiniPCIe 1 USB2 (no OC) */
91 { 1, 8, 0x0040 }, /* P05: MiniPCIe 2 USB2 (no OC) */
92 { 1, 8, 0x0040 }, /* P06: USB Hub x4 USB2 (no OC) */
93 { 1, 8, 0x0040 }, /* P07: MiniPCIe 4 USB2 (no OC) */
94 { 1, 8, 0x0080 }, /* P08: SD card reader USB2 (no OC) */
95 { 1, 4, 0x0080 }, /* P09: 3rd (right) USB2 (OC #4) */
96 { 1, 5, 0x0040 }, /* P10: 4th (right) USB2 (OC #5) */
97 { 1, 8, 0x0040 }, /* P11: 3rd Multibay USB2 (no OC) */
98 { 1, 8, 0x0080 }, /* P12: misc internal USB2 (no OC) */
99 { 1, 6, 0x0080 }, /* P13: misc internal USB2 (OC #6) */
100 },
101 .usb3 = {
102 .mode = 3, /* Smart Auto? */
103 .hs_port_switch_mask = 0xf, /* All four ports. */
104 .preboot_support = 1, /* preOS driver? */
105 .xhci_streams = 1, /* Enable. */
106 },
107 .pcie_init = 1,
108 };
109 *pei_data = pei_data_template;
110}
111
112const struct southbridge_usb_port mainboard_usb_ports[] = {
113 /* Enabled / Power / OC PIN */
114 { 1, 1, 0 }, /* P00: 1st (left) USB3 (OC #0) */
115 { 1, 1, 0 }, /* P01: 2nd (left) USB3 (OC #0) */
116 { 1, 1, 1 }, /* P02: 1st Multibay USB3 (OC #1) */
117 { 1, 1, 1 }, /* P03: 2nd Multibay USB3 (OC #1) */
118 { 1, 0, 8 }, /* P04: MiniPCIe 1 USB2 (no OC) */
119 { 1, 0, 8 }, /* P05: MiniPCIe 2 USB2 (no OC) */
120 { 1, 0, 8 }, /* P06: USB Hub x4 USB2 (no OC) */
121 { 1, 0, 8 }, /* P07: MiniPCIe 4 USB2 (no OC) */
122 { 1, 1, 8 }, /* P08: SD card reader USB2 (no OC) */
123 { 1, 1, 4 }, /* P09: 3rd (right) USB2 (OC #4) */
124 { 1, 0, 5 }, /* P10: 4th (right) USB2 (OC #5) */
125 { 1, 0, 8 }, /* P11: 3rd Multibay USB2 (no OC) */
126 { 1, 1, 8 }, /* P12: misc internal USB2 (no OC) */
127 { 1, 1, 6 }, /* P13: misc internal USB2 (OC #6) */
128};
129
130void mainboard_get_spd(spd_raw_data *spd, bool id_only)
131{
132 read_spd(&spd[0], 0x50, id_only);
133 read_spd(&spd[1], 0x51, id_only);
134 read_spd(&spd[2], 0x52, id_only);
135 read_spd(&spd[3], 0x53, id_only);
136}