Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -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 | |
Sathish Ambley | e3154b4 | 2012-04-09 10:59:09 -0700 | [diff] [blame] | 20 | #define KS8851_IRQ_GPIO 90 |
| 21 | |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 22 | static 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 | |
Sagar Dharia | a8e6b0a | 2012-08-10 20:52:30 -0600 | [diff] [blame] | 29 | static struct gpiomux_setting slimbus = { |
| 30 | .func = GPIOMUX_FUNC_1, |
| 31 | .drv = GPIOMUX_DRV_8MA, |
| 32 | .pull = GPIOMUX_PULL_KEEPER, |
| 33 | }; |
| 34 | |
Sathish Ambley | e3154b4 | 2012-04-09 10:59:09 -0700 | [diff] [blame] | 35 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
| 36 | static struct gpiomux_setting gpio_eth_config = { |
| 37 | .pull = GPIOMUX_PULL_NONE, |
| 38 | .drv = GPIOMUX_DRV_8MA, |
| 39 | .func = GPIOMUX_FUNC_GPIO, |
| 40 | }; |
| 41 | |
| 42 | static struct gpiomux_setting gpio_spi_cs_config = { |
| 43 | .func = GPIOMUX_FUNC_4, |
| 44 | .drv = GPIOMUX_DRV_12MA, |
| 45 | .pull = GPIOMUX_PULL_NONE, |
| 46 | }; |
| 47 | |
| 48 | static struct gpiomux_setting gpio_spi_config = { |
| 49 | .func = GPIOMUX_FUNC_1, |
| 50 | .drv = GPIOMUX_DRV_12MA, |
| 51 | .pull = GPIOMUX_PULL_NONE, |
| 52 | }; |
| 53 | |
| 54 | static struct msm_gpiomux_config msm_eth_configs[] = { |
| 55 | { |
| 56 | .gpio = KS8851_IRQ_GPIO, |
| 57 | .settings = { |
| 58 | [GPIOMUX_SUSPENDED] = &gpio_eth_config, |
| 59 | } |
| 60 | }, |
| 61 | }; |
| 62 | #endif |
Jin Hong | a04caaa | 2012-05-23 10:28:27 -0700 | [diff] [blame] | 63 | static struct gpiomux_setting gpio_i2c_config = { |
| 64 | .func = GPIOMUX_FUNC_3, |
| 65 | .drv = GPIOMUX_DRV_8MA, |
| 66 | .pull = GPIOMUX_PULL_NONE, |
| 67 | }; |
| 68 | |
Chandan Uddaraju | 88b26d7 | 2012-08-13 22:28:44 -0700 | [diff] [blame] | 69 | static struct gpiomux_setting lcd_en_act_cfg = { |
| 70 | .func = GPIOMUX_FUNC_GPIO, |
| 71 | .drv = GPIOMUX_DRV_8MA, |
| 72 | .pull = GPIOMUX_PULL_NONE, |
| 73 | }; |
| 74 | |
| 75 | static struct gpiomux_setting lcd_en_sus_cfg = { |
| 76 | .func = GPIOMUX_FUNC_GPIO, |
| 77 | .drv = GPIOMUX_DRV_2MA, |
| 78 | .pull = GPIOMUX_PULL_DOWN, |
| 79 | }; |
Sathish Ambley | e3154b4 | 2012-04-09 10:59:09 -0700 | [diff] [blame] | 80 | |
Amy Maloche | 9e99a79 | 2012-08-15 23:27:51 -0700 | [diff] [blame^] | 81 | static struct gpiomux_setting atmel_resout_sus_cfg = { |
| 82 | .func = GPIOMUX_FUNC_GPIO, |
| 83 | .drv = GPIOMUX_DRV_6MA, |
| 84 | .pull = GPIOMUX_PULL_DOWN, |
| 85 | }; |
| 86 | |
| 87 | static struct gpiomux_setting atmel_resout_act_cfg = { |
| 88 | .func = GPIOMUX_FUNC_GPIO, |
| 89 | .drv = GPIOMUX_DRV_6MA, |
| 90 | .pull = GPIOMUX_PULL_UP, |
| 91 | }; |
| 92 | |
| 93 | static struct gpiomux_setting atmel_int_act_cfg = { |
| 94 | .func = GPIOMUX_FUNC_GPIO, |
| 95 | .drv = GPIOMUX_DRV_8MA, |
| 96 | .pull = GPIOMUX_PULL_UP, |
| 97 | }; |
| 98 | |
| 99 | static struct gpiomux_setting atmel_int_sus_cfg = { |
| 100 | .func = GPIOMUX_FUNC_GPIO, |
| 101 | .drv = GPIOMUX_DRV_2MA, |
| 102 | .pull = GPIOMUX_PULL_DOWN, |
| 103 | }; |
| 104 | |
| 105 | static struct msm_gpiomux_config msm_touch_configs[] __initdata = { |
| 106 | { |
| 107 | .gpio = 60, /* TOUCH RESET */ |
| 108 | .settings = { |
| 109 | [GPIOMUX_ACTIVE] = &atmel_resout_act_cfg, |
| 110 | [GPIOMUX_SUSPENDED] = &atmel_resout_sus_cfg, |
| 111 | }, |
| 112 | }, |
| 113 | { |
| 114 | .gpio = 61, /* TOUCH IRQ */ |
| 115 | .settings = { |
| 116 | [GPIOMUX_ACTIVE] = &atmel_int_act_cfg, |
| 117 | [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg, |
| 118 | }, |
| 119 | }, |
| 120 | |
| 121 | }; |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 122 | static struct msm_gpiomux_config msm_blsp_configs[] __initdata = { |
Sathish Ambley | e3154b4 | 2012-04-09 10:59:09 -0700 | [diff] [blame] | 123 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
| 124 | { |
| 125 | .gpio = 0, /* BLSP1 QUP SPI_DATA_MOSI */ |
| 126 | .settings = { |
| 127 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 128 | }, |
| 129 | }, |
| 130 | { |
| 131 | .gpio = 1, /* BLSP1 QUP SPI_DATA_MISO */ |
| 132 | .settings = { |
| 133 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 134 | }, |
| 135 | }, |
| 136 | { |
| 137 | .gpio = 3, /* BLSP1 QUP SPI_CLK */ |
| 138 | .settings = { |
| 139 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 140 | }, |
| 141 | }, |
| 142 | { |
| 143 | .gpio = 9, /* BLSP1 QUP SPI_CS_N */ |
| 144 | .settings = { |
| 145 | [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config, |
| 146 | }, |
| 147 | }, |
| 148 | #endif |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 149 | { |
Chandan Uddaraju | 88b26d7 | 2012-08-13 22:28:44 -0700 | [diff] [blame] | 150 | .gpio = 58, |
| 151 | .settings = { |
| 152 | [GPIOMUX_ACTIVE] = &lcd_en_act_cfg, |
| 153 | [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg, |
| 154 | }, |
| 155 | }, |
| 156 | { |
Amy Maloche | bc7e967 | 2012-08-15 10:30:40 -0700 | [diff] [blame] | 157 | .gpio = 6, /* BLSP1 QUP2 I2C_DAT */ |
| 158 | .settings = { |
| 159 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 160 | }, |
| 161 | }, |
| 162 | { |
| 163 | .gpio = 7, /* BLSP1 QUP2 I2C_CLK */ |
| 164 | .settings = { |
| 165 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 166 | }, |
| 167 | }, |
| 168 | { |
Jin Hong | a04caaa | 2012-05-23 10:28:27 -0700 | [diff] [blame] | 169 | .gpio = 83, /* BLSP11 QUP I2C_DAT */ |
| 170 | .settings = { |
| 171 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 172 | }, |
| 173 | }, |
| 174 | { |
| 175 | .gpio = 84, /* BLSP11 QUP I2C_CLK */ |
| 176 | .settings = { |
| 177 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 178 | }, |
| 179 | }, |
| 180 | { |
Stepan Moskovchenko | 5269b60 | 2012-08-08 17:57:09 -0700 | [diff] [blame] | 181 | .gpio = 4, /* BLSP2 UART TX */ |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 182 | .settings = { |
| 183 | [GPIOMUX_SUSPENDED] = &gpio_uart_config, |
| 184 | }, |
| 185 | }, |
| 186 | { |
Stepan Moskovchenko | 5269b60 | 2012-08-08 17:57:09 -0700 | [diff] [blame] | 187 | .gpio = 5, /* BLSP2 UART RX */ |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 188 | .settings = { |
| 189 | [GPIOMUX_SUSPENDED] = &gpio_uart_config, |
| 190 | }, |
| 191 | }, |
| 192 | }; |
| 193 | |
Sagar Dharia | a8e6b0a | 2012-08-10 20:52:30 -0600 | [diff] [blame] | 194 | static struct msm_gpiomux_config msm8974_slimbus_config[] __initdata = { |
| 195 | { |
| 196 | .gpio = 70, /* slimbus clk */ |
| 197 | .settings = { |
| 198 | [GPIOMUX_SUSPENDED] = &slimbus, |
| 199 | }, |
| 200 | }, |
| 201 | { |
| 202 | .gpio = 71, /* slimbus data */ |
| 203 | .settings = { |
| 204 | [GPIOMUX_SUSPENDED] = &slimbus, |
| 205 | }, |
| 206 | }, |
| 207 | }; |
| 208 | |
Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 209 | void __init msm_8974_init_gpiomux(void) |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 210 | { |
| 211 | int rc; |
| 212 | |
| 213 | rc = msm_gpiomux_init(NR_GPIO_IRQS); |
| 214 | if (rc) { |
Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 215 | pr_err(KERN_ERR "msm_8974_init_gpiomux failed %d\n", rc); |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 216 | return; |
| 217 | } |
| 218 | |
Sathish Ambley | e3154b4 | 2012-04-09 10:59:09 -0700 | [diff] [blame] | 219 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
| 220 | msm_gpiomux_install(msm_eth_configs, ARRAY_SIZE(msm_eth_configs)); |
| 221 | #endif |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 222 | msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs)); |
Sagar Dharia | a8e6b0a | 2012-08-10 20:52:30 -0600 | [diff] [blame] | 223 | |
| 224 | msm_gpiomux_install(msm8974_slimbus_config, |
| 225 | ARRAY_SIZE(msm8974_slimbus_config)); |
| 226 | |
Amy Maloche | 9e99a79 | 2012-08-15 23:27:51 -0700 | [diff] [blame^] | 227 | msm_gpiomux_install(msm_touch_configs, ARRAY_SIZE(msm_touch_configs)); |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 228 | } |