Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 2 | |
| 3 | #ifndef _EC_H |
| 4 | #define _EC_H |
Uwe Hermann | 257ae3f | 2009-04-22 12:28:14 +0000 | [diff] [blame] | 5 | |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 6 | /* EC_SC input */ |
Uwe Hermann | 257ae3f | 2009-04-22 12:28:14 +0000 | [diff] [blame] | 7 | #define EC_SMI_EVT (1 << 6) // 1: SMI event pending |
| 8 | #define EC_SCI_EVT (1 << 5) // 1: SCI event pending |
| 9 | #define EC_BURST (1 << 4) // controller is in burst mode |
| 10 | #define EC_CMD (1 << 3) // 1: byte in data register is command |
| 11 | // 0: byte in data register is data |
| 12 | #define EC_IBF (1 << 1) // 1: input buffer full (data ready for ec) |
| 13 | #define EC_OBF (1 << 0) // 1: output buffer full (data ready for host) |
| 14 | |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 15 | /* EC_SC output */ |
Uwe Hermann | 257ae3f | 2009-04-22 12:28:14 +0000 | [diff] [blame] | 16 | #define RD_EC 0x80 // Read Embedded Controller |
| 17 | #define WR_EC 0x81 // Write Embedded Controller |
| 18 | #define BE_EC 0x82 // Burst Enable Embedded Controller |
| 19 | #define BD_EC 0x83 // Burst Disable Embedded Controller |
| 20 | #define QR_EC 0x84 // Query Embedded Controller |
Anton Kochkov | 7e59f769 | 2010-06-29 21:13:20 +0000 | [diff] [blame] | 21 | #define RX_EC 0xf0 // Read Extended operation |
| 22 | #define WX_EC 0xf1 // Write Extended operation |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 23 | |
| 24 | int send_ec_command(uint8_t command); |
| 25 | int send_ec_data(uint8_t data); |
| 26 | int send_ec_data_nowait(uint8_t data); |
| 27 | uint8_t recv_ec_data(void); |
| 28 | uint8_t ec_read(uint8_t addr); |
Anton Kochkov | 7e59f769 | 2010-06-29 21:13:20 +0000 | [diff] [blame] | 29 | int ec_write(uint8_t addr, uint8_t data); |
| 30 | uint8_t ec_ext_read(uint16_t addr); |
| 31 | int ec_ext_write(uint16_t addr, uint8_t data); |
Stefan Reinauer | 984e0f3 | 2010-01-16 17:50:55 +0000 | [diff] [blame] | 32 | uint8_t ec_idx_read(uint16_t addr); |
Alexander Couzens | 0edf419 | 2015-02-06 22:27:33 +0100 | [diff] [blame] | 33 | uint8_t ec_query(void); |
Iru Cai | 2e8f4cc | 2018-01-25 21:44:09 +0800 | [diff] [blame] | 34 | int get_ec_ports(void); |
Uwe Hermann | 257ae3f | 2009-04-22 12:28:14 +0000 | [diff] [blame] | 35 | #endif |