blob: ad0104283490bc02d63ba177ff12943c014d7122 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/*
2 * Copyright (C) 2008 Google, Inc.
Duy Truong790f06d2013-02-13 16:38:12 -08003 * Copyright (c) 2008-2012, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#include <linux/kernel.h>
17#include <linux/platform_device.h>
Jordan Crouse914de9b2012-07-09 13:49:46 -060018#include <mach/kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070019#include <linux/regulator/machine.h>
20#include <linux/dma-mapping.h>
Taniya Das2e948192011-12-20 11:15:13 +053021#include <linux/init.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070022#include <asm/clkdev.h>
23#include <mach/irqs.h>
24#include <mach/msm_iomap.h>
25#include <mach/dma.h>
26#include <mach/board.h>
27
28#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070029#include "footswitch.h"
Matt Wagantallbf430eb2012-03-22 11:45:49 -070030#include "acpuclock.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070031
32#include <asm/mach/flash.h>
33
34#include <asm/mach/mmc.h>
35#include <mach/msm_hsusb.h>
36#include <mach/usbdiag.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <mach/rpc_hsusb.h>
Murali Nalajala2a0bbda2012-03-28 12:12:54 +053038#include "irq.h"
39#include "pm.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070040
41static struct resource resources_uart1[] = {
42 {
43 .start = INT_UART1,
44 .end = INT_UART1,
45 .flags = IORESOURCE_IRQ,
46 },
47 {
Taniya Das13b811a2011-12-09 18:33:45 +053048 .start = MSM7XXX_UART1_PHYS,
49 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050 .flags = IORESOURCE_MEM,
51 },
52};
53
54static struct resource resources_uart2[] = {
55 {
56 .start = INT_UART2,
57 .end = INT_UART2,
58 .flags = IORESOURCE_IRQ,
59 },
60 {
Taniya Das13b811a2011-12-09 18:33:45 +053061 .start = MSM7XXX_UART2_PHYS,
62 .end = MSM7XXX_UART2_PHYS + MSM7XXX_UART2_SIZE - 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063 .flags = IORESOURCE_MEM,
64 },
65};
66
67struct platform_device msm_device_uart1 = {
68 .name = "msm_serial",
69 .id = 0,
70 .num_resources = ARRAY_SIZE(resources_uart1),
71 .resource = resources_uart1,
72};
73
74struct platform_device msm_device_uart2 = {
75 .name = "msm_serial",
76 .id = 1,
77 .num_resources = ARRAY_SIZE(resources_uart2),
78 .resource = resources_uart2,
79};
80
Laxminath Kasam1f2cd2a2012-02-15 12:12:44 +053081static struct resource resources_adsp[] = {
82 {
83 .start = INT_ADSP_A9_A11,
84 .end = INT_ADSP_A9_A11,
85 .flags = IORESOURCE_IRQ,
86 },
87};
88
89struct platform_device msm_adsp_device = {
90 .name = "msm_adsp",
91 .id = -1,
92 .num_resources = ARRAY_SIZE(resources_adsp),
93 .resource = resources_adsp,
94};
95
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070096#define MSM_UART1DM_PHYS 0xA0200000
97#define MSM_UART2DM_PHYS 0xA0300000
98static struct resource msm_uart1_dm_resources[] = {
99 {
100 .start = MSM_UART1DM_PHYS,
101 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
102 .flags = IORESOURCE_MEM,
103 },
104 {
105 .start = INT_UART1DM_IRQ,
106 .end = INT_UART1DM_IRQ,
107 .flags = IORESOURCE_IRQ,
108 },
109 {
110 .start = INT_UART1DM_RX,
111 .end = INT_UART1DM_RX,
112 .flags = IORESOURCE_IRQ,
113 },
114 {
115 .start = DMOV_HSUART1_TX_CHAN,
116 .end = DMOV_HSUART1_RX_CHAN,
117 .name = "uartdm_channels",
118 .flags = IORESOURCE_DMA,
119 },
120 {
121 .start = DMOV_HSUART1_TX_CRCI,
122 .end = DMOV_HSUART1_RX_CRCI,
123 .name = "uartdm_crci",
124 .flags = IORESOURCE_DMA,
125 },
126};
127
128static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
129
130struct platform_device msm_device_uart_dm1 = {
131 .name = "msm_serial_hs",
132 .id = 0,
133 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
134 .resource = msm_uart1_dm_resources,
135 .dev = {
136 .dma_mask = &msm_uart_dm1_dma_mask,
137 .coherent_dma_mask = DMA_BIT_MASK(32),
138 },
139};
140
141static struct resource msm_uart2_dm_resources[] = {
142 {
143 .start = MSM_UART2DM_PHYS,
144 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
145 .flags = IORESOURCE_MEM,
146 },
147 {
148 .start = INT_UART2DM_IRQ,
149 .end = INT_UART2DM_IRQ,
150 .flags = IORESOURCE_IRQ,
151 },
152 {
153 .start = INT_UART2DM_RX,
154 .end = INT_UART2DM_RX,
155 .flags = IORESOURCE_IRQ,
156 },
157 {
158 .start = DMOV_HSUART2_TX_CHAN,
159 .end = DMOV_HSUART2_RX_CHAN,
160 .name = "uartdm_channels",
161 .flags = IORESOURCE_DMA,
162 },
163 {
164 .start = DMOV_HSUART2_TX_CRCI,
165 .end = DMOV_HSUART2_RX_CRCI,
166 .name = "uartdm_crci",
167 .flags = IORESOURCE_DMA,
168 },
169};
170
171static u64 msm_uart_dm2_dma_mask = DMA_BIT_MASK(32);
172
173struct platform_device msm_device_uart_dm2 = {
174 .name = "msm_serial_hs",
175 .id = 1,
176 .num_resources = ARRAY_SIZE(msm_uart2_dm_resources),
177 .resource = msm_uart2_dm_resources,
178 .dev = {
179 .dma_mask = &msm_uart_dm2_dma_mask,
180 .coherent_dma_mask = DMA_BIT_MASK(32),
181 },
182};
183
184#define MSM_I2C_SIZE SZ_4K
185#define MSM_I2C_PHYS 0xA9900000
186static struct resource resources_i2c[] = {
187 {
188 .start = MSM_I2C_PHYS,
189 .end = MSM_I2C_PHYS + MSM_I2C_SIZE - 1,
190 .flags = IORESOURCE_MEM,
191 },
192 {
193 .start = INT_PWB_I2C,
194 .end = INT_PWB_I2C,
195 .flags = IORESOURCE_IRQ,
196 },
197};
198
199struct platform_device msm_device_i2c = {
200 .name = "msm_i2c",
201 .id = 0,
202 .num_resources = ARRAY_SIZE(resources_i2c),
203 .resource = resources_i2c,
204};
205
206#define MSM_HSUSB_PHYS 0xA0800000
207static struct resource resources_hsusb_otg[] = {
208 {
209 .start = MSM_HSUSB_PHYS,
210 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
211 .flags = IORESOURCE_MEM,
212 },
213 {
214 .start = INT_USB_HS,
215 .end = INT_USB_HS,
216 .flags = IORESOURCE_IRQ,
217 },
218};
219
220static u64 dma_mask = 0xffffffffULL;
221struct platform_device msm_device_hsusb_otg = {
222 .name = "msm_hsusb_otg",
223 .id = -1,
224 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
225 .resource = resources_hsusb_otg,
226 .dev = {
227 .dma_mask = &dma_mask,
228 .coherent_dma_mask = 0xffffffffULL,
229 },
230};
231
232static struct resource resources_hsusb_peripheral[] = {
233 {
234 .start = MSM_HSUSB_PHYS,
235 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
236 .flags = IORESOURCE_MEM,
237 },
238 {
239 .start = INT_USB_HS,
240 .end = INT_USB_HS,
241 .flags = IORESOURCE_IRQ,
242 },
243};
244
245static struct resource resources_gadget_peripheral[] = {
246 {
247 .start = MSM_HSUSB_PHYS,
248 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
249 .flags = IORESOURCE_MEM,
250 },
251 {
252 .start = INT_USB_HS,
253 .end = INT_USB_HS,
254 .flags = IORESOURCE_IRQ,
255 },
256};
257
258struct platform_device msm_device_hsusb_peripheral = {
259 .name = "msm_hsusb_peripheral",
260 .id = -1,
261 .num_resources = ARRAY_SIZE(resources_hsusb_peripheral),
262 .resource = resources_hsusb_peripheral,
263 .dev = {
264 .dma_mask = &dma_mask,
265 .coherent_dma_mask = 0xffffffffULL,
266 },
267};
268
269struct platform_device msm_device_gadget_peripheral = {
270 .name = "msm_hsusb",
271 .id = -1,
272 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
273 .resource = resources_gadget_peripheral,
274 .dev = {
275 .dma_mask = &dma_mask,
276 .coherent_dma_mask = 0xffffffffULL,
277 },
278};
279
280static struct resource resources_hsusb_host[] = {
281 {
282 .start = MSM_HSUSB_PHYS,
283 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
284 .flags = IORESOURCE_MEM,
285 },
286 {
287 .start = INT_USB_HS,
288 .end = INT_USB_HS,
289 .flags = IORESOURCE_IRQ,
290 },
291};
292
293struct platform_device msm_device_hsusb_host = {
294 .name = "msm_hsusb_host",
295 .id = 0,
296 .num_resources = ARRAY_SIZE(resources_hsusb_host),
297 .resource = resources_hsusb_host,
298 .dev = {
299 .dma_mask = &dma_mask,
300 .coherent_dma_mask = 0xffffffffULL,
301 },
302};
303
304static struct platform_device *msm_host_devices[] = {
305 &msm_device_hsusb_host,
306};
307
308int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
309{
310 struct platform_device *pdev;
311
312 pdev = msm_host_devices[host];
313 if (!pdev)
314 return -ENODEV;
315 pdev->dev.platform_data = plat;
316 return platform_device_register(pdev);
317}
318
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700319struct platform_device asoc_msm_pcm = {
320 .name = "msm-dsp-audio",
321 .id = 0,
322};
323
324struct platform_device asoc_msm_dai0 = {
325 .name = "msm-codec-dai",
326 .id = 0,
327};
328
329struct platform_device asoc_msm_dai1 = {
330 .name = "msm-cpu-dai",
331 .id = 0,
332};
333
334#define MSM_NAND_PHYS 0xA0A00000
335static struct resource resources_nand[] = {
336 [0] = {
337 .name = "msm_nand_dmac",
338 .start = DMOV_NAND_CHAN,
339 .end = DMOV_NAND_CHAN,
340 .flags = IORESOURCE_DMA,
341 },
342 [1] = {
343 .name = "msm_nand_phys",
344 .start = MSM_NAND_PHYS,
345 .end = MSM_NAND_PHYS + 0x7FF,
346 .flags = IORESOURCE_MEM,
347 },
348};
349
350static struct resource resources_otg[] = {
351 {
352 .start = MSM_HSUSB_PHYS,
353 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
354 .flags = IORESOURCE_MEM,
355 },
356 {
357 .start = INT_USB_HS,
358 .end = INT_USB_HS,
359 .flags = IORESOURCE_IRQ,
360 },
361};
362
363struct platform_device msm_device_otg = {
364 .name = "msm_otg",
365 .id = -1,
366 .num_resources = ARRAY_SIZE(resources_otg),
367 .resource = resources_otg,
368 .dev = {
369 .coherent_dma_mask = 0xffffffffULL,
370 },
371};
372
373struct flash_platform_data msm_nand_data = {
374 .parts = NULL,
375 .nr_parts = 0,
376};
377
378struct platform_device msm_device_nand = {
379 .name = "msm_nand",
380 .id = -1,
381 .num_resources = ARRAY_SIZE(resources_nand),
382 .resource = resources_nand,
383 .dev = {
384 .platform_data = &msm_nand_data,
385 },
386};
387
388struct platform_device msm_device_smd = {
389 .name = "msm_smd",
390 .id = -1,
391};
392
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700393static struct resource msm_dmov_resource[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700394 {
395 .start = INT_ADM_AARM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700396 .flags = IORESOURCE_IRQ,
397 },
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700398 {
399 .start = 0xA9700000,
400 .end = 0xA9700000 + SZ_4K - 1,
401 .flags = IORESOURCE_MEM,
402 },
403};
404
405static struct msm_dmov_pdata msm_dmov_pdata = {
406 .sd = 3,
407 .sd_size = 0x400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700408};
409
410struct platform_device msm_device_dmov = {
411 .name = "msm_dmov",
412 .id = -1,
413 .resource = msm_dmov_resource,
414 .num_resources = ARRAY_SIZE(msm_dmov_resource),
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700415 .dev = {
416 .platform_data = &msm_dmov_pdata,
417 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700418};
419
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530420static struct msm_pm_irq_calls msm7x27_pm_irq_calls = {
421 .irq_pending = msm_irq_pending,
422 .idle_sleep_allowed = msm_irq_idle_sleep_allowed,
423 .enter_sleep1 = msm_irq_enter_sleep1,
424 .enter_sleep2 = msm_irq_enter_sleep2,
425 .exit_sleep1 = msm_irq_exit_sleep1,
426 .exit_sleep2 = msm_irq_exit_sleep2,
427 .exit_sleep3 = msm_irq_exit_sleep3,
428};
429
Stephen Boyd986c9632012-04-24 16:31:45 -0700430void __init msm_pm_register_irqs(void)
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530431{
432 msm_pm_set_irq_extns(&msm7x27_pm_irq_calls);
433}
434
Matt Wagantallbf430eb2012-03-22 11:45:49 -0700435static struct acpuclk_pdata msm7x27_acpuclk_pdata = {
436 .max_speed_delta_khz = 400000,
437};
438
439struct platform_device msm7x27_device_acpuclk = {
440 .name = "acpuclk-7627",
441 .id = -1,
442 .dev.platform_data = &msm7x27_acpuclk_pdata,
443};
444
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700445#define MSM_SDC1_BASE 0xA0400000
446#define MSM_SDC2_BASE 0xA0500000
447#define MSM_SDC3_BASE 0xA0600000
448#define MSM_SDC4_BASE 0xA0700000
449static struct resource resources_sdc1[] = {
450 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530451 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700452 .start = MSM_SDC1_BASE,
453 .end = MSM_SDC1_BASE + SZ_4K - 1,
454 .flags = IORESOURCE_MEM,
455 },
456 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530457 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700458 .start = INT_SDC1_0,
459 .end = INT_SDC1_1,
460 .flags = IORESOURCE_IRQ,
461 },
462 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530463 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700464 .start = DMOV_SDC1_CHAN,
465 .end = DMOV_SDC1_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700466 .flags = IORESOURCE_DMA,
467 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700468 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530469 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700470 .start = DMOV_SDC1_CRCI,
471 .end = DMOV_SDC1_CRCI,
472 .flags = IORESOURCE_DMA,
473 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700474};
475
476static struct resource resources_sdc2[] = {
477 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530478 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700479 .start = MSM_SDC2_BASE,
480 .end = MSM_SDC2_BASE + SZ_4K - 1,
481 .flags = IORESOURCE_MEM,
482 },
483 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530484 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700485 .start = INT_SDC2_0,
486 .end = INT_SDC2_1,
487 .flags = IORESOURCE_IRQ,
488 },
489 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530490 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700491 .start = DMOV_SDC2_CHAN,
492 .end = DMOV_SDC2_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700493 .flags = IORESOURCE_DMA,
494 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700495 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530496 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700497 .start = DMOV_SDC2_CRCI,
498 .end = DMOV_SDC2_CRCI,
499 .flags = IORESOURCE_DMA,
500 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700501};
502
503static struct resource resources_sdc3[] = {
504 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530505 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700506 .start = MSM_SDC3_BASE,
507 .end = MSM_SDC3_BASE + SZ_4K - 1,
508 .flags = IORESOURCE_MEM,
509 },
510 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530511 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700512 .start = INT_SDC3_0,
513 .end = INT_SDC3_1,
514 .flags = IORESOURCE_IRQ,
515 },
516 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530517 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700518 .start = DMOV_SDC3_CHAN,
519 .end = DMOV_SDC3_CHAN,
520 .flags = IORESOURCE_DMA,
521 },
522 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530523 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700524 .start = DMOV_SDC3_CRCI,
525 .end = DMOV_SDC3_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700526 .flags = IORESOURCE_DMA,
527 },
528};
529
530static struct resource resources_sdc4[] = {
531 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530532 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700533 .start = MSM_SDC4_BASE,
534 .end = MSM_SDC4_BASE + SZ_4K - 1,
535 .flags = IORESOURCE_MEM,
536 },
537 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530538 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700539 .start = INT_SDC4_0,
540 .end = INT_SDC4_1,
541 .flags = IORESOURCE_IRQ,
542 },
543 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530544 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700545 .start = DMOV_SDC4_CHAN,
546 .end = DMOV_SDC4_CHAN,
547 .flags = IORESOURCE_DMA,
548 },
549 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530550 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700551 .start = DMOV_SDC4_CRCI,
552 .end = DMOV_SDC4_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700553 .flags = IORESOURCE_DMA,
554 },
555};
556
557struct platform_device msm_device_sdc1 = {
558 .name = "msm_sdcc",
559 .id = 1,
560 .num_resources = ARRAY_SIZE(resources_sdc1),
561 .resource = resources_sdc1,
562 .dev = {
563 .coherent_dma_mask = 0xffffffff,
564 },
565};
566
567struct platform_device msm_device_sdc2 = {
568 .name = "msm_sdcc",
569 .id = 2,
570 .num_resources = ARRAY_SIZE(resources_sdc2),
571 .resource = resources_sdc2,
572 .dev = {
573 .coherent_dma_mask = 0xffffffff,
574 },
575};
576
577struct platform_device msm_device_sdc3 = {
578 .name = "msm_sdcc",
579 .id = 3,
580 .num_resources = ARRAY_SIZE(resources_sdc3),
581 .resource = resources_sdc3,
582 .dev = {
583 .coherent_dma_mask = 0xffffffff,
584 },
585};
586
587struct platform_device msm_device_sdc4 = {
588 .name = "msm_sdcc",
589 .id = 4,
590 .num_resources = ARRAY_SIZE(resources_sdc4),
591 .resource = resources_sdc4,
592 .dev = {
593 .coherent_dma_mask = 0xffffffff,
594 },
595};
596
597static struct platform_device *msm_sdcc_devices[] __initdata = {
598 &msm_device_sdc1,
599 &msm_device_sdc2,
600 &msm_device_sdc3,
601 &msm_device_sdc4,
602};
603
604int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
605{
606 struct platform_device *pdev;
607
608 if (controller < 1 || controller > 4)
609 return -EINVAL;
610
611 pdev = msm_sdcc_devices[controller-1];
612 pdev->dev.platform_data = plat;
613 return platform_device_register(pdev);
614}
615
616#if defined(CONFIG_FB_MSM_MDP40)
617#define MDP_BASE 0xA3F00000
618#define PMDH_BASE 0xAD600000
619#define EMDH_BASE 0xAD700000
620#define TVENC_BASE 0xAD400000
621#else
622#define MDP_BASE 0xAA200000
623#define PMDH_BASE 0xAA600000
624#define EMDH_BASE 0xAA700000
625#define TVENC_BASE 0xAA400000
626#endif
627
628static struct resource msm_mdp_resources[] = {
629 {
630 .name = "mdp",
631 .start = MDP_BASE,
632 .end = MDP_BASE + 0x000F0000 - 1,
633 .flags = IORESOURCE_MEM,
634 },
635 {
636 .start = INT_MDP,
637 .end = INT_MDP,
638 .flags = IORESOURCE_IRQ,
639 },
640};
641
642static struct resource msm_mddi_resources[] = {
643 {
644 .name = "pmdh",
645 .start = PMDH_BASE,
646 .end = PMDH_BASE + PAGE_SIZE - 1,
647 .flags = IORESOURCE_MEM,
648 }
649};
650
651static struct resource msm_mddi_ext_resources[] = {
652 {
653 .name = "emdh",
654 .start = EMDH_BASE,
655 .end = EMDH_BASE + PAGE_SIZE - 1,
656 .flags = IORESOURCE_MEM,
657 }
658};
659
660static struct resource msm_ebi2_lcd_resources[] = {
661 {
662 .name = "base",
663 .start = 0xa0d00000,
664 .end = 0xa0d00000 + PAGE_SIZE - 1,
665 .flags = IORESOURCE_MEM,
666 },
667 {
668 .name = "lcd01",
669 .start = 0x98000000,
670 .end = 0x98000000 + 0x80000 - 1,
671 .flags = IORESOURCE_MEM,
672 },
673 {
674 .name = "lcd02",
675 .start = 0x9c000000,
676 .end = 0x9c000000 + 0x80000 - 1,
677 .flags = IORESOURCE_MEM,
678 },
679};
680
681static struct resource msm_tvenc_resources[] = {
682 {
683 .name = "tvenc",
684 .start = TVENC_BASE,
685 .end = TVENC_BASE + PAGE_SIZE - 1,
686 .flags = IORESOURCE_MEM,
687 }
688};
689
690static struct platform_device msm_mdp_device = {
691 .name = "mdp",
692 .id = 0,
693 .num_resources = ARRAY_SIZE(msm_mdp_resources),
694 .resource = msm_mdp_resources,
695};
696
697static struct platform_device msm_mddi_device = {
698 .name = "mddi",
699 .id = 0,
700 .num_resources = ARRAY_SIZE(msm_mddi_resources),
701 .resource = msm_mddi_resources,
702};
703
704static struct platform_device msm_mddi_ext_device = {
705 .name = "mddi_ext",
706 .id = 0,
707 .num_resources = ARRAY_SIZE(msm_mddi_ext_resources),
708 .resource = msm_mddi_ext_resources,
709};
710
711static struct platform_device msm_ebi2_lcd_device = {
712 .name = "ebi2_lcd",
713 .id = 0,
714 .num_resources = ARRAY_SIZE(msm_ebi2_lcd_resources),
715 .resource = msm_ebi2_lcd_resources,
716};
717
Padmanabhan Komandurue77bcf52012-07-26 12:43:39 +0530718struct platform_device msm_lcdc_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700719 .name = "lcdc",
720 .id = 0,
721};
722
723static struct platform_device msm_tvenc_device = {
724 .name = "tvenc",
725 .id = 0,
726 .num_resources = ARRAY_SIZE(msm_tvenc_resources),
727 .resource = msm_tvenc_resources,
728};
729
730/* TSIF begin */
731#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
732
733#define MSM_TSIF_PHYS (0xa0100000)
734#define MSM_TSIF_SIZE (0x200)
735
736static struct resource tsif_resources[] = {
737 [0] = {
738 .flags = IORESOURCE_IRQ,
739 .start = INT_TSIF_IRQ,
740 .end = INT_TSIF_IRQ,
741 },
742 [1] = {
743 .flags = IORESOURCE_MEM,
744 .start = MSM_TSIF_PHYS,
745 .end = MSM_TSIF_PHYS + MSM_TSIF_SIZE - 1,
746 },
747 [2] = {
748 .flags = IORESOURCE_DMA,
749 .start = DMOV_TSIF_CHAN,
750 .end = DMOV_TSIF_CRCI,
751 },
752};
753
754static void tsif_release(struct device *dev)
755{
756 dev_info(dev, "release\n");
757}
758
759struct platform_device msm_device_tsif = {
760 .name = "msm_tsif",
761 .id = 0,
762 .num_resources = ARRAY_SIZE(tsif_resources),
763 .resource = tsif_resources,
764 .dev = {
765 .release = tsif_release,
766 },
767};
768#endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */
769/* TSIF end */
770
771#define MSM_TSSC_PHYS 0xAA300000
772static struct resource resources_tssc[] = {
773 {
774 .start = MSM_TSSC_PHYS,
775 .end = MSM_TSSC_PHYS + SZ_4K - 1,
776 .name = "tssc",
777 .flags = IORESOURCE_MEM,
778 },
779 {
780 .start = INT_TCHSCRN1,
781 .end = INT_TCHSCRN1,
782 .name = "tssc1",
783 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
784 },
785 {
786 .start = INT_TCHSCRN2,
787 .end = INT_TCHSCRN2,
788 .name = "tssc2",
789 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
790 },
791};
792
793struct platform_device msm_device_tssc = {
794 .name = "msm_touchscreen",
795 .id = 0,
796 .num_resources = ARRAY_SIZE(resources_tssc),
797 .resource = resources_tssc,
798};
799
800static void __init msm_register_device(struct platform_device *pdev, void *data)
801{
802 int ret;
803
804 pdev->dev.platform_data = data;
805
806 ret = platform_device_register(pdev);
807 if (ret)
808 dev_err(&pdev->dev,
809 "%s: platform_device_register() failed = %d\n",
810 __func__, ret);
811}
812
813void __init msm_fb_register_device(char *name, void *data)
814{
815 if (!strncmp(name, "mdp", 3))
816 msm_register_device(&msm_mdp_device, data);
817 else if (!strncmp(name, "pmdh", 4))
818 msm_register_device(&msm_mddi_device, data);
819 else if (!strncmp(name, "emdh", 4))
820 msm_register_device(&msm_mddi_ext_device, data);
821 else if (!strncmp(name, "ebi2", 4))
822 msm_register_device(&msm_ebi2_lcd_device, data);
823 else if (!strncmp(name, "tvenc", 5))
824 msm_register_device(&msm_tvenc_device, data);
825 else if (!strncmp(name, "lcdc", 4))
826 msm_register_device(&msm_lcdc_device, data);
827 else
828 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
829}
830
831static struct platform_device msm_camera_device = {
832 .name = "msm_camera",
833 .id = 0,
834};
835
836void __init msm_camera_register_device(void *res, uint32_t num,
837 void *data)
838{
839 msm_camera_device.num_resources = num;
840 msm_camera_device.resource = res;
841
842 msm_register_device(&msm_camera_device, data);
843}
844
845static struct resource kgsl_3d0_resources[] = {
846 {
847 .name = KGSL_3D0_REG_MEMORY,
848 .start = 0xA0000000,
849 .end = 0xA001ffff,
850 .flags = IORESOURCE_MEM,
851 },
852 {
853 .name = KGSL_3D0_IRQ,
854 .start = INT_GRAPHICS,
855 .end = INT_GRAPHICS,
856 .flags = IORESOURCE_IRQ,
857 },
858};
859
860static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600861 /* bus_freq has been set to 160000 for power savings.
862 * OEMs may modify the value at their discretion for performance
863 * The appropriate maximum replacement for 160000 is:
864 * msm7x2x_clock_data.max_axi_khz
865 */
866 .pwrlevel = {
867 {
868 .gpu_freq = 0,
869 .bus_freq = 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700870 },
871 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600872 .init_level = 0,
873 .num_levels = 1,
874 .set_grp_async = NULL,
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700875 .idle_timeout = HZ,
Lynus Vazfe4bede2012-04-06 11:53:30 -0700876 .strtstp_sleepwake = true,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600877 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700878};
879
880struct platform_device msm_kgsl_3d0 = {
881 .name = "kgsl-3d0",
882 .id = 0,
883 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
884 .resource = kgsl_3d0_resources,
885 .dev = {
886 .platform_data = &kgsl_3d0_pdata,
887 },
888};
889
890struct platform_device *msm_footswitch_devices[] = {
Matt Wagantalld6fbf232012-05-03 20:09:28 -0700891 FS_PCOM(FS_GFX3D, "vdd", "kgsl-3d0.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700892};
893unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
Taniya Das2e948192011-12-20 11:15:13 +0530894
895static struct resource gpio_resources[] = {
896 {
897 .start = INT_GPIO_GROUP1,
898 .flags = IORESOURCE_IRQ,
899 },
900 {
901 .start = INT_GPIO_GROUP2,
902 .flags = IORESOURCE_IRQ,
903 },
904};
905
906static struct platform_device msm_device_gpio = {
907 .name = "msmgpio",
908 .id = -1,
909 .resource = gpio_resources,
910 .num_resources = ARRAY_SIZE(gpio_resources),
911};
912
913static int __init msm7627_init_gpio(void)
914{
915 platform_device_register(&msm_device_gpio);
916 return 0;
917}
918
919postcore_initcall(msm7627_init_gpio);