blob: 6dfe36a225c1712760085507f1a9be25e4b2b0ac [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#ifndef __ASM_MACH_PXA168_H
2#define __ASM_MACH_PXA168_H
3
4extern void pxa168_timer_init(void);
5extern void __init icu_init_irq(void);
6extern void __init pxa168_init_irq(void);
7extern void pxa168_restart(char, const char *);
8extern void pxa168_clear_keypad_wakeup(void);
9
10#include <linux/i2c.h>
11#include <linux/i2c/pxa-i2c.h>
12#include <soc/asr/devices.h>
13#include <linux/platform_data/mtd-nand-pxa3xx.h>
14#include <video/pxa168fb.h>
15#include <linux/platform_data/keypad-pxa27x.h>
16#include <linux/cputype.h>
17#include <linux/pxa168_eth.h>
18#include <linux/platform_data/mv_usb.h>
19
20extern struct pxa_device_desc pxa168_device_uart1;
21extern struct pxa_device_desc pxa168_device_uart2;
22extern struct pxa_device_desc pxa168_device_uart3;
23extern struct pxa_device_desc pxa168_device_twsi0;
24extern struct pxa_device_desc pxa168_device_twsi1;
25extern struct pxa_device_desc pxa168_device_pwm1;
26extern struct pxa_device_desc pxa168_device_pwm2;
27extern struct pxa_device_desc pxa168_device_pwm3;
28extern struct pxa_device_desc pxa168_device_pwm4;
29extern struct pxa_device_desc pxa168_device_ssp1;
30extern struct pxa_device_desc pxa168_device_ssp2;
31extern struct pxa_device_desc pxa168_device_ssp3;
32extern struct pxa_device_desc pxa168_device_ssp4;
33extern struct pxa_device_desc pxa168_device_ssp5;
34extern struct pxa_device_desc pxa168_device_nand;
35extern struct pxa_device_desc pxa168_device_fb;
36extern struct pxa_device_desc pxa168_device_keypad;
37extern struct pxa_device_desc pxa168_device_eth;
38
39/* pdata can be NULL */
40extern int __init pxa168_add_usb_host(struct mv_usb_platform_data *pdata);
41
42
43extern struct platform_device pxa168_device_gpio;
44
45static 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
61static 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
81static 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
97static 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
113static 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
118static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
119{
120 return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
121}
122
123static 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
131static 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 */