blob: 674d55cfe395eaae18f35cd36186403a4c568eb4 [file] [log] [blame]
Daniel Walker62a6cc52010-05-05 07:27:16 -07001/*
2 * Copyright (C) 2008 Google, Inc.
Murali Nalajala2a0bbda2012-03-28 12:12:54 +05303 * Copyright (c) 2008-2012, Code Aurora Forum. All rights reserved.
Daniel Walker62a6cc52010-05-05 07:27:16 -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>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070018#include <linux/msm_kgsl.h>
Stephen Boydbd323442011-02-23 09:37:42 -080019
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/dma-mapping.h>
21#include <asm/clkdev.h>
Daniel Walker62a6cc52010-05-05 07:27:16 -070022#include <mach/irqs.h>
23#include <mach/msm_iomap.h>
24#include <mach/dma.h>
25#include <mach/board.h>
26
27#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028#include "gpio_hw.h"
Daniel Walker62a6cc52010-05-05 07:27:16 -070029
30#include <asm/mach/flash.h>
31
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070032#include <asm/mach/mmc.h>
33#include <mach/msm_hsusb.h>
34#include <mach/usbdiag.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070035#include <mach/rpc_hsusb.h>
Murali Nalajala2a0bbda2012-03-28 12:12:54 +053036#include "pm.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037
38static struct resource resources_uart1[] = {
39 {
40 .start = INT_UART1,
41 .end = INT_UART1,
42 .flags = IORESOURCE_IRQ,
43 },
44 {
45 .start = MSM_UART1_PHYS,
46 .end = MSM_UART1_PHYS + MSM_UART1_SIZE - 1,
47 .flags = IORESOURCE_MEM,
48 },
49};
50
51static struct resource resources_uart2[] = {
52 {
53 .start = INT_UART2,
54 .end = INT_UART2,
55 .flags = IORESOURCE_IRQ,
56 },
57 {
58 .start = MSM_UART2_PHYS,
59 .end = MSM_UART2_PHYS + MSM_UART2_SIZE - 1,
60 .flags = IORESOURCE_MEM,
61 },
62};
Daniel Walker62a6cc52010-05-05 07:27:16 -070063
64static struct resource resources_uart3[] = {
65 {
66 .start = INT_UART3,
67 .end = INT_UART3,
68 .flags = IORESOURCE_IRQ,
69 },
70 {
71 .start = MSM_UART3_PHYS,
72 .end = MSM_UART3_PHYS + MSM_UART3_SIZE - 1,
73 .flags = IORESOURCE_MEM,
Stepan Moskovchenkod41cb8c2011-01-17 20:33:32 -080074 .name = "uart_resource"
Daniel Walker62a6cc52010-05-05 07:27:16 -070075 },
76};
77
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070078struct platform_device msm_device_uart1 = {
79 .name = "msm_serial",
80 .id = 0,
81 .num_resources = ARRAY_SIZE(resources_uart1),
82 .resource = resources_uart1,
83};
84
85struct platform_device msm_device_uart2 = {
86 .name = "msm_serial",
87 .id = 1,
88 .num_resources = ARRAY_SIZE(resources_uart2),
89 .resource = resources_uart2,
90};
91
Daniel Walker62a6cc52010-05-05 07:27:16 -070092struct platform_device msm_device_uart3 = {
93 .name = "msm_serial",
94 .id = 2,
95 .num_resources = ARRAY_SIZE(resources_uart3),
96 .resource = resources_uart3,
97};
98
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070099#define MSM_UART1DM_PHYS 0xA0200000
100#define MSM_UART2DM_PHYS 0xA0900000
101static struct resource msm_uart1_dm_resources[] = {
102 {
103 .start = MSM_UART1DM_PHYS,
104 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
105 .flags = IORESOURCE_MEM,
106 },
107 {
108 .start = INT_UART1DM_IRQ,
109 .end = INT_UART1DM_IRQ,
110 .flags = IORESOURCE_IRQ,
111 },
112 {
113 .start = INT_UART1DM_RX,
114 .end = INT_UART1DM_RX,
115 .flags = IORESOURCE_IRQ,
116 },
117 {
118 .start = DMOV_HSUART1_TX_CHAN,
119 .end = DMOV_HSUART1_RX_CHAN,
120 .name = "uartdm_channels",
121 .flags = IORESOURCE_DMA,
122 },
123 {
124 .start = DMOV_HSUART1_TX_CRCI,
125 .end = DMOV_HSUART1_RX_CRCI,
126 .name = "uartdm_crci",
127 .flags = IORESOURCE_DMA,
128 },
129};
130
131static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
132
133struct platform_device msm_device_uart_dm1 = {
134 .name = "msm_serial_hs",
135 .id = 0,
136 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
137 .resource = msm_uart1_dm_resources,
138 .dev = {
139 .dma_mask = &msm_uart_dm1_dma_mask,
140 .coherent_dma_mask = DMA_BIT_MASK(32),
141 },
142};
143
144static struct resource msm_uart2_dm_resources[] = {
145 {
146 .start = MSM_UART2DM_PHYS,
147 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
148 .flags = IORESOURCE_MEM,
149 },
150 {
151 .start = INT_UART2DM_IRQ,
152 .end = INT_UART2DM_IRQ,
153 .flags = IORESOURCE_IRQ,
154 },
155 {
156 .start = INT_UART2DM_RX,
157 .end = INT_UART2DM_RX,
158 .flags = IORESOURCE_IRQ,
159 },
160 {
161 .start = DMOV_HSUART2_TX_CHAN,
162 .end = DMOV_HSUART2_RX_CHAN,
163 .name = "uartdm_channels",
164 .flags = IORESOURCE_DMA,
165 },
166 {
167 .start = DMOV_HSUART2_TX_CRCI,
168 .end = DMOV_HSUART2_RX_CRCI,
169 .name = "uartdm_crci",
170 .flags = IORESOURCE_DMA,
171 },
172};
173
174static u64 msm_uart_dm2_dma_mask = DMA_BIT_MASK(32);
175
176struct platform_device msm_device_uart_dm2 = {
177 .name = "msm_serial_hs",
178 .id = 1,
179 .num_resources = ARRAY_SIZE(msm_uart2_dm_resources),
180 .resource = msm_uart2_dm_resources,
181 .dev = {
182 .dma_mask = &msm_uart_dm2_dma_mask,
183 .coherent_dma_mask = DMA_BIT_MASK(32),
184 },
185};
186
187#define MSM_I2C_SIZE SZ_4K
188#define MSM_I2C_PHYS 0xA9900000
189
190static struct resource resources_i2c[] = {
191 {
192 .start = MSM_I2C_PHYS,
193 .end = MSM_I2C_PHYS + MSM_I2C_SIZE - 1,
194 .flags = IORESOURCE_MEM,
195 },
196 {
197 .start = INT_PWB_I2C,
198 .end = INT_PWB_I2C,
199 .flags = IORESOURCE_IRQ,
200 },
201};
202
203struct platform_device msm_device_i2c = {
204 .name = "msm_i2c",
205 .id = 0,
206 .num_resources = ARRAY_SIZE(resources_i2c),
207 .resource = resources_i2c,
208};
209
210#define MSM_HSUSB_PHYS 0xA0800000
211static struct resource resources_hsusb_otg[] = {
212 {
213 .start = MSM_HSUSB_PHYS,
214 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
215 .flags = IORESOURCE_MEM,
216 },
217 {
218 .start = INT_USB_HS,
219 .end = INT_USB_HS,
220 .flags = IORESOURCE_IRQ,
221 },
222};
223
224static u64 dma_mask = 0xffffffffULL;
225struct platform_device msm_device_hsusb_otg = {
226 .name = "msm_hsusb_otg",
227 .id = -1,
228 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
229 .resource = resources_hsusb_otg,
230 .dev = {
231 .dma_mask = &dma_mask,
232 .coherent_dma_mask = 0xffffffffULL,
233 },
234};
235
236static struct resource resources_hsusb_peripheral[] = {
237 {
238 .start = MSM_HSUSB_PHYS,
239 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
240 .flags = IORESOURCE_MEM,
241 },
242 {
243 .start = INT_USB_HS,
244 .end = INT_USB_HS,
245 .flags = IORESOURCE_IRQ,
246 },
247};
248
249static struct resource resources_gadget_peripheral[] = {
250 {
251 .start = MSM_HSUSB_PHYS,
252 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
253 .flags = IORESOURCE_MEM,
254 },
255 {
256 .start = INT_USB_HS,
257 .end = INT_USB_HS,
258 .flags = IORESOURCE_IRQ,
259 },
260};
261
262struct platform_device msm_device_hsusb_peripheral = {
263 .name = "msm_hsusb_peripheral",
264 .id = -1,
265 .num_resources = ARRAY_SIZE(resources_hsusb_peripheral),
266 .resource = resources_hsusb_peripheral,
267 .dev = {
268 .dma_mask = &dma_mask,
269 .coherent_dma_mask = 0xffffffffULL,
270 },
271};
272
273struct platform_device msm_device_gadget_peripheral = {
274 .name = "msm_hsusb",
275 .id = -1,
276 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
277 .resource = resources_gadget_peripheral,
278 .dev = {
279 .dma_mask = &dma_mask,
280 .coherent_dma_mask = 0xffffffffULL,
281 },
282};
283
284#ifdef CONFIG_USB_FS_HOST
285#define MSM_HS2USB_PHYS 0xA0800400
286static struct resource resources_hsusb_host2[] = {
287 {
288 .start = MSM_HS2USB_PHYS,
289 .end = MSM_HS2USB_PHYS + SZ_1K - 1,
290 .flags = IORESOURCE_MEM,
291 },
292 {
293 .start = INT_USB_OTG,
294 .end = INT_USB_OTG,
295 .flags = IORESOURCE_IRQ,
296 },
297};
298
299struct platform_device msm_device_hsusb_host2 = {
300 .name = "msm_hsusb_host",
301 .id = 1,
302 .num_resources = ARRAY_SIZE(resources_hsusb_host2),
303 .resource = resources_hsusb_host2,
304 .dev = {
305 .dma_mask = &dma_mask,
306 .coherent_dma_mask = 0xffffffffULL,
307 },
308};
309#endif
310
311static struct resource resources_hsusb_host[] = {
312 {
313 .start = MSM_HSUSB_PHYS,
314 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
315 .flags = IORESOURCE_MEM,
316 },
317 {
318 .start = INT_USB_HS,
319 .end = INT_USB_HS,
320 .flags = IORESOURCE_IRQ,
321 },
322};
323
324struct platform_device msm_device_hsusb_host = {
325 .name = "msm_hsusb_host",
326 .id = 0,
327 .num_resources = ARRAY_SIZE(resources_hsusb_host),
328 .resource = resources_hsusb_host,
329 .dev = {
330 .dma_mask = &dma_mask,
331 .coherent_dma_mask = 0xffffffffULL,
332 },
333};
334
335static struct platform_device *msm_host_devices[] = {
336 &msm_device_hsusb_host,
337#ifdef CONFIG_USB_FS_HOST
338 &msm_device_hsusb_host2,
339#endif
340};
341
342int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
343{
344 struct platform_device *pdev;
345
346 pdev = msm_host_devices[host];
347 if (!pdev)
348 return -ENODEV;
349 pdev->dev.platform_data = plat;
350 return platform_device_register(pdev);
351}
352
353#ifdef CONFIG_USB_ANDROID
354struct usb_diag_platform_data usb_diag_pdata = {
355 .ch_name = DIAG_LEGACY,
356 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
357};
358
359struct platform_device usb_diag_device = {
360 .name = "usb_diag",
361 .id = -1,
362 .dev = {
363 .platform_data = &usb_diag_pdata,
364 },
365};
366#endif
367
368#ifdef CONFIG_USB_F_SERIAL
369static struct usb_gadget_fserial_platform_data fserial_pdata = {
370 .no_ports = 2,
371};
372
373struct platform_device usb_gadget_fserial_device = {
374 .name = "usb_fserial",
375 .id = -1,
376 .dev = {
377 .platform_data = &fserial_pdata,
378 },
379};
380#endif
381
382#define MSM_NAND_PHYS 0xA0A00000
383static struct resource resources_nand[] = {
384 [0] = {
385 .name = "msm_nand_dmac",
386 .start = DMOV_NAND_CHAN,
387 .end = DMOV_NAND_CHAN,
388 .flags = IORESOURCE_DMA,
389 },
390 [1] = {
391 .name = "msm_nand_phys",
392 .start = MSM_NAND_PHYS,
393 .end = MSM_NAND_PHYS + 0x7FF,
394 .flags = IORESOURCE_MEM,
395 },
Niranjana Vishwanathapura88b52272010-10-06 13:52:11 -0700396};
397
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530398static struct resource resources_otg[] = {
399 {
400 .start = MSM_HSUSB_PHYS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700401 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530402 .flags = IORESOURCE_MEM,
403 },
404 {
405 .start = INT_USB_HS,
406 .end = INT_USB_HS,
407 .flags = IORESOURCE_IRQ,
408 },
409};
410
411struct platform_device msm_device_otg = {
412 .name = "msm_otg",
413 .id = -1,
414 .num_resources = ARRAY_SIZE(resources_otg),
415 .resource = resources_otg,
416 .dev = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700417 .coherent_dma_mask = 0xffffffffULL,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530418 },
419};
420
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700421struct flash_platform_data msm_nand_data = {
422 .parts = NULL,
423 .nr_parts = 0,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530424};
425
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700426struct platform_device msm_device_nand = {
427 .name = "msm_nand",
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530428 .id = -1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700429 .num_resources = ARRAY_SIZE(resources_nand),
430 .resource = resources_nand,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530431 .dev = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700432 .platform_data = &msm_nand_data,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530433 },
434};
435
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530436static struct msm_pm_irq_calls qsd8x50_pm_irq_calls = {
437 .irq_pending = msm_irq_pending,
438 .idle_sleep_allowed = msm_irq_idle_sleep_allowed,
439 .enter_sleep1 = msm_irq_enter_sleep1,
440 .enter_sleep2 = msm_irq_enter_sleep2,
441 .exit_sleep1 = msm_irq_exit_sleep1,
442 .exit_sleep2 = msm_irq_exit_sleep2,
443 .exit_sleep3 = msm_irq_exit_sleep3,
444};
445
Stephen Boyd986c9632012-04-24 16:31:45 -0700446void __init msm_pm_register_irqs(void)
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530447{
448 msm_pm_set_irq_extns(&qsd8x50_pm_irq_calls);
449}
450
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700451struct platform_device msm_device_smd = {
452 .name = "msm_smd",
453 .id = -1,
454};
455
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700456static struct resource msm_dmov_resource[] = {
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530457 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700458 .start = INT_ADM_AARM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700459 .flags = IORESOURCE_IRQ,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530460 },
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700461 {
462 .start = 0xA9700000,
463 .end = 0xA9700000 + SZ_4K - 1,
464 .flags = IORESOURCE_MEM,
465 },
466};
467
468static struct msm_dmov_pdata msm_dmov_pdata = {
469 .sd = 3,
470 .sd_size = 0x400,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530471};
472
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700473struct platform_device msm_device_dmov = {
474 .name = "msm_dmov",
475 .id = -1,
476 .resource = msm_dmov_resource,
477 .num_resources = ARRAY_SIZE(msm_dmov_resource),
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700478 .dev = {
479 .platform_data = &msm_dmov_pdata,
480 },
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530481};
482
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700483#define MSM_SDC1_BASE 0xA0300000
484#define MSM_SDC2_BASE 0xA0400000
485#define MSM_SDC3_BASE 0xA0500000
486#define MSM_SDC4_BASE 0xA0600000
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530487static struct resource resources_sdc1[] = {
488 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700489 .start = MSM_SDC1_BASE,
490 .end = MSM_SDC1_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530491 .flags = IORESOURCE_MEM,
492 },
493 {
494 .start = INT_SDC1_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530495 .end = INT_SDC1_1,
496 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530497 },
498 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700499 .name = "sdcc_dma_chnl",
500 .start = DMOV_SDC1_CHAN,
501 .end = DMOV_SDC1_CHAN,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530502 .flags = IORESOURCE_DMA,
503 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700504 {
505 .name = "sdcc_dma_crci",
506 .start = DMOV_SDC1_CRCI,
507 .end = DMOV_SDC1_CRCI,
508 .flags = IORESOURCE_DMA,
509 }
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530510};
511
512static struct resource resources_sdc2[] = {
513 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700514 .start = MSM_SDC2_BASE,
515 .end = MSM_SDC2_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530516 .flags = IORESOURCE_MEM,
517 },
518 {
519 .start = INT_SDC2_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530520 .end = INT_SDC2_1,
521 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530522 },
523 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700524 .name = "sdcc_dma_chnl",
525 .start = DMOV_SDC2_CHAN,
526 .end = DMOV_SDC2_CHAN,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530527 .flags = IORESOURCE_DMA,
528 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700529 {
530 .name = "sdcc_dma_crci",
531 .start = DMOV_SDC2_CRCI,
532 .end = DMOV_SDC2_CRCI,
533 .flags = IORESOURCE_DMA,
534 }
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530535};
536
537static struct resource resources_sdc3[] = {
538 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700539 .start = MSM_SDC3_BASE,
540 .end = MSM_SDC3_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530541 .flags = IORESOURCE_MEM,
542 },
543 {
544 .start = INT_SDC3_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530545 .end = INT_SDC3_1,
546 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530547 },
548 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700549 .name = "sdcc_dma_chnl",
550 .start = DMOV_SDC3_CHAN,
551 .end = DMOV_SDC3_CHAN,
552 .flags = IORESOURCE_DMA,
553 },
554 {
555 .name = "sdcc_dma_crci",
556 .start = DMOV_SDC3_CRCI,
557 .end = DMOV_SDC3_CRCI,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530558 .flags = IORESOURCE_DMA,
559 },
560};
561
562static struct resource resources_sdc4[] = {
563 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700564 .start = MSM_SDC4_BASE,
565 .end = MSM_SDC4_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530566 .flags = IORESOURCE_MEM,
567 },
568 {
569 .start = INT_SDC4_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530570 .end = INT_SDC4_1,
571 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530572 },
573 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700574 .name = "sdcc_dma_chnl",
575 .start = DMOV_SDC4_CHAN,
576 .end = DMOV_SDC4_CHAN,
577 .flags = IORESOURCE_DMA,
578 },
579 {
580 .name = "sdcc_dma_crci",
581 .start = DMOV_SDC4_CRCI,
582 .end = DMOV_SDC4_CRCI,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530583 .flags = IORESOURCE_DMA,
584 },
585};
586
587struct platform_device msm_device_sdc1 = {
588 .name = "msm_sdcc",
589 .id = 1,
590 .num_resources = ARRAY_SIZE(resources_sdc1),
591 .resource = resources_sdc1,
592 .dev = {
593 .coherent_dma_mask = 0xffffffff,
594 },
595};
596
597struct platform_device msm_device_sdc2 = {
598 .name = "msm_sdcc",
599 .id = 2,
600 .num_resources = ARRAY_SIZE(resources_sdc2),
601 .resource = resources_sdc2,
602 .dev = {
603 .coherent_dma_mask = 0xffffffff,
604 },
605};
606
607struct platform_device msm_device_sdc3 = {
608 .name = "msm_sdcc",
609 .id = 3,
610 .num_resources = ARRAY_SIZE(resources_sdc3),
611 .resource = resources_sdc3,
612 .dev = {
613 .coherent_dma_mask = 0xffffffff,
614 },
615};
616
617struct platform_device msm_device_sdc4 = {
618 .name = "msm_sdcc",
619 .id = 4,
620 .num_resources = ARRAY_SIZE(resources_sdc4),
621 .resource = resources_sdc4,
622 .dev = {
623 .coherent_dma_mask = 0xffffffff,
624 },
625};
626
627static struct platform_device *msm_sdcc_devices[] __initdata = {
628 &msm_device_sdc1,
629 &msm_device_sdc2,
630 &msm_device_sdc3,
631 &msm_device_sdc4,
632};
633
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700634int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530635{
636 struct platform_device *pdev;
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530637
638 if (controller < 1 || controller > 4)
639 return -EINVAL;
640
641 pdev = msm_sdcc_devices[controller-1];
642 pdev->dev.platform_data = plat;
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530643 return platform_device_register(pdev);
644}
645
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700646#if defined(CONFIG_FB_MSM_MDP40)
647#define MDP_BASE 0xA3F00000
648#define PMDH_BASE 0xAD600000
649#define EMDH_BASE 0xAD700000
650#define TVENC_BASE 0xAD400000
651#else
652#define MDP_BASE 0xAA200000
653#define PMDH_BASE 0xAA600000
654#define EMDH_BASE 0xAA700000
655#define TVENC_BASE 0xAA400000
656#endif
657
658static struct resource msm_mdp_resources[] = {
659 {
660 .name = "mdp",
661 .start = MDP_BASE,
662 .end = MDP_BASE + 0x000F0000 - 1,
663 .flags = IORESOURCE_MEM,
664 },
665 {
666 .start = INT_MDP,
667 .end = INT_MDP,
668 .flags = IORESOURCE_IRQ,
669 },
Daniel Walker62a6cc52010-05-05 07:27:16 -0700670};
671
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700672static struct resource msm_mddi_resources[] = {
673 {
674 .name = "pmdh",
675 .start = PMDH_BASE,
676 .end = PMDH_BASE + PAGE_SIZE - 1,
677 .flags = IORESOURCE_MEM,
678 }
679};
680
681static struct resource msm_mddi_ext_resources[] = {
682 {
683 .name = "emdh",
684 .start = EMDH_BASE,
685 .end = EMDH_BASE + PAGE_SIZE - 1,
686 .flags = IORESOURCE_MEM,
687 }
688};
689
690static struct resource msm_ebi2_lcd_resources[] = {
691 {
692 .name = "base",
693 .start = 0xa0d00000,
694 .end = 0xa0d00000 + PAGE_SIZE - 1,
695 .flags = IORESOURCE_MEM,
696 },
697 {
698 .name = "lcd01",
699 .start = 0x98000000,
700 .end = 0x98000000 + 0x80000 - 1,
701 .flags = IORESOURCE_MEM,
702 },
703 {
704 .name = "lcd02",
705 .start = 0x9c000000,
706 .end = 0x9c000000 + 0x80000 - 1,
707 .flags = IORESOURCE_MEM,
708 },
709};
710
711static struct resource msm_tvenc_resources[] = {
712 {
713 .name = "tvenc",
714 .start = TVENC_BASE,
715 .end = TVENC_BASE + PAGE_SIZE - 1,
716 .flags = IORESOURCE_MEM,
717 }
718};
719
720static struct platform_device msm_mdp_device = {
721 .name = "mdp",
722 .id = 0,
723 .num_resources = ARRAY_SIZE(msm_mdp_resources),
724 .resource = msm_mdp_resources,
725};
726
727static struct platform_device msm_mddi_device = {
728 .name = "mddi",
729 .id = 0,
730 .num_resources = ARRAY_SIZE(msm_mddi_resources),
731 .resource = msm_mddi_resources,
732};
733
734static struct platform_device msm_mddi_ext_device = {
735 .name = "mddi_ext",
736 .id = 0,
737 .num_resources = ARRAY_SIZE(msm_mddi_ext_resources),
738 .resource = msm_mddi_ext_resources,
739};
740
741static struct platform_device msm_ebi2_lcd_device = {
742 .name = "ebi2_lcd",
743 .id = 0,
744 .num_resources = ARRAY_SIZE(msm_ebi2_lcd_resources),
745 .resource = msm_ebi2_lcd_resources,
746};
747
748static struct platform_device msm_lcdc_device = {
749 .name = "lcdc",
750 .id = 0,
751};
752
753static struct platform_device msm_tvenc_device = {
754 .name = "tvenc",
755 .id = 0,
756 .num_resources = ARRAY_SIZE(msm_tvenc_resources),
757 .resource = msm_tvenc_resources,
758};
759
760#if defined(CONFIG_MSM_SOC_REV_A)
761#define MSM_QUP_PHYS 0xA1680000
762#define MSM_GSBI_QUP_I2C_PHYS 0xA1600000
763#define INT_PWB_QUP_ERR INT_GSBI_QUP
764#else
765#define MSM_QUP_PHYS 0xA9900000
766#define MSM_GSBI_QUP_I2C_PHYS 0xA9900000
767#define INT_PWB_QUP_ERR INT_PWB_I2C
768#endif
769#define MSM_QUP_SIZE SZ_4K
770static struct resource resources_qup[] = {
771 {
772 .name = "qup_phys_addr",
773 .start = MSM_QUP_PHYS,
774 .end = MSM_QUP_PHYS + MSM_QUP_SIZE - 1,
775 .flags = IORESOURCE_MEM,
776 },
777 {
778 .name = "gsbi_qup_i2c_addr",
779 .start = MSM_GSBI_QUP_I2C_PHYS,
780 .end = MSM_GSBI_QUP_I2C_PHYS + 4 - 1,
781 .flags = IORESOURCE_MEM,
782 },
783 {
784 .name = "qup_err_intr",
785 .start = INT_PWB_QUP_ERR,
786 .end = INT_PWB_QUP_ERR,
787 .flags = IORESOURCE_IRQ,
788 },
789};
790
791struct platform_device qup_device_i2c = {
792 .name = "qup_i2c",
793 .id = 4,
794 .num_resources = ARRAY_SIZE(resources_qup),
795 .resource = resources_qup,
796};
797
798/* TSIF begin */
799#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
800
801#define MSM_TSIF_PHYS (0xa0100000)
802#define MSM_TSIF_SIZE (0x200)
803
804static struct resource tsif_resources[] = {
805 [0] = {
806 .flags = IORESOURCE_IRQ,
807 .start = INT_TSIF_IRQ,
808 .end = INT_TSIF_IRQ,
809 },
810 [1] = {
811 .flags = IORESOURCE_MEM,
812 .start = MSM_TSIF_PHYS,
813 .end = MSM_TSIF_PHYS + MSM_TSIF_SIZE - 1,
814 },
815 [2] = {
816 .flags = IORESOURCE_DMA,
817 .start = DMOV_TSIF_CHAN,
818 .end = DMOV_TSIF_CRCI,
819 },
820};
821
822static void tsif_release(struct device *dev)
823{
824 dev_info(dev, "release\n");
825}
826
827struct platform_device msm_device_tsif = {
828 .name = "msm_tsif",
829 .id = 0,
830 .num_resources = ARRAY_SIZE(tsif_resources),
831 .resource = tsif_resources,
832 .dev = {
833 .release = tsif_release,
834 },
835};
836#endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */
837/* TSIF end */
838
839#define MSM_TSSC_PHYS 0xAA300000
840static struct resource resources_tssc[] = {
841 {
842 .start = MSM_TSSC_PHYS,
843 .end = MSM_TSSC_PHYS + SZ_4K - 1,
844 .name = "tssc",
845 .flags = IORESOURCE_MEM,
846 },
847 {
848 .start = INT_TCHSCRN1,
849 .end = INT_TCHSCRN1,
850 .name = "tssc1",
851 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
852 },
853 {
854 .start = INT_TCHSCRN2,
855 .end = INT_TCHSCRN2,
856 .name = "tssc2",
857 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
858 },
859};
860
861struct platform_device msm_device_tssc = {
862 .name = "msm_touchscreen",
863 .id = 0,
864 .num_resources = ARRAY_SIZE(resources_tssc),
865 .resource = resources_tssc,
866};
867
868static void __init msm_register_device(struct platform_device *pdev, void *data)
869{
870 int ret;
871
872 pdev->dev.platform_data = data;
873
874 ret = platform_device_register(pdev);
875 if (ret)
876 dev_err(&pdev->dev,
877 "%s: platform_device_register() failed = %d\n",
878 __func__, ret);
879}
880
881void __init msm_fb_register_device(char *name, void *data)
882{
883 if (!strncmp(name, "mdp", 3))
884 msm_register_device(&msm_mdp_device, data);
885 else if (!strncmp(name, "pmdh", 4))
886 msm_register_device(&msm_mddi_device, data);
887 else if (!strncmp(name, "emdh", 4))
888 msm_register_device(&msm_mddi_ext_device, data);
889 else if (!strncmp(name, "ebi2", 4))
890 msm_register_device(&msm_ebi2_lcd_device, data);
891 else if (!strncmp(name, "tvenc", 5))
892 msm_register_device(&msm_tvenc_device, data);
893 else if (!strncmp(name, "lcdc", 4))
894 msm_register_device(&msm_lcdc_device, data);
895 else
896 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
897}
898
899static struct platform_device msm_camera_device = {
900 .name = "msm_camera",
901 .id = 0,
902};
903
904void __init msm_camera_register_device(void *res, uint32_t num,
905 void *data)
906{
907 msm_camera_device.num_resources = num;
908 msm_camera_device.resource = res;
909
910 msm_register_device(&msm_camera_device, data);
911}
912
913static struct resource kgsl_3d0_resources[] = {
914 {
915 .name = KGSL_3D0_REG_MEMORY,
916 .start = 0xA0000000,
917 .end = 0xA001ffff,
918 .flags = IORESOURCE_MEM,
919 },
920 {
921 .name = KGSL_3D0_IRQ,
922 .start = INT_GRAPHICS,
923 .end = INT_GRAPHICS,
924 .flags = IORESOURCE_IRQ,
925 },
926};
927
928static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600929 .pwrlevel = {
930 {
931 .gpu_freq = 0,
932 .bus_freq = 128000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700933 },
934 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600935 .init_level = 0,
936 .num_levels = 1,
937 .set_grp_async = NULL,
938 .idle_timeout = HZ/5,
939 .clk_map = KGSL_CLK_CORE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700940};
941
942struct platform_device msm_kgsl_3d0 = {
943 .name = "kgsl-3d0",
944 .id = 0,
945 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
946 .resource = kgsl_3d0_resources,
947 .dev = {
948 .platform_data = &kgsl_3d0_pdata,
949 },
950};
Daniel Walker62a6cc52010-05-05 07:27:16 -0700951