Debian Codegraph @

src/mainboard/google/poppy/variants/nautilus/mainboard.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <baseboard/variants.h>
4 #include <chip.h>
5 #include <arch/io.h>
6 #include <device/device.h>
7 #include <device/pci_ops.h>
8 #include <smbios.h>
9 #include <static.h>
10 #include <stdio.h>
11 #include <variant/sku.h>
12
13 #define R_PCH_OC_WDT_CTL 0x54
14 #define B_PCH_OC_WDT_CTL_FORCE_ALL BIT15
15 #define B_PCH_OC_WDT_CTL_EN BIT14
16 #define B_PCH_OC_WDT_CTL_UNXP_RESET_STS BIT22
17
18 const char *smbios_system_sku(void)
19 {
20 static char sku_str[5]; /* sku{0-1} */
21
22 snprintf(sku_str, sizeof(sku_str), "sku%u", variant_board_sku());
23
24 return sku_str;
25 }
26
27 /* Override dev tree settings per board */
28 void variant_devtree_update(void)
29 {
30 uint32_t sku_id = variant_board_sku();
31 uint16_t abase;
32 uint32_t val32;
33
34 config_t *cfg = config_of_soc();
35
36 switch (sku_id) {
37 case SKU_0_NAUTILUS:
38 /* Disable LTE module */
39 cfg->usb3_ports[3].enable = 0;
40
41 /* OC_WDT has been enabled in FSP-M by enabling SaOcSupport.
42 * We should clear it to prevent turning the system off. */
43 abase = pci_read_config16(PCH_DEV_PMC, ABASE) & 0xfffc;
44 val32 = inl(abase + R_PCH_OC_WDT_CTL);
45 val32 &= ~(B_PCH_OC_WDT_CTL_EN |
46 B_PCH_OC_WDT_CTL_FORCE_ALL |
47 B_PCH_OC_WDT_CTL_UNXP_RESET_STS);
48 outl(val32, abase + R_PCH_OC_WDT_CTL);
49 break;
50
51 case SKU_1_NAUTILUS_LTE:
52 /* LTE board has different layout with Wifi sku, it need
53 new USB2 port strength settings */
54
55 /* Configure USB2 port 0 - USB2_PORT_TYPE_C(OC1) */
56 cfg->usb2_ports[0].enable = 1;
57 cfg->usb2_ports[0].ocpin = OC1;
58 cfg->usb2_ports[0].tx_bias = USB2_BIAS_0MV;
59 cfg->usb2_ports[0].tx_emp_enable = USB2_PRE_EMP_ON;
60 cfg->usb2_ports[0].pre_emp_bias = USB2_BIAS_56MV;
61 cfg->usb2_ports[0].pre_emp_bit = USB2_HALF_BIT_PRE_EMP;
62
63 /* Configure USB2 port 1 - USB2_PORT_LONG(OC2) */
64 cfg->usb2_ports[1].enable = 1;
65 cfg->usb2_ports[1].ocpin = OC2;
66 cfg->usb2_ports[1].tx_bias = USB2_BIAS_39MV;
67 cfg->usb2_ports[1].tx_emp_enable = USB2_PRE_EMP_ON;
68 cfg->usb2_ports[1].pre_emp_bias = USB2_BIAS_56MV;
69 cfg->usb2_ports[1].pre_emp_bit = USB2_HALF_BIT_PRE_EMP;
70
71 /* Configure USB2 port 4 - USB2_PORT_TYPE_C(OC0) */
72 cfg->usb2_ports[4].enable = 1;
73 cfg->usb2_ports[4].ocpin = OC0;
74 cfg->usb2_ports[4].tx_bias = USB2_BIAS_0MV;
75 cfg->usb2_ports[4].tx_emp_enable = USB2_PRE_EMP_ON;
76 cfg->usb2_ports[4].pre_emp_bias = USB2_BIAS_56MV;
77 cfg->usb2_ports[4].pre_emp_bit = USB2_HALF_BIT_PRE_EMP;
78
79 /* Override SlowSlewRate settings */
80 cfg->SlowSlewRateForIa = 0;
81 cfg->SlowSlewRateForGt = 0;
82 cfg->SlowSlewRateForSa = 0;
83 break;
84
85 default:
86 break;
87 }
88 }