tizen 2.4 release
[kernel/u-boot-tm1.git] / drivers / i2c / v0 / i2c_reg_v0.h
1 /******************************************************************************
2  ** File Name:      I2C_reg_v0.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 #ifndef _I2C_REG_V0_H_
16 #define _I2C_REG_V0_H_
17 /*----------------------------------------------------------------------------*
18  **                         Dependencies                                      *
19  **------------------------------------------------------------------------- */
20
21 /**---------------------------------------------------------------------------*
22  **                             Compiler Flag                                 *
23  **--------------------------------------------------------------------------*/
24 #ifdef   __cplusplus
25 extern   "C"
26 {
27 #endif
28 #include "asm/arch/sci_types.h"
29
30 /**---------------------------------------------------------------------------*
31 **                               Micro Define                                **
32 **---------------------------------------------------------------------------*/
33 /*----------I2C Register----------
34 #define I2C_BASE      0x86000000
35 #define I2C_CTL                         (I2C_BASE + 0x0000)
36 #define I2C_CMD                         (I2C_BASE + 0x0004)
37 #define I2C_CLKD0                       (I2C_BASE + 0x0008)
38 #define I2C_CLKD1                       (I2C_BASE + 0x000C)
39 #define I2C_RST                         (I2C_BASE + 0x0010)
40 #define I2C_CMD_BUF                     (I2C_BASE + 0x0014)
41 */
42 //GREG_BASE     0x8B000000
43 #define GR_GEN0                         (0x71300000 + 0x0000)
44 #define AON_APB_EB0                     (0X402E0000 + 0X0000)
45 #define GEN0_I2C0_EN                     BIT_8
46 #define GEN0_I2C1_EN                     BIT_9
47 #define GEN0_I2C2_EN                     BIT_10
48 #define GEN0_I2C3_EN                     BIT_11
49 #define GEN0_I2C4_EN                     BIT_12
50 #define AON_I2C_EN                       BIT_31
51 //The corresponding bit of I2C_CTL register.
52 #define I2CCTL_INT                      (1 << 0)        //I2c interrupt
53 #define I2CCTL_ACK                      (1 << 1)        //I2c received ack value
54 #define I2CCTL_BUSY                     (1 << 2)        //I2c data line value
55 #define I2CCTL_IE                       (1 << 3)        //I2c interrupt enable
56 #define I2CCTL_EN                       (1 << 4)        //I2c module enable
57 #define I2CCTL_CMDBUF_EN                (1 << 5)        //Enable the cmd buffer mode
58 #define I2CCTL_CMDBUF_EXEC              (1 << 6)        //Start to exec the cmd in the cmd buffer
59 #define I2CCTL_ST_CMDBUF                (7 << 7)        //The state of  I2c cmd buffer state machine.
60 #define I2CCTL_CMDBUF_WPTR              (7 << 7)        //I2c command buffer write pointer
61
62 //The corresponding bit of I2C_CMD register.
63 #define I2CCMD_INT_ACK                  (1 << 0)        //I2c interrupt clear bit
64 #define I2CCMD_TX_ACK                   (1 << 1)        //I2c transmit ack that need to be send
65 #define I2CCMD_WRITE                    (1 << 2)        //I2c write command
66 #define I2CCMD_READ                     (1 << 3)        //I2c read command
67 #define I2CCMD_STOP                     (1 << 4)        //I2c stop command
68 #define I2CCMD_START                    (1 << 5)        //I2c start command
69 #define I2CCMD_ACK                      (1 << 6)        //I2c received ack  value
70 #define I2CCMD_BUS                      (1 << 7)        //I2c busy in exec commands
71 #define I2CCMD_DATA                     0xFF00          //I2c data received or data need to be transmitted
72
73 /**----------------------------------------------------------------------------*
74 **                         Local Function Prototype                           **
75 **----------------------------------------------------------------------------*/
76 //I2C control register
77 typedef struct i2c_tag
78 {
79     VOLATILE uint32 ctl;
80     VOLATILE uint32 cmd;
81     VOLATILE uint32 div0;
82     VOLATILE uint32 div1;
83     VOLATILE uint32 rst;
84     VOLATILE uint32 cmd_buf;
85 } I2C_CTL_REG_T;
86
87 /**----------------------------------------------------------------------------*
88 **                         Compiler Flag                                      **
89 **----------------------------------------------------------------------------*/
90 #ifdef   __cplusplus
91 }
92 #endif
93 /**---------------------------------------------------------------------------*/
94 #endif
95 // End