Add EC component for SMSC MEC1308/1310
[coreboot.git] / src / ec / smsc / mec1308 / ec.h
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2011 The Chromium OS Authors. All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * Mailbox EC communication interface for SMSC MEC1308 Embedded Controller.
20  */
21
22 #ifndef _EC_SMSC_MEC1308_EC_H
23 #define _EC_SMSC_MEC1308_EC_H
24
25 #define EC_TIMEOUT           0xfff
26 #define EC_MAILBOX_COMMAND   0x82  // Send a command
27 #define EC_MAILBOX_DATA      0x84  // Send data with a command
28 #define EC_MAILBOX_DATA_H    0x85  // Send data with a command
29 #define EC_RAM_READ          0x88  // Read from RAM
30 #define EC_RAM_WRITE         0x89  // Write to RAM
31
32 int send_ec_command(u8 command);
33 int send_ec_command_data(u8 command, u8 data);
34 u8 read_ec_command_byte(u8 command);
35 u8 ec_read(u8 addr);
36 int ec_write(u8 addr, u8 data);
37 void ec_set_bit(u8 addr, u8 bit);
38 void ec_clr_bit(u8 addr, u8 bit);
39 void ec_set_ports(u16 cmd_reg, u16 data_reg);
40
41 #endif /* _EC_SMSC_MEC1308_EC_H */