blob: adafc4fba8f4ba5aba608b1c4f64f916ede97b5e [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -05002#ifndef __ASM_MACH_MMP2_H
3#define __ASM_MACH_MMP2_H
4
Zhangfei Gaobfed3452011-06-20 22:11:52 +08005#include <linux/platform_data/pxa_sdhci.h>
Zhangfei Gao5382f412010-09-29 16:18:51 -04006
Stephen Warren6bb27d72012-11-08 12:40:59 -07007extern void mmp2_timer_init(void);
Eric Miao27287012010-07-15 22:22:33 +08008extern void __init mmp2_init_icu(void);
9extern void __init mmp2_init_irq(void);
10extern void mmp2_clear_pmic_int(void);
11
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050012#include <linux/i2c.h>
Wolfram Sangf15fc9b2017-11-13 18:27:39 +010013#include <linux/platform_data/i2c-pxa.h>
Arnd Bergmann293b2da2012-08-24 15:16:48 +020014#include <linux/platform_data/dma-mmp_tdma.h>
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050015
Arnd Bergmannb501fd72014-04-15 20:38:32 +020016#include "devices.h"
17
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050018extern struct pxa_device_desc mmp2_device_uart1;
19extern struct pxa_device_desc mmp2_device_uart2;
20extern struct pxa_device_desc mmp2_device_uart3;
21extern struct pxa_device_desc mmp2_device_uart4;
22extern struct pxa_device_desc mmp2_device_twsi1;
23extern struct pxa_device_desc mmp2_device_twsi2;
24extern struct pxa_device_desc mmp2_device_twsi3;
25extern struct pxa_device_desc mmp2_device_twsi4;
26extern struct pxa_device_desc mmp2_device_twsi5;
27extern struct pxa_device_desc mmp2_device_twsi6;
Zhangfei Gao5382f412010-09-29 16:18:51 -040028extern struct pxa_device_desc mmp2_device_sdh0;
29extern struct pxa_device_desc mmp2_device_sdh1;
30extern struct pxa_device_desc mmp2_device_sdh2;
31extern struct pxa_device_desc mmp2_device_sdh3;
Leo Yan101bf4c2011-08-15 11:09:53 +080032extern struct pxa_device_desc mmp2_device_asram;
Leo Yanbca7ab32011-08-15 11:09:54 +080033extern struct pxa_device_desc mmp2_device_isram;
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050034
Haojian Zhuang157d2642011-10-17 20:37:52 +080035extern struct platform_device mmp2_device_gpio;
36
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050037static inline int mmp2_add_uart(int id)
38{
39 struct pxa_device_desc *d = NULL;
40
41 switch (id) {
42 case 1: d = &mmp2_device_uart1; break;
43 case 2: d = &mmp2_device_uart2; break;
44 case 3: d = &mmp2_device_uart3; break;
45 case 4: d = &mmp2_device_uart4; break;
46 default:
47 return -EINVAL;
48 }
49
50 return pxa_register_device(d, NULL, 0);
51}
52
53static inline int mmp2_add_twsi(int id, struct i2c_pxa_platform_data *data,
54 struct i2c_board_info *info, unsigned size)
55{
56 struct pxa_device_desc *d = NULL;
57 int ret;
58
59 switch (id) {
Haojian Zhuangfed24052010-04-28 15:34:04 -040060 case 1: d = &mmp2_device_twsi1; break;
61 case 2: d = &mmp2_device_twsi2; break;
62 case 3: d = &mmp2_device_twsi3; break;
63 case 4: d = &mmp2_device_twsi4; break;
64 case 5: d = &mmp2_device_twsi5; break;
65 case 6: d = &mmp2_device_twsi6; break;
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050066 default:
67 return -EINVAL;
68 }
69
Haojian Zhuangfed24052010-04-28 15:34:04 -040070 ret = i2c_register_board_info(id - 1, info, size);
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050071 if (ret)
72 return ret;
73
74 return pxa_register_device(d, data, sizeof(*data));
75}
76
Zhangfei Gao5382f412010-09-29 16:18:51 -040077static inline int mmp2_add_sdhost(int id, struct sdhci_pxa_platdata *data)
78{
79 struct pxa_device_desc *d = NULL;
80
81 switch (id) {
82 case 0: d = &mmp2_device_sdh0; break;
83 case 1: d = &mmp2_device_sdh1; break;
84 case 2: d = &mmp2_device_sdh2; break;
85 case 3: d = &mmp2_device_sdh3; break;
86 default:
87 return -EINVAL;
88 }
89
90 return pxa_register_device(d, data, sizeof(*data));
91}
92
Leo Yan101bf4c2011-08-15 11:09:53 +080093static inline int mmp2_add_asram(struct sram_platdata *data)
94{
95 return pxa_register_device(&mmp2_device_asram, data, sizeof(*data));
96}
97
Leo Yanbca7ab32011-08-15 11:09:54 +080098static inline int mmp2_add_isram(struct sram_platdata *data)
99{
100 return pxa_register_device(&mmp2_device_isram, data, sizeof(*data));
101}
102
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -0500103#endif /* __ASM_MACH_MMP2_H */
104