mb/google/nissa/var/rull: add ssd timing and modify ssd GPIO pins of rtd3
[coreboot2.git] / src / mainboard / google / reef / variants / coral / mainboard.c
blob1e7ebba6b33831977ba875d67e541a998f2a9097
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <stdint.h>
4 #include <drivers/intel/gma/opregion.h>
5 #include <ec/google/chromeec/ec.h>
6 #include "baseboard/variants.h"
7 #include <soc/cpu.h>
8 #include <soc/intel/apollolake/chip.h>
9 #include <soc/gpio.h>
11 enum {
12 SKU_0_ASTRONAUT = 0,
13 SKU_1_ASTRONAUT = 1,
14 SKU_2_SANTA = 2,
15 SKU_3_SANTA = 3,
16 SKU_4_LAVA = 4,
17 SKU_5_LAVA = 5,
18 SKU_9_LAVA = 9,
19 SKU_10_LAVA = 10,
20 SKU_13_EPAULETTE = 13,
21 SKU_14_EPAULETTE = 14,
22 SKU_15_EPAULETTE = 15,
23 SKU_16_EPAULETTE = 16,
24 SKU_28_RABBID_RUGGED = 28,
25 SKU_30_BABYTIGER = 30,
26 SKU_31_RABBID = 31,
27 SKU_32_RABBID = 32,
28 SKU_33_BABYTIGER = 33,
29 SKU_52_BABYMEGA = 52,
30 SKU_53_BABYMEGA = 53,
31 SKU_61_ASTRONAUT = 61,
32 SKU_62_ASTRONAUT = 62,
33 SKU_160_NASHER = 160,
34 SKU_161_NASHER = 161,
35 SKU_162_NASHER = 162,
36 SKU_163_NASHER360 = 163,
37 SKU_164_NASHER360 = 164,
38 SKU_165_NASHER360 = 165,
39 SKU_166_NASHER360 = 166,
42 uint8_t variant_board_sku(void)
44 static int sku = -1;
46 if (sku == -1)
47 sku = google_chromeec_get_sku_id();
49 return sku;
52 void variant_nhlt_oem_overrides(const char **oem_id,
53 const char **oem_table_id,
54 uint32_t *oem_revision)
56 *oem_id = "coral";
57 *oem_table_id = CONFIG_VARIANT_DIR;
58 *oem_revision = variant_board_sku();
61 #define DW_I2C_SPEED_CONFIG(speedval, lcnt, hcnt, hold) \
62 { \
63 .speed = I2C_SPEED_ ## speedval, \
64 .scl_lcnt = (lcnt), \
65 .scl_hcnt = (hcnt), \
66 .sda_hold = (hold), \
69 static const struct dw_i2c_speed_config
70 rabbid_i2c_speed_config = DW_I2C_SPEED_CONFIG(FAST, 210, 107, 47);
72 static const struct dw_i2c_speed_config
73 babymega_i2c_speed_config = DW_I2C_SPEED_CONFIG(FAST, 210, 107, 47);
75 static const struct dw_i2c_speed_config
76 babytiger_i2c_speed_config = DW_I2C_SPEED_CONFIG(FAST, 210, 107, 47);
78 void mainboard_devtree_update(struct device *dev)
80 /* Override dev tree settings per board */
81 struct soc_intel_apollolake_config *cfg = dev->chip_info;
82 uint8_t sku_id;
84 sku_id = variant_board_sku();
86 switch (sku_id) {
87 case SKU_0_ASTRONAUT:
88 case SKU_1_ASTRONAUT:
89 cfg->usb2eye[1].Usb20PerPortPeTxiSet = 7;
90 cfg->usb2eye[1].Usb20PerPortTxiSet = 2;
91 break;
92 case SKU_2_SANTA:
93 case SKU_3_SANTA:
94 cfg->usb2eye[1].Usb20PerPortPeTxiSet = 7;
95 cfg->usb2eye[1].Usb20PerPortTxiSet = 2;
96 break;
97 case SKU_4_LAVA:
98 case SKU_5_LAVA:
99 case SKU_9_LAVA:
100 case SKU_10_LAVA:
101 cfg->usb2eye[1].Usb20PerPortPeTxiSet = 7;
102 cfg->usb2eye[1].Usb20PerPortTxiSet = 2;
103 break;
104 case SKU_28_RABBID_RUGGED:
105 case SKU_31_RABBID:
106 case SKU_32_RABBID:
107 cfg->common_soc_config.i2c[3].speed_config[0] = rabbid_i2c_speed_config;
108 cfg->common_soc_config.i2c[4].speed_config[0] = rabbid_i2c_speed_config;
109 break;
110 case SKU_30_BABYTIGER:
111 case SKU_33_BABYTIGER:
112 cfg->common_soc_config.i2c[3].speed_config[0] = babytiger_i2c_speed_config;
113 cfg->common_soc_config.i2c[4].speed_config[0] = babytiger_i2c_speed_config;
114 break;
115 case SKU_52_BABYMEGA:
116 case SKU_53_BABYMEGA:
117 cfg->common_soc_config.i2c[4].speed_config[0] = babymega_i2c_speed_config;
118 break;
119 case SKU_61_ASTRONAUT:
120 case SKU_62_ASTRONAUT:
121 cfg->usb2eye[1].Usb20PerPortPeTxiSet = 7;
122 cfg->usb2eye[1].Usb20PerPortTxiSet = 5;
123 break;
124 default:
125 break;
128 const char *mainboard_vbt_filename(void)
130 int sku_id = variant_board_sku();
131 switch (sku_id) {
132 case SKU_0_ASTRONAUT:
133 case SKU_1_ASTRONAUT:
134 return "vbt-astronaut.bin";
135 case SKU_2_SANTA:
136 case SKU_3_SANTA:
137 return "vbt-santa.bin";
138 case SKU_13_EPAULETTE:
139 case SKU_14_EPAULETTE:
140 case SKU_15_EPAULETTE:
141 case SKU_16_EPAULETTE:
142 return "vbt-epaulette.bin";
143 case SKU_28_RABBID_RUGGED:
144 return "vbt-rabbid_rugged.bin";
145 case SKU_30_BABYTIGER:
146 case SKU_33_BABYTIGER:
147 return "vbt-babytiger.bin";
148 case SKU_52_BABYMEGA:
149 case SKU_53_BABYMEGA:
150 return "vbt-babymega.bin";
151 case SKU_160_NASHER:
152 case SKU_161_NASHER:
153 case SKU_162_NASHER:
154 case SKU_163_NASHER360:
155 case SKU_164_NASHER360:
156 case SKU_165_NASHER360:
157 case SKU_166_NASHER360:
158 return "vbt-nasher.bin";
159 default:
160 return "vbt.bin";
164 static const struct pad_config nasher_gpio_tables[] = {
165 /* AVS_DMIC_CLK_A1 */
166 PAD_CFG_NF_IOSSTATE(GPIO_79, NATIVE, DEEP, NF1, Tx1RxDCRx0),
167 /* AVS_DMIC_CLK_B1 */
168 PAD_CFG_NF_IOSSTATE(GPIO_80, NATIVE, DEEP, NF1, Tx1RxDCRx0),
171 const struct pad_config *variant_sku_gpio_table(size_t *num)
173 int sku_id = variant_board_sku();
174 const struct pad_config *board_gpio_tables;
176 switch (sku_id) {
177 case SKU_160_NASHER:
178 case SKU_161_NASHER:
179 case SKU_162_NASHER:
180 case SKU_163_NASHER360:
181 case SKU_164_NASHER360:
182 case SKU_165_NASHER360:
183 case SKU_166_NASHER360:
184 *num = ARRAY_SIZE(nasher_gpio_tables);
185 board_gpio_tables = nasher_gpio_tables;
186 break;
187 default:
188 *num = 0;
189 board_gpio_tables = NULL;
190 break;
192 return board_gpio_tables;