2 * Copyright (C) 2010,2011 Google, Inc.
5 * Colin Cross <ccross@android.com>
6 * Erik Gilling <ccross@android.com>
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
20 #include <linux/resource.h>
21 #include <linux/platform_device.h>
22 #include <linux/dma-mapping.h>
23 #include <linux/fsl_devices.h>
24 #include <linux/serial_8250.h>
25 #include <linux/i2c-tegra.h>
27 #include <mach/irqs.h>
28 #include <mach/iomap.h>
31 static struct resource i2c_resource1[] = {
35 .flags = IORESOURCE_IRQ,
38 .start = TEGRA_I2C_BASE,
39 .end = TEGRA_I2C_BASE + TEGRA_I2C_SIZE-1,
40 .flags = IORESOURCE_MEM,
44 static struct resource i2c_resource2[] = {
48 .flags = IORESOURCE_IRQ,
51 .start = TEGRA_I2C2_BASE,
52 .end = TEGRA_I2C2_BASE + TEGRA_I2C2_SIZE-1,
53 .flags = IORESOURCE_MEM,
57 static struct resource i2c_resource3[] = {
61 .flags = IORESOURCE_IRQ,
64 .start = TEGRA_I2C3_BASE,
65 .end = TEGRA_I2C3_BASE + TEGRA_I2C3_SIZE-1,
66 .flags = IORESOURCE_MEM,
70 static struct resource i2c_resource4[] = {
74 .flags = IORESOURCE_IRQ,
77 .start = TEGRA_DVC_BASE,
78 .end = TEGRA_DVC_BASE + TEGRA_DVC_SIZE-1,
79 .flags = IORESOURCE_MEM,
83 static struct tegra_i2c_platform_data tegra_i2c1_platform_data = {
84 .bus_clk_rate = 400000,
87 static struct tegra_i2c_platform_data tegra_i2c2_platform_data = {
88 .bus_clk_rate = 400000,
91 static struct tegra_i2c_platform_data tegra_i2c3_platform_data = {
92 .bus_clk_rate = 400000,
95 static struct tegra_i2c_platform_data tegra_dvc_platform_data = {
96 .bus_clk_rate = 400000,
99 struct platform_device tegra_i2c_device1 = {
102 .resource = i2c_resource1,
103 .num_resources = ARRAY_SIZE(i2c_resource1),
105 .platform_data = &tegra_i2c1_platform_data,
109 struct platform_device tegra_i2c_device2 = {
112 .resource = i2c_resource2,
113 .num_resources = ARRAY_SIZE(i2c_resource2),
115 .platform_data = &tegra_i2c2_platform_data,
119 struct platform_device tegra_i2c_device3 = {
122 .resource = i2c_resource3,
123 .num_resources = ARRAY_SIZE(i2c_resource3),
125 .platform_data = &tegra_i2c3_platform_data,
129 struct platform_device tegra_i2c_device4 = {
132 .resource = i2c_resource4,
133 .num_resources = ARRAY_SIZE(i2c_resource4),
135 .platform_data = &tegra_dvc_platform_data,
139 static struct resource spi_resource1[] = {
141 .start = INT_S_LINK1,
143 .flags = IORESOURCE_IRQ,
146 .start = TEGRA_SPI1_BASE,
147 .end = TEGRA_SPI1_BASE + TEGRA_SPI1_SIZE-1,
148 .flags = IORESOURCE_MEM,
152 static struct resource spi_resource2[] = {
156 .flags = IORESOURCE_IRQ,
159 .start = TEGRA_SPI2_BASE,
160 .end = TEGRA_SPI2_BASE + TEGRA_SPI2_SIZE-1,
161 .flags = IORESOURCE_MEM,
165 static struct resource spi_resource3[] = {
169 .flags = IORESOURCE_IRQ,
172 .start = TEGRA_SPI3_BASE,
173 .end = TEGRA_SPI3_BASE + TEGRA_SPI3_SIZE-1,
174 .flags = IORESOURCE_MEM,
178 static struct resource spi_resource4[] = {
182 .flags = IORESOURCE_IRQ,
185 .start = TEGRA_SPI4_BASE,
186 .end = TEGRA_SPI4_BASE + TEGRA_SPI4_SIZE-1,
187 .flags = IORESOURCE_MEM,
191 struct platform_device tegra_spi_device1 = {
194 .resource = spi_resource1,
195 .num_resources = ARRAY_SIZE(spi_resource1),
197 .coherent_dma_mask = 0xffffffff,
201 struct platform_device tegra_spi_device2 = {
204 .resource = spi_resource2,
205 .num_resources = ARRAY_SIZE(spi_resource2),
207 .coherent_dma_mask = 0xffffffff,
211 struct platform_device tegra_spi_device3 = {
214 .resource = spi_resource3,
215 .num_resources = ARRAY_SIZE(spi_resource3),
217 .coherent_dma_mask = 0xffffffff,
221 struct platform_device tegra_spi_device4 = {
224 .resource = spi_resource4,
225 .num_resources = ARRAY_SIZE(spi_resource4),
227 .coherent_dma_mask = 0xffffffff,
232 static struct resource sdhci_resource1[] = {
236 .flags = IORESOURCE_IRQ,
239 .start = TEGRA_SDMMC1_BASE,
240 .end = TEGRA_SDMMC1_BASE + TEGRA_SDMMC1_SIZE-1,
241 .flags = IORESOURCE_MEM,
245 static struct resource sdhci_resource2[] = {
249 .flags = IORESOURCE_IRQ,
252 .start = TEGRA_SDMMC2_BASE,
253 .end = TEGRA_SDMMC2_BASE + TEGRA_SDMMC2_SIZE-1,
254 .flags = IORESOURCE_MEM,
258 static struct resource sdhci_resource3[] = {
262 .flags = IORESOURCE_IRQ,
265 .start = TEGRA_SDMMC3_BASE,
266 .end = TEGRA_SDMMC3_BASE + TEGRA_SDMMC3_SIZE-1,
267 .flags = IORESOURCE_MEM,
271 static struct resource sdhci_resource4[] = {
275 .flags = IORESOURCE_IRQ,
278 .start = TEGRA_SDMMC4_BASE,
279 .end = TEGRA_SDMMC4_BASE + TEGRA_SDMMC4_SIZE-1,
280 .flags = IORESOURCE_MEM,
284 /* board files should fill in platform_data register the devices themselvs.
285 * See board-harmony.c for an example
287 struct platform_device tegra_sdhci_device1 = {
288 .name = "sdhci-tegra",
290 .resource = sdhci_resource1,
291 .num_resources = ARRAY_SIZE(sdhci_resource1),
294 struct platform_device tegra_sdhci_device2 = {
295 .name = "sdhci-tegra",
297 .resource = sdhci_resource2,
298 .num_resources = ARRAY_SIZE(sdhci_resource2),
301 struct platform_device tegra_sdhci_device3 = {
302 .name = "sdhci-tegra",
304 .resource = sdhci_resource3,
305 .num_resources = ARRAY_SIZE(sdhci_resource3),
308 struct platform_device tegra_sdhci_device4 = {
309 .name = "sdhci-tegra",
311 .resource = sdhci_resource4,
312 .num_resources = ARRAY_SIZE(sdhci_resource4),
315 static struct resource tegra_usb1_resources[] = {
317 .start = TEGRA_USB_BASE,
318 .end = TEGRA_USB_BASE + TEGRA_USB_SIZE - 1,
319 .flags = IORESOURCE_MEM,
324 .flags = IORESOURCE_IRQ,
328 static struct resource tegra_usb2_resources[] = {
330 .start = TEGRA_USB2_BASE,
331 .end = TEGRA_USB2_BASE + TEGRA_USB2_SIZE - 1,
332 .flags = IORESOURCE_MEM,
337 .flags = IORESOURCE_IRQ,
341 static struct resource tegra_usb3_resources[] = {
343 .start = TEGRA_USB3_BASE,
344 .end = TEGRA_USB3_BASE + TEGRA_USB3_SIZE - 1,
345 .flags = IORESOURCE_MEM,
350 .flags = IORESOURCE_IRQ,
354 static u64 tegra_ehci_dmamask = DMA_BIT_MASK(32);
356 struct platform_device tegra_ehci1_device = {
357 .name = "tegra-ehci",
360 .dma_mask = &tegra_ehci_dmamask,
361 .coherent_dma_mask = DMA_BIT_MASK(32),
363 .resource = tegra_usb1_resources,
364 .num_resources = ARRAY_SIZE(tegra_usb1_resources),
367 struct platform_device tegra_ehci2_device = {
368 .name = "tegra-ehci",
371 .dma_mask = &tegra_ehci_dmamask,
372 .coherent_dma_mask = DMA_BIT_MASK(32),
374 .resource = tegra_usb2_resources,
375 .num_resources = ARRAY_SIZE(tegra_usb2_resources),
378 struct platform_device tegra_ehci3_device = {
379 .name = "tegra-ehci",
382 .dma_mask = &tegra_ehci_dmamask,
383 .coherent_dma_mask = DMA_BIT_MASK(32),
385 .resource = tegra_usb3_resources,
386 .num_resources = ARRAY_SIZE(tegra_usb3_resources),
389 static struct resource tegra_pmu_resources[] = {
391 .start = INT_CPU0_PMU_INTR,
392 .end = INT_CPU0_PMU_INTR,
393 .flags = IORESOURCE_IRQ,
396 .start = INT_CPU1_PMU_INTR,
397 .end = INT_CPU1_PMU_INTR,
398 .flags = IORESOURCE_IRQ,
402 struct platform_device tegra_pmu_device = {
404 .id = ARM_PMU_DEVICE_CPU,
405 .num_resources = ARRAY_SIZE(tegra_pmu_resources),
406 .resource = tegra_pmu_resources,
409 static struct resource tegra_uarta_resources[] = {
411 .start = TEGRA_UARTA_BASE,
412 .end = TEGRA_UARTA_BASE + TEGRA_UARTA_SIZE - 1,
413 .flags = IORESOURCE_MEM,
418 .flags = IORESOURCE_IRQ,
422 static struct resource tegra_uartb_resources[] = {
424 .start = TEGRA_UARTB_BASE,
425 .end = TEGRA_UARTB_BASE + TEGRA_UARTB_SIZE - 1,
426 .flags = IORESOURCE_MEM,
431 .flags = IORESOURCE_IRQ,
435 static struct resource tegra_uartc_resources[] = {
437 .start = TEGRA_UARTC_BASE,
438 .end = TEGRA_UARTC_BASE + TEGRA_UARTC_SIZE - 1,
439 .flags = IORESOURCE_MEM,
444 .flags = IORESOURCE_IRQ,
448 static struct resource tegra_uartd_resources[] = {
450 .start = TEGRA_UARTD_BASE,
451 .end = TEGRA_UARTD_BASE + TEGRA_UARTD_SIZE - 1,
452 .flags = IORESOURCE_MEM,
457 .flags = IORESOURCE_IRQ,
461 static struct resource tegra_uarte_resources[] = {
463 .start = TEGRA_UARTE_BASE,
464 .end = TEGRA_UARTE_BASE + TEGRA_UARTE_SIZE - 1,
465 .flags = IORESOURCE_MEM,
470 .flags = IORESOURCE_IRQ,
474 struct platform_device tegra_uarta_device = {
475 .name = "tegra_uart",
477 .num_resources = ARRAY_SIZE(tegra_uarta_resources),
478 .resource = tegra_uarta_resources,
480 .coherent_dma_mask = DMA_BIT_MASK(32),
484 struct platform_device tegra_uartb_device = {
485 .name = "tegra_uart",
487 .num_resources = ARRAY_SIZE(tegra_uartb_resources),
488 .resource = tegra_uartb_resources,
490 .coherent_dma_mask = DMA_BIT_MASK(32),
494 struct platform_device tegra_uartc_device = {
495 .name = "tegra_uart",
497 .num_resources = ARRAY_SIZE(tegra_uartc_resources),
498 .resource = tegra_uartc_resources,
500 .coherent_dma_mask = DMA_BIT_MASK(32),
504 struct platform_device tegra_uartd_device = {
505 .name = "tegra_uart",
507 .num_resources = ARRAY_SIZE(tegra_uartd_resources),
508 .resource = tegra_uartd_resources,
510 .coherent_dma_mask = DMA_BIT_MASK(32),
514 struct platform_device tegra_uarte_device = {
515 .name = "tegra_uart",
517 .num_resources = ARRAY_SIZE(tegra_uarte_resources),
518 .resource = tegra_uarte_resources,
520 .coherent_dma_mask = DMA_BIT_MASK(32),
524 static struct resource i2s_resource1[] = {
528 .flags = IORESOURCE_IRQ
531 .start = TEGRA_DMA_REQ_SEL_I2S_1,
532 .end = TEGRA_DMA_REQ_SEL_I2S_1,
533 .flags = IORESOURCE_DMA
536 .start = TEGRA_I2S1_BASE,
537 .end = TEGRA_I2S1_BASE + TEGRA_I2S1_SIZE - 1,
538 .flags = IORESOURCE_MEM
542 static struct resource i2s_resource2[] = {
546 .flags = IORESOURCE_IRQ
549 .start = TEGRA_DMA_REQ_SEL_I2S2_1,
550 .end = TEGRA_DMA_REQ_SEL_I2S2_1,
551 .flags = IORESOURCE_DMA
554 .start = TEGRA_I2S2_BASE,
555 .end = TEGRA_I2S2_BASE + TEGRA_I2S2_SIZE - 1,
556 .flags = IORESOURCE_MEM
560 struct platform_device tegra_i2s_device1 = {
563 .resource = i2s_resource1,
564 .num_resources = ARRAY_SIZE(i2s_resource1),
567 struct platform_device tegra_i2s_device2 = {
570 .resource = i2s_resource2,
571 .num_resources = ARRAY_SIZE(i2s_resource2),
574 static struct resource tegra_das_resources[] = {
576 .start = TEGRA_APB_MISC_DAS_BASE,
577 .end = TEGRA_APB_MISC_DAS_BASE + TEGRA_APB_MISC_DAS_SIZE - 1,
578 .flags = IORESOURCE_MEM,
582 struct platform_device tegra_das_device = {
585 .num_resources = ARRAY_SIZE(tegra_das_resources),
586 .resource = tegra_das_resources,
589 struct platform_device tegra_pcm_device = {
590 .name = "tegra-pcm-audio",