Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 1 | #ifndef __ASM_MACH_MMP2_H |
| 2 | #define __ASM_MACH_MMP2_H |
| 3 | |
| 4 | #include <linux/i2c.h> |
| 5 | #include <mach/devices.h> |
| 6 | #include <plat/i2c.h> |
| 7 | |
| 8 | extern struct pxa_device_desc mmp2_device_uart1; |
| 9 | extern struct pxa_device_desc mmp2_device_uart2; |
| 10 | extern struct pxa_device_desc mmp2_device_uart3; |
| 11 | extern struct pxa_device_desc mmp2_device_uart4; |
| 12 | extern struct pxa_device_desc mmp2_device_twsi1; |
| 13 | extern struct pxa_device_desc mmp2_device_twsi2; |
| 14 | extern struct pxa_device_desc mmp2_device_twsi3; |
| 15 | extern struct pxa_device_desc mmp2_device_twsi4; |
| 16 | extern struct pxa_device_desc mmp2_device_twsi5; |
| 17 | extern struct pxa_device_desc mmp2_device_twsi6; |
| 18 | |
| 19 | static inline int mmp2_add_uart(int id) |
| 20 | { |
| 21 | struct pxa_device_desc *d = NULL; |
| 22 | |
| 23 | switch (id) { |
| 24 | case 1: d = &mmp2_device_uart1; break; |
| 25 | case 2: d = &mmp2_device_uart2; break; |
| 26 | case 3: d = &mmp2_device_uart3; break; |
| 27 | case 4: d = &mmp2_device_uart4; break; |
| 28 | default: |
| 29 | return -EINVAL; |
| 30 | } |
| 31 | |
| 32 | return pxa_register_device(d, NULL, 0); |
| 33 | } |
| 34 | |
| 35 | static inline int mmp2_add_twsi(int id, struct i2c_pxa_platform_data *data, |
| 36 | struct i2c_board_info *info, unsigned size) |
| 37 | { |
| 38 | struct pxa_device_desc *d = NULL; |
| 39 | int ret; |
| 40 | |
| 41 | switch (id) { |
Haojian Zhuang | fed2405 | 2010-04-28 15:34:04 -0400 | [diff] [blame^] | 42 | case 1: d = &mmp2_device_twsi1; break; |
| 43 | case 2: d = &mmp2_device_twsi2; break; |
| 44 | case 3: d = &mmp2_device_twsi3; break; |
| 45 | case 4: d = &mmp2_device_twsi4; break; |
| 46 | case 5: d = &mmp2_device_twsi5; break; |
| 47 | case 6: d = &mmp2_device_twsi6; break; |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 48 | default: |
| 49 | return -EINVAL; |
| 50 | } |
| 51 | |
Haojian Zhuang | fed2405 | 2010-04-28 15:34:04 -0400 | [diff] [blame^] | 52 | ret = i2c_register_board_info(id - 1, info, size); |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 53 | if (ret) |
| 54 | return ret; |
| 55 | |
| 56 | return pxa_register_device(d, data, sizeof(*data)); |
| 57 | } |
| 58 | |
| 59 | #endif /* __ASM_MACH_MMP2_H */ |
| 60 | |