Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
low_i2c.c File Reference
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/export.h>
#include <linux/adb.h>
#include <linux/pmu.h>
#include <linux/delay.h>
#include <linux/completion.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/timer.h>
#include <linux/mutex.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <asm/keylargo.h>
#include <asm/uninorth.h>
#include <asm/io.h>
#include <asm/prom.h>
#include <asm/machdep.h>
#include <asm/smu.h>
#include <asm/pmac_pfunc.h>
#include <asm/pmac_low_i2c.h>

Go to the source code of this file.

Data Structures

struct  pmac_i2c_bus
struct  pmac_i2c_host_kw
struct  pmac_i2c_pf_inst


#define DBG(x...)
#define DBG_LOW(x...)
#define KW_POLL_TIMEOUT   (2*HZ)
#define KW_I2C_MODE_100KHZ   0x00
#define KW_I2C_MODE_50KHZ   0x01
#define KW_I2C_MODE_25KHZ   0x02
#define KW_I2C_MODE_DUMB   0x00
#define KW_I2C_MODE_STANDARD   0x04
#define KW_I2C_MODE_STANDARDSUB   0x08
#define KW_I2C_MODE_COMBINED   0x0C
#define KW_I2C_MODE_MODE_MASK   0x0C
#define KW_I2C_MODE_CHAN_MASK   0xF0
#define KW_I2C_CTL_AAK   0x01
#define KW_I2C_CTL_XADDR   0x02
#define KW_I2C_CTL_STOP   0x04
#define KW_I2C_CTL_START   0x08
#define KW_I2C_STAT_BUSY   0x01
#define KW_I2C_STAT_LAST_AAK   0x02
#define KW_I2C_STAT_LAST_RW   0x04
#define KW_I2C_STAT_SDA   0x08
#define KW_I2C_STAT_SCL   0x10
#define KW_I2C_IRQ_DATA   0x01
#define KW_I2C_IRQ_ADDR   0x02
#define KW_I2C_IRQ_STOP   0x04
#define KW_I2C_IRQ_START   0x08
#define KW_I2C_IRQ_MASK   0x0F
#define WRONG_STATE(name)
#define kw_write_reg(reg, val)   __kw_write_reg(host, reg, val)
#define kw_read_reg(reg)   __kw_read_reg(host, reg)
#define MAX_I2C_DATA   64


