blob: e58cee7572f712d73de5e350b7dd36c1d255ed5a [file] [log] [blame]
Gilad Avidov28e18eb2012-11-21 18:13:25 -07001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Syed Rameez Mustafa9d16c4f2012-09-10 14:16:55 -07002 *
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
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -080020#define KS8851_IRQ_GPIO 75
21
22#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
23static struct gpiomux_setting gpio_eth_config = {
24 .pull = GPIOMUX_PULL_UP,
25 .drv = GPIOMUX_DRV_2MA,
26 .func = GPIOMUX_FUNC_GPIO,
27};
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -080028
29static struct msm_gpiomux_config msm_eth_configs[] = {
30 {
31 .gpio = KS8851_IRQ_GPIO,
32 .settings = {
33 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
34 }
35 },
36};
Gilad Avidov28e18eb2012-11-21 18:13:25 -070037#endif
38
39static struct gpiomux_setting gpio_spi_config = {
40 .func = GPIOMUX_FUNC_1,
41 .drv = GPIOMUX_DRV_8MA,
42 .pull = GPIOMUX_PULL_NONE,
43};
44
45static struct gpiomux_setting gpio_i2c_config = {
46 .func = GPIOMUX_FUNC_3,
47 .drv = GPIOMUX_DRV_2MA,
48 .pull = GPIOMUX_PULL_NONE,
49};
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -080050
51static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
52 {
53 .gpio = 0, /* BLSP1 QUP2 SPI_DATA_MOSI */
54 .settings = {
55 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
56 },
57 },
58 {
59 .gpio = 1, /* BLSP1 QUP2 SPI_DATA_MISO */
60 .settings = {
61 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
62 },
63 },
64 {
65 .gpio = 2, /* BLSP1 QUP2 SPI_CS_N */
66 .settings = {
67 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
68 },
69 },
70 {
71 .gpio = 3, /* BLSP1 QUP2 SPI_CLK */
72 .settings = {
73 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
74 },
75 },
Gilad Avidov28e18eb2012-11-21 18:13:25 -070076 {
77 .gpio = 14, /* BLSP-1 QUP-4 I2C_SDA */
78 .settings = {
79 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
80 },
81 },
82 {
83 .gpio = 15, /* BLSP-1 QUP-4 I2C_SCL */
84 .settings = {
85 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
86 },
87 },
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -080088};
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -080089
Syed Rameez Mustafa9d16c4f2012-09-10 14:16:55 -070090void __init msm8226_init_gpiomux(void)
91{
92 int rc;
93
Rohit Vaswani341c2032012-11-08 18:49:29 -080094 rc = msm_gpiomux_init_dt();
Syed Rameez Mustafa9d16c4f2012-09-10 14:16:55 -070095 if (rc) {
Rohit Vaswani341c2032012-11-08 18:49:29 -080096 pr_err("%s failed %d\n", __func__, rc);
Syed Rameez Mustafa9d16c4f2012-09-10 14:16:55 -070097 return;
98 }
Gilad Avidov28e18eb2012-11-21 18:13:25 -070099
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -0800100#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
101 msm_gpiomux_install(msm_eth_configs, ARRAY_SIZE(msm_eth_configs));
Syed Rameez Mustafa01d15eb2012-12-20 15:30:17 -0800102#endif
Gilad Avidov28e18eb2012-11-21 18:13:25 -0700103
104 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Syed Rameez Mustafa9d16c4f2012-09-10 14:16:55 -0700105}