blob: 4f0b4ec6f5d0530f158799254271b5e0601dd9a2 [file] [log] [blame]
Eric Miao14c6b5e2009-03-20 12:50:22 +08001#ifndef __ASM_MACH_PXA910_H
2#define __ASM_MACH_PXA910_H
3
Eric Miao1a779202009-04-13 15:34:54 +08004#include <linux/i2c.h>
Eric Miao14c6b5e2009-03-20 12:50:22 +08005#include <mach/devices.h>
Eric Miao1a779202009-04-13 15:34:54 +08006#include <plat/i2c.h>
Haojian Zhuanga0f266c2009-10-13 15:24:55 +08007#include <plat/pxa3xx_nand.h>
Eric Miao14c6b5e2009-03-20 12:50:22 +08008
9extern struct pxa_device_desc pxa910_device_uart1;
10extern struct pxa_device_desc pxa910_device_uart2;
Eric Miao1a779202009-04-13 15:34:54 +080011extern struct pxa_device_desc pxa910_device_twsi0;
12extern struct pxa_device_desc pxa910_device_twsi1;
Eric Miaoa27ba762009-04-13 18:29:52 +080013extern struct pxa_device_desc pxa910_device_pwm1;
14extern struct pxa_device_desc pxa910_device_pwm2;
15extern struct pxa_device_desc pxa910_device_pwm3;
16extern struct pxa_device_desc pxa910_device_pwm4;
Haojian Zhuanga0f266c2009-10-13 15:24:55 +080017extern struct pxa_device_desc pxa910_device_nand;
Eric Miao14c6b5e2009-03-20 12:50:22 +080018
19static inline int pxa910_add_uart(int id)
20{
21 struct pxa_device_desc *d = NULL;
22
23 switch (id) {
24 case 1: d = &pxa910_device_uart1; break;
25 case 2: d = &pxa910_device_uart2; break;
26 }
27
28 if (d == NULL)
29 return -EINVAL;
30
31 return pxa_register_device(d, NULL, 0);
32}
Eric Miao1a779202009-04-13 15:34:54 +080033
34static inline int pxa910_add_twsi(int id, struct i2c_pxa_platform_data *data,
35 struct i2c_board_info *info, unsigned size)
36{
37 struct pxa_device_desc *d = NULL;
38 int ret;
39
40 switch (id) {
41 case 0: d = &pxa910_device_twsi0; break;
42 case 1: d = &pxa910_device_twsi1; break;
43 default:
44 return -EINVAL;
45 }
46
47 ret = i2c_register_board_info(id, info, size);
48 if (ret)
49 return ret;
50
51 return pxa_register_device(d, data, sizeof(*data));
52}
Eric Miaoa27ba762009-04-13 18:29:52 +080053
54static inline int pxa910_add_pwm(int id)
55{
56 struct pxa_device_desc *d = NULL;
57
58 switch (id) {
59 case 1: d = &pxa910_device_pwm1; break;
60 case 2: d = &pxa910_device_pwm2; break;
61 case 3: d = &pxa910_device_pwm3; break;
62 case 4: d = &pxa910_device_pwm4; break;
63 default:
64 return -EINVAL;
65 }
66
67 return pxa_register_device(d, NULL, 0);
68}
Haojian Zhuanga0f266c2009-10-13 15:24:55 +080069
70static inline int pxa910_add_nand(struct pxa3xx_nand_platform_data *info)
71{
72 return pxa_register_device(&pxa910_device_nand, info, sizeof(*info));
73}
Eric Miao14c6b5e2009-03-20 12:50:22 +080074#endif /* __ASM_MACH_PXA910_H */