ARM: pxa2xx: reorganize I2C files
[linux-2.6/libata-dev.git] / arch / arm / mach-mmp / include / mach / mmp2.h
blob2cbf6df09b82851ae7117c69279994723c41ec9f
1 #ifndef __ASM_MACH_MMP2_H
2 #define __ASM_MACH_MMP2_H
4 #include <plat/sdhci.h>
6 struct sys_timer;
8 extern struct sys_timer mmp2_timer;
9 extern void __init mmp2_init_icu(void);
10 extern void __init mmp2_init_irq(void);
11 extern void mmp2_clear_pmic_int(void);
13 #include <linux/i2c.h>
14 #include <linux/i2c/pxa-i2c.h>
15 #include <mach/devices.h>
17 extern struct pxa_device_desc mmp2_device_uart1;
18 extern struct pxa_device_desc mmp2_device_uart2;
19 extern struct pxa_device_desc mmp2_device_uart3;
20 extern struct pxa_device_desc mmp2_device_uart4;
21 extern struct pxa_device_desc mmp2_device_twsi1;
22 extern struct pxa_device_desc mmp2_device_twsi2;
23 extern struct pxa_device_desc mmp2_device_twsi3;
24 extern struct pxa_device_desc mmp2_device_twsi4;
25 extern struct pxa_device_desc mmp2_device_twsi5;
26 extern struct pxa_device_desc mmp2_device_twsi6;
27 extern struct pxa_device_desc mmp2_device_sdh0;
28 extern struct pxa_device_desc mmp2_device_sdh1;
29 extern struct pxa_device_desc mmp2_device_sdh2;
30 extern struct pxa_device_desc mmp2_device_sdh3;
32 static inline int mmp2_add_uart(int id)
34 struct pxa_device_desc *d = NULL;
36 switch (id) {
37 case 1: d = &mmp2_device_uart1; break;
38 case 2: d = &mmp2_device_uart2; break;
39 case 3: d = &mmp2_device_uart3; break;
40 case 4: d = &mmp2_device_uart4; break;
41 default:
42 return -EINVAL;
45 return pxa_register_device(d, NULL, 0);
48 static inline int mmp2_add_twsi(int id, struct i2c_pxa_platform_data *data,
49 struct i2c_board_info *info, unsigned size)
51 struct pxa_device_desc *d = NULL;
52 int ret;
54 switch (id) {
55 case 1: d = &mmp2_device_twsi1; break;
56 case 2: d = &mmp2_device_twsi2; break;
57 case 3: d = &mmp2_device_twsi3; break;
58 case 4: d = &mmp2_device_twsi4; break;
59 case 5: d = &mmp2_device_twsi5; break;
60 case 6: d = &mmp2_device_twsi6; break;
61 default:
62 return -EINVAL;
65 ret = i2c_register_board_info(id - 1, info, size);
66 if (ret)
67 return ret;
69 return pxa_register_device(d, data, sizeof(*data));
72 static inline int mmp2_add_sdhost(int id, struct sdhci_pxa_platdata *data)
74 struct pxa_device_desc *d = NULL;
76 switch (id) {
77 case 0: d = &mmp2_device_sdh0; break;
78 case 1: d = &mmp2_device_sdh1; break;
79 case 2: d = &mmp2_device_sdh2; break;
80 case 3: d = &mmp2_device_sdh3; break;
81 default:
82 return -EINVAL;
85 return pxa_register_device(d, data, sizeof(*data));
88 #endif /* __ASM_MACH_MMP2_H */