2 * arch/arm/mach-tegra/devices.c
4 * Copyright (C) 2010 Google, Inc.
7 * Colin Cross <ccross@android.com>
8 * Erik Gilling <ccross@android.com>
10 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and
12 * may be copied, distributed, and modified under those terms.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
22 #include <linux/resource.h>
23 #include <linux/platform_device.h>
24 #include <linux/dma-mapping.h>
25 #include <linux/fsl_devices.h>
26 #include <linux/serial_8250.h>
28 #include <mach/irqs.h>
29 #include <mach/iomap.h>
32 static struct resource i2c_resource1[] = {
36 .flags = IORESOURCE_IRQ,
39 .start = TEGRA_I2C_BASE,
40 .end = TEGRA_I2C_BASE + TEGRA_I2C_SIZE-1,
41 .flags = IORESOURCE_MEM,
45 static struct resource i2c_resource2[] = {
49 .flags = IORESOURCE_IRQ,
52 .start = TEGRA_I2C2_BASE,
53 .end = TEGRA_I2C2_BASE + TEGRA_I2C2_SIZE-1,
54 .flags = IORESOURCE_MEM,
58 static struct resource i2c_resource3[] = {
62 .flags = IORESOURCE_IRQ,
65 .start = TEGRA_I2C3_BASE,
66 .end = TEGRA_I2C3_BASE + TEGRA_I2C3_SIZE-1,
67 .flags = IORESOURCE_MEM,
71 static struct resource i2c_resource4[] = {
75 .flags = IORESOURCE_IRQ,
78 .start = TEGRA_DVC_BASE,
79 .end = TEGRA_DVC_BASE + TEGRA_DVC_SIZE-1,
80 .flags = IORESOURCE_MEM,
84 struct platform_device tegra_i2c_device1 = {
87 .resource = i2c_resource1,
88 .num_resources = ARRAY_SIZE(i2c_resource1),
94 struct platform_device tegra_i2c_device2 = {
97 .resource = i2c_resource2,
98 .num_resources = ARRAY_SIZE(i2c_resource2),
104 struct platform_device tegra_i2c_device3 = {
107 .resource = i2c_resource3,
108 .num_resources = ARRAY_SIZE(i2c_resource3),
114 struct platform_device tegra_i2c_device4 = {
117 .resource = i2c_resource4,
118 .num_resources = ARRAY_SIZE(i2c_resource4),
124 static struct resource spi_resource1[] = {
126 .start = INT_S_LINK1,
128 .flags = IORESOURCE_IRQ,
131 .start = TEGRA_SPI1_BASE,
132 .end = TEGRA_SPI1_BASE + TEGRA_SPI1_SIZE-1,
133 .flags = IORESOURCE_MEM,
137 static struct resource spi_resource2[] = {
141 .flags = IORESOURCE_IRQ,
144 .start = TEGRA_SPI2_BASE,
145 .end = TEGRA_SPI2_BASE + TEGRA_SPI2_SIZE-1,
146 .flags = IORESOURCE_MEM,
150 static struct resource spi_resource3[] = {
154 .flags = IORESOURCE_IRQ,
157 .start = TEGRA_SPI3_BASE,
158 .end = TEGRA_SPI3_BASE + TEGRA_SPI3_SIZE-1,
159 .flags = IORESOURCE_MEM,
163 static struct resource spi_resource4[] = {
167 .flags = IORESOURCE_IRQ,
170 .start = TEGRA_SPI4_BASE,
171 .end = TEGRA_SPI4_BASE + TEGRA_SPI4_SIZE-1,
172 .flags = IORESOURCE_MEM,
176 struct platform_device tegra_spi_device1 = {
179 .resource = spi_resource1,
180 .num_resources = ARRAY_SIZE(spi_resource1),
182 .coherent_dma_mask = 0xffffffff,
186 struct platform_device tegra_spi_device2 = {
189 .resource = spi_resource2,
190 .num_resources = ARRAY_SIZE(spi_resource2),
192 .coherent_dma_mask = 0xffffffff,
196 struct platform_device tegra_spi_device3 = {
199 .resource = spi_resource3,
200 .num_resources = ARRAY_SIZE(spi_resource3),
202 .coherent_dma_mask = 0xffffffff,
206 struct platform_device tegra_spi_device4 = {
209 .resource = spi_resource4,
210 .num_resources = ARRAY_SIZE(spi_resource4),
212 .coherent_dma_mask = 0xffffffff,
217 static struct resource sdhci_resource1[] = {
221 .flags = IORESOURCE_IRQ,
224 .start = TEGRA_SDMMC1_BASE,
225 .end = TEGRA_SDMMC1_BASE + TEGRA_SDMMC1_SIZE-1,
226 .flags = IORESOURCE_MEM,
230 static struct resource sdhci_resource2[] = {
234 .flags = IORESOURCE_IRQ,
237 .start = TEGRA_SDMMC2_BASE,
238 .end = TEGRA_SDMMC2_BASE + TEGRA_SDMMC2_SIZE-1,
239 .flags = IORESOURCE_MEM,
243 static struct resource sdhci_resource3[] = {
247 .flags = IORESOURCE_IRQ,
250 .start = TEGRA_SDMMC3_BASE,
251 .end = TEGRA_SDMMC3_BASE + TEGRA_SDMMC3_SIZE-1,
252 .flags = IORESOURCE_MEM,
256 static struct resource sdhci_resource4[] = {
260 .flags = IORESOURCE_IRQ,
263 .start = TEGRA_SDMMC4_BASE,
264 .end = TEGRA_SDMMC4_BASE + TEGRA_SDMMC4_SIZE-1,
265 .flags = IORESOURCE_MEM,
269 /* board files should fill in platform_data register the devices themselvs.
270 * See board-harmony.c for an example
272 struct platform_device tegra_sdhci_device1 = {
273 .name = "sdhci-tegra",
275 .resource = sdhci_resource1,
276 .num_resources = ARRAY_SIZE(sdhci_resource1),
279 struct platform_device tegra_sdhci_device2 = {
280 .name = "sdhci-tegra",
282 .resource = sdhci_resource2,
283 .num_resources = ARRAY_SIZE(sdhci_resource2),
286 struct platform_device tegra_sdhci_device3 = {
287 .name = "sdhci-tegra",
289 .resource = sdhci_resource3,
290 .num_resources = ARRAY_SIZE(sdhci_resource3),
293 struct platform_device tegra_sdhci_device4 = {
294 .name = "sdhci-tegra",
296 .resource = sdhci_resource4,
297 .num_resources = ARRAY_SIZE(sdhci_resource4),
300 static struct resource w1_resources[] = {
304 .flags = IORESOURCE_IRQ
307 .start = TEGRA_OWR_BASE,
308 .end = TEGRA_OWR_BASE + TEGRA_OWR_SIZE - 1,
309 .flags = IORESOURCE_MEM
313 struct platform_device tegra_w1_device = {
316 .resource = w1_resources,
317 .num_resources = ARRAY_SIZE(w1_resources),
320 static struct resource tegra_udc_resources[] = {
322 .start = TEGRA_USB_BASE,
323 .end = TEGRA_USB_BASE + TEGRA_USB_SIZE - 1,
324 .flags = IORESOURCE_MEM,
329 .flags = IORESOURCE_IRQ,
333 static struct resource tegra_usb1_resources[] = {
335 .start = TEGRA_USB_BASE,
336 .end = TEGRA_USB_BASE + TEGRA_USB_SIZE - 1,
337 .flags = IORESOURCE_MEM,
342 .flags = IORESOURCE_IRQ,
346 static struct resource tegra_usb2_resources[] = {
348 .start = TEGRA_USB2_BASE,
349 .end = TEGRA_USB2_BASE + TEGRA_USB2_SIZE - 1,
350 .flags = IORESOURCE_MEM,
355 .flags = IORESOURCE_IRQ,
359 static struct resource tegra_usb3_resources[] = {
361 .start = TEGRA_USB3_BASE,
362 .end = TEGRA_USB3_BASE + TEGRA_USB3_SIZE - 1,
363 .flags = IORESOURCE_MEM,
368 .flags = IORESOURCE_IRQ,
372 static u64 tegra_udc_dmamask = DMA_BIT_MASK(32);
374 static struct fsl_usb2_platform_data tegra_udc_pdata = {
375 .operating_mode = FSL_USB2_DR_DEVICE,
376 .phy_mode = FSL_USB2_PHY_UTMI,
379 struct platform_device tegra_udc_device = {
380 .name = "fsl-tegra-udc",
383 .dma_mask = &tegra_udc_dmamask,
384 .coherent_dma_mask = DMA_BIT_MASK(32),
385 .platform_data = &tegra_udc_pdata,
387 .resource = tegra_udc_resources,
388 .num_resources = ARRAY_SIZE(tegra_udc_resources),
391 static u64 tegra_ehci_dmamask = DMA_BIT_MASK(32);
393 struct platform_device tegra_ehci1_device = {
394 .name = "tegra-ehci",
397 .dma_mask = &tegra_ehci_dmamask,
398 .coherent_dma_mask = DMA_BIT_MASK(32),
400 .resource = tegra_usb1_resources,
401 .num_resources = ARRAY_SIZE(tegra_usb1_resources),
404 struct platform_device tegra_ehci2_device = {
405 .name = "tegra-ehci",
408 .dma_mask = &tegra_ehci_dmamask,
409 .coherent_dma_mask = DMA_BIT_MASK(32),
411 .resource = tegra_usb2_resources,
412 .num_resources = ARRAY_SIZE(tegra_usb2_resources),
415 struct platform_device tegra_ehci3_device = {
416 .name = "tegra-ehci",
419 .dma_mask = &tegra_ehci_dmamask,
420 .coherent_dma_mask = DMA_BIT_MASK(32),
422 .resource = tegra_usb3_resources,
423 .num_resources = ARRAY_SIZE(tegra_usb3_resources),
426 static struct resource tegra_otg_resources[] = {
428 .start = TEGRA_USB_BASE,
429 .end = TEGRA_USB_BASE + TEGRA_USB_SIZE - 1,
430 .flags = IORESOURCE_MEM,
435 .flags = IORESOURCE_IRQ,
439 struct platform_device tegra_otg_device = {
442 .resource = tegra_otg_resources,
443 .num_resources = ARRAY_SIZE(tegra_otg_resources),
446 static struct resource i2s_resource1[] = {
450 .flags = IORESOURCE_IRQ
453 .start = TEGRA_DMA_REQ_SEL_I2S_1,
454 .end = TEGRA_DMA_REQ_SEL_I2S_1,
455 .flags = IORESOURCE_DMA
458 .start = TEGRA_I2S1_BASE,
459 .end = TEGRA_I2S1_BASE + TEGRA_I2S1_SIZE - 1,
460 .flags = IORESOURCE_MEM
464 static struct resource i2s_resource2[] = {
468 .flags = IORESOURCE_IRQ
471 .start = TEGRA_DMA_REQ_SEL_I2S2_1,
472 .end = TEGRA_DMA_REQ_SEL_I2S2_1,
473 .flags = IORESOURCE_DMA
476 .start = TEGRA_I2S2_BASE,
477 .end = TEGRA_I2S2_BASE + TEGRA_I2S2_SIZE - 1,
478 .flags = IORESOURCE_MEM
482 static struct resource spdif_resource[] = {
486 .flags = IORESOURCE_IRQ
489 .start = TEGRA_DMA_REQ_SEL_SPD_I,
490 .end = TEGRA_DMA_REQ_SEL_SPD_I,
491 .flags = IORESOURCE_DMA
494 .start = TEGRA_SPDIF_BASE,
495 .end = TEGRA_SPDIF_BASE + TEGRA_SPDIF_SIZE - 1,
496 .flags = IORESOURCE_MEM
500 struct platform_device tegra_i2s_device1 = {
503 .resource = i2s_resource1,
504 .num_resources = ARRAY_SIZE(i2s_resource1),
507 struct platform_device tegra_i2s_device2 = {
510 .resource = i2s_resource2,
511 .num_resources = ARRAY_SIZE(i2s_resource2),
514 struct platform_device tegra_spdif_device = {
517 .resource = spdif_resource,
518 .num_resources = ARRAY_SIZE(spdif_resource),
521 static struct resource tegra_gart_resources[] = {
524 .flags = IORESOURCE_MEM,
525 .start = TEGRA_MC_BASE,
526 .end = TEGRA_MC_BASE + TEGRA_MC_SIZE - 1,
530 .flags = IORESOURCE_MEM,
531 .start = TEGRA_GART_BASE,
532 .end = TEGRA_GART_BASE + TEGRA_GART_SIZE - 1,
536 struct platform_device tegra_gart_device = {
537 .name = "tegra_gart",
539 .num_resources = ARRAY_SIZE(tegra_gart_resources),
540 .resource = tegra_gart_resources
543 static struct resource pmu_resources[] = {
545 .start = INT_CPU0_PMU_INTR,
546 .end = INT_CPU0_PMU_INTR,
547 .flags = IORESOURCE_IRQ,
550 .start = INT_CPU1_PMU_INTR,
551 .end = INT_CPU1_PMU_INTR,
552 .flags = IORESOURCE_IRQ,
556 struct platform_device pmu_device = {
558 .id = ARM_PMU_DEVICE_CPU,
559 .num_resources = ARRAY_SIZE(pmu_resources),
560 .resource = pmu_resources,
563 #define CLK_RESET_RST_SOURCE 0x0
564 static struct resource tegra_wdt_resources[] = {
566 .start = TEGRA_CLK_RESET_BASE + CLK_RESET_RST_SOURCE,
567 .end = TEGRA_CLK_RESET_BASE + CLK_RESET_RST_SOURCE + 4 - 1,
568 .flags = IORESOURCE_MEM,
571 .start = TEGRA_TMR1_BASE,
572 .end = TEGRA_TMR1_BASE + TEGRA_TMR1_SIZE - 1,
573 .flags = IORESOURCE_MEM,
578 .flags = IORESOURCE_IRQ,
582 struct platform_device tegra_wdt_device = {
585 .num_resources = ARRAY_SIZE(tegra_wdt_resources),
586 .resource = tegra_wdt_resources,
589 static struct resource tegra_pwfm0_resource = {
590 .start = TEGRA_PWFM0_BASE,
591 .end = TEGRA_PWFM0_BASE + TEGRA_PWFM0_SIZE - 1,
592 .flags = IORESOURCE_MEM,
595 static struct resource tegra_pwfm1_resource = {
596 .start = TEGRA_PWFM1_BASE,
597 .end = TEGRA_PWFM1_BASE + TEGRA_PWFM1_SIZE - 1,
598 .flags = IORESOURCE_MEM,
601 static struct resource tegra_pwfm2_resource = {
602 .start = TEGRA_PWFM2_BASE,
603 .end = TEGRA_PWFM2_BASE + TEGRA_PWFM2_SIZE - 1,
604 .flags = IORESOURCE_MEM,
607 static struct resource tegra_pwfm3_resource = {
608 .start = TEGRA_PWFM3_BASE,
609 .end = TEGRA_PWFM3_BASE + TEGRA_PWFM3_SIZE - 1,
610 .flags = IORESOURCE_MEM,
613 struct platform_device tegra_pwfm0_device = {
617 .resource = &tegra_pwfm0_resource,
620 struct platform_device tegra_pwfm1_device = {
624 .resource = &tegra_pwfm1_resource,
627 struct platform_device tegra_pwfm2_device = {
631 .resource = &tegra_pwfm2_resource,
634 struct platform_device tegra_pwfm3_device = {
638 .resource = &tegra_pwfm3_resource,
641 static struct plat_serial8250_port tegra_uart0_port[] = {
643 .mapbase = TEGRA_UARTA_BASE,
644 .membase = IO_ADDRESS(TEGRA_UARTA_BASE),
652 static struct plat_serial8250_port tegra_uart1_port[] = {
654 .mapbase = TEGRA_UARTB_BASE,
655 .membase = IO_ADDRESS(TEGRA_UARTB_BASE),
663 static struct plat_serial8250_port tegra_uart2_port[] = {
665 .mapbase = TEGRA_UARTC_BASE,
666 .membase = IO_ADDRESS(TEGRA_UARTC_BASE),
674 static struct plat_serial8250_port tegra_uart3_port[] = {
676 .mapbase = TEGRA_UARTD_BASE,
677 .membase = IO_ADDRESS(TEGRA_UARTD_BASE),
685 static struct plat_serial8250_port tegra_uart4_port[] = {
687 .mapbase = TEGRA_UARTE_BASE,
688 .membase = IO_ADDRESS(TEGRA_UARTE_BASE),
696 struct platform_device tegra_uart0_device = {
697 .name = "tegra_uart",
700 .platform_data = tegra_uart0_port,
701 .coherent_dma_mask = DMA_BIT_MASK(32),
705 struct platform_device tegra_uart1_device = {
706 .name = "tegra_uart",
709 .platform_data = tegra_uart1_port,
710 .coherent_dma_mask = DMA_BIT_MASK(32),
714 struct platform_device tegra_uart2_device = {
715 .name = "tegra_uart",
718 .platform_data = tegra_uart2_port,
719 .coherent_dma_mask = DMA_BIT_MASK(32),
723 struct platform_device tegra_uart3_device = {
724 .name = "tegra_uart",
727 .platform_data = tegra_uart3_port,
728 .coherent_dma_mask = DMA_BIT_MASK(32),
732 struct platform_device tegra_uart4_device = {
733 .name = "tegra_uart",
736 .platform_data = tegra_uart4_port,
737 .coherent_dma_mask = DMA_BIT_MASK(32),
741 static struct resource tegra_grhost_resources[] = {
743 .start = TEGRA_HOST1X_BASE,
744 .end = TEGRA_HOST1X_BASE + TEGRA_HOST1X_SIZE - 1,
745 .flags = IORESOURCE_MEM,
748 .start = TEGRA_DISPLAY_BASE,
749 .end = TEGRA_DISPLAY_BASE + TEGRA_DISPLAY_SIZE - 1,
750 .flags = IORESOURCE_MEM,
753 .start = TEGRA_DISPLAY2_BASE,
754 .end = TEGRA_DISPLAY2_BASE + TEGRA_DISPLAY2_SIZE - 1,
755 .flags = IORESOURCE_MEM,
758 .start = TEGRA_VI_BASE,
759 .end = TEGRA_VI_BASE + TEGRA_VI_SIZE - 1,
760 .flags = IORESOURCE_MEM,
763 .start = TEGRA_ISP_BASE,
764 .end = TEGRA_ISP_BASE + TEGRA_ISP_SIZE - 1,
765 .flags = IORESOURCE_MEM,
768 .start = TEGRA_MPE_BASE,
769 .end = TEGRA_MPE_BASE + TEGRA_MPE_SIZE - 1,
770 .flags = IORESOURCE_MEM,
773 .start = INT_SYNCPT_THRESH_BASE,
774 .end = INT_SYNCPT_THRESH_BASE + INT_SYNCPT_THRESH_NR - 1,
775 .flags = IORESOURCE_IRQ,
778 .start = INT_HOST1X_MPCORE_GENERAL,
779 .end = INT_HOST1X_MPCORE_GENERAL,
780 .flags = IORESOURCE_IRQ,
784 struct platform_device tegra_grhost_device = {
785 .name = "tegra_grhost",
787 .resource = tegra_grhost_resources,
788 .num_resources = ARRAY_SIZE(tegra_grhost_resources),
791 static struct resource tegra_avp_resources[] = {
793 .start = INT_SHR_SEM_INBOX_IBF,
794 .end = INT_SHR_SEM_INBOX_IBF,
795 .flags = IORESOURCE_IRQ,
796 .name = "mbox_from_avp_pending",
800 struct platform_device tegra_avp_device = {
803 .num_resources = ARRAY_SIZE(tegra_avp_resources),
804 .resource = tegra_avp_resources,
806 .coherent_dma_mask = 0xffffffffULL,