Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
i2c-stu300.c File Reference
#include <linux/init.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/slab.h>

Go to the source code of this file.

Data Structures

struct  stu300_dev
 
struct  stu300_clkset
 

Macros

#define NAME   "stu300"
 
#define I2C_CR   (0x00000000)
 
#define I2C_CR_RESET_VALUE   (0x00)
 
#define I2C_CR_RESET_UMASK   (0x00)
 
#define I2C_CR_DDC1_ENABLE   (0x80)
 
#define I2C_CR_TRANS_ENABLE   (0x40)
 
#define I2C_CR_PERIPHERAL_ENABLE   (0x20)
 
#define I2C_CR_DDC2B_ENABLE   (0x10)
 
#define I2C_CR_START_ENABLE   (0x08)
 
#define I2C_CR_ACK_ENABLE   (0x04)
 
#define I2C_CR_STOP_ENABLE   (0x02)
 
#define I2C_CR_INTERRUPT_ENABLE   (0x01)
 
#define I2C_SR1   (0x00000004)
 
#define I2C_SR1_RESET_VALUE   (0x00)
 
#define I2C_SR1_RESET_UMASK   (0x00)
 
#define I2C_SR1_EVF_IND   (0x80)
 
#define I2C_SR1_ADD10_IND   (0x40)
 
#define I2C_SR1_TRA_IND   (0x20)
 
#define I2C_SR1_BUSY_IND   (0x10)
 
#define I2C_SR1_BTF_IND   (0x08)
 
#define I2C_SR1_ADSL_IND   (0x04)
 
#define I2C_SR1_MSL_IND   (0x02)
 
#define I2C_SR1_SB_IND   (0x01)
 
#define I2C_SR2   (0x00000008)
 
#define I2C_SR2_RESET_VALUE   (0x00)
 
#define I2C_SR2_RESET_UMASK   (0x40)
 
#define I2C_SR2_MASK   (0xBF)
 
#define I2C_SR2_SCLFAL_IND   (0x80)
 
#define I2C_SR2_ENDAD_IND   (0x20)
 
#define I2C_SR2_AF_IND   (0x10)
 
#define I2C_SR2_STOPF_IND   (0x08)
 
#define I2C_SR2_ARLO_IND   (0x04)
 
#define I2C_SR2_BERR_IND   (0x02)
 
#define I2C_SR2_DDC2BF_IND   (0x01)
 
#define I2C_CCR   (0x0000000C)
 
#define I2C_CCR_RESET_VALUE   (0x00)
 
#define I2C_CCR_RESET_UMASK   (0x00)
 
#define I2C_CCR_MASK   (0xFF)
 
#define I2C_CCR_FMSM   (0x80)
 
#define I2C_CCR_CC_MASK   (0x7F)
 
#define I2C_OAR1   (0x00000010)
 
#define I2C_OAR1_RESET_VALUE   (0x00)
 
#define I2C_OAR1_RESET_UMASK   (0x00)
 
#define I2C_OAR1_ADD_MASK   (0xFF)
 
#define I2C_OAR2   (0x00000014)
 
#define I2C_OAR2_RESET_VALUE   (0x40)
 
#define I2C_OAR2_RESET_UMASK   (0x19)
 
#define I2C_OAR2_MASK   (0xE6)
 
#define I2C_OAR2_FR_25_10MHZ   (0x00)
 
#define I2C_OAR2_FR_10_1667MHZ   (0x20)
 
#define I2C_OAR2_FR_1667_2667MHZ   (0x40)
 
#define I2C_OAR2_FR_2667_40MHZ   (0x60)
 
#define I2C_OAR2_FR_40_5333MHZ   (0x80)
 
#define I2C_OAR2_FR_5333_66MHZ   (0xA0)
 
#define I2C_OAR2_FR_66_80MHZ   (0xC0)
 
#define I2C_OAR2_FR_80_100MHZ   (0xE0)
 
#define I2C_OAR2_FR_MASK   (0xE0)
 
#define I2C_OAR2_ADD_MASK   (0x06)
 
#define I2C_DR   (0x00000018)
 
#define I2C_DR_RESET_VALUE   (0x00)
 
