Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
i2c-designware-core.c File Reference
#include <linux/export.h>
#include <linux/clk.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/pm_runtime.h>
#include <linux/delay.h>
#include "i2c-designware-core.h"

Go to the source code of this file.

Macros

#define DW_IC_CON   0x0
 
#define DW_IC_TAR   0x4
 
#define DW_IC_DATA_CMD   0x10
 
#define DW_IC_SS_SCL_HCNT   0x14
 
#define DW_IC_SS_SCL_LCNT   0x18
 
#define DW_IC_FS_SCL_HCNT   0x1c
 
#define DW_IC_FS_SCL_LCNT   0x20
 
#define DW_IC_INTR_STAT   0x2c
 
#define DW_IC_INTR_MASK   0x30
 
#define DW_IC_RAW_INTR_STAT   0x34
 
#define DW_IC_RX_TL   0x38
 
#define DW_IC_TX_TL   0x3c
 
#define DW_IC_CLR_INTR   0x40
 
#define DW_IC_CLR_RX_UNDER   0x44
 
#define DW_IC_CLR_RX_OVER   0x48
 
#define DW_IC_CLR_TX_OVER   0x4c
 
#define DW_IC_CLR_RD_REQ   0x50
 
#define DW_IC_CLR_TX_ABRT   0x54
 
#define DW_IC_CLR_RX_DONE   0x58
 
#define DW_IC_CLR_ACTIVITY   0x5c
 
#define DW_IC_CLR_STOP_DET   0x60
 
#define DW_IC_CLR_START_DET   0x64
 
#define DW_IC_CLR_GEN_CALL   0x68
 
#define DW_IC_ENABLE   0x6c
 
#define DW_IC_STATUS   0x70
 
#define DW_IC_TXFLR   0x74
 
#define DW_IC_RXFLR   0x78
 
#define DW_IC_TX_ABRT_SOURCE   0x80
 
#define DW_IC_COMP_PARAM_1   0xf4
 
#define DW_IC_COMP_TYPE   0xfc
 
#define DW_IC_COMP_TYPE_VALUE   0x44570140
 
#define DW_IC_INTR_RX_UNDER   0x001
 
#define DW_IC_INTR_RX_OVER   0x002
 
#define DW_IC_INTR_RX_FULL   0x004
 
#define DW_IC_INTR_TX_OVER   0x008
 
#define DW_IC_INTR_TX_EMPTY   0x010
 
#define DW_IC_INTR_RD_REQ   0x020
 
#define DW_IC_INTR_TX_ABRT   0x040
 
#define DW_IC_INTR_RX_DONE   0x080
 
#define DW_IC_INTR_ACTIVITY   0x100
 
#define DW_IC_INTR_STOP_DET   0x200
 
#define DW_IC_INTR_START_DET   0x400
 
#define DW_IC_INTR_GEN_CALL   0x800
 
#define DW_IC_INTR_DEFAULT_MASK
 
#define DW_IC_STATUS_ACTIVITY   0x1
 
#define DW_IC_ERR_TX_ABRT   0x1
 
#define STATUS_IDLE   0x0
 
#define STATUS_WRITE_IN_PROGRESS   0x1
 
#define STATUS_READ_IN_PROGRESS   0x2
 
#define TIMEOUT   20 /* ms */
 
#define ABRT_7B_ADDR_NOACK   0
 
#define ABRT_10ADDR1_NOACK   1
 
#define ABRT_10ADDR2_NOACK   2
 
#define ABRT_TXDATA_NOACK   3
 
#define ABRT_GCALL_NOACK   4
 
#define ABRT_GCALL_READ   5
 
#define ABRT_SBYTE_ACKDET   7
 
#define ABRT_SBYTE_NORSTRT   9
 
#define ABRT_10B_RD_NORSTRT   10
 
#define ABRT_MASTER_DIS   11
 
#define ARB_LOST   12
 
#define DW_IC_TX_ABRT_7B_ADDR_NOACK   (1UL << ABRT_7B_ADDR_NOACK)
 
#define DW_IC_TX_ABRT_10ADDR1_NOACK   (1UL << ABRT_10ADDR1_NOACK)
 
#define DW_IC_TX_ABRT_10ADDR2_NOACK   (1UL << ABRT_10ADDR2_NOACK)
 
#define DW_IC_TX_ABRT_TXDATA_NOACK   (1UL << ABRT_TXDATA_NOACK)
 
#define DW_IC_TX_ABRT_GCALL_NOACK   (1UL << ABRT_GCALL_NOACK)
 
#define DW_IC_TX_ABRT_GCALL_READ   (1UL << ABRT_GCALL_READ)
 
#define DW_IC_TX_ABRT_SBYTE_ACKDET   (1UL << ABRT_SBYTE_ACKDET)
 
