Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
i2c-tegra.c File Reference
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/i2c-tegra.h>
#include <linux/of_i2c.h>
#include <linux/of_device.h>
#include <linux/module.h>
#include <asm/unaligned.h>
#include <mach/clk.h>

Go to the source code of this file.

Data Structures

struct  tegra_i2c_hw_feature
 
struct  tegra_i2c_dev
 

Macros

#define TEGRA_I2C_TIMEOUT   (msecs_to_jiffies(1000))
 
#define BYTES_PER_FIFO_WORD   4
 
#define I2C_CNFG   0x000
 
#define I2C_CNFG_DEBOUNCE_CNT_SHIFT   12
 
#define I2C_CNFG_PACKET_MODE_EN   (1<<10)
 
#define I2C_CNFG_NEW_MASTER_FSM   (1<<11)
 
#define I2C_STATUS   0x01C
 
#define I2C_SL_CNFG   0x020
 
#define I2C_SL_CNFG_NACK   (1<<1)
 
#define I2C_SL_CNFG_NEWSL   (1<<2)
 
#define I2C_SL_ADDR1   0x02c
 
#define I2C_SL_ADDR2   0x030
 
#define I2C_TX_FIFO   0x050
 
#define I2C_RX_FIFO   0x054
 
#define I2C_PACKET_TRANSFER_STATUS   0x058
 
#define I2C_FIFO_CONTROL   0x05c
 
#define I2C_FIFO_CONTROL_TX_FLUSH   (1<<1)
 
#define I2C_FIFO_CONTROL_RX_FLUSH   (1<<0)
 
#define I2C_FIFO_CONTROL_TX_TRIG_SHIFT   5
 
#define I2C_FIFO_CONTROL_RX_TRIG_SHIFT   2
 
#define I2C_FIFO_STATUS   0x060
 
#define I2C_FIFO_STATUS_TX_MASK   0xF0
 
#define I2C_FIFO_STATUS_TX_SHIFT   4
 
#define I2C_FIFO_STATUS_RX_MASK   0x0F
 
#define I2C_FIFO_STATUS_RX_SHIFT   0
 
#define I2C_INT_MASK   0x064
 
#define I2C_INT_STATUS   0x068
 
#define I2C_INT_PACKET_XFER_COMPLETE   (1<<7)
 
#define I2C_INT_ALL_PACKETS_XFER_COMPLETE   (1<<6)
 
#define I2C_INT_TX_FIFO_OVERFLOW   (1<<5)
 
#define I2C_INT_RX_FIFO_UNDERFLOW   (1<<4)
 
#define I2C_INT_NO_ACK   (1<<3)
 
#define I2C_INT_ARBITRATION_LOST   (1<<2)
 
#define I2C_INT_TX_FIFO_DATA_REQ   (1<<1)
 
#define I2C_INT_RX_FIFO_DATA_REQ   (1<<0)
 
#define I2C_CLK_DIVISOR   0x06c
 
#define DVC_CTRL_REG1   0x000
 
#define DVC_CTRL_REG1_INTR_EN   (1<<10)
 
#define DVC_CTRL_REG2   0x004
 
#define DVC_CTRL_REG3   0x008
 
#define DVC_CTRL_REG3_SW_PROG   (1<<26)
 
#define DVC_CTRL_REG3_I2C_DONE_INTR_EN   (1<<30)
 
#define DVC_STATUS   0x00c
 
#define DVC_STATUS_I2C_DONE_INTR   (1<<30)
 
#define I2C_ERR_NONE   0x00
 
#define I2C_ERR_NO_ACK   0x01
 
#define I2C_ERR_ARBITRATION_LOST   0x02
 
#define I2C_ERR_UNKNOWN_INTERRUPT   0x04
 
#define PACKET_HEADER0_HEADER_SIZE_SHIFT   28
 
#define PACKET_HEADER0_PACKET_ID_SHIFT   16
 
#define PACKET_HEADER0_CONT_ID_SHIFT   12
 
#define PACKET_HEADER0_PROTOCOL_I2C   (1<<4)
 
#define I2C_HEADER_HIGHSPEED_MODE   (1<<22)
 
#define I2C_HEADER_CONT_ON_NAK   (1<<21)
 
#define I2C_HEADER_SEND_START_BYTE   (1<<20)
 
#define I2C_HEADER_READ   (1<<19)
 
#define I2C_HEADER_10BIT_ADDR   (1<<18)
 
#define I2C_HEADER_IE_ENABLE   (1<<17)
 
