blob: af132ebd86c502f5543d8b0f540e317b1ddaac5d [file] [log] [blame]
Daniel Walker8d747cd2010-02-25 11:37:43 -08001/* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17
18#include <linux/kernel.h>
19#include <linux/irq.h>
20#include <linux/gpio.h>
21#include <linux/platform_device.h>
22#include <linux/delay.h>
23#include <linux/bootmem.h>
24#include <linux/io.h>
25#include <linux/smsc911x.h>
26
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/setup.h>
30
31#include <mach/gpio.h>
32#include <mach/board.h>
33#include <mach/camera.h>
34#include <mach/memory.h>
35#include <mach/msm_iomap.h>
36#include <mach/msm_hsusb.h>
37#include <mach/dma.h>
38
39#include <mach/vreg.h>
40
41#include "devices.h"
42#include "timer.h"
43#include "socinfo.h"
44
45static struct resource smc91x_resources[] = {
46 [0] = {
47 .start = 0x8A000300,
48 .end = 0x8A0003ff,
49 .flags = IORESOURCE_MEM,
50 },
51 [1] = {
52 .start = MSM_GPIO_TO_INT(156),
53 .end = MSM_GPIO_TO_INT(156),
54 .flags = IORESOURCE_IRQ,
55 },
56};
57
58static struct platform_device smc91x_device = {
59 .name = "smc91x",
60 .id = 0,
61 .num_resources = ARRAY_SIZE(smc91x_resources),
62 .resource = smc91x_resources,
63};
64
65static struct smsc911x_platform_config smsc911x_config = {
66 .phy_interface = PHY_INTERFACE_MODE_MII,
67 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
68 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
69 .flags = SMSC911X_USE_32BIT,
70};
71
72static struct resource smsc911x_resources[] = {
73 [0] = {
74 .start = 0x8D000000,
75 .end = 0x8D000100,
76 .flags = IORESOURCE_MEM,
77 },
78 [1] = {
79 .start = MSM_GPIO_TO_INT(88),
80 .end = MSM_GPIO_TO_INT(88),
81 .flags = IORESOURCE_IRQ,
82 },
83};
84
85static struct platform_device smsc911x_device = {
86 .name = "smsc911x",
87 .id = -1,
88 .num_resources = ARRAY_SIZE(smsc911x_resources),
89 .resource = smsc911x_resources,
90 .dev = {
91 .platform_data = &smsc911x_config,
92 },
93};
94
95static struct msm_gpio smsc911x_gpios[] = {
96 { GPIO_CFG(172, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "ebi2_addr6" },
97 { GPIO_CFG(173, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "ebi2_addr5" },
98 { GPIO_CFG(174, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "ebi2_addr4" },
99 { GPIO_CFG(175, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "ebi2_addr3" },
100 { GPIO_CFG(176, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "ebi2_addr2" },
101 { GPIO_CFG(177, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "ebi2_addr1" },
102 { GPIO_CFG(178, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "ebi2_addr0" },
103 { GPIO_CFG(88, 2, GPIO_INPUT, GPIO_PULL_UP, GPIO_2MA), "smsc911x_irq" },
104};
105
106static void msm7x30_cfg_smsc911x(void)
107{
108 int rc;
109
110 rc = msm_gpios_request_enable(smsc911x_gpios,
111 ARRAY_SIZE(smsc911x_gpios));
112 if (rc)
113 pr_err("%s: unable to enable gpios\n", __func__);
114}
115
116static struct platform_device *devices[] __initdata = {
117 &msm_device_smd,
118 &msm_device_dmov,
119 &smc91x_device,
120 &smsc911x_device,
121 &msm_device_nand,
122 &msm_device_uart_dm1,
123};
124
125static void __init msm7x30_init_irq(void)
126{
127 msm_init_irq();
128}
129
130static void __init msm_7x30_init_nand(void)
131{
132 int rc;
133 /* Enable GPIO 86 & 115 */
134 rc = msm_gpios_request_enable(msm_nand_ebi2_cfg_data,
135 ARRAY_SIZE(msm_nand_ebi2_cfg_data));
136 if (rc)
137 printk(KERN_ERR "%s: Failed to enable GPIO 86 & 115\n",
138 __func__);
139}
140
141static void __init msm7x30_init(void)
142{
143 if (socinfo_init() < 0)
144 printk(KERN_ERR "%s: socinfo_init() failed!\n",
145 __func__);
146 msm_acpu_clock_init(&msm7x30_clock_data);
147 if (machine_is_msm7x30_surf() || machine_is_msm7x30_fluid())
148 msm7x30_cfg_smsc911x();
149 platform_add_devices(devices, ARRAY_SIZE(devices));
150 msm_7x30_init_nand();
151 buses_init();
152}
153
154static void __init msm7x30_map_io(void)
155{
156 msm_shared_ram_phys = 0x00000000;
157 msm_map_msm7x30_io();
158 msm7x30_allocate_memory_regions();
159 msm_clock_init(msm_clocks_7x30, msm_num_clocks_7x30);
160}
161
162MACHINE_START(MSM7X30_SURF, "QCT MSM7X30 SURF")
163#ifdef CONFIG_MSM_DEBUG_UART
164 .phys_io = MSM_DEBUG_UART_PHYS,
165 .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
166#endif
167 .boot_params = PHYS_OFFSET + 0x100,
168 .map_io = msm7x30_map_io,
169 .init_irq = msm7x30_init_irq,
170 .init_machine = msm7x30_init,
171 .timer = &msm_timer,
172MACHINE_END
173
174MACHINE_START(MSM7X30_FFA, "QCT MSM7X30 FFA")
175#ifdef CONFIG_MSM_DEBUG_UART
176 .phys_io = MSM_DEBUG_UART_PHYS,
177 .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
178#endif
179 .boot_params = PHYS_OFFSET + 0x100,
180 .map_io = msm7x30_map_io,
181 .init_irq = msm7x30_init_irq,
182 .init_machine = msm7x30_init,
183 .timer = &msm_timer,
184MACHINE_END
185
186MACHINE_START(MSM7X30_FLUID, "QCT MSM7X30 FLUID")
187#ifdef CONFIG_MSM_DEBUG_UART
188 .phys_io = MSM_DEBUG_UART_PHYS,
189 .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
190#endif
191 .boot_params = PHYS_OFFSET + 0x100,
192 .map_io = msm7x30_map_io,
193 .init_irq = msm7x30_init_irq,
194 .init_machine = msm7x30_init,
195 .timer = &msm_timer,
196MACHINE_END