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