|
1 | 1 | // SPDX-License-Identifier: GPL-3.0-only |
2 | 2 |
|
| 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 | + |
3 | 7 | #include <ec/espi.h> |
4 | 8 |
|
| 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) |
5 | 16 | #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, |
15 | 33 | 0x85, 0x12, 0x5A, 0x5A, 0xAA, 0x00, 0x55, 0x55, |
16 | 34 | }; |
17 | | -#endif // CONFIG_BUS_ESPI |
|
0 commit comments