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 <mach/irqs.h>
27 #include <mach/iomap.h>
29 #include <mach/usb_phy.h>
31 #include "gpio-names.h"
34 static struct resource gpio_resource
[] = {
36 .start
= TEGRA_GPIO_BASE
,
37 .end
= TEGRA_GPIO_BASE
+ TEGRA_GPIO_SIZE
-1,
38 .flags
= IORESOURCE_MEM
,
43 .flags
= IORESOURCE_IRQ
,
48 .flags
= IORESOURCE_IRQ
,
53 .flags
= IORESOURCE_IRQ
,
58 .flags
= IORESOURCE_IRQ
,
63 .flags
= IORESOURCE_IRQ
,
68 .flags
= IORESOURCE_IRQ
,
73 .flags
= IORESOURCE_IRQ
,
77 struct platform_device tegra_gpio_device
= {
80 .resource
= gpio_resource
,
81 .num_resources
= ARRAY_SIZE(gpio_resource
),
84 static struct resource pinmux_resource
[] = {
86 /* Tri-state registers */
87 .start
= TEGRA_APB_MISC_BASE
+ 0x14,
88 .end
= TEGRA_APB_MISC_BASE
+ 0x20 + 3,
89 .flags
= IORESOURCE_MEM
,
93 .start
= TEGRA_APB_MISC_BASE
+ 0x80,
94 .end
= TEGRA_APB_MISC_BASE
+ 0x9c + 3,
95 .flags
= IORESOURCE_MEM
,
98 /* Pull-up/down registers */
99 .start
= TEGRA_APB_MISC_BASE
+ 0xa0,
100 .end
= TEGRA_APB_MISC_BASE
+ 0xb0 + 3,
101 .flags
= IORESOURCE_MEM
,
104 /* Pad control registers */
105 .start
= TEGRA_APB_MISC_BASE
+ 0x868,
106 .end
= TEGRA_APB_MISC_BASE
+ 0x90c + 3,
107 .flags
= IORESOURCE_MEM
,
111 struct platform_device tegra_pinmux_device
= {
112 .name
= "tegra20-pinctrl",
114 .resource
= pinmux_resource
,
115 .num_resources
= ARRAY_SIZE(pinmux_resource
),
118 static struct resource i2c_resource1
[] = {
122 .flags
= IORESOURCE_IRQ
,
125 .start
= TEGRA_I2C_BASE
,
126 .end
= TEGRA_I2C_BASE
+ TEGRA_I2C_SIZE
-1,
127 .flags
= IORESOURCE_MEM
,
131 static struct resource i2c_resource2
[] = {
135 .flags
= IORESOURCE_IRQ
,
138 .start
= TEGRA_I2C2_BASE
,
139 .end
= TEGRA_I2C2_BASE
+ TEGRA_I2C2_SIZE
-1,
140 .flags
= IORESOURCE_MEM
,
144 static struct resource i2c_resource3
[] = {
148 .flags
= IORESOURCE_IRQ
,
151 .start
= TEGRA_I2C3_BASE
,
152 .end
= TEGRA_I2C3_BASE
+ TEGRA_I2C3_SIZE
-1,
153 .flags
= IORESOURCE_MEM
,
157 static struct resource i2c_resource4
[] = {
161 .flags
= IORESOURCE_IRQ
,
164 .start
= TEGRA_DVC_BASE
,
165 .end
= TEGRA_DVC_BASE
+ TEGRA_DVC_SIZE
-1,
166 .flags
= IORESOURCE_MEM
,
170 static struct tegra_i2c_platform_data tegra_i2c1_platform_data
= {
171 .bus_clk_rate
= 400000,
174 static struct tegra_i2c_platform_data tegra_i2c2_platform_data
= {
175 .bus_clk_rate
= 400000,
178 static struct tegra_i2c_platform_data tegra_i2c3_platform_data
= {
179 .bus_clk_rate
= 400000,
182 static struct tegra_i2c_platform_data tegra_dvc_platform_data
= {
183 .bus_clk_rate
= 400000,
186 struct platform_device tegra_i2c_device1
= {
189 .resource
= i2c_resource1
,
190 .num_resources
= ARRAY_SIZE(i2c_resource1
),
192 .platform_data
= &tegra_i2c1_platform_data
,
196 struct platform_device tegra_i2c_device2
= {
199 .resource
= i2c_resource2
,
200 .num_resources
= ARRAY_SIZE(i2c_resource2
),
202 .platform_data
= &tegra_i2c2_platform_data
,
206 struct platform_device tegra_i2c_device3
= {
209 .resource
= i2c_resource3
,
210 .num_resources
= ARRAY_SIZE(i2c_resource3
),
212 .platform_data
= &tegra_i2c3_platform_data
,
216 struct platform_device tegra_i2c_device4
= {
219 .resource
= i2c_resource4
,
220 .num_resources
= ARRAY_SIZE(i2c_resource4
),
222 .platform_data
= &tegra_dvc_platform_data
,
226 static struct resource spi_resource1
[] = {
228 .start
= INT_S_LINK1
,
230 .flags
= IORESOURCE_IRQ
,
233 .start
= TEGRA_SPI1_BASE
,
234 .end
= TEGRA_SPI1_BASE
+ TEGRA_SPI1_SIZE
-1,
235 .flags
= IORESOURCE_MEM
,
239 static struct resource spi_resource2
[] = {
243 .flags
= IORESOURCE_IRQ
,
246 .start
= TEGRA_SPI2_BASE
,
247 .end
= TEGRA_SPI2_BASE
+ TEGRA_SPI2_SIZE
-1,
248 .flags
= IORESOURCE_MEM
,
252 static struct resource spi_resource3
[] = {
256 .flags
= IORESOURCE_IRQ
,
259 .start
= TEGRA_SPI3_BASE
,
260 .end
= TEGRA_SPI3_BASE
+ TEGRA_SPI3_SIZE
-1,
261 .flags
= IORESOURCE_MEM
,
265 static struct resource spi_resource4
[] = {
269 .flags
= IORESOURCE_IRQ
,
272 .start
= TEGRA_SPI4_BASE
,
273 .end
= TEGRA_SPI4_BASE
+ TEGRA_SPI4_SIZE
-1,
274 .flags
= IORESOURCE_MEM
,
278 struct platform_device tegra_spi_device1
= {
281 .resource
= spi_resource1
,
282 .num_resources
= ARRAY_SIZE(spi_resource1
),
284 .coherent_dma_mask
= 0xffffffff,
288 struct platform_device tegra_spi_device2
= {
291 .resource
= spi_resource2
,
292 .num_resources
= ARRAY_SIZE(spi_resource2
),
294 .coherent_dma_mask
= 0xffffffff,
298 struct platform_device tegra_spi_device3
= {
301 .resource
= spi_resource3
,
302 .num_resources
= ARRAY_SIZE(spi_resource3
),
304 .coherent_dma_mask
= 0xffffffff,
308 struct platform_device tegra_spi_device4
= {
311 .resource
= spi_resource4
,
312 .num_resources
= ARRAY_SIZE(spi_resource4
),
314 .coherent_dma_mask
= 0xffffffff,
319 static struct resource sdhci_resource1
[] = {
323 .flags
= IORESOURCE_IRQ
,
326 .start
= TEGRA_SDMMC1_BASE
,
327 .end
= TEGRA_SDMMC1_BASE
+ TEGRA_SDMMC1_SIZE
-1,
328 .flags
= IORESOURCE_MEM
,
332 static struct resource sdhci_resource2
[] = {
336 .flags
= IORESOURCE_IRQ
,
339 .start
= TEGRA_SDMMC2_BASE
,
340 .end
= TEGRA_SDMMC2_BASE
+ TEGRA_SDMMC2_SIZE
-1,
341 .flags
= IORESOURCE_MEM
,
345 static struct resource sdhci_resource3
[] = {
349 .flags
= IORESOURCE_IRQ
,
352 .start
= TEGRA_SDMMC3_BASE
,
353 .end
= TEGRA_SDMMC3_BASE
+ TEGRA_SDMMC3_SIZE
-1,
354 .flags
= IORESOURCE_MEM
,
358 static struct resource sdhci_resource4
[] = {
362 .flags
= IORESOURCE_IRQ
,
365 .start
= TEGRA_SDMMC4_BASE
,
366 .end
= TEGRA_SDMMC4_BASE
+ TEGRA_SDMMC4_SIZE
-1,
367 .flags
= IORESOURCE_MEM
,
371 /* board files should fill in platform_data register the devices themselvs.
372 * See board-harmony.c for an example
374 struct platform_device tegra_sdhci_device1
= {
375 .name
= "sdhci-tegra",
377 .resource
= sdhci_resource1
,
378 .num_resources
= ARRAY_SIZE(sdhci_resource1
),
381 struct platform_device tegra_sdhci_device2
= {
382 .name
= "sdhci-tegra",
384 .resource
= sdhci_resource2
,
385 .num_resources
= ARRAY_SIZE(sdhci_resource2
),
388 struct platform_device tegra_sdhci_device3
= {
389 .name
= "sdhci-tegra",
391 .resource
= sdhci_resource3
,
392 .num_resources
= ARRAY_SIZE(sdhci_resource3
),
395 struct platform_device tegra_sdhci_device4
= {
396 .name
= "sdhci-tegra",
398 .resource
= sdhci_resource4
,
399 .num_resources
= ARRAY_SIZE(sdhci_resource4
),
402 static struct resource tegra_usb1_resources
[] = {
404 .start
= TEGRA_USB_BASE
,
405 .end
= TEGRA_USB_BASE
+ TEGRA_USB_SIZE
- 1,
406 .flags
= IORESOURCE_MEM
,
411 .flags
= IORESOURCE_IRQ
,
415 static struct resource tegra_usb2_resources
[] = {
417 .start
= TEGRA_USB2_BASE
,
418 .end
= TEGRA_USB2_BASE
+ TEGRA_USB2_SIZE
- 1,
419 .flags
= IORESOURCE_MEM
,
424 .flags
= IORESOURCE_IRQ
,
428 static struct resource tegra_usb3_resources
[] = {
430 .start
= TEGRA_USB3_BASE
,
431 .end
= TEGRA_USB3_BASE
+ TEGRA_USB3_SIZE
- 1,
432 .flags
= IORESOURCE_MEM
,
437 .flags
= IORESOURCE_IRQ
,
441 struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config
= {
446 struct tegra_ehci_platform_data tegra_ehci1_pdata
= {
447 .operating_mode
= TEGRA_USB_OTG
,
448 .power_down_on_bus_suspend
= 1,
452 struct tegra_ehci_platform_data tegra_ehci2_pdata
= {
453 .phy_config
= &tegra_ehci2_ulpi_phy_config
,
454 .operating_mode
= TEGRA_USB_HOST
,
455 .power_down_on_bus_suspend
= 1,
459 struct tegra_ehci_platform_data tegra_ehci3_pdata
= {
460 .operating_mode
= TEGRA_USB_HOST
,
461 .power_down_on_bus_suspend
= 1,
465 static u64 tegra_ehci_dmamask
= DMA_BIT_MASK(32);
467 struct platform_device tegra_ehci1_device
= {
468 .name
= "tegra-ehci",
471 .dma_mask
= &tegra_ehci_dmamask
,
472 .coherent_dma_mask
= DMA_BIT_MASK(32),
473 .platform_data
= &tegra_ehci1_pdata
,
475 .resource
= tegra_usb1_resources
,
476 .num_resources
= ARRAY_SIZE(tegra_usb1_resources
),
479 struct platform_device tegra_ehci2_device
= {
480 .name
= "tegra-ehci",
483 .dma_mask
= &tegra_ehci_dmamask
,
484 .coherent_dma_mask
= DMA_BIT_MASK(32),
485 .platform_data
= &tegra_ehci2_pdata
,
487 .resource
= tegra_usb2_resources
,
488 .num_resources
= ARRAY_SIZE(tegra_usb2_resources
),
491 struct platform_device tegra_ehci3_device
= {
492 .name
= "tegra-ehci",
495 .dma_mask
= &tegra_ehci_dmamask
,
496 .coherent_dma_mask
= DMA_BIT_MASK(32),
497 .platform_data
= &tegra_ehci3_pdata
,
499 .resource
= tegra_usb3_resources
,
500 .num_resources
= ARRAY_SIZE(tegra_usb3_resources
),
503 static struct resource tegra_pmu_resources
[] = {
505 .start
= INT_CPU0_PMU_INTR
,
506 .end
= INT_CPU0_PMU_INTR
,
507 .flags
= IORESOURCE_IRQ
,
510 .start
= INT_CPU1_PMU_INTR
,
511 .end
= INT_CPU1_PMU_INTR
,
512 .flags
= IORESOURCE_IRQ
,
516 struct platform_device tegra_pmu_device
= {
519 .num_resources
= ARRAY_SIZE(tegra_pmu_resources
),
520 .resource
= tegra_pmu_resources
,
523 static struct resource tegra_uarta_resources
[] = {
525 .start
= TEGRA_UARTA_BASE
,
526 .end
= TEGRA_UARTA_BASE
+ TEGRA_UARTA_SIZE
- 1,
527 .flags
= IORESOURCE_MEM
,
532 .flags
= IORESOURCE_IRQ
,
536 static struct resource tegra_uartb_resources
[] = {
538 .start
= TEGRA_UARTB_BASE
,
539 .end
= TEGRA_UARTB_BASE
+ TEGRA_UARTB_SIZE
- 1,
540 .flags
= IORESOURCE_MEM
,
545 .flags
= IORESOURCE_IRQ
,
549 static struct resource tegra_uartc_resources
[] = {
551 .start
= TEGRA_UARTC_BASE
,
552 .end
= TEGRA_UARTC_BASE
+ TEGRA_UARTC_SIZE
- 1,
553 .flags
= IORESOURCE_MEM
,
558 .flags
= IORESOURCE_IRQ
,
562 static struct resource tegra_uartd_resources
[] = {
564 .start
= TEGRA_UARTD_BASE
,
565 .end
= TEGRA_UARTD_BASE
+ TEGRA_UARTD_SIZE
- 1,
566 .flags
= IORESOURCE_MEM
,
571 .flags
= IORESOURCE_IRQ
,
575 static struct resource tegra_uarte_resources
[] = {
577 .start
= TEGRA_UARTE_BASE
,
578 .end
= TEGRA_UARTE_BASE
+ TEGRA_UARTE_SIZE
- 1,
579 .flags
= IORESOURCE_MEM
,
584 .flags
= IORESOURCE_IRQ
,
588 struct platform_device tegra_uarta_device
= {
589 .name
= "tegra_uart",
591 .num_resources
= ARRAY_SIZE(tegra_uarta_resources
),
592 .resource
= tegra_uarta_resources
,
594 .coherent_dma_mask
= DMA_BIT_MASK(32),
598 struct platform_device tegra_uartb_device
= {
599 .name
= "tegra_uart",
601 .num_resources
= ARRAY_SIZE(tegra_uartb_resources
),
602 .resource
= tegra_uartb_resources
,
604 .coherent_dma_mask
= DMA_BIT_MASK(32),
608 struct platform_device tegra_uartc_device
= {
609 .name
= "tegra_uart",
611 .num_resources
= ARRAY_SIZE(tegra_uartc_resources
),
612 .resource
= tegra_uartc_resources
,
614 .coherent_dma_mask
= DMA_BIT_MASK(32),
618 struct platform_device tegra_uartd_device
= {
619 .name
= "tegra_uart",
621 .num_resources
= ARRAY_SIZE(tegra_uartd_resources
),
622 .resource
= tegra_uartd_resources
,
624 .coherent_dma_mask
= DMA_BIT_MASK(32),
628 struct platform_device tegra_uarte_device
= {
629 .name
= "tegra_uart",
631 .num_resources
= ARRAY_SIZE(tegra_uarte_resources
),
632 .resource
= tegra_uarte_resources
,
634 .coherent_dma_mask
= DMA_BIT_MASK(32),
638 static struct resource i2s_resource1
[] = {
642 .flags
= IORESOURCE_IRQ
645 .start
= TEGRA_DMA_REQ_SEL_I2S_1
,
646 .end
= TEGRA_DMA_REQ_SEL_I2S_1
,
647 .flags
= IORESOURCE_DMA
650 .start
= TEGRA_I2S1_BASE
,
651 .end
= TEGRA_I2S1_BASE
+ TEGRA_I2S1_SIZE
- 1,
652 .flags
= IORESOURCE_MEM
656 static struct resource i2s_resource2
[] = {
660 .flags
= IORESOURCE_IRQ
663 .start
= TEGRA_DMA_REQ_SEL_I2S2_1
,
664 .end
= TEGRA_DMA_REQ_SEL_I2S2_1
,
665 .flags
= IORESOURCE_DMA
668 .start
= TEGRA_I2S2_BASE
,
669 .end
= TEGRA_I2S2_BASE
+ TEGRA_I2S2_SIZE
- 1,
670 .flags
= IORESOURCE_MEM
674 struct platform_device tegra_i2s_device1
= {
675 .name
= "tegra20-i2s",
677 .resource
= i2s_resource1
,
678 .num_resources
= ARRAY_SIZE(i2s_resource1
),
681 struct platform_device tegra_i2s_device2
= {
682 .name
= "tegra20-i2s",
684 .resource
= i2s_resource2
,
685 .num_resources
= ARRAY_SIZE(i2s_resource2
),
688 static struct resource tegra_das_resources
[] = {
690 .start
= TEGRA_APB_MISC_DAS_BASE
,
691 .end
= TEGRA_APB_MISC_DAS_BASE
+ TEGRA_APB_MISC_DAS_SIZE
- 1,
692 .flags
= IORESOURCE_MEM
,
696 struct platform_device tegra_das_device
= {
697 .name
= "tegra20-das",
699 .num_resources
= ARRAY_SIZE(tegra_das_resources
),
700 .resource
= tegra_das_resources
,