blob: be9698a42b12ed1b68cb1564075acf25af14ebde [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 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 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Kenneth Heitke748593a2011-07-15 15:45:11 -060017#include <linux/i2c.h>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060018#include <linux/slimbus/slimbus.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060019#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070020#include <linux/spi/spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070021#include <asm/mach-types.h>
22#include <asm/mach/arch.h>
23#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053024#include <asm/mach/mmc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025
26#include <mach/board.h>
27#include <mach/msm_iomap.h>
28#include <linux/usb/msm_hsusb.h>
29#include <linux/usb/android.h>
30#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060031#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070032#include "timer.h"
33#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070034#include <mach/gpio.h>
35#include <mach/gpiomux.h>
36
Jay Chokshiea67c622011-07-29 17:12:26 -070037#include "board-apq8064.h"
38
Sahitya Tummalab4d883f2011-08-23 10:44:51 +053039/* APQ8064 have 4 SDCC controllers */
40enum sdcc_controllers {
41 SDCC1,
42 SDCC2,
43 SDCC3,
44 SDCC4,
45 MAX_SDCC_CONTROLLER
46};
47
48/* All SDCC controllers requires VDD/VCC voltage */
49static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
50 /* SDCC1 : eMMC card connected */
51 [SDCC1] = {
52 .name = "sdc_vdd",
53 .set_voltage_sup = 1,
54 .high_vol_level = 2950000,
55 .low_vol_level = 2950000,
56 .always_on = 1,
57 .lpm_sup = 1,
58 .lpm_uA = 9000,
59 .hpm_uA = 200000, /* 200mA */
60 },
61 /* SDCC3 : External card slot connected */
62 [SDCC3] = {
63 .name = "sdc_vdd",
64 .set_voltage_sup = 1,
65 .high_vol_level = 2950000,
66 .low_vol_level = 2950000,
67 .hpm_uA = 600000, /* 600mA */
68 }
69};
70
71/* Only slots having eMMC card will require VCCQ voltage */
72static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
73 /* SDCC1 : eMMC card connected */
74 [SDCC1] = {
75 .name = "sdc_vccq",
76 .set_voltage_sup = 1,
77 .always_on = 1,
78 .high_vol_level = 1800000,
79 .low_vol_level = 1800000,
80 .hpm_uA = 200000, /* 200mA */
81 }
82};
83
84/* All SDCC controllers may require voting for VDD PAD voltage */
85static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
86 /* SDCC3 : External card slot connected */
87 [SDCC3] = {
88 .name = "sdc_vddp",
89 .set_voltage_sup = 1,
90 .high_vol_level = 2950000,
91 .low_vol_level = 1850000,
92 .always_on = 1,
93 .lpm_sup = 1,
94 /* Max. Active current required is 16 mA */
95 .hpm_uA = 16000,
96 /*
97 * Sleep current required is ~300 uA. But min. vote can be
98 * in terms of mA (min. 1 mA). So let's vote for 2 mA
99 * during sleep.
100 */
101 .lpm_uA = 2000,
102 }
103};
104
105static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
106 /* SDCC1 : eMMC card connected */
107 [SDCC1] = {
108 .vdd_data = &mmc_vdd_reg_data[SDCC1],
109 .vccq_data = &mmc_vccq_reg_data[SDCC1],
110 },
111 /* SDCC3 : External card slot connected */
112 [SDCC3] = {
113 .vdd_data = &mmc_vdd_reg_data[SDCC3],
114 .vddp_data = &mmc_vddp_reg_data[SDCC3],
115 }
116};
117
118/* SDC1 pad data */
119static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
120 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
121 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
122 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
123};
124
125static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
126 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
127 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
128 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
129};
130
131static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
132 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
133 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
134};
135
136static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
137 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
138 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
139};
140
141/* SDC3 pad data */
142static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
143 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
144 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
145 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
146};
147
148static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
149 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
150 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
151 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
152};
153
154static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
155 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
156 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
157};
158
159static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
160 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
161 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
162};
163
164static struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
165 [SDCC1] = {
166 .on = sdc1_pad_pull_on_cfg,
167 .off = sdc1_pad_pull_off_cfg,
168 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
169 },
170 [SDCC3] = {
171 .on = sdc3_pad_pull_on_cfg,
172 .off = sdc3_pad_pull_off_cfg,
173 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
174 },
175};
176
177static struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
178 [SDCC1] = {
179 .on = sdc1_pad_drv_on_cfg,
180 .off = sdc1_pad_drv_off_cfg,
181 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
182 },
183 [SDCC3] = {
184 .on = sdc3_pad_drv_on_cfg,
185 .off = sdc3_pad_drv_off_cfg,
186 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
187 },
188};
189
190static struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
191 [SDCC1] = {
192 .pull = &mmc_pad_pull_data[SDCC1],
193 .drv = &mmc_pad_drv_data[SDCC1]
194 },
195 [SDCC3] = {
196 .pull = &mmc_pad_pull_data[SDCC3],
197 .drv = &mmc_pad_drv_data[SDCC3]
198 },
199};
200
201static struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
202 [SDCC1] = {
203 .pad_data = &mmc_pad_data[SDCC1],
204 },
205 [SDCC3] = {
206 .pad_data = &mmc_pad_data[SDCC3],
207 },
208};
209
Sahitya Tummala3586ed92011-08-03 09:13:23 +0530210#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
211static unsigned int sdc1_sup_clk_rates[] = {
212 400000, 24000000, 48000000, 96000000
213};
214
215static struct mmc_platform_data sdc1_data = {
216 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
217 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
218 .sup_clk_table = sdc1_sup_clk_rates,
219 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Sahitya Tummalab4d883f2011-08-23 10:44:51 +0530220 .pin_data = &mmc_slot_pin_data[SDCC1],
221 .vreg_data = &mmc_slot_vreg_data[SDCC1],
222 .sdcc_v4_sup = true,
Sahitya Tummala3586ed92011-08-03 09:13:23 +0530223};
224static struct mmc_platform_data *apq8064_sdc1_pdata = &sdc1_data;
225#else
226static struct mmc_platform_data *apq8064_sdc1_pdata;
227#endif
228
229#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
230static unsigned int sdc3_sup_clk_rates[] = {
231 400000, 24000000, 48000000, 96000000
232};
233
234static struct mmc_platform_data sdc3_data = {
235 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
236 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
237 .sup_clk_table = sdc3_sup_clk_rates,
238 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Sahitya Tummalab4d883f2011-08-23 10:44:51 +0530239 .pin_data = &mmc_slot_pin_data[SDCC3],
240 .vreg_data = &mmc_slot_vreg_data[SDCC3],
241 .sdcc_v4_sup = true,
Sahitya Tummala3586ed92011-08-03 09:13:23 +0530242};
243static struct mmc_platform_data *apq8064_sdc3_pdata = &sdc3_data;
244#else
245static struct mmc_platform_data *apq8064_sdc3_pdata;
246#endif
247
248static void __init apq8064_init_mmc(void)
249{
Amol Jadi7d4ce032011-09-09 17:07:18 -0700250 if ((machine_is_apq8064_rumi3()) || machine_is_apq8064_sim()) {
Sahitya Tummalab07e1ae2011-09-02 11:58:42 +0530251 if (apq8064_sdc1_pdata) {
Sahitya Tummalad9df3272011-08-19 16:50:46 +0530252 apq8064_sdc1_pdata->disable_bam = true;
Sahitya Tummalab07e1ae2011-09-02 11:58:42 +0530253 apq8064_sdc1_pdata->disable_runtime_pm = true;
Sahitya Tummala85fa0702011-09-15 09:39:37 +0530254 apq8064_sdc1_pdata->disable_cmd23 = true;
Sahitya Tummalab07e1ae2011-09-02 11:58:42 +0530255 }
256 if (apq8064_sdc3_pdata) {
Sahitya Tummalad9df3272011-08-19 16:50:46 +0530257 apq8064_sdc3_pdata->disable_bam = true;
Sahitya Tummalab07e1ae2011-09-02 11:58:42 +0530258 apq8064_sdc3_pdata->disable_runtime_pm = true;
Sahitya Tummala85fa0702011-09-15 09:39:37 +0530259 apq8064_sdc3_pdata->disable_cmd23 = true;
Sahitya Tummalab07e1ae2011-09-02 11:58:42 +0530260 }
Sahitya Tummalad9df3272011-08-19 16:50:46 +0530261 }
Sahitya Tummala3586ed92011-08-03 09:13:23 +0530262 apq8064_add_sdcc(1, apq8064_sdc1_pdata);
263 apq8064_add_sdcc(3, apq8064_sdc3_pdata);
264}
265
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700266static void __init apq8064_map_io(void)
267{
268 msm_map_apq8064_io();
269}
270
271static void __init apq8064_init_irq(void)
272{
273 unsigned int i;
274 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
275 (void *)MSM_QGIC_CPU_BASE);
276
277 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
278 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
279
280 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
281 mb();
282
283 /*
284 * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
285 * as they are configured as level, which does not play nice with
286 * handle_percpu_irq.
287 */
288 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
289 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
290 irq_set_handler(i, handle_percpu_irq);
291 }
292}
293
294static struct platform_device *common_devices[] __initdata = {
Kenneth Heitke748593a2011-07-15 15:45:11 -0600295 &apq8064_device_qup_i2c_gsbi4,
Harini Jayaramanc4c58692011-07-19 14:50:10 -0600296 &apq8064_device_qup_spi_gsbi5,
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -0600297 &apq8064_slim_ctrl,
Jay Chokshi9c25f072011-09-23 18:19:15 -0700298 &apq8064_device_ssbi_pmic1,
299 &apq8064_device_ssbi_pmic2,
Harini Jayaramanc4c58692011-07-19 14:50:10 -0600300};
301
Joel King4e7ad222011-08-17 15:47:38 -0700302static struct platform_device *sim_devices[] __initdata = {
303 &apq8064_device_dmov,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -0700304 &apq8064_device_uart_gsbi3,
Yan He06913ce2011-08-26 16:33:46 -0700305 &msm_device_sps_apq8064,
Stepan Moskovchenko2701a442011-08-19 13:47:22 -0700306};
307
308static struct platform_device *rumi3_devices[] __initdata = {
309 &apq8064_device_uart_gsbi1,
Joel King4e7ad222011-08-17 15:47:38 -0700310};
311
Harini Jayaramanc4c58692011-07-19 14:50:10 -0600312static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
313 .max_clock_speed = 26000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700314};
315
316static struct msm_otg_platform_data msm_otg_pdata = {
317 .mode = USB_PERIPHERAL,
318 .otg_control = OTG_PHY_CONTROL,
319 .phy_type = SNPS_28NM_INTEGRATED_PHY,
320 .pclk_src_name = "dfab_usb_hs_clk",
321};
322
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -0700323#define KS8851_IRQ_GPIO 43
324
325static struct spi_board_info spi_board_info[] __initdata = {
326 {
327 .modalias = "ks8851",
328 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
329 .max_speed_hz = 19200000,
330 .bus_num = 0,
331 .chip_select = 2,
332 .mode = SPI_MODE_0,
333 },
334};
335
336#ifdef CONFIG_KS8851
337static struct gpiomux_setting gpio_eth_config = {
338 .pull = GPIOMUX_PULL_NONE,
339 .drv = GPIOMUX_DRV_8MA,
340 .func = GPIOMUX_FUNC_GPIO,
341};
342
343/* The SPI configurations apply to GSBI 5*/
344static struct gpiomux_setting gpio_spi_config = {
345 .func = GPIOMUX_FUNC_2,
346 .drv = GPIOMUX_DRV_8MA,
347 .pull = GPIOMUX_PULL_NONE,
348};
349
350/* The SPI configurations apply to GSBI 5 chip select 2*/
351static struct gpiomux_setting gpio_spi_cs2_config = {
352 .func = GPIOMUX_FUNC_3,
353 .drv = GPIOMUX_DRV_8MA,
354 .pull = GPIOMUX_PULL_NONE,
355};
356#endif
357
358struct msm_gpiomux_config apq8064_ethernet_configs[NR_GPIO_IRQS] = {
359#ifdef CONFIG_KS8851
360 {
361 .gpio = KS8851_IRQ_GPIO,
362 .settings = {
363 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
364 [GPIOMUX_ACTIVE] = &gpio_eth_config,
365 }
366 },
367#endif
368};
369
370static struct msm_gpiomux_config apq8064_gsbi_configs[] __initdata = {
371#ifdef CONFIG_KS8851
372 {
373 .gpio = 51, /* GSBI5 QUP SPI_DATA_MOSI */
374 .settings = {
375 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
376 },
377 },
378 {
379 .gpio = 52, /* GSBI5 QUP SPI_DATA_MISO */
380 .settings = {
381 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
382 },
383 },
384 {
385 .gpio = 31, /* GSBI5 QUP SPI_CS2_N */
386 .settings = {
387 [GPIOMUX_SUSPENDED] = &gpio_spi_cs2_config,
388 },
389 },
390 {
391 .gpio = 54, /* GSBI5 QUP SPI_CLK */
392 .settings = {
393 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
394 },
395 },
396#endif
397};
398
Jay Chokshibc3d98d2011-08-10 17:14:23 -0700399static struct pm8xxx_mpp_platform_data
400apq8064_pm8921_mpp_pdata __devinitdata = {
401 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
402};
403
404static struct pm8xxx_gpio_platform_data
405apq8064_pm8921_gpio_pdata __devinitdata = {
406 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
407};
408
409static struct pm8xxx_irq_platform_data
410apq8064_pm8921_irq_pdata __devinitdata = {
411 .irq_base = PM8921_IRQ_BASE,
Jay Chokshi44873f72011-08-30 17:24:26 -0700412 .devirq = PM8921_USR_IRQ_N,
413 .irq_trigger_flag = IRQF_TRIGGER_HIGH,
Jay Chokshi9e926e72011-09-23 19:19:58 -0700414 .dev_id = 0,
Jay Chokshibc3d98d2011-08-10 17:14:23 -0700415};
416
417static struct pm8921_platform_data
418apq8064_pm8921_platform_data __devinitdata = {
Jay Chokshiea67c622011-07-29 17:12:26 -0700419 .regulator_pdatas = msm8064_pm8921_regulator_pdata,
Jay Chokshibc3d98d2011-08-10 17:14:23 -0700420 .irq_pdata = &apq8064_pm8921_irq_pdata,
421 .gpio_pdata = &apq8064_pm8921_gpio_pdata,
422 .mpp_pdata = &apq8064_pm8921_mpp_pdata,
Jay Chokshiea67c622011-07-29 17:12:26 -0700423};
424
Jay Chokshi44873f72011-08-30 17:24:26 -0700425static struct pm8xxx_irq_platform_data
426apq8064_pm8821_irq_pdata __devinitdata = {
427 .irq_base = PM8821_IRQ_BASE,
428 .devirq = PM8821_USR_IRQ_N,
429 .irq_trigger_flag = IRQF_TRIGGER_HIGH,
Jay Chokshi9e926e72011-09-23 19:19:58 -0700430 .dev_id = 1,
Jay Chokshi44873f72011-08-30 17:24:26 -0700431};
432
433static struct pm8xxx_mpp_platform_data
434apq8064_pm8821_mpp_pdata __devinitdata = {
435 .mpp_base = PM8821_MPP_PM_TO_SYS(1),
436};
437
438static struct pm8821_platform_data
439apq8064_pm8821_platform_data __devinitdata = {
440 .irq_pdata = &apq8064_pm8821_irq_pdata,
441 .mpp_pdata = &apq8064_pm8821_mpp_pdata,
442};
443
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700444static struct msm_ssbi_platform_data apq8064_ssbi_pm8921_pdata __devinitdata = {
445 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
446 .slave = {
Jay Chokshiea67c622011-07-29 17:12:26 -0700447 .name = "pm8921-core",
Jay Chokshibc3d98d2011-08-10 17:14:23 -0700448 .platform_data = &apq8064_pm8921_platform_data,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700449 },
450};
451
452static struct msm_ssbi_platform_data apq8064_ssbi_pm8821_pdata __devinitdata = {
453 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
454 .slave = {
Jay Chokshi44873f72011-08-30 17:24:26 -0700455 .name = "pm8821-core",
456 .platform_data = &apq8064_pm8821_platform_data,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700457 },
458};
459
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -0600460static struct slim_boardinfo apq8064_slim_devices[] = {
461 /* Add slimbus slaves as needed */
462};
463
Kenneth Heitke748593a2011-07-15 15:45:11 -0600464static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
465 .clk_freq = 100000,
466 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -0600467};
468
469static void __init apq8064_i2c_init(void)
470{
471 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
472 &apq8064_i2c_qup_gsbi4_pdata;
473}
474
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -0700475static int __init gpiomux_init(void)
476{
477 int rc;
478
479 rc = msm_gpiomux_init(NR_GPIO_IRQS);
480 if (rc) {
481 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
482 return rc;
483 }
484 msm_gpiomux_install(apq8064_ethernet_configs,
485 ARRAY_SIZE(apq8064_ethernet_configs));
486
487 msm_gpiomux_install(apq8064_gsbi_configs,
488 ARRAY_SIZE(apq8064_gsbi_configs));
489 return 0;
490}
491
492#ifdef CONFIG_KS8851
493static int ethernet_init(void)
494{
495 int ret;
496 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
497 if (ret) {
498 pr_err("ks8851 gpio_request failed: %d\n", ret);
499 goto fail;
500 }
501
502 return 0;
503fail:
504 return ret;
505}
506#else
507static int ethernet_init(void)
508{
509 return 0;
510}
511#endif
512
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700513static void __init apq8064_common_init(void)
514{
515 if (socinfo_init() < 0)
516 pr_err("socinfo_init() failed!\n");
Stephen Boydbb600ae2011-08-02 20:11:40 -0700517 msm_clock_init(&apq8064_dummy_clock_init_data);
Joel King4ebccc62011-07-22 09:43:22 -0700518 gpiomux_init();
Kenneth Heitke748593a2011-07-15 15:45:11 -0600519 apq8064_i2c_init();
Kenneth Heitke36920d32011-07-20 16:44:30 -0600520
Harini Jayaramanc4c58692011-07-19 14:50:10 -0600521 apq8064_device_qup_spi_gsbi5.dev.platform_data =
522 &apq8064_qup_spi_gsbi5_pdata;
Kenneth Heitke36920d32011-07-20 16:44:30 -0600523 apq8064_device_ssbi_pmic1.dev.platform_data =
Jay Chokshiea67c622011-07-29 17:12:26 -0700524 &apq8064_ssbi_pm8921_pdata;
Kenneth Heitke36920d32011-07-20 16:44:30 -0600525 apq8064_device_ssbi_pmic2.dev.platform_data =
526 &apq8064_ssbi_pm8821_pdata;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -0700527 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
528 apq8064_device_gadget_peripheral.dev.parent = &apq8064_device_otg.dev;
Jay Chokshibc3d98d2011-08-10 17:14:23 -0700529 apq8064_pm8921_platform_data.num_regulators =
Jay Chokshiea67c622011-07-29 17:12:26 -0700530 msm8064_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700531 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Sahitya Tummala3586ed92011-08-03 09:13:23 +0530532 apq8064_init_mmc();
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -0600533 slim_register_board_info(apq8064_slim_devices,
534 ARRAY_SIZE(apq8064_slim_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700535}
536
537static void __init apq8064_sim_init(void)
538{
539 apq8064_common_init();
Joel King4e7ad222011-08-17 15:47:38 -0700540 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
541}
542
543static void __init apq8064_rumi3_init(void)
544{
Jay Chokshi9c25f072011-09-23 18:19:15 -0700545 apq8064_pm8921_irq_pdata.devirq = 0;
546 apq8064_pm8821_irq_pdata.devirq = 0;
Joel King4e7ad222011-08-17 15:47:38 -0700547 apq8064_common_init();
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -0700548 ethernet_init();
Stepan Moskovchenko2701a442011-08-19 13:47:22 -0700549 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -0700550 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700551}
552
553MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
554 .map_io = apq8064_map_io,
555 .init_irq = apq8064_init_irq,
556 .timer = &msm_timer,
557 .init_machine = apq8064_sim_init,
558MACHINE_END
559
Joel King4e7ad222011-08-17 15:47:38 -0700560MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3")
561 .map_io = apq8064_map_io,
562 .init_irq = apq8064_init_irq,
563 .timer = &msm_timer,
564 .init_machine = apq8064_rumi3_init,
565MACHINE_END
566