aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-msm/board-qsd8x50.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-msm/board-qsd8x50.c')
-rw-r--r--arch/arm/mach-msm/board-qsd8x50.c254
1 files changed, 0 insertions, 254 deletions
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
deleted file mode 100644
index 10016a3bc698..000000000000
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ /dev/null
@@ -1,254 +0,0 @@
1/* Copyright (c) 2009-2011, 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#include <linux/gpio.h>
18#include <linux/kernel.h>
19#include <linux/irq.h>
20#include <linux/platform_device.h>
21#include <linux/delay.h>
22#include <linux/usb/msm_hsusb.h>
23#include <linux/err.h>
24#include <linux/clkdev.h>
25#include <linux/smc91x.h>
26
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/io.h>
30#include <asm/setup.h>
31
32#include <mach/irqs.h>
33#include <mach/sirc.h>
34#include <mach/vreg.h>
35#include <mach/clk.h>
36#include <linux/platform_data/mmc-msm_sdcc.h>
37
38#include "devices.h"
39#include "common.h"
40
41static const resource_size_t qsd8x50_surf_smc91x_base __initconst = 0x70000300;
42static const unsigned qsd8x50_surf_smc91x_gpio __initconst = 156;
43
44/* Leave smc91x resources empty here, as we'll fill them in
45 * at run-time: they vary from board to board, and the true
46 * configuration won't be known until boot.
47 */
48static struct resource smc91x_resources[] = {
49 [0] = {
50 .flags = IORESOURCE_MEM,
51 },
52 [1] = {
53 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
54 },
55};
56
57static struct smc91x_platdata smc91x_platdata = {
58 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
59};
60
61static struct platform_device smc91x_device = {
62 .name = "smc91x",
63 .id = 0,
64 .num_resources = ARRAY_SIZE(smc91x_resources),
65 .resource = smc91x_resources,
66 .dev.platform_data = &smc91x_platdata,
67};
68
69static int __init msm_init_smc91x(void)
70{
71 if (machine_is_qsd8x50_surf()) {
72 smc91x_resources[0].start = qsd8x50_surf_smc91x_base;
73 smc91x_resources[0].end = qsd8x50_surf_smc91x_base + 0xff;
74 smc91x_resources[1].start =
75 gpio_to_irq(qsd8x50_surf_smc91x_gpio);
76 smc91x_resources[1].end =
77 gpio_to_irq(qsd8x50_surf_smc91x_gpio);
78 platform_device_register(&smc91x_device);
79 }
80
81 return 0;
82}
83module_init(msm_init_smc91x);
84
85static int hsusb_phy_init_seq[] = {
86 0x08, 0x31, /* Increase HS Driver Amplitude */
87 0x20, 0x32, /* Enable and set Pre-Emphasis Depth to 10% */
88 -1
89};
90
91static int hsusb_link_clk_reset(struct clk *link_clk, bool assert)
92{
93 int ret;
94
95 if (assert) {
96 ret = clk_reset(link_clk, CLK_RESET_ASSERT);
97 if (ret)
98 pr_err("usb hs_clk assert failed\n");
99 } else {
100 ret = clk_reset(link_clk, CLK_RESET_DEASSERT);
101 if (ret)
102 pr_err("usb hs_clk deassert failed\n");
103 }
104 return ret;
105}
106
107static int hsusb_phy_clk_reset(struct clk *phy_clk)
108{
109 int ret;
110
111 ret = clk_reset(phy_clk, CLK_RESET_ASSERT);
112 if (ret) {
113 pr_err("usb phy clk assert failed\n");
114 return ret;
115 }
116 usleep_range(10000, 12000);
117 ret = clk_reset(phy_clk, CLK_RESET_DEASSERT);
118 if (ret)
119 pr_err("usb phy clk deassert failed\n");
120 return ret;
121}
122
123static struct msm_otg_platform_data msm_otg_pdata = {
124 .phy_init_seq = hsusb_phy_init_seq,
125 .mode = USB_DR_MODE_PERIPHERAL,
126 .otg_control = OTG_PHY_CONTROL,
127 .link_clk_reset = hsusb_link_clk_reset,
128 .phy_clk_reset = hsusb_phy_clk_reset,
129};
130
131static struct platform_device *devices[] __initdata = {
132 &msm_clock_8x50,
133 &msm_device_gpio_8x50,
134 &msm_device_uart3,
135 &msm_device_smd,
136 &msm_device_otg,
137 &msm_device_hsusb,
138 &msm_device_hsusb_host,
139};
140
141static struct msm_mmc_gpio sdc1_gpio_cfg[] = {
142 {51, "sdc1_dat_3"},
143 {52, "sdc1_dat_2"},
144 {53, "sdc1_dat_1"},
145 {54, "sdc1_dat_0"},
146 {55, "sdc1_cmd"},
147 {56, "sdc1_clk"}
148};
149
150static struct vreg *vreg_mmc;
151static unsigned long vreg_sts;
152
153static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd)
154{
155 int rc = 0;
156 struct platform_device *pdev;
157
158 pdev = container_of(dv, struct platform_device, dev);
159
160 if (vdd == 0) {
161 if (!vreg_sts)
162 return 0;
163
164 clear_bit(pdev->id, &vreg_sts);
165
166 if (!vreg_sts) {
167 rc = vreg_disable(vreg_mmc);
168 if (rc)
169 pr_err("vreg_mmc disable failed for slot "
170 "%d: %d\n", pdev->id, rc);
171 }
172 return 0;
173 }
174
175 if (!vreg_sts) {
176 rc = vreg_set_level(vreg_mmc, 2900);
177 if (rc)
178 pr_err("vreg_mmc set level failed for slot %d: %d\n",
179 pdev->id, rc);
180 rc = vreg_enable(vreg_mmc);
181 if (rc)
182 pr_err("vreg_mmc enable failed for slot %d: %d\n",
183 pdev->id, rc);
184 }
185 set_bit(pdev->id, &vreg_sts);
186 return 0;
187}
188
189static struct msm_mmc_gpio_data sdc1_gpio = {
190 .gpio = sdc1_gpio_cfg,
191 .size = ARRAY_SIZE(sdc1_gpio_cfg),
192};
193
194static struct msm_mmc_platform_data qsd8x50_sdc1_data = {
195 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
196 .translate_vdd = msm_sdcc_setup_power,
197 .gpio_data = &sdc1_gpio,
198};
199
200static void __init qsd8x50_init_mmc(void)
201{
202 vreg_mmc = vreg_get(NULL, "gp5");
203
204 if (IS_ERR(vreg_mmc)) {
205 pr_err("vreg get for vreg_mmc failed (%ld)\n",
206 PTR_ERR(vreg_mmc));
207 return;
208 }
209
210 msm_add_sdcc(1, &qsd8x50_sdc1_data, 0, 0);
211}
212
213static void __init qsd8x50_map_io(void)
214{
215 msm_map_qsd8x50_io();
216}
217
218static void __init qsd8x50_init_irq(void)
219{
220 msm_init_irq();
221 msm_init_sirc();
222}
223
224static void __init qsd8x50_init(void)
225{
226 msm_device_otg.dev.platform_data = &msm_otg_pdata;
227 msm_device_hsusb.dev.parent = &msm_device_otg.dev;
228 msm_device_hsusb_host.dev.parent = &msm_device_otg.dev;
229 platform_add_devices(devices, ARRAY_SIZE(devices));
230 qsd8x50_init_mmc();
231}
232
233static void __init qsd8x50_init_late(void)
234{
235 smd_debugfs_init();
236}
237
238MACHINE_START(QSD8X50_SURF, "QCT QSD8X50 SURF")
239 .atag_offset = 0x100,
240 .map_io = qsd8x50_map_io,
241 .init_irq = qsd8x50_init_irq,
242 .init_machine = qsd8x50_init,
243 .init_late = qsd8x50_init_late,
244 .init_time = qsd8x50_timer_init,
245MACHINE_END
246
247MACHINE_START(QSD8X50A_ST1_5, "QCT QSD8X50A ST1.5")
248 .atag_offset = 0x100,
249 .map_io = qsd8x50_map_io,
250 .init_irq = qsd8x50_init_irq,
251 .init_machine = qsd8x50_init,
252 .init_late = qsd8x50_init_late,
253 .init_time = qsd8x50_timer_init,
254MACHINE_END