#define I2C_HEADER_REPEAT_START   (1<<16)
 
#define I2C_HEADER_CONTINUE_XFER   (1<<15)
 
#define I2C_HEADER_MASTER_ADDR_SHIFT   12
 
#define I2C_HEADER_SLAVE_ADDR_SHIFT   1
 
#define TEGRA_I2C_PM   NULL
 

Enumerations

enum  msg_end_type { MSG_END_STOP, MSG_END_REPEAT_START, MSG_END_CONTINUE }
 

Functions

 subsys_initcall (tegra_i2c_init_driver)
 
 module_exit (tegra_i2c_exit_driver)
 
 MODULE_DESCRIPTION ("nVidia Tegra2 I2C Bus Controller driver")
 
 MODULE_AUTHOR ("Colin Cross")
 
 MODULE_LICENSE ("GPL v2")
 

Macro Definition Documentation

#define BYTES_PER_FIFO_WORD   4

Definition at line 38 of file i2c-tegra.c.

#define DVC_CTRL_REG1   0x000

Definition at line 75 of file i2c-tegra.c.

#define DVC_CTRL_REG1_INTR_EN   (1<<10)

Definition at line 76 of file i2c-tegra.c.

#define DVC_CTRL_REG2   0x004

Definition at line 77 of file i2c-tegra.c.

#define DVC_CTRL_REG3   0x008

Definition at line 78 of file i2c-tegra.c.

#define DVC_CTRL_REG3_I2C_DONE_INTR_EN   (1<<30)

Definition at line 80 of file i2c-tegra.c.

#define DVC_CTRL_REG3_SW_PROG   (1<<26)

Definition at line 79 of file i2c-tegra.c.

#define DVC_STATUS   0x00c

Definition at line 81 of file i2c-tegra.c.

#define DVC_STATUS_I2C_DONE_INTR   (1<<30)

Definition at line 82 of file i2c-tegra.c.

#define I2C_CLK_DIVISOR   0x06c

Definition at line 73 of file i2c-tegra.c.

#define I2C_CNFG   0x000

Definition at line 40 of file i2c-tegra.c.

#define I2C_CNFG_DEBOUNCE_CNT_SHIFT   12

Definition at line 41 of file i2c-tegra.c.

#define I2C_CNFG_NEW_MASTER_FSM   (1<<11)

Definition at line 43 of file i2c-tegra.c.

#define I2C_CNFG_PACKET_MODE_EN   (1<<10)

Definition at line 42 of file i2c-tegra.c.

#define I2C_ERR_ARBITRATION_LOST   0x02

Definition at line 86 of file i2c-tegra.c.

#define I2C_ERR_NO_ACK   0x01

Definition at line 85 of file i2c-tegra.c.

#define I2C_ERR_NONE   0x00

Definition at line 84 of file i2c-tegra.c.

#define I2C_ERR_UNKNOWN_INTERRUPT   0x04

Definition at line 87 of file i2c-tegra.c.

#define I2C_FIFO_CONTROL   0x05c

Definition at line 53 of file i2c-tegra.c.

#define I2C_FIFO_CONTROL_RX_FLUSH   (1<<0)

Definition at line 55 of file i2c-tegra.c.

#define I2C_FIFO_CONTROL_RX_TRIG_SHIFT   2

Definition at line 57 of file i2c-tegra.c.

#define I2C_FIFO_CONTROL_TX_FLUSH   (1<<1)

Definition at line 54 of file i2c-tegra.c.

#define I2C_FIFO_CONTROL_TX_TRIG_SHIFT   5

Definition at line 56 of file i2c-tegra.c.

#define I2C_FIFO_STATUS   0x060

Definition at line 58 of file i2c-tegra.c.

#define I2C_FIFO_STATUS_RX_MASK   0x0F

Definition at line 61 of file i2c-tegra.c.

#define I2C_FIFO_STATUS_RX_SHIFT   0

Definition at line 62 of file i2c-tegra.c.

#define I2C_FIFO_STATUS_TX_MASK   0xF0

Definition at line 59 of file i2c-tegra.c.

#define I2C_FIFO_STATUS_TX_SHIFT   4

Definition at line 60 of file i2c-tegra.c.

#define I2C_HEADER_10BIT_ADDR   (1<<18)

Definition at line 98 of file i2c-tegra.c.

#define I2C_HEADER_CONT_ON_NAK   (1<<21)

Definition at line 95 of file i2c-tegra.c.

