1 #ifndef __ASM_MACH_PXA910_H
2 #define __ASM_MACH_PXA910_H
3 
4 struct sys_timer;
5 
6 extern struct sys_timer pxa910_timer;
7 extern void __init pxa910_init_irq(void);
8 
9 #include <linux/i2c.h>
10 #include <linux/i2c/pxa-i2c.h>
11 #include <mach/devices.h>
12 #include <plat/pxa3xx_nand.h>
13 
14 extern struct pxa_device_desc pxa910_device_uart1;
15 extern struct pxa_device_desc pxa910_device_uart2;
16 extern struct pxa_device_desc pxa910_device_twsi0;
17 extern struct pxa_device_desc pxa910_device_twsi1;
18 extern struct pxa_device_desc pxa910_device_pwm1;
19 extern struct pxa_device_desc pxa910_device_pwm2;
20 extern struct pxa_device_desc pxa910_device_pwm3;
21 extern struct pxa_device_desc pxa910_device_pwm4;
22 extern struct pxa_device_desc pxa910_device_nand;
23 
24 extern struct platform_device pxa910_device_gpio;
25 
pxa910_add_uart(int id)26 static inline int pxa910_add_uart(int id)
27 {
28 	struct pxa_device_desc *d = NULL;
29 
30 	switch (id) {
31 	case 1: d = &pxa910_device_uart1; break;
32 	case 2: d = &pxa910_device_uart2; break;
33 	}
34 
35 	if (d == NULL)
36 		return -EINVAL;
37 
38 	return pxa_register_device(d, NULL, 0);
39 }
40 
pxa910_add_twsi(int id,struct i2c_pxa_platform_data * data,struct i2c_board_info * info,unsigned size)41 static inline int pxa910_add_twsi(int id, struct i2c_pxa_platform_data *data,
42 				  struct i2c_board_info *info, unsigned size)
43 {
44 	struct pxa_device_desc *d = NULL;
45 	int ret;
46 
47 	switch (id) {
48 	case 0: d = &pxa910_device_twsi0; break;
49 	case 1: d = &pxa910_device_twsi1; break;
50 	default:
51 		return -EINVAL;
52 	}
53 
54 	ret = i2c_register_board_info(id, info, size);
55 	if (ret)
56 		return ret;
57 
58 	return pxa_register_device(d, data, sizeof(*data));
59 }
60 
pxa910_add_pwm(int id)61 static inline int pxa910_add_pwm(int id)
62 {
63 	struct pxa_device_desc *d = NULL;
64 
65 	switch (id) {
66 	case 1: d = &pxa910_device_pwm1; break;
67 	case 2: d = &pxa910_device_pwm2; break;
68 	case 3: d = &pxa910_device_pwm3; break;
69 	case 4: d = &pxa910_device_pwm4; break;
70 	default:
71 		return -EINVAL;
72 	}
73 
74 	return pxa_register_device(d, NULL, 0);
75 }
76 
pxa910_add_nand(struct pxa3xx_nand_platform_data * info)77 static inline int pxa910_add_nand(struct pxa3xx_nand_platform_data *info)
78 {
79 	return pxa_register_device(&pxa910_device_nand, info, sizeof(*info));
80 }
81 #endif /* __ASM_MACH_PXA910_H */
82