enum  reg_t {
  reg_mode = 0, reg_control, reg_status, reg_isr,
  reg_ier, reg_addr, reg_subaddr, reg_data
enum  {
  state_idle, state_addr, state_read, state_write,
  state_stop, state_dead
enum  { pmac_i2c_quirk_invmask = 0x00000001u, pmac_i2c_quirk_skip = 0x00000002u }


struct pmac_i2c_buspmac_i2c_find_bus (struct device_node *node)
 EXPORT_SYMBOL_GPL (pmac_i2c_find_bus)
u8 pmac_i2c_get_dev_addr (struct device_node *device)
 EXPORT_SYMBOL_GPL (pmac_i2c_get_dev_addr)
struct device_nodepmac_i2c_get_controller (struct pmac_i2c_bus *bus)
 EXPORT_SYMBOL_GPL (pmac_i2c_get_controller)
struct device_nodepmac_i2c_get_bus_node (struct pmac_i2c_bus *bus)
 EXPORT_SYMBOL_GPL (pmac_i2c_get_bus_node)
int pmac_i2c_get_type (struct pmac_i2c_bus *bus)
 EXPORT_SYMBOL_GPL (pmac_i2c_get_type)
int pmac_i2c_get_flags (struct pmac_i2c_bus *bus)
 EXPORT_SYMBOL_GPL (pmac_i2c_get_flags)
int pmac_i2c_get_channel (struct pmac_i2c_bus *bus)
 EXPORT_SYMBOL_GPL (pmac_i2c_get_channel)
struct i2c_adapterpmac_i2c_get_adapter (struct pmac_i2c_bus *bus)
 EXPORT_SYMBOL_GPL (pmac_i2c_get_adapter)
struct pmac_i2c_buspmac_i2c_adapter_to_bus (struct i2c_adapter *adapter)
 EXPORT_SYMBOL_GPL (pmac_i2c_adapter_to_bus)
int pmac_i2c_match_adapter (struct device_node *dev, struct i2c_adapter *adapter)
 EXPORT_SYMBOL_GPL (pmac_i2c_match_adapter)
int pmac_low_i2c_lock (struct device_node *np)
 EXPORT_SYMBOL_GPL (pmac_low_i2c_lock)
int pmac_low_i2c_unlock (struct device_node *np)
 EXPORT_SYMBOL_GPL (pmac_low_i2c_unlock)
int pmac_i2c_open (struct pmac_i2c_bus *bus, int polled)
 EXPORT_SYMBOL_GPL (pmac_i2c_open)
void pmac_i2c_close (struct pmac_i2c_bus *bus)
 EXPORT_SYMBOL_GPL (pmac_i2c_close)
int pmac_i2c_setmode (struct pmac_i2c_bus *bus, int mode)
 EXPORT_SYMBOL_GPL (pmac_i2c_setmode)
int pmac_i2c_xfer (struct pmac_i2c_bus *bus, u8 addrdir, int subsize, u32 subaddr, u8 *data, int len)
 EXPORT_SYMBOL_GPL (pmac_i2c_xfer)
void pmac_pfunc_i2c_suspend (void)
void pmac_pfunc_i2c_resume (void)
int __init pmac_i2c_init (void)
 machine_arch_initcall (powermac, pmac_i2c_init)
 machine_subsys_initcall (powermac, pmac_i2c_create_platform_devices)

Macro Definition Documentation

#define DBG (   x...)

Definition at line 61 of file low_i2c.c.

#define DBG_LOW (   x...)

Definition at line 69 of file low_i2c.c.

#define KW_I2C_CTL_AAK   0x01

Definition at line 153 of file low_i2c.c.

#define KW_I2C_CTL_START   0x08

Definition at line 156 of file low_i2c.c.

#define KW_I2C_CTL_STOP   0x04

Definition at line 155 of file low_i2c.c.

#define KW_I2C_CTL_XADDR   0x02

Definition at line 154 of file low_i2c.c.

#define KW_I2C_IRQ_ADDR   0x02

Definition at line 167 of file low_i2c.c.

#define KW_I2C_IRQ_DATA   0x01

Definition at line 166 of file low_i2c.c.

#define KW_I2C_IRQ_MASK   0x0F

Definition at line 170 of file low_i2c.c.

#define KW_I2C_IRQ_START   0x08

Definition at line 169 of file low_i2c.c.

#define KW_I2C_IRQ_STOP   0x04

Definition at line 168 of file low_i2c.c.

#define KW_I2C_MODE_100KHZ   0x00

Definition at line 142 of file low_i2c.c.

#define KW_I2C_MODE_25KHZ   0x02

Definition at line 144 of file low_i2c.c.

#define KW_I2C_MODE_50KHZ   0x01

Definition at line 143 of file low_i2c.c.

#define KW_I2C_MODE_CHAN_MASK   0xF0

Definition at line 150 of file low_i2c.c.

#define KW_I2C_MODE_COMBINED   0x0C

Definition at line 148 of file low_i2c.c.

#define KW_I2C_MODE_DUMB   0x00

Definition at line 145 of file low_i2c.c.

#define KW_I2C_MODE_MODE_MASK   0x0C

Definition at line 149 of file low_i2c.c.

#define KW_I2C_MODE_STANDARD   0x04

Definition at line 146 of file low_i2c.c.

#define KW_I2C_MODE_STANDARDSUB   0x08

Definition at line 147 of file low_i2c.c.

#define KW_I2C_STAT_BUSY   0x01

Definition at line 159 of file low_i2c.c.

#define KW_I2C_STAT_LAST_AAK   0x02

Definition at line 160 of file low_i2c.c.

#define KW_I2C_STAT_LAST_RW   0x04

Definition at line 161 of file low_i2c.c.

#define KW_I2C_STAT_SCL   0x10

Definition at line 163 of file low_i2c.c.

#define KW_I2C_STAT_SDA   0x08

Definition at line 162 of file low_i2c.c.

#define KW_POLL_TIMEOUT   (2*HZ)

Definition at line 139 of file low_i2c.c.

#define kw_read_reg (   reg)    __kw_read_reg(host, reg)

Definition at line 210 of file low_i2c.c.

#define kw_write_reg (   reg,
)    __kw_write_reg(host, reg, val)

Definition at line 209 of file low_i2c.c.

#define MAX_I2C_DATA   64

Definition at line 1221 of file low_i2c.c.

#define WRONG_STATE (   name)
do {\
printk(KERN_DEBUG "KW: wrong state. Got %s, state: %s " \
"(isr: %02x)\n", \
name, __kw_state_names[host->state], isr); \
} while(0)

Definition at line 182 of file low_i2c.c.

Enumeration Type Documentation

anonymous enum

Definition at line 173 of file low_i2c.c.

anonymous enum

Definition at line 1159 of file low_i2c.c.

enum reg_t

Definition at line 127 of file low_i2c.c.

Function Documentation

EXPORT_SYMBOL_GPL ( pmac_i2c_find_bus  )
EXPORT_SYMBOL_GPL ( pmac_i2c_get_dev_addr  )
EXPORT_SYMBOL_GPL ( pmac_i2c_get_controller  )
EXPORT_SYMBOL_GPL ( pmac_i2c_get_bus_node  )
EXPORT_SYMBOL_GPL ( pmac_i2c_get_type  )
EXPORT_SYMBOL_GPL ( pmac_i2c_get_flags  )
EXPORT_SYMBOL_GPL ( pmac_i2c_get_channel  )
EXPORT_SYMBOL_GPL ( pmac_i2c_get_adapter  )
EXPORT_SYMBOL_GPL ( pmac_i2c_adapter_to_bus  )
EXPORT_SYMBOL_GPL ( pmac_i2c_match_adapter  )
EXPORT_SYMBOL_GPL ( pmac_low_i2c_lock  )
EXPORT_SYMBOL_GPL ( pmac_low_i2c_unlock  )
EXPORT_SYMBOL_GPL ( pmac_i2c_open  )
EXPORT_SYMBOL_GPL ( pmac_i2c_close  )
EXPORT_SYMBOL_GPL ( pmac_i2c_setmode  )
EXPORT_SYMBOL_GPL ( pmac_i2c_xfer  )
machine_arch_initcall ( powermac  ,
machine_subsys_initcall ( powermac  ,
struct pmac_i2c_bus* pmac_i2c_adapter_to_bus ( struct i2c_adapter adapter)

Definition at line 1037 of file low_i2c.c.

void pmac_i2c_close ( struct pmac_i2c_bus bus)

Definition at line 1109 of file low_i2c.c.

struct pmac_i2c_bus* pmac_i2c_find_bus ( struct device_node node)

Definition at line 958 of file low_i2c.c.

struct i2c_adapter* pmac_i2c_get_adapter ( struct pmac_i2c_bus bus)

Definition at line 1031 of file low_i2c.c.

struct device_node* pmac_i2c_get_bus_node ( struct pmac_i2c_bus bus)

Definition at line 1006 of file low_i2c.c.

int pmac_i2c_get_channel ( struct pmac_i2c_bus bus)

Definition at line 1024 of file low_i2c.c.

struct device_node* pmac_i2c_get_controller ( struct pmac_i2c_bus bus)

Definition at line 1000 of file low_i2c.c.

u8 pmac_i2c_get_dev_addr ( struct device_node device)

Definition at line 989 of file low_i2c.c.

int pmac_i2c_get_flags ( struct pmac_i2c_bus bus)

Definition at line 1018 of file low_i2c.c.

int pmac_i2c_get_type ( struct pmac_i2c_bus bus)

Definition at line 1012 of file low_i2c.c.

int __init pmac_i2c_init ( void  )

Definition at line 1456 of file low_i2c.c.

int pmac_i2c_match_adapter ( struct device_node dev,
struct i2c_adapter adapter 

Definition at line 1048 of file low_i2c.c.

int pmac_i2c_open ( struct pmac_i2c_bus bus,
int  polled 

Definition at line 1092 of file low_i2c.c.

int pmac_i2c_setmode ( struct pmac_i2c_bus bus,
int  mode 

Definition at line 1119 of file low_i2c.c.

int pmac_i2c_xfer ( struct pmac_i2c_bus bus,
u8  addrdir,
int  subsize,
u32  subaddr,
u8 data,
int  len 

Definition at line 1137 of file low_i2c.c.

int pmac_low_i2c_lock ( struct device_node np)

Definition at line 1058 of file low_i2c.c.

int pmac_low_i2c_unlock ( struct device_node np)

Definition at line 1074 of file low_i2c.c.

void pmac_pfunc_i2c_resume ( void  )

Definition at line 1446 of file low_i2c.c.

void pmac_pfunc_i2c_suspend ( void  )

Definition at line 1441 of file low_i2c.c.