Commit | Line | Data |
---|---|---|
49cbe786 EM |
1 | #ifndef __ASM_MACH_PXA168_H |
2 | #define __ASM_MACH_PXA168_H | |
3 | ||
2728701d EM |
4 | struct sys_timer; |
5 | ||
6 | extern struct sys_timer pxa168_timer; | |
7 | extern void __init pxa168_init_irq(void); | |
8 | ||
1a77920e | 9 | #include <linux/i2c.h> |
49cbe786 | 10 | #include <mach/devices.h> |
1a77920e | 11 | #include <plat/i2c.h> |
a0f266c1 | 12 | #include <plat/pxa3xx_nand.h> |
58cf68b8 | 13 | #include <video/pxa168fb.h> |
6d109465 | 14 | #include <plat/pxa27x_keypad.h> |
49cbe786 EM |
15 | |
16 | extern struct pxa_device_desc pxa168_device_uart1; | |
17 | extern struct pxa_device_desc pxa168_device_uart2; | |
1a77920e EM |
18 | extern struct pxa_device_desc pxa168_device_twsi0; |
19 | extern struct pxa_device_desc pxa168_device_twsi1; | |
a27ba768 EM |
20 | extern struct pxa_device_desc pxa168_device_pwm1; |
21 | extern struct pxa_device_desc pxa168_device_pwm2; | |
22 | extern struct pxa_device_desc pxa168_device_pwm3; | |
23 | extern struct pxa_device_desc pxa168_device_pwm4; | |
7e499228 HZ |
24 | extern struct pxa_device_desc pxa168_device_ssp1; |
25 | extern struct pxa_device_desc pxa168_device_ssp2; | |
26 | extern struct pxa_device_desc pxa168_device_ssp3; | |
27 | extern struct pxa_device_desc pxa168_device_ssp4; | |
28 | extern struct pxa_device_desc pxa168_device_ssp5; | |
a0f266c1 | 29 | extern struct pxa_device_desc pxa168_device_nand; |
58cf68b8 | 30 | extern struct pxa_device_desc pxa168_device_fb; |
6d109465 | 31 | extern struct pxa_device_desc pxa168_device_keypad; |
49cbe786 EM |
32 | |
33 | static inline int pxa168_add_uart(int id) | |
34 | { | |
35 | struct pxa_device_desc *d = NULL; | |
36 | ||
37 | switch (id) { | |
38 | case 1: d = &pxa168_device_uart1; break; | |
39 | case 2: d = &pxa168_device_uart2; break; | |
40 | } | |
41 | ||
42 | if (d == NULL) | |
43 | return -EINVAL; | |
44 | ||
45 | return pxa_register_device(d, NULL, 0); | |
46 | } | |
1a77920e EM |
47 | |
48 | static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data, | |
49 | struct i2c_board_info *info, unsigned size) | |
50 | { | |
51 | struct pxa_device_desc *d = NULL; | |
52 | int ret; | |
53 | ||
54 | switch (id) { | |
55 | case 0: d = &pxa168_device_twsi0; break; | |
56 | case 1: d = &pxa168_device_twsi1; break; | |
57 | default: | |
58 | return -EINVAL; | |
59 | } | |
60 | ||
61 | ret = i2c_register_board_info(id, info, size); | |
62 | if (ret) | |
63 | return ret; | |
64 | ||
65 | return pxa_register_device(d, data, sizeof(*data)); | |
66 | } | |
a27ba768 EM |
67 | |
68 | static inline int pxa168_add_pwm(int id) | |
69 | { | |
70 | struct pxa_device_desc *d = NULL; | |
71 | ||
72 | switch (id) { | |
73 | case 1: d = &pxa168_device_pwm1; break; | |
74 | case 2: d = &pxa168_device_pwm2; break; | |
75 | case 3: d = &pxa168_device_pwm3; break; | |
76 | case 4: d = &pxa168_device_pwm4; break; | |
77 | default: | |
78 | return -EINVAL; | |
79 | } | |
80 | ||
81 | return pxa_register_device(d, NULL, 0); | |
82 | } | |
a0f266c1 | 83 | |
7e499228 HZ |
84 | static inline int pxa168_add_ssp(int id) |
85 | { | |
86 | struct pxa_device_desc *d = NULL; | |
87 | ||
88 | switch (id) { | |
89 | case 1: d = &pxa168_device_ssp1; break; | |
90 | case 2: d = &pxa168_device_ssp2; break; | |
91 | case 3: d = &pxa168_device_ssp3; break; | |
92 | case 4: d = &pxa168_device_ssp4; break; | |
93 | case 5: d = &pxa168_device_ssp5; break; | |
94 | default: | |
95 | return -EINVAL; | |
96 | } | |
97 | return pxa_register_device(d, NULL, 0); | |
98 | } | |
99 | ||
a0f266c1 HZ |
100 | static inline int pxa168_add_nand(struct pxa3xx_nand_platform_data *info) |
101 | { | |
102 | return pxa_register_device(&pxa168_device_nand, info, sizeof(*info)); | |
103 | } | |
58cf68b8 MB |
104 | |
105 | static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi) | |
106 | { | |
107 | return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi)); | |
108 | } | |
109 | ||
6d109465 MB |
110 | static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *data) |
111 | { | |
112 | return pxa_register_device(&pxa168_device_keypad, data, sizeof(*data)); | |
113 | } | |
114 | ||
49cbe786 | 115 | #endif /* __ASM_MACH_PXA168_H */ |