#define DW_IC_TX_ABRT_SBYTE_NORSTRT   (1UL << ABRT_SBYTE_NORSTRT)
 
#define DW_IC_TX_ABRT_10B_RD_NORSTRT   (1UL << ABRT_10B_RD_NORSTRT)
 
#define DW_IC_TX_ABRT_MASTER_DIS   (1UL << ABRT_MASTER_DIS)
 
#define DW_IC_TX_ARB_LOST   (1UL << ARB_LOST)
 
#define DW_IC_TX_ABRT_NOACK
 

Functions

u32 dw_readl (struct dw_i2c_dev *dev, int offset)
 
void dw_writel (struct dw_i2c_dev *dev, u32 b, int offset)
 
int i2c_dw_init (struct dw_i2c_dev *dev)
 
 EXPORT_SYMBOL_GPL (i2c_dw_init)
 
int i2c_dw_xfer (struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
 
 EXPORT_SYMBOL_GPL (i2c_dw_xfer)
 
u32 i2c_dw_func (struct i2c_adapter *adap)
 
 EXPORT_SYMBOL_GPL (i2c_dw_func)
 
irqreturn_t i2c_dw_isr (int this_irq, void *dev_id)
 
 EXPORT_SYMBOL_GPL (i2c_dw_isr)
 
void i2c_dw_enable (struct dw_i2c_dev *dev)
 
 EXPORT_SYMBOL_GPL (i2c_dw_enable)
 
u32 i2c_dw_is_enabled (struct dw_i2c_dev *dev)
 
 EXPORT_SYMBOL_GPL (i2c_dw_is_enabled)
 
void i2c_dw_disable (struct dw_i2c_dev *dev)
 
 EXPORT_SYMBOL_GPL (i2c_dw_disable)
 
void i2c_dw_clear_int (struct dw_i2c_dev *dev)
 
 EXPORT_SYMBOL_GPL (i2c_dw_clear_int)
 
void i2c_dw_disable_int (struct dw_i2c_dev *dev)
 
 EXPORT_SYMBOL_GPL (i2c_dw_disable_int)
 
u32 i2c_dw_read_comp_param (struct dw_i2c_dev *dev)
 
 EXPORT_SYMBOL_GPL (i2c_dw_read_comp_param)
 

Macro Definition Documentation

#define ABRT_10ADDR1_NOACK   1

Definition at line 112 of file i2c-designware-core.c.

#define ABRT_10ADDR2_NOACK   2

Definition at line 113 of file i2c-designware-core.c.

#define ABRT_10B_RD_NORSTRT   10

Definition at line 119 of file i2c-designware-core.c.

#define ABRT_7B_ADDR_NOACK   0

Definition at line 111 of file i2c-designware-core.c.

#define ABRT_GCALL_NOACK   4

Definition at line 115 of file i2c-designware-core.c.

#define ABRT_GCALL_READ   5

Definition at line 116 of file i2c-designware-core.c.

#define ABRT_MASTER_DIS   11

Definition at line 120 of file i2c-designware-core.c.

#define ABRT_SBYTE_ACKDET   7

Definition at line 117 of file i2c-designware-core.c.

#define ABRT_SBYTE_NORSTRT   9

Definition at line 118 of file i2c-designware-core.c.

#define ABRT_TXDATA_NOACK   3

Definition at line 114 of file i2c-designware-core.c.

#define ARB_LOST   12

Definition at line 121 of file i2c-designware-core.c.

#define DW_IC_CLR_ACTIVITY   0x5c

Definition at line 61 of file i2c-designware-core.c.

#define DW_IC_CLR_GEN_CALL   0x68

Definition at line 64 of file i2c-designware-core.c.

#define DW_IC_CLR_INTR   0x40

Definition at line 54 of file i2c-designware-core.c.

#define DW_IC_CLR_RD_REQ   0x50

Definition at line 58 of file i2c-designware-core.c.

#define DW_IC_CLR_RX_DONE   0x58

Definition at line 60 of file i2c-designware-core.c.

#define DW_IC_CLR_RX_OVER   0x48

Definition at line 56 of file i2c-designware-core.c.

#define DW_IC_CLR_RX_UNDER   0x44

Definition at line 55 of file i2c-designware-core.c.

#define DW_IC_CLR_START_DET   0x64

Definition at line 63 of file i2c-designware-core.c.

#define DW_IC_CLR_STOP_DET   0x60

Definition at line 62 of file i2c-designware-core.c.

#define DW_IC_CLR_TX_ABRT   0x54

Definition at line 59 of file i2c-designware-core.c.

#define DW_IC_CLR_TX_OVER   0x4c

Definition at line 57 of file i2c-designware-core.c.

#define DW_IC_COMP_PARAM_1   0xf4

Definition at line 70 of file i2c-designware-core.c.

#define DW_IC_COMP_TYPE   0xfc

Definition at line 71 of file i2c-designware-core.c.

#define DW_IC_COMP_TYPE_VALUE   0x44570140

Definition at line 72 of file i2c-designware-core.c.

#define DW_IC_CON   0x0

Definition at line 42 of file i2c-designware-core.c.

#define DW_IC_DATA_CMD   0x10

Definition at line 44 of file i2c-designware-core.c.

#define DW_IC_ENABLE   0x6c

Definition at line 65 of file i2c-designware-core.c.

#define DW_IC_ERR_TX_ABRT   0x1

Definition at line 94 of file i2c-designware-core.c.

#define DW_IC_FS_SCL_HCNT   0x1c

Definition at line 47 of file i2c-designware-core.c.

#define DW_IC_FS_SCL_LCNT   0x20

Definition at line 48 of file i2c-designware-core.c.

#define DW_IC_INTR_ACTIVITY   0x100

Definition at line 82 of file i2c-designware-core.c.

#define DW_IC_INTR_DEFAULT_MASK
Value:
DW_IC_INTR_TX_EMPTY | \
DW_IC_INTR_TX_ABRT | \
DW_IC_INTR_STOP_DET)

