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 | a27ba76 | 2009-04-13 18:29:52 +0800 | [diff] [blame^] | 12 | extern struct pxa_device_desc pxa168_device_pwm1; |
| 13 | extern struct pxa_device_desc pxa168_device_pwm2; |
| 14 | extern struct pxa_device_desc pxa168_device_pwm3; |
| 15 | extern struct pxa_device_desc pxa168_device_pwm4; |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 16 | |
| 17 | static inline int pxa168_add_uart(int id) |
| 18 | { |
| 19 | struct pxa_device_desc *d = NULL; |
| 20 | |
| 21 | switch (id) { |
| 22 | case 1: d = &pxa168_device_uart1; break; |
| 23 | case 2: d = &pxa168_device_uart2; break; |
| 24 | } |
| 25 | |
| 26 | if (d == NULL) |
| 27 | return -EINVAL; |
| 28 | |
| 29 | return pxa_register_device(d, NULL, 0); |
| 30 | } |
Eric Miao | 1a77920 | 2009-04-13 15:34:54 +0800 | [diff] [blame] | 31 | |
| 32 | static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data, |
| 33 | struct i2c_board_info *info, unsigned size) |
| 34 | { |
| 35 | struct pxa_device_desc *d = NULL; |
| 36 | int ret; |
| 37 | |
| 38 | switch (id) { |
| 39 | case 0: d = &pxa168_device_twsi0; break; |
| 40 | case 1: d = &pxa168_device_twsi1; break; |
| 41 | default: |
| 42 | return -EINVAL; |
| 43 | } |
| 44 | |
| 45 | ret = i2c_register_board_info(id, info, size); |
| 46 | if (ret) |
| 47 | return ret; |
| 48 | |
| 49 | return pxa_register_device(d, data, sizeof(*data)); |
| 50 | } |
Eric Miao | a27ba76 | 2009-04-13 18:29:52 +0800 | [diff] [blame^] | 51 | |
| 52 | static inline int pxa168_add_pwm(int id) |
| 53 | { |
| 54 | struct pxa_device_desc *d = NULL; |
| 55 | |
| 56 | switch (id) { |
| 57 | case 1: d = &pxa168_device_pwm1; break; |
| 58 | case 2: d = &pxa168_device_pwm2; break; |
| 59 | case 3: d = &pxa168_device_pwm3; break; |
| 60 | case 4: d = &pxa168_device_pwm4; break; |
| 61 | default: |
| 62 | return -EINVAL; |
| 63 | } |
| 64 | |
| 65 | return pxa_register_device(d, NULL, 0); |
| 66 | } |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 67 | #endif /* __ASM_MACH_PXA168_H */ |