Commit | Line | Data |
---|---|---|
49cbe786 EM |
1 | #ifndef __ASM_MACH_PXA168_H |
2 | #define __ASM_MACH_PXA168_H | |
3 | ||
1a77920e | 4 | #include <linux/i2c.h> |
49cbe786 | 5 | #include <mach/devices.h> |
1a77920e | 6 | #include <plat/i2c.h> |
49cbe786 EM |
7 | |
8 | extern struct pxa_device_desc pxa168_device_uart1; | |
9 | extern struct pxa_device_desc pxa168_device_uart2; | |
1a77920e EM |
10 | extern struct pxa_device_desc pxa168_device_twsi0; |
11 | extern struct pxa_device_desc pxa168_device_twsi1; | |
a27ba768 EM |
12 | extern struct pxa_device_desc pxa168_device_pwm1; |
13 | extern struct pxa_device_desc pxa168_device_pwm2; | |
14 | extern struct pxa_device_desc pxa168_device_pwm3; | |
15 | extern struct pxa_device_desc pxa168_device_pwm4; | |
49cbe786 EM |
16 | |
17 | static inline int pxa168_add_uart(int id) | |
18 | { | |
19 | struct pxa_device_desc *d = NULL; | |
20 | ||
21 | switch (id) { | |
22 | case 1: d = &pxa168_device_uart1; break; | |
23 | case 2: d = &pxa168_device_uart2; break; | |
24 | } | |
25 | ||
26 | if (d == NULL) | |
27 | return -EINVAL; | |
28 | ||
29 | return pxa_register_device(d, NULL, 0); | |
30 | } | |
1a77920e EM |
31 | |
32 | static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data, | |
33 | struct i2c_board_info *info, unsigned size) | |
34 | { | |
35 | struct pxa_device_desc *d = NULL; | |
36 | int ret; | |
37 | ||
38 | switch (id) { | |
39 | case 0: d = &pxa168_device_twsi0; break; | |
40 | case 1: d = &pxa168_device_twsi1; break; | |
41 | default: | |
42 | return -EINVAL; | |
43 | } | |
44 | ||
45 | ret = i2c_register_board_info(id, info, size); | |
46 | if (ret) | |
47 | return ret; | |
48 | ||
49 | return pxa_register_device(d, data, sizeof(*data)); | |
50 | } | |
a27ba768 EM |
51 | |
52 | static inline int pxa168_add_pwm(int id) | |
53 | { | |
54 | struct pxa_device_desc *d = NULL; | |
55 | ||
56 | switch (id) { | |
57 | case 1: d = &pxa168_device_pwm1; break; | |
58 | case 2: d = &pxa168_device_pwm2; break; | |
59 | case 3: d = &pxa168_device_pwm3; break; | |
60 | case 4: d = &pxa168_device_pwm4; break; | |
61 | default: | |
62 | return -EINVAL; | |
63 | } | |
64 | ||
65 | return pxa_register_device(d, NULL, 0); | |
66 | } | |
49cbe786 | 67 | #endif /* __ASM_MACH_PXA168_H */ |