Definition at line 87 of file i2c-designware-core.c.

#define DW_IC_INTR_GEN_CALL   0x800

Definition at line 85 of file i2c-designware-core.c.

#define DW_IC_INTR_MASK   0x30

Definition at line 50 of file i2c-designware-core.c.

#define DW_IC_INTR_RD_REQ   0x020

Definition at line 79 of file i2c-designware-core.c.

#define DW_IC_INTR_RX_DONE   0x080

Definition at line 81 of file i2c-designware-core.c.

#define DW_IC_INTR_RX_FULL   0x004

Definition at line 76 of file i2c-designware-core.c.

#define DW_IC_INTR_RX_OVER   0x002

Definition at line 75 of file i2c-designware-core.c.

#define DW_IC_INTR_RX_UNDER   0x001

Definition at line 74 of file i2c-designware-core.c.

#define DW_IC_INTR_START_DET   0x400

Definition at line 84 of file i2c-designware-core.c.

#define DW_IC_INTR_STAT   0x2c

Definition at line 49 of file i2c-designware-core.c.

#define DW_IC_INTR_STOP_DET   0x200

Definition at line 83 of file i2c-designware-core.c.

#define DW_IC_INTR_TX_ABRT   0x040

Definition at line 80 of file i2c-designware-core.c.

#define DW_IC_INTR_TX_EMPTY   0x010

Definition at line 78 of file i2c-designware-core.c.

#define DW_IC_INTR_TX_OVER   0x008

Definition at line 77 of file i2c-designware-core.c.

#define DW_IC_RAW_INTR_STAT   0x34

Definition at line 51 of file i2c-designware-core.c.

#define DW_IC_RX_TL   0x38

Definition at line 52 of file i2c-designware-core.c.

#define DW_IC_RXFLR   0x78

Definition at line 68 of file i2c-designware-core.c.

#define DW_IC_SS_SCL_HCNT   0x14

Definition at line 45 of file i2c-designware-core.c.

#define DW_IC_SS_SCL_LCNT   0x18

Definition at line 46 of file i2c-designware-core.c.

#define DW_IC_STATUS   0x70

Definition at line 66 of file i2c-designware-core.c.

#define DW_IC_STATUS_ACTIVITY   0x1

Definition at line 92 of file i2c-designware-core.c.

#define DW_IC_TAR   0x4

Definition at line 43 of file i2c-designware-core.c.

#define DW_IC_TX_ABRT_10ADDR1_NOACK   (1UL << ABRT_10ADDR1_NOACK)

Definition at line 124 of file i2c-designware-core.c.

#define DW_IC_TX_ABRT_10ADDR2_NOACK   (1UL << ABRT_10ADDR2_NOACK)

Definition at line 125 of file i2c-designware-core.c.

#define DW_IC_TX_ABRT_10B_RD_NORSTRT   (1UL << ABRT_10B_RD_NORSTRT)

Definition at line 131 of file i2c-designware-core.c.

#define DW_IC_TX_ABRT_7B_ADDR_NOACK   (1UL << ABRT_7B_ADDR_NOACK)

Definition at line 123 of file i2c-designware-core.c.

#define DW_IC_TX_ABRT_GCALL_NOACK   (1UL << ABRT_GCALL_NOACK)

Definition at line 127 of file i2c-designware-core.c.

