blob: 95bcf65228d04efcaefac984bae6ec16ad11a59d [file] [log] [blame]
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -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>
Harini Jayaramaneba52672011-09-08 15:13:00 -060015#include <linux/i2c.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070016#include <asm/mach-types.h>
17#include <asm/mach/arch.h>
18#include <mach/board.h>
19#include <mach/msm_iomap.h>
20#include <mach/gpio.h>
21#include <mach/gpiomux.h>
22#include "timer.h"
23#include "devices.h"
24
Rohit Vaswani09666872011-08-23 17:41:54 -070025static struct platform_device *common_devices[] = {
26 &msm9615_device_uart_gsbi4,
Harini Jayaramaneba52672011-09-08 15:13:00 -060027 &msm9615_device_qup_i2c_gsbi5,
Rohit Vaswani09666872011-08-23 17:41:54 -070028};
29
30static struct gpiomux_setting gsbi4 = {
31 .func = GPIOMUX_FUNC_1,
32 .drv = GPIOMUX_DRV_8MA,
33 .pull = GPIOMUX_PULL_NONE,
34};
35
Harini Jayaramaneba52672011-09-08 15:13:00 -060036static struct gpiomux_setting gsbi5 = {
37 .func = GPIOMUX_FUNC_1,
38 .drv = GPIOMUX_DRV_8MA,
39 .pull = GPIOMUX_PULL_NONE,
40};
41
Rohit Vaswani09666872011-08-23 17:41:54 -070042struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = {
43 {
44 .gpio = 12, /* GSBI4 UART */
45 .settings = {
46 [GPIOMUX_SUSPENDED] = &gsbi4,
47 },
48 },
49 {
50 .gpio = 13, /* GSBI4 UART */
51 .settings = {
52 [GPIOMUX_SUSPENDED] = &gsbi4,
53 },
54 },
55 {
56 .gpio = 14, /* GSBI4 UART */
57 .settings = {
58 [GPIOMUX_SUSPENDED] = &gsbi4,
59 },
60 },
61 {
62 .gpio = 15, /* GSBI4 UART */
63 .settings = {
64 [GPIOMUX_SUSPENDED] = &gsbi4,
65 },
66 },
Harini Jayaramaneba52672011-09-08 15:13:00 -060067 {
68 .gpio = 16, /* GSBI5 I2C QUP SCL */
69 .settings = {
70 [GPIOMUX_SUSPENDED] = &gsbi5,
71 },
72 },
73 {
74 .gpio = 17, /* GSBI5 I2C QUP SDA */
75 .settings = {
76 [GPIOMUX_SUSPENDED] = &gsbi5,
77 },
78 },
Rohit Vaswani09666872011-08-23 17:41:54 -070079};
80
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070081static int __init gpiomux_init(void)
82{
83 int rc;
84
85 rc = msm_gpiomux_init(NR_GPIO_IRQS);
86 if (rc) {
87 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
88 return rc;
89 }
Rohit Vaswani09666872011-08-23 17:41:54 -070090 msm_gpiomux_install(msm9615_gsbi_configs,
91 ARRAY_SIZE(msm9615_gsbi_configs));
92
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070093 return 0;
94}
95
Harini Jayaramaneba52672011-09-08 15:13:00 -060096static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = {
97 .clk_freq = 100000,
98 .src_clk_rate = 24000000,
99};
100
101static void __init msm9615_i2c_init(void)
102{
103 msm9615_device_qup_i2c_gsbi5.dev.platform_data =
104 &msm9615_i2c_qup_gsbi5_pdata;
105}
106
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700107static void __init msm9615_common_init(void)
108{
109 msm9615_device_init();
110 gpiomux_init();
Harini Jayaramaneba52672011-09-08 15:13:00 -0600111 msm9615_i2c_init();
Rohit Vaswani09666872011-08-23 17:41:54 -0700112 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700113}
114
115static void __init msm9615_cdp_init(void)
116{
117 msm9615_common_init();
118}
119
120static void __init msm9615_mtp_init(void)
121{
122 msm9615_common_init();
123}
124
125MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP")
126 .map_io = msm9615_map_io,
127 .init_irq = msm9615_init_irq,
128 .timer = &msm_timer,
129 .init_machine = msm9615_cdp_init,
130MACHINE_END
131
132MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP")
133 .map_io = msm9615_map_io,
134 .init_irq = msm9615_init_irq,
135 .timer = &msm_timer,
136 .init_machine = msm9615_mtp_init,
137MACHINE_END