1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
|
/* Copyright 2017 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/*
* Microchip Evaluation Board (EVB) with
* MEC1701H 144-pin processor card.
* EVB connected to Intel SKL RVP3 configured
* for eSPI with Kabylake silicon.
*/
#ifndef __CROS_EC_BOARD_H
#define __CROS_EC_BOARD_H
/*
* Initial board bringup and prevent power button task from
* generating event to exit G3 state.
*
* #define CONFIG_BRINGUP
*/
/*
* Debug on EVB with CONFIG_CHIPSET_DEBUG
* Keep WDG disabled and JTAG enabled.
* CONFIG_BOARD_PRE_INIT enables JTAG early
*/
/* #define CONFIG_CHIPSET_DEBUG */
#ifdef CONFIG_CHIPSET_DEBUG
#ifndef CONFIG_BOARD_PRE_INIT
#define CONFIG_BOARD_PRE_INIT
#endif
#endif
/*
* DEBUG: Add CRC32 in last 4 bytes of EC_RO/RW binaries
* in SPI. LFW will use DMA CRC32 HW to check data integrity.
* #define CONFIG_MCHP_LFW_DEBUG
*/
/*
* Override Boot-ROM JTAG mode
* 0x01 = 4-pin standard JTAG
* 0x03 = ARM 2-pin SWD + 1-pin SWV
* 0x05 = ARM 2-pin SWD no SWV
*/
#define CONFIG_MCHP_JTAG_MODE 0x03
/*
* Enable Trace FIFO Debug port
* When this is undefined all TRACEn() and tracen()
* macros are defined as blank.
* Uncomment this define to enable these messages.
* Only enable if GPIO's 0171 & 0171 are available therefore
* define this at the board level.
*/
/* #define CONFIG_MCHP_TFDP */
/*
* Enable MCHP specific GPIO EC UART commands
* for debug.
*/
/* #define CONFIG_MEC_GPIO_EC_CMDS */
/*
* Enable CPRINT in chip eSPI module
* and EC UART test command.
*/
/* #define CONFIG_MCHP_ESPI_DEBUG */
/*
* Enable board specific ISR on ALL_SYS_PWRGD signal.
* Requires for handling Kabylake/Skylake RVP3 board's
* ALL_SYS_PWRGD signal.
*/
#define CONFIG_BOARD_EC_HANDLES_ALL_SYS_PWRGD
/*
* EVB eSPI test mode (no eSPI master connected)
*/
/*
* #define EVB_NO_ESPI_TEST_MODE
*/
/*
* DEBUG
* Disable ARM Cortex-M4 write buffer so
* exceptions become synchronous.
*
* #define CONFIG_DEBUG_DISABLE_WRITE_BUFFER
*/
/* New eSPI slave configuration items */
/*
* Maximum clock frequence eSPI EC slave advertises
* Values in MHz are 20, 25, 33, 50, and 66
*/
/* KBL + EVB fly-wire hook up only supports 20MHz */
#define CONFIG_HOSTCMD_ESPI_EC_MAX_FREQ 20
/*
* EC eSPI slave advertises IO lanes
* 0 = Single
* 1 = Single and Dual
* 2 = Single and Quad
* 3 = Single, Dual, and Quad
*/
/* KBL + EVB fly-wire hook up only support Single mode */
#define CONFIG_HOSTCMD_ESPI_EC_MODE 0
/*
* Bit map of eSPI channels EC advertises
* bit[0] = 1 Peripheral channel
* bit[1] = 1 Virtual Wire channel
* bit[2] = 1 OOB channel
* bit[3] = 1 Flash channel
*/
#define CONFIG_HOSTCMD_ESPI_EC_CHAN_BITMAP 0x0F
#define CONFIG_MCHP_ESPI_VW_SAVE_ON_SLEEP
/*
* Allow dangerous commands.
* TODO(shawnn): Remove this config before production.
*/
#define CONFIG_SYSTEM_UNLOCKED
/* Optional features */
#define CONFIG_ACCELGYRO_BMI160
/* #define CONFIG_ACCEL_KX022 */
/* #define CONFIG_ALS */
/* #define CONFIG_ALS_OPT3001 */
#define CONFIG_BATTERY_CUT_OFF
#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_PRESENT_L
#define CONFIG_BATTERY_SMART
#define CONFIG_BOARD_VERSION_GPIO
#define CONFIG_BUTTON_COUNT 2
/* #define CONFIG_CHARGE_MANAGER */
/* #define CONFIG_CHARGE_RAMP_SW */
/* #define CONFIG_CHARGER */
/* #define CONFIG_CHARGER_DISCHARGE_ON_AC */
/* #define CONFIG_CHARGER_ISL9237 */
/* #define CONFIG_CHARGER_ILIM_PIN_DISABLED */
/* #define CONFIG_CHARGER_INPUT_CURRENT 512 */
/*
* MCHP disable this for Kabylake eSPI bring up
* #define CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON 1
*/
/* #define CONFIG_CHARGER_NARROW_VDC */
/* #define CONFIG_CHARGER_PROFILE_OVERRIDE */
/* #define CONFIG_CHARGER_SENSE_RESISTOR 10 */
/* #define CONFIG_CHARGER_SENSE_RESISTOR_AC 20 */
/* #define CONFIG_CMD_CHARGER_ADC_AMON_BMON */
#define CONFIG_CHIPSET_SKYLAKE
#define CONFIG_CHIPSET_RESET_HOOK
#define CONFIG_HOSTCMD_ESPI
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
#define CONFIG_CLOCK_CRYSTAL
#define CONFIG_EXTPOWER_GPIO
/* #define CONFIG_HOSTCMD_PD */
/* #define CONFIG_HOSTCMD_PD_PANIC */
#define CONFIG_I2C
#define CONFIG_I2C_MASTER
#define CONFIG_KEYBOARD_PROTOCOL_8042
#define CONFIG_LED_COMMON
#ifdef CONFIG_ACCEL_KX022
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#endif /* CONFIG_ACCEL_KX022 */
#define CONFIG_LID_SWITCH
/*
* Enable MCHP Low Power Idle support
* and API to power down pins
* #define CONFIG_LOW_POWER_IDLE
*/
/* #define CONFIG_GPIO_POWER_DOWN */
/*
* Turn off pin modules during deep sleep.
* Requires CONFIG_GPIO_POWER_DOWN
*/
/* #define CONFIG_MCHP_DEEP_SLP_GPIO_PWR_DOWN */
/*
* DEBUG: Configure MEC17xx GPIO060 as 48MHZ_OUT to
* verify & debug clock is shutdown in heavy sleep.
*/
#define CONFIG_MCHP_48MHZ_OUT
/*
* DEBUG: Save and print out PCR sleep enables,
* clock required, and interrupt aggregator result
* registers.
*/
#define CONFIG_MCHP_DEEP_SLP_DEBUG
/*
* MCHP debug EC code turn off GCC link-time-optimization
* #define CONFIG_LTO
*/
#define CONFIG_POWER_BUTTON
#define CONFIG_POWER_BUTTON_X86
#define CONFIG_POWER_COMMON
#define CONFIG_POWER_SIGNAL_INTERRUPT_STORM_DETECT_THRESHOLD 30
/*
* MEC1701H SCI is virtual wire on eSPI
*#define CONFIG_SCI_GPIO GPIO_PCH_SCI_L
*/
#if 0 /* MCHP EVB + KBL/SKL RVP3 no USB charging hardware */
#define CONFIG_USB_CHARGER
#define CONFIG_USB_MUX_PI3USB30532
#define CONFIG_USB_MUX_PS8740
#define CONFIG_USB_POWER_DELIVERY
#define CONFIG_USB_PD_ALT_MODE
#define CONFIG_USB_PD_ALT_MODE_DFP
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_LOGGING
#define CONFIG_USB_PD_PORT_COUNT 2
#define CONFIG_USB_PD_TCPM_TCPCI
#endif
/*
* #define CONFIG_USB_PD_TCPC
* #define CONFIG_USB_PD_TCPM_STUB
*/
#if 0
#define CONFIG_USB_PD_TRY_SRC
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_BC12_DETECT_PI3USB9281
#define CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT 2
#define CONFIG_USBC_SS_MUX
#define CONFIG_USBC_SS_MUX_DFP_ONLY
#define CONFIG_USBC_VCONN
#define CONFIG_USBC_VCONN_SWAP
#endif
#define CONFIG_VBOOT_HASH
/*
* MEC1701H loads firmware using QMSPI controller
* CONFIG_SPI_FLASH_PORT is the index into
* spi_devices[] in board.c
*/
#define CONFIG_SPI_FLASH_PORT 0
#define CONFIG_SPI_FLASH
/*
* Google uses smaller flashes on chromebook boards
* MCHP SPI test dongle for EVB uses 16MB W25Q128F
* Configure for smaller flash is OK for testing except
* for SPI flash lock bit.
*/
#define CONFIG_FLASH_SIZE 524288
#define CONFIG_SPI_FLASH_W25X40
/*
* #define CONFIG_FLASH_SIZE 0x1000000
* #define CONFIG_SPI_FLASH_W25Q128
*/
/*
* Enable extra SPI flash and generic SPI
* commands via EC UART
*/
#define CONFIG_CMD_SPI_FLASH
#define CONFIG_CMD_SPI_XFER
/* common software SHA256 required by vboot and rollback */
#define CONFIG_SHA256
/*
* Enable MCHP SHA256 hardware accelerator module.
* API is same as software SHA256 but prefixed with "chip_"
* #define CONFIG_SHA256_HW
*/
/* enable console command to test HW Hash engine
* #define CONFIG_CMD_SHA256_TEST
*/
/*
* MEC17xx EVB + SKL/KBL RVP3 does not have
* BD99992GW PMIC with NCP15WB thermistor.
* We have connected a Maxim DS1624 I2C temperature
* sensor. The sensor board has a thermistor on it
* we connect to an EC ADC channel.
*/
#if 0
#define CONFIG_TEMP_SENSOR
#define CONFIG_TEMP_SENSOR_BD99992GW
#define CONFIG_THERMISTOR_NCP15WB
#define CONFIG_DPTF
#else
#define CONFIG_TEMP_SENSOR
#define CONFIG_DPTF
#endif
/* Enable GPSPI0 controller and port for
* SPI Accelerometer.
* bit[0] == 1 GPSPI0
* bit[1] == 0 board does not use GPSPI1
* Make sure to not include GPSPI in little-firmware(LFW)
*/
#ifndef LFW
#define CONFIG_MCHP_GPSPI 0x01
#endif
/* SPI Accelerometer
* CONFIG_SPI_FLASH_PORT is the index into
* spi_devices[] in board.c
*/
#define CONFIG_SPI_ACCEL_PORT 1
/*
* Enable EC UART commands to read/write
* motion sensor.
*/
#define CONFIG_CMD_ACCELS
/*
* Enable 1 slot of secure temporary storage to support
* suspend/resume with read/write memory training.
*/
#define CONFIG_VSTORE
#define CONFIG_VSTORE_SLOT_COUNT 1
#define CONFIG_WATCHDOG_HELP
#if 0 /* TODO - No wireless on EVB */
#define CONFIG_WIRELESS
#define CONFIG_WIRELESS_SUSPEND \
(EC_WIRELESS_SWITCH_WLAN | EC_WIRELESS_SWITCH_WLAN_POWER)
/* Wireless signals */
#define WIRELESS_GPIO_WLAN GPIO_WLAN_OFF_L
#define WIRELESS_GPIO_WLAN_POWER GPIO_PP3300_WLAN_EN
#endif
/* LED signals */
#define GPIO_BAT_LED_RED GPIO_CHARGE_LED_1
#define GPIO_BAT_LED_GREEN GPIO_CHARGE_LED_2
/* I2C ports */
#define I2C_CONTROLLER_COUNT 2
#define I2C_PORT_COUNT 2
/*
* Map I2C Ports to Controllers for this board.
*
* I2C Controller 0 ---- Port 0 -> PMIC, USB Charger 2
* |-- Port 2 -> USB Charger 1, USB Mux
*
* I2C Controller 1 ---- Port 3 -> PD MCU, TCPC
* I2C Controller 2 ---- Port 4 -> ALS, Accel
* I2C Controller 3 ---- Port 5 -> Battery, Charger
*
* All other ports set to 0xff (not used)
*/
#define I2C_PORT_PMIC MCHP_I2C_PORT10
#define I2C_PORT_USB_CHARGER_1 MCHP_I2C_PORT2
#define I2C_PORT_USB_MUX MCHP_I2C_PORT2
#define I2C_PORT_USB_CHARGER_2 MCHP_I2C_PORT2
#define I2C_PORT_PD_MCU MCHP_I2C_PORT3
#define I2C_PORT_TCPC MCHP_I2C_PORT3
#define I2C_PORT_ALS MCHP_I2C_PORT4
#define I2C_PORT_ACCEL MCHP_I2C_PORT4
#define I2C_PORT_BATTERY MCHP_I2C_PORT5
#define I2C_PORT_CHARGER MCHP_I2C_PORT5
/* Thermal sensors read through PMIC ADC interface */
#if 0
#define I2C_PORT_THERMAL I2C_PORT_PMIC
#else
#define I2C_PORT_THERMAL MCHP_I2C_PORT4
#endif
/* Ambient Light Sensor address */
#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
/* Modules we want to exclude */
#undef CONFIG_CMD_HASH
#undef CONFIG_CMD_TEMP_SENSOR
#undef CONFIG_CMD_TIMERINFO
/* #undef CONFIG_CONSOLE_CMDHELP */
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
#include "registers.h"
/* ADC signal */
enum adc_channel {
ADC_VBUS,
ADC_AMON_BMON,
ADC_PSYS,
ADC_CASE,
/* Number of ADC channels */
ADC_CH_COUNT
};
enum temp_sensor_id {
TEMP_SENSOR_BATTERY,
/* These temp sensors are only readable in S0 */
TEMP_SENSOR_AMBIENT,
TEMP_SENSOR_CASE,
/* TEMP_SENSOR_CHARGER, */
/* TEMP_SENSOR_DRAM, */
/* TEMP_SENSOR_WIFI, */
TEMP_SENSOR_COUNT
};
enum sensor_id {
BASE_ACCEL,
BASE_GYRO,
#ifdef CONFIG_ACCEL_KX022
LID_ACCEL,
#endif
SENSOR_COUNT,
};
/* Light sensors */
enum als_id {
ALS_OPT3001 = 0,
ALS_COUNT
};
/* TODO: determine the following board specific type-C power constants */
/*
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
#define PD_VCONN_SWAP_DELAY 5000 /* us */
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 15000
#define PD_MAX_POWER_MW 45000
#define PD_MAX_CURRENT_MA 3000
/* Try to negotiate to 20V since i2c noise problems should be fixed. */
#define PD_MAX_VOLTAGE_MV 20000
/*
* include TFDP macros from mchp chip level
*/
#include "tfdp_chip.h"
/* Map I2C port to controller */
int board_i2c_p2c(int port);
/* Return the two slave addresses the specified
* controller will respond to when controller
* is acting as a slave.
* b[6:0] = b[7:1] of I2C address 1
* b[14:8] = b[7:1] of I2C address 2
*/
uint16_t board_i2c_slave_addrs(int controller);
/* Reset PD MCU */
void board_reset_pd_mcu(void);
#ifdef CONFIG_LOW_POWER_IDLE
void board_prepare_for_deep_sleep(void);
void board_resume_from_deep_sleep(void);
#endif
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */
|