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 | |
Sathish Ambley | e3154b4 | 2012-04-09 10:59:09 -0700 | [diff] [blame] | 29 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
| 30 | static struct gpiomux_setting gpio_eth_config = { |
| 31 | .pull = GPIOMUX_PULL_NONE, |
| 32 | .drv = GPIOMUX_DRV_8MA, |
| 33 | .func = GPIOMUX_FUNC_GPIO, |
| 34 | }; |
| 35 | |
| 36 | static struct gpiomux_setting gpio_spi_cs_config = { |
| 37 | .func = GPIOMUX_FUNC_4, |
| 38 | .drv = GPIOMUX_DRV_12MA, |
| 39 | .pull = GPIOMUX_PULL_NONE, |
| 40 | }; |
| 41 | |
| 42 | static struct gpiomux_setting gpio_spi_config = { |
| 43 | .func = GPIOMUX_FUNC_1, |
| 44 | .drv = GPIOMUX_DRV_12MA, |
| 45 | .pull = GPIOMUX_PULL_NONE, |
| 46 | }; |
| 47 | |
| 48 | static struct msm_gpiomux_config msm_eth_configs[] = { |
| 49 | { |
| 50 | .gpio = KS8851_IRQ_GPIO, |
| 51 | .settings = { |
| 52 | [GPIOMUX_SUSPENDED] = &gpio_eth_config, |
| 53 | } |
| 54 | }, |
| 55 | }; |
| 56 | #endif |
Jin Hong | a04caaa | 2012-05-23 10:28:27 -0700 | [diff] [blame] | 57 | static struct gpiomux_setting gpio_i2c_config = { |
| 58 | .func = GPIOMUX_FUNC_3, |
| 59 | .drv = GPIOMUX_DRV_8MA, |
| 60 | .pull = GPIOMUX_PULL_NONE, |
| 61 | }; |
| 62 | |
Sathish Ambley | e3154b4 | 2012-04-09 10:59:09 -0700 | [diff] [blame] | 63 | |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 64 | static struct msm_gpiomux_config msm_blsp_configs[] __initdata = { |
Sathish Ambley | e3154b4 | 2012-04-09 10:59:09 -0700 | [diff] [blame] | 65 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
| 66 | { |
| 67 | .gpio = 0, /* BLSP1 QUP SPI_DATA_MOSI */ |
| 68 | .settings = { |
| 69 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 70 | }, |
| 71 | }, |
| 72 | { |
| 73 | .gpio = 1, /* BLSP1 QUP SPI_DATA_MISO */ |
| 74 | .settings = { |
| 75 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 76 | }, |
| 77 | }, |
| 78 | { |
| 79 | .gpio = 3, /* BLSP1 QUP SPI_CLK */ |
| 80 | .settings = { |
| 81 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 82 | }, |
| 83 | }, |
| 84 | { |
| 85 | .gpio = 9, /* BLSP1 QUP SPI_CS_N */ |
| 86 | .settings = { |
| 87 | [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config, |
| 88 | }, |
| 89 | }, |
| 90 | #endif |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 91 | { |
Jin Hong | a04caaa | 2012-05-23 10:28:27 -0700 | [diff] [blame] | 92 | .gpio = 83, /* BLSP11 QUP I2C_DAT */ |
| 93 | .settings = { |
| 94 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 95 | }, |
| 96 | }, |
| 97 | { |
| 98 | .gpio = 84, /* BLSP11 QUP I2C_CLK */ |
| 99 | .settings = { |
| 100 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 101 | }, |
| 102 | }, |
| 103 | { |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 104 | .gpio = 45, /* BLSP8 UART TX */ |
| 105 | .settings = { |
| 106 | [GPIOMUX_SUSPENDED] = &gpio_uart_config, |
| 107 | }, |
| 108 | }, |
| 109 | { |
| 110 | .gpio = 46, /* BLSP8 UART RX */ |
| 111 | .settings = { |
| 112 | [GPIOMUX_SUSPENDED] = &gpio_uart_config, |
| 113 | }, |
| 114 | }, |
| 115 | }; |
| 116 | |
Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame^] | 117 | void __init msm_8974_init_gpiomux(void) |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 118 | { |
| 119 | int rc; |
| 120 | |
| 121 | rc = msm_gpiomux_init(NR_GPIO_IRQS); |
| 122 | if (rc) { |
Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame^] | 123 | pr_err(KERN_ERR "msm_8974_init_gpiomux failed %d\n", rc); |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 124 | return; |
| 125 | } |
| 126 | |
Sathish Ambley | e3154b4 | 2012-04-09 10:59:09 -0700 | [diff] [blame] | 127 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
| 128 | msm_gpiomux_install(msm_eth_configs, ARRAY_SIZE(msm_eth_configs)); |
| 129 | #endif |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 130 | msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs)); |
| 131 | } |