USB: pxa168: Add onchip USB host controller support
[deliverable/linux.git] / arch / arm / mach-mmp / include / mach / pxa168.h
1 #ifndef __ASM_MACH_PXA168_H
2 #define __ASM_MACH_PXA168_H
3
4 struct sys_timer;
5
6 extern struct sys_timer pxa168_timer;
7 extern void __init pxa168_init_irq(void);
8 extern void pxa168_clear_keypad_wakeup(void);
9
10 #include <linux/i2c.h>
11 #include <linux/i2c/pxa-i2c.h>
12 #include <mach/devices.h>
13 #include <plat/pxa3xx_nand.h>
14 #include <video/pxa168fb.h>
15 #include <plat/pxa27x_keypad.h>
16 #include <mach/cputype.h>
17 #include <linux/pxa168_eth.h>
18
19 extern struct pxa_device_desc pxa168_device_uart1;
20 extern struct pxa_device_desc pxa168_device_uart2;
21 extern struct pxa_device_desc pxa168_device_uart3;
22 extern struct pxa_device_desc pxa168_device_twsi0;
23 extern struct pxa_device_desc pxa168_device_twsi1;
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;
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;
33 extern struct pxa_device_desc pxa168_device_nand;
34 extern struct pxa_device_desc pxa168_device_fb;
35 extern struct pxa_device_desc pxa168_device_keypad;
36 extern struct pxa_device_desc pxa168_device_eth;
37
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
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;
52 case 3: d = &pxa168_device_uart3; break;
53 }
54
55 if (d == NULL)
56 return -EINVAL;
57
58 return pxa_register_device(d, NULL, 0);
59 }
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 }
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 }
96
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
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 }
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
123 static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *data)
124 {
125 if (cpu_is_pxa168())
126 data->clear_wakeup_event = pxa168_clear_keypad_wakeup;
127
128 return pxa_register_device(&pxa168_device_keypad, data, sizeof(*data));
129 }
130
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 }
135 #endif /* __ASM_MACH_PXA168_H */
This page took 0.035154 seconds and 5 git commands to generate.