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