Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
i2c-nomadik.c File Reference
#include <linux/init.h>
#include <linux/module.h>
#include <linux/amba/bus.h>
#include <linux/atomic.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/err.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/pm_runtime.h>
#include <linux/platform_data/i2c-nomadik.h>
#include <linux/of.h>
#include <linux/of_i2c.h>

Go to the source code of this file.

Data Structures

struct  i2c_nmk_client
 
struct  nmk_i2c_dev
 

Macros

#define DRIVER_NAME   "nmk-i2c"
 
#define I2C_CR   (0x000)
 
#define I2C_SCR   (0x004)
 
#define I2C_HSMCR   (0x008)
 
#define I2C_MCR   (0x00C)
 
#define I2C_TFR   (0x010)
 
#define I2C_SR   (0x014)
 
#define I2C_RFR   (0x018)
 
#define I2C_TFTR   (0x01C)
 
#define I2C_RFTR   (0x020)
 
#define I2C_DMAR   (0x024)
 
#define I2C_BRCR   (0x028)
 
#define I2C_IMSCR   (0x02C)
 
#define I2C_RISR   (0x030)
 
#define I2C_MISR   (0x034)
 
#define I2C_ICR   (0x038)
 
#define I2C_CR_PE   (0x1 << 0) /* Peripheral Enable */
 
#define I2C_CR_OM   (0x3 << 1) /* Operating mode */
 
#define I2C_CR_SAM   (0x1 << 3) /* Slave addressing mode */
 
#define I2C_CR_SM   (0x3 << 4) /* Speed mode */
 
#define I2C_CR_SGCM   (0x1 << 6) /* Slave general call mode */
 
#define I2C_CR_FTX   (0x1 << 7) /* Flush Transmit */
 
#define I2C_CR_FRX   (0x1 << 8) /* Flush Receive */
 
#define I2C_CR_DMA_TX_EN   (0x1 << 9) /* DMA Tx enable */
 
#define I2C_CR_DMA_RX_EN   (0x1 << 10) /* DMA Rx Enable */
 
#define I2C_CR_DMA_SLE   (0x1 << 11) /* DMA sync. logic enable */
 
#define I2C_CR_LM   (0x1 << 12) /* Loopback mode */
 
#define I2C_CR_FON   (0x3 << 13) /* Filtering on */
 
#define I2C_CR_FS   (0x3 << 15) /* Force stop enable */
 
#define I2C_MCR_OP   (0x1 << 0) /* Operation */
 
#define I2C_MCR_A7   (0x7f << 1) /* 7-bit address */
 
#define I2C_MCR_EA10   (0x7 << 8) /* 10-bit Extended address */
 
#define I2C_MCR_SB   (0x1 << 11) /* Extended address */
 
#define I2C_MCR_AM   (0x3 << 12) /* Address type */
 
#define I2C_MCR_STOP   (0x1 << 14) /* Stop condition */
 
#define I2C_MCR_LENGTH   (0x7ff << 15) /* Transaction length */
 
#define I2C_SR_OP   (0x3 << 0) /* Operation */
 
#define I2C_SR_STATUS   (0x3 << 2) /* controller status */
 
#define I2C_SR_CAUSE   (0x7 << 4) /* Abort cause */
 
#define I2C_SR_TYPE   (0x3 << 7) /* Receive type */
 
#define I2C_SR_LENGTH   (0x7ff << 9) /* Transfer length */
 
#define I2C_IT_TXFE   (0x1 << 0)
 
#define I2C_IT_TXFNE   (0x1 << 1)
 
#define I2C_IT_TXFF   (0x1 << 2)
 
#define I2C_IT_TXFOVR   (0x1 << 3)
 
#define I2C_IT_RXFE   (0x1 << 4)
 
#define I2C_IT_RXFNF   (0x1 << 5)
 
#define I2C_IT_RXFF   (0x1 << 6)
 
#define I2C_IT_RFSR   (0x1 << 16)
 
#define I2C_IT_RFSE   (0x1 << 17)
 
#define I2C_IT_WTSR   (0x1 << 18)
 
#define I2C_IT_MTD   (0x1 << 19)
 
