blob: f34e6638fc6c2137ae26b9966edb38fae3ea69c0 [file] [log] [blame]
Eric Miao49cbe782009-01-20 14:15:18 +08001#ifndef __ASM_MACH_PXA168_H
2#define __ASM_MACH_PXA168_H
3
Eric Miao27287012010-07-15 22:22:33 +08004struct sys_timer;
5
6extern struct sys_timer pxa168_timer;
7extern void __init pxa168_init_irq(void);
8
Eric Miao1a779202009-04-13 15:34:54 +08009#include <linux/i2c.h>
Eric Miao49cbe782009-01-20 14:15:18 +080010#include <mach/devices.h>
Eric Miao1a779202009-04-13 15:34:54 +080011#include <plat/i2c.h>
Haojian Zhuanga0f266c2009-10-13 15:24:55 +080012#include <plat/pxa3xx_nand.h>
Mark F. Brown58cf68b2010-08-25 23:51:54 -040013#include <video/pxa168fb.h>
Mark F. Brown6d109462010-09-03 18:28:07 -040014#include <plat/pxa27x_keypad.h>
Eric Miao49cbe782009-01-20 14:15:18 +080015
16extern struct pxa_device_desc pxa168_device_uart1;
17extern struct pxa_device_desc pxa168_device_uart2;
Eric Miao1a779202009-04-13 15:34:54 +080018extern struct pxa_device_desc pxa168_device_twsi0;
19extern struct pxa_device_desc pxa168_device_twsi1;
Eric Miaoa27ba762009-04-13 18:29:52 +080020extern struct pxa_device_desc pxa168_device_pwm1;
21extern struct pxa_device_desc pxa168_device_pwm2;
22extern struct pxa_device_desc pxa168_device_pwm3;
23extern struct pxa_device_desc pxa168_device_pwm4;
Haojian Zhuang7e499222010-03-19 11:53:17 -040024extern struct pxa_device_desc pxa168_device_ssp1;
25extern struct pxa_device_desc pxa168_device_ssp2;
26extern struct pxa_device_desc pxa168_device_ssp3;
27extern struct pxa_device_desc pxa168_device_ssp4;
28extern struct pxa_device_desc pxa168_device_ssp5;
Haojian Zhuanga0f266c2009-10-13 15:24:55 +080029extern struct pxa_device_desc pxa168_device_nand;
Mark F. Brown58cf68b2010-08-25 23:51:54 -040030extern struct pxa_device_desc pxa168_device_fb;
Mark F. Brown6d109462010-09-03 18:28:07 -040031extern struct pxa_device_desc pxa168_device_keypad;
Eric Miao49cbe782009-01-20 14:15:18 +080032
33static inline int pxa168_add_uart(int id)
34{
35 struct pxa_device_desc *d = NULL;
36
37 switch (id) {
38 case 1: d = &pxa168_device_uart1; break;
39 case 2: d = &pxa168_device_uart2; break;
40 }
41
42 if (d == NULL)
43 return -EINVAL;
44
45 return pxa_register_device(d, NULL, 0);
46}
Eric Miao1a779202009-04-13 15:34:54 +080047
48static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data,
49 struct i2c_board_info *info, unsigned size)
50{
51 struct pxa_device_desc *d = NULL;
52 int ret;
53
54 switch (id) {
55 case 0: d = &pxa168_device_twsi0; break;
56 case 1: d = &pxa168_device_twsi1; break;
57 default:
58 return -EINVAL;
59 }
60
61 ret = i2c_register_board_info(id, info, size);
62 if (ret)
63 return ret;
64
65 return pxa_register_device(d, data, sizeof(*data));
66}
Eric Miaoa27ba762009-04-13 18:29:52 +080067
68static inline int pxa168_add_pwm(int id)
69{
70 struct pxa_device_desc *d = NULL;
71
72 switch (id) {
73 case 1: d = &pxa168_device_pwm1; break;
74 case 2: d = &pxa168_device_pwm2; break;
75 case 3: d = &pxa168_device_pwm3; break;
76 case 4: d = &pxa168_device_pwm4; break;
77 default:
78 return -EINVAL;
79 }
80
81 return pxa_register_device(d, NULL, 0);
82}
Haojian Zhuanga0f266c2009-10-13 15:24:55 +080083
Haojian Zhuang7e499222010-03-19 11:53:17 -040084static inline int pxa168_add_ssp(int id)
85{
86 struct pxa_device_desc *d = NULL;
87
88 switch (id) {
89 case 1: d = &pxa168_device_ssp1; break;
90 case 2: d = &pxa168_device_ssp2; break;
91 case 3: d = &pxa168_device_ssp3; break;
92 case 4: d = &pxa168_device_ssp4; break;
93 case 5: d = &pxa168_device_ssp5; break;
94 default:
95 return -EINVAL;
96 }
97 return pxa_register_device(d, NULL, 0);
98}
99
Haojian Zhuanga0f266c2009-10-13 15:24:55 +0800100static inline int pxa168_add_nand(struct pxa3xx_nand_platform_data *info)
101{
102 return pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
103}
Mark F. Brown58cf68b2010-08-25 23:51:54 -0400104
105static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
106{
107 return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
108}
109
Mark F. Brown6d109462010-09-03 18:28:07 -0400110static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *data)
111{
112 return pxa_register_device(&pxa168_device_keypad, data, sizeof(*data));
113}
114
Eric Miao49cbe782009-01-20 14:15:18 +0800115#endif /* __ASM_MACH_PXA168_H */