blob: 75841e9ccd739684b4667f74c36d28d3319ef3de [file] [log] [blame]
Eric Miao49cbe782009-01-20 14:15:18 +08001#ifndef __ASM_MACH_PXA168_H
2#define __ASM_MACH_PXA168_H
3
Robin Holt7b6d8642013-07-08 16:01:40 -07004#include <linux/reboot.h>
5
Stephen Warren6bb27d72012-11-08 12:40:59 -07006extern void pxa168_timer_init(void);
Haojian Zhuangc052d132013-04-21 13:21:48 +08007extern void __init icu_init_irq(void);
Eric Miao27287012010-07-15 22:22:33 +08008extern void __init pxa168_init_irq(void);
Robin Holt7b6d8642013-07-08 16:01:40 -07009extern void pxa168_restart(enum reboot_mode, const char *);
Mark F. Brownab5739a2010-09-03 18:28:10 -040010extern void pxa168_clear_keypad_wakeup(void);
Eric Miao27287012010-07-15 22:22:33 +080011
Eric Miao1a779202009-04-13 15:34:54 +080012#include <linux/i2c.h>
Sebastian Andrzej Siewiorb4593962011-02-23 12:38:16 +010013#include <linux/i2c/pxa-i2c.h>
Arnd Bergmann293b2da2012-08-24 15:16:48 +020014#include <linux/platform_data/mtd-nand-pxa3xx.h>
Mark F. Brown58cf68b2010-08-25 23:51:54 -040015#include <video/pxa168fb.h>
Arnd Bergmann293b2da2012-08-24 15:16:48 +020016#include <linux/platform_data/keypad-pxa27x.h>
Tanmay Upadhyay80def0d2011-05-02 11:29:59 +053017#include <linux/pxa168_eth.h>
Neil Zhang161105b2012-05-03 14:19:15 +080018#include <linux/platform_data/mv_usb.h>
Eric Miao49cbe782009-01-20 14:15:18 +080019
Arnd Bergmannb501fd72014-04-15 20:38:32 +020020#include "devices.h"
21#include "cputype.h"
22
Eric Miao49cbe782009-01-20 14:15:18 +080023extern struct pxa_device_desc pxa168_device_uart1;
24extern struct pxa_device_desc pxa168_device_uart2;
Tanmay Upadhyay26407f82011-05-02 11:29:58 +053025extern struct pxa_device_desc pxa168_device_uart3;
Eric Miao1a779202009-04-13 15:34:54 +080026extern struct pxa_device_desc pxa168_device_twsi0;
27extern struct pxa_device_desc pxa168_device_twsi1;
Eric Miaoa27ba762009-04-13 18:29:52 +080028extern struct pxa_device_desc pxa168_device_pwm1;
29extern struct pxa_device_desc pxa168_device_pwm2;
30extern struct pxa_device_desc pxa168_device_pwm3;
31extern struct pxa_device_desc pxa168_device_pwm4;
Haojian Zhuang7e499222010-03-19 11:53:17 -040032extern struct pxa_device_desc pxa168_device_ssp1;
33extern struct pxa_device_desc pxa168_device_ssp2;
34extern struct pxa_device_desc pxa168_device_ssp3;
35extern struct pxa_device_desc pxa168_device_ssp4;
36extern struct pxa_device_desc pxa168_device_ssp5;
Haojian Zhuanga0f266c2009-10-13 15:24:55 +080037extern struct pxa_device_desc pxa168_device_nand;
Mark F. Brown58cf68b2010-08-25 23:51:54 -040038extern struct pxa_device_desc pxa168_device_fb;
Mark F. Brown6d109462010-09-03 18:28:07 -040039extern struct pxa_device_desc pxa168_device_keypad;
Tanmay Upadhyay80def0d2011-05-02 11:29:59 +053040extern struct pxa_device_desc pxa168_device_eth;
Eric Miao49cbe782009-01-20 14:15:18 +080041
Tanmay Upadhyay3abd7f62011-07-20 10:00:58 +053042/* pdata can be NULL */
Neil Zhang161105b2012-05-03 14:19:15 +080043extern int __init pxa168_add_usb_host(struct mv_usb_platform_data *pdata);
44
Tanmay Upadhyay3abd7f62011-07-20 10:00:58 +053045
Haojian Zhuang157d2642011-10-17 20:37:52 +080046extern struct platform_device pxa168_device_gpio;
47
Eric Miao49cbe782009-01-20 14:15:18 +080048static inline int pxa168_add_uart(int id)
49{
50 struct pxa_device_desc *d = NULL;
51
52 switch (id) {
53 case 1: d = &pxa168_device_uart1; break;
54 case 2: d = &pxa168_device_uart2; break;
Tanmay Upadhyay26407f82011-05-02 11:29:58 +053055 case 3: d = &pxa168_device_uart3; break;
Eric Miao49cbe782009-01-20 14:15:18 +080056 }
57
58 if (d == NULL)
59 return -EINVAL;
60
61 return pxa_register_device(d, NULL, 0);
62}
Eric Miao1a779202009-04-13 15:34:54 +080063
64static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data,
65 struct i2c_board_info *info, unsigned size)
66{
67 struct pxa_device_desc *d = NULL;
68 int ret;
69
70 switch (id) {
71 case 0: d = &pxa168_device_twsi0; break;
72 case 1: d = &pxa168_device_twsi1; break;
73 default:
74 return -EINVAL;
75 }
76
77 ret = i2c_register_board_info(id, info, size);
78 if (ret)
79 return ret;
80
81 return pxa_register_device(d, data, sizeof(*data));
82}
Eric Miaoa27ba762009-04-13 18:29:52 +080083
84static inline int pxa168_add_pwm(int id)
85{
86 struct pxa_device_desc *d = NULL;
87
88 switch (id) {
89 case 1: d = &pxa168_device_pwm1; break;
90 case 2: d = &pxa168_device_pwm2; break;
91 case 3: d = &pxa168_device_pwm3; break;
92 case 4: d = &pxa168_device_pwm4; break;
93 default:
94 return -EINVAL;
95 }
96
97 return pxa_register_device(d, NULL, 0);
98}
Haojian Zhuanga0f266c2009-10-13 15:24:55 +080099
Haojian Zhuang7e499222010-03-19 11:53:17 -0400100static inline int pxa168_add_ssp(int id)
101{
102 struct pxa_device_desc *d = NULL;
103
104 switch (id) {
105 case 1: d = &pxa168_device_ssp1; break;
106 case 2: d = &pxa168_device_ssp2; break;
107 case 3: d = &pxa168_device_ssp3; break;
108 case 4: d = &pxa168_device_ssp4; break;
109 case 5: d = &pxa168_device_ssp5; break;
110 default:
111 return -EINVAL;
112 }
113 return pxa_register_device(d, NULL, 0);
114}
115
Haojian Zhuanga0f266c2009-10-13 15:24:55 +0800116static inline int pxa168_add_nand(struct pxa3xx_nand_platform_data *info)
117{
118 return pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
119}
Mark F. Brown58cf68b2010-08-25 23:51:54 -0400120
121static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
122{
123 return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
124}
125
Mark F. Brown6d109462010-09-03 18:28:07 -0400126static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *data)
127{
Mark F. Brownab5739a2010-09-03 18:28:10 -0400128 if (cpu_is_pxa168())
129 data->clear_wakeup_event = pxa168_clear_keypad_wakeup;
130
Mark F. Brown6d109462010-09-03 18:28:07 -0400131 return pxa_register_device(&pxa168_device_keypad, data, sizeof(*data));
132}
133
Tanmay Upadhyay80def0d2011-05-02 11:29:59 +0530134static inline int pxa168_add_eth(struct pxa168_eth_platform_data *data)
135{
136 return pxa_register_device(&pxa168_device_eth, data, sizeof(*data));
137}
Eric Miao49cbe782009-01-20 14:15:18 +0800138#endif /* __ASM_MACH_PXA168_H */