1
2
3
4
5
6
7
8
9
10
11
12#ifndef __PMAC_LOW_I2C_H__
13#define __PMAC_LOW_I2C_H__
14#ifdef __KERNEL__
15
16
17enum {
18 pmac_i2c_mode_dumb = 1,
19 pmac_i2c_mode_std = 2,
20 pmac_i2c_mode_stdsub = 3,
21 pmac_i2c_mode_combined = 4,
22};
23
24
25enum {
26 pmac_i2c_read = 0x01,
27 pmac_i2c_write = 0x00
28};
29
30
31enum {
32 pmac_i2c_bus_keywest = 0,
33 pmac_i2c_bus_pmu = 1,
34 pmac_i2c_bus_smu = 2,
35};
36
37
38enum {
39
40 pmac_i2c_can_largesub = 0x00000001u,
41
42
43
44
45 pmac_i2c_multibus = 0x00000002u,
46};
47
48
49struct pmac_i2c_bus;
50struct i2c_adapter;
51
52
53extern int pmac_i2c_init(void);
54
55
56
57
58
59
60extern struct pmac_i2c_bus *pmac_i2c_find_bus(struct device_node *node);
61
62
63
64
65
66extern u8 pmac_i2c_get_dev_addr(struct device_node *device);
67
68
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
76extern struct i2c_adapter *pmac_i2c_get_adapter(struct pmac_i2c_bus *bus);
77extern struct pmac_i2c_bus *pmac_i2c_adapter_to_bus(struct i2c_adapter *adapter);
78
79
80
81
82
83extern int pmac_i2c_match_adapter(struct device_node *dev,
84 struct i2c_adapter *adapter);
85
86
87
88extern int pmac_low_i2c_lock(struct device_node *np);
89extern int pmac_low_i2c_unlock(struct device_node *np);
90
91
92extern int pmac_i2c_open(struct pmac_i2c_bus *bus, int polled);
93extern void pmac_i2c_close(struct pmac_i2c_bus *bus);
94extern int pmac_i2c_setmode(struct pmac_i2c_bus *bus, int mode);
95extern int pmac_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize,
96 u32 subaddr, u8 *data, int len);
97
98
99extern void pmac_pfunc_i2c_suspend(void);
100extern void pmac_pfunc_i2c_resume(void);
101
102#endif
103#endif
104