aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/pmac_low_i2c.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-powerpc/pmac_low_i2c.h')
-rw-r--r--include/asm-powerpc/pmac_low_i2c.h92
1 files changed, 78 insertions, 14 deletions
diff --git a/include/asm-powerpc/pmac_low_i2c.h b/include/asm-powerpc/pmac_low_i2c.h
index 809a5963d5e7..131011bd7e76 100644
--- a/include/asm-powerpc/pmac_low_i2c.h
+++ b/include/asm-powerpc/pmac_low_i2c.h
@@ -11,33 +11,97 @@
11 */ 11 */
12#ifndef __PMAC_LOW_I2C_H__ 12#ifndef __PMAC_LOW_I2C_H__
13#define __PMAC_LOW_I2C_H__ 13#define __PMAC_LOW_I2C_H__
14#ifdef __KERNEL__
14 15
15/* i2c mode (based on the platform functions format) */ 16/* i2c mode (based on the platform functions format) */
16enum { 17enum {
17 pmac_low_i2c_mode_dumb = 1, 18 pmac_i2c_mode_dumb = 1,
18 pmac_low_i2c_mode_std = 2, 19 pmac_i2c_mode_std = 2,
19 pmac_low_i2c_mode_stdsub = 3, 20 pmac_i2c_mode_stdsub = 3,
20 pmac_low_i2c_mode_combined = 4, 21 pmac_i2c_mode_combined = 4,
21}; 22};
22 23
23/* RW bit in address */ 24/* RW bit in address */
24enum { 25enum {
25 pmac_low_i2c_read = 0x01, 26 pmac_i2c_read = 0x01,
26 pmac_low_i2c_write = 0x00 27 pmac_i2c_write = 0x00
27}; 28};
28 29
30/* i2c bus type */
31enum {
32 pmac_i2c_bus_keywest = 0,
33 pmac_i2c_bus_pmu = 1,
34 pmac_i2c_bus_smu = 2,
35};
36
37/* i2c bus features */
38enum {
39 /* can_largesub : supports >1 byte subaddresses (SMU only) */
40 pmac_i2c_can_largesub = 0x00000001u,
41
42 /* multibus : device node holds multiple busses, bus number is
43 * encoded in bits 0xff00 of "reg" of a given device
44 */
45 pmac_i2c_multibus = 0x00000002u,
46};
47
48/* i2c busses in the system */
49struct pmac_i2c_bus;
50struct i2c_adapter;
51
29/* Init, called early during boot */ 52/* Init, called early during boot */
30extern void pmac_init_low_i2c(void); 53extern int pmac_i2c_init(void);
54
55/* Lookup an i2c bus for a device-node. The node can be either the bus
56 * node itself or a device below it. In the case of a multibus, the bus
57 * node itself is the controller node, else, it's a child of the controller
58 * node
59 */
60extern struct pmac_i2c_bus *pmac_i2c_find_bus(struct device_node *node);
61
62/* Get the address for an i2c device. This strips the bus number if
63 * necessary. The 7 bits address is returned 1 bit right shifted so that the
64 * direction can be directly ored in
65 */
66extern u8 pmac_i2c_get_dev_addr(struct device_node *device);
67
68/* Get infos about a bus */
69extern struct device_node *pmac_i2c_get_controller(struct pmac_i2c_bus *bus);
70extern struct device_node *pmac_i2c_get_bus_node(struct pmac_i2c_bus *bus);
71extern int pmac_i2c_get_type(struct pmac_i2c_bus *bus);
72extern int pmac_i2c_get_flags(struct pmac_i2c_bus *bus);
73extern int pmac_i2c_get_channel(struct pmac_i2c_bus *bus);
74
75/* i2c layer adapter attach/detach */
76extern void pmac_i2c_attach_adapter(struct pmac_i2c_bus *bus,
77 struct i2c_adapter *adapter);
78extern void pmac_i2c_detach_adapter(struct pmac_i2c_bus *bus,
79 struct i2c_adapter *adapter);
80extern struct i2c_adapter *pmac_i2c_get_adapter(struct pmac_i2c_bus *bus);
81extern struct pmac_i2c_bus *pmac_i2c_adapter_to_bus(struct i2c_adapter *adapter);
82
83/* March a device or bus with an i2c adapter structure, to be used by drivers
84 * to match device-tree nodes with i2c adapters during adapter discovery
85 * callbacks
86 */
87extern int pmac_i2c_match_adapter(struct device_node *dev,
88 struct i2c_adapter *adapter);
89
31 90
32/* Locking functions exposed to i2c-keywest */ 91/* (legacy) Locking functions exposed to i2c-keywest */
33int pmac_low_i2c_lock(struct device_node *np); 92extern int pmac_low_i2c_lock(struct device_node *np);
34int pmac_low_i2c_unlock(struct device_node *np); 93extern int pmac_low_i2c_unlock(struct device_node *np);
35 94
36/* Access functions for platform code */ 95/* Access functions for platform code */
37int pmac_low_i2c_open(struct device_node *np, int channel); 96extern int pmac_i2c_open(struct pmac_i2c_bus *bus, int polled);
38int pmac_low_i2c_close(struct device_node *np); 97extern void pmac_i2c_close(struct pmac_i2c_bus *bus);
39int pmac_low_i2c_setmode(struct device_node *np, int mode); 98extern int pmac_i2c_setmode(struct pmac_i2c_bus *bus, int mode);
40int pmac_low_i2c_xfer(struct device_node *np, u8 addrdir, u8 subaddr, u8 *data, int len); 99extern int pmac_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize,
100 u32 subaddr, u8 *data, int len);
41 101
102/* Suspend/resume code called by via-pmu directly for now */
103extern void pmac_pfunc_i2c_suspend(void);
104extern void pmac_pfunc_i2c_resume(void);
42 105
106#endif /* __KERNEL__ */
43#endif /* __PMAC_LOW_I2C_H__ */ 107#endif /* __PMAC_LOW_I2C_H__ */