#define I2C_DR_RESET_UMASK   (0xFF)
 
#define I2C_DR_D_MASK   (0xFF)
 
#define I2C_ECCR   (0x0000001C)
 
#define I2C_ECCR_RESET_VALUE   (0x00)
 
#define I2C_ECCR_RESET_UMASK   (0xE0)
 
#define I2C_ECCR_MASK   (0x1F)
 
#define I2C_ECCR_CC_MASK   (0x1F)
 
#define STU300_TIMEOUT   (msecs_to_jiffies(1000))
 
#define NUM_ADDR_RESEND_ATTEMPTS   12
 
#define BUSY_RELEASE_ATTEMPTS   10
 
#define STU300_I2C_PM   NULL
 

Enumerations

enum  stu300_event {
  STU300_EVENT_NONE = 0, STU300_EVENT_1, STU300_EVENT_2, STU300_EVENT_3,
  STU300_EVENT_4, STU300_EVENT_5, STU300_EVENT_6, STU300_EVENT_7,
  STU300_EVENT_8, STU300_EVENT_9
}
 
enum  stu300_error {
  STU300_ERROR_NONE = 0, STU300_ERROR_ACKNOWLEDGE_FAILURE, STU300_ERROR_BUS_ERROR, STU300_ERROR_ARBITRATION_LOST,
  STU300_ERROR_UNKNOWN
}
 

Functions

 module_param (scl_frequency, uint, 0644)
 
 subsys_initcall (stu300_init)
 
 module_exit (stu300_exit)
 
 MODULE_AUTHOR ("Linus Walleij <[email protected]>")
 
 MODULE_DESCRIPTION ("ST Micro DDC I2C adapter ("NAME")")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_ALIAS ("platform:"NAME)
 

Macro Definition Documentation

#define BUSY_RELEASE_ATTEMPTS   10

Definition at line 438 of file i2c-stu300.c.

#define I2C_CCR   (0x0000000C)

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

#define I2C_CCR_CC_MASK   (0x7F)

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

#define I2C_CCR_FMSM   (0x80)

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

#define I2C_CCR_MASK   (0xFF)

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

#define I2C_CCR_RESET_UMASK   (0x00)

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

#define I2C_CCR_RESET_VALUE   (0x00)

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

#define I2C_CR   (0x00000000)

Definition at line 25 of file i2c-stu300.c.

#define I2C_CR_ACK_ENABLE   (0x04)

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

#define I2C_CR_DDC1_ENABLE   (0x80)

Definition at line 28 of file i2c-stu300.c.

#define I2C_CR_DDC2B_ENABLE   (0x10)

Definition at line 31 of file i2c-stu300.c.

#define I2C_CR_INTERRUPT_ENABLE   (0x01)

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

#define I2C_CR_PERIPHERAL_ENABLE   (0x20)

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

#define I2C_CR_RESET_UMASK   (0x00)

Definition at line 27 of file i2c-stu300.c.

#define I2C_CR_RESET_VALUE   (0x00)

Definition at line 26 of file i2c-stu300.c.

#define I2C_CR_START_ENABLE   (0x08)

Definition at line 32 of file i2c-stu300.c.

#define I2C_CR_STOP_ENABLE   (0x02)

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

#define I2C_CR_TRANS_ENABLE   (0x40)

Definition at line 29 of file i2c-stu300.c.

#define I2C_DR   (0x00000018)

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

#define I2C_DR_D_MASK   (0xFF)

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

#define I2C_DR_RESET_UMASK   (0xFF)

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

#define I2C_DR_RESET_VALUE   (0x00)

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

#define I2C_ECCR   (0x0000001C)

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

#define I2C_ECCR_CC_MASK   (0x1F)

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

#define I2C_ECCR_MASK   (0x1F)

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

#define I2C_ECCR_RESET_UMASK   (0xE0)

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

#define I2C_ECCR_RESET_VALUE   (0x00)

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

#define I2C_OAR1   (0x00000010)

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

#define I2C_OAR1_ADD_MASK   (0xFF)

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

#define I2C_OAR1_RESET_UMASK   (0x00)

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

