tizen 2.4 release
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-sc9630 / 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 /**---------------------------------------------------------------------------*
29 **                               Micro Define                                **
30 **---------------------------------------------------------------------------*/
31 /*----------I2C Register----------*/
32 //I2C_BASE      0x86000000
33 #define I2C_CTL                         (I2C_BASE + 0x0000)
34 #define I2C_CMD                         (I2C_BASE + 0x0004)
35 #define I2C_CLKD0                       (I2C_BASE + 0x0008)
36 #define I2C_CLKD1                       (I2C_BASE + 0x000C)
37 #define I2C_RST                         (I2C_BASE + 0x0010)
38 #define I2C_CMD_BUF                     (I2C_BASE + 0x0014)
39
40 //The corresponding bit of I2C_CTL register.
41 #define I2CCTL_INT                      (1 << 0)        //I2c interrupt
42 #define I2CCTL_ACK                      (1 << 1)        //I2c received ack value
43 #define I2CCTL_BUSY                     (1 << 2)        //I2c data line value
44 #define I2CCTL_IE                       (1 << 3)        //I2c interrupt enable
45 #define I2CCTL_EN                       (1 << 4)        //I2c module enable
46 #define I2CCTL_CMDBUF_EN                (1 << 5)        //Enable the cmd buffer mode
47 #define I2CCTL_CMDBUF_EXEC              (1 << 6)        //Start to exec the cmd in the cmd buffer
48 #define I2CCTL_ST_CMDBUF                (7 << 7)        //The state of  I2c cmd buffer state machine.
49 #define I2CCTL_CMDBUF_WPTR              (7 << 7)        //I2c command buffer write pointer
50
51 //The corresponding bit of I2C_CMD register.
52 #define I2CCMD_INT_ACK                  (1 << 0)        //I2c interrupt clear bit
53 #define I2CCMD_TX_ACK                   (1 << 1)        //I2c transmit ack that need to be send
54 #define I2CCMD_WRITE                    (1 << 2)        //I2c write command
55 #define I2CCMD_READ                     (1 << 3)        //I2c read command
56 #define I2CCMD_STOP                     (1 << 4)        //I2c stop command
57 #define I2CCMD_START                    (1 << 5)        //I2c start command
58 #define I2CCMD_ACK                      (1 << 6)        //I2c received ack  value
59 #define I2CCMD_BUS                      (1 << 7)        //I2c busy in exec commands
60 #define I2CCMD_DATA                     0xFF00          //I2c data received or data need to be transmitted
61
62 /**----------------------------------------------------------------------------*
63 **                         Local Function Prototype                           **
64 **----------------------------------------------------------------------------*/
65 //I2C control register
66 typedef struct i2c_tag
67 {
68     VOLATILE uint32 ctl;
69     VOLATILE uint32 cmd;
70     VOLATILE uint32 div0;
71     VOLATILE uint32 div1;
72     VOLATILE uint32 rst;
73     VOLATILE uint32 cmd_buf;
74 } I2C_CTL_REG_T;
75
76 /**----------------------------------------------------------------------------*
77 **                         Compiler Flag                                      **
78 **----------------------------------------------------------------------------*/
79 #ifdef   __cplusplus
80 }
81 #endif
82 /**---------------------------------------------------------------------------*/
83 #endif
84 // End