Eric Miao | 14c6b5e | 2009-03-20 12:50:22 +0800 | [diff] [blame] | 1 | #ifndef __ASM_MACH_PXA910_H |
| 2 | #define __ASM_MACH_PXA910_H |
| 3 | |
Eric Miao | 1a77920 | 2009-04-13 15:34:54 +0800 | [diff] [blame] | 4 | #include <linux/i2c.h> |
Eric Miao | 14c6b5e | 2009-03-20 12:50:22 +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> |
Haojian Zhuang | a0f266c | 2009-10-13 15:24:55 +0800 | [diff] [blame^] | 7 | #include <plat/pxa3xx_nand.h> |
Eric Miao | 14c6b5e | 2009-03-20 12:50:22 +0800 | [diff] [blame] | 8 | |
| 9 | extern struct pxa_device_desc pxa910_device_uart1; |
| 10 | extern struct pxa_device_desc pxa910_device_uart2; |
Eric Miao | 1a77920 | 2009-04-13 15:34:54 +0800 | [diff] [blame] | 11 | extern struct pxa_device_desc pxa910_device_twsi0; |
| 12 | extern struct pxa_device_desc pxa910_device_twsi1; |
Eric Miao | a27ba76 | 2009-04-13 18:29:52 +0800 | [diff] [blame] | 13 | extern struct pxa_device_desc pxa910_device_pwm1; |
| 14 | extern struct pxa_device_desc pxa910_device_pwm2; |
| 15 | extern struct pxa_device_desc pxa910_device_pwm3; |
| 16 | extern struct pxa_device_desc pxa910_device_pwm4; |
Haojian Zhuang | a0f266c | 2009-10-13 15:24:55 +0800 | [diff] [blame^] | 17 | extern struct pxa_device_desc pxa910_device_nand; |
Eric Miao | 14c6b5e | 2009-03-20 12:50:22 +0800 | [diff] [blame] | 18 | |
| 19 | static 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 Miao | 1a77920 | 2009-04-13 15:34:54 +0800 | [diff] [blame] | 33 | |
| 34 | static 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 Miao | a27ba76 | 2009-04-13 18:29:52 +0800 | [diff] [blame] | 53 | |
| 54 | static 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 Zhuang | a0f266c | 2009-10-13 15:24:55 +0800 | [diff] [blame^] | 69 | |
| 70 | static 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 Miao | 14c6b5e | 2009-03-20 12:50:22 +0800 | [diff] [blame] | 74 | #endif /* __ASM_MACH_PXA910_H */ |