#define I2C_HEADER_CONTINUE_XFER   (1<<15)

Definition at line 101 of file i2c-tegra.c.

#define I2C_HEADER_HIGHSPEED_MODE   (1<<22)

Definition at line 94 of file i2c-tegra.c.

#define I2C_HEADER_IE_ENABLE   (1<<17)

Definition at line 99 of file i2c-tegra.c.

#define I2C_HEADER_MASTER_ADDR_SHIFT   12

Definition at line 102 of file i2c-tegra.c.

#define I2C_HEADER_READ   (1<<19)

Definition at line 97 of file i2c-tegra.c.

#define I2C_HEADER_REPEAT_START   (1<<16)

Definition at line 100 of file i2c-tegra.c.

#define I2C_HEADER_SEND_START_BYTE   (1<<20)

Definition at line 96 of file i2c-tegra.c.

#define I2C_HEADER_SLAVE_ADDR_SHIFT   1

Definition at line 103 of file i2c-tegra.c.

#define I2C_INT_ALL_PACKETS_XFER_COMPLETE   (1<<6)

Definition at line 66 of file i2c-tegra.c.

#define I2C_INT_ARBITRATION_LOST   (1<<2)

Definition at line 70 of file i2c-tegra.c.

#define I2C_INT_MASK   0x064

Definition at line 63 of file i2c-tegra.c.

#define I2C_INT_NO_ACK   (1<<3)

Definition at line 69 of file i2c-tegra.c.

#define I2C_INT_PACKET_XFER_COMPLETE   (1<<7)

Definition at line 65 of file i2c-tegra.c.

#define I2C_INT_RX_FIFO_DATA_REQ   (1<<0)

Definition at line 72 of file i2c-tegra.c.

#define I2C_INT_RX_FIFO_UNDERFLOW   (1<<4)

Definition at line 68 of file i2c-tegra.c.

#define I2C_INT_STATUS   0x068

Definition at line 64 of file i2c-tegra.c.

#define I2C_INT_TX_FIFO_DATA_REQ   (1<<1)

Definition at line 71 of file i2c-tegra.c.

#define I2C_INT_TX_FIFO_OVERFLOW   (1<<5)

Definition at line 67 of file i2c-tegra.c.

#define I2C_PACKET_TRANSFER_STATUS   0x058

Definition at line 52 of file i2c-tegra.c.

#define I2C_RX_FIFO   0x054

Definition at line 51 of file i2c-tegra.c.

#define I2C_SL_ADDR1   0x02c

Definition at line 48 of file i2c-tegra.c.

#define I2C_SL_ADDR2   0x030

Definition at line 49 of file i2c-tegra.c.

#define I2C_SL_CNFG   0x020

Definition at line 45 of file i2c-tegra.c.

#define I2C_SL_CNFG_NACK   (1<<1)

Definition at line 46 of file i2c-tegra.c.

#define I2C_SL_CNFG_NEWSL   (1<<2)

Definition at line 47 of file i2c-tegra.c.

#define I2C_STATUS   0x01C

Definition at line 44 of file i2c-tegra.c.

#define I2C_TX_FIFO   0x050

Definition at line 50 of file i2c-tegra.c.

#define PACKET_HEADER0_CONT_ID_SHIFT   12

Definition at line 91 of file i2c-tegra.c.

#define PACKET_HEADER0_HEADER_SIZE_SHIFT   28

Definition at line 89 of file i2c-tegra.c.

#define PACKET_HEADER0_PACKET_ID_SHIFT   16

Definition at line 90 of file i2c-tegra.c.

#define PACKET_HEADER0_PROTOCOL_I2C   (1<<4)

Definition at line 92 of file i2c-tegra.c.

#define TEGRA_I2C_PM   NULL

Definition at line 815 of file i2c-tegra.c.

#define TEGRA_I2C_TIMEOUT   (msecs_to_jiffies(1000))

Definition at line 37 of file i2c-tegra.c.

Enumeration Type Documentation

Enumerator:
MSG_END_STOP 
MSG_END_REPEAT_START 
MSG_END_CONTINUE 

Definition at line 111 of file i2c-tegra.c.

Function Documentation

MODULE_AUTHOR ( "Colin Cross"  )
MODULE_DESCRIPTION ( "nVidia Tegra2 I2C Bus Controller driver )
module_exit ( tegra_i2c_exit_driver  )
MODULE_LICENSE ( "GPL v2 )
subsys_initcall ( tegra_i2c_init_driver  )