Merge commit 'linus/master' into merge-linus
[linux-2.6] / arch / arm / mach-msm / common.c
1 /* linux/arch/arm/mach-msm/common.c
2  *
3  * Common setup code for MSM7K Boards
4  *
5  * Copyright (C) 2007 Google, Inc.
6  * Author: Brian Swetland <swetland@google.com>
7  *
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.
11  *
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.
16  *
17  */
18
19 #include <linux/kernel.h>
20 #include <linux/init.h>
21 #include <linux/platform_device.h>
22 #include <linux/io.h>
23
24 #include <asm/mach/flash.h>
25
26 #include <asm/setup.h>
27
28 #include <linux/mtd/nand.h>
29 #include <linux/mtd/partitions.h>
30
31 #include <mach/msm_iomap.h>
32
33 #include <mach/board.h>
34
35 struct flash_platform_data msm_nand_data = {
36         .parts          = 0,
37         .nr_parts       = 0,
38 };
39
40 static struct resource msm_nand_resources[] = {
41         [0] = {
42                 .start  = 7,
43                 .end    = 7,
44                 .flags  = IORESOURCE_DMA,
45         },
46 };
47
48 static struct platform_device msm_nand_device = {
49         .name           = "msm_nand",
50         .id             = -1,
51         .num_resources  = ARRAY_SIZE(msm_nand_resources),
52         .resource       = msm_nand_resources,
53         .dev            = {
54                 .platform_data  = &msm_nand_data,
55         },
56 };
57
58 static struct platform_device msm_smd_device = {
59         .name   = "msm_smd",
60         .id     = -1,
61 };
62
63 static struct resource msm_i2c_resources[] = {
64         {
65                 .start  = MSM_I2C_BASE,
66                 .end    = MSM_I2C_BASE + MSM_I2C_SIZE - 1,
67                 .flags  = IORESOURCE_MEM,
68         },
69         {
70                 .start  = INT_PWB_I2C,
71                 .end    = INT_PWB_I2C,
72                 .flags  = IORESOURCE_IRQ,
73         },
74 };
75
76 static struct platform_device msm_i2c_device = {
77         .name           = "msm_i2c",
78         .id             = 0,
79         .num_resources  = ARRAY_SIZE(msm_i2c_resources),
80         .resource       = msm_i2c_resources,
81 };
82
83 static struct resource usb_resources[] = {
84         {
85                 .start  = MSM_HSUSB_PHYS,
86                 .end    = MSM_HSUSB_PHYS + MSM_HSUSB_SIZE,
87                 .flags  = IORESOURCE_MEM,
88         },
89         {
90                 .start  = INT_USB_HS,
91                 .end    = INT_USB_HS,
92                 .flags  = IORESOURCE_IRQ,
93         },
94 };
95
96 static struct platform_device msm_hsusb_device = {
97         .name           = "msm_hsusb",
98         .id             = -1,
99         .num_resources  = ARRAY_SIZE(usb_resources),
100         .resource       = usb_resources,
101         .dev            = {
102                 .coherent_dma_mask      = 0xffffffff,
103         },
104 };
105
106 static struct platform_device *devices[] __initdata = {
107         &msm_nand_device,
108         &msm_smd_device,
109         &msm_i2c_device,
110         &msm_hsusb_device,
111 };
112
113 void __init msm_add_devices(void)
114 {
115         platform_add_devices(devices, ARRAY_SIZE(devices));
116 }