Jin Hong | 690e335 | 2012-05-02 09:25:05 -0700 | [diff] [blame] | 1 | /* 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 | |
| 20 | static struct gpiomux_setting gpio_uart_config = { |
Abhimanyu Kapur | 2f9483f | 2012-09-27 16:44:23 -0700 | [diff] [blame] | 21 | .func = GPIOMUX_FUNC_1, |
| 22 | .drv = GPIOMUX_DRV_8MA, |
Jin Hong | 690e335 | 2012-05-02 09:25:05 -0700 | [diff] [blame] | 23 | .pull = GPIOMUX_PULL_NONE, |
| 24 | .dir = GPIOMUX_OUT_HIGH, |
| 25 | }; |
| 26 | |
Rohit Vaswani | 0045df4 | 2012-06-29 16:21:48 -0700 | [diff] [blame] | 27 | static struct gpiomux_setting gpio_spi_cs_config = { |
Gilad Avidov | 09c78ec | 2012-10-18 09:34:35 -0600 | [diff] [blame^] | 28 | .func = GPIOMUX_FUNC_1, |
Rohit Vaswani | 0045df4 | 2012-06-29 16:21:48 -0700 | [diff] [blame] | 29 | .drv = GPIOMUX_DRV_12MA, |
| 30 | .pull = GPIOMUX_PULL_NONE, |
| 31 | }; |
| 32 | |
| 33 | static struct gpiomux_setting gpio_spi_config = { |
Gilad Avidov | 09c78ec | 2012-10-18 09:34:35 -0600 | [diff] [blame^] | 34 | .func = GPIOMUX_FUNC_1, |
Rohit Vaswani | 0045df4 | 2012-06-29 16:21:48 -0700 | [diff] [blame] | 35 | .drv = GPIOMUX_DRV_12MA, |
| 36 | .pull = GPIOMUX_PULL_NONE, |
| 37 | }; |
| 38 | |
David Collins | 50d4bcd | 2012-11-01 14:31:21 -0700 | [diff] [blame] | 39 | static struct gpiomux_setting gpio_i2c_config = { |
| 40 | .func = GPIOMUX_FUNC_3, |
| 41 | .drv = GPIOMUX_DRV_2MA, |
| 42 | .pull = GPIOMUX_PULL_NONE, |
| 43 | }; |
| 44 | |
Jin Hong | 690e335 | 2012-05-02 09:25:05 -0700 | [diff] [blame] | 45 | static struct msm_gpiomux_config msm_blsp_configs[] __initdata = { |
| 46 | { |
Gilad Avidov | 09c78ec | 2012-10-18 09:34:35 -0600 | [diff] [blame^] | 47 | .gpio = 4, /* BLSP1 QUP2 SPI_DATA_MOSI */ |
| 48 | .settings = { |
| 49 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 50 | }, |
| 51 | }, |
| 52 | { |
| 53 | .gpio = 5, /* BLSP1 QUP2 SPI_DATA_MISO */ |
| 54 | .settings = { |
| 55 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 56 | }, |
| 57 | }, |
| 58 | { |
| 59 | .gpio = 6, /* BLSP1 QUP2 SPI_CS_N */ |
| 60 | .settings = { |
| 61 | [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config, |
| 62 | }, |
| 63 | }, |
| 64 | { |
| 65 | .gpio = 7, /* BLSP1 QUP2 SPI_CLK */ |
| 66 | .settings = { |
| 67 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 68 | }, |
| 69 | }, |
| 70 | { |
Abhimanyu Kapur | 2f9483f | 2012-09-27 16:44:23 -0700 | [diff] [blame] | 71 | .gpio = 8, /* BLSP1 UART TX */ |
Jin Hong | 690e335 | 2012-05-02 09:25:05 -0700 | [diff] [blame] | 72 | .settings = { |
| 73 | [GPIOMUX_SUSPENDED] = &gpio_uart_config, |
| 74 | }, |
| 75 | }, |
| 76 | { |
Abhimanyu Kapur | 2f9483f | 2012-09-27 16:44:23 -0700 | [diff] [blame] | 77 | .gpio = 9, /* BLSP1 UART RX */ |
Jin Hong | 690e335 | 2012-05-02 09:25:05 -0700 | [diff] [blame] | 78 | .settings = { |
| 79 | [GPIOMUX_SUSPENDED] = &gpio_uart_config, |
| 80 | }, |
| 81 | }, |
Rohit Vaswani | 0045df4 | 2012-06-29 16:21:48 -0700 | [diff] [blame] | 82 | { |
David Collins | 50d4bcd | 2012-11-01 14:31:21 -0700 | [diff] [blame] | 83 | .gpio = 10, /* BLSP1 QUP3 I2C_DAT */ |
| 84 | .settings = { |
| 85 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 86 | }, |
| 87 | }, |
| 88 | { |
| 89 | .gpio = 11, /* BLSP1 QUP3 I2C_CLK */ |
| 90 | .settings = { |
| 91 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 92 | }, |
| 93 | }, |
Jin Hong | 690e335 | 2012-05-02 09:25:05 -0700 | [diff] [blame] | 94 | }; |
| 95 | |
Oluwafemi Adeyemi | 4926a9e | 2012-09-14 17:39:59 -0700 | [diff] [blame] | 96 | static struct gpiomux_setting sdc3_clk_active_cfg = { |
| 97 | .func = GPIOMUX_FUNC_1, |
| 98 | .drv = GPIOMUX_DRV_8MA, |
| 99 | .pull = GPIOMUX_PULL_NONE, |
| 100 | }; |
| 101 | |
| 102 | static struct gpiomux_setting sdc3_cmd_active_cfg = { |
| 103 | .func = GPIOMUX_FUNC_1, |
| 104 | .drv = GPIOMUX_DRV_8MA, |
| 105 | .pull = GPIOMUX_PULL_UP, |
| 106 | }; |
| 107 | |
| 108 | static struct gpiomux_setting sdc3_data_0_3_active_cfg = { |
| 109 | .func = GPIOMUX_FUNC_6, |
| 110 | .drv = GPIOMUX_DRV_8MA, |
| 111 | .pull = GPIOMUX_PULL_UP, |
| 112 | }; |
| 113 | |
| 114 | static struct gpiomux_setting sdc3_suspended_cfg = { |
| 115 | .func = GPIOMUX_FUNC_GPIO, |
| 116 | .drv = GPIOMUX_DRV_2MA, |
| 117 | .pull = GPIOMUX_PULL_DOWN, |
| 118 | }; |
| 119 | |
| 120 | static struct gpiomux_setting sdc3_data_1_suspended_cfg = { |
| 121 | .func = GPIOMUX_FUNC_GPIO, |
| 122 | .drv = GPIOMUX_DRV_2MA, |
| 123 | .pull = GPIOMUX_PULL_UP, |
| 124 | }; |
| 125 | |
| 126 | static struct msm_gpiomux_config sdc3_configs[] __initdata = { |
| 127 | { |
| 128 | .gpio = 25, |
| 129 | .settings = { |
| 130 | [GPIOMUX_ACTIVE] = &sdc3_clk_active_cfg, |
| 131 | [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg, |
| 132 | }, |
| 133 | }, |
| 134 | { |
| 135 | .gpio = 24, |
| 136 | .settings = { |
| 137 | [GPIOMUX_ACTIVE] = &sdc3_cmd_active_cfg, |
| 138 | [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg, |
| 139 | }, |
| 140 | |
| 141 | }, |
| 142 | { |
| 143 | .gpio = 16, |
| 144 | .settings = { |
| 145 | [GPIOMUX_ACTIVE] = &sdc3_data_0_3_active_cfg, |
| 146 | [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg, |
| 147 | }, |
| 148 | }, |
| 149 | { |
| 150 | .gpio = 17, |
| 151 | .settings = { |
| 152 | [GPIOMUX_ACTIVE] = &sdc3_data_0_3_active_cfg, |
| 153 | [GPIOMUX_SUSPENDED] = &sdc3_data_1_suspended_cfg, |
| 154 | }, |
| 155 | }, |
| 156 | { |
| 157 | .gpio = 18, |
| 158 | .settings = { |
| 159 | [GPIOMUX_ACTIVE] = &sdc3_data_0_3_active_cfg, |
| 160 | [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg, |
| 161 | }, |
| 162 | }, |
| 163 | { |
| 164 | .gpio = 19, |
| 165 | .settings = { |
| 166 | [GPIOMUX_ACTIVE] = &sdc3_data_0_3_active_cfg, |
| 167 | [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg, |
| 168 | }, |
| 169 | }, |
| 170 | }; |
| 171 | |
Pavan Kumar | 07c070b | 2012-10-29 18:58:49 -0700 | [diff] [blame] | 172 | static struct gpiomux_setting wlan_ath6kl_active_config = { |
| 173 | .func = GPIOMUX_FUNC_GPIO, |
| 174 | .drv = GPIOMUX_DRV_2MA, |
| 175 | .pull = GPIOMUX_PULL_NONE, |
| 176 | .dir = GPIOMUX_OUT_LOW, |
| 177 | }; |
| 178 | |
| 179 | static struct gpiomux_setting wlan_ath6kl_suspend_config = { |
| 180 | .func = GPIOMUX_FUNC_GPIO, |
| 181 | .drv = GPIOMUX_DRV_2MA, |
| 182 | .pull = GPIOMUX_PULL_NONE, |
| 183 | .dir = GPIOMUX_IN, |
| 184 | }; |
| 185 | |
| 186 | static struct msm_gpiomux_config wlan_ath6kl_configs[] __initdata = { |
| 187 | { |
| 188 | .gpio = 62,/* CHIP_PWD_L */ |
| 189 | .settings = { |
| 190 | [GPIOMUX_ACTIVE] = &wlan_ath6kl_active_config, |
| 191 | [GPIOMUX_SUSPENDED] = &wlan_ath6kl_suspend_config, |
| 192 | }, |
| 193 | }, |
| 194 | }; |
| 195 | |
Jin Hong | 690e335 | 2012-05-02 09:25:05 -0700 | [diff] [blame] | 196 | void __init msm9625_init_gpiomux(void) |
| 197 | { |
| 198 | int rc; |
| 199 | |
| 200 | rc = msm_gpiomux_init(NR_GPIO_IRQS); |
| 201 | if (rc) { |
| 202 | pr_err(KERN_ERR "msm9625_init_gpiomux failed %d\n", rc); |
| 203 | return; |
| 204 | } |
| 205 | |
| 206 | msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs)); |
Oluwafemi Adeyemi | 4926a9e | 2012-09-14 17:39:59 -0700 | [diff] [blame] | 207 | msm_gpiomux_install(sdc3_configs, ARRAY_SIZE(sdc3_configs)); |
Pavan Kumar | 07c070b | 2012-10-29 18:58:49 -0700 | [diff] [blame] | 208 | msm_gpiomux_install(wlan_ath6kl_configs, |
| 209 | ARRAY_SIZE(wlan_ath6kl_configs)); |
Jin Hong | 690e335 | 2012-05-02 09:25:05 -0700 | [diff] [blame] | 210 | } |