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>
26 #include <linux/platform_data/tegra_usb.h>
28 #include <mach/irqs.h>
29 #include <mach/iomap.h>
31 #include <mach/usb_phy.h>
32 #include "gpio-names.h"
34 static struct resource i2c_resource1[] = {
38 .flags = IORESOURCE_IRQ,
41 .start = TEGRA_I2C_BASE,
42 .end = TEGRA_I2C_BASE + TEGRA_I2C_SIZE-1,
43 .flags = IORESOURCE_MEM,
47 static struct resource i2c_resource2[] = {
51 .flags = IORESOURCE_IRQ,
54 .start = TEGRA_I2C2_BASE,
55 .end = TEGRA_I2C2_BASE + TEGRA_I2C2_SIZE-1,
56 .flags = IORESOURCE_MEM,
60 static struct resource i2c_resource3[] = {
64 .flags = IORESOURCE_IRQ,
67 .start = TEGRA_I2C3_BASE,
68 .end = TEGRA_I2C3_BASE + TEGRA_I2C3_SIZE-1,
69 .flags = IORESOURCE_MEM,
73 static struct resource i2c_resource4[] = {
77 .flags = IORESOURCE_IRQ,
80 .start = TEGRA_DVC_BASE,
81 .end = TEGRA_DVC_BASE + TEGRA_DVC_SIZE-1,
82 .flags = IORESOURCE_MEM,
86 static struct tegra_i2c_platform_data tegra_i2c1_platform_data = {
87 .bus_clk_rate = 400000,
90 static struct tegra_i2c_platform_data tegra_i2c2_platform_data = {
91 .bus_clk_rate = 400000,
94 static struct tegra_i2c_platform_data tegra_i2c3_platform_data = {
95 .bus_clk_rate = 400000,
98 static struct tegra_i2c_platform_data tegra_dvc_platform_data = {
99 .bus_clk_rate = 400000,
102 struct platform_device tegra_i2c_device1 = {
105 .resource = i2c_resource1,
106 .num_resources = ARRAY_SIZE(i2c_resource1),
108 .platform_data = &tegra_i2c1_platform_data,
112 struct platform_device tegra_i2c_device2 = {
115 .resource = i2c_resource2,
116 .num_resources = ARRAY_SIZE(i2c_resource2),
118 .platform_data = &tegra_i2c2_platform_data,
122 struct platform_device tegra_i2c_device3 = {
125 .resource = i2c_resource3,
126 .num_resources = ARRAY_SIZE(i2c_resource3),
128 .platform_data = &tegra_i2c3_platform_data,
132 struct platform_device tegra_i2c_device4 = {
135 .resource = i2c_resource4,
136 .num_resources = ARRAY_SIZE(i2c_resource4),
138 .platform_data = &tegra_dvc_platform_data,
142 static struct resource spi_resource1[] = {
144 .start = INT_S_LINK1,
146 .flags = IORESOURCE_IRQ,
149 .start = TEGRA_SPI1_BASE,
150 .end = TEGRA_SPI1_BASE + TEGRA_SPI1_SIZE-1,
151 .flags = IORESOURCE_MEM,
155 static struct resource spi_resource2[] = {
159 .flags = IORESOURCE_IRQ,
162 .start = TEGRA_SPI2_BASE,
163 .end = TEGRA_SPI2_BASE + TEGRA_SPI2_SIZE-1,
164 .flags = IORESOURCE_MEM,
168 static struct resource spi_resource3[] = {
172 .flags = IORESOURCE_IRQ,
175 .start = TEGRA_SPI3_BASE,
176 .end = TEGRA_SPI3_BASE + TEGRA_SPI3_SIZE-1,
177 .flags = IORESOURCE_MEM,
181 static struct resource spi_resource4[] = {
185 .flags = IORESOURCE_IRQ,
188 .start = TEGRA_SPI4_BASE,
189 .end = TEGRA_SPI4_BASE + TEGRA_SPI4_SIZE-1,
190 .flags = IORESOURCE_MEM,
194 struct platform_device tegra_spi_device1 = {
197 .resource = spi_resource1,
198 .num_resources = ARRAY_SIZE(spi_resource1),
200 .coherent_dma_mask = 0xffffffff,
204 struct platform_device tegra_spi_device2 = {
207 .resource = spi_resource2,
208 .num_resources = ARRAY_SIZE(spi_resource2),
210 .coherent_dma_mask = 0xffffffff,
214 struct platform_device tegra_spi_device3 = {
217 .resource = spi_resource3,
218 .num_resources = ARRAY_SIZE(spi_resource3),
220 .coherent_dma_mask = 0xffffffff,
224 struct platform_device tegra_spi_device4 = {
227 .resource = spi_resource4,
228 .num_resources = ARRAY_SIZE(spi_resource4),
230 .coherent_dma_mask = 0xffffffff,
235 static struct resource sdhci_resource1[] = {
239 .flags = IORESOURCE_IRQ,
242 .start = TEGRA_SDMMC1_BASE,
243 .end = TEGRA_SDMMC1_BASE + TEGRA_SDMMC1_SIZE-1,
244 .flags = IORESOURCE_MEM,
248 static struct resource sdhci_resource2[] = {
252 .flags = IORESOURCE_IRQ,
255 .start = TEGRA_SDMMC2_BASE,
256 .end = TEGRA_SDMMC2_BASE + TEGRA_SDMMC2_SIZE-1,
257 .flags = IORESOURCE_MEM,
261 static struct resource sdhci_resource3[] = {
265 .flags = IORESOURCE_IRQ,
268 .start = TEGRA_SDMMC3_BASE,
269 .end = TEGRA_SDMMC3_BASE + TEGRA_SDMMC3_SIZE-1,
270 .flags = IORESOURCE_MEM,
274 static struct resource sdhci_resource4[] = {
278 .flags = IORESOURCE_IRQ,
281 .start = TEGRA_SDMMC4_BASE,
282 .end = TEGRA_SDMMC4_BASE + TEGRA_SDMMC4_SIZE-1,
283 .flags = IORESOURCE_MEM,
287 /* board files should fill in platform_data register the devices themselvs.
288 * See board-harmony.c for an example
290 struct platform_device tegra_sdhci_device1 = {
291 .name = "sdhci-tegra",
293 .resource = sdhci_resource1,
294 .num_resources = ARRAY_SIZE(sdhci_resource1),
297 struct platform_device tegra_sdhci_device2 = {
298 .name = "sdhci-tegra",
300 .resource = sdhci_resource2,
301 .num_resources = ARRAY_SIZE(sdhci_resource2),
304 struct platform_device tegra_sdhci_device3 = {
305 .name = "sdhci-tegra",
307 .resource = sdhci_resource3,
308 .num_resources = ARRAY_SIZE(sdhci_resource3),
311 struct platform_device tegra_sdhci_device4 = {
312 .name = "sdhci-tegra",
314 .resource = sdhci_resource4,
315 .num_resources = ARRAY_SIZE(sdhci_resource4),
318 static struct resource tegra_usb1_resources[] = {
320 .start = TEGRA_USB_BASE,
321 .end = TEGRA_USB_BASE + TEGRA_USB_SIZE - 1,
322 .flags = IORESOURCE_MEM,
327 .flags = IORESOURCE_IRQ,
331 static struct resource tegra_usb2_resources[] = {
333 .start = TEGRA_USB2_BASE,
334 .end = TEGRA_USB2_BASE + TEGRA_USB2_SIZE - 1,
335 .flags = IORESOURCE_MEM,
340 .flags = IORESOURCE_IRQ,
344 static struct resource tegra_usb3_resources[] = {
346 .start = TEGRA_USB3_BASE,
347 .end = TEGRA_USB3_BASE + TEGRA_USB3_SIZE - 1,
348 .flags = IORESOURCE_MEM,
353 .flags = IORESOURCE_IRQ,
357 static struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config = {
358 /* All existing boards use GPIO PV0 for phy reset */
359 .reset_gpio = TEGRA_GPIO_PV0,
363 static struct tegra_ehci_platform_data tegra_ehci1_pdata = {
364 .operating_mode = TEGRA_USB_OTG,
365 .power_down_on_bus_suspend = 1,
368 static struct tegra_ehci_platform_data tegra_ehci2_pdata = {
369 .phy_config = &tegra_ehci2_ulpi_phy_config,
370 .operating_mode = TEGRA_USB_HOST,
371 .power_down_on_bus_suspend = 1,
374 static struct tegra_ehci_platform_data tegra_ehci3_pdata = {
375 .operating_mode = TEGRA_USB_HOST,
376 .power_down_on_bus_suspend = 1,
379 static u64 tegra_ehci_dmamask = DMA_BIT_MASK(32);
381 struct platform_device tegra_ehci1_device = {
382 .name = "tegra-ehci",
385 .dma_mask = &tegra_ehci_dmamask,
386 .coherent_dma_mask = DMA_BIT_MASK(32),
387 .platform_data = &tegra_ehci1_pdata,
389 .resource = tegra_usb1_resources,
390 .num_resources = ARRAY_SIZE(tegra_usb1_resources),
393 struct platform_device tegra_ehci2_device = {
394 .name = "tegra-ehci",
397 .dma_mask = &tegra_ehci_dmamask,
398 .coherent_dma_mask = DMA_BIT_MASK(32),
399 .platform_data = &tegra_ehci2_pdata,
401 .resource = tegra_usb2_resources,
402 .num_resources = ARRAY_SIZE(tegra_usb2_resources),
405 struct platform_device tegra_ehci3_device = {
406 .name = "tegra-ehci",
409 .dma_mask = &tegra_ehci_dmamask,
410 .coherent_dma_mask = DMA_BIT_MASK(32),
411 .platform_data = &tegra_ehci3_pdata,
413 .resource = tegra_usb3_resources,
414 .num_resources = ARRAY_SIZE(tegra_usb3_resources),
417 static struct resource tegra_pmu_resources[] = {
419 .start = INT_CPU0_PMU_INTR,
420 .end = INT_CPU0_PMU_INTR,
421 .flags = IORESOURCE_IRQ,
424 .start = INT_CPU1_PMU_INTR,
425 .end = INT_CPU1_PMU_INTR,
426 .flags = IORESOURCE_IRQ,
430 struct platform_device tegra_pmu_device = {
432 .id = ARM_PMU_DEVICE_CPU,
433 .num_resources = ARRAY_SIZE(tegra_pmu_resources),
434 .resource = tegra_pmu_resources,
437 static struct resource tegra_uarta_resources[] = {
439 .start = TEGRA_UARTA_BASE,
440 .end = TEGRA_UARTA_BASE + TEGRA_UARTA_SIZE - 1,
441 .flags = IORESOURCE_MEM,
446 .flags = IORESOURCE_IRQ,
450 static struct resource tegra_uartb_resources[] = {
452 .start = TEGRA_UARTB_BASE,
453 .end = TEGRA_UARTB_BASE + TEGRA_UARTB_SIZE - 1,
454 .flags = IORESOURCE_MEM,
459 .flags = IORESOURCE_IRQ,
463 static struct resource tegra_uartc_resources[] = {
465 .start = TEGRA_UARTC_BASE,
466 .end = TEGRA_UARTC_BASE + TEGRA_UARTC_SIZE - 1,
467 .flags = IORESOURCE_MEM,
472 .flags = IORESOURCE_IRQ,
476 static struct resource tegra_uartd_resources[] = {
478 .start = TEGRA_UARTD_BASE,
479 .end = TEGRA_UARTD_BASE + TEGRA_UARTD_SIZE - 1,
480 .flags = IORESOURCE_MEM,
485 .flags = IORESOURCE_IRQ,
489 static struct resource tegra_uarte_resources[] = {
491 .start = TEGRA_UARTE_BASE,
492 .end = TEGRA_UARTE_BASE + TEGRA_UARTE_SIZE - 1,
493 .flags = IORESOURCE_MEM,
498 .flags = IORESOURCE_IRQ,
502 struct platform_device tegra_uarta_device = {
503 .name = "tegra_uart",
505 .num_resources = ARRAY_SIZE(tegra_uarta_resources),
506 .resource = tegra_uarta_resources,
508 .coherent_dma_mask = DMA_BIT_MASK(32),
512 struct platform_device tegra_uartb_device = {
513 .name = "tegra_uart",
515 .num_resources = ARRAY_SIZE(tegra_uartb_resources),
516 .resource = tegra_uartb_resources,
518 .coherent_dma_mask = DMA_BIT_MASK(32),
522 struct platform_device tegra_uartc_device = {
523 .name = "tegra_uart",
525 .num_resources = ARRAY_SIZE(tegra_uartc_resources),
526 .resource = tegra_uartc_resources,
528 .coherent_dma_mask = DMA_BIT_MASK(32),
532 struct platform_device tegra_uartd_device = {
533 .name = "tegra_uart",
535 .num_resources = ARRAY_SIZE(tegra_uartd_resources),
536 .resource = tegra_uartd_resources,
538 .coherent_dma_mask = DMA_BIT_MASK(32),
542 struct platform_device tegra_uarte_device = {
543 .name = "tegra_uart",
545 .num_resources = ARRAY_SIZE(tegra_uarte_resources),
546 .resource = tegra_uarte_resources,
548 .coherent_dma_mask = DMA_BIT_MASK(32),
552 static struct resource i2s_resource1[] = {
556 .flags = IORESOURCE_IRQ
559 .start = TEGRA_DMA_REQ_SEL_I2S_1,
560 .end = TEGRA_DMA_REQ_SEL_I2S_1,
561 .flags = IORESOURCE_DMA
564 .start = TEGRA_I2S1_BASE,
565 .end = TEGRA_I2S1_BASE + TEGRA_I2S1_SIZE - 1,
566 .flags = IORESOURCE_MEM
570 static struct resource i2s_resource2[] = {
574 .flags = IORESOURCE_IRQ
577 .start = TEGRA_DMA_REQ_SEL_I2S2_1,
578 .end = TEGRA_DMA_REQ_SEL_I2S2_1,
579 .flags = IORESOURCE_DMA
582 .start = TEGRA_I2S2_BASE,
583 .end = TEGRA_I2S2_BASE + TEGRA_I2S2_SIZE - 1,
584 .flags = IORESOURCE_MEM
588 struct platform_device tegra_i2s_device1 = {
591 .resource = i2s_resource1,
592 .num_resources = ARRAY_SIZE(i2s_resource1),
595 struct platform_device tegra_i2s_device2 = {
598 .resource = i2s_resource2,
599 .num_resources = ARRAY_SIZE(i2s_resource2),
602 static struct resource tegra_das_resources[] = {
604 .start = TEGRA_APB_MISC_DAS_BASE,
605 .end = TEGRA_APB_MISC_DAS_BASE + TEGRA_APB_MISC_DAS_SIZE - 1,
606 .flags = IORESOURCE_MEM,
610 struct platform_device tegra_das_device = {
613 .num_resources = ARRAY_SIZE(tegra_das_resources),
614 .resource = tegra_das_resources,
617 struct platform_device tegra_pcm_device = {
618 .name = "tegra-pcm-audio",