blob: 7fb568d2845b0da8f86c2614b6072b9526b3ee5e [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);
Mark F. Brownab5739a2010-09-03 18:28:10 -04008extern void pxa168_clear_keypad_wakeup(void);
Eric Miao27287012010-07-15 22:22:33 +08009
Eric Miao1a779202009-04-13 15:34:54 +080010#include <linux/i2c.h>
Sebastian Andrzej Siewiorb4593962011-02-23 12:38:16 +010011#include <linux/i2c/pxa-i2c.h>
Eric Miao49cbe782009-01-20 14:15:18 +080012#include <mach/devices.h>
Haojian Zhuanga0f266c2009-10-13 15:24:55 +080013#include <plat/pxa3xx_nand.h>
Mark F. Brown58cf68b2010-08-25 23:51:54 -040014#include <video/pxa168fb.h>
Mark F. Brown6d109462010-09-03 18:28:07 -040015#include <plat/pxa27x_keypad.h>
Mark F. Brownab5739a2010-09-03 18:28:10 -040016#include <mach/cputype.h>
Tanmay Upadhyay80def0d2011-05-02 11:29:59 +053017#include <linux/pxa168_eth.h>
Eric Miao49cbe782009-01-20 14:15:18 +080018
19extern struct pxa_device_desc pxa168_device_uart1;
20extern struct pxa_device_desc pxa168_device_uart2;
Tanmay Upadhyay26407f82011-05-02 11:29:58 +053021extern struct pxa_device_desc pxa168_device_uart3;
Eric Miao1a779202009-04-13 15:34:54 +080022extern struct pxa_device_desc pxa168_device_twsi0;
23extern struct pxa_device_desc pxa168_device_twsi1;
Eric Miaoa27ba762009-04-13 18:29:52 +080024extern struct pxa_device_desc pxa168_device_pwm1;
25extern struct pxa_device_desc pxa168_device_pwm2;
26extern struct pxa_device_desc pxa168_device_pwm3;
27extern struct pxa_device_desc pxa168_device_pwm4;
Haojian Zhuang7e499222010-03-19 11:53:17 -040028extern struct pxa_device_desc pxa168_device_ssp1;
29extern struct pxa_device_desc pxa168_device_ssp2;
30extern struct pxa_device_desc pxa168_device_ssp3;
31extern struct pxa_device_desc pxa168_device_ssp4;
32extern struct pxa_device_desc pxa168_device_ssp5;
Haojian Zhuanga0f266c2009-10-13 15:24:55 +080033extern struct pxa_device_desc pxa168_device_nand;
Mark F. Brown58cf68b2010-08-25 23:51:54 -040034extern struct pxa_device_desc pxa168_device_fb;
Mark F. Brown6d109462010-09-03 18:28:07 -040035extern struct pxa_device_desc pxa168_device_keypad;
Tanmay Upadhyay80def0d2011-05-02 11:29:59 +053036extern struct pxa_device_desc pxa168_device_eth;
Eric Miao49cbe782009-01-20 14:15:18 +080037
Tanmay Upadhyay3abd7f62011-07-20 10:00:58 +053038struct 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 */
43int __init pxa168_add_usb_host(struct pxa168_usb_pdata *pdata);
44
Eric Miao49cbe782009-01-20 14:15:18 +080045static 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;
Tanmay Upadhyay26407f82011-05-02 11:29:58 +053052 case 3: d = &pxa168_device_uart3; break;
Eric Miao49cbe782009-01-20 14:15:18 +080053 }
54
55 if (d == NULL)
56 return -EINVAL;
57
58 return pxa_register_device(d, NULL, 0);
59}
Eric Miao1a779202009-04-13 15:34:54 +080060
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}
Eric Miaoa27ba762009-04-13 18:29:52 +080080
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}
Haojian Zhuanga0f266c2009-10-13 15:24:55 +080096
Haojian Zhuang7e499222010-03-19 11:53:17 -040097static 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
Haojian Zhuanga0f266c2009-10-13 15:24:55 +0800113static inline int pxa168_add_nand(struct pxa3xx_nand_platform_data *info)
114{
115 return pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
116}
Mark F. Brown58cf68b2010-08-25 23:51:54 -0400117
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
Mark F. Brown6d109462010-09-03 18:28:07 -0400123static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *data)
124{
Mark F. Brownab5739a2010-09-03 18:28:10 -0400125 if (cpu_is_pxa168())
126 data->clear_wakeup_event = pxa168_clear_keypad_wakeup;
127
Mark F. Brown6d109462010-09-03 18:28:07 -0400128 return pxa_register_device(&pxa168_device_keypad, data, sizeof(*data));
129}
130
Tanmay Upadhyay80def0d2011-05-02 11:29:59 +0530131static inline int pxa168_add_eth(struct pxa168_eth_platform_data *data)
132{
133 return pxa_register_device(&pxa168_device_eth, data, sizeof(*data));
134}
Eric Miao49cbe782009-01-20 14:15:18 +0800135#endif /* __ASM_MACH_PXA168_H */