Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
[pandora-kernel.git] / arch / arm / mach-mmp / include / mach / mmp2.h
1 #ifndef __ASM_MACH_MMP2_H
2 #define __ASM_MACH_MMP2_H
3
4 struct sys_timer;
5
6 extern struct sys_timer mmp2_timer;
7 extern void __init mmp2_init_icu(void);
8 extern void __init mmp2_init_irq(void);
9 extern void mmp2_clear_pmic_int(void);
10
11 #include <linux/i2c.h>
12 #include <mach/devices.h>
13 #include <plat/i2c.h>
14
15 extern struct pxa_device_desc mmp2_device_uart1;
16 extern struct pxa_device_desc mmp2_device_uart2;
17 extern struct pxa_device_desc mmp2_device_uart3;
18 extern struct pxa_device_desc mmp2_device_uart4;
19 extern struct pxa_device_desc mmp2_device_twsi1;
20 extern struct pxa_device_desc mmp2_device_twsi2;
21 extern struct pxa_device_desc mmp2_device_twsi3;
22 extern struct pxa_device_desc mmp2_device_twsi4;
23 extern struct pxa_device_desc mmp2_device_twsi5;
24 extern struct pxa_device_desc mmp2_device_twsi6;
25
26 static inline int mmp2_add_uart(int id)
27 {
28         struct pxa_device_desc *d = NULL;
29
30         switch (id) {
31         case 1: d = &mmp2_device_uart1; break;
32         case 2: d = &mmp2_device_uart2; break;
33         case 3: d = &mmp2_device_uart3; break;
34         case 4: d = &mmp2_device_uart4; break;
35         default:
36                 return -EINVAL;
37         }
38
39         return pxa_register_device(d, NULL, 0);
40 }
41
42 static inline int mmp2_add_twsi(int id, struct i2c_pxa_platform_data *data,
43                                   struct i2c_board_info *info, unsigned size)
44 {
45         struct pxa_device_desc *d = NULL;
46         int ret;
47
48         switch (id) {
49         case 1: d = &mmp2_device_twsi1; break;
50         case 2: d = &mmp2_device_twsi2; break;
51         case 3: d = &mmp2_device_twsi3; break;
52         case 4: d = &mmp2_device_twsi4; break;
53         case 5: d = &mmp2_device_twsi5; break;
54         case 6: d = &mmp2_device_twsi6; break;
55         default:
56                 return -EINVAL;
57         }
58
59         ret = i2c_register_board_info(id - 1, info, size);
60         if (ret)
61                 return ret;
62
63         return pxa_register_device(d, data, sizeof(*data));
64 }
65
66 #endif /* __ASM_MACH_MMP2_H */
67