#define I2C_OAR1_RESET_VALUE   (0x00)

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

#define I2C_OAR2   (0x00000014)

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

#define I2C_OAR2_ADD_MASK   (0x06)

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

#define I2C_OAR2_FR_10_1667MHZ   (0x20)

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

#define I2C_OAR2_FR_1667_2667MHZ   (0x40)

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

#define I2C_OAR2_FR_25_10MHZ   (0x00)

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

#define I2C_OAR2_FR_2667_40MHZ   (0x60)

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

#define I2C_OAR2_FR_40_5333MHZ   (0x80)

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

#define I2C_OAR2_FR_5333_66MHZ   (0xA0)

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

#define I2C_OAR2_FR_66_80MHZ   (0xC0)

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

#define I2C_OAR2_FR_80_100MHZ   (0xE0)

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

#define I2C_OAR2_FR_MASK   (0xE0)

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

#define I2C_OAR2_MASK   (0xE6)

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

#define I2C_OAR2_RESET_UMASK   (0x19)

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

#define I2C_OAR2_RESET_VALUE   (0x40)

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

#define I2C_SR1   (0x00000004)

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

#define I2C_SR1_ADD10_IND   (0x40)

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

#define I2C_SR1_ADSL_IND   (0x04)

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

#define I2C_SR1_BTF_IND   (0x08)

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

#define I2C_SR1_BUSY_IND   (0x10)

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

#define I2C_SR1_EVF_IND   (0x80)

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

#define I2C_SR1_MSL_IND   (0x02)

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

#define I2C_SR1_RESET_UMASK   (0x00)

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

#define I2C_SR1_RESET_VALUE   (0x00)

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

#define I2C_SR1_SB_IND   (0x01)

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

#define I2C_SR1_TRA_IND   (0x20)

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

#define I2C_SR2   (0x00000008)

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

#define I2C_SR2_AF_IND   (0x10)

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

#define I2C_SR2_ARLO_IND   (0x04)

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

#define I2C_SR2_BERR_IND   (0x02)

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

#define I2C_SR2_DDC2BF_IND   (0x01)

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

#define I2C_SR2_ENDAD_IND   (0x20)

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

#define I2C_SR2_MASK   (0xBF)

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

#define I2C_SR2_RESET_UMASK   (0x40)

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

#define I2C_SR2_RESET_VALUE   (0x00)

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

#define I2C_SR2_SCLFAL_IND   (0x80)

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

#define I2C_SR2_STOPF_IND   (0x08)

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

#define NAME   "stu300"

Definition at line 22 of file i2c-stu300.c.

#define NUM_ADDR_RESEND_ATTEMPTS   12

Definition at line 132 of file i2c-stu300.c.

#define STU300_I2C_PM   NULL

Definition at line 967 of file i2c-stu300.c.

#define STU300_TIMEOUT   (msecs_to_jiffies(1000))

Definition at line 126 of file i2c-stu300.c.

Enumeration Type Documentation

Enumerator:
STU300_ERROR_NONE 
STU300_ERROR_ACKNOWLEDGE_FAILURE 
STU300_ERROR_BUS_ERROR 
STU300_ERROR_ARBITRATION_LOST 
STU300_ERROR_UNKNOWN 

Definition at line 117 of file i2c-stu300.c.

Enumerator:
STU300_EVENT_NONE 
STU300_EVENT_1 
STU300_EVENT_2 
STU300_EVENT_3 
STU300_EVENT_4 
STU300_EVENT_5 
STU300_EVENT_6 
STU300_EVENT_7 
STU300_EVENT_8 
STU300_EVENT_9 

Definition at line 104 of file i2c-stu300.c.

Function Documentation

MODULE_ALIAS ( "platform:"  NAME)
MODULE_AUTHOR ( "Linus Walleij <[email protected]>"  )
MODULE_DESCRIPTION ( "ST Micro DDC I2C adapter ("NAME")"  )
module_exit ( stu300_exit  )
MODULE_LICENSE ( "GPL"  )
module_param ( scl_frequency  ,
uint  ,
0644   
)
subsys_initcall ( stu300_init  )