blob: 9b5e75ee9e4dabbfc0dcd259e612d518ef9e7a77 [file] [log] [blame]
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -05001#ifndef __ASM_MACH_MMP2_H
2#define __ASM_MACH_MMP2_H
3
Zhangfei Gaobfed3452011-06-20 22:11:52 +08004#include <linux/platform_data/pxa_sdhci.h>
Zhangfei Gao5382f412010-09-29 16:18:51 -04005
Stephen Warren6bb27d72012-11-08 12:40:59 -07006extern void mmp2_timer_init(void);
Eric Miao27287012010-07-15 22:22:33 +08007extern void __init mmp2_init_icu(void);
8extern void __init mmp2_init_irq(void);
9extern void mmp2_clear_pmic_int(void);
10
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050011#include <linux/i2c.h>
Sebastian Andrzej Siewiorb4593962011-02-23 12:38:16 +010012#include <linux/i2c/pxa-i2c.h>
Arnd Bergmann293b2da2012-08-24 15:16:48 +020013#include <linux/platform_data/dma-mmp_tdma.h>
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050014
Arnd Bergmannb501fd72014-04-15 20:38:32 +020015#include "devices.h"
16
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050017extern struct pxa_device_desc mmp2_device_uart1;
18extern struct pxa_device_desc mmp2_device_uart2;
19extern struct pxa_device_desc mmp2_device_uart3;
20extern struct pxa_device_desc mmp2_device_uart4;
21extern struct pxa_device_desc mmp2_device_twsi1;
22extern struct pxa_device_desc mmp2_device_twsi2;
23extern struct pxa_device_desc mmp2_device_twsi3;
24extern struct pxa_device_desc mmp2_device_twsi4;
25extern struct pxa_device_desc mmp2_device_twsi5;
26extern struct pxa_device_desc mmp2_device_twsi6;
Zhangfei Gao5382f412010-09-29 16:18:51 -040027extern struct pxa_device_desc mmp2_device_sdh0;
28extern struct pxa_device_desc mmp2_device_sdh1;
29extern struct pxa_device_desc mmp2_device_sdh2;
30extern struct pxa_device_desc mmp2_device_sdh3;
Leo Yan101bf4c2011-08-15 11:09:53 +080031extern struct pxa_device_desc mmp2_device_asram;
Leo Yanbca7ab32011-08-15 11:09:54 +080032extern struct pxa_device_desc mmp2_device_isram;
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050033
Haojian Zhuang157d2642011-10-17 20:37:52 +080034extern struct platform_device mmp2_device_gpio;
35
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050036static inline int mmp2_add_uart(int id)
37{
38 struct pxa_device_desc *d = NULL;
39
40 switch (id) {
41 case 1: d = &mmp2_device_uart1; break;
42 case 2: d = &mmp2_device_uart2; break;
43 case 3: d = &mmp2_device_uart3; break;
44 case 4: d = &mmp2_device_uart4; break;
45 default:
46 return -EINVAL;
47 }
48
49 return pxa_register_device(d, NULL, 0);
50}
51
52static inline int mmp2_add_twsi(int id, struct i2c_pxa_platform_data *data,
53 struct i2c_board_info *info, unsigned size)
54{
55 struct pxa_device_desc *d = NULL;
56 int ret;
57
58 switch (id) {
Haojian Zhuangfed24052010-04-28 15:34:04 -040059 case 1: d = &mmp2_device_twsi1; break;
60 case 2: d = &mmp2_device_twsi2; break;
61 case 3: d = &mmp2_device_twsi3; break;
62 case 4: d = &mmp2_device_twsi4; break;
63 case 5: d = &mmp2_device_twsi5; break;
64 case 6: d = &mmp2_device_twsi6; break;
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050065 default:
66 return -EINVAL;
67 }
68
Haojian Zhuangfed24052010-04-28 15:34:04 -040069 ret = i2c_register_board_info(id - 1, info, size);
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050070 if (ret)
71 return ret;
72
73 return pxa_register_device(d, data, sizeof(*data));
74}
75
Zhangfei Gao5382f412010-09-29 16:18:51 -040076static inline int mmp2_add_sdhost(int id, struct sdhci_pxa_platdata *data)
77{
78 struct pxa_device_desc *d = NULL;
79
80 switch (id) {
81 case 0: d = &mmp2_device_sdh0; break;
82 case 1: d = &mmp2_device_sdh1; break;
83 case 2: d = &mmp2_device_sdh2; break;
84 case 3: d = &mmp2_device_sdh3; break;
85 default:
86 return -EINVAL;
87 }
88
89 return pxa_register_device(d, data, sizeof(*data));
90}
91
Leo Yan101bf4c2011-08-15 11:09:53 +080092static inline int mmp2_add_asram(struct sram_platdata *data)
93{
94 return pxa_register_device(&mmp2_device_asram, data, sizeof(*data));
95}
96
Leo Yanbca7ab32011-08-15 11:09:54 +080097static inline int mmp2_add_isram(struct sram_platdata *data)
98{
99 return pxa_register_device(&mmp2_device_isram, data, sizeof(*data));
100}
101
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -0500102#endif /* __ASM_MACH_MMP2_H */
103