Linux 3.11-rc3
[cris-mirror.git] / arch / arm / mach-mmp / include / mach / pxa168.h
blob459c2d03eb5c26ab34e06981b55f0b75bf8451ae
1 #ifndef __ASM_MACH_PXA168_H
2 #define __ASM_MACH_PXA168_H
4 #include <linux/reboot.h>
6 extern void pxa168_timer_init(void);
7 extern void __init pxa168_init_irq(void);
8 extern void pxa168_restart(enum reboot_mode, const char *);
9 extern void pxa168_clear_keypad_wakeup(void);
11 #include <linux/i2c.h>
12 #include <linux/i2c/pxa-i2c.h>
13 #include <mach/devices.h>
14 #include <linux/platform_data/mtd-nand-pxa3xx.h>
15 #include <video/pxa168fb.h>
16 #include <linux/platform_data/keypad-pxa27x.h>
17 #include <mach/cputype.h>
18 #include <linux/pxa168_eth.h>
19 #include <linux/platform_data/mv_usb.h>
21 extern struct pxa_device_desc pxa168_device_uart1;
22 extern struct pxa_device_desc pxa168_device_uart2;
23 extern struct pxa_device_desc pxa168_device_uart3;
24 extern struct pxa_device_desc pxa168_device_twsi0;
25 extern struct pxa_device_desc pxa168_device_twsi1;
26 extern struct pxa_device_desc pxa168_device_pwm1;
27 extern struct pxa_device_desc pxa168_device_pwm2;
28 extern struct pxa_device_desc pxa168_device_pwm3;
29 extern struct pxa_device_desc pxa168_device_pwm4;
30 extern struct pxa_device_desc pxa168_device_ssp1;
31 extern struct pxa_device_desc pxa168_device_ssp2;
32 extern struct pxa_device_desc pxa168_device_ssp3;
33 extern struct pxa_device_desc pxa168_device_ssp4;
34 extern struct pxa_device_desc pxa168_device_ssp5;
35 extern struct pxa_device_desc pxa168_device_nand;
36 extern struct pxa_device_desc pxa168_device_fb;
37 extern struct pxa_device_desc pxa168_device_keypad;
38 extern struct pxa_device_desc pxa168_device_eth;
40 /* pdata can be NULL */
41 extern int __init pxa168_add_usb_host(struct mv_usb_platform_data *pdata);
44 extern struct platform_device pxa168_device_gpio;
46 static inline int pxa168_add_uart(int id)
48 struct pxa_device_desc *d = NULL;
50 switch (id) {
51 case 1: d = &pxa168_device_uart1; break;
52 case 2: d = &pxa168_device_uart2; break;
53 case 3: d = &pxa168_device_uart3; break;
56 if (d == NULL)
57 return -EINVAL;
59 return pxa_register_device(d, NULL, 0);
62 static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data,
63 struct i2c_board_info *info, unsigned size)
65 struct pxa_device_desc *d = NULL;
66 int ret;
68 switch (id) {
69 case 0: d = &pxa168_device_twsi0; break;
70 case 1: d = &pxa168_device_twsi1; break;
71 default:
72 return -EINVAL;
75 ret = i2c_register_board_info(id, info, size);
76 if (ret)
77 return ret;
79 return pxa_register_device(d, data, sizeof(*data));
82 static inline int pxa168_add_pwm(int id)
84 struct pxa_device_desc *d = NULL;
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;
95 return pxa_register_device(d, NULL, 0);
98 static inline int pxa168_add_ssp(int id)
100 struct pxa_device_desc *d = NULL;
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;
111 return pxa_register_device(d, NULL, 0);
114 static inline int pxa168_add_nand(struct pxa3xx_nand_platform_data *info)
116 return pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
119 static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
121 return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
124 static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *data)
126 if (cpu_is_pxa168())
127 data->clear_wakeup_event = pxa168_clear_keypad_wakeup;
129 return pxa_register_device(&pxa168_device_keypad, data, sizeof(*data));
132 static inline int pxa168_add_eth(struct pxa168_eth_platform_data *data)
134 return pxa_register_device(&pxa168_device_eth, data, sizeof(*data));
136 #endif /* __ASM_MACH_PXA168_H */