change source file mode to 0644 instead of 0755
[profile/mobile/platform/kernel/u-boot-tm1.git] / include / sp8830_i2c.h
1 /******************************************************************************
2  ** File Name:      I2C_drv_new.h                                                 *
3  ** Author:         liuhao                                                   *
4  ** DATE:           06/28/2010                                                *
5  ** Copyright:      2010 Spreatrum, Incoporated. All Rights Reserved.         *
6  ** Description:    This file define the basic interfaces of I2C device.      *
7  ******************************************************************************
8
9  ******************************************************************************
10  **                        Edit History                                       *
11  ** ------------------------------------------------------------------------- *
12  ** DATE           NAME             DESCRIPTION                               *
13  ** 06/28/2010     liuhao     Create.                                   *
14  ******************************************************************************/
15 #ifndef _I2C_DRVAPI_H_
16 #define _I2C_DRVAPI_H_
17
18 /**---------------------------------------------------------------------------*
19  **                         Dependencies                                      *
20  **---------------------------------------------------------------------------*/
21
22 /**---------------------------------------------------------------------------*
23  **                         Debugging Flag                                    *
24  **---------------------------------------------------------------------------*/
25
26 /**---------------------------------------------------------------------------*
27  **                         Compiler Flag                                     *
28  **---------------------------------------------------------------------------*/
29 #ifdef   __cplusplus
30 extern   "C"
31 {
32 #endif
33
34 #include "asm/arch/sci_types.h"
35
36 /**---------------------------------------------------------------------------*
37 **                               Micro Define                                                           **
38 **---------------------------------------------------------------------------*/
39 typedef struct
40 {
41     uint32 id;
42     uint32 freq;
43     uint32 bus;
44     uint8 slave_addr;
45     uint8 reg_addr_num;
46     uint8 check_ack;
47     uint8 no_stop;
48 } I2C_DEV;
49
50 /**---------------------------------------------------------------------------*
51  **                      I2C IOCTL
52  **---------------------------------------------------------------------------*/
53 #define I2C_CTL_G_FREQ 0x20 /*get frequency*/
54 #define I2C_CTL_S_FREQ 0x21 /*set frequency*/
55 #define I2C_CTL_G_PORT 0x22 /*get port*/
56 #define I2C_CTL_S_PORT 0x23 /*set port*/
57 #define I2C_CTL_STOP_BUS 0x24 /*stop i2c bus*/
58
59 /**---------------------------------------------------------------------------*
60  **                      Function  Prototype
61  **---------------------------------------------------------------------------*/
62 /*********************************************************************************************************
63 ** Function name:
64 ** Descriptions:
65 ** input parameters:
66 **
67 **
68 **
69 ** output parameters:
70 ** Returned value:
71 *********************************************************************************************************/
72 int32 I2C_HAL_Open (I2C_DEV *dev);
73
74 /*********************************************************************************************************
75 ** Function name:
76 ** Descriptions:
77 ** input parameters:
78 **
79 **
80 **
81 ** output parameters:
82 ** Returned value:
83 *********************************************************************************************************/
84 int32 I2C_HAL_Close (uint32 handle);
85
86 /*********************************************************************************************************
87 ** Function name:
88 ** Descriptions:
89 ** input parameters:
90 **
91 **
92 **
93 ** output parameters:
94 ** Returned value:
95 *********************************************************************************************************/
96 uint32 I2C_HAL_Read (uint32 handle, uint8 *reg_addr, uint8 *buffer, uint32 bytes);
97
98 /*********************************************************************************************************
99 ** Function name:
100 ** Descriptions:
101 ** input parameters:
102 **
103 **
104 **
105 ** output parameters:
106 ** Returned value:
107 *********************************************************************************************************/
108 uint32 I2C_HAL_Write (uint32 handle, uint8 *reg_addr, uint8 *buffer, uint32 bytes);
109
110 /*********************************************************************************************************
111 ** Function name:
112 ** Descriptions:
113 ** input parameters:
114 **
115 **
116 **
117 ** output parameters:
118 ** Returned value:
119 *********************************************************************************************************/
120 uint32 I2C_HAL_Ioctl (uint32 handle, uint32 cmd, uint32 *arg);
121
122 /**---------------------------------------------------------------------------*
123  **                         Compiler Flag                                     *
124  **---------------------------------------------------------------------------*/
125 #ifdef   __cplusplus
126 }
127 #endif
128
129 #endif
130
131 /* End Of File  */