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