Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 1 | #ifndef __ASM_MACH_PXA168_H |
| 2 | #define __ASM_MACH_PXA168_H |
| 3 | |
Eric Miao | 1a77920 | 2009-04-13 15:34:54 +0800 | [diff] [blame] | 4 | #include <linux/i2c.h> |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 5 | #include <mach/devices.h> |
Eric Miao | 1a77920 | 2009-04-13 15:34:54 +0800 | [diff] [blame] | 6 | #include <plat/i2c.h> |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 7 | |
| 8 | extern struct pxa_device_desc pxa168_device_uart1; |
| 9 | extern struct pxa_device_desc pxa168_device_uart2; |
Eric Miao | 1a77920 | 2009-04-13 15:34:54 +0800 | [diff] [blame] | 10 | extern struct pxa_device_desc pxa168_device_twsi0; |
| 11 | extern struct pxa_device_desc pxa168_device_twsi1; |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 12 | |
| 13 | static 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 Miao | 1a77920 | 2009-04-13 15:34:54 +0800 | [diff] [blame] | 27 | |
| 28 | static 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 Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 47 | #endif /* __ASM_MACH_PXA168_H */ |