Commit | Line | Data |
---|---|---|
6fa3eb70 S |
1 | #include <generated/autoconf.h> |
2 | #include <linux/device.h> | |
3 | #include <linux/dma-mapping.h> | |
4 | #include <linux/ioport.h> | |
5 | #include <linux/fs.h> | |
6 | #include <linux/delay.h> | |
7 | #include <linux/platform_device.h> | |
8 | #include <linux/android_pmem.h> | |
9 | #include <linux/memblock.h> | |
10 | #include <asm/setup.h> | |
11 | #include <asm/mach/arch.h> | |
12 | #include <linux/sysfs.h> | |
13 | #include <asm/io.h> | |
14 | #include <linux/spi/spi.h> | |
15 | #include <linux/amba/bus.h> | |
16 | #include <linux/amba/clcd.h> | |
17 | #include <linux/musb/musb.h> | |
18 | #include <linux/musbfsh.h> | |
19 | #include "mach/memory.h" | |
20 | #include "mach/irqs.h" | |
21 | #include <mach/mt_reg_base.h> | |
22 | #include <mach/devs.h> | |
23 | #include <mach/mt_boot.h> | |
24 | #include <linux/version.h> | |
25 | #include <mach/mtk_ccci_helper.h> | |
26 | #include <mach/mtk_eemcs_helper.h> | |
27 | #include <mach/mtk_memcfg.h> | |
28 | #include <mach/dfo_boot.h> | |
29 | #include <mach/dfo_boot_default.h> | |
30 | #include <linux/aee.h> | |
31 | #include <linux/mrdump.h> | |
4b9e9796 | 32 | #if 0//#ifdef CONFIG_MTK_MTD_NAND |
6fa3eb70 S |
33 | #include <mach/nand_device_define.h> |
34 | #include <mach/mt_partitioninfo.h> | |
35 | #endif | |
36 | #define SERIALNO_LEN 32 | |
37 | static char serial_number[SERIALNO_LEN]; | |
38 | ||
39 | extern BOOTMODE get_boot_mode(void); | |
40 | extern u32 get_devinfo_with_index(u32 index); | |
41 | extern u32 g_devinfo_data[]; | |
42 | extern u32 g_devinfo_data_size; | |
43 | extern void adjust_kernel_cmd_line_setting_for_console(char*, char*); | |
44 | unsigned int mtk_get_max_DRAM_size(void); | |
45 | resource_size_t get_actual_DRAM_size(void); | |
46 | ||
4b9e9796 | 47 | #if 0//#ifdef CONFIG_MTK_MTD_NAND |
6fa3eb70 S |
48 | struct tag_pt_info otp_info; |
49 | struct tag_pt_info bmt_info; | |
50 | unsigned int flash_number; | |
51 | flashdev_info_t *gen_FlashTable_ptr; | |
52 | flashdev_info_t gen_FlashTable_p[MAX_FLASH]; | |
53 | #endif | |
54 | ||
55 | struct { | |
56 | u32 base; | |
57 | u32 size; | |
58 | } bl_fb = {0, 0}; | |
59 | ||
60 | static int use_bl_fb = 0; | |
61 | ||
62 | /*=======================================================================*/ | |
63 | /* MT8127 USB GADGET */ | |
64 | /*=======================================================================*/ | |
65 | static u64 usb_dmamask = DMA_BIT_MASK(32); | |
66 | static struct musb_hdrc_config musb_config_mt65xx = { | |
67 | .multipoint = true, | |
68 | .dyn_fifo = true, | |
69 | .soft_con = true, | |
70 | .dma = true, | |
71 | .num_eps = 16, | |
72 | .dma_channels = 8, | |
73 | }; | |
74 | ||
75 | static struct musb_hdrc_platform_data usb_data = { | |
76 | #ifdef CONFIG_USB_MTK_OTG | |
77 | .mode = MUSB_OTG, | |
78 | #else | |
79 | .mode = MUSB_PERIPHERAL, | |
80 | #endif | |
81 | .config = &musb_config_mt65xx, | |
82 | }; | |
83 | struct platform_device mt_device_usb = { | |
84 | .name = "mt_usb", | |
85 | .id = -1, //only one such device | |
86 | .dev = { | |
87 | .platform_data = &usb_data, | |
88 | .dma_mask = &usb_dmamask, | |
89 | .coherent_dma_mask = DMA_BIT_MASK(32), | |
90 | /*.release=musbfsh_hcd_release,*/ | |
91 | }, | |
92 | }; | |
93 | ||
94 | /*=======================================================================*/ | |
95 | /* MT6589 USB11 Host */ | |
96 | /*=======================================================================*/ | |
97 | #if defined(CONFIG_MTK_USBFSH) | |
98 | static u64 usb11_dmamask = DMA_BIT_MASK(32); | |
99 | extern void musbfsh_hcd_release (struct device *dev); | |
100 | ||
101 | static struct musbfsh_hdrc_config musbfsh_config_mt65xx = { | |
102 | .multipoint = false, | |
103 | .dyn_fifo = true, | |
104 | .soft_con = true, | |
105 | .dma = true, | |
106 | .num_eps = 16, | |
107 | .dma_channels = 8, | |
108 | }; | |
109 | static struct musbfsh_hdrc_platform_data usb_data_mt65xx = { | |
110 | .mode = 1, | |
111 | .config = &musbfsh_config_mt65xx, | |
112 | }; | |
113 | static struct platform_device mt_usb11_dev = { | |
114 | .name = "mt_usb11", | |
115 | .id = -1, | |
116 | .dev = { | |
117 | .platform_data = &usb_data_mt65xx, | |
118 | .dma_mask = &usb11_dmamask, | |
119 | .coherent_dma_mask = DMA_BIT_MASK(32), | |
120 | .release = musbfsh_hcd_release, | |
121 | }, | |
122 | }; | |
123 | #endif | |
124 | ||
125 | /*=======================================================================*/ | |
126 | /* MT6589 UART Ports */ | |
127 | /*=======================================================================*/ | |
128 | #if defined(CFG_DEV_UART1) | |
129 | static struct resource mtk_resource_uart1[] = { | |
130 | { | |
131 | .start = IO_VIRT_TO_PHYS(UART1_BASE), | |
132 | .end = IO_VIRT_TO_PHYS(UART1_BASE) + MTK_UART_SIZE - 1, | |
133 | .flags = IORESOURCE_MEM, | |
134 | }, | |
135 | { | |
136 | .start = MT_UART1_IRQ_ID, | |
137 | .flags = IORESOURCE_IRQ, | |
138 | }, | |
139 | }; | |
140 | #endif | |
141 | ||
142 | #if defined(CFG_DEV_UART2) | |
143 | static struct resource mtk_resource_uart2[] = { | |
144 | { | |
145 | .start = IO_VIRT_TO_PHYS(UART2_BASE), | |
146 | .end = IO_VIRT_TO_PHYS(UART2_BASE) + MTK_UART_SIZE - 1, | |
147 | .flags = IORESOURCE_MEM, | |
148 | }, | |
149 | { | |
150 | .start = MT_UART2_IRQ_ID, | |
151 | .flags = IORESOURCE_IRQ, | |
152 | }, | |
153 | }; | |
154 | #endif | |
155 | ||
156 | #if defined(CFG_DEV_UART3) | |
157 | static struct resource mtk_resource_uart3[] = { | |
158 | { | |
159 | .start = IO_VIRT_TO_PHYS(UART3_BASE), | |
160 | .end = IO_VIRT_TO_PHYS(UART3_BASE) + MTK_UART_SIZE - 1, | |
161 | .flags = IORESOURCE_MEM, | |
162 | }, | |
163 | { | |
164 | .start = MT_UART3_IRQ_ID, | |
165 | .flags = IORESOURCE_IRQ, | |
166 | }, | |
167 | }; | |
168 | #endif | |
169 | ||
170 | #if defined(CFG_DEV_UART4) | |
171 | static struct resource mtk_resource_uart4[] = { | |
172 | { | |
173 | .start = IO_VIRT_TO_PHYS(UART4_BASE), | |
174 | .end = IO_VIRT_TO_PHYS(UART4_BASE) + MTK_UART_SIZE - 1, | |
175 | .flags = IORESOURCE_MEM, | |
176 | }, | |
177 | { | |
178 | .start = MT_UART4_IRQ_ID, | |
179 | .flags = IORESOURCE_IRQ, | |
180 | }, | |
181 | }; | |
182 | #endif | |
183 | ||
184 | static struct platform_device mtk_device_btif = { | |
185 | .name = "mtk_btif", | |
186 | .id = -1, | |
187 | }; | |
188 | ||
189 | extern unsigned long max_pfn; | |
190 | #define RESERVED_MEM_MODEM (0x0) // do not reserve memory in advance, do it in mt_fixup | |
191 | #ifndef CONFIG_RESERVED_MEM_SIZE_FOR_PMEM | |
192 | #define CONFIG_RESERVED_MEM_SIZE_FOR_PMEM 1 | |
193 | #endif | |
194 | ||
195 | ||
196 | #if defined(CONFIG_MTK_FB) | |
197 | char temp_command_line[1024] = {0}; | |
198 | extern unsigned int DISP_GetVRamSizeBoot(char* cmdline); | |
199 | #define RESERVED_MEM_SIZE_FOR_FB (DISP_GetVRamSizeBoot((char*)&temp_command_line)) | |
200 | extern void mtkfb_set_lcm_inited(bool isLcmInited); | |
201 | #else | |
202 | #define RESERVED_MEM_SIZE_FOR_FB (0x400000) | |
203 | #endif | |
204 | ||
205 | /* | |
206 | * The memory size reserved for PMEM | |
207 | * | |
208 | * The size could be varied in different solutions. | |
209 | * The size is set in mt65xx_fixup function. | |
210 | * - MT8127 in develop should be 0x3600000 | |
211 | * - MT8127 SQC should be 0x0 | |
212 | */ | |
213 | resource_size_t RESERVED_MEM_SIZE_FOR_PMEM = 0x1700000; | |
214 | phys_addr_t pmem_start = 0x12345678; // pmem_start is inited in mt_fixup | |
215 | resource_size_t kernel_mem_sz = 0x0; // kernel_mem_sz is inited in mt_fixup | |
216 | resource_size_t RESERVED_MEM_SIZE_FOR_TEST_3D = 0x0; | |
217 | resource_size_t FB_SIZE_EXTERN = 0x0; | |
218 | resource_size_t RESERVED_MEM_SIZE_FOR_FB_MAX = 0x1500000; | |
219 | ||
220 | #define TOTAL_RESERVED_MEM_SIZE (RESERVED_MEM_SIZE_FOR_PMEM + \ | |
221 | RESERVED_MEM_SIZE_FOR_FB) | |
222 | ||
223 | #define MAX_PFN ((max_pfn << PAGE_SHIFT) + PHYS_OFFSET) | |
224 | ||
225 | #define PMEM_MM_START (pmem_start) | |
226 | #define PMEM_MM_SIZE (RESERVED_MEM_SIZE_FOR_PMEM) | |
227 | ||
228 | #define TEST_3D_START (PMEM_MM_START + PMEM_MM_SIZE) | |
229 | #define TEST_3D_SIZE (RESERVED_MEM_SIZE_FOR_TEST_3D) | |
230 | ||
231 | #define FB_START (TEST_3D_START + RESERVED_MEM_SIZE_FOR_TEST_3D) | |
232 | #define FB_SIZE (RESERVED_MEM_SIZE_FOR_FB) | |
233 | ||
234 | static struct platform_device mtk_device_uart[] = { | |
235 | ||
236 | #if defined(CFG_DEV_UART1) | |
237 | { | |
238 | .name = "mtk-uart", | |
239 | .id = 0, | |
240 | .num_resources = ARRAY_SIZE(mtk_resource_uart1), | |
241 | .resource = mtk_resource_uart1, | |
242 | }, | |
243 | #endif | |
244 | #if defined(CFG_DEV_UART2) | |
245 | { | |
246 | .name = "mtk-uart", | |
247 | .id = 1, | |
248 | .num_resources = ARRAY_SIZE(mtk_resource_uart2), | |
249 | .resource = mtk_resource_uart2, | |
250 | }, | |
251 | #endif | |
252 | #if defined(CFG_DEV_UART3) | |
253 | { | |
254 | .name = "mtk-uart", | |
255 | .id = 2, | |
256 | .num_resources = ARRAY_SIZE(mtk_resource_uart3), | |
257 | .resource = mtk_resource_uart3, | |
258 | }, | |
259 | #endif | |
260 | ||
261 | #if defined(CFG_DEV_UART4) | |
262 | { | |
263 | .name = "mtk-uart", | |
264 | .id = 3, | |
265 | .num_resources = ARRAY_SIZE(mtk_resource_uart4), | |
266 | .resource = mtk_resource_uart4, | |
267 | }, | |
268 | #endif | |
269 | }; | |
270 | //FIX-ME: marked for early porting | |
271 | #if defined(CONFIG_FIQ_DEBUGGER) | |
272 | extern void fiq_uart_fixup(int uart_port); | |
273 | extern struct platform_device mt_fiq_debugger; | |
274 | #endif | |
275 | ||
276 | /* ========================================================================= */ | |
277 | /* implementation of serial number attribute */ | |
278 | /* ========================================================================= */ | |
279 | #define to_sysinfo_attribute(x) container_of(x, struct sysinfo_attribute, attr) | |
280 | ||
281 | struct sysinfo_attribute{ | |
282 | struct attribute attr; | |
283 | ssize_t (*show)(char *buf); | |
284 | ssize_t (*store)(const char *buf, size_t count); | |
285 | }; | |
286 | ||
287 | static struct kobject sn_kobj; | |
288 | ||
289 | static ssize_t sn_show(char *buf){ | |
290 | return snprintf(buf, 4096, "%s\n", serial_number); | |
291 | } | |
292 | //[FEATURE]-Add-BEGIN by SCDTABLET.(meiqin),04/14/2015,modify SN | |
293 | static ssize_t sn_store(char *buf, size_t count){ | |
294 | memset(serial_number, 0,sizeof(serial_number)); | |
295 | memcpy(serial_number,buf,count); | |
296 | return count; | |
297 | } | |
298 | //[FEATURE]-Add-END by SCDTABLET.(meiqin) | |
299 | ||
300 | ||
301 | struct sysinfo_attribute sn_attr = { | |
302 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) | |
303 | .attr = {"serial_number", THIS_MODULE, 0644}, | |
304 | #else | |
305 | .attr = {"serial_number", 0644}, | |
306 | #endif | |
307 | .show = sn_show, | |
308 | //[FEATURE]-Mod-BEGIN by SCDTABLET.(meiqin),04/14/2015,modify SN | |
309 | .store = sn_store, | |
310 | //[FEATURE]-Mod-END by SCDTABLET.(meiqin) | |
311 | }; | |
312 | ||
313 | static ssize_t sysinfo_show(struct kobject *kobj, struct attribute *attr, char *buf) | |
314 | { | |
315 | struct sysinfo_attribute *sysinfo_attr = to_sysinfo_attribute(attr); | |
316 | ssize_t ret = -EIO; | |
317 | ||
318 | if(sysinfo_attr->show) | |
319 | ret = sysinfo_attr->show(buf); | |
320 | ||
321 | return ret; | |
322 | } | |
323 | ||
324 | static ssize_t sysinfo_store(struct kobject *kobj, struct attribute *attr, const char *buf, size_t count) | |
325 | { | |
326 | struct sysinfo_attribute *sysinfo_attr = to_sysinfo_attribute(attr); | |
327 | ssize_t ret = -EIO; | |
328 | ||
329 | if(sysinfo_attr->store) | |
330 | ret = sysinfo_attr->store(buf, count); | |
331 | ||
332 | return ret; | |
333 | } | |
334 | ||
335 | static struct sysfs_ops sn_sysfs_ops = { | |
336 | .show = sysinfo_show, | |
337 | .store = sysinfo_store | |
338 | }; | |
339 | ||
340 | static struct attribute *sn_attrs[] = { | |
341 | &sn_attr.attr, | |
342 | NULL | |
343 | }; | |
344 | ||
345 | static struct kobj_type sn_ktype = { | |
346 | .sysfs_ops = &sn_sysfs_ops, | |
347 | .default_attrs = sn_attrs | |
348 | }; | |
349 | ||
350 | #define HASH_ARRAY_SIZE 4 | |
351 | ||
352 | static char udc_chr[32] = {"ABCDEFGHIJKLMNOPQRSTUVWSYZ456789"}; | |
353 | int get_serial(uint64_t hwkey, uint32_t chipid, char ser[SERIALNO_LEN]) | |
354 | { | |
355 | uint16_t hashkey[HASH_ARRAY_SIZE]; | |
356 | int idx, ser_idx; | |
357 | uint32_t digit, id; | |
358 | uint64_t tmp = hwkey; | |
359 | ||
360 | memset(ser, 0x00, SERIALNO_LEN); | |
361 | ||
362 | /* split to 4 key with 16-bit width each */ | |
363 | tmp = hwkey; | |
364 | for (idx = 0; idx < HASH_ARRAY_SIZE; idx++) { | |
365 | hashkey[idx] = (uint16_t)(tmp & 0xffff); | |
366 | tmp >>= 16; | |
367 | } | |
368 | ||
369 | /* hash the key with chip id */ | |
370 | id = chipid; | |
371 | for (idx = 0; idx < HASH_ARRAY_SIZE; idx++) { | |
372 | digit = (id % 10); | |
373 | hashkey[idx] = (hashkey[idx] >> digit) | (hashkey[idx] << (16-digit)); | |
374 | id = (id / 10); | |
375 | } | |
376 | ||
377 | /* generate serail using hashkey */ | |
378 | ser_idx = 0; | |
379 | for (idx = 0; idx < HASH_ARRAY_SIZE; idx++) { | |
380 | ser[ser_idx++] = (hashkey[idx] & 0x001f); | |
381 | ser[ser_idx++] = (hashkey[idx] & 0x00f8) >> 3; | |
382 | ser[ser_idx++] = (hashkey[idx] & 0x1f00) >> 8; | |
383 | ser[ser_idx++] = (hashkey[idx] & 0xf800) >> 11; | |
384 | } | |
385 | for (idx = 0; idx < ser_idx; idx++) | |
386 | ser[idx] = udc_chr[(int)ser[idx]]; | |
387 | ser[ser_idx] = 0x00; | |
388 | return 0; | |
389 | } | |
390 | ||
391 | /*=======================================================================*/ | |
392 | /* MT8127 GPIO */ | |
393 | /*=======================================================================*/ | |
394 | struct platform_device gpio_dev = | |
395 | { | |
396 | .name = "mt-gpio", | |
397 | .id = -1, | |
398 | }; | |
399 | struct platform_device fh_dev = | |
400 | { | |
401 | .name = "mt-freqhopping", | |
402 | .id = -1, | |
403 | }; | |
404 | ||
405 | #if defined(CONFIG_SERIAL_AMBA_PL011) | |
406 | static struct amba_device uart1_device = | |
407 | { | |
408 | .dev = | |
409 | { | |
410 | .coherent_dma_mask = ~0, | |
411 | .init_name = "dev:f1", | |
412 | .platform_data = NULL, | |
413 | }, | |
414 | .res = | |
415 | { | |
416 | .start = 0xE01F1000, | |
417 | .end = 0xE01F1000 + SZ_4K - 1, | |
418 | .flags = IORESOURCE_MEM, | |
419 | }, | |
420 | .dma_mask = ~0, | |
421 | .irq = MT_UART1_IRQ_ID, | |
422 | }; | |
423 | #endif | |
424 | ||
425 | /*=======================================================================*/ | |
426 | /* MT8127 MSDC Hosts */ | |
427 | /*=======================================================================*/ | |
428 | #if defined(CFG_DEV_MSDC0) | |
429 | static struct resource mt_resource_msdc0[] = { | |
430 | { | |
431 | .start = IO_VIRT_TO_PHYS(MSDC_0_BASE), | |
432 | .end = IO_VIRT_TO_PHYS(MSDC_0_BASE) + 0x108, | |
433 | .flags = IORESOURCE_MEM, | |
434 | }, | |
435 | { | |
436 | .start = MT_MSDC0_IRQ_ID, | |
437 | .flags = IORESOURCE_IRQ, | |
438 | }, | |
439 | }; | |
440 | #endif | |
441 | ||
442 | #if defined(CFG_DEV_MSDC1) | |
443 | static struct resource mt_resource_msdc1[] = { | |
444 | { | |
445 | .start = IO_VIRT_TO_PHYS(MSDC_1_BASE), | |
446 | .end = IO_VIRT_TO_PHYS(MSDC_1_BASE) + 0x108, | |
447 | .flags = IORESOURCE_MEM, | |
448 | }, | |
449 | { | |
450 | .start = MT_MSDC1_IRQ_ID, | |
451 | .flags = IORESOURCE_IRQ, | |
452 | }, | |
453 | }; | |
454 | #endif | |
455 | ||
456 | #if defined(CFG_DEV_MSDC2) | |
457 | static struct resource mt_resource_msdc2[] = { | |
458 | { | |
459 | .start = IO_VIRT_TO_PHYS(MSDC_2_BASE), | |
460 | .end = IO_VIRT_TO_PHYS(MSDC_2_BASE) + 0x108, | |
461 | .flags = IORESOURCE_MEM, | |
462 | }, | |
463 | { | |
464 | .start = MT_MSDC2_IRQ_ID, | |
465 | //.start = MSDC2_IRQ_ID, | |
466 | .flags = IORESOURCE_IRQ, | |
467 | }, | |
468 | }; | |
469 | #endif | |
470 | ||
471 | #if defined(CFG_DEV_MSDC3) | |
472 | static struct resource mt_resource_msdc3[] = { | |
473 | { | |
474 | .start = IO_VIRT_TO_PHYS(MSDC_3_BASE), | |
475 | .end = IO_VIRT_TO_PHYS(MSDC_3_BASE) + 0x108, | |
476 | .flags = IORESOURCE_MEM, | |
477 | }, | |
478 | { | |
479 | .start = MT_MSDC3_IRQ_ID, | |
480 | .flags = IORESOURCE_IRQ, | |
481 | }, | |
482 | }; | |
483 | #endif | |
484 | #if defined(CFG_DEV_MSDC4) | |
485 | static struct resource mt_resource_msdc4[] = { | |
486 | { | |
487 | .start = IO_VIRT_TO_PHYS(MSDC_4_BASE), | |
488 | .end = IO_VIRT_TO_PHYS(MSDC_4_BASE) + 0x108, | |
489 | .flags = IORESOURCE_MEM, | |
490 | }, | |
491 | { | |
492 | .start = MT_MSDC4_IRQ_ID, | |
493 | .flags = IORESOURCE_IRQ, | |
494 | }, | |
495 | }; | |
496 | #endif | |
497 | ||
498 | #if defined(CONFIG_MTK_FB) | |
499 | static u64 mtkfb_dmamask = ~(u32)0; | |
500 | ||
501 | static struct resource resource_fb[] = { | |
502 | { | |
503 | .start = 0, /* Will be redefined later */ | |
504 | .end = 0, | |
505 | .flags = IORESOURCE_MEM | |
506 | } | |
507 | }; | |
508 | ||
509 | static struct platform_device mt6575_device_fb = { | |
510 | .name = "mtkfb", | |
511 | .id = 0, | |
512 | .num_resources = ARRAY_SIZE(resource_fb), | |
513 | .resource = resource_fb, | |
514 | .dev = { | |
515 | .dma_mask = &mtkfb_dmamask, | |
516 | .coherent_dma_mask = 0xffffffff, | |
517 | }, | |
518 | }; | |
519 | #endif | |
520 | ||
521 | #ifdef MTK_MULTIBRIDGE_SUPPORT | |
522 | static struct platform_device mtk_multibridge_dev = { | |
523 | .name = "multibridge", | |
524 | .id = 0, | |
525 | }; | |
526 | #endif | |
527 | #ifdef CONFIG_MTK_HDMI_SUPPORT | |
528 | static struct platform_device mtk_hdmi_dev = { | |
529 | .name = "hdmitx", | |
530 | .id = 0, | |
531 | }; | |
532 | #endif | |
533 | ||
534 | ||
535 | #ifdef MTK_MT8193_SUPPORT | |
536 | static struct platform_device mtk_ckgen_dev = { | |
537 | .name = "mt8193-ckgen", | |
538 | .id = 0, | |
539 | }; | |
540 | #endif | |
541 | ||
542 | ||
543 | #if defined (CONFIG_MTK_SPI) | |
544 | static struct resource mt_spi_resources[] = | |
545 | { | |
546 | [0]={ | |
547 | .start = IO_VIRT_TO_PHYS(SPI1_BASE), | |
548 | .end = IO_VIRT_TO_PHYS(SPI1_BASE) + 0x0028, | |
549 | .flags = IORESOURCE_MEM, | |
550 | }, | |
551 | [1]={ | |
552 | .start = MT6582_SPI1_IRQ_ID, | |
553 | .flags = IORESOURCE_IRQ, | |
554 | }, | |
555 | }; | |
556 | ||
557 | static struct platform_device mt_spi_device = { | |
558 | .name = "mt-spi", | |
559 | .num_resources = ARRAY_SIZE(mt_spi_resources), | |
560 | .resource=mt_spi_resources | |
561 | }; | |
562 | ||
563 | #endif | |
564 | ||
565 | ||
566 | #if defined(CONFIG_USB_MTK_ACM_TEMP) | |
567 | struct platform_device usbacm_temp_device = { | |
568 | .name ="USB_ACM_Temp_Driver", | |
569 | .id = -1, | |
570 | }; | |
571 | #endif | |
572 | ||
573 | #if defined(CONFIG_MTK_ACCDET) | |
574 | struct platform_device accdet_device = { | |
575 | .name ="Accdet_Driver", | |
576 | .id = -1, | |
577 | //.dev ={ | |
578 | //.release = accdet_dumy_release, | |
579 | //} | |
580 | }; | |
581 | #endif | |
582 | ||
583 | #if defined(MTK_TVOUT_SUPPORT) | |
584 | ||
585 | static struct resource mt6575_TVOUT_resource[] = { | |
586 | [0] = {//TVC | |
587 | .start = TVC_BASE, | |
588 | .end = TVC_BASE + 0x78, | |
589 | .flags = IORESOURCE_MEM, | |
590 | }, | |
591 | [1] = {//TVR | |
592 | .start = TV_ROT_BASE, | |
593 | .end = TV_ROT_BASE + 0x378, | |
594 | .flags = IORESOURCE_MEM, | |
595 | }, | |
596 | [2] = {//TVE | |
597 | .start = TVE_BASE, | |
598 | .end = TVE_BASE + 0x84, | |
599 | .flags = IORESOURCE_MEM, | |
600 | }, | |
601 | }; | |
602 | ||
603 | static u64 mt6575_TVOUT_dmamask = ~(u32)0; | |
604 | ||
605 | static struct platform_device mt6575_TVOUT_dev = { | |
606 | .name = "TV-out", | |
607 | .id = 0, | |
608 | .num_resources = ARRAY_SIZE(mt6575_TVOUT_resource), | |
609 | .resource = mt6575_TVOUT_resource, | |
610 | .dev = { | |
611 | .dma_mask = &mt6575_TVOUT_dmamask, | |
612 | .coherent_dma_mask = 0xffffffffUL | |
613 | } | |
614 | }; | |
615 | #endif | |
616 | static struct platform_device mt_device_msdc[] = | |
617 | { | |
618 | #if defined(CFG_DEV_MSDC0) | |
619 | { | |
620 | .name = "mtk-msdc", | |
621 | .id = 0, | |
622 | .num_resources = ARRAY_SIZE(mt_resource_msdc0), | |
623 | .resource = mt_resource_msdc0, | |
624 | .dev = { | |
625 | .platform_data = &msdc0_hw, | |
626 | }, | |
627 | }, | |
628 | #endif | |
629 | #if defined(CFG_DEV_MSDC1) | |
630 | { | |
631 | .name = "mtk-msdc", | |
632 | .id = 1, | |
633 | .num_resources = ARRAY_SIZE(mt_resource_msdc1), | |
634 | .resource = mt_resource_msdc1, | |
635 | .dev = { | |
636 | .platform_data = &msdc1_hw, | |
637 | }, | |
638 | }, | |
639 | #endif | |
640 | #if defined(CFG_DEV_MSDC2) | |
641 | { | |
642 | .name = "mtk-msdc", | |
643 | .id = 2, | |
644 | .num_resources = ARRAY_SIZE(mt_resource_msdc2), | |
645 | .resource = mt_resource_msdc2, | |
646 | .dev = { | |
647 | .platform_data = &msdc2_hw, | |
648 | }, | |
649 | }, | |
650 | #endif | |
651 | #if defined(CFG_DEV_MSDC3) | |
652 | { | |
653 | .name = "mtk-msdc", | |
654 | .id = 3, | |
655 | .num_resources = ARRAY_SIZE(mt_resource_msdc3), | |
656 | .resource = mt_resource_msdc3, | |
657 | .dev = { | |
658 | .platform_data = &msdc3_hw, | |
659 | }, | |
660 | }, | |
661 | #endif | |
662 | #if defined(CFG_DEV_MSDC4) | |
663 | { | |
664 | .name = "mtk-msdc", | |
665 | .id = 4, | |
666 | .num_resources = ARRAY_SIZE(mt_resource_msdc4), | |
667 | .resource = mt_resource_msdc4, | |
668 | .dev = { | |
669 | .platform_data = &msdc4_hw, | |
670 | }, | |
671 | }, | |
672 | #endif | |
673 | ||
674 | }; | |
675 | ||
676 | /*=======================================================================*/ | |
677 | /* MT6575 Keypad */ | |
678 | /*=======================================================================*/ | |
679 | #ifdef CONFIG_MTK_KEYPAD | |
680 | static struct platform_device kpd_pdev = { | |
681 | .name = "mtk-kpd", | |
682 | .id = -1, | |
683 | }; | |
684 | #endif | |
685 | ||
686 | #ifdef CONFIG_RFKILL | |
687 | /*=======================================================================*/ | |
688 | /* MT6589 RFKill module (BT and WLAN) */ | |
689 | /*=======================================================================*/ | |
690 | /* MT66xx RFKill BT */ | |
691 | struct platform_device mt_rfkill_device = { | |
692 | .name = "mt-rfkill", | |
693 | .id = -1, | |
694 | }; | |
695 | #endif | |
696 | ||
697 | /*=======================================================================*/ | |
698 | /* HID Keyboard add by zhangsg */ | |
699 | /*=======================================================================*/ | |
700 | ||
701 | #if defined(CONFIG_KEYBOARD_HID) | |
702 | static struct platform_device mt_hid_dev = { | |
703 | .name = "hid-keyboard", | |
704 | .id = -1, | |
705 | }; | |
706 | #endif | |
707 | ||
708 | /*=======================================================================*/ | |
709 | /* UIBC input device, add by Seraph */ | |
710 | /*=======================================================================*/ | |
711 | ||
712 | #if defined(CONFIG_MTK_WFD_SUPPORT) | |
713 | static struct platform_device mt_uibc_dev = { | |
714 | .name = "uibc", | |
715 | .id = -1, | |
716 | }; | |
717 | #endif | |
718 | ||
719 | /*=======================================================================*/ | |
720 | /* MT6575 Touch Panel */ | |
721 | /*=======================================================================*/ | |
722 | static struct platform_device mtk_tpd_dev = { | |
723 | .name = "mtk-tpd", | |
724 | .id = -1, | |
725 | }; | |
726 | ||
727 | /*=======================================================================*/ | |
728 | /* MT6575 ofn */ | |
729 | /*=======================================================================*/ | |
730 | #if defined(CUSTOM_KERNEL_OFN) | |
731 | static struct platform_device ofn_driver = | |
732 | { | |
733 | .name = "mtofn", | |
734 | .id = -1, | |
735 | }; | |
736 | #endif | |
737 | ||
738 | /*=======================================================================*/ | |
739 | /* CPUFreq */ | |
740 | /*=======================================================================*/ | |
741 | #ifdef CONFIG_CPU_FREQ | |
742 | static struct platform_device cpufreq_pdev = { | |
743 | .name = "mt-cpufreq", | |
744 | .id = -1, | |
745 | }; | |
746 | #endif | |
747 | ||
748 | /*=======================================================================*/ | |
749 | /* MT6575 Thermal Controller module */ | |
750 | /*=======================================================================*/ | |
751 | struct platform_device thermal_pdev = { | |
752 | .name = "mtk-thermal", | |
753 | .id = -1, | |
754 | }; | |
755 | ||
756 | #if 1 | |
757 | struct platform_device mtk_therm_mon_pdev = { | |
758 | .name = "mtk-therm-mon", | |
759 | .id = -1, | |
760 | }; | |
761 | #endif | |
762 | ||
763 | /*=======================================================================*/ | |
764 | /* PTPOD */ | |
765 | /*=======================================================================*/ | |
766 | struct platform_device ptp_pdev = { | |
767 | .name = "mt-ptp", | |
768 | .id = -1, | |
769 | }; | |
770 | ||
771 | /*=======================================================================*/ | |
772 | /* MT6589 SPM-MCDI module */ | |
773 | /*=======================================================================*/ | |
774 | struct platform_device spm_mcdi_pdev = { | |
775 | .name = "mtk-spm-mcdi", | |
776 | .id = -1, | |
777 | }; | |
778 | ||
779 | /*=======================================================================*/ | |
780 | /* MT6589 USIF-DUMCHAR */ | |
781 | /*=======================================================================*/ | |
782 | ||
783 | static struct platform_device dummychar_device = | |
784 | { | |
785 | .name = "dummy_char", | |
786 | .id = 0, | |
787 | }; | |
788 | ||
789 | /*=======================================================================*/ | |
790 | /* MASP */ | |
791 | /*=======================================================================*/ | |
792 | static struct platform_device masp_device = | |
793 | { | |
794 | .name = "masp", | |
795 | .id = -1, | |
796 | }; | |
797 | ||
798 | ||
799 | /*=======================================================================*/ | |
800 | /* MT6589 NAND */ | |
801 | /*=======================================================================*/ | |
802 | #if defined(CONFIG_MTK_MTD_NAND) | |
803 | #define NFI_base NFI_BASE//0x80032000 | |
804 | #define NFIECC_base NFIECC_BASE//0x80038000 | |
805 | static struct resource mtk_resource_nand[] = { | |
806 | { | |
807 | .start = IO_VIRT_TO_PHYS(NFI_base), | |
808 | .end = IO_VIRT_TO_PHYS(NFI_base) + 0x1A0, | |
809 | .flags = IORESOURCE_MEM, | |
810 | }, | |
811 | { | |
812 | .start = IO_VIRT_TO_PHYS(NFIECC_base), | |
813 | .end = IO_VIRT_TO_PHYS(NFIECC_base) + 0x150, | |
814 | .flags = IORESOURCE_MEM, | |
815 | }, | |
816 | { | |
817 | .start = MT_NFI_IRQ_ID, | |
818 | .flags = IORESOURCE_IRQ, | |
819 | }, | |
820 | { | |
821 | .start = MT_NFIECC_IRQ_ID, | |
822 | .flags = IORESOURCE_IRQ, | |
823 | }, | |
824 | }; | |
825 | ||
826 | static struct platform_device mtk_nand_dev = { | |
827 | .name = "mtk-nand", | |
828 | .id = 0, | |
829 | .num_resources = ARRAY_SIZE(mtk_resource_nand), | |
830 | .resource = mtk_resource_nand, | |
831 | .dev = { | |
832 | .platform_data = &mtk_nand_hw, | |
833 | }, | |
834 | }; | |
835 | #endif | |
836 | ||
837 | /*=======================================================================*/ | |
838 | /* AUDIO */ | |
839 | /*=======================================================================*/ | |
840 | #if defined(CONFIG_MTK_SOUND) | |
841 | static u64 AudDrv_dmamask = 0xffffffffUL; | |
842 | static struct platform_device AudDrv_device = { | |
843 | .name = "AudDrv_driver_device", | |
844 | .id = 0, | |
845 | .dev = { | |
846 | .dma_mask = &AudDrv_dmamask, | |
847 | .coherent_dma_mask = 0xffffffffUL | |
848 | } | |
849 | }; | |
850 | ||
851 | static u64 AudDrv_btcvsd_dmamask = 0xffffffffUL; | |
852 | static struct platform_device AudDrv_device2 = { | |
853 | .name = "AudioMTKBTCVSD", | |
854 | .id = 0, | |
855 | .dev = { | |
856 | .dma_mask = &AudDrv_btcvsd_dmamask, | |
857 | .coherent_dma_mask = 0xffffffffUL | |
858 | } | |
859 | }; | |
860 | #endif /* CONFIG_MTK_SOUND */ | |
861 | ||
862 | #if defined(CONFIG_SND_SOC_MT8127) | |
863 | static struct platform_device mtk_soc_dl1_pcm_device = { | |
864 | .name = "mt-soc-dl1-pcm", | |
865 | .id = PLATFORM_DEVID_NONE, | |
866 | }; | |
867 | ||
868 | static struct platform_device mtk_soc_ul1_pcm_device = { | |
869 | .name = "mt-soc-ul1-pcm", | |
870 | .id = PLATFORM_DEVID_NONE, | |
871 | }; | |
872 | ||
873 | static struct platform_device mtk_soc_pmic_codec_device = { | |
874 | .name = "mt-soc-codec", | |
875 | .id = PLATFORM_DEVID_NONE, | |
876 | }; | |
877 | ||
878 | static struct platform_device mtk_soc_stub_dai_device = { | |
879 | .name = "mt-soc-dai-driver", | |
880 | .id = PLATFORM_DEVID_NONE, | |
881 | }; | |
882 | ||
883 | static struct platform_device mtk_soc_stub_codec_device = { | |
884 | .name = "mt-soc-codec-stub", | |
885 | .id = PLATFORM_DEVID_NONE, | |
886 | }; | |
887 | ||
888 | static struct platform_device mtk_soc_btsco_pcm_device = { | |
889 | .name = "mt-soc-btsco-pcm", | |
890 | .id = PLATFORM_DEVID_NONE, | |
891 | }; | |
892 | ||
893 | static struct platform_device mtk_soc_routing_pcm_device = { | |
894 | .name = "mt-soc-routing-pcm", | |
895 | .id = PLATFORM_DEVID_NONE, | |
896 | }; | |
897 | ||
898 | static struct platform_device mtk_soc_hdmi_pcm_device = { | |
899 | .name = "mt-soc-hdmi-pcm", | |
900 | .id = PLATFORM_DEVID_NONE, | |
901 | }; | |
902 | ||
903 | static struct platform_device mtk_soc_hdmi_dai_device = { | |
904 | .name = "mt-audio-hdmi", | |
905 | .id = PLATFORM_DEVID_NONE, | |
906 | }; | |
907 | ||
908 | //static struct mt_audio_platform_data audio_platform_data; | |
909 | ||
910 | static struct platform_device mtk_soc_machine_device = { | |
911 | .name = "mt-soc-machine", | |
912 | .id = PLATFORM_DEVID_NONE, | |
913 | .dev = { | |
914 | //.platform_data = &audio_platform_data, | |
915 | .coherent_dma_mask = DMA_BIT_MASK(32), | |
916 | }, | |
917 | }; | |
918 | ||
919 | static struct platform_device *mtk_soc_audio_devices[] __initdata = { | |
920 | &mtk_soc_dl1_pcm_device, | |
921 | &mtk_soc_ul1_pcm_device, | |
922 | &mtk_soc_pmic_codec_device, | |
923 | &mtk_soc_stub_dai_device, | |
924 | &mtk_soc_stub_codec_device, | |
925 | &mtk_soc_btsco_pcm_device, | |
926 | &mtk_soc_routing_pcm_device, | |
927 | &mtk_soc_hdmi_pcm_device, | |
928 | &mtk_soc_hdmi_dai_device, | |
929 | &mtk_soc_machine_device, | |
930 | }; | |
931 | #endif /* CONFIG_SND_SOC_MT8127 */ | |
932 | ||
933 | ||
934 | /*=======================================================================*/ | |
935 | /* MTK I2C */ | |
936 | /*=======================================================================*/ | |
937 | //static struct i2c_board_info __initdata i2c_devs0[]={ | |
938 | // { I2C_BOARD_INFO("ADXL345", 0x53),}, | |
939 | // { I2C_BOARD_INFO("A320", 0x57),}, | |
940 | // { I2C_BOARD_INFO("ami304", (0x1E>>1)),},//0x1E>>1 | |
941 | // { I2C_BOARD_INFO("CM3623", (0x92>>1)),},//0x92>>1 | |
942 | // { I2C_BOARD_INFO("MPU3000", (0xD0>>1)),},//0xD0>>1 | |
943 | // { I2C_BOARD_INFO("mtk-tpd", (0xBA>>1)),}, | |
944 | //}; | |
945 | //static struct i2c_board_info __initdata i2c_devs1[]={ | |
946 | // { I2C_BOARD_INFO("kd_camera_hw", 0xfe), }, | |
947 | // { I2C_BOARD_INFO("FM50AF", 0x18), }, | |
948 | // { I2C_BOARD_INFO("dummy_eeprom", 0xA0),}, | |
949 | // { I2C_BOARD_INFO("EEPROM_S24CS64A", 0xAA),}, | |
950 | // {}, | |
951 | //}; | |
952 | //static struct i2c_board_info __initdata i2c_devs2[]={ | |
953 | //#ifndef CONFIG_MT8127_FPGA | |
954 | // { I2C_BOARD_INFO("mt6329_pmic", 0x60), }, | |
955 | //#endif //End of CONFIG_MT8127_FPGA | |
956 | // { I2C_BOARD_INFO("mt6329_pmic_bank1", 0x61), }, | |
957 | //}; | |
958 | static struct resource mt_resource_i2c0[] = { | |
959 | { | |
960 | .start = IO_VIRT_TO_PHYS(I2C0_BASE), | |
961 | .end = IO_VIRT_TO_PHYS(I2C0_BASE) + 0x70, | |
962 | .flags = IORESOURCE_MEM, | |
963 | }, | |
964 | { | |
965 | .start = MT_I2C0_IRQ_ID, | |
966 | .flags = IORESOURCE_IRQ, | |
967 | }, | |
968 | }; | |
969 | ||
970 | static struct resource mt_resource_i2c1[] = { | |
971 | { | |
972 | .start = IO_VIRT_TO_PHYS(I2C1_BASE), | |
973 | .end = IO_VIRT_TO_PHYS(I2C1_BASE) + 0x70, | |
974 | .flags = IORESOURCE_MEM, | |
975 | }, | |
976 | { | |
977 | .start = MT_I2C1_IRQ_ID, | |
978 | .flags = IORESOURCE_IRQ, | |
979 | }, | |
980 | }; | |
981 | ||
982 | static struct resource mt_resource_i2c2[] = { | |
983 | { | |
984 | .start = IO_VIRT_TO_PHYS(I2C2_BASE), | |
985 | .end = IO_VIRT_TO_PHYS(I2C2_BASE) + 0x70, | |
986 | .flags = IORESOURCE_MEM, | |
987 | }, | |
988 | { | |
989 | .start = MT_I2C2_IRQ_ID, | |
990 | .flags = IORESOURCE_IRQ, | |
991 | }, | |
992 | }; | |
993 | ||
994 | static struct platform_device mt_device_i2c[] = { | |
995 | { | |
996 | .name = "mt-i2c", | |
997 | .id = 0, | |
998 | .num_resources = ARRAY_SIZE(mt_resource_i2c0), | |
999 | .resource = mt_resource_i2c0, | |
1000 | }, | |
1001 | { | |
1002 | .name = "mt-i2c", | |
1003 | .id = 1, | |
1004 | .num_resources = ARRAY_SIZE(mt_resource_i2c1), | |
1005 | .resource = mt_resource_i2c1, | |
1006 | }, | |
1007 | { | |
1008 | .name = "mt-i2c", | |
1009 | .id = 2, | |
1010 | .num_resources = ARRAY_SIZE(mt_resource_i2c2), | |
1011 | .resource = mt_resource_i2c2, | |
1012 | }, | |
1013 | ||
1014 | }; | |
1015 | ||
1016 | ||
1017 | ||
1018 | static u64 mtk_smi_dmamask = ~(u32)0; | |
1019 | ||
1020 | static struct platform_device mtk_smi_dev = { | |
1021 | .name = "MTK_SMI", | |
1022 | .id = 0, | |
1023 | .dev = { | |
1024 | .dma_mask = &mtk_smi_dmamask, | |
1025 | .coherent_dma_mask = 0xffffffffUL | |
1026 | } | |
1027 | }; | |
1028 | ||
1029 | static u64 mtk_m4u_dmamask = ~(u32)0; | |
1030 | ||
1031 | static struct platform_device mtk_m4u_dev = { | |
1032 | .name = "M4U_device", | |
1033 | .id = 0, | |
1034 | .dev = { | |
1035 | .dma_mask = &mtk_m4u_dmamask, | |
1036 | .coherent_dma_mask = 0xffffffffUL | |
1037 | } | |
1038 | }; | |
1039 | ||
1040 | ||
1041 | /*=======================================================================*/ | |
1042 | /* MT6573 GPS module */ | |
1043 | /*=======================================================================*/ | |
1044 | /* MT3326 GPS */ | |
1045 | #ifdef CONFIG_MTK_GPS | |
1046 | struct platform_device mt3326_device_gps = { | |
1047 | .name = "mt3326-gps", | |
1048 | .id = -1, | |
1049 | .dev = { | |
1050 | .platform_data = &mt3326_gps_hw, | |
1051 | }, | |
1052 | }; | |
1053 | #endif | |
1054 | ||
1055 | /*=======================================================================*/ | |
1056 | /* MT6573 PMEM */ | |
1057 | /*=======================================================================*/ | |
1058 | #if defined(CONFIG_ANDROID_PMEM) | |
1059 | static struct android_pmem_platform_data pdata_multimedia = { | |
1060 | .name = "pmem_multimedia", | |
1061 | .no_allocator = 0, | |
1062 | .cached = 1, | |
1063 | .buffered = 1 | |
1064 | }; | |
1065 | ||
1066 | static struct platform_device pmem_multimedia_device = { | |
1067 | .name = "android_pmem", | |
1068 | .id = 1, | |
1069 | .dev = { .platform_data = &pdata_multimedia } | |
1070 | }; | |
1071 | #endif | |
1072 | ||
1073 | #if defined(CONFIG_ANDROID_VMEM) | |
1074 | static struct android_vmem_platform_data pdata_vmultimedia = { | |
1075 | .name = "vmem_multimedia", | |
1076 | .no_allocator = 0, | |
1077 | .cached = 1, | |
1078 | .buffered = 1 | |
1079 | }; | |
1080 | ||
1081 | static struct platform_device vmem_multimedia_device = { | |
1082 | .name = "android_vmem", | |
1083 | .id = -1, | |
1084 | .dev = { .platform_data = &pdata_vmultimedia } | |
1085 | }; | |
1086 | #endif | |
1087 | ||
1088 | /*=======================================================================*/ | |
1089 | /* MT6575 SYSRAM */ | |
1090 | /*=======================================================================*/ | |
1091 | static struct platform_device camera_sysram_dev = { | |
1092 | .name = "camera-sysram", /* FIXME. Sync to driver, init.rc, MHAL */ | |
1093 | .id = 0, | |
1094 | }; | |
1095 | ||
1096 | /*=======================================================================*/ | |
1097 | /*=======================================================================*/ | |
1098 | /* Commandline filter */ | |
1099 | /* This function is used to filter undesired command passed from LK */ | |
1100 | /*=======================================================================*/ | |
1101 | static void cmdline_filter(struct tag *cmdline_tag, char *default_cmdline) | |
1102 | { | |
1103 | const char *undesired_cmds[] = { | |
1104 | "console=", | |
1105 | "root=", | |
1106 | "lk_t=", | |
1107 | "pl_t=", | |
1108 | }; | |
1109 | ||
1110 | int i; | |
1111 | int ck_f = 0; | |
1112 | char *cs,*ce; | |
1113 | ||
1114 | cs = cmdline_tag->u.cmdline.cmdline; | |
1115 | ce = cs; | |
1116 | while((__u32)ce < (__u32)tag_next(cmdline_tag)) { | |
1117 | ||
1118 | while(*cs == ' ' || *cs == '\0') { | |
1119 | cs++; | |
1120 | ce = cs; | |
1121 | } | |
1122 | ||
1123 | if (*ce == ' ' || *ce == '\0') { | |
1124 | for (i = 0; i < sizeof(undesired_cmds)/sizeof(char *); i++){ | |
1125 | if (memcmp(cs, undesired_cmds[i], strlen(undesired_cmds[i])) == 0) { | |
1126 | ck_f = 1; | |
1127 | break; | |
1128 | } | |
1129 | } | |
1130 | ||
1131 | if(ck_f == 0){ | |
1132 | *ce = '\0'; | |
1133 | //Append to the default command line | |
1134 | strcat(default_cmdline, " "); | |
1135 | strcat(default_cmdline, cs); | |
1136 | } | |
1137 | ck_f = 0; | |
1138 | cs = ce + 1; | |
1139 | } | |
1140 | ce++; | |
1141 | } | |
1142 | if (strlen(default_cmdline) >= COMMAND_LINE_SIZE) | |
1143 | { | |
1144 | panic("Command line length is too long.\n\r"); | |
1145 | } | |
1146 | } | |
1147 | /*=======================================================================*/ | |
1148 | /* Parse the framebuffer info */ | |
1149 | /*=======================================================================*/ | |
1150 | static int __init parse_tag_videofb_fixup(const struct tag *tags) | |
1151 | { | |
1152 | bl_fb.base = tags->u.videolfb.lfb_base; | |
1153 | bl_fb.size = tags->u.videolfb.lfb_size; | |
1154 | use_bl_fb++; | |
1155 | return 0; | |
1156 | } | |
1157 | ||
1158 | static int __init parse_tag_devinfo_data_fixup(const struct tag *tags) | |
1159 | { | |
1160 | int i=0; | |
1161 | int size = tags->u.devinfo_data.devinfo_data_size; | |
1162 | for (i=0;i<size;i++){ | |
1163 | g_devinfo_data[i] = tags->u.devinfo_data.devinfo_data[i]; | |
1164 | } | |
1165 | ||
1166 | /* print chip id for debugging purpose */ | |
1167 | printk("tag_devinfo_data_rid, index[%d]:0x%x\n", 12,g_devinfo_data[12]); | |
1168 | printk("tag_devinfo_data size:%d\n", size); | |
1169 | g_devinfo_data_size = size; | |
1170 | return 0; | |
1171 | } | |
1172 | ||
4b9e9796 | 1173 | #if 0//#ifdef CONFIG_MTK_MTD_NAND |
6fa3eb70 S |
1174 | int __init parse_tag_partition_fixup(const struct tag *tags) |
1175 | { | |
1176 | ||
1177 | if(tags->hdr.tag == ATAG_OTP_INFO) | |
1178 | { | |
1179 | otp_info.size = tags->u.tag_pt_info.size; | |
1180 | otp_info.start_address = tags->u.tag_pt_info.start_address; | |
1181 | } | |
1182 | if(tags->hdr.tag == ATAG_BMT_INFO) | |
1183 | { | |
1184 | bmt_info.size = tags->u.tag_pt_info.size; | |
1185 | bmt_info.start_address = tags->u.tag_pt_info.start_address; | |
1186 | } | |
1187 | return 0; | |
1188 | } | |
1189 | ||
1190 | int __init parse_tag_flashnum_fixup(const struct tag *tags) | |
1191 | { | |
1192 | ||
1193 | flash_number = tags->u.tag_nand_number.number; | |
1194 | //gen_FlashTable_p = (flashdev_info_t*) kzalloc(flash_number*sizeof(flashdev_info_t), GFP_KERNEL); | |
1195 | gen_FlashTable_ptr = gen_FlashTable_p; | |
1196 | return 0; | |
1197 | } | |
1198 | ||
1199 | int __init parse_tag_flash_fixup(const struct tag *tags) | |
1200 | { | |
1201 | int* p = (int*)&tags->u.gen_FlashTable_p; | |
1202 | int i; | |
1203 | memcpy(gen_FlashTable_ptr, &tags->u.gen_FlashTable_p, sizeof(flashdev_info_t)); | |
1204 | gen_FlashTable_ptr++; | |
1205 | return 0; | |
1206 | } | |
1207 | #endif | |
1208 | ||
1209 | extern unsigned int mtkfb_parse_dfo_setting(void *dfo_tbl, int num); | |
1210 | ||
1211 | resource_size_t bl_mem_sz = 0; | |
1212 | void mt_fixup(struct tag *tags, char **cmdline, struct meminfo *mi) | |
1213 | { | |
1214 | struct tag *cmdline_tag = NULL; | |
1215 | struct tag *reserved_mem_bank_tag = NULL; | |
1216 | struct tag *none_tag = NULL; | |
1217 | ||
1218 | resource_size_t max_limit_size = CONFIG_MAX_DRAM_SIZE_SUPPORT - | |
1219 | RESERVED_MEM_MODEM; | |
1220 | resource_size_t avail_dram = 0; | |
1221 | unsigned char md_inf_from_meta[4] = {0}; | |
1222 | #ifdef CONFIG_MTK_TABLET_HARDWARE | |
1223 | struct machine_desc *mdesc = NULL; | |
1224 | #endif | |
1225 | ||
1226 | #if defined(CONFIG_MTK_FB) | |
1227 | struct tag *temp_tags = tags; | |
1228 | for (; temp_tags->hdr.size; temp_tags = tag_next(temp_tags)) | |
1229 | { | |
1230 | if(temp_tags->hdr.tag == ATAG_CMDLINE) | |
1231 | cmdline_filter(temp_tags, (char*)&temp_command_line); | |
1232 | } | |
1233 | #endif | |
1234 | ||
1235 | printk(KERN_ALERT"Load default dfo data...\n"); | |
1236 | ||
1237 | parse_ccci_dfo_setting(&dfo_boot_default, DFO_BOOT_COUNT); | |
1238 | parse_eemcs_dfo_setting(&dfo_boot_default, DFO_BOOT_COUNT); | |
1239 | ||
1240 | for (; tags->hdr.size; tags = tag_next(tags)) { | |
1241 | if (tags->hdr.tag == ATAG_MEM) { | |
1242 | bl_mem_sz += tags->u.mem.size; | |
1243 | ||
1244 | /* | |
1245 | * Modify the memory tag to limit available memory to | |
1246 | * CONFIG_MAX_DRAM_SIZE_SUPPORT | |
1247 | */ | |
1248 | if (max_limit_size > 0) { | |
1249 | if (max_limit_size >= tags->u.mem.size) { | |
1250 | max_limit_size -= tags->u.mem.size; | |
1251 | avail_dram += tags->u.mem.size; | |
1252 | } else { | |
1253 | tags->u.mem.size = max_limit_size; | |
1254 | avail_dram += max_limit_size; | |
1255 | max_limit_size = 0; | |
1256 | } | |
1257 | // By Keene: | |
1258 | // remove this check to avoid calcuate pmem size before we know all dram size | |
1259 | // Assuming the minimum size of memory bank is 256MB | |
1260 | //if (tags->u.mem.size >= (TOTAL_RESERVED_MEM_SIZE)) { | |
1261 | reserved_mem_bank_tag = tags; | |
1262 | //} | |
1263 | } else { | |
1264 | tags->u.mem.size = 0; | |
1265 | } | |
1266 | } | |
1267 | else if (tags->hdr.tag == ATAG_CMDLINE) { | |
1268 | cmdline_tag = tags; | |
1269 | } else if (tags->hdr.tag == ATAG_BOOT) { | |
1270 | g_boot_mode = tags->u.boot.bootmode; | |
1271 | } else if (tags->hdr.tag == ATAG_VIDEOLFB) { | |
1272 | parse_tag_videofb_fixup(tags); | |
1273 | }else if (tags->hdr.tag == ATAG_DEVINFO_DATA){ | |
1274 | parse_tag_devinfo_data_fixup(tags); | |
1275 | } | |
1276 | else if(tags->hdr.tag == ATAG_META_COM) | |
1277 | { | |
1278 | g_meta_com_type = tags->u.meta_com.meta_com_type; | |
1279 | g_meta_com_id = tags->u.meta_com.meta_com_id; | |
1280 | } //FIXME_8127 | |
4b9e9796 | 1281 | #if 0//#ifdef CONFIG_MTK_MTD_NAND |
6fa3eb70 S |
1282 | else if(tags->hdr.tag == ATAG_OTP_INFO) |
1283 | { | |
1284 | parse_tag_partition_fixup(tags); | |
1285 | } | |
1286 | else if(tags->hdr.tag == ATAG_BMT_INFO) | |
1287 | { | |
1288 | parse_tag_partition_fixup(tags); | |
1289 | } | |
1290 | ||
1291 | else if(tags->hdr.tag == ATAG_FLASH_NUMBER_INFO) | |
1292 | { | |
1293 | parse_tag_flashnum_fixup(tags); | |
1294 | } | |
1295 | else if(tags->hdr.tag == ATAG_FLASH_INFO) | |
1296 | { | |
1297 | parse_tag_flash_fixup(tags); | |
1298 | } | |
1299 | #endif | |
1300 | /*else if (tags->hdr.tag == ATAG_DFO_DATA) { | |
1301 | parse_ccci_dfo_setting(&tags->u.dfo_data, DFO_BOOT_COUNT); | |
1302 | parse_eemcs_dfo_setting(&tags->u.dfo_data, DFO_BOOT_COUNT); | |
1303 | mtkfb_parse_dfo_setting(&tags->u.dfo_data, DFO_BOOT_COUNT); | |
1304 | }*/ | |
1305 | else if(tags->hdr.tag == ATAG_MDINFO_DATA) { | |
1306 | printk(KERN_ALERT "Get MD inf from META\n"); | |
1307 | printk(KERN_ALERT "md_inf[0]=%d\n",tags->u.mdinfo_data.md_type[0]); | |
1308 | printk(KERN_ALERT "md_inf[1]=%d\n",tags->u.mdinfo_data.md_type[1]); | |
1309 | printk(KERN_ALERT "md_inf[2]=%d\n",tags->u.mdinfo_data.md_type[2]); | |
1310 | printk(KERN_ALERT "md_inf[3]=%d\n",tags->u.mdinfo_data.md_type[3]); | |
1311 | md_inf_from_meta[0]=tags->u.mdinfo_data.md_type[0]; | |
1312 | md_inf_from_meta[1]=tags->u.mdinfo_data.md_type[1]; | |
1313 | md_inf_from_meta[2]=tags->u.mdinfo_data.md_type[2]; | |
1314 | md_inf_from_meta[3]=tags->u.mdinfo_data.md_type[3]; | |
1315 | } | |
1316 | } | |
1317 | #ifdef CONFIG_MTK_TABLET_HARDWARE | |
1318 | for_each_machine_desc(mdesc) | |
1319 | if (8127 == mdesc->nr) | |
1320 | break; | |
1321 | ||
1322 | if (mdesc) | |
1323 | { | |
1324 | unsigned int i = get_devinfo_with_index(3); | |
1325 | unsigned int j = get_devinfo_with_index(15); | |
1326 | ||
1327 | if (j & (1 << 31)) | |
1328 | { | |
1329 | if (i & (1 << 13)) | |
1330 | strcpy((void *)mdesc->name, "MT8680"); | |
1331 | else | |
1332 | strcpy((void *)mdesc->name, "MT8685"); | |
1333 | } | |
1334 | else | |
1335 | { | |
1336 | switch ((i >> 24) & 0xF) | |
1337 | { | |
1338 | case 0x0: | |
1339 | strcpy((void *)mdesc->name, "MT8127"); | |
1340 | break; | |
1341 | default: | |
1342 | strcpy((void *)mdesc->name, "MT8117"); | |
1343 | break; | |
1344 | } | |
1345 | } | |
1346 | } | |
1347 | #endif | |
1348 | ||
1349 | if ((g_boot_mode == META_BOOT) || (g_boot_mode == ADVMETA_BOOT)) { | |
1350 | /* | |
1351 | * Always use default dfo setting in META mode. | |
1352 | * We can fix abnormal dfo setting this way. | |
1353 | */ | |
1354 | printk(KERN_ALERT"(META mode) Load default dfo data...\n"); | |
1355 | parse_ccci_dfo_setting(&dfo_boot_default, DFO_BOOT_COUNT); | |
1356 | parse_meta_md_setting(md_inf_from_meta); | |
1357 | parse_eemcs_dfo_setting(&dfo_boot_default, DFO_BOOT_COUNT); | |
1358 | parse_ext_meta_md_setting(md_inf_from_meta); | |
1359 | } | |
1360 | ||
1361 | kernel_mem_sz = avail_dram; // keep the DRAM size (limited by CONFIG_MAX_DRAM_SIZE_SUPPORT) | |
1362 | /* | |
1363 | * If the maximum memory size configured in kernel | |
1364 | * is smaller than the actual size (passed from BL) | |
1365 | * Still limit the maximum memory size but use the FB | |
1366 | * initialized by BL | |
1367 | */ | |
1368 | if (bl_mem_sz >= (CONFIG_MAX_DRAM_SIZE_SUPPORT - RESERVED_MEM_MODEM)) { | |
1369 | use_bl_fb++; | |
1370 | } | |
1371 | ||
1372 | /* | |
1373 | * Setup PMEM size | |
1374 | */ | |
1375 | /* | |
1376 | if (avail_dram < 0x10000000) | |
1377 | RESERVED_MEM_SIZE_FOR_PMEM = 0x1700000; | |
1378 | else */ | |
1379 | RESERVED_MEM_SIZE_FOR_PMEM = 0x0; | |
1380 | ||
1381 | /* Reserve memory in the last bank */ | |
1382 | if (reserved_mem_bank_tag) { | |
1383 | reserved_mem_bank_tag->u.mem.size -= ((__u32)TOTAL_RESERVED_MEM_SIZE); | |
1384 | if(g_boot_mode == FACTORY_BOOT) { | |
1385 | /* we need to reserved the maximum FB_SIZE to get a fixed TEST_3D pa. */ | |
1386 | resource_size_t rest_fb_size = RESERVED_MEM_SIZE_FOR_FB_MAX - FB_SIZE; | |
1387 | RESERVED_MEM_SIZE_FOR_TEST_3D = 0x9a00000 + rest_fb_size; | |
1388 | reserved_mem_bank_tag->u.mem.size -= RESERVED_MEM_SIZE_FOR_TEST_3D; | |
1389 | } | |
1390 | FB_SIZE_EXTERN = FB_SIZE; | |
1391 | pmem_start = reserved_mem_bank_tag->u.mem.start + reserved_mem_bank_tag->u.mem.size; | |
1392 | } else // we should always have reserved memory | |
1393 | BUG(); | |
1394 | ||
1395 | MTK_MEMCFG_LOG_AND_PRINTK(KERN_ALERT | |
1396 | "[PHY layout]avaiable DRAM size (lk) = 0x%llx\n" | |
1397 | "[PHY layout]avaiable DRAM size = 0x%llx\n" | |
1398 | "[PHY layout]FB : 0x%llx - 0x%llx (0x%llx)\n", | |
1399 | (unsigned long long)bl_mem_sz, | |
1400 | (unsigned long long)kernel_mem_sz, | |
1401 | (unsigned long long)FB_START, | |
1402 | (unsigned long long)(FB_START + FB_SIZE - 1), | |
1403 | (unsigned long long)FB_SIZE); | |
1404 | if(g_boot_mode == FACTORY_BOOT) | |
1405 | MTK_MEMCFG_LOG_AND_PRINTK(KERN_ALERT | |
1406 | "[PHY layout]3D : 0x%llx - 0x%llx (0x%llx)\n", | |
1407 | (unsigned long long)TEST_3D_START, | |
1408 | (unsigned long long)(TEST_3D_START + TEST_3D_SIZE - 1), | |
1409 | (unsigned long long)TEST_3D_SIZE); | |
1410 | if (PMEM_MM_SIZE) { | |
1411 | MTK_MEMCFG_LOG_AND_PRINTK(KERN_ALERT | |
1412 | "[PHY layout]PMEM : 0x%llx - 0x%llx (0x%llx)\n", | |
1413 | (unsigned long long)PMEM_MM_START, | |
1414 | (unsigned long long)(PMEM_MM_START + PMEM_MM_SIZE - 1), | |
1415 | (unsigned long long)PMEM_MM_SIZE); | |
1416 | } | |
1417 | ||
1418 | if(tags->hdr.tag == ATAG_NONE) | |
1419 | none_tag = tags; | |
1420 | if (cmdline_tag != NULL) { | |
1421 | #ifdef CONFIG_FIQ_DEBUGGER | |
1422 | char *console_ptr; | |
1423 | int uart_port; | |
1424 | #endif | |
1425 | char *br_ptr; | |
1426 | // This function may modify ttyMT3 to ttyMT0 if needed | |
1427 | adjust_kernel_cmd_line_setting_for_console(cmdline_tag->u.cmdline.cmdline, *cmdline); | |
1428 | #ifdef CONFIG_FIQ_DEBUGGER | |
1429 | if ((console_ptr=strstr(*cmdline, "ttyMT")) != 0) | |
1430 | { | |
1431 | uart_port = console_ptr[5] - '0'; | |
1432 | if (uart_port > 3) | |
1433 | uart_port = -1; | |
1434 | ||
1435 | fiq_uart_fixup(uart_port); | |
1436 | } | |
1437 | #endif | |
1438 | ||
1439 | cmdline_filter(cmdline_tag, *cmdline); | |
1440 | if ((br_ptr = strstr(*cmdline, "boot_reason=")) != 0) { | |
1441 | /* get boot reason */ | |
1442 | g_boot_reason = br_ptr[12] - '0'; | |
1443 | } | |
1444 | /* Use the default cmdline */ | |
1445 | memcpy((void*)cmdline_tag, | |
1446 | (void*)tag_next(cmdline_tag), | |
1447 | /* ATAG_NONE actual size */ | |
1448 | (uint32_t)(none_tag) - (uint32_t)(tag_next(cmdline_tag)) + 8); | |
1449 | } | |
1450 | } | |
1451 | ||
1452 | struct platform_device auxadc_device = { | |
1453 | .name = "mt-auxadc", | |
1454 | .id = -1, | |
1455 | }; | |
1456 | ||
1457 | /*=======================================================================*/ | |
1458 | /* MT6575 sensor module */ | |
1459 | /*=======================================================================*/ | |
1460 | struct platform_device sensor_gsensor = { | |
1461 | .name = "gsensor", | |
1462 | .id = -1, | |
1463 | }; | |
1464 | ||
1465 | struct platform_device sensor_msensor = { | |
1466 | .name = "msensor", | |
1467 | .id = -1, | |
1468 | }; | |
1469 | ||
1470 | struct platform_device sensor_orientation = { | |
1471 | .name = "orientation", | |
1472 | .id = -1, | |
1473 | }; | |
1474 | ||
1475 | struct platform_device sensor_alsps = { | |
1476 | .name = "als_ps", | |
1477 | .id = -1, | |
1478 | }; | |
1479 | ||
1480 | struct platform_device sensor_gyroscope = { | |
1481 | .name = "gyroscope", | |
1482 | .id = -1, | |
1483 | }; | |
1484 | ||
1485 | struct platform_device sensor_barometer = { | |
1486 | .name = "barometer", | |
1487 | .id = -1, | |
1488 | }; | |
1489 | ||
1490 | struct platform_device sensor_temperature = { | |
1491 | .name = "temperature", | |
1492 | .id = -1, | |
1493 | }; | |
1494 | ||
1495 | struct platform_device sensor_batch = { | |
1496 | .name = "batchsensor", | |
1497 | .id = -1, | |
1498 | }; | |
1499 | ||
1500 | /* hwmon sensor */ | |
1501 | struct platform_device hwmon_sensor = { | |
1502 | .name = "hwmsensor", | |
1503 | .id = -1, | |
1504 | }; | |
1505 | ||
1506 | struct platform_device acc_sensor = { | |
1507 | .name = "m_acc_pl", | |
1508 | .id = -1, | |
1509 | }; | |
1510 | struct platform_device mag_sensor = { | |
1511 | .name = "m_mag_pl", | |
1512 | .id = -1, | |
1513 | }; | |
1514 | ||
1515 | struct platform_device alsps_sensor = { | |
1516 | .name = "m_alsps_pl", | |
1517 | .id = -1, | |
1518 | }; | |
1519 | ||
1520 | struct platform_device gyro_sensor = { | |
1521 | .name = "m_gyro_pl", | |
1522 | .id = -1, | |
1523 | }; | |
1524 | ||
1525 | struct platform_device barometer_sensor = { | |
1526 | .name = "m_baro_pl", | |
1527 | .id = -1, | |
1528 | }; | |
1529 | ||
1530 | struct platform_device temp_sensor = { | |
1531 | .name = "m_temp_pl", | |
1532 | .id = -1, | |
1533 | }; | |
1534 | ||
1535 | struct platform_device batch_sensor = { | |
1536 | .name = "m_batch_pl", | |
1537 | .id = -1, | |
1538 | }; | |
1539 | ||
1540 | ||
1541 | /*=======================================================================*/ | |
1542 | /* DISP DEV */ | |
1543 | /*=======================================================================*/ | |
1544 | static u64 disp_dmamask = ~(u32)0; | |
1545 | ||
1546 | static struct platform_device disp_device = { | |
1547 | .name = "mtk_disp", | |
1548 | .id = 0, | |
1549 | .dev = { | |
1550 | .dma_mask = &disp_dmamask, | |
1551 | .coherent_dma_mask = 0xffffffff, | |
1552 | }, | |
1553 | .num_resources = 0, | |
1554 | }; | |
1555 | ||
1556 | ||
1557 | /*=======================================================================*/ | |
1558 | /* Camera ISP */ | |
1559 | /*=======================================================================*/ | |
1560 | static struct resource mt_resource_isp[] = { | |
1561 | { // ISP configuration | |
1562 | .start = IO_VIRT_TO_PHYS(CAMINF_BASE), | |
1563 | .end = IO_VIRT_TO_PHYS(CAMINF_BASE) + 0xE000, | |
1564 | .flags = IORESOURCE_MEM, | |
1565 | }, | |
1566 | { // ISP IRQ | |
1567 | .start = CAMERA_ISP_IRQ0_ID, | |
1568 | .flags = IORESOURCE_IRQ, | |
1569 | } | |
1570 | }; | |
1571 | static u64 mt_isp_dmamask = ~(u32) 0; | |
1572 | // | |
1573 | static struct platform_device mt_isp_dev = { | |
1574 | .name = "camera-isp", | |
1575 | .id = 0, | |
1576 | .num_resources = ARRAY_SIZE(mt_resource_isp), | |
1577 | .resource = mt_resource_isp, | |
1578 | .dev = { | |
1579 | .dma_mask = &mt_isp_dmamask, | |
1580 | .coherent_dma_mask = 0xffffffffUL | |
1581 | } | |
1582 | }; | |
1583 | ||
1584 | #if 0 | |
1585 | /*=======================================================================*/ | |
1586 | /* MT6575 EIS */ | |
1587 | /*=======================================================================*/ | |
1588 | static struct resource mt_resource_eis[] = { | |
1589 | [0] = { // EIS configuration | |
1590 | .start = EIS_BASE, | |
1591 | .end = EIS_BASE + 0x2C, | |
1592 | .flags = IORESOURCE_MEM, | |
1593 | } | |
1594 | }; | |
1595 | static u64 mt_eis_dmamask = ~(u32) 0; | |
1596 | // | |
1597 | static struct platform_device mt_eis_dev = { | |
1598 | .name = "camera-eis", | |
1599 | .id = 0, | |
1600 | .num_resources = ARRAY_SIZE(mt_resource_eis), | |
1601 | .resource = mt_resource_eis, | |
1602 | .dev = { | |
1603 | .dma_mask = &mt_eis_dmamask, | |
1604 | .coherent_dma_mask = 0xffffffffUL | |
1605 | } | |
1606 | }; | |
1607 | ||
1608 | #endif | |
1609 | // | |
1610 | /*=======================================================================*/ | |
1611 | /* Image sensor */ | |
1612 | /*=======================================================================*/ | |
1613 | static struct platform_device sensor_dev = { | |
1614 | .name = "image_sensor", | |
1615 | .id = -1, | |
1616 | }; | |
1617 | static struct platform_device sensor_dev_bus2 = { | |
1618 | .name = "image_sensor_bus2", | |
1619 | .id = -1, | |
1620 | }; | |
1621 | ||
1622 | // | |
1623 | /*=======================================================================*/ | |
1624 | /* Lens actuator */ | |
1625 | /*=======================================================================*/ | |
1626 | static struct platform_device actuator_dev = { | |
1627 | .name = "lens_actuator", | |
1628 | .id = -1, | |
1629 | }; | |
1630 | /*=======================================================================*/ | |
1631 | /* MT6575 jogball */ | |
1632 | /*=======================================================================*/ | |
1633 | #ifdef CONFIG_MOUSE_PANASONIC_EVQWJN | |
1634 | static struct platform_device jbd_pdev = { | |
1635 | .name = "mt6575-jb", | |
1636 | .id = -1, | |
1637 | }; | |
1638 | #endif | |
1639 | ||
1640 | /*=======================================================================*/ | |
1641 | /* MT812 Pipe Manager */ | |
1642 | /*=======================================================================*/ | |
1643 | static struct platform_device camera_pipemgr_dev = { | |
1644 | .name = "camera-pipemgr", | |
1645 | .id = -1, | |
1646 | }; | |
1647 | ||
1648 | static struct platform_device mt65xx_leds_device = { | |
1649 | .name = "leds-mt65xx", | |
1650 | .id = -1 | |
1651 | }; | |
1652 | /*=======================================================================*/ | |
1653 | /* NFC */ | |
1654 | /*=======================================================================*/ | |
1655 | static struct platform_device mtk_nfc_6605_dev = { | |
1656 | .name = "mt6605", | |
1657 | .id = -1, | |
1658 | }; | |
1659 | ||
1660 | //#ifdef CONFIG_MTK_WIFI | |
1661 | /*=======================================================================*/ | |
1662 | /* MT6572/82 WIFI module */ | |
1663 | /*=======================================================================*/ | |
1664 | struct platform_device mt_device_wifi = { | |
1665 | .name = "mt-wifi", | |
1666 | .id = -1, | |
1667 | }; | |
1668 | //#endif | |
1669 | ||
1670 | /*=======================================================================*/ | |
1671 | /* Unused Memory Allocation */ | |
1672 | /*=======================================================================*/ | |
1673 | #ifdef MTK_USE_RESERVED_EXT_MEM | |
1674 | static struct platform_device mt_extmem = { | |
1675 | .name = "mt-extmem", | |
1676 | .id = 0, | |
1677 | }; | |
1678 | #endif | |
1679 | /*=======================================================================*/ | |
1680 | /* MT8127 Board Device Initialization */ | |
1681 | /* Sim switch driver */ | |
1682 | /*=======================================================================*/ | |
1683 | #if defined (CUSTOM_KERNEL_SSW) | |
1684 | static struct platform_device ssw_device = { | |
1685 | .name = "sim-switch", | |
1686 | .id = -1}; | |
1687 | #endif | |
1688 | ||
1689 | /*=======================================================================*/ | |
1690 | /* battery driver */ | |
1691 | /*=======================================================================*/ | |
1692 | struct platform_device battery_device = { | |
1693 | .name = "battery", | |
1694 | .id = -1, | |
1695 | }; | |
1696 | ||
1697 | /*=======================================================================*/ | |
1698 | /* MT6589 Board Device Initialization */ | |
1699 | /*=======================================================================*/ | |
1700 | __init int mt_board_init(void) | |
1701 | { | |
1702 | int i = 0, retval = 0; | |
1703 | ||
1704 | #if defined(CONFIG_MTK_SERIAL) | |
1705 | for (i = 0; i < ARRAY_SIZE(mtk_device_uart); i++){ | |
1706 | retval = platform_device_register(&mtk_device_uart[i]); | |
1707 | printk("register uart device\n"); | |
1708 | if (retval != 0){ | |
1709 | return retval; | |
1710 | } | |
1711 | } | |
1712 | #endif | |
1713 | #ifdef CONFIG_FIQ_DEBUGGER | |
1714 | retval = platform_device_register(&mt_fiq_debugger); | |
1715 | if (retval != 0){ | |
1716 | return retval; | |
1717 | } | |
1718 | #endif | |
1719 | ||
1720 | { | |
1721 | uint64_t key; | |
1722 | #if defined(CONFIG_MTK_USB_UNIQUE_SERIAL) || defined(MTK_SEC_FASTBOOT_UNLOCK_SUPPORT) | |
1723 | key = get_devinfo_with_index(13); | |
1724 | key = (key << 32) | get_devinfo_with_index(12); | |
1725 | #else | |
1726 | key = 0; | |
1727 | #endif | |
1728 | if (key != 0) | |
1729 | get_serial(key, get_chip_code(), serial_number); | |
1730 | else | |
1731 | memcpy(serial_number, "0123456789ABCDEF", 16); | |
1732 | ||
1733 | retval = kobject_init_and_add(&sn_kobj, &sn_ktype, NULL, "sys_info"); | |
1734 | ||
1735 | if (retval < 0) | |
1736 | printk("[%s] fail to add kobject\n", "sys_info"); | |
1737 | } | |
1738 | ||
1739 | #if defined(CONFIG_MTK_MTD_NAND) | |
1740 | retval = platform_device_register(&mtk_nand_dev); | |
1741 | if (retval != 0) { | |
1742 | printk(KERN_ERR "register nand device fail\n"); | |
1743 | return retval; | |
1744 | } | |
1745 | #endif | |
1746 | ||
1747 | retval = platform_device_register(&gpio_dev); | |
1748 | if (retval != 0){ | |
1749 | return retval; | |
1750 | } | |
1751 | retval = platform_device_register(&fh_dev); | |
1752 | if (retval != 0){ | |
1753 | return retval; | |
1754 | } | |
1755 | #ifdef CONFIG_MTK_KEYPAD | |
1756 | retval = platform_device_register(&kpd_pdev); | |
1757 | if (retval != 0) { | |
1758 | return retval; | |
1759 | } | |
1760 | #endif | |
1761 | ||
1762 | #ifdef CONFIG_MOUSE_PANASONIC_EVQWJN | |
1763 | retval = platform_device_register(&jbd_pdev); | |
1764 | if (retval != 0) { | |
1765 | return retval; | |
1766 | } | |
1767 | #endif | |
1768 | ||
1769 | #if defined(CONFIG_KEYBOARD_HID) | |
1770 | retval = platform_device_register(&mt_hid_dev); | |
1771 | if (retval != 0){ | |
1772 | return retval; | |
1773 | } | |
1774 | #endif | |
1775 | ||
1776 | #if defined(CONFIG_MTK_WFD_SUPPORT) | |
1777 | retval = platform_device_register(&mt_uibc_dev); | |
1778 | if (retval != 0){ | |
1779 | return retval; | |
1780 | } | |
1781 | #endif | |
1782 | ||
1783 | #if defined(CONFIG_MTK_I2C) | |
1784 | //i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0)); | |
1785 | //i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1)); | |
1786 | //i2c_register_board_info(2, i2c_devs2, ARRAY_SIZE(i2c_devs2)); | |
1787 | for (i = 0; i < ARRAY_SIZE(mt_device_i2c); i++){ | |
1788 | retval = platform_device_register(&mt_device_i2c[i]); | |
1789 | if (retval != 0){ | |
1790 | return retval; | |
1791 | } | |
1792 | } | |
1793 | #endif | |
1794 | #if defined(CONFIG_MTK_MMC) | |
1795 | for (i = 0; i < ARRAY_SIZE(mt_device_msdc); i++){ | |
1796 | retval = platform_device_register(&mt_device_msdc[i]); | |
1797 | if (retval != 0){ | |
1798 | return retval; | |
1799 | } | |
1800 | } | |
1801 | #endif | |
1802 | ||
1803 | #if defined(CONFIG_MTK_SOUND) | |
1804 | retval = platform_device_register(&AudDrv_device); | |
1805 | printk("AudDrv_driver_device \n!"); | |
1806 | if (retval != 0){ | |
1807 | return retval; | |
1808 | } | |
1809 | ||
1810 | retval = platform_device_register(&AudDrv_device2); | |
1811 | printk("AudioMTKBTCVSD AudDrv_device2 \n!"); | |
1812 | if (retval != 0){ | |
1813 | printk("AudioMTKBTCVSD AudDrv_device2 Fail:%d \n", retval); | |
1814 | return retval; | |
1815 | } | |
1816 | #endif | |
1817 | ||
1818 | #if defined(CONFIG_SND_SOC_MT8127) | |
1819 | retval = platform_add_devices(mtk_soc_audio_devices, ARRAY_SIZE(mtk_soc_audio_devices)); | |
1820 | if (retval != 0){ | |
1821 | printk("platform_add_devices(mtk_soc_audio_devices) fail:%d\n", retval); | |
1822 | return retval; | |
1823 | } | |
1824 | #endif | |
1825 | ||
1826 | #ifdef MTK_MULTIBRIDGE_SUPPORT | |
1827 | retval = platform_device_register(&mtk_multibridge_dev); | |
1828 | printk("multibridge_driver_device \n!"); | |
1829 | if (retval != 0){ | |
1830 | return retval; | |
1831 | } | |
1832 | #endif | |
1833 | ||
1834 | retval = platform_device_register(&mtk_device_btif); | |
1835 | printk("mtk_device_btif register ret %d", retval); | |
1836 | if (retval != 0){ | |
1837 | return retval; | |
1838 | } | |
1839 | ||
1840 | //=====SMI/M4U devices=========== | |
1841 | printk("register MTK_SMI device\n"); | |
1842 | retval = platform_device_register(&mtk_smi_dev); | |
1843 | if (retval != 0) { | |
1844 | return retval; | |
1845 | } | |
1846 | ||
1847 | ||
1848 | //=========================== | |
1849 | ||
1850 | #ifdef MTK_MT8193_SUPPORT | |
1851 | printk("register 8193_CKGEN device\n"); | |
1852 | retval = platform_device_register(&mtk_ckgen_dev); | |
1853 | if (retval != 0){ | |
1854 | ||
1855 | printk("register 8193_CKGEN device FAILS!\n"); | |
1856 | return retval; | |
1857 | } | |
1858 | #endif | |
1859 | // | |
1860 | //======================================================================= | |
1861 | // DISP DEV | |
1862 | //======================================================================= | |
1863 | ||
1864 | retval = platform_device_register(&disp_device); | |
1865 | #if 1 | |
1866 | if (retval != 0){ | |
1867 | return retval; | |
1868 | } | |
1869 | #endif // 1 | |
1870 | ||
1871 | printk("register M4U device: %d\n", retval); | |
1872 | retval = platform_device_register(&mtk_m4u_dev); | |
1873 | if (retval != 0) { | |
1874 | return retval; | |
1875 | } | |
1876 | ||
1877 | ||
1878 | #if defined(CONFIG_MTK_FB) | |
1879 | /* | |
1880 | * Bypass matching the frame buffer info. between boot loader and kernel | |
1881 | * if the limited memory size of the kernel is smaller than the | |
1882 | * memory size from bootloader | |
1883 | */ | |
1884 | if (((bl_fb.base == FB_START) && (bl_fb.size == FB_SIZE)) || | |
1885 | (use_bl_fb == 2)) { | |
1886 | printk(KERN_ALERT"FB is initialized by BL(%d)\n", use_bl_fb); | |
1887 | mtkfb_set_lcm_inited(1); | |
1888 | } else if ((bl_fb.base == 0) && (bl_fb.size == 0)) { | |
1889 | printk(KERN_ALERT"FB is not initialized(%d)\n", use_bl_fb); | |
1890 | mtkfb_set_lcm_inited(0); | |
1891 | } else { | |
1892 | printk(KERN_ALERT | |
1893 | "******************************************************************************\n" | |
1894 | " WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING\n" | |
1895 | "******************************************************************************\n" | |
1896 | "\n" | |
1897 | " The default FB base & size values are not matched between BL and kernel\n" | |
1898 | " - BOOTLD: start 0x%08x, size %d\n" | |
1899 | " - KERNEL: start 0x%llx, size %lld\n" | |
1900 | "\n" | |
1901 | " If you see this warning message, please update your uboot.\n" | |
1902 | "\n" | |
1903 | "******************************************************************************\n" | |
1904 | " WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING\n" | |
1905 | "******************************************************************************\n" | |
1906 | "\n", bl_fb.base, bl_fb.size, (unsigned long long)FB_START, (unsigned long long)FB_SIZE); | |
1907 | /* workaround for TEST_3D_START */ | |
1908 | mtkfb_set_lcm_inited(1); | |
1909 | { | |
1910 | int delay_sec = 5; | |
1911 | ||
1912 | while (delay_sec >= 0) { | |
1913 | printk("\rcontinue after %d seconds ...", delay_sec--); | |
1914 | mdelay(1000); | |
1915 | } | |
1916 | printk("\n"); | |
1917 | } | |
1918 | #if 0 | |
1919 | panic("The default base & size values are not matched " | |
1920 | "between BL and kernel\n"); | |
1921 | #endif | |
1922 | } | |
1923 | ||
1924 | resource_fb[0].start = FB_START; | |
1925 | resource_fb[0].end = FB_START + FB_SIZE - 1; | |
1926 | ||
1927 | printk(KERN_ALERT"FB start: 0x%x end: 0x%x\n", resource_fb[0].start, | |
1928 | resource_fb[0].end); | |
1929 | ||
1930 | retval = platform_device_register(&mt6575_device_fb); | |
1931 | if (retval != 0) { | |
1932 | return retval; | |
1933 | } | |
1934 | #endif | |
1935 | ||
1936 | #if defined(CONFIG_MTK_LEDS) | |
1937 | retval = platform_device_register(&mt65xx_leds_device); | |
1938 | if (retval != 0) | |
1939 | return retval; | |
1940 | printk("bei:device LEDS register\n"); | |
1941 | #endif | |
1942 | ||
1943 | #ifdef CONFIG_MTK_HDMI_SUPPORT | |
1944 | retval = platform_device_register(&mtk_hdmi_dev); | |
1945 | if (retval != 0){ | |
1946 | return retval; | |
1947 | } | |
1948 | #endif | |
1949 | ||
1950 | ||
1951 | #if defined(CONFIG_MTK_SPI) | |
1952 | // spi_register_board_info(spi_board_devs, ARRAY_SIZE(spi_board_devs)); | |
1953 | platform_device_register(&mt_spi_device); | |
1954 | #endif | |
1955 | ||
1956 | ||
1957 | ||
1958 | ||
1959 | ||
1960 | ||
1961 | #if defined(MTK_TVOUT_SUPPORT) | |
1962 | retval = platform_device_register(&mt6575_TVOUT_dev); | |
1963 | printk("register TV-out device\n"); | |
1964 | if (retval != 0) { | |
1965 | return retval; | |
1966 | } | |
1967 | #endif | |
1968 | ||
1969 | #if 1 | |
1970 | retval = platform_device_register(&auxadc_device); | |
1971 | if(retval != 0) | |
1972 | { | |
1973 | printk("****[auxadc_driver] Unable to device register(%d)\n", retval); | |
1974 | return retval; | |
1975 | } | |
1976 | #endif | |
1977 | ||
1978 | #if defined(CONFIG_MTK_ACCDET) | |
1979 | ||
1980 | ||
1981 | retval = platform_device_register(&accdet_device); | |
1982 | printk("register accdet device\n"); | |
1983 | ||
1984 | if (retval != 0) | |
1985 | { | |
1986 | printk("platform_device_accdet_register error:(%d)\n", retval); | |
1987 | return retval; | |
1988 | } | |
1989 | else | |
1990 | { | |
1991 | printk("platform_device_accdet_register done!\n"); | |
1992 | } | |
1993 | ||
1994 | #endif | |
1995 | ||
1996 | #if defined(CONFIG_USB_MTK_ACM_TEMP) | |
1997 | ||
1998 | retval = platform_device_register(&usbacm_temp_device); | |
1999 | printk("register usbacm temp device\n"); | |
2000 | ||
2001 | if (retval != 0) | |
2002 | { | |
2003 | printk("platform_device_usbacm_register error:(%d)\n", retval); | |
2004 | return retval; | |
2005 | } | |
2006 | else | |
2007 | { | |
2008 | printk("platform_device_usbacm_register done!\n"); | |
2009 | } | |
2010 | ||
2011 | #endif | |
2012 | ||
2013 | ||
2014 | #if 0 //defined(CONFIG_MDP_MT6575) | |
2015 | //printk("[MDP]platform_device_register\n\r"); | |
2016 | retval = platform_device_register(&mt6575_MDP_dev); | |
2017 | if(retval != 0){ | |
2018 | return retval; | |
2019 | } | |
2020 | #endif | |
2021 | ||
2022 | #if defined(CONFIG_MTK_SENSOR_SUPPORT) | |
2023 | ||
2024 | retval = platform_device_register(&hwmon_sensor); | |
2025 | printk("hwmon_sensor device!"); | |
2026 | if (retval != 0) | |
2027 | return retval; | |
2028 | ||
2029 | retval = platform_device_register(&batch_sensor); | |
2030 | printk("[%s]: batch_sensor, retval=%d \n!", __func__, retval); | |
2031 | if (retval != 0) | |
2032 | return retval; | |
2033 | ||
2034 | retval = platform_device_register(&acc_sensor); | |
2035 | printk("[%s]: acc_sensor, retval=%d \n!", __func__, retval); | |
2036 | if (retval != 0) | |
2037 | return retval; | |
2038 | ||
2039 | retval = platform_device_register(&mag_sensor); | |
2040 | printk("[%s]: mag_sensor, retval=%d \n!", __func__, retval); | |
2041 | if (retval != 0) | |
2042 | return retval; | |
2043 | ||
2044 | retval = platform_device_register(&gyro_sensor); | |
2045 | printk("[%s]: gyro_sensor, retval=%d \n!", __func__, retval); | |
2046 | if (retval != 0) | |
2047 | return retval; | |
2048 | ||
2049 | retval = platform_device_register(&alsps_sensor); | |
2050 | printk("[%s]: alsps_sensor, retval=%d \n!", __func__, retval); | |
2051 | if (retval != 0) | |
2052 | return retval; | |
2053 | ||
2054 | retval = platform_device_register(&barometer_sensor); | |
2055 | printk("[%s]: barometer_sensor, retval=%d \n!", __func__, retval); | |
2056 | if (retval != 0) | |
2057 | return retval; | |
2058 | ||
2059 | retval = platform_device_register(&temp_sensor); | |
2060 | printk("[%s]: temp_sensor, retval=%d \n!", __func__, retval); | |
2061 | if (retval != 0) | |
2062 | return retval; | |
2063 | ||
2064 | #if defined(CONFIG_CUSTOM_KERNEL_ACCELEROMETER) | |
2065 | retval = platform_device_register(&sensor_gsensor); | |
2066 | printk("sensor_gsensor device!"); | |
2067 | if (retval != 0) | |
2068 | return retval; | |
2069 | #endif | |
2070 | ||
2071 | #if defined(CONFIG_CUSTOM_KERNEL_MAGNETOMETER) | |
2072 | retval = platform_device_register(&sensor_msensor); | |
2073 | printk("sensor_msensor device!"); | |
2074 | if (retval != 0) | |
2075 | return retval; | |
2076 | ||
2077 | retval = platform_device_register(&sensor_orientation); | |
2078 | printk("sensor_osensor device!"); | |
2079 | if (retval != 0) | |
2080 | return retval; | |
2081 | ||
2082 | #endif | |
2083 | ||
2084 | #if defined(CONFIG_CUSTOM_KERNEL_GYROSCOPE) | |
2085 | retval = platform_device_register(&sensor_gyroscope); | |
2086 | printk("sensor_gyroscope device!"); | |
2087 | if (retval != 0) | |
2088 | return retval; | |
2089 | #endif | |
2090 | ||
2091 | #if defined(CONFIG_CUSTOM_KERNEL_BAROMETER) | |
2092 | retval = platform_device_register(&sensor_barometer); | |
2093 | printk("sensor_barometer device!"); | |
2094 | if (retval != 0) | |
2095 | return retval; | |
2096 | #endif | |
2097 | ||
2098 | #if defined(CONFIG_CUSTOM_KERNEL_ALSPS) | |
2099 | retval = platform_device_register(&sensor_alsps); | |
2100 | printk("sensor_alsps device!"); | |
2101 | if (retval != 0) | |
2102 | return retval; | |
2103 | #endif | |
2104 | ||
2105 | #if defined(CONFIG_CUSTOM_KERNEL_TEMPERATURE) | |
2106 | retval = platform_device_register(&sensor_temperature); | |
2107 | printk("[%s]: sensor_temperature, retval=%d \n!", __func__, retval); | |
2108 | printk("sensor_temperature device!"); | |
2109 | if (retval != 0) | |
2110 | return retval; | |
2111 | #endif | |
2112 | #endif | |
2113 | ||
2114 | #if defined(CONFIG_MTK_USBFSH) | |
2115 | printk("register musbfsh device\n"); | |
2116 | retval = platform_device_register(&mt_usb11_dev); | |
2117 | if (retval != 0){ | |
2118 | printk("register musbfsh device fail!\n"); | |
2119 | return retval; | |
2120 | } | |
2121 | #endif | |
2122 | ||
2123 | #if defined(CONFIG_USB_MTK_HDRC) | |
2124 | printk("mt_device_usb register\n"); | |
2125 | retval = platform_device_register(&mt_device_usb); | |
2126 | if (retval != 0){ | |
2127 | printk("mt_device_usb register fail\n"); | |
2128 | return retval; | |
2129 | } | |
2130 | #endif | |
2131 | ||
2132 | #if 1 // init after USB driver | |
2133 | retval = platform_device_register(&battery_device); | |
2134 | if (retval) { | |
2135 | printk("[battery_driver] Unable to device register\n"); | |
2136 | return retval; | |
2137 | } | |
2138 | #endif | |
2139 | ||
2140 | #if defined(CONFIG_MTK_TOUCHPANEL) | |
2141 | retval = platform_device_register(&mtk_tpd_dev); | |
2142 | if (retval != 0) { | |
2143 | return retval; | |
2144 | } | |
2145 | #endif | |
2146 | #if defined(CUSTOM_KERNEL_OFN) | |
2147 | retval = platform_device_register(&ofn_driver); | |
2148 | if (retval != 0){ | |
2149 | return retval; | |
2150 | } | |
2151 | #endif | |
2152 | ||
2153 | #if (defined(CONFIG_MTK_MTD_NAND) ||defined(CONFIG_MTK_MMC)) | |
2154 | retval = platform_device_register(&dummychar_device); | |
2155 | if (retval != 0){ | |
2156 | return retval; | |
2157 | } | |
2158 | #endif | |
2159 | ||
2160 | ||
2161 | #if defined(CONFIG_ANDROID_PMEM) | |
2162 | pdata_multimedia.start = PMEM_MM_START;; | |
2163 | pdata_multimedia.size = PMEM_MM_SIZE; | |
2164 | printk("PMEM start: 0x%lx size: 0x%lx\n", pdata_multimedia.start, pdata_multimedia.size); | |
2165 | ||
2166 | retval = platform_device_register(&pmem_multimedia_device); | |
2167 | if (retval != 0){ | |
2168 | return retval; | |
2169 | } | |
2170 | #endif | |
2171 | ||
2172 | #if defined(CONFIG_ANDROID_VMEM) | |
2173 | pdata_vmultimedia.start = PMEM_MM_START;; | |
2174 | pdata_vmultimedia.size = PMEM_MM_SIZE; | |
2175 | printk("VMEM start: 0x%lx size: 0x%lx\n", pdata_vmultimedia.start, pdata_vmultimedia.size); | |
2176 | ||
2177 | retval = platform_device_register(&vmem_multimedia_device); | |
2178 | if (retval != 0){ | |
2179 | printk("vmem platform register failed\n"); | |
2180 | return retval; | |
2181 | } | |
2182 | #endif | |
2183 | ||
2184 | #ifdef CONFIG_CPU_FREQ | |
2185 | retval = platform_device_register(&cpufreq_pdev); | |
2186 | if (retval != 0) { | |
2187 | return retval; | |
2188 | } | |
2189 | #endif | |
2190 | ||
2191 | #if 1 | |
2192 | retval = platform_device_register(&thermal_pdev); | |
2193 | if (retval != 0) { | |
2194 | return retval; | |
2195 | } | |
2196 | #endif | |
2197 | ||
2198 | #if 1 | |
2199 | retval = platform_device_register(&mtk_therm_mon_pdev); | |
2200 | if (retval != 0) { | |
2201 | return retval; | |
2202 | } | |
2203 | #endif | |
2204 | ||
2205 | retval = platform_device_register(&ptp_pdev); | |
2206 | if (retval != 0) { | |
2207 | return retval; | |
2208 | } | |
2209 | ||
2210 | retval = platform_device_register(&spm_mcdi_pdev); | |
2211 | if (retval != 0) { | |
2212 | return retval; | |
2213 | } | |
2214 | ||
2215 | // | |
2216 | //======================================================================= | |
2217 | // Image sensor | |
2218 | //======================================================================= | |
2219 | #if 1 ///defined(CONFIG_VIDEO_CAPTURE_DRIVERS) | |
2220 | retval = platform_device_register(&sensor_dev); | |
2221 | if (retval != 0){ | |
2222 | return retval; | |
2223 | } | |
2224 | #endif | |
2225 | #if 1 ///defined(CONFIG_VIDEO_CAPTURE_DRIVERS) | |
2226 | retval = platform_device_register(&sensor_dev_bus2); | |
2227 | if (retval != 0){ | |
2228 | return retval; | |
2229 | } | |
2230 | #endif | |
2231 | ||
2232 | // | |
2233 | //======================================================================= | |
2234 | // Lens motor | |
2235 | //======================================================================= | |
2236 | #if 1 //defined(CONFIG_ACTUATOR) | |
2237 | retval = platform_device_register(&actuator_dev); | |
2238 | if (retval != 0){ | |
2239 | return retval; | |
2240 | } | |
2241 | #endif | |
2242 | ||
2243 | ||
2244 | ||
2245 | // | |
2246 | //======================================================================= | |
2247 | // Camera ISP | |
2248 | //======================================================================= | |
2249 | #if 1 //defined(CONFIG_ISP_MT8127) | |
2250 | retval = platform_device_register(&mt_isp_dev); | |
2251 | if (retval != 0){ | |
2252 | return retval; | |
2253 | } | |
2254 | #endif | |
2255 | ||
2256 | #if 0 | |
2257 | retval = platform_device_register(&mt_eis_dev); | |
2258 | if (retval != 0){ | |
2259 | return retval; | |
2260 | } | |
2261 | #endif | |
2262 | ||
2263 | #ifdef CONFIG_RFKILL | |
2264 | retval = platform_device_register(&mt_rfkill_device); | |
2265 | if (retval != 0){ | |
2266 | return retval; | |
2267 | } | |
2268 | #endif | |
2269 | ||
2270 | #if 1 | |
2271 | retval = platform_device_register(&camera_sysram_dev); | |
2272 | if (retval != 0){ | |
2273 | return retval; | |
2274 | } | |
2275 | #endif | |
2276 | ||
2277 | #if defined(CONFIG_MTK_GPS) | |
2278 | retval = platform_device_register(&mt3326_device_gps); | |
2279 | if (retval != 0){ | |
2280 | return retval; | |
2281 | } | |
2282 | #endif | |
2283 | ||
2284 | retval = platform_device_register(&camera_pipemgr_dev); | |
2285 | if (retval != 0){ | |
2286 | return retval; | |
2287 | } | |
2288 | ||
2289 | ||
2290 | #if defined(CONFIG_MTK_NFC) //NFC | |
2291 | retval = platform_device_register(&mtk_nfc_6605_dev); | |
2292 | printk("mtk_nfc_6605_dev register ret %d", retval); | |
2293 | if (retval != 0){ | |
2294 | return retval; | |
2295 | } | |
2296 | #endif | |
2297 | ||
2298 | //#if defined(CONFIG_MTK_WIFI) | |
2299 | retval = platform_device_register(&mt_device_wifi); | |
2300 | if (retval != 0){ | |
2301 | return retval; | |
2302 | } | |
2303 | //#endif | |
2304 | ||
2305 | #if defined (CUSTOM_KERNEL_SSW) | |
2306 | retval = platform_device_register(&ssw_device); | |
2307 | if (retval != 0) { | |
2308 | return retval; | |
2309 | } | |
2310 | #endif | |
2311 | ||
2312 | #ifdef CONFIG_MTK_USE_RESERVED_EXT_MEM | |
2313 | retval = platform_device_register(&mt_extmem); | |
2314 | ||
2315 | printk("%s[%d] ret: %d\n", __FILE__, __LINE__, retval); | |
2316 | if (retval != 0){ | |
2317 | return retval; | |
2318 | } | |
2319 | #endif | |
2320 | ||
2321 | retval = platform_device_register(&masp_device); | |
2322 | if (retval != 0){ | |
2323 | return retval; | |
2324 | } | |
2325 | ||
2326 | return 0; | |
2327 | } | |
2328 | ||
2329 | /* | |
2330 | * is_pmem_range | |
2331 | * Input | |
2332 | * base: buffer base physical address | |
2333 | * size: buffer len in byte | |
2334 | * Return | |
2335 | * 1: buffer is located in pmem address range | |
2336 | * 0: buffer is out of pmem address range | |
2337 | */ | |
2338 | int is_pmem_range(unsigned long *base, unsigned long size) | |
2339 | { | |
2340 | unsigned long start = (unsigned long)base; | |
2341 | unsigned long end = start + size; | |
2342 | ||
2343 | //printk("[PMEM] start=0x%p,end=0x%p,size=%d\n", start, end, size); | |
2344 | //printk("[PMEM] PMEM_MM_START=0x%p,PMEM_MM_SIZE=%d\n", PMEM_MM_START, PMEM_MM_SIZE); | |
2345 | ||
2346 | if (start < PMEM_MM_START) | |
2347 | return 0; | |
2348 | if (end >= PMEM_MM_START + PMEM_MM_SIZE) | |
2349 | return 0; | |
2350 | ||
2351 | return 1; | |
2352 | } | |
2353 | EXPORT_SYMBOL(is_pmem_range); | |
2354 | ||
2355 | // return the actual physical DRAM size | |
2356 | unsigned int mtk_get_max_DRAM_size(void) | |
2357 | { | |
2358 | return kernel_mem_sz + RESERVED_MEM_MODEM; | |
2359 | } | |
2360 | ||
2361 | resource_size_t get_actual_DRAM_size(void) | |
2362 | { | |
2363 | return bl_mem_sz; | |
2364 | } | |
2365 | EXPORT_SYMBOL(get_actual_DRAM_size); | |
2366 | ||
2367 | #include <asm/sections.h> | |
2368 | void get_text_region (unsigned int *s, unsigned int *e) | |
2369 | { | |
2370 | *s = (unsigned int)_text, *e=(unsigned int)_etext ; | |
2371 | } | |
2372 | EXPORT_SYMBOL(get_text_region) ; | |
2373 | ||
2374 | void __weak mtk_wcn_consys_memory_reserve(void) | |
2375 | { | |
2376 | printk(KERN_ERR"weak reserve function: %s", __FUNCTION__); | |
2377 | } | |
2378 | ||
2379 | void __weak eemcs_memory_reserve(void) | |
2380 | { | |
2381 | printk(KERN_ERR"calling weak function %s\n", __FUNCTION__); | |
2382 | } | |
2383 | ||
8ca3027e | 2384 | void __init mt_reserve(void) |
6fa3eb70 S |
2385 | { |
2386 | // aee_dram_console_reserve_memory(); | |
2387 | mrdump_reserve_memory(); | |
2388 | ||
2389 | #if defined(CONFIG_MTK_RAM_CONSOLE_USING_DRAM) | |
2390 | memblock_reserve(CONFIG_MTK_RAM_CONSOLE_DRAM_ADDR, CONFIG_MTK_RAM_CONSOLE_DRAM_SIZE); | |
2391 | #endif | |
2392 | mrdump_mini_reserve_memory(); | |
2393 | ||
2394 | /* | |
2395 | * Dynamic reserved memory (by arm_memblock_steal) | |
2396 | * | |
2397 | * *** DO NOT CHANGE THE RESERVE ORDER *** | |
2398 | * | |
2399 | * New memory reserve functions should be APPENDED to old funtions | |
2400 | */ | |
2401 | mtk_wcn_consys_memory_reserve(); | |
2402 | ccci_md_mem_reserve(); | |
2403 | #if defined(CONFIG_MTK_EEMCS_DEVICES) | |
2404 | eemcs_memory_reserve(); | |
2405 | #endif | |
2406 | /* Last line of dynamic reserve functions */ | |
2407 | } |