#define DW_IC_TX_ABRT_GCALL_READ   (1UL << ABRT_GCALL_READ)

Definition at line 128 of file i2c-designware-core.c.

#define DW_IC_TX_ABRT_MASTER_DIS   (1UL << ABRT_MASTER_DIS)

Definition at line 132 of file i2c-designware-core.c.

#define DW_IC_TX_ABRT_NOACK
Value:
DW_IC_TX_ABRT_10ADDR1_NOACK | \
DW_IC_TX_ABRT_10ADDR2_NOACK | \
DW_IC_TX_ABRT_TXDATA_NOACK | \
DW_IC_TX_ABRT_GCALL_NOACK)

Definition at line 135 of file i2c-designware-core.c.

#define DW_IC_TX_ABRT_SBYTE_ACKDET   (1UL << ABRT_SBYTE_ACKDET)

Definition at line 129 of file i2c-designware-core.c.

#define DW_IC_TX_ABRT_SBYTE_NORSTRT   (1UL << ABRT_SBYTE_NORSTRT)

Definition at line 130 of file i2c-designware-core.c.

#define DW_IC_TX_ABRT_SOURCE   0x80

Definition at line 69 of file i2c-designware-core.c.

#define DW_IC_TX_ABRT_TXDATA_NOACK   (1UL << ABRT_TXDATA_NOACK)

Definition at line 126 of file i2c-designware-core.c.

#define DW_IC_TX_ARB_LOST   (1UL << ARB_LOST)

Definition at line 133 of file i2c-designware-core.c.

#define DW_IC_TX_TL   0x3c

Definition at line 53 of file i2c-designware-core.c.

#define DW_IC_TXFLR   0x74

Definition at line 67 of file i2c-designware-core.c.

#define STATUS_IDLE   0x0

Definition at line 99 of file i2c-designware-core.c.

#define STATUS_READ_IN_PROGRESS   0x2

Definition at line 101 of file i2c-designware-core.c.

#define STATUS_WRITE_IN_PROGRESS   0x1

Definition at line 100 of file i2c-designware-core.c.

#define TIMEOUT   20 /* ms */

Definition at line 103 of file i2c-designware-core.c.

Function Documentation

u32 dw_readl ( struct dw_i2c_dev dev,
int  offset 
)

Definition at line 166 of file i2c-designware-core.c.

void dw_writel ( struct dw_i2c_dev dev,
u32  b,
int  offset 
)

Definition at line 182 of file i2c-designware-core.c.

EXPORT_SYMBOL_GPL ( i2c_dw_init  )
EXPORT_SYMBOL_GPL ( i2c_dw_xfer  )
EXPORT_SYMBOL_GPL ( i2c_dw_func  )
EXPORT_SYMBOL_GPL ( i2c_dw_isr  )
EXPORT_SYMBOL_GPL ( i2c_dw_enable  )
EXPORT_SYMBOL_GPL ( i2c_dw_is_enabled  )
EXPORT_SYMBOL_GPL ( i2c_dw_disable  )
EXPORT_SYMBOL_GPL ( i2c_dw_clear_int  )
EXPORT_SYMBOL_GPL ( i2c_dw_disable_int  )
EXPORT_SYMBOL_GPL ( i2c_dw_read_comp_param  )
void i2c_dw_clear_int ( struct dw_i2c_dev dev)

Definition at line 711 of file i2c-designware-core.c.

void i2c_dw_disable ( struct dw_i2c_dev dev)

Definition at line 700 of file i2c-designware-core.c.

void i2c_dw_disable_int ( struct dw_i2c_dev dev)

Definition at line 717 of file i2c-designware-core.c.

void i2c_dw_enable ( struct dw_i2c_dev dev)

Definition at line 687 of file i2c-designware-core.c.

u32 i2c_dw_func ( struct i2c_adapter adap)

Definition at line 575 of file i2c-designware-core.c.

int i2c_dw_init ( struct dw_i2c_dev dev)

i2c_dw_init() - initialize the designware i2c master hardware : device private data

This functions configures and enables the I2C master. This function is called during I2C init function, and in case of timeout at run time.

Definition at line 258 of file i2c-designware-core.c.

u32 i2c_dw_is_enabled ( struct dw_i2c_dev dev)

Definition at line 694 of file i2c-designware-core.c.

irqreturn_t i2c_dw_isr ( int  this_irq,
void dev_id 
)

Definition at line 641 of file i2c-designware-core.c.

u32 i2c_dw_read_comp_param ( struct dw_i2c_dev dev)

Definition at line 723 of file i2c-designware-core.c.

int i2c_dw_xfer ( struct i2c_adapter adap,
struct i2c_msg  msgs[],
int  num 
)

Definition at line 510 of file i2c-designware-core.c.