Stepan Moskovchenko | 2327a95 | 2011-12-14 16:31:28 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011, 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 <linux/platform_device.h> |
| 17 | #include <linux/bootmem.h> |
| 18 | #include <asm/mach-types.h> |
| 19 | #include <asm/mach/mmc.h> |
| 20 | #include <mach/msm_bus_board.h> |
| 21 | #include <mach/board.h> |
| 22 | #include <mach/gpio.h> |
| 23 | #include <mach/gpiomux.h> |
| 24 | #include "devices.h" |
| 25 | #include "board-8064.h" |
| 26 | |
| 27 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
| 28 | static struct gpiomux_setting gpio_eth_config = { |
| 29 | .pull = GPIOMUX_PULL_NONE, |
| 30 | .drv = GPIOMUX_DRV_8MA, |
| 31 | .func = GPIOMUX_FUNC_GPIO, |
| 32 | }; |
| 33 | |
| 34 | /* The SPI configurations apply to GSBI 5*/ |
| 35 | static struct gpiomux_setting gpio_spi_config = { |
| 36 | .func = GPIOMUX_FUNC_2, |
| 37 | .drv = GPIOMUX_DRV_8MA, |
| 38 | .pull = GPIOMUX_PULL_NONE, |
| 39 | }; |
| 40 | |
| 41 | /* The SPI configurations apply to GSBI 5 chip select 2*/ |
| 42 | static struct gpiomux_setting gpio_spi_cs2_config = { |
| 43 | .func = GPIOMUX_FUNC_3, |
| 44 | .drv = GPIOMUX_DRV_8MA, |
| 45 | .pull = GPIOMUX_PULL_NONE, |
| 46 | }; |
| 47 | |
| 48 | struct msm_gpiomux_config apq8064_ethernet_configs[] = { |
| 49 | { |
| 50 | .gpio = 43, |
| 51 | .settings = { |
| 52 | [GPIOMUX_SUSPENDED] = &gpio_eth_config, |
| 53 | [GPIOMUX_ACTIVE] = &gpio_eth_config, |
| 54 | } |
| 55 | }, |
| 56 | }; |
| 57 | #endif |
| 58 | |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame^] | 59 | static struct gpiomux_setting cdc_mclk = { |
| 60 | .func = GPIOMUX_FUNC_1, |
| 61 | .drv = GPIOMUX_DRV_8MA, |
| 62 | .pull = GPIOMUX_PULL_NONE, |
| 63 | }; |
| 64 | |
Stepan Moskovchenko | 2327a95 | 2011-12-14 16:31:28 -0800 | [diff] [blame] | 65 | static struct gpiomux_setting audio_auxpcm[] = { |
| 66 | /* Suspended state */ |
| 67 | { |
| 68 | .func = GPIOMUX_FUNC_GPIO, |
| 69 | .drv = GPIOMUX_DRV_2MA, |
| 70 | .pull = GPIOMUX_PULL_NONE, |
| 71 | }, |
| 72 | /* Active state */ |
| 73 | { |
| 74 | .func = GPIOMUX_FUNC_1, |
| 75 | .drv = GPIOMUX_DRV_2MA, |
| 76 | .pull = GPIOMUX_PULL_NONE, |
| 77 | }, |
| 78 | }; |
| 79 | |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame^] | 80 | static struct gpiomux_setting slimbus = { |
| 81 | .func = GPIOMUX_FUNC_1, |
| 82 | .drv = GPIOMUX_DRV_8MA, |
| 83 | .pull = GPIOMUX_PULL_KEEPER, |
| 84 | }; |
| 85 | |
Stepan Moskovchenko | 2327a95 | 2011-12-14 16:31:28 -0800 | [diff] [blame] | 86 | static struct msm_gpiomux_config apq8064_gsbi_configs[] __initdata = { |
| 87 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
| 88 | { |
| 89 | .gpio = 51, /* GSBI5 QUP SPI_DATA_MOSI */ |
| 90 | .settings = { |
| 91 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 92 | }, |
| 93 | }, |
| 94 | { |
| 95 | .gpio = 52, /* GSBI5 QUP SPI_DATA_MISO */ |
| 96 | .settings = { |
| 97 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 98 | }, |
| 99 | }, |
| 100 | { |
| 101 | .gpio = 31, /* GSBI5 QUP SPI_CS2_N */ |
| 102 | .settings = { |
| 103 | [GPIOMUX_SUSPENDED] = &gpio_spi_cs2_config, |
| 104 | }, |
| 105 | }, |
| 106 | { |
| 107 | .gpio = 54, /* GSBI5 QUP SPI_CLK */ |
| 108 | .settings = { |
| 109 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 110 | }, |
| 111 | }, |
| 112 | #endif |
| 113 | }; |
| 114 | |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame^] | 115 | static struct msm_gpiomux_config apq8064_slimbus_config[] __initdata = { |
| 116 | { |
| 117 | .gpio = 40, /* slimbus clk */ |
| 118 | .settings = { |
| 119 | [GPIOMUX_SUSPENDED] = &slimbus, |
| 120 | }, |
| 121 | }, |
| 122 | { |
| 123 | .gpio = 41, /* slimbus data */ |
| 124 | .settings = { |
| 125 | [GPIOMUX_SUSPENDED] = &slimbus, |
| 126 | }, |
| 127 | }, |
| 128 | }; |
| 129 | |
| 130 | static struct msm_gpiomux_config apq8064_audio_codec_configs[] __initdata = { |
| 131 | { |
| 132 | .gpio = 39, |
| 133 | .settings = { |
| 134 | [GPIOMUX_SUSPENDED] = &cdc_mclk, |
| 135 | }, |
| 136 | }, |
| 137 | }; |
| 138 | |
Stepan Moskovchenko | 2327a95 | 2011-12-14 16:31:28 -0800 | [diff] [blame] | 139 | static struct msm_gpiomux_config apq8064_audio_auxpcm_configs[] __initdata = { |
| 140 | { |
| 141 | .gpio = 43, |
| 142 | .settings = { |
| 143 | [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], |
| 144 | [GPIOMUX_ACTIVE] = &audio_auxpcm[1], |
| 145 | }, |
| 146 | }, |
| 147 | { |
| 148 | .gpio = 44, |
| 149 | .settings = { |
| 150 | [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], |
| 151 | [GPIOMUX_ACTIVE] = &audio_auxpcm[1], |
| 152 | }, |
| 153 | }, |
| 154 | { |
| 155 | .gpio = 45, |
| 156 | .settings = { |
| 157 | [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], |
| 158 | [GPIOMUX_ACTIVE] = &audio_auxpcm[1], |
| 159 | }, |
| 160 | }, |
| 161 | { |
| 162 | .gpio = 46, |
| 163 | .settings = { |
| 164 | [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], |
| 165 | [GPIOMUX_ACTIVE] = &audio_auxpcm[1], |
| 166 | }, |
| 167 | }, |
| 168 | }; |
| 169 | |
| 170 | void __init apq8064_init_gpiomux(void) |
| 171 | { |
| 172 | int rc; |
| 173 | |
| 174 | rc = msm_gpiomux_init(NR_GPIO_IRQS); |
| 175 | if (rc) { |
| 176 | pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc); |
| 177 | return; |
| 178 | } |
| 179 | |
| 180 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
| 181 | msm_gpiomux_install(apq8064_ethernet_configs, |
| 182 | ARRAY_SIZE(apq8064_ethernet_configs)); |
| 183 | #endif |
| 184 | |
| 185 | msm_gpiomux_install(apq8064_gsbi_configs, |
| 186 | ARRAY_SIZE(apq8064_gsbi_configs)); |
| 187 | |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame^] | 188 | msm_gpiomux_install(apq8064_slimbus_config, |
| 189 | ARRAY_SIZE(apq8064_slimbus_config)); |
| 190 | |
| 191 | msm_gpiomux_install(apq8064_audio_codec_configs, |
| 192 | ARRAY_SIZE(apq8064_audio_codec_configs)); |
| 193 | |
Stepan Moskovchenko | 2327a95 | 2011-12-14 16:31:28 -0800 | [diff] [blame] | 194 | msm_gpiomux_install(apq8064_audio_auxpcm_configs, |
| 195 | ARRAY_SIZE(apq8064_audio_auxpcm_configs)); |
| 196 | } |