Merge tag 'imx-eukrea' of git://git.pengutronix.de/git/imx/linux-2.6 into next/boards
[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
2728701d
EM
4struct sys_timer;
5
6extern struct sys_timer pxa168_timer;
7extern void __init pxa168_init_irq(void);
9854a38e 8extern void pxa168_restart(char, const char *);
ab5739a1 9extern void pxa168_clear_keypad_wakeup(void);
2728701d 10
1a77920e 11#include <linux/i2c.h>
b459396e 12#include <linux/i2c/pxa-i2c.h>
49cbe786 13#include <mach/devices.h>
a0f266c1 14#include <plat/pxa3xx_nand.h>
58cf68b8 15#include <video/pxa168fb.h>
6d109465 16#include <plat/pxa27x_keypad.h>
ab5739a1 17#include <mach/cputype.h>
80def0dc 18#include <linux/pxa168_eth.h>
161105bc 19#include <linux/platform_data/mv_usb.h>
49cbe786
EM
20
21extern struct pxa_device_desc pxa168_device_uart1;
22extern struct pxa_device_desc pxa168_device_uart2;
26407f81 23extern struct pxa_device_desc pxa168_device_uart3;
1a77920e
EM
24extern struct pxa_device_desc pxa168_device_twsi0;
25extern struct pxa_device_desc pxa168_device_twsi1;
a27ba768
EM
26extern struct pxa_device_desc pxa168_device_pwm1;
27extern struct pxa_device_desc pxa168_device_pwm2;
28extern struct pxa_device_desc pxa168_device_pwm3;
29extern struct pxa_device_desc pxa168_device_pwm4;
7e499228
HZ
30extern struct pxa_device_desc pxa168_device_ssp1;
31extern struct pxa_device_desc pxa168_device_ssp2;
32extern struct pxa_device_desc pxa168_device_ssp3;
33extern struct pxa_device_desc pxa168_device_ssp4;
34extern struct pxa_device_desc pxa168_device_ssp5;
a0f266c1 35extern struct pxa_device_desc pxa168_device_nand;
58cf68b8 36extern struct pxa_device_desc pxa168_device_fb;
6d109465 37extern struct pxa_device_desc pxa168_device_keypad;
80def0dc 38extern struct pxa_device_desc pxa168_device_eth;
49cbe786 39
3abd7f68 40/* pdata can be NULL */
161105bc
NZ
41extern int __init pxa168_add_usb_host(struct mv_usb_platform_data *pdata);
42
3abd7f68 43
157d2644
HZ
44extern struct platform_device pxa168_device_gpio;
45
49cbe786
EM
46static inline int pxa168_add_uart(int id)
47{
48 struct pxa_device_desc *d = NULL;
49
50 switch (id) {
51 case 1: d = &pxa168_device_uart1; break;
52 case 2: d = &pxa168_device_uart2; break;
26407f81 53 case 3: d = &pxa168_device_uart3; break;
49cbe786
EM
54 }
55
56 if (d == NULL)
57 return -EINVAL;
58
59 return pxa_register_device(d, NULL, 0);
60}
1a77920e
EM
61
62static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data,
63 struct i2c_board_info *info, unsigned size)
64{
65 struct pxa_device_desc *d = NULL;
66 int ret;
67
68 switch (id) {
69 case 0: d = &pxa168_device_twsi0; break;
70 case 1: d = &pxa168_device_twsi1; break;
71 default:
72 return -EINVAL;
73 }
74
75 ret = i2c_register_board_info(id, info, size);
76 if (ret)
77 return ret;
78
79 return pxa_register_device(d, data, sizeof(*data));
80}
a27ba768
EM
81
82static inline int pxa168_add_pwm(int id)
83{
84 struct pxa_device_desc *d = NULL;
85
86 switch (id) {
87 case 1: d = &pxa168_device_pwm1; break;
88 case 2: d = &pxa168_device_pwm2; break;
89 case 3: d = &pxa168_device_pwm3; break;
90 case 4: d = &pxa168_device_pwm4; break;
91 default:
92 return -EINVAL;
93 }
94
95 return pxa_register_device(d, NULL, 0);
96}
a0f266c1 97
7e499228
HZ
98static inline int pxa168_add_ssp(int id)
99{
100 struct pxa_device_desc *d = NULL;
101
102 switch (id) {
103 case 1: d = &pxa168_device_ssp1; break;
104 case 2: d = &pxa168_device_ssp2; break;
105 case 3: d = &pxa168_device_ssp3; break;
106 case 4: d = &pxa168_device_ssp4; break;
107 case 5: d = &pxa168_device_ssp5; break;
108 default:
109 return -EINVAL;
110 }
111 return pxa_register_device(d, NULL, 0);
112}
113
a0f266c1
HZ
114static inline int pxa168_add_nand(struct pxa3xx_nand_platform_data *info)
115{
116 return pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
117}
58cf68b8
MB
118
119static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
120{
121 return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
122}
123
6d109465
MB
124static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *data)
125{
ab5739a1
MB
126 if (cpu_is_pxa168())
127 data->clear_wakeup_event = pxa168_clear_keypad_wakeup;
128
6d109465
MB
129 return pxa_register_device(&pxa168_device_keypad, data, sizeof(*data));
130}
131
80def0dc
TU
132static inline int pxa168_add_eth(struct pxa168_eth_platform_data *data)
133{
134 return pxa_register_device(&pxa168_device_eth, data, sizeof(*data));
135}
49cbe786 136#endif /* __ASM_MACH_PXA168_H */