blob: bfdd6299dff5c1e3ef3ae8a13ee952221c28c7b1 [file] [log] [blame]
Eric Miao49cbe782009-01-20 14:15:18 +08001#ifndef __ASM_MACH_PXA168_H
2#define __ASM_MACH_PXA168_H
3
Eric Miao1a779202009-04-13 15:34:54 +08004#include <linux/i2c.h>
Eric Miao49cbe782009-01-20 14:15:18 +08005#include <mach/devices.h>
Eric Miao1a779202009-04-13 15:34:54 +08006#include <plat/i2c.h>
Eric Miao49cbe782009-01-20 14:15:18 +08007
8extern struct pxa_device_desc pxa168_device_uart1;
9extern struct pxa_device_desc pxa168_device_uart2;
Eric Miao1a779202009-04-13 15:34:54 +080010extern struct pxa_device_desc pxa168_device_twsi0;
11extern struct pxa_device_desc pxa168_device_twsi1;
Eric Miao49cbe782009-01-20 14:15:18 +080012
13static inline int pxa168_add_uart(int id)
14{
15 struct pxa_device_desc *d = NULL;
16
17 switch (id) {
18 case 1: d = &pxa168_device_uart1; break;
19 case 2: d = &pxa168_device_uart2; break;
20 }
21
22 if (d == NULL)
23 return -EINVAL;
24
25 return pxa_register_device(d, NULL, 0);
26}
Eric Miao1a779202009-04-13 15:34:54 +080027
28static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data,
29 struct i2c_board_info *info, unsigned size)
30{
31 struct pxa_device_desc *d = NULL;
32 int ret;
33
34 switch (id) {
35 case 0: d = &pxa168_device_twsi0; break;
36 case 1: d = &pxa168_device_twsi1; break;
37 default:
38 return -EINVAL;
39 }
40
41 ret = i2c_register_board_info(id, info, size);
42 if (ret)
43 return ret;
44
45 return pxa_register_device(d, data, sizeof(*data));
46}
Eric Miao49cbe782009-01-20 14:15:18 +080047#endif /* __ASM_MACH_PXA168_H */