blob: 91be75591398baf9427a892864316101284dc7cf [file] [log] [blame]
Eric Miao14c6b5e2009-03-20 12:50:22 +08001#ifndef __ASM_MACH_PXA910_H
2#define __ASM_MACH_PXA910_H
3
Eric Miao27287012010-07-15 22:22:33 +08004struct sys_timer;
5
6extern struct sys_timer pxa910_timer;
7extern void __init pxa910_init_irq(void);
8
Eric Miao1a779202009-04-13 15:34:54 +08009#include <linux/i2c.h>
Sebastian Andrzej Siewiorb4593962011-02-23 12:38:16 +010010#include <linux/i2c/pxa-i2c.h>
Eric Miao14c6b5e2009-03-20 12:50:22 +080011#include <mach/devices.h>
Haojian Zhuanga0f266c2009-10-13 15:24:55 +080012#include <plat/pxa3xx_nand.h>
Eric Miao14c6b5e2009-03-20 12:50:22 +080013
14extern struct pxa_device_desc pxa910_device_uart1;
15extern struct pxa_device_desc pxa910_device_uart2;
Eric Miao1a779202009-04-13 15:34:54 +080016extern struct pxa_device_desc pxa910_device_twsi0;
17extern struct pxa_device_desc pxa910_device_twsi1;
Eric Miaoa27ba762009-04-13 18:29:52 +080018extern struct pxa_device_desc pxa910_device_pwm1;
19extern struct pxa_device_desc pxa910_device_pwm2;
20extern struct pxa_device_desc pxa910_device_pwm3;
21extern struct pxa_device_desc pxa910_device_pwm4;
Haojian Zhuanga0f266c2009-10-13 15:24:55 +080022extern struct pxa_device_desc pxa910_device_nand;
Eric Miao14c6b5e2009-03-20 12:50:22 +080023
24static inline int pxa910_add_uart(int id)
25{
26 struct pxa_device_desc *d = NULL;
27
28 switch (id) {
29 case 1: d = &pxa910_device_uart1; break;
30 case 2: d = &pxa910_device_uart2; break;
31 }
32
33 if (d == NULL)
34 return -EINVAL;
35
36 return pxa_register_device(d, NULL, 0);
37}
Eric Miao1a779202009-04-13 15:34:54 +080038
39static inline int pxa910_add_twsi(int id, struct i2c_pxa_platform_data *data,
40 struct i2c_board_info *info, unsigned size)
41{
42 struct pxa_device_desc *d = NULL;
43 int ret;
44
45 switch (id) {
46 case 0: d = &pxa910_device_twsi0; break;
47 case 1: d = &pxa910_device_twsi1; break;
48 default:
49 return -EINVAL;
50 }
51
52 ret = i2c_register_board_info(id, info, size);
53 if (ret)
54 return ret;
55
56 return pxa_register_device(d, data, sizeof(*data));
57}
Eric Miaoa27ba762009-04-13 18:29:52 +080058
59static inline int pxa910_add_pwm(int id)
60{
61 struct pxa_device_desc *d = NULL;
62
63 switch (id) {
64 case 1: d = &pxa910_device_pwm1; break;
65 case 2: d = &pxa910_device_pwm2; break;
66 case 3: d = &pxa910_device_pwm3; break;
67 case 4: d = &pxa910_device_pwm4; break;
68 default:
69 return -EINVAL;
70 }
71
72 return pxa_register_device(d, NULL, 0);
73}
Haojian Zhuanga0f266c2009-10-13 15:24:55 +080074
75static inline int pxa910_add_nand(struct pxa3xx_nand_platform_data *info)
76{
77 return pxa_register_device(&pxa910_device_nand, info, sizeof(*info));
78}
Eric Miao14c6b5e2009-03-20 12:50:22 +080079#endif /* __ASM_MACH_PXA910_H */