Skip to content

Commit 288cfda

Browse files
committed
ec/ite: Move e-flash signature to 0x80
According to the datasheet, the e-flash signature can be at any 16-byte aligned address in 0x40-0xF0. Because of an address conflict with SDCC 4.5.0, move the signature to 0x80. This matches the address for Zephyr RISC-V SoCs, like 82302. Ref: zephyrproject-rtos/zephyr#36379 Signed-off-by: Tim Crawford <tcrawford@system76.com>
1 parent 4851eb4 commit 288cfda

1 file changed

Lines changed: 27 additions & 10 deletions

File tree

src/ec/ite/signature.c

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
11
// SPDX-License-Identifier: GPL-3.0-only
22

3+
// ITE SoCs have a hardware mechanism to check if e-flash is programmed by a
4+
// 16-byte signature check at power-on. It must be at a 16-byte aligned address
5+
// at 0x40-0xF0.
6+
37
#include <ec/espi.h>
48

9+
// NOTE: SDCC 4.5.0 causes a conflict with the default address of 0x40, so the
10+
// signature is moved to 0x80, which matches the address used by RISC-V SoCs
11+
// in Zephyr.
12+
#define EFLASH_SIG_ADDR 0x80
13+
14+
// Byte 7: Undocumented
15+
// - Bit 0: Host bus type (0=eSPI, 1=LPC)
516
#if CONFIG_BUS_ESPI
6-
// eSPI signature (byte 7 = 0xA4)
7-
static __code const uint8_t __at(0x40) SIGNATURE[16] = {
8-
0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA4, 0x95,
9-
0x85, 0x12, 0x5A, 0x5A, 0xAA, 0x00, 0x55, 0x55,
10-
};
11-
#else // CONFIG_BUS_ESPI
12-
// LPC signature (byte 7 = 0xA5)
13-
static __code const uint8_t __at(0x40) SIGNATURE[16] = {
14-
0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0x94,
17+
#define HBUS 0xA4
18+
#else
19+
#define HBUS 0xA5
20+
#endif
21+
22+
// Byte 8: "flag" (mostly undocumented)
23+
// - Bit 6: Suspend internal-to-external clock switching (0=Disable)
24+
// - Bit 4: 32 kHz clock selection (1=Use internal clock generator)
25+
#define FLAG 0x95
26+
27+
// Byte 14: "Undocumented"; Using the documented value (0xAA) results in
28+
// firmware not running at power-on. Proprietary firmware programs the byte
29+
// with values such as 0x7F and 0xFF.
30+
31+
static __code const uint8_t __at(EFLASH_SIG_ADDR) SIGNATURE[16] = {
32+
0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, HBUS, FLAG,
1533
0x85, 0x12, 0x5A, 0x5A, 0xAA, 0x00, 0x55, 0x55,
1634
};
17-
#endif // CONFIG_BUS_ESPI

0 commit comments

Comments
 (0)