#define I2C_IT_STD   (0x1 << 20)
 
#define I2C_IT_MAL   (0x1 << 24)
 
#define I2C_IT_BERR   (0x1 << 25)
 
#define I2C_IT_MTDWS   (0x1 << 28)
 
#define GEN_MASK(val, mask, sb)   (((val) << (sb)) & (mask))
 
#define I2C_CLEAR_ALL_INTS   0x131f007f
 
#define IRQ_MASK(mask)   (mask & 0x1fffffff)
 
#define MAX_I2C_FIFO_THRESHOLD   15
 
#define LOOP_ATTEMPTS   10
 
#define DEFAULT_I2C_REG_CR   ((1 << 1) | I2C_CR_PE)
 
#define nmk_i2c_suspend   NULL
 
#define nmk_i2c_resume   NULL
 

Enumerations

enum  i2c_status {
  I2C_NOP, I2C_ON_GOING, I2C_OK, I2C_ABORT,
  IDLE = 0, DONE_STOP = 1, BUSY = 2, TO_SCL = 3,
  TO_ARB = 4, DONE_WRITE = 5, DONE_READ = 6, DONE_WRITE_TO = 7,
  DONE_READ_TO = 8, NO_DEVICE = 9, NO_ACKN = 10, BUS_ERR = 11,
  ARB_LOST = 12, SEQ_ERR = 13, ST_ERR = 14, SW_ERR = 15
}
 
enum  i2c_operation { I2C_NO_OPERATION = 0xff, I2C_WRITE = 0x00, I2C_READ = 0x01 }
 

Functions

 MODULE_DEVICE_TABLE (amba, nmk_i2c_ids)
 
 subsys_initcall (nmk_i2c_init)
 
 module_exit (nmk_i2c_exit)
 
 MODULE_AUTHOR ("Sachin Verma, Srinidhi KASAGAR")
 
 MODULE_DESCRIPTION ("Nomadik/Ux500 I2C driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define DEFAULT_I2C_REG_CR   ((1 << 1) | I2C_CR_PE)

Definition at line 273 of file i2c-nomadik.c.

#define DRIVER_NAME   "nmk-i2c"

Definition at line 30 of file i2c-nomadik.c.

#define GEN_MASK (   val,
  mask,
  sb 
)    (((val) << (sb)) & (mask))

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

#define I2C_BRCR   (0x028)

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

#define I2C_CLEAR_ALL_INTS   0x131f007f

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

#define I2C_CR   (0x000)

Definition at line 33 of file i2c-nomadik.c.

#define I2C_CR_DMA_RX_EN   (0x1 << 10) /* DMA Rx Enable */

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

#define I2C_CR_DMA_SLE   (0x1 << 11) /* DMA sync. logic enable */

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

#define I2C_CR_DMA_TX_EN   (0x1 << 9) /* DMA Tx enable */

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

#define I2C_CR_FON   (0x3 << 13) /* Filtering on */

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

#define I2C_CR_FRX   (0x1 << 8) /* Flush Receive */

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

#define I2C_CR_FS   (0x3 << 15) /* Force stop enable */

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

#define I2C_CR_FTX   (0x1 << 7) /* Flush Transmit */

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

#define I2C_CR_LM   (0x1 << 12) /* Loopback mode */

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

#define I2C_CR_OM   (0x3 << 1) /* Operating mode */

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

#define I2C_CR_PE   (0x1 << 0) /* Peripheral Enable */

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

#define I2C_CR_SAM   (0x1 << 3) /* Slave addressing mode */

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

#define I2C_CR_SGCM   (0x1 << 6) /* Slave general call mode */

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

#define I2C_CR_SM   (0x3 << 4) /* Speed mode */

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

#define I2C_DMAR   (0x024)

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

#define I2C_HSMCR   (0x008)

Definition at line 35 of file i2c-nomadik.c.

#define I2C_ICR   (0x038)

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

#define I2C_IMSCR   (0x02C)

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

#define I2C_IT_BERR   (0x1 << 25)

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

#define I2C_IT_MAL   (0x1 << 24)

Definition at line 93 of file i2c-nomadik.c.

#define I2C_IT_MTD   (0x1 << 19)

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

#define I2C_IT_MTDWS   (0x1 << 28)

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

#define I2C_IT_RFSE   (0x1 << 17)

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

#define I2C_IT_RFSR   (0x1 << 16)

Definition at line 88 of file i2c-nomadik.c.

#define I2C_IT_RXFE   (0x1 << 4)

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

#define I2C_IT_RXFF   (0x1 << 6)

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

#define I2C_IT_RXFNF   (0x1 << 5)

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

#define I2C_IT_STD   (0x1 << 20)

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

#define I2C_IT_TXFE   (0x1 << 0)

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

#define I2C_IT_TXFF   (0x1 << 2)

Definition at line 83 of file i2c-nomadik.c.

#define I2C_IT_TXFNE   (0x1 << 1)

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

#define I2C_IT_TXFOVR   (0x1 << 3)

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

#define I2C_IT_WTSR   (0x1 << 18)

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

#define I2C_MCR   (0x00C)

Definition at line 36 of file i2c-nomadik.c.

#define I2C_MCR_A7   (0x7f << 1) /* 7-bit address */

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

#define I2C_MCR_AM   (0x3 << 12) /* Address type */

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

#define I2C_MCR_EA10   (0x7 << 8) /* 10-bit Extended address */

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

#define I2C_MCR_LENGTH   (0x7ff << 15) /* Transaction length */

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

#define I2C_MCR_OP   (0x1 << 0) /* Operation */

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

#define I2C_MCR_SB   (0x1 << 11) /* Extended address */

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

#define I2C_MCR_STOP   (0x1 << 14) /* Stop condition */

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

#define I2C_MISR   (0x034)

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

#define I2C_RFR   (0x018)

Definition at line 39 of file i2c-nomadik.c.

#define I2C_RFTR   (0x020)

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

#define I2C_RISR   (0x030)

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

#define I2C_SCR   (0x004)

Definition at line 34 of file i2c-nomadik.c.

#define I2C_SR   (0x014)

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

#define I2C_SR_CAUSE   (0x7 << 4) /* Abort cause */

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

#define I2C_SR_LENGTH   (0x7ff << 9) /* Transfer length */

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

#define I2C_SR_OP   (0x3 << 0) /* Operation */

Definition at line 74 of file i2c-nomadik.c.

#define I2C_SR_STATUS   (0x3 << 2) /* controller status */

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

#define I2C_SR_TYPE   (0x3 << 7) /* Receive type */

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

#define I2C_TFR   (0x010)

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

#define I2C_TFTR   (0x01C)

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

#define IRQ_MASK (   mask)    (mask & 0x1fffffff)

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

#define LOOP_ATTEMPTS   10
#define MAX_I2C_FIFO_THRESHOLD   15

Definition at line 106 of file i2c-nomadik.c.

#define nmk_i2c_resume   NULL

Definition at line 887 of file i2c-nomadik.c.

#define nmk_i2c_suspend   NULL

Definition at line 886 of file i2c-nomadik.c.

Enumeration Type Documentation

Enumerator:
I2C_NO_OPERATION 
I2C_WRITE 
I2C_READ 

Definition at line 116 of file i2c-nomadik.c.

enum i2c_status
Enumerator:
I2C_NOP 
I2C_ON_GOING 
I2C_OK 
I2C_ABORT 
IDLE 
DONE_STOP 
BUSY 
TO_SCL 
TO_ARB 
DONE_WRITE 
DONE_READ 
DONE_WRITE_TO 
DONE_READ_TO 
NO_DEVICE 
NO_ACKN 
BUS_ERR 
ARB_LOST 
SEQ_ERR 
ST_ERR 
SW_ERR 

Definition at line 108 of file i2c-nomadik.c.

Function Documentation

MODULE_AUTHOR ( "Sachin  Verma,
Srinidhi KASAGAR"   
)
MODULE_DESCRIPTION ( "Nomadik/Ux500 I2C driver )
MODULE_DEVICE_TABLE ( amba  ,
nmk_i2c_ids   
)
module_exit ( nmk_i2c_exit  )
MODULE_LICENSE ( "GPL"  )
subsys_initcall ( nmk_i2c_init  )