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); |
Mark F. Brown | ab5739a | 2010-09-03 18:28:10 -0400 | [diff] [blame] | 8 | extern void pxa168_clear_keypad_wakeup(void); |
Eric Miao | 2728701 | 2010-07-15 22:22:33 +0800 | [diff] [blame] | 9 | |
Eric Miao | 1a77920 | 2009-04-13 15:34:54 +0800 | [diff] [blame] | 10 | #include <linux/i2c.h> |
Sebastian Andrzej Siewior | b459396 | 2011-02-23 12:38:16 +0100 | [diff] [blame] | 11 | #include <linux/i2c/pxa-i2c.h> |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 12 | #include <mach/devices.h> |
Haojian Zhuang | a0f266c | 2009-10-13 15:24:55 +0800 | [diff] [blame] | 13 | #include <plat/pxa3xx_nand.h> |
Mark F. Brown | 58cf68b | 2010-08-25 23:51:54 -0400 | [diff] [blame] | 14 | #include <video/pxa168fb.h> |
Mark F. Brown | 6d10946 | 2010-09-03 18:28:07 -0400 | [diff] [blame] | 15 | #include <plat/pxa27x_keypad.h> |
Mark F. Brown | ab5739a | 2010-09-03 18:28:10 -0400 | [diff] [blame] | 16 | #include <mach/cputype.h> |
Tanmay Upadhyay | 80def0d | 2011-05-02 11:29:59 +0530 | [diff] [blame] | 17 | #include <linux/pxa168_eth.h> |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 18 | |
| 19 | extern struct pxa_device_desc pxa168_device_uart1; |
| 20 | extern struct pxa_device_desc pxa168_device_uart2; |
Tanmay Upadhyay | 26407f8 | 2011-05-02 11:29:58 +0530 | [diff] [blame] | 21 | extern struct pxa_device_desc pxa168_device_uart3; |
Eric Miao | 1a77920 | 2009-04-13 15:34:54 +0800 | [diff] [blame] | 22 | extern struct pxa_device_desc pxa168_device_twsi0; |
| 23 | extern struct pxa_device_desc pxa168_device_twsi1; |
Eric Miao | a27ba76 | 2009-04-13 18:29:52 +0800 | [diff] [blame] | 24 | extern struct pxa_device_desc pxa168_device_pwm1; |
| 25 | extern struct pxa_device_desc pxa168_device_pwm2; |
| 26 | extern struct pxa_device_desc pxa168_device_pwm3; |
| 27 | extern struct pxa_device_desc pxa168_device_pwm4; |
Haojian Zhuang | 7e49922 | 2010-03-19 11:53:17 -0400 | [diff] [blame] | 28 | extern struct pxa_device_desc pxa168_device_ssp1; |
| 29 | extern struct pxa_device_desc pxa168_device_ssp2; |
| 30 | extern struct pxa_device_desc pxa168_device_ssp3; |
| 31 | extern struct pxa_device_desc pxa168_device_ssp4; |
| 32 | extern struct pxa_device_desc pxa168_device_ssp5; |
Haojian Zhuang | a0f266c | 2009-10-13 15:24:55 +0800 | [diff] [blame] | 33 | extern struct pxa_device_desc pxa168_device_nand; |
Mark F. Brown | 58cf68b | 2010-08-25 23:51:54 -0400 | [diff] [blame] | 34 | extern struct pxa_device_desc pxa168_device_fb; |
Mark F. Brown | 6d10946 | 2010-09-03 18:28:07 -0400 | [diff] [blame] | 35 | extern struct pxa_device_desc pxa168_device_keypad; |
Tanmay Upadhyay | 80def0d | 2011-05-02 11:29:59 +0530 | [diff] [blame] | 36 | extern struct pxa_device_desc pxa168_device_eth; |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 37 | |
Tanmay Upadhyay | 3abd7f6 | 2011-07-20 10:00:58 +0530 | [diff] [blame^] | 38 | struct pxa168_usb_pdata { |
| 39 | /* If NULL, default phy init routine for PXA168 would be called */ |
| 40 | int (*phy_init)(void __iomem *usb_phy_reg_base); |
| 41 | }; |
| 42 | /* pdata can be NULL */ |
| 43 | int __init pxa168_add_usb_host(struct pxa168_usb_pdata *pdata); |
| 44 | |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 45 | static inline int pxa168_add_uart(int id) |
| 46 | { |
| 47 | struct pxa_device_desc *d = NULL; |
| 48 | |
| 49 | switch (id) { |
| 50 | case 1: d = &pxa168_device_uart1; break; |
| 51 | case 2: d = &pxa168_device_uart2; break; |
Tanmay Upadhyay | 26407f8 | 2011-05-02 11:29:58 +0530 | [diff] [blame] | 52 | case 3: d = &pxa168_device_uart3; break; |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | if (d == NULL) |
| 56 | return -EINVAL; |
| 57 | |
| 58 | return pxa_register_device(d, NULL, 0); |
| 59 | } |
Eric Miao | 1a77920 | 2009-04-13 15:34:54 +0800 | [diff] [blame] | 60 | |
| 61 | static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data, |
| 62 | struct i2c_board_info *info, unsigned size) |
| 63 | { |
| 64 | struct pxa_device_desc *d = NULL; |
| 65 | int ret; |
| 66 | |
| 67 | switch (id) { |
| 68 | case 0: d = &pxa168_device_twsi0; break; |
| 69 | case 1: d = &pxa168_device_twsi1; break; |
| 70 | default: |
| 71 | return -EINVAL; |
| 72 | } |
| 73 | |
| 74 | ret = i2c_register_board_info(id, info, size); |
| 75 | if (ret) |
| 76 | return ret; |
| 77 | |
| 78 | return pxa_register_device(d, data, sizeof(*data)); |
| 79 | } |
Eric Miao | a27ba76 | 2009-04-13 18:29:52 +0800 | [diff] [blame] | 80 | |
| 81 | static inline int pxa168_add_pwm(int id) |
| 82 | { |
| 83 | struct pxa_device_desc *d = NULL; |
| 84 | |
| 85 | switch (id) { |
| 86 | case 1: d = &pxa168_device_pwm1; break; |
| 87 | case 2: d = &pxa168_device_pwm2; break; |
| 88 | case 3: d = &pxa168_device_pwm3; break; |
| 89 | case 4: d = &pxa168_device_pwm4; break; |
| 90 | default: |
| 91 | return -EINVAL; |
| 92 | } |
| 93 | |
| 94 | return pxa_register_device(d, NULL, 0); |
| 95 | } |
Haojian Zhuang | a0f266c | 2009-10-13 15:24:55 +0800 | [diff] [blame] | 96 | |
Haojian Zhuang | 7e49922 | 2010-03-19 11:53:17 -0400 | [diff] [blame] | 97 | static inline int pxa168_add_ssp(int id) |
| 98 | { |
| 99 | struct pxa_device_desc *d = NULL; |
| 100 | |
| 101 | switch (id) { |
| 102 | case 1: d = &pxa168_device_ssp1; break; |
| 103 | case 2: d = &pxa168_device_ssp2; break; |
| 104 | case 3: d = &pxa168_device_ssp3; break; |
| 105 | case 4: d = &pxa168_device_ssp4; break; |
| 106 | case 5: d = &pxa168_device_ssp5; break; |
| 107 | default: |
| 108 | return -EINVAL; |
| 109 | } |
| 110 | return pxa_register_device(d, NULL, 0); |
| 111 | } |
| 112 | |
Haojian Zhuang | a0f266c | 2009-10-13 15:24:55 +0800 | [diff] [blame] | 113 | static inline int pxa168_add_nand(struct pxa3xx_nand_platform_data *info) |
| 114 | { |
| 115 | return pxa_register_device(&pxa168_device_nand, info, sizeof(*info)); |
| 116 | } |
Mark F. Brown | 58cf68b | 2010-08-25 23:51:54 -0400 | [diff] [blame] | 117 | |
| 118 | static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi) |
| 119 | { |
| 120 | return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi)); |
| 121 | } |
| 122 | |
Mark F. Brown | 6d10946 | 2010-09-03 18:28:07 -0400 | [diff] [blame] | 123 | static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *data) |
| 124 | { |
Mark F. Brown | ab5739a | 2010-09-03 18:28:10 -0400 | [diff] [blame] | 125 | if (cpu_is_pxa168()) |
| 126 | data->clear_wakeup_event = pxa168_clear_keypad_wakeup; |
| 127 | |
Mark F. Brown | 6d10946 | 2010-09-03 18:28:07 -0400 | [diff] [blame] | 128 | return pxa_register_device(&pxa168_device_keypad, data, sizeof(*data)); |
| 129 | } |
| 130 | |
Tanmay Upadhyay | 80def0d | 2011-05-02 11:29:59 +0530 | [diff] [blame] | 131 | static inline int pxa168_add_eth(struct pxa168_eth_platform_data *data) |
| 132 | { |
| 133 | return pxa_register_device(&pxa168_device_eth, data, sizeof(*data)); |
| 134 | } |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 135 | #endif /* __ASM_MACH_PXA168_H */ |