[ARM] mmp: avoid devices.h being included multiple times
[linux-2.6-block.git] / arch / arm / mach-mmp / include / mach / pxa168.h
CommitLineData
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>
a0f266c1 7#include <plat/pxa3xx_nand.h>
49cbe786
EM
8
9extern struct pxa_device_desc pxa168_device_uart1;
10extern struct pxa_device_desc pxa168_device_uart2;
1a77920e
EM
11extern struct pxa_device_desc pxa168_device_twsi0;
12extern struct pxa_device_desc pxa168_device_twsi1;
a27ba768
EM
13extern struct pxa_device_desc pxa168_device_pwm1;
14extern struct pxa_device_desc pxa168_device_pwm2;
15extern struct pxa_device_desc pxa168_device_pwm3;
16extern struct pxa_device_desc pxa168_device_pwm4;
7e499228
HZ
17extern struct pxa_device_desc pxa168_device_ssp1;
18extern struct pxa_device_desc pxa168_device_ssp2;
19extern struct pxa_device_desc pxa168_device_ssp3;
20extern struct pxa_device_desc pxa168_device_ssp4;
21extern struct pxa_device_desc pxa168_device_ssp5;
a0f266c1 22extern struct pxa_device_desc pxa168_device_nand;
49cbe786
EM
23
24static inline int pxa168_add_uart(int id)
25{
26 struct pxa_device_desc *d = NULL;
27
28 switch (id) {
29 case 1: d = &pxa168_device_uart1; break;
30 case 2: d = &pxa168_device_uart2; break;
31 }
32
33 if (d == NULL)
34 return -EINVAL;
35
36 return pxa_register_device(d, NULL, 0);
37}
1a77920e
EM
38
39static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data,
40 struct i2c_board_info *info, unsigned size)
41{
42 struct pxa_device_desc *d = NULL;
43 int ret;
44
45 switch (id) {
46 case 0: d = &pxa168_device_twsi0; break;
47 case 1: d = &pxa168_device_twsi1; break;
48 default:
49 return -EINVAL;
50 }
51
52 ret = i2c_register_board_info(id, info, size);
53 if (ret)
54 return ret;
55
56 return pxa_register_device(d, data, sizeof(*data));
57}
a27ba768
EM
58
59static inline int pxa168_add_pwm(int id)
60{
61 struct pxa_device_desc *d = NULL;
62
63 switch (id) {
64 case 1: d = &pxa168_device_pwm1; break;
65 case 2: d = &pxa168_device_pwm2; break;
66 case 3: d = &pxa168_device_pwm3; break;
67 case 4: d = &pxa168_device_pwm4; break;
68 default:
69 return -EINVAL;
70 }
71
72 return pxa_register_device(d, NULL, 0);
73}
a0f266c1 74
7e499228
HZ
75static inline int pxa168_add_ssp(int id)
76{
77 struct pxa_device_desc *d = NULL;
78
79 switch (id) {
80 case 1: d = &pxa168_device_ssp1; break;
81 case 2: d = &pxa168_device_ssp2; break;
82 case 3: d = &pxa168_device_ssp3; break;
83 case 4: d = &pxa168_device_ssp4; break;
84 case 5: d = &pxa168_device_ssp5; break;
85 default:
86 return -EINVAL;
87 }
88 return pxa_register_device(d, NULL, 0);
89}
90
a0f266c1
HZ
91static inline int pxa168_add_nand(struct pxa3xx_nand_platform_data *info)
92{
93 return pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
94}
49cbe786 95#endif /* __ASM_MACH_PXA168_H */