Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
49cbe786 EM |
2 | #ifndef __ASM_MACH_PXA168_H |
3 | #define __ASM_MACH_PXA168_H | |
4 | ||
7b6d864b RH |
5 | #include <linux/reboot.h> |
6 | ||
6bb27d73 | 7 | extern void pxa168_timer_init(void); |
c052d13c | 8 | extern void __init icu_init_irq(void); |
2728701d | 9 | extern void __init pxa168_init_irq(void); |
7b6d864b | 10 | extern void pxa168_restart(enum reboot_mode, const char *); |
ab5739a1 | 11 | extern void pxa168_clear_keypad_wakeup(void); |
2728701d | 12 | |
1a77920e | 13 | #include <linux/i2c.h> |
f15fc9b1 | 14 | #include <linux/platform_data/i2c-pxa.h> |
293b2da1 | 15 | #include <linux/platform_data/mtd-nand-pxa3xx.h> |
58cf68b8 | 16 | #include <video/pxa168fb.h> |
293b2da1 | 17 | #include <linux/platform_data/keypad-pxa27x.h> |
80def0dc | 18 | #include <linux/pxa168_eth.h> |
161105bc | 19 | #include <linux/platform_data/mv_usb.h> |
49cbe786 | 20 | |
b501fd7b AB |
21 | #include "devices.h" |
22 | #include "cputype.h" | |
23 | ||
49cbe786 EM |
24 | extern struct pxa_device_desc pxa168_device_uart1; |
25 | extern struct pxa_device_desc pxa168_device_uart2; | |
26407f81 | 26 | extern struct pxa_device_desc pxa168_device_uart3; |
1a77920e EM |
27 | extern struct pxa_device_desc pxa168_device_twsi0; |
28 | extern struct pxa_device_desc pxa168_device_twsi1; | |
a27ba768 EM |
29 | extern struct pxa_device_desc pxa168_device_pwm1; |
30 | extern struct pxa_device_desc pxa168_device_pwm2; | |
31 | extern struct pxa_device_desc pxa168_device_pwm3; | |
32 | extern struct pxa_device_desc pxa168_device_pwm4; | |
7e499228 HZ |
33 | extern struct pxa_device_desc pxa168_device_ssp1; |
34 | extern struct pxa_device_desc pxa168_device_ssp2; | |
35 | extern struct pxa_device_desc pxa168_device_ssp3; | |
36 | extern struct pxa_device_desc pxa168_device_ssp4; | |
37 | extern struct pxa_device_desc pxa168_device_ssp5; | |
a0f266c1 | 38 | extern struct pxa_device_desc pxa168_device_nand; |
58cf68b8 | 39 | extern struct pxa_device_desc pxa168_device_fb; |
6d109465 | 40 | extern struct pxa_device_desc pxa168_device_keypad; |
80def0dc | 41 | extern struct pxa_device_desc pxa168_device_eth; |
49cbe786 | 42 | |
3abd7f68 | 43 | /* pdata can be NULL */ |
161105bc NZ |
44 | extern int __init pxa168_add_usb_host(struct mv_usb_platform_data *pdata); |
45 | ||
3abd7f68 | 46 | |
157d2644 HZ |
47 | extern struct platform_device pxa168_device_gpio; |
48 | ||
49cbe786 EM |
49 | static inline int pxa168_add_uart(int id) |
50 | { | |
51 | struct pxa_device_desc *d = NULL; | |
52 | ||
53 | switch (id) { | |
54 | case 1: d = &pxa168_device_uart1; break; | |
55 | case 2: d = &pxa168_device_uart2; break; | |
26407f81 | 56 | case 3: d = &pxa168_device_uart3; break; |
49cbe786 EM |
57 | } |
58 | ||
59 | if (d == NULL) | |
60 | return -EINVAL; | |
61 | ||
62 | return pxa_register_device(d, NULL, 0); | |
63 | } | |
1a77920e EM |
64 | |
65 | static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data, | |
66 | struct i2c_board_info *info, unsigned size) | |
67 | { | |
68 | struct pxa_device_desc *d = NULL; | |
69 | int ret; | |
70 | ||
71 | switch (id) { | |
72 | case 0: d = &pxa168_device_twsi0; break; | |
73 | case 1: d = &pxa168_device_twsi1; break; | |
74 | default: | |
75 | return -EINVAL; | |
76 | } | |
77 | ||
78 | ret = i2c_register_board_info(id, info, size); | |
79 | if (ret) | |
80 | return ret; | |
81 | ||
82 | return pxa_register_device(d, data, sizeof(*data)); | |
83 | } | |
a27ba768 EM |
84 | |
85 | static inline int pxa168_add_pwm(int id) | |
86 | { | |
87 | struct pxa_device_desc *d = NULL; | |
88 | ||
89 | switch (id) { | |
90 | case 1: d = &pxa168_device_pwm1; break; | |
91 | case 2: d = &pxa168_device_pwm2; break; | |
92 | case 3: d = &pxa168_device_pwm3; break; | |
93 | case 4: d = &pxa168_device_pwm4; break; | |
94 | default: | |
95 | return -EINVAL; | |
96 | } | |
97 | ||
98 | return pxa_register_device(d, NULL, 0); | |
99 | } | |
a0f266c1 | 100 | |
7e499228 HZ |
101 | static inline int pxa168_add_ssp(int id) |
102 | { | |
103 | struct pxa_device_desc *d = NULL; | |
104 | ||
105 | switch (id) { | |
106 | case 1: d = &pxa168_device_ssp1; break; | |
107 | case 2: d = &pxa168_device_ssp2; break; | |
108 | case 3: d = &pxa168_device_ssp3; break; | |
109 | case 4: d = &pxa168_device_ssp4; break; | |
110 | case 5: d = &pxa168_device_ssp5; break; | |
111 | default: | |
112 | return -EINVAL; | |
113 | } | |
114 | return pxa_register_device(d, NULL, 0); | |
115 | } | |
116 | ||
a0f266c1 HZ |
117 | static inline int pxa168_add_nand(struct pxa3xx_nand_platform_data *info) |
118 | { | |
119 | return pxa_register_device(&pxa168_device_nand, info, sizeof(*info)); | |
120 | } | |
58cf68b8 MB |
121 | |
122 | static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi) | |
123 | { | |
124 | return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi)); | |
125 | } | |
126 | ||
6d109465 MB |
127 | static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *data) |
128 | { | |
ab5739a1 MB |
129 | if (cpu_is_pxa168()) |
130 | data->clear_wakeup_event = pxa168_clear_keypad_wakeup; | |
131 | ||
6d109465 MB |
132 | return pxa_register_device(&pxa168_device_keypad, data, sizeof(*data)); |
133 | } | |
134 | ||
80def0dc TU |
135 | static inline int pxa168_add_eth(struct pxa168_eth_platform_data *data) |
136 | { | |
137 | return pxa_register_device(&pxa168_device_eth, data, sizeof(*data)); | |
138 | } | |
49cbe786 | 139 | #endif /* __ASM_MACH_PXA168_H */ |