tizen 2.4 release
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-sc8810 / i2c_phy.h
1 /******************************************************************************
2  ** File Name:      I2C_phy.h                                                 *
3  ** Author:         liuhao                                                   *
4  ** DATE:           06/28/2010                                                *
5  ** Copyright:      2010 Spreatrum, Incoporated. All Rights Reserved.         *
6  ** Description:    This file define the basic hw interfaces of I2C device.      *
7  ******************************************************************************
8
9  ******************************************************************************
10  **                        Edit History                                       *
11  ** ------------------------------------------------------------------------- *
12  ** DATE           NAME             DESCRIPTION                               *
13  ** 06/28/2010     liuhao     Create.                                   *
14  ******************************************************************************/
15
16 #ifndef _I2C_PHY_H_
17 #define _I2C_PHY_H_
18 /*----------------------------------------------------------------------------*
19  **                         Dependencies                                      *
20  **------------------------------------------------------------------------- */
21
22 #include "sci_types.h"
23
24 /**---------------------------------------------------------------------------*
25  **                             Compiler Flag                                 *
26  **--------------------------------------------------------------------------*/
27 #ifdef   __cplusplus
28 extern   "C"
29 {
30 #endif
31 /**---------------------------------------------------------------------------*
32 **                               Micro Define                                **
33 **---------------------------------------------------------------------------*/
34 typedef uint32 (*_init) (uint32 phy_id, uint32 freq, uint32 port);
35 typedef uint32 (*_start) (uint32 phy_id, uint8 addr, BOOLEAN rw, BOOLEAN ack_en);
36 typedef uint32 (*_write) (uint32 phy_id, uint8 *pCmd, uint32 len, BOOLEAN ack_en, BOOLEAN no_stop);
37 typedef uint32 (*_read) (uint32 phy_id, uint8 *pCmd, uint32 len, BOOLEAN ack_en);
38 typedef uint32 (*_stop) (uint32 phy_id);
39 typedef uint32 (*_sendack) (uint32 phy_id);
40 typedef uint32 (*_getack) (uint32 phy_id);
41
42 typedef struct
43 {
44     _init init;
45     _start start;
46     _write write;
47     _read read;
48     _stop stop;
49     _sendack sendack;
50     _getack getack;
51 } I2C_PHY_FUN;
52
53 //I2C error code define
54 typedef enum
55 {
56     ERR_I2C_NONE = 0,               // Success,no error
57     ERR_I2C_ACK_TIMEOUT,            // I2C wait ACK timeout
58     ERR_I2C_INT_TIMEOUT,            // I2C wait INT timeout
59     ERR_I2C_BUSY_TIMEOUT,           // I2C wait BUSY timeout
60     ERR_I2C_DEVICE_NOT_FOUND,       // I2C device not found
61     ERR_I2C_NO_MUTEX        // No mutex created
62 } ERR_I2C_E;
63
64 /**----------------------------------------------------------------------------*
65 **                         Local Function Prototype                           **
66 **----------------------------------------------------------------------------*/
67
68
69 /**----------------------------------------------------------------------------*
70 **                           Function Prototype                               **
71 **----------------------------------------------------------------------------*/
72
73 /**----------------------------------------------------------------------------*
74 **                         Compiler Flag                                      **
75 **----------------------------------------------------------------------------*/
76 #ifdef   __cplusplus
77 }
78 #endif
79 /**---------------------------------------------------------------------------*/
80 #endif
81 // End