• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef __ASM_MACH_MMP2_H
2 #define __ASM_MACH_MMP2_H
3 
4 #include <linux/platform_data/pxa_sdhci.h>
5 
6 extern void mmp2_timer_init(void);
7 extern void __init mmp2_init_icu(void);
8 extern void __init mmp2_init_irq(void);
9 extern void mmp2_clear_pmic_int(void);
10 
11 #include <linux/i2c.h>
12 #include <linux/i2c/pxa-i2c.h>
13 #include <mach/devices.h>
14 #include <linux/platform_data/dma-mmp_tdma.h>
15 
16 extern struct pxa_device_desc mmp2_device_uart1;
17 extern struct pxa_device_desc mmp2_device_uart2;
18 extern struct pxa_device_desc mmp2_device_uart3;
19 extern struct pxa_device_desc mmp2_device_uart4;
20 extern struct pxa_device_desc mmp2_device_twsi1;
21 extern struct pxa_device_desc mmp2_device_twsi2;
22 extern struct pxa_device_desc mmp2_device_twsi3;
23 extern struct pxa_device_desc mmp2_device_twsi4;
24 extern struct pxa_device_desc mmp2_device_twsi5;
25 extern struct pxa_device_desc mmp2_device_twsi6;
26 extern struct pxa_device_desc mmp2_device_sdh0;
27 extern struct pxa_device_desc mmp2_device_sdh1;
28 extern struct pxa_device_desc mmp2_device_sdh2;
29 extern struct pxa_device_desc mmp2_device_sdh3;
30 extern struct pxa_device_desc mmp2_device_asram;
31 extern struct pxa_device_desc mmp2_device_isram;
32 
33 extern struct platform_device mmp2_device_gpio;
34 
mmp2_add_uart(int id)35 static inline int mmp2_add_uart(int id)
36 {
37 	struct pxa_device_desc *d = NULL;
38 
39 	switch (id) {
40 	case 1: d = &mmp2_device_uart1; break;
41 	case 2: d = &mmp2_device_uart2; break;
42 	case 3: d = &mmp2_device_uart3; break;
43 	case 4: d = &mmp2_device_uart4; break;
44 	default:
45 		return -EINVAL;
46 	}
47 
48 	return pxa_register_device(d, NULL, 0);
49 }
50 
mmp2_add_twsi(int id,struct i2c_pxa_platform_data * data,struct i2c_board_info * info,unsigned size)51 static inline int mmp2_add_twsi(int id, struct i2c_pxa_platform_data *data,
52 				  struct i2c_board_info *info, unsigned size)
53 {
54 	struct pxa_device_desc *d = NULL;
55 	int ret;
56 
57 	switch (id) {
58 	case 1: d = &mmp2_device_twsi1; break;
59 	case 2: d = &mmp2_device_twsi2; break;
60 	case 3: d = &mmp2_device_twsi3; break;
61 	case 4: d = &mmp2_device_twsi4; break;
62 	case 5: d = &mmp2_device_twsi5; break;
63 	case 6: d = &mmp2_device_twsi6; break;
64 	default:
65 		return -EINVAL;
66 	}
67 
68 	ret = i2c_register_board_info(id - 1, info, size);
69 	if (ret)
70 		return ret;
71 
72 	return pxa_register_device(d, data, sizeof(*data));
73 }
74 
mmp2_add_sdhost(int id,struct sdhci_pxa_platdata * data)75 static inline int mmp2_add_sdhost(int id, struct sdhci_pxa_platdata *data)
76 {
77 	struct pxa_device_desc *d = NULL;
78 
79 	switch (id) {
80 	case 0: d = &mmp2_device_sdh0; break;
81 	case 1: d = &mmp2_device_sdh1; break;
82 	case 2: d = &mmp2_device_sdh2; break;
83 	case 3: d = &mmp2_device_sdh3; break;
84 	default:
85 		return -EINVAL;
86 	}
87 
88 	return pxa_register_device(d, data, sizeof(*data));
89 }
90 
mmp2_add_asram(struct sram_platdata * data)91 static inline int mmp2_add_asram(struct sram_platdata *data)
92 {
93 	return pxa_register_device(&mmp2_device_asram, data, sizeof(*data));
94 }
95 
mmp2_add_isram(struct sram_platdata * data)96 static inline int mmp2_add_isram(struct sram_platdata *data)
97 {
98 	return pxa_register_device(&mmp2_device_isram, data, sizeof(*data));
99 }
100 
101 #endif /* __ASM_MACH_MMP2_H */
102 
103