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