blob: caba698438cf7ee7813af81fd10568703634b5a6 [file] [log] [blame]
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -07001/* Copyright (c) 2012, 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
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
Sathish Ambleye3154b42012-04-09 10:59:09 -070020#define KS8851_IRQ_GPIO 90
21
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -070022static struct gpiomux_setting gpio_uart_config = {
23 .func = GPIOMUX_FUNC_2,
24 .drv = GPIOMUX_DRV_16MA,
25 .pull = GPIOMUX_PULL_NONE,
26 .dir = GPIOMUX_OUT_HIGH,
27};
28
Sathish Ambleye3154b42012-04-09 10:59:09 -070029#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
30static struct gpiomux_setting gpio_eth_config = {
31 .pull = GPIOMUX_PULL_NONE,
32 .drv = GPIOMUX_DRV_8MA,
33 .func = GPIOMUX_FUNC_GPIO,
34};
35
36static struct gpiomux_setting gpio_spi_cs_config = {
37 .func = GPIOMUX_FUNC_4,
38 .drv = GPIOMUX_DRV_12MA,
39 .pull = GPIOMUX_PULL_NONE,
40};
41
42static struct gpiomux_setting gpio_spi_config = {
43 .func = GPIOMUX_FUNC_1,
44 .drv = GPIOMUX_DRV_12MA,
45 .pull = GPIOMUX_PULL_NONE,
46};
47
48static struct msm_gpiomux_config msm_eth_configs[] = {
49 {
50 .gpio = KS8851_IRQ_GPIO,
51 .settings = {
52 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
53 }
54 },
55};
56#endif
Jin Honga04caaa2012-05-23 10:28:27 -070057static struct gpiomux_setting gpio_i2c_config = {
58 .func = GPIOMUX_FUNC_3,
59 .drv = GPIOMUX_DRV_8MA,
60 .pull = GPIOMUX_PULL_NONE,
61};
62
Sathish Ambleye3154b42012-04-09 10:59:09 -070063
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -070064static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
Sathish Ambleye3154b42012-04-09 10:59:09 -070065#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
66 {
67 .gpio = 0, /* BLSP1 QUP SPI_DATA_MOSI */
68 .settings = {
69 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
70 },
71 },
72 {
73 .gpio = 1, /* BLSP1 QUP SPI_DATA_MISO */
74 .settings = {
75 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
76 },
77 },
78 {
79 .gpio = 3, /* BLSP1 QUP SPI_CLK */
80 .settings = {
81 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
82 },
83 },
84 {
85 .gpio = 9, /* BLSP1 QUP SPI_CS_N */
86 .settings = {
87 [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config,
88 },
89 },
90#endif
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -070091 {
Jin Honga04caaa2012-05-23 10:28:27 -070092 .gpio = 83, /* BLSP11 QUP I2C_DAT */
93 .settings = {
94 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
95 },
96 },
97 {
98 .gpio = 84, /* BLSP11 QUP I2C_CLK */
99 .settings = {
100 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
101 },
102 },
103 {
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700104 .gpio = 45, /* BLSP8 UART TX */
105 .settings = {
106 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
107 },
108 },
109 {
110 .gpio = 46, /* BLSP8 UART RX */
111 .settings = {
112 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
113 },
114 },
115};
116
117void __init msm_copper_init_gpiomux(void)
118{
119 int rc;
120
121 rc = msm_gpiomux_init(NR_GPIO_IRQS);
122 if (rc) {
123 pr_err(KERN_ERR "msmcopper_init_gpiomux failed %d\n", rc);
124 return;
125 }
126
Sathish Ambleye3154b42012-04-09 10:59:09 -0700127#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
128 msm_gpiomux_install(msm_eth_configs, ARRAY_SIZE(msm_eth_configs));
129#endif
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700130 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
131}