Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 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 | |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 20 | static struct gpiomux_setting gpio_i2c_config = { |
| 21 | .func = GPIOMUX_FUNC_3, |
| 22 | .drv = GPIOMUX_DRV_2MA, |
| 23 | .pull = GPIOMUX_PULL_NONE, |
| 24 | }; |
| 25 | |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 26 | static struct gpiomux_setting gpio_spi_config = { |
| 27 | .func = GPIOMUX_FUNC_1, |
| 28 | .drv = GPIOMUX_DRV_6MA, |
| 29 | .pull = GPIOMUX_PULL_NONE, |
| 30 | }; |
| 31 | |
| 32 | static 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 Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame^] | 38 | static struct gpiomux_setting wcnss_5wire_suspend_cfg = { |
| 39 | .func = GPIOMUX_FUNC_GPIO, |
| 40 | .drv = GPIOMUX_DRV_2MA, |
| 41 | .pull = GPIOMUX_PULL_UP, |
| 42 | }; |
| 43 | |
| 44 | static 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 Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 50 | static struct msm_gpiomux_config msm_blsp_configs[] __initdata = { |
| 51 | { |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 52 | .gpio = 10, /* BLSP1 QUP3 I2C_SDA */ |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 53 | .settings = { |
| 54 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 55 | }, |
| 56 | }, |
| 57 | { |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 58 | .gpio = 11, /* BLSP1 QUP3 I2C_SCL */ |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 59 | .settings = { |
| 60 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 61 | }, |
| 62 | }, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 63 | { |
| 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 Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame^] | 89 | static 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 Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 127 | void __init msm8610_init_gpiomux(void) |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 128 | { |
| 129 | int rc; |
| 130 | |
Rohit Vaswani | 341c203 | 2012-11-08 18:49:29 -0800 | [diff] [blame] | 131 | rc = msm_gpiomux_init_dt(); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 132 | if (rc) { |
Rohit Vaswani | 341c203 | 2012-11-08 18:49:29 -0800 | [diff] [blame] | 133 | pr_err("%s failed %d\n", __func__, rc); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 134 | return; |
| 135 | } |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 136 | |
| 137 | msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs)); |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame^] | 138 | msm_gpiomux_install(wcnss_5wire_interface, |
| 139 | ARRAY_SIZE(wcnss_5wire_interface)); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 140 | } |