blob: acb10765a2f479c43c6d7ef9806561500eec09f9 [file] [log] [blame]
Daniel Walker62a6cc52010-05-05 07:27:16 -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.
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>
Jordan Crouse914de9b2012-07-09 13:49:46 -060018#include <mach/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"
28
29#include <asm/mach/flash.h>
30
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070031#include <asm/mach/mmc.h>
32#include <mach/msm_hsusb.h>
33#include <mach/usbdiag.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070034#include <mach/rpc_hsusb.h>
Murali Nalajala2a0bbda2012-03-28 12:12:54 +053035#include "pm.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070036
Matt Wagantallbf430eb2012-03-22 11:45:49 -070037struct platform_device msm8x50_device_acpuclk = {
38 .name = "acpuclk-8x50",
39 .id = -1,
40};
41
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042static struct resource resources_uart1[] = {
43 {
44 .start = INT_UART1,
45 .end = INT_UART1,
46 .flags = IORESOURCE_IRQ,
47 },
48 {
49 .start = MSM_UART1_PHYS,
50 .end = MSM_UART1_PHYS + MSM_UART1_SIZE - 1,
51 .flags = IORESOURCE_MEM,
52 },
53};
54
55static struct resource resources_uart2[] = {
56 {
57 .start = INT_UART2,
58 .end = INT_UART2,
59 .flags = IORESOURCE_IRQ,
60 },
61 {
62 .start = MSM_UART2_PHYS,
63 .end = MSM_UART2_PHYS + MSM_UART2_SIZE - 1,
64 .flags = IORESOURCE_MEM,
65 },
66};
Daniel Walker62a6cc52010-05-05 07:27:16 -070067
68static struct resource resources_uart3[] = {
69 {
70 .start = INT_UART3,
71 .end = INT_UART3,
72 .flags = IORESOURCE_IRQ,
73 },
74 {
75 .start = MSM_UART3_PHYS,
76 .end = MSM_UART3_PHYS + MSM_UART3_SIZE - 1,
77 .flags = IORESOURCE_MEM,
Stepan Moskovchenkod41cb8c2011-01-17 20:33:32 -080078 .name = "uart_resource"
Daniel Walker62a6cc52010-05-05 07:27:16 -070079 },
80};
81
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070082struct platform_device msm_device_uart1 = {
83 .name = "msm_serial",
84 .id = 0,
85 .num_resources = ARRAY_SIZE(resources_uart1),
86 .resource = resources_uart1,
87};
88
89struct platform_device msm_device_uart2 = {
90 .name = "msm_serial",
91 .id = 1,
92 .num_resources = ARRAY_SIZE(resources_uart2),
93 .resource = resources_uart2,
94};
95
Daniel Walker62a6cc52010-05-05 07:27:16 -070096struct platform_device msm_device_uart3 = {
97 .name = "msm_serial",
98 .id = 2,
99 .num_resources = ARRAY_SIZE(resources_uart3),
100 .resource = resources_uart3,
101};
102
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700103#define MSM_UART1DM_PHYS 0xA0200000
104#define MSM_UART2DM_PHYS 0xA0900000
105static struct resource msm_uart1_dm_resources[] = {
106 {
107 .start = MSM_UART1DM_PHYS,
108 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
109 .flags = IORESOURCE_MEM,
110 },
111 {
112 .start = INT_UART1DM_IRQ,
113 .end = INT_UART1DM_IRQ,
114 .flags = IORESOURCE_IRQ,
115 },
116 {
117 .start = INT_UART1DM_RX,
118 .end = INT_UART1DM_RX,
119 .flags = IORESOURCE_IRQ,
120 },
121 {
122 .start = DMOV_HSUART1_TX_CHAN,
123 .end = DMOV_HSUART1_RX_CHAN,
124 .name = "uartdm_channels",
125 .flags = IORESOURCE_DMA,
126 },
127 {
128 .start = DMOV_HSUART1_TX_CRCI,
129 .end = DMOV_HSUART1_RX_CRCI,
130 .name = "uartdm_crci",
131 .flags = IORESOURCE_DMA,
132 },
133};
134
135static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
136
137struct platform_device msm_device_uart_dm1 = {
138 .name = "msm_serial_hs",
139 .id = 0,
140 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
141 .resource = msm_uart1_dm_resources,
142 .dev = {
143 .dma_mask = &msm_uart_dm1_dma_mask,
144 .coherent_dma_mask = DMA_BIT_MASK(32),
145 },
146};
147
148static struct resource msm_uart2_dm_resources[] = {
149 {
150 .start = MSM_UART2DM_PHYS,
151 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
152 .flags = IORESOURCE_MEM,
153 },
154 {
155 .start = INT_UART2DM_IRQ,
156 .end = INT_UART2DM_IRQ,
157 .flags = IORESOURCE_IRQ,
158 },
159 {
160 .start = INT_UART2DM_RX,
161 .end = INT_UART2DM_RX,
162 .flags = IORESOURCE_IRQ,
163 },
164 {
165 .start = DMOV_HSUART2_TX_CHAN,
166 .end = DMOV_HSUART2_RX_CHAN,
167 .name = "uartdm_channels",
168 .flags = IORESOURCE_DMA,
169 },
170 {
171 .start = DMOV_HSUART2_TX_CRCI,
172 .end = DMOV_HSUART2_RX_CRCI,
173 .name = "uartdm_crci",
174 .flags = IORESOURCE_DMA,
175 },
176};
177
178static u64 msm_uart_dm2_dma_mask = DMA_BIT_MASK(32);
179
180struct platform_device msm_device_uart_dm2 = {
181 .name = "msm_serial_hs",
182 .id = 1,
183 .num_resources = ARRAY_SIZE(msm_uart2_dm_resources),
184 .resource = msm_uart2_dm_resources,
185 .dev = {
186 .dma_mask = &msm_uart_dm2_dma_mask,
187 .coherent_dma_mask = DMA_BIT_MASK(32),
188 },
189};
190
191#define MSM_I2C_SIZE SZ_4K
192#define MSM_I2C_PHYS 0xA9900000
193
194static struct resource resources_i2c[] = {
195 {
196 .start = MSM_I2C_PHYS,
197 .end = MSM_I2C_PHYS + MSM_I2C_SIZE - 1,
198 .flags = IORESOURCE_MEM,
199 },
200 {
201 .start = INT_PWB_I2C,
202 .end = INT_PWB_I2C,
203 .flags = IORESOURCE_IRQ,
204 },
205};
206
207struct platform_device msm_device_i2c = {
208 .name = "msm_i2c",
209 .id = 0,
210 .num_resources = ARRAY_SIZE(resources_i2c),
211 .resource = resources_i2c,
212};
213
214#define MSM_HSUSB_PHYS 0xA0800000
215static struct resource resources_hsusb_otg[] = {
216 {
217 .start = MSM_HSUSB_PHYS,
218 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
219 .flags = IORESOURCE_MEM,
220 },
221 {
222 .start = INT_USB_HS,
223 .end = INT_USB_HS,
224 .flags = IORESOURCE_IRQ,
225 },
226};
227
228static u64 dma_mask = 0xffffffffULL;
229struct platform_device msm_device_hsusb_otg = {
230 .name = "msm_hsusb_otg",
231 .id = -1,
232 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
233 .resource = resources_hsusb_otg,
234 .dev = {
235 .dma_mask = &dma_mask,
236 .coherent_dma_mask = 0xffffffffULL,
237 },
238};
239
240static struct resource resources_hsusb_peripheral[] = {
241 {
242 .start = MSM_HSUSB_PHYS,
243 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
244 .flags = IORESOURCE_MEM,
245 },
246 {
247 .start = INT_USB_HS,
248 .end = INT_USB_HS,
249 .flags = IORESOURCE_IRQ,
250 },
251};
252
253static struct resource resources_gadget_peripheral[] = {
254 {
255 .start = MSM_HSUSB_PHYS,
256 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
257 .flags = IORESOURCE_MEM,
258 },
259 {
260 .start = INT_USB_HS,
261 .end = INT_USB_HS,
262 .flags = IORESOURCE_IRQ,
263 },
264};
265
266struct platform_device msm_device_hsusb_peripheral = {
267 .name = "msm_hsusb_peripheral",
268 .id = -1,
269 .num_resources = ARRAY_SIZE(resources_hsusb_peripheral),
270 .resource = resources_hsusb_peripheral,
271 .dev = {
272 .dma_mask = &dma_mask,
273 .coherent_dma_mask = 0xffffffffULL,
274 },
275};
276
277struct platform_device msm_device_gadget_peripheral = {
278 .name = "msm_hsusb",
279 .id = -1,
280 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
281 .resource = resources_gadget_peripheral,
282 .dev = {
283 .dma_mask = &dma_mask,
284 .coherent_dma_mask = 0xffffffffULL,
285 },
286};
287
288#ifdef CONFIG_USB_FS_HOST
289#define MSM_HS2USB_PHYS 0xA0800400
290static struct resource resources_hsusb_host2[] = {
291 {
292 .start = MSM_HS2USB_PHYS,
293 .end = MSM_HS2USB_PHYS + SZ_1K - 1,
294 .flags = IORESOURCE_MEM,
295 },
296 {
297 .start = INT_USB_OTG,
298 .end = INT_USB_OTG,
299 .flags = IORESOURCE_IRQ,
300 },
301};
302
303struct platform_device msm_device_hsusb_host2 = {
304 .name = "msm_hsusb_host",
305 .id = 1,
306 .num_resources = ARRAY_SIZE(resources_hsusb_host2),
307 .resource = resources_hsusb_host2,
308 .dev = {
309 .dma_mask = &dma_mask,
310 .coherent_dma_mask = 0xffffffffULL,
311 },
312};
313#endif
314
315static struct resource resources_hsusb_host[] = {
316 {
317 .start = MSM_HSUSB_PHYS,
318 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
319 .flags = IORESOURCE_MEM,
320 },
321 {
322 .start = INT_USB_HS,
323 .end = INT_USB_HS,
324 .flags = IORESOURCE_IRQ,
325 },
326};
327
328struct platform_device msm_device_hsusb_host = {
329 .name = "msm_hsusb_host",
330 .id = 0,
331 .num_resources = ARRAY_SIZE(resources_hsusb_host),
332 .resource = resources_hsusb_host,
333 .dev = {
334 .dma_mask = &dma_mask,
335 .coherent_dma_mask = 0xffffffffULL,
336 },
337};
338
339static struct platform_device *msm_host_devices[] = {
340 &msm_device_hsusb_host,
341#ifdef CONFIG_USB_FS_HOST
342 &msm_device_hsusb_host2,
343#endif
344};
345
346int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
347{
348 struct platform_device *pdev;
349
350 pdev = msm_host_devices[host];
351 if (!pdev)
352 return -ENODEV;
353 pdev->dev.platform_data = plat;
354 return platform_device_register(pdev);
355}
356
357#ifdef CONFIG_USB_ANDROID
358struct usb_diag_platform_data usb_diag_pdata = {
359 .ch_name = DIAG_LEGACY,
360 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
361};
362
363struct platform_device usb_diag_device = {
364 .name = "usb_diag",
365 .id = -1,
366 .dev = {
367 .platform_data = &usb_diag_pdata,
368 },
369};
370#endif
371
372#ifdef CONFIG_USB_F_SERIAL
373static struct usb_gadget_fserial_platform_data fserial_pdata = {
374 .no_ports = 2,
375};
376
377struct platform_device usb_gadget_fserial_device = {
378 .name = "usb_fserial",
379 .id = -1,
380 .dev = {
381 .platform_data = &fserial_pdata,
382 },
383};
384#endif
385
386#define MSM_NAND_PHYS 0xA0A00000
387static struct resource resources_nand[] = {
388 [0] = {
389 .name = "msm_nand_dmac",
390 .start = DMOV_NAND_CHAN,
391 .end = DMOV_NAND_CHAN,
392 .flags = IORESOURCE_DMA,
393 },
394 [1] = {
395 .name = "msm_nand_phys",
396 .start = MSM_NAND_PHYS,
397 .end = MSM_NAND_PHYS + 0x7FF,
398 .flags = IORESOURCE_MEM,
399 },
Niranjana Vishwanathapura88b52272010-10-06 13:52:11 -0700400};
401
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530402static struct resource resources_otg[] = {
403 {
404 .start = MSM_HSUSB_PHYS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700405 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530406 .flags = IORESOURCE_MEM,
407 },
408 {
409 .start = INT_USB_HS,
410 .end = INT_USB_HS,
411 .flags = IORESOURCE_IRQ,
412 },
413};
414
415struct platform_device msm_device_otg = {
416 .name = "msm_otg",
417 .id = -1,
418 .num_resources = ARRAY_SIZE(resources_otg),
419 .resource = resources_otg,
420 .dev = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700421 .coherent_dma_mask = 0xffffffffULL,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530422 },
423};
424
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700425struct flash_platform_data msm_nand_data = {
426 .parts = NULL,
427 .nr_parts = 0,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530428};
429
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700430struct platform_device msm_device_nand = {
431 .name = "msm_nand",
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530432 .id = -1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700433 .num_resources = ARRAY_SIZE(resources_nand),
434 .resource = resources_nand,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530435 .dev = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700436 .platform_data = &msm_nand_data,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530437 },
438};
439
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530440static struct msm_pm_irq_calls qsd8x50_pm_irq_calls = {
441 .irq_pending = msm_irq_pending,
442 .idle_sleep_allowed = msm_irq_idle_sleep_allowed,
443 .enter_sleep1 = msm_irq_enter_sleep1,
444 .enter_sleep2 = msm_irq_enter_sleep2,
445 .exit_sleep1 = msm_irq_exit_sleep1,
446 .exit_sleep2 = msm_irq_exit_sleep2,
447 .exit_sleep3 = msm_irq_exit_sleep3,
448};
449
Stephen Boyd986c9632012-04-24 16:31:45 -0700450void __init msm_pm_register_irqs(void)
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530451{
452 msm_pm_set_irq_extns(&qsd8x50_pm_irq_calls);
453}
454
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700455struct platform_device msm_device_smd = {
456 .name = "msm_smd",
457 .id = -1,
458};
459
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700460static struct resource msm_dmov_resource[] = {
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530461 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700462 .start = INT_ADM_AARM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700463 .flags = IORESOURCE_IRQ,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530464 },
465 {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700466 .start = 0xA9700000,
467 .end = 0xA9700000 + SZ_4K - 1,
468 .flags = IORESOURCE_MEM,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530469 },
470};
471
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700472static struct msm_dmov_pdata msm_dmov_pdata = {
473 .sd = 3,
474 .sd_size = 0x400,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530475};
476
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700477struct platform_device msm_device_dmov = {
478 .name = "msm_dmov",
479 .id = -1,
480 .resource = msm_dmov_resource,
481 .num_resources = ARRAY_SIZE(msm_dmov_resource),
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700482 .dev = {
483 .platform_data = &msm_dmov_pdata,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530484 },
485};
486
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700487#define MSM_SDC1_BASE 0xA0300000
488#define MSM_SDC2_BASE 0xA0400000
489#define MSM_SDC3_BASE 0xA0500000
490#define MSM_SDC4_BASE 0xA0600000
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530491static struct resource resources_sdc1[] = {
492 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530493 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700494 .start = MSM_SDC1_BASE,
495 .end = MSM_SDC1_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530496 .flags = IORESOURCE_MEM,
497 },
498 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530499 .name = "core_irq",
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530500 .start = INT_SDC1_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530501 .end = INT_SDC1_1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530502 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530503 },
504 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530505 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700506 .start = DMOV_SDC1_CHAN,
507 .end = DMOV_SDC1_CHAN,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530508 .flags = IORESOURCE_DMA,
509 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700510 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530511 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700512 .start = DMOV_SDC1_CRCI,
513 .end = DMOV_SDC1_CRCI,
514 .flags = IORESOURCE_DMA,
515 }
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530516};
517
518static struct resource resources_sdc2[] = {
519 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530520 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700521 .start = MSM_SDC2_BASE,
522 .end = MSM_SDC2_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530523 .flags = IORESOURCE_MEM,
524 },
525 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530526 .name = "core_irq",
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530527 .start = INT_SDC2_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530528 .end = INT_SDC2_1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530529 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530530 },
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530531 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530532 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700533 .start = DMOV_SDC2_CHAN,
534 .end = DMOV_SDC2_CHAN,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530535 .flags = IORESOURCE_DMA,
536 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700537 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530538 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700539 .start = DMOV_SDC2_CRCI,
540 .end = DMOV_SDC2_CRCI,
541 .flags = IORESOURCE_DMA,
542 }
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530543};
544
545static struct resource resources_sdc3[] = {
546 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530547 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700548 .start = MSM_SDC3_BASE,
549 .end = MSM_SDC3_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530550 .flags = IORESOURCE_MEM,
551 },
552 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530553 .name = "core_irq",
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530554 .start = INT_SDC3_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530555 .end = INT_SDC3_1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530556 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530557 },
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530558 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530559 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700560 .start = DMOV_SDC3_CHAN,
561 .end = DMOV_SDC3_CHAN,
562 .flags = IORESOURCE_DMA,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530563 },
564 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530565 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700566 .start = DMOV_SDC3_CRCI,
567 .end = DMOV_SDC3_CRCI,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530568 .flags = IORESOURCE_DMA,
569 },
570};
571
572static struct resource resources_sdc4[] = {
573 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530574 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700575 .start = MSM_SDC4_BASE,
576 .end = MSM_SDC4_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530577 .flags = IORESOURCE_MEM,
578 },
579 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530580 .name = "core_irq",
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530581 .start = INT_SDC4_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530582 .end = INT_SDC4_1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530583 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530584 },
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530585 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530586 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700587 .start = DMOV_SDC4_CHAN,
588 .end = DMOV_SDC4_CHAN,
589 .flags = IORESOURCE_DMA,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530590 },
591 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530592 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700593 .start = DMOV_SDC4_CRCI,
594 .end = DMOV_SDC4_CRCI,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530595 .flags = IORESOURCE_DMA,
596 },
597};
598
599struct platform_device msm_device_sdc1 = {
600 .name = "msm_sdcc",
601 .id = 1,
602 .num_resources = ARRAY_SIZE(resources_sdc1),
603 .resource = resources_sdc1,
604 .dev = {
605 .coherent_dma_mask = 0xffffffff,
606 },
607};
608
609struct platform_device msm_device_sdc2 = {
610 .name = "msm_sdcc",
611 .id = 2,
612 .num_resources = ARRAY_SIZE(resources_sdc2),
613 .resource = resources_sdc2,
614 .dev = {
615 .coherent_dma_mask = 0xffffffff,
616 },
617};
618
619struct platform_device msm_device_sdc3 = {
620 .name = "msm_sdcc",
621 .id = 3,
622 .num_resources = ARRAY_SIZE(resources_sdc3),
623 .resource = resources_sdc3,
624 .dev = {
625 .coherent_dma_mask = 0xffffffff,
626 },
627};
628
629struct platform_device msm_device_sdc4 = {
630 .name = "msm_sdcc",
631 .id = 4,
632 .num_resources = ARRAY_SIZE(resources_sdc4),
633 .resource = resources_sdc4,
634 .dev = {
635 .coherent_dma_mask = 0xffffffff,
636 },
637};
638
639static struct platform_device *msm_sdcc_devices[] __initdata = {
640 &msm_device_sdc1,
641 &msm_device_sdc2,
642 &msm_device_sdc3,
643 &msm_device_sdc4,
644};
645
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700646int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530647{
648 struct platform_device *pdev;
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530649
650 if (controller < 1 || controller > 4)
651 return -EINVAL;
652
653 pdev = msm_sdcc_devices[controller-1];
654 pdev->dev.platform_data = plat;
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530655 return platform_device_register(pdev);
656}
657
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700658#if defined(CONFIG_FB_MSM_MDP40)
659#define MDP_BASE 0xA3F00000
660#define PMDH_BASE 0xAD600000
661#define EMDH_BASE 0xAD700000
662#define TVENC_BASE 0xAD400000
663#else
664#define MDP_BASE 0xAA200000
665#define PMDH_BASE 0xAA600000
666#define EMDH_BASE 0xAA700000
667#define TVENC_BASE 0xAA400000
668#endif
669
670static struct resource msm_mdp_resources[] = {
671 {
672 .name = "mdp",
673 .start = MDP_BASE,
674 .end = MDP_BASE + 0x000F0000 - 1,
675 .flags = IORESOURCE_MEM,
676 },
677 {
678 .start = INT_MDP,
679 .end = INT_MDP,
680 .flags = IORESOURCE_IRQ,
681 },
Daniel Walker62a6cc52010-05-05 07:27:16 -0700682};
683
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700684static struct resource msm_mddi_resources[] = {
685 {
686 .name = "pmdh",
687 .start = PMDH_BASE,
688 .end = PMDH_BASE + PAGE_SIZE - 1,
689 .flags = IORESOURCE_MEM,
690 }
691};
692
693static struct resource msm_mddi_ext_resources[] = {
694 {
695 .name = "emdh",
696 .start = EMDH_BASE,
697 .end = EMDH_BASE + PAGE_SIZE - 1,
698 .flags = IORESOURCE_MEM,
699 }
700};
701
702static struct resource msm_ebi2_lcd_resources[] = {
703 {
704 .name = "base",
705 .start = 0xa0d00000,
706 .end = 0xa0d00000 + PAGE_SIZE - 1,
707 .flags = IORESOURCE_MEM,
708 },
709 {
710 .name = "lcd01",
711 .start = 0x98000000,
712 .end = 0x98000000 + 0x80000 - 1,
713 .flags = IORESOURCE_MEM,
714 },
715 {
716 .name = "lcd02",
717 .start = 0x9c000000,
718 .end = 0x9c000000 + 0x80000 - 1,
719 .flags = IORESOURCE_MEM,
720 },
721};
722
723static struct resource msm_tvenc_resources[] = {
724 {
725 .name = "tvenc",
726 .start = TVENC_BASE,
727 .end = TVENC_BASE + PAGE_SIZE - 1,
728 .flags = IORESOURCE_MEM,
729 }
730};
731
732static struct platform_device msm_mdp_device = {
733 .name = "mdp",
734 .id = 0,
735 .num_resources = ARRAY_SIZE(msm_mdp_resources),
736 .resource = msm_mdp_resources,
737};
738
739static struct platform_device msm_mddi_device = {
740 .name = "mddi",
741 .id = 0,
742 .num_resources = ARRAY_SIZE(msm_mddi_resources),
743 .resource = msm_mddi_resources,
744};
745
746static struct platform_device msm_mddi_ext_device = {
747 .name = "mddi_ext",
748 .id = 0,
749 .num_resources = ARRAY_SIZE(msm_mddi_ext_resources),
750 .resource = msm_mddi_ext_resources,
751};
752
753static struct platform_device msm_ebi2_lcd_device = {
754 .name = "ebi2_lcd",
755 .id = 0,
756 .num_resources = ARRAY_SIZE(msm_ebi2_lcd_resources),
757 .resource = msm_ebi2_lcd_resources,
758};
759
Padmanabhan Komandurue77bcf52012-07-26 12:43:39 +0530760struct platform_device msm_lcdc_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700761 .name = "lcdc",
762 .id = 0,
763};
764
765static struct platform_device msm_tvenc_device = {
766 .name = "tvenc",
767 .id = 0,
768 .num_resources = ARRAY_SIZE(msm_tvenc_resources),
769 .resource = msm_tvenc_resources,
770};
771
772#if defined(CONFIG_MSM_SOC_REV_A)
773#define MSM_QUP_PHYS 0xA1680000
774#define MSM_GSBI_QUP_I2C_PHYS 0xA1600000
775#define INT_PWB_QUP_ERR INT_GSBI_QUP
776#else
777#define MSM_QUP_PHYS 0xA9900000
778#define MSM_GSBI_QUP_I2C_PHYS 0xA9900000
779#define INT_PWB_QUP_ERR INT_PWB_I2C
780#endif
781#define MSM_QUP_SIZE SZ_4K
782static struct resource resources_qup[] = {
783 {
784 .name = "qup_phys_addr",
785 .start = MSM_QUP_PHYS,
786 .end = MSM_QUP_PHYS + MSM_QUP_SIZE - 1,
787 .flags = IORESOURCE_MEM,
788 },
789 {
790 .name = "gsbi_qup_i2c_addr",
791 .start = MSM_GSBI_QUP_I2C_PHYS,
792 .end = MSM_GSBI_QUP_I2C_PHYS + 4 - 1,
793 .flags = IORESOURCE_MEM,
794 },
795 {
796 .name = "qup_err_intr",
797 .start = INT_PWB_QUP_ERR,
798 .end = INT_PWB_QUP_ERR,
799 .flags = IORESOURCE_IRQ,
800 },
801};
802
803struct platform_device qup_device_i2c = {
804 .name = "qup_i2c",
805 .id = 4,
806 .num_resources = ARRAY_SIZE(resources_qup),
807 .resource = resources_qup,
808};
809
810/* TSIF begin */
811#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
812
813#define MSM_TSIF_PHYS (0xa0100000)
814#define MSM_TSIF_SIZE (0x200)
815
816static struct resource tsif_resources[] = {
817 [0] = {
818 .flags = IORESOURCE_IRQ,
819 .start = INT_TSIF_IRQ,
820 .end = INT_TSIF_IRQ,
821 },
822 [1] = {
823 .flags = IORESOURCE_MEM,
824 .start = MSM_TSIF_PHYS,
825 .end = MSM_TSIF_PHYS + MSM_TSIF_SIZE - 1,
826 },
827 [2] = {
828 .flags = IORESOURCE_DMA,
829 .start = DMOV_TSIF_CHAN,
830 .end = DMOV_TSIF_CRCI,
831 },
832};
833
834static void tsif_release(struct device *dev)
835{
836 dev_info(dev, "release\n");
837}
838
839struct platform_device msm_device_tsif = {
840 .name = "msm_tsif",
841 .id = 0,
842 .num_resources = ARRAY_SIZE(tsif_resources),
843 .resource = tsif_resources,
844 .dev = {
845 .release = tsif_release,
846 },
847};
848#endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */
849/* TSIF end */
850
851#define MSM_TSSC_PHYS 0xAA300000
852static struct resource resources_tssc[] = {
853 {
854 .start = MSM_TSSC_PHYS,
855 .end = MSM_TSSC_PHYS + SZ_4K - 1,
856 .name = "tssc",
857 .flags = IORESOURCE_MEM,
858 },
859 {
860 .start = INT_TCHSCRN1,
861 .end = INT_TCHSCRN1,
862 .name = "tssc1",
863 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
864 },
865 {
866 .start = INT_TCHSCRN2,
867 .end = INT_TCHSCRN2,
868 .name = "tssc2",
869 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
870 },
871};
872
873struct platform_device msm_device_tssc = {
874 .name = "msm_touchscreen",
875 .id = 0,
876 .num_resources = ARRAY_SIZE(resources_tssc),
877 .resource = resources_tssc,
878};
879
880static void __init msm_register_device(struct platform_device *pdev, void *data)
881{
882 int ret;
883
884 pdev->dev.platform_data = data;
885
886 ret = platform_device_register(pdev);
887 if (ret)
888 dev_err(&pdev->dev,
889 "%s: platform_device_register() failed = %d\n",
890 __func__, ret);
891}
892
893void __init msm_fb_register_device(char *name, void *data)
894{
895 if (!strncmp(name, "mdp", 3))
896 msm_register_device(&msm_mdp_device, data);
897 else if (!strncmp(name, "pmdh", 4))
898 msm_register_device(&msm_mddi_device, data);
899 else if (!strncmp(name, "emdh", 4))
900 msm_register_device(&msm_mddi_ext_device, data);
901 else if (!strncmp(name, "ebi2", 4))
902 msm_register_device(&msm_ebi2_lcd_device, data);
903 else if (!strncmp(name, "tvenc", 5))
904 msm_register_device(&msm_tvenc_device, data);
905 else if (!strncmp(name, "lcdc", 4))
906 msm_register_device(&msm_lcdc_device, data);
907 else
908 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
909}
910
911static struct platform_device msm_camera_device = {
912 .name = "msm_camera",
913 .id = 0,
914};
915
916void __init msm_camera_register_device(void *res, uint32_t num,
917 void *data)
918{
919 msm_camera_device.num_resources = num;
920 msm_camera_device.resource = res;
921
922 msm_register_device(&msm_camera_device, data);
923}
924
925static struct resource kgsl_3d0_resources[] = {
926 {
927 .name = KGSL_3D0_REG_MEMORY,
928 .start = 0xA0000000,
929 .end = 0xA001ffff,
930 .flags = IORESOURCE_MEM,
931 },
932 {
933 .name = KGSL_3D0_IRQ,
934 .start = INT_GRAPHICS,
935 .end = INT_GRAPHICS,
936 .flags = IORESOURCE_IRQ,
937 },
938};
939
940static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600941 .pwrlevel = {
942 {
943 .gpu_freq = 0,
944 .bus_freq = 128000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700945 },
946 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600947 .init_level = 0,
948 .num_levels = 1,
949 .set_grp_async = NULL,
950 .idle_timeout = HZ/5,
951 .clk_map = KGSL_CLK_CORE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700952};
953
954struct platform_device msm_kgsl_3d0 = {
955 .name = "kgsl-3d0",
956 .id = 0,
957 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
958 .resource = kgsl_3d0_resources,
959 .dev = {
960 .platform_data = &kgsl_3d0_pdata,
961 },
962};
Daniel Walker62a6cc52010-05-05 07:27:16 -0700963