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 | 2728701 | 2010-07-15 22:22:33 +0800 | [diff] [blame^] | 4 | struct sys_timer; |
| 5 | |
| 6 | extern struct sys_timer pxa168_timer; |
| 7 | extern void __init pxa168_init_irq(void); |
| 8 | |
Eric Miao | 1a77920 | 2009-04-13 15:34:54 +0800 | [diff] [blame] | 9 | #include <linux/i2c.h> |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 10 | #include <mach/devices.h> |
Eric Miao | 1a77920 | 2009-04-13 15:34:54 +0800 | [diff] [blame] | 11 | #include <plat/i2c.h> |
Haojian Zhuang | a0f266c | 2009-10-13 15:24:55 +0800 | [diff] [blame] | 12 | #include <plat/pxa3xx_nand.h> |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 13 | |
| 14 | extern struct pxa_device_desc pxa168_device_uart1; |
| 15 | extern struct pxa_device_desc pxa168_device_uart2; |
Eric Miao | 1a77920 | 2009-04-13 15:34:54 +0800 | [diff] [blame] | 16 | extern struct pxa_device_desc pxa168_device_twsi0; |
| 17 | extern struct pxa_device_desc pxa168_device_twsi1; |
Eric Miao | a27ba76 | 2009-04-13 18:29:52 +0800 | [diff] [blame] | 18 | extern struct pxa_device_desc pxa168_device_pwm1; |
| 19 | extern struct pxa_device_desc pxa168_device_pwm2; |
| 20 | extern struct pxa_device_desc pxa168_device_pwm3; |
| 21 | extern struct pxa_device_desc pxa168_device_pwm4; |
Haojian Zhuang | 7e49922 | 2010-03-19 11:53:17 -0400 | [diff] [blame] | 22 | extern struct pxa_device_desc pxa168_device_ssp1; |
| 23 | extern struct pxa_device_desc pxa168_device_ssp2; |
| 24 | extern struct pxa_device_desc pxa168_device_ssp3; |
| 25 | extern struct pxa_device_desc pxa168_device_ssp4; |
| 26 | extern struct pxa_device_desc pxa168_device_ssp5; |
Haojian Zhuang | a0f266c | 2009-10-13 15:24:55 +0800 | [diff] [blame] | 27 | extern struct pxa_device_desc pxa168_device_nand; |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 28 | |
| 29 | static inline int pxa168_add_uart(int id) |
| 30 | { |
| 31 | struct pxa_device_desc *d = NULL; |
| 32 | |
| 33 | switch (id) { |
| 34 | case 1: d = &pxa168_device_uart1; break; |
| 35 | case 2: d = &pxa168_device_uart2; break; |
| 36 | } |
| 37 | |
| 38 | if (d == NULL) |
| 39 | return -EINVAL; |
| 40 | |
| 41 | return pxa_register_device(d, NULL, 0); |
| 42 | } |
Eric Miao | 1a77920 | 2009-04-13 15:34:54 +0800 | [diff] [blame] | 43 | |
| 44 | static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data, |
| 45 | struct i2c_board_info *info, unsigned size) |
| 46 | { |
| 47 | struct pxa_device_desc *d = NULL; |
| 48 | int ret; |
| 49 | |
| 50 | switch (id) { |
| 51 | case 0: d = &pxa168_device_twsi0; break; |
| 52 | case 1: d = &pxa168_device_twsi1; break; |
| 53 | default: |
| 54 | return -EINVAL; |
| 55 | } |
| 56 | |
| 57 | ret = i2c_register_board_info(id, info, size); |
| 58 | if (ret) |
| 59 | return ret; |
| 60 | |
| 61 | return pxa_register_device(d, data, sizeof(*data)); |
| 62 | } |
Eric Miao | a27ba76 | 2009-04-13 18:29:52 +0800 | [diff] [blame] | 63 | |
| 64 | static inline int pxa168_add_pwm(int id) |
| 65 | { |
| 66 | struct pxa_device_desc *d = NULL; |
| 67 | |
| 68 | switch (id) { |
| 69 | case 1: d = &pxa168_device_pwm1; break; |
| 70 | case 2: d = &pxa168_device_pwm2; break; |
| 71 | case 3: d = &pxa168_device_pwm3; break; |
| 72 | case 4: d = &pxa168_device_pwm4; break; |
| 73 | default: |
| 74 | return -EINVAL; |
| 75 | } |
| 76 | |
| 77 | return pxa_register_device(d, NULL, 0); |
| 78 | } |
Haojian Zhuang | a0f266c | 2009-10-13 15:24:55 +0800 | [diff] [blame] | 79 | |
Haojian Zhuang | 7e49922 | 2010-03-19 11:53:17 -0400 | [diff] [blame] | 80 | static inline int pxa168_add_ssp(int id) |
| 81 | { |
| 82 | struct pxa_device_desc *d = NULL; |
| 83 | |
| 84 | switch (id) { |
| 85 | case 1: d = &pxa168_device_ssp1; break; |
| 86 | case 2: d = &pxa168_device_ssp2; break; |
| 87 | case 3: d = &pxa168_device_ssp3; break; |
| 88 | case 4: d = &pxa168_device_ssp4; break; |
| 89 | case 5: d = &pxa168_device_ssp5; break; |
| 90 | default: |
| 91 | return -EINVAL; |
| 92 | } |
| 93 | return pxa_register_device(d, NULL, 0); |
| 94 | } |
| 95 | |
Haojian Zhuang | a0f266c | 2009-10-13 15:24:55 +0800 | [diff] [blame] | 96 | static inline int pxa168_add_nand(struct pxa3xx_nand_platform_data *info) |
| 97 | { |
| 98 | return pxa_register_device(&pxa168_device_nand, info, sizeof(*info)); |
| 99 | } |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 100 | #endif /* __ASM_MACH_PXA168_H */ |