xref: /OK3568_Linux_fs/kernel/Documentation/ABI/testing/debugfs-wilco-ec (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunWhat:		/sys/kernel/debug/wilco_ec/h1_gpio
2*4882a593SmuzhiyunDate:		April 2019
3*4882a593SmuzhiyunKernelVersion:	5.2
4*4882a593SmuzhiyunDescription:
5*4882a593Smuzhiyun		As part of Chrome OS's FAFT (Fully Automated Firmware Testing)
6*4882a593Smuzhiyun		tests, we need to ensure that the H1 chip is properly setting
7*4882a593Smuzhiyun		some GPIO lines. The h1_gpio attribute exposes the state
8*4882a593Smuzhiyun		of the lines:
9*4882a593Smuzhiyun		- ENTRY_TO_FACT_MODE in BIT(0)
10*4882a593Smuzhiyun		- SPI_CHROME_SEL in BIT(1)
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun		Output will formatted with "0x%02x\n".
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunWhat:		/sys/kernel/debug/wilco_ec/raw
15*4882a593SmuzhiyunDate:		January 2019
16*4882a593SmuzhiyunKernelVersion:	5.1
17*4882a593SmuzhiyunDescription:
18*4882a593Smuzhiyun		Write and read raw mailbox commands to the EC.
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun		You can write a hexadecimal sentence to raw, and that series of
21*4882a593Smuzhiyun		bytes will be sent to the EC. Then, you can read the bytes of
22*4882a593Smuzhiyun		response by reading from raw.
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun		For writing, bytes 0-1 indicate the message type, one of enum
25*4882a593Smuzhiyun		wilco_ec_msg_type. Byte 2+ consist of the data passed in the
26*4882a593Smuzhiyun		request, starting at MBOX[0]. At least three bytes are required
27*4882a593Smuzhiyun		for writing, two for the type and at least a single byte of
28*4882a593Smuzhiyun		data.
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun		Example::
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun		    // Request EC info type 3 (EC firmware build date)
33*4882a593Smuzhiyun		    // Corresponds with sending type 0x00f0 with
34*4882a593Smuzhiyun		    // MBOX = [38, 00, 03, 00]
35*4882a593Smuzhiyun		    $ echo 00 f0 38 00 03 00 > /sys/kernel/debug/wilco_ec/raw
36*4882a593Smuzhiyun		    // View the result. The decoded ASCII result "12/21/18" is
37*4882a593Smuzhiyun		    // included after the raw hex.
38*4882a593Smuzhiyun		    // Corresponds with MBOX = [00, 00, 31, 32, 2f, 32, 31, 38, ...]
39*4882a593Smuzhiyun		    $ cat /sys/kernel/debug/wilco_ec/raw
40*4882a593Smuzhiyun		    00 00 31 32 2f 32 31 2f 31 38 00 38 00 01 00 2f 00  ..12/21/18.8...
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun		Note that the first 16 bytes of the received MBOX[] will be
43*4882a593Smuzhiyun		printed, even if some of the data is junk, and skipping bytes
44*4882a593Smuzhiyun		17 to 32. It is up to you to know how many of the first bytes of
45*4882a593Smuzhiyun		data are the actual response.
46