1 /* linux/arch/arm/mach-msm/devices.c
3 * Copyright (C) 2008 Google, Inc.
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.
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.
16 #include <linux/kernel.h>
17 #include <linux/platform_device.h>
19 #include <mach/irqs.h>
20 #include <mach/msm_iomap.h>
23 #include <asm/mach/flash.h>
24 #include <linux/mtd/nand.h>
25 #include <linux/mtd/partitions.h>
29 static struct resource resources_uart1[] = {
33 .flags = IORESOURCE_IRQ,
36 .start = MSM_UART1_PHYS,
37 .end = MSM_UART1_PHYS + MSM_UART1_SIZE - 1,
38 .flags = IORESOURCE_MEM,
42 static struct resource resources_uart2[] = {
46 .flags = IORESOURCE_IRQ,
49 .start = MSM_UART2_PHYS,
50 .end = MSM_UART2_PHYS + MSM_UART2_SIZE - 1,
51 .flags = IORESOURCE_MEM,
55 static struct resource resources_uart3[] = {
59 .flags = IORESOURCE_IRQ,
62 .start = MSM_UART3_PHYS,
63 .end = MSM_UART3_PHYS + MSM_UART3_SIZE - 1,
64 .flags = IORESOURCE_MEM,
68 struct platform_device msm_device_uart1 = {
71 .num_resources = ARRAY_SIZE(resources_uart1),
72 .resource = resources_uart1,
75 struct platform_device msm_device_uart2 = {
78 .num_resources = ARRAY_SIZE(resources_uart2),
79 .resource = resources_uart2,
82 struct platform_device msm_device_uart3 = {
85 .num_resources = ARRAY_SIZE(resources_uart3),
86 .resource = resources_uart3,
89 static struct resource resources_i2c[] = {
91 .start = MSM_I2C_PHYS,
92 .end = MSM_I2C_PHYS + MSM_I2C_SIZE - 1,
93 .flags = IORESOURCE_MEM,
98 .flags = IORESOURCE_IRQ,
102 struct platform_device msm_device_i2c = {
105 .num_resources = ARRAY_SIZE(resources_i2c),
106 .resource = resources_i2c,
109 static struct resource resources_hsusb[] = {
111 .start = MSM_HSUSB_PHYS,
112 .end = MSM_HSUSB_PHYS + MSM_HSUSB_SIZE,
113 .flags = IORESOURCE_MEM,
118 .flags = IORESOURCE_IRQ,
122 struct platform_device msm_device_hsusb = {
125 .num_resources = ARRAY_SIZE(resources_hsusb),
126 .resource = resources_hsusb,
128 .coherent_dma_mask = 0xffffffff,
132 struct flash_platform_data msm_nand_data = {
137 static struct resource resources_nand[] = {
141 .flags = IORESOURCE_DMA,
145 struct platform_device msm_device_nand = {
148 .num_resources = ARRAY_SIZE(resources_nand),
149 .resource = resources_nand,
151 .platform_data = &msm_nand_data,
155 struct platform_device msm_device_smd = {
160 static struct resource resources_sdc1[] = {
162 .start = MSM_SDC1_PHYS,
163 .end = MSM_SDC1_PHYS + MSM_SDC1_SIZE - 1,
164 .flags = IORESOURCE_MEM,
169 .flags = IORESOURCE_IRQ,
175 .flags = IORESOURCE_IRQ,
179 .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED,
185 .flags = IORESOURCE_DMA,
189 static struct resource resources_sdc2[] = {
191 .start = MSM_SDC2_PHYS,
192 .end = MSM_SDC2_PHYS + MSM_SDC2_SIZE - 1,
193 .flags = IORESOURCE_MEM,
198 .flags = IORESOURCE_IRQ,
204 .flags = IORESOURCE_IRQ,
208 .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED,
214 .flags = IORESOURCE_DMA,
218 static struct resource resources_sdc3[] = {
220 .start = MSM_SDC3_PHYS,
221 .end = MSM_SDC3_PHYS + MSM_SDC3_SIZE - 1,
222 .flags = IORESOURCE_MEM,
227 .flags = IORESOURCE_IRQ,
233 .flags = IORESOURCE_IRQ,
237 .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED,
243 .flags = IORESOURCE_DMA,
247 static struct resource resources_sdc4[] = {
249 .start = MSM_SDC4_PHYS,
250 .end = MSM_SDC4_PHYS + MSM_SDC4_SIZE - 1,
251 .flags = IORESOURCE_MEM,
256 .flags = IORESOURCE_IRQ,
262 .flags = IORESOURCE_IRQ,
266 .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED,
272 .flags = IORESOURCE_DMA,
276 struct platform_device msm_device_sdc1 = {
279 .num_resources = ARRAY_SIZE(resources_sdc1),
280 .resource = resources_sdc1,
282 .coherent_dma_mask = 0xffffffff,
286 struct platform_device msm_device_sdc2 = {
289 .num_resources = ARRAY_SIZE(resources_sdc2),
290 .resource = resources_sdc2,
292 .coherent_dma_mask = 0xffffffff,
296 struct platform_device msm_device_sdc3 = {
299 .num_resources = ARRAY_SIZE(resources_sdc3),
300 .resource = resources_sdc3,
302 .coherent_dma_mask = 0xffffffff,
306 struct platform_device msm_device_sdc4 = {
309 .num_resources = ARRAY_SIZE(resources_sdc4),
310 .resource = resources_sdc4,
312 .coherent_dma_mask = 0xffffffff,
316 static struct platform_device *msm_sdcc_devices[] __initdata = {
323 int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat,
324 unsigned int stat_irq, unsigned long stat_irq_flags)
326 struct platform_device *pdev;
327 struct resource *res;
329 if (controller < 1 || controller > 4)
332 pdev = msm_sdcc_devices[controller-1];
333 pdev->dev.platform_data = plat;
335 res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "status_irq");
339 res->start = res->end = stat_irq;
340 res->flags &= ~IORESOURCE_DISABLED;
341 res->flags |= stat_irq_flags;
344 return platform_device_register(pdev);