• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 /*
4  * EC communication interface for COMPAL ENE932 Embedded Controller.
5  */
6 
7 #ifndef _EC_COMPAL_ENE932_EC_H
8 #define _EC_COMPAL_ENE932_EC_H
9 
10 #include <stdint.h>
11 
12 #define EC_IO 0xfd60 /* Mainboard specific. Could be Kconfig option */
13 #define EC_IO_HIGH EC_IO + 1
14 #define EC_IO_LOW  EC_IO + 2
15 #define EC_IO_DATA EC_IO + 3
16 
17 /* ENE EC internal address space */
18 #define REG_SPI_DATA    0xfeab
19 #define REG_SPI_COMMAND 0xfeac
20 #define REG_SPI_CONFIG  0xfead
21 #define CFG_CSn_FORCE_LOW        (1 << 4)
22 #define CFG_COMMAND_WRITE_ENABLE (1 << 3)
23 #define CFG_STATUS               (1 << 1)
24 
25 #define KBD_DATA	0x60
26 #define KBD_COMMAND	0x64
27 #define KBD_STATUS	0x64
28 #define   KBD_IBF	(1 << 1) // 1: input buffer full (data ready for ec)
29 #define   KBD_OBF	(1 << 0) // 1: output buffer full (data ready for host)
30 
31 /* Wait 400ms for keyboard controller answers */
32 #define KBC_TIMEOUT_IN_MS 400
33 
34 u8 ec_kbc_read_ob(void);
35 void ec_kbc_write_cmd(u8 cmd);
36 void ec_kbc_write_ib(u8 data);
37 int kbc_cleanup_buffers(void);
38 
39 #endif /* _EC_COMPAL_ENE932_EC_H */
40