blob: 7b8a4a9d7c29edd909c21d612cd3f3a476b13672 [file] [log] [blame]
Taniya Das2e948192011-12-20 11:15:13 +05301/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/dma-mapping.h>
16#include <linux/msm_kgsl.h>
17#include <linux/regulator/machine.h>
Taniya Das2e948192011-12-20 11:15:13 +053018#include <linux/init.h>
Taniya Das43bcdd62011-12-02 17:33:27 +053019#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <mach/irqs.h>
21#include <mach/msm_iomap.h>
22#include <mach/board.h>
23#include <mach/dma.h>
24#include <mach/dal_axi.h>
25#include <asm/mach/flash.h>
Taniya Das43bcdd62011-12-02 17:33:27 +053026#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070027#include <asm/hardware/cache-l2x0.h>
28#include <asm/mach/mmc.h>
29#include <mach/rpc_hsusb.h>
30#include <mach/socinfo.h>
31
32#include "devices.h"
33#include "devices-msm7x2xa.h"
34#include "footswitch.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070035#include "acpuclock.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070036
37/* Address of GSBI blocks */
38#define MSM_GSBI0_PHYS 0xA1200000
39#define MSM_GSBI1_PHYS 0xA1300000
40
41/* GSBI QUPe devices */
42#define MSM_GSBI0_QUP_PHYS (MSM_GSBI0_PHYS + 0x80000)
43#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
44
45static struct resource gsbi0_qup_i2c_resources[] = {
46 {
47 .name = "qup_phys_addr",
48 .start = MSM_GSBI0_QUP_PHYS,
49 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
50 .flags = IORESOURCE_MEM,
51 },
52 {
53 .name = "gsbi_qup_i2c_addr",
54 .start = MSM_GSBI0_PHYS,
55 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
56 .flags = IORESOURCE_MEM,
57 },
58 {
59 .name = "qup_err_intr",
60 .start = INT_PWB_I2C,
61 .end = INT_PWB_I2C,
62 .flags = IORESOURCE_IRQ,
63 },
64};
65
66/* Use GSBI0 QUP for /dev/i2c-0 */
67struct platform_device msm_gsbi0_qup_i2c_device = {
68 .name = "qup_i2c",
69 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
70 .num_resources = ARRAY_SIZE(gsbi0_qup_i2c_resources),
71 .resource = gsbi0_qup_i2c_resources,
72};
73
74static struct resource gsbi1_qup_i2c_resources[] = {
75 {
76 .name = "qup_phys_addr",
77 .start = MSM_GSBI1_QUP_PHYS,
78 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
79 .flags = IORESOURCE_MEM,
80 },
81 {
82 .name = "gsbi_qup_i2c_addr",
83 .start = MSM_GSBI1_PHYS,
84 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
85 .flags = IORESOURCE_MEM,
86 },
87 {
88 .name = "qup_err_intr",
89 .start = INT_ARM11_DMA,
90 .end = INT_ARM11_DMA,
91 .flags = IORESOURCE_IRQ,
92 },
93};
94
95/* Use GSBI1 QUP for /dev/i2c-1 */
96struct platform_device msm_gsbi1_qup_i2c_device = {
97 .name = "qup_i2c",
98 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
99 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
100 .resource = gsbi1_qup_i2c_resources,
101};
102
103#define MSM_HSUSB_PHYS 0xA0800000
104static struct resource resources_hsusb_otg[] = {
105 {
106 .start = MSM_HSUSB_PHYS,
107 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
108 .flags = IORESOURCE_MEM,
109 },
110 {
111 .start = INT_USB_HS,
112 .end = INT_USB_HS,
113 .flags = IORESOURCE_IRQ,
114 },
115};
116
117static u64 dma_mask = 0xffffffffULL;
118struct platform_device msm_device_otg = {
119 .name = "msm_otg",
120 .id = -1,
121 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
122 .resource = resources_hsusb_otg,
123 .dev = {
124 .dma_mask = &dma_mask,
125 .coherent_dma_mask = 0xffffffffULL,
126 },
127};
128
129static struct resource resources_gadget_peripheral[] = {
130 {
131 .start = MSM_HSUSB_PHYS,
132 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
133 .flags = IORESOURCE_MEM,
134 },
135 {
136 .start = INT_USB_HS,
137 .end = INT_USB_HS,
138 .flags = IORESOURCE_IRQ,
139 },
140};
141
142struct platform_device msm_device_gadget_peripheral = {
143 .name = "msm_hsusb",
144 .id = -1,
145 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
146 .resource = resources_gadget_peripheral,
147 .dev = {
148 .dma_mask = &dma_mask,
149 .coherent_dma_mask = 0xffffffffULL,
150 },
151};
152
153static struct resource resources_hsusb_host[] = {
154 {
155 .start = MSM_HSUSB_PHYS,
156 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
157 .flags = IORESOURCE_MEM,
158 },
159 {
160 .start = INT_USB_HS,
161 .end = INT_USB_HS,
162 .flags = IORESOURCE_IRQ,
163 },
164};
165
166struct platform_device msm_device_hsusb_host = {
167 .name = "msm_hsusb_host",
168 .id = 0,
169 .num_resources = ARRAY_SIZE(resources_hsusb_host),
170 .resource = resources_hsusb_host,
171 .dev = {
172 .dma_mask = &dma_mask,
173 .coherent_dma_mask = 0xffffffffULL,
174 },
175};
176
177static struct platform_device *msm_host_devices[] = {
178 &msm_device_hsusb_host,
179};
180
181int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
182{
183 struct platform_device *pdev;
184
185 pdev = msm_host_devices[host];
186 if (!pdev)
187 return -ENODEV;
188 pdev->dev.platform_data = plat;
189 return platform_device_register(pdev);
190}
191
192static struct resource msm_dmov_resource[] = {
193 {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700194 .start = INT_ADM_AARM,
195 .flags = IORESOURCE_IRQ,
196 },
197 {
198 .start = 0xA9700000,
199 .end = 0xA9700000 + SZ_4K - 1,
200 .flags = IORESOURCE_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700201 },
202};
203
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700204static struct msm_dmov_pdata msm_dmov_pdata = {
205 .sd = 3,
206 .sd_size = 0x400,
207};
208
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700209struct platform_device msm_device_dmov = {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700210 .name = "msm_dmov",
211 .id = -1,
212 .resource = msm_dmov_resource,
213 .num_resources = ARRAY_SIZE(msm_dmov_resource),
214 .dev = {
215 .platform_data = &msm_dmov_pdata,
216 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700217};
218
219struct platform_device msm_device_smd = {
220 .name = "msm_smd",
221 .id = -1,
222};
223
224static struct resource resources_uart1[] = {
225 {
226 .start = INT_UART1,
227 .end = INT_UART1,
228 .flags = IORESOURCE_IRQ,
229 },
230 {
Taniya Das13b811a2011-12-09 18:33:45 +0530231 .start = MSM7XXX_UART1_PHYS,
232 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700233 .flags = IORESOURCE_MEM,
234 },
235};
236
237struct platform_device msm_device_uart1 = {
238 .name = "msm_serial",
239 .id = 0,
240 .num_resources = ARRAY_SIZE(resources_uart1),
241 .resource = resources_uart1,
242};
243
244#define MSM_UART1DM_PHYS 0xA0200000
245static struct resource msm_uart1_dm_resources[] = {
246 {
247 .start = MSM_UART1DM_PHYS,
248 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
249 .flags = IORESOURCE_MEM,
250 },
251 {
252 .start = INT_UART1DM_IRQ,
253 .end = INT_UART1DM_IRQ,
254 .flags = IORESOURCE_IRQ,
255 },
256 {
257 .start = INT_UART1DM_RX,
258 .end = INT_UART1DM_RX,
259 .flags = IORESOURCE_IRQ,
260 },
261 {
262 .start = DMOV_HSUART1_TX_CHAN,
263 .end = DMOV_HSUART1_RX_CHAN,
264 .name = "uartdm_channels",
265 .flags = IORESOURCE_DMA,
266 },
267 {
268 .start = DMOV_HSUART1_TX_CRCI,
269 .end = DMOV_HSUART1_RX_CRCI,
270 .name = "uartdm_crci",
271 .flags = IORESOURCE_DMA,
272 },
273};
274
275static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
276struct platform_device msm_device_uart_dm1 = {
277 .name = "msm_serial_hs",
278 .id = 0,
279 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
280 .resource = msm_uart1_dm_resources,
281 .dev = {
282 .dma_mask = &msm_uart_dm1_dma_mask,
283 .coherent_dma_mask = DMA_BIT_MASK(32),
284 },
285};
286
287#define MSM_UART2DM_PHYS 0xA0300000
288static struct resource msm_uart2dm_resources[] = {
289 {
290 .start = MSM_UART2DM_PHYS,
291 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
292 .name = "uartdm_resource",
293 .flags = IORESOURCE_MEM,
294 },
295 {
296 .start = INT_UART2DM_IRQ,
297 .end = INT_UART2DM_IRQ,
298 .flags = IORESOURCE_IRQ,
299 },
300};
301
302struct platform_device msm_device_uart_dm2 = {
303 .name = "msm_serial_hsl",
304 .id = 0,
305 .num_resources = ARRAY_SIZE(msm_uart2dm_resources),
306 .resource = msm_uart2dm_resources,
307};
308
309#define MSM_NAND_PHYS 0xA0A00000
310#define MSM_NANDC01_PHYS 0xA0A40000
311#define MSM_NANDC10_PHYS 0xA0A80000
312#define MSM_NANDC11_PHYS 0xA0AC0000
313#define EBI2_REG_BASE 0xA0D00000
314static struct resource resources_nand[] = {
315 [0] = {
316 .name = "msm_nand_dmac",
317 .start = DMOV_NAND_CHAN,
318 .end = DMOV_NAND_CHAN,
319 .flags = IORESOURCE_DMA,
320 },
321 [1] = {
322 .name = "msm_nand_phys",
323 .start = MSM_NAND_PHYS,
324 .end = MSM_NAND_PHYS + 0x7FF,
325 .flags = IORESOURCE_MEM,
326 },
327 [2] = {
328 .name = "msm_nandc01_phys",
329 .start = MSM_NANDC01_PHYS,
330 .end = MSM_NANDC01_PHYS + 0x7FF,
331 .flags = IORESOURCE_MEM,
332 },
333 [3] = {
334 .name = "msm_nandc10_phys",
335 .start = MSM_NANDC10_PHYS,
336 .end = MSM_NANDC10_PHYS + 0x7FF,
337 .flags = IORESOURCE_MEM,
338 },
339 [4] = {
340 .name = "msm_nandc11_phys",
341 .start = MSM_NANDC11_PHYS,
342 .end = MSM_NANDC11_PHYS + 0x7FF,
343 .flags = IORESOURCE_MEM,
344 },
345 [5] = {
346 .name = "ebi2_reg_base",
347 .start = EBI2_REG_BASE,
348 .end = EBI2_REG_BASE + 0x60,
349 .flags = IORESOURCE_MEM,
350 },
351};
352
353struct flash_platform_data msm_nand_data;
354
355struct platform_device msm_device_nand = {
356 .name = "msm_nand",
357 .id = -1,
358 .num_resources = ARRAY_SIZE(resources_nand),
359 .resource = resources_nand,
360 .dev = {
361 .platform_data = &msm_nand_data,
362 },
363};
364
365#define MSM_SDC1_BASE 0xA0400000
366#define MSM_SDC2_BASE 0xA0500000
367#define MSM_SDC3_BASE 0xA0600000
368#define MSM_SDC4_BASE 0xA0700000
369static struct resource resources_sdc1[] = {
370 {
371 .start = MSM_SDC1_BASE,
372 .end = MSM_SDC1_BASE + SZ_4K - 1,
373 .flags = IORESOURCE_MEM,
374 },
375 {
376 .start = INT_SDC1_0,
377 .end = INT_SDC1_1,
378 .flags = IORESOURCE_IRQ,
379 },
380 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700381 .name = "sdcc_dma_chnl",
382 .start = DMOV_SDC1_CHAN,
383 .end = DMOV_SDC1_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700384 .flags = IORESOURCE_DMA,
385 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700386 {
387 .name = "sdcc_dma_crci",
388 .start = DMOV_SDC1_CRCI,
389 .end = DMOV_SDC1_CRCI,
390 .flags = IORESOURCE_DMA,
391 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700392};
393
394static struct resource resources_sdc2[] = {
395 {
396 .start = MSM_SDC2_BASE,
397 .end = MSM_SDC2_BASE + SZ_4K - 1,
398 .flags = IORESOURCE_MEM,
399 },
400 {
401 .start = INT_SDC2_0,
402 .end = INT_SDC2_1,
403 .flags = IORESOURCE_IRQ,
404 },
405 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700406 .name = "sdcc_dma_chnl",
407 .start = DMOV_SDC2_CHAN,
408 .end = DMOV_SDC2_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700409 .flags = IORESOURCE_DMA,
410 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700411 {
412 .name = "sdcc_dma_crci",
413 .start = DMOV_SDC2_CRCI,
414 .end = DMOV_SDC2_CRCI,
415 .flags = IORESOURCE_DMA,
416 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700417};
418
419static struct resource resources_sdc3[] = {
420 {
421 .start = MSM_SDC3_BASE,
422 .end = MSM_SDC3_BASE + SZ_4K - 1,
423 .flags = IORESOURCE_MEM,
424 },
425 {
426 .start = INT_SDC3_0,
427 .end = INT_SDC3_1,
428 .flags = IORESOURCE_IRQ,
429 },
430 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700431 .name = "sdcc_dma_chnl",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530432 .start = DMOV_SDC3_CHAN,
433 .end = DMOV_SDC3_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700434 .flags = IORESOURCE_DMA,
435 },
436 {
437 .name = "sdcc_dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530438 .start = DMOV_SDC3_CRCI,
439 .end = DMOV_SDC3_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700440 .flags = IORESOURCE_DMA,
441 },
442};
443
444static struct resource resources_sdc4[] = {
445 {
446 .start = MSM_SDC4_BASE,
447 .end = MSM_SDC4_BASE + SZ_4K - 1,
448 .flags = IORESOURCE_MEM,
449 },
450 {
451 .start = INT_SDC4_0,
452 .end = INT_SDC4_1,
453 .flags = IORESOURCE_IRQ,
454 },
455 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700456 .name = "sdcc_dma_chnl",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530457 .start = DMOV_SDC4_CHAN,
458 .end = DMOV_SDC4_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700459 .flags = IORESOURCE_DMA,
460 },
461 {
462 .name = "sdcc_dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530463 .start = DMOV_SDC4_CRCI,
464 .end = DMOV_SDC4_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700465 .flags = IORESOURCE_DMA,
466 },
467};
468
469struct platform_device msm_device_sdc1 = {
470 .name = "msm_sdcc",
471 .id = 1,
472 .num_resources = ARRAY_SIZE(resources_sdc1),
473 .resource = resources_sdc1,
474 .dev = {
475 .coherent_dma_mask = 0xffffffff,
476 },
477};
478
479struct platform_device msm_device_sdc2 = {
480 .name = "msm_sdcc",
481 .id = 2,
482 .num_resources = ARRAY_SIZE(resources_sdc2),
483 .resource = resources_sdc2,
484 .dev = {
485 .coherent_dma_mask = 0xffffffff,
486 },
487};
488
489struct platform_device msm_device_sdc3 = {
490 .name = "msm_sdcc",
491 .id = 3,
492 .num_resources = ARRAY_SIZE(resources_sdc3),
493 .resource = resources_sdc3,
494 .dev = {
495 .coherent_dma_mask = 0xffffffff,
496 },
497};
498
499struct platform_device msm_device_sdc4 = {
500 .name = "msm_sdcc",
501 .id = 4,
502 .num_resources = ARRAY_SIZE(resources_sdc4),
503 .resource = resources_sdc4,
504 .dev = {
505 .coherent_dma_mask = 0xffffffff,
506 },
507};
508
509static struct platform_device *msm_sdcc_devices[] __initdata = {
510 &msm_device_sdc1,
511 &msm_device_sdc2,
512 &msm_device_sdc3,
513 &msm_device_sdc4,
514};
515
516int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
517{
518 struct platform_device *pdev;
519
520 if (controller < 1 || controller > 4)
521 return -EINVAL;
522
523 pdev = msm_sdcc_devices[controller-1];
524 pdev->dev.platform_data = plat;
525 return platform_device_register(pdev);
526}
527
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530528#ifdef CONFIG_MSM_CAMERA_V4L2
529static struct resource msm_csic0_resources[] = {
530 {
531 .name = "csic",
532 .start = 0xA0F00000,
533 .end = 0xA0F00000 + 0x00100000 - 1,
534 .flags = IORESOURCE_MEM,
535 },
536 {
537 .name = "csic",
538 .start = INT_CSI_IRQ_0,
539 .end = INT_CSI_IRQ_0,
540 .flags = IORESOURCE_IRQ,
541 },
542};
543
544static struct resource msm_csic1_resources[] = {
545 {
546 .name = "csic",
547 .start = 0xA1000000,
548 .end = 0xA1000000 + 0x00100000 - 1,
549 .flags = IORESOURCE_MEM,
550 },
551 {
552 .name = "csic",
553 .start = INT_CSI_IRQ_1,
554 .end = INT_CSI_IRQ_1,
555 .flags = IORESOURCE_IRQ,
556 },
557};
558
559struct platform_device msm7x27a_device_csic0 = {
560 .name = "msm_csic",
561 .id = 0,
562 .resource = msm_csic0_resources,
563 .num_resources = ARRAY_SIZE(msm_csic0_resources),
564};
565
566struct platform_device msm7x27a_device_csic1 = {
567 .name = "msm_csic",
568 .id = 1,
569 .resource = msm_csic1_resources,
570 .num_resources = ARRAY_SIZE(msm_csic1_resources),
571};
572
573static struct resource msm_clkctl_resources[] = {
574 {
575 .name = "clk_ctl",
Taniya Das13b811a2011-12-09 18:33:45 +0530576 .start = MSM7XXX_CLK_CTL_PHYS,
577 .end = MSM7XXX_CLK_CTL_PHYS + MSM7XXX_CLK_CTL_SIZE - 1,
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530578 .flags = IORESOURCE_MEM,
579 },
580};
581struct platform_device msm7x27a_device_clkctl = {
582 .name = "msm_clk_ctl",
583 .id = 0,
584 .resource = msm_clkctl_resources,
585 .num_resources = ARRAY_SIZE(msm_clkctl_resources),
586};
587
588struct platform_device msm7x27a_device_vfe = {
589 .name = "msm_vfe",
590 .id = 0,
591};
592
593#endif
594
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700595#define MDP_BASE 0xAA200000
596#define MIPI_DSI_HW_BASE 0xA1100000
597
598static struct resource msm_mipi_dsi_resources[] = {
599 {
600 .name = "mipi_dsi",
601 .start = MIPI_DSI_HW_BASE,
602 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
603 .flags = IORESOURCE_MEM,
604 },
605 {
606 .start = INT_DSI_IRQ,
607 .end = INT_DSI_IRQ,
608 .flags = IORESOURCE_IRQ,
609 },
610};
611
612static struct platform_device msm_mipi_dsi_device = {
613 .name = "mipi_dsi",
614 .id = 1,
615 .num_resources = ARRAY_SIZE(msm_mipi_dsi_resources),
616 .resource = msm_mipi_dsi_resources,
617};
618
619static struct resource msm_mdp_resources[] = {
620 {
621 .name = "mdp",
622 .start = MDP_BASE,
623 .end = MDP_BASE + 0x000F1008 - 1,
624 .flags = IORESOURCE_MEM,
625 },
626 {
627 .start = INT_MDP,
628 .end = INT_MDP,
629 .flags = IORESOURCE_IRQ,
630 },
631};
632
633static struct platform_device msm_mdp_device = {
634 .name = "mdp",
635 .id = 0,
636 .num_resources = ARRAY_SIZE(msm_mdp_resources),
637 .resource = msm_mdp_resources,
638};
639
640static struct platform_device msm_lcdc_device = {
641 .name = "lcdc",
642 .id = 0,
643};
644
645static struct resource kgsl_3d0_resources[] = {
646 {
647 .name = KGSL_3D0_REG_MEMORY,
648 .start = 0xA0000000,
649 .end = 0xA001ffff,
650 .flags = IORESOURCE_MEM,
651 },
652 {
653 .name = KGSL_3D0_IRQ,
654 .start = INT_GRAPHICS,
655 .end = INT_GRAPHICS,
656 .flags = IORESOURCE_IRQ,
657 },
658};
659
660static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600661 .pwrlevel = {
662 {
663 .gpu_freq = 245760000,
664 .bus_freq = 200000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700665 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600666 {
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530667 .gpu_freq = 192000000,
668 .bus_freq = 160000000,
669 },
670 {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600671 .gpu_freq = 133330000,
672 .bus_freq = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700673 },
674 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600675 .init_level = 0,
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530676 .num_levels = 3,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600677 .set_grp_async = set_grp_xbar_async,
678 .idle_timeout = HZ/5,
679 .nap_allowed = false,
680 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700681};
682
683struct platform_device msm_kgsl_3d0 = {
684 .name = "kgsl-3d0",
685 .id = 0,
686 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
687 .resource = kgsl_3d0_resources,
688 .dev = {
689 .platform_data = &kgsl_3d0_pdata,
690 },
691};
692
693void __init msm7x25a_kgsl_3d0_init(void)
694{
695 if (cpu_is_msm7x25a() || cpu_is_msm7x25aa()) {
Lynus Vaz971610e2012-01-06 11:00:32 +0530696 kgsl_3d0_pdata.num_levels = 2;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600697 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 133330000;
698 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 160000000;
699 kgsl_3d0_pdata.pwrlevel[1].gpu_freq = 96000000;
700 kgsl_3d0_pdata.pwrlevel[1].bus_freq = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700701 }
702}
703
704static void __init msm_register_device(struct platform_device *pdev, void *data)
705{
706 int ret;
707
708 pdev->dev.platform_data = data;
709
710 ret = platform_device_register(pdev);
711
712 if (ret)
713 dev_err(&pdev->dev,
714 "%s: platform_device_register() failed = %d\n",
715 __func__, ret);
716}
717
718void __init msm_fb_register_device(char *name, void *data)
719{
720 if (!strncmp(name, "mdp", 3))
721 msm_register_device(&msm_mdp_device, data);
722 else if (!strncmp(name, "mipi_dsi", 8))
723 msm_register_device(&msm_mipi_dsi_device, data);
724 else if (!strncmp(name, "lcdc", 4))
725 msm_register_device(&msm_lcdc_device, data);
726 else
727 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
728}
729
730#define PERPH_WEB_BLOCK_ADDR (0xA9D00040)
731#define PDM0_CTL_OFFSET (0x04)
732#define SIZE_8B (0x08)
733
734static struct resource resources_led[] = {
735 {
736 .start = PERPH_WEB_BLOCK_ADDR,
737 .end = PERPH_WEB_BLOCK_ADDR + (SIZE_8B) - 1,
738 .name = "led-gpio-pdm",
739 .flags = IORESOURCE_MEM,
740 },
741};
742
743static struct led_info msm_kpbl_pdm_led_pdata = {
744 .name = "keyboard-backlight",
745};
746
747struct platform_device led_pdev = {
748 .name = "leds-msm-pdm",
749 /* use pdev id to represent pdm id */
750 .id = 0,
751 .num_resources = ARRAY_SIZE(resources_led),
752 .resource = resources_led,
753 .dev = {
754 .platform_data = &msm_kpbl_pdm_led_pdata,
755 },
756};
757
Manish Dewangan3a260992011-06-24 18:01:34 +0530758struct platform_device asoc_msm_pcm = {
759 .name = "msm-dsp-audio",
760 .id = 0,
761};
762
763struct platform_device asoc_msm_dai0 = {
764 .name = "msm-codec-dai",
765 .id = 0,
766};
767
768struct platform_device asoc_msm_dai1 = {
769 .name = "msm-cpu-dai",
770 .id = 0,
771};
772
Taniya Das2e948192011-12-20 11:15:13 +0530773static struct resource gpio_resources[] = {
774 {
775 .start = INT_GPIO_GROUP1,
776 .flags = IORESOURCE_IRQ,
777 },
778 {
779 .start = INT_GPIO_GROUP2,
780 .flags = IORESOURCE_IRQ,
781 },
782};
783
784static struct platform_device msm_device_gpio = {
785 .name = "msmgpio",
786 .id = -1,
787 .resource = gpio_resources,
788 .num_resources = ARRAY_SIZE(gpio_resources),
789};
790
Taniya Das43bcdd62011-12-02 17:33:27 +0530791struct platform_device *msm_footswitch_devices[] = {
792 FS_PCOM(FS_GFX3D, "fs_gfx3d"),
793};
794unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
795
796/* MSM8625 Devices */
797
798static struct resource msm8625_resources_uart1[] = {
799 {
800 .start = MSM8625_INT_UART1,
801 .end = MSM8625_INT_UART1,
802 .flags = IORESOURCE_IRQ,
803 },
804 {
Taniya Das13b811a2011-12-09 18:33:45 +0530805 .start = MSM7XXX_UART1_PHYS,
806 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Taniya Das43bcdd62011-12-02 17:33:27 +0530807 .flags = IORESOURCE_MEM,
808 },
809};
810
811struct platform_device msm8625_device_uart1 = {
812 .name = "msm_serial",
813 .id = 0,
814 .num_resources = ARRAY_SIZE(msm8625_resources_uart1),
815 .resource = msm8625_resources_uart1,
816};
817
818static struct resource msm8625_dmov_resource[] = {
819 {
820 .start = MSM8625_INT_ADM_AARM,
821 .flags = IORESOURCE_IRQ,
822 },
823 {
824 .start = 0xA9700000,
825 .end = 0xA9700000 + SZ_4K - 1,
826 .flags = IORESOURCE_MEM,
827 },
828};
829
830struct platform_device msm8625_device_dmov = {
831 .name = "msm_dmov",
832 .id = -1,
833 .resource = msm8625_dmov_resource,
834 .num_resources = ARRAY_SIZE(msm8625_dmov_resource),
835 .dev = {
836 .platform_data = &msm_dmov_pdata,
837 },
838};
Taniya Das2e948192011-12-20 11:15:13 +0530839
Taniya Das7c9f0512011-12-02 14:26:46 +0530840static struct clk_lookup msm_clock_8625_dummy[] = {
841 CLK_DUMMY("core_clk", adm_clk.c, "msm_dmov", 0),
842 CLK_DUMMY("adsp_clk", adsp_clk.c, NULL, 0),
843 CLK_DUMMY("ahb_m_clk", ahb_m_clk.c, NULL, 0),
844 CLK_DUMMY("ahb_s_clk", ahb_s_clk.c, NULL, 0),
845 CLK_DUMMY("cam_m_clk", cam_m_clk.c, NULL, 0),
846 CLK_DUMMY("csi_clk", csi1_clk.c, NULL, 0),
847 CLK_DUMMY("csi_pclk", csi1_p_clk.c, NULL, 0),
848 CLK_DUMMY("csi_vfe_clk", csi1_vfe_clk.c, NULL, 0),
849 CLK_DUMMY("dsi_byte_clk", dsi_byte_clk.c, NULL, 0),
850 CLK_DUMMY("dsi_clk", dsi_clk.c, NULL, 0),
851 CLK_DUMMY("dsi_esc_clk", dsi_esc_clk.c, NULL, 0),
852 CLK_DUMMY("dsi_pixel_clk", dsi_pixel_clk.c, NULL, 0),
853 CLK_DUMMY("dsi_ref_clk", dsi_ref_clk.c, NULL, 0),
854 CLK_DUMMY("ebi1_clk", ebi1_clk.c, NULL, 0),
855 CLK_DUMMY("ebi2_clk", ebi2_clk.c, NULL, 0),
856 CLK_DUMMY("ecodec_clk", ecodec_clk.c, NULL, 0),
857 CLK_DUMMY("gp_clk", gp_clk.c, NULL, 0),
858 CLK_DUMMY("core_clk", gsbi1_qup_clk.c, "qup_i2c.0", 0),
859 CLK_DUMMY("core_clk", gsbi2_qup_clk.c, "qup_i2c.1", 0),
860 CLK_DUMMY("iface_clk", gsbi1_qup_p_clk.c, "qup_i2c.0", 0),
861 CLK_DUMMY("iface_clk", gsbi2_qup_p_clk.c, "qup_i2c.1", 0),
862 CLK_DUMMY("icodec_rx_clk", icodec_rx_clk.c, NULL, 0),
863 CLK_DUMMY("icodec_tx_clk", icodec_tx_clk.c, NULL, 0),
864 CLK_DUMMY("mem_clk", imem_clk.c, NULL, 0),
865 CLK_DUMMY("mddi_clk", pmdh_clk.c, NULL, 0),
866 CLK_DUMMY("mdp_clk", mdp_clk.c, NULL, 0),
867 CLK_DUMMY("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL, 0),
868 CLK_DUMMY("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL, 0),
869 CLK_DUMMY("mdp_vsync_clk", mdp_vsync_clk.c, NULL, 0),
870 CLK_DUMMY("mdp_dsi_pclk", mdp_dsi_p_clk.c, NULL, 0),
871 CLK_DUMMY("pbus_clk", pbus_clk.c, NULL, 0),
872 CLK_DUMMY("pcm_clk", pcm_clk.c, NULL, 0),
873 CLK_DUMMY("sdac_clk", sdac_clk.c, NULL, 0),
874 CLK_DUMMY("core_clk", sdc1_clk.c, "msm_sdcc.1", 0),
875 CLK_DUMMY("iface_clk", sdc1_p_clk.c, "msm_sdcc.1", 0),
876 CLK_DUMMY("core_clk", sdc2_clk.c, "msm_sdcc.2", 0),
877 CLK_DUMMY("iface_clk", sdc2_p_clk.c, "msm_sdcc.2", 0),
878 CLK_DUMMY("core_clk", sdc3_clk.c, "msm_sdcc.3", 0),
879 CLK_DUMMY("iface_clk", sdc3_p_clk.c, "msm_sdcc.3", 0),
880 CLK_DUMMY("core_clk", sdc4_clk.c, "msm_sdcc.4", 0),
881 CLK_DUMMY("iface_clk", sdc4_p_clk.c, "msm_sdcc.4", 0),
882 CLK_DUMMY("ref_clk", tsif_ref_clk.c, "msm_tsif.0", 0),
883 CLK_DUMMY("iface_clk", tsif_p_clk.c, "msm_tsif.0", 0),
884 CLK_DUMMY("core_clk", uart1_clk.c, "msm_serial.0", 0),
885 CLK_DUMMY("core_clk", uart2_clk.c, "msm_serial.1", 0),
886 CLK_DUMMY("core_clk", uart1dm_clk.c, "msm_serial_hs.0", 0),
887 CLK_DUMMY("core_clk", uart2dm_clk.c, "msm_serial_hsl.0", 0),
888 CLK_DUMMY("usb_hs_core_clk", usb_hs_core_clk.c, NULL, 0),
889 CLK_DUMMY("usb_hs2_clk", usb_hs2_clk.c, NULL, 0),
890 CLK_DUMMY("usb_hs_clk", usb_hs_clk.c, NULL, 0),
891 CLK_DUMMY("usb_hs_pclk", usb_hs_p_clk.c, NULL, 0),
892 CLK_DUMMY("usb_phy_clk", usb_phy_clk.c, NULL, 0),
893 CLK_DUMMY("vdc_clk", vdc_clk.c, NULL, 0),
894 CLK_DUMMY("ebi1_acpu_clk", ebi_acpu_clk.c, NULL, 0),
895 CLK_DUMMY("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL, 0),
896 CLK_DUMMY("ebi1_mddi_clk", ebi_mddi_clk.c, NULL, 0),
897 CLK_DUMMY("ebi1_usb_clk", ebi_usb_clk.c, NULL, 0),
898 CLK_DUMMY("ebi1_vfe_clk", ebi_vfe_clk.c, NULL, 0),
899 CLK_DUMMY("mem_clk", ebi_adm_clk.c, "msm_dmov", 0),
900};
901
902struct clock_init_data msm8625_dummy_clock_init_data __initdata = {
903 .table = msm_clock_8625_dummy,
904 .size = ARRAY_SIZE(msm_clock_8625_dummy),
905};
906
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700907int __init msm7x2x_misc_init(void)
908{
Taniya Das7c9f0512011-12-02 14:26:46 +0530909 if (machine_is_msm8625_rumi3()) {
910 msm_clock_init(&msm8625_dummy_clock_init_data);
Taniya Das43bcdd62011-12-02 17:33:27 +0530911 return 0;
Taniya Das7c9f0512011-12-02 14:26:46 +0530912 }
Taniya Das43bcdd62011-12-02 17:33:27 +0530913
Stephen Boydbb600ae2011-08-02 20:11:40 -0700914 msm_clock_init(&msm7x27a_clock_init_data);
Matt Wagantallec57f062011-08-16 23:54:46 -0700915 if (cpu_is_msm7x27aa())
916 acpuclk_init(&acpuclk_7x27aa_soc_data);
917 else
918 acpuclk_init(&acpuclk_7x27a_soc_data);
919
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700920
921 return 0;
922}
923
924#ifdef CONFIG_CACHE_L2X0
925static int __init msm7x27x_cache_init(void)
926{
927 int aux_ctrl = 0;
928
929 /* Way Size 010(0x2) 32KB */
930 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
931 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
932 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
933
Taniya Das379b5682011-12-02 14:53:46 +0530934 if (cpu_is_msm8625()) {
935 /* Way Size 011(0x3) 64KB */
936 aux_ctrl |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
937 (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | \
938 (0x1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT);
939 }
940
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700941 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
942
943 return 0;
944}
945#else
pankaj kumar80d7cb62011-08-23 13:37:55 +0530946static int __init msm7x27x_cache_init(void){ return 0; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700947#endif
948
949void __init msm_common_io_init(void)
950{
951 msm_map_common_io();
Taniya Das43bcdd62011-12-02 17:33:27 +0530952 if (socinfo_init() < 0)
953 pr_err("%s: socinfo_init() failed!\n", __func__);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700954 msm7x27x_cache_init();
Taniya Das43bcdd62011-12-02 17:33:27 +0530955}
956
957void __init msm8625_init_irq(void)
958{
959 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
960 (void *)MSM_QGIC_CPU_BASE);
961
962 /* Edge trigger PPIs
963 */
964 writel_relaxed(0x555555F5, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
965
966 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
967 mb();
968}
969
970void __init msm8625_map_io(void)
971{
972 msm_map_msm8625_io();
973
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700974 if (socinfo_init() < 0)
975 pr_err("%s: socinfo_init() failed!\n", __func__);
Taniya Das379b5682011-12-02 14:53:46 +0530976 msm7x27x_cache_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700977}
978
Taniya Das43bcdd62011-12-02 17:33:27 +0530979static int msm7627a_init_gpio(void)
980{
981 platform_device_register(&msm_device_gpio);
982 return 0;
983}
984postcore_initcall(msm7627a_init_gpio);
985