blob: 0fdb298cb964087c38c27640e32c9115199eedc4 [file] [log] [blame]
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Hanumant Singh55a1bb02012-11-06 10:01:15 -08002 *
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
14#include <linux/init.h>
15#include <linux/ioport.h>
16#include <mach/board.h>
17#include <mach/gpio.h>
18#include <mach/gpiomux.h>
19
Gilad Avidovf84f2792013-01-31 13:26:39 -070020static struct gpiomux_setting gpio_i2c_config = {
21 .func = GPIOMUX_FUNC_3,
22 .drv = GPIOMUX_DRV_2MA,
23 .pull = GPIOMUX_PULL_NONE,
24};
25
Gilad Avidovf58f1832013-01-09 17:31:28 -070026static struct gpiomux_setting gpio_spi_config = {
27 .func = GPIOMUX_FUNC_1,
28 .drv = GPIOMUX_DRV_6MA,
29 .pull = GPIOMUX_PULL_NONE,
30};
31
32static struct gpiomux_setting gpio_spi_cs_config = {
33 .func = GPIOMUX_FUNC_1,
34 .drv = GPIOMUX_DRV_6MA,
35 .pull = GPIOMUX_PULL_DOWN,
36};
37
Sameer Thalappil1fafd672013-04-03 12:31:04 -070038static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
39 .func = GPIOMUX_FUNC_GPIO,
40 .drv = GPIOMUX_DRV_2MA,
41 .pull = GPIOMUX_PULL_UP,
42};
43
44static struct gpiomux_setting wcnss_5wire_active_cfg = {
45 .func = GPIOMUX_FUNC_1,
46 .drv = GPIOMUX_DRV_6MA,
47 .pull = GPIOMUX_PULL_DOWN,
48};
49
Gilad Avidovf84f2792013-01-31 13:26:39 -070050static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
51 {
Gilad Avidovf58f1832013-01-09 17:31:28 -070052 .gpio = 10, /* BLSP1 QUP3 I2C_SDA */
Gilad Avidovf84f2792013-01-31 13:26:39 -070053 .settings = {
54 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
55 },
56 },
57 {
Gilad Avidovf58f1832013-01-09 17:31:28 -070058 .gpio = 11, /* BLSP1 QUP3 I2C_SCL */
Gilad Avidovf84f2792013-01-31 13:26:39 -070059 .settings = {
60 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
61 },
62 },
Gilad Avidovf58f1832013-01-09 17:31:28 -070063 {
64 .gpio = 0, /* BLSP1 QUP1 SPI_DATA_MOSI */
65 .settings = {
66 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
67 },
68 },
69 {
70 .gpio = 1, /* BLSP1 QUP1 SPI_DATA_MISO */
71 .settings = {
72 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
73 },
74 },
75 {
76 .gpio = 3, /* BLSP1 QUP1 SPI_CLK */
77 .settings = {
78 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
79 },
80 },
81 {
82 .gpio = 2, /* BLSP1 QUP1 SPI_CS1 */
83 .settings = {
84 [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config,
85 },
86 },
Gilad Avidovf84f2792013-01-31 13:26:39 -070087};
88
Sameer Thalappil1fafd672013-04-03 12:31:04 -070089static struct msm_gpiomux_config wcnss_5wire_interface[] = {
90 {
91 .gpio = 23,
92 .settings = {
93 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
94 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
95 },
96 },
97 {
98 .gpio = 24,
99 .settings = {
100 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
101 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
102 },
103 },
104 {
105 .gpio = 25,
106 .settings = {
107 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
108 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
109 },
110 },
111 {
112 .gpio = 26,
113 .settings = {
114 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
115 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
116 },
117 },
118 {
119 .gpio = 27,
120 .settings = {
121 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
122 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
123 },
124 },
125};
126
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800127void __init msm8610_init_gpiomux(void)
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800128{
129 int rc;
130
Rohit Vaswani341c2032012-11-08 18:49:29 -0800131 rc = msm_gpiomux_init_dt();
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800132 if (rc) {
Rohit Vaswani341c2032012-11-08 18:49:29 -0800133 pr_err("%s failed %d\n", __func__, rc);
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800134 return;
135 }
Gilad Avidovf84f2792013-01-31 13:26:39 -0700136
137 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700138 msm_gpiomux_install(wcnss_5wire_interface,
139 ARRAY_SIZE(wcnss_5wire_interface));
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800140}