Linux 2.6.31.6
[linux/fpc-iii.git] / arch / arm / mach-mmp / include / mach / pxa168.h
blob6bf1f0eefcd1bf8ac88245c6808073ccb6ab0ff3
1 #ifndef __ASM_MACH_PXA168_H
2 #define __ASM_MACH_PXA168_H
4 #include <linux/i2c.h>
5 #include <mach/devices.h>
6 #include <plat/i2c.h>
8 extern struct pxa_device_desc pxa168_device_uart1;
9 extern struct pxa_device_desc pxa168_device_uart2;
10 extern struct pxa_device_desc pxa168_device_twsi0;
11 extern struct pxa_device_desc pxa168_device_twsi1;
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;
17 static inline int pxa168_add_uart(int id)
19 struct pxa_device_desc *d = NULL;
21 switch (id) {
22 case 1: d = &pxa168_device_uart1; break;
23 case 2: d = &pxa168_device_uart2; break;
26 if (d == NULL)
27 return -EINVAL;
29 return pxa_register_device(d, NULL, 0);
32 static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data,
33 struct i2c_board_info *info, unsigned size)
35 struct pxa_device_desc *d = NULL;
36 int ret;
38 switch (id) {
39 case 0: d = &pxa168_device_twsi0; break;
40 case 1: d = &pxa168_device_twsi1; break;
41 default:
42 return -EINVAL;
45 ret = i2c_register_board_info(id, info, size);
46 if (ret)
47 return ret;
49 return pxa_register_device(d, data, sizeof(*data));
52 static inline int pxa168_add_pwm(int id)
54 struct pxa_device_desc *d = NULL;
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;
65 return pxa_register_device(d, NULL, 0);
67 #endif /* __ASM_MACH_PXA168_H */