Gilad Avidov | 28e18eb | 2012-11-21 18:13:25 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
Syed Rameez Mustafa | 9d16c4f | 2012-09-10 14:16:55 -0700 | [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 | |
Syed Rameez Mustafa | 01d15eb | 2012-12-20 15:30:17 -0800 | [diff] [blame] | 20 | #define KS8851_IRQ_GPIO 75 |
| 21 | |
| 22 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
| 23 | static struct gpiomux_setting gpio_eth_config = { |
| 24 | .pull = GPIOMUX_PULL_UP, |
| 25 | .drv = GPIOMUX_DRV_2MA, |
| 26 | .func = GPIOMUX_FUNC_GPIO, |
| 27 | }; |
Syed Rameez Mustafa | 01d15eb | 2012-12-20 15:30:17 -0800 | [diff] [blame] | 28 | |
| 29 | static struct msm_gpiomux_config msm_eth_configs[] = { |
| 30 | { |
| 31 | .gpio = KS8851_IRQ_GPIO, |
| 32 | .settings = { |
| 33 | [GPIOMUX_SUSPENDED] = &gpio_eth_config, |
| 34 | } |
| 35 | }, |
| 36 | }; |
Gilad Avidov | 28e18eb | 2012-11-21 18:13:25 -0700 | [diff] [blame] | 37 | #endif |
| 38 | |
| 39 | static struct gpiomux_setting gpio_spi_config = { |
| 40 | .func = GPIOMUX_FUNC_1, |
| 41 | .drv = GPIOMUX_DRV_8MA, |
| 42 | .pull = GPIOMUX_PULL_NONE, |
| 43 | }; |
| 44 | |
| 45 | static struct gpiomux_setting gpio_i2c_config = { |
| 46 | .func = GPIOMUX_FUNC_3, |
| 47 | .drv = GPIOMUX_DRV_2MA, |
| 48 | .pull = GPIOMUX_PULL_NONE, |
| 49 | }; |
Syed Rameez Mustafa | 01d15eb | 2012-12-20 15:30:17 -0800 | [diff] [blame] | 50 | |
| 51 | static struct msm_gpiomux_config msm_blsp_configs[] __initdata = { |
| 52 | { |
| 53 | .gpio = 0, /* BLSP1 QUP2 SPI_DATA_MOSI */ |
| 54 | .settings = { |
| 55 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 56 | }, |
| 57 | }, |
| 58 | { |
| 59 | .gpio = 1, /* BLSP1 QUP2 SPI_DATA_MISO */ |
| 60 | .settings = { |
| 61 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 62 | }, |
| 63 | }, |
| 64 | { |
| 65 | .gpio = 2, /* BLSP1 QUP2 SPI_CS_N */ |
| 66 | .settings = { |
| 67 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 68 | }, |
| 69 | }, |
| 70 | { |
| 71 | .gpio = 3, /* BLSP1 QUP2 SPI_CLK */ |
| 72 | .settings = { |
| 73 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 74 | }, |
| 75 | }, |
Gilad Avidov | 28e18eb | 2012-11-21 18:13:25 -0700 | [diff] [blame] | 76 | { |
| 77 | .gpio = 14, /* BLSP-1 QUP-4 I2C_SDA */ |
| 78 | .settings = { |
| 79 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 80 | }, |
| 81 | }, |
| 82 | { |
| 83 | .gpio = 15, /* BLSP-1 QUP-4 I2C_SCL */ |
| 84 | .settings = { |
| 85 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 86 | }, |
| 87 | }, |
Syed Rameez Mustafa | 01d15eb | 2012-12-20 15:30:17 -0800 | [diff] [blame] | 88 | }; |
Syed Rameez Mustafa | 01d15eb | 2012-12-20 15:30:17 -0800 | [diff] [blame] | 89 | |
Syed Rameez Mustafa | 9d16c4f | 2012-09-10 14:16:55 -0700 | [diff] [blame] | 90 | void __init msm8226_init_gpiomux(void) |
| 91 | { |
| 92 | int rc; |
| 93 | |
Rohit Vaswani | 341c203 | 2012-11-08 18:49:29 -0800 | [diff] [blame] | 94 | rc = msm_gpiomux_init_dt(); |
Syed Rameez Mustafa | 9d16c4f | 2012-09-10 14:16:55 -0700 | [diff] [blame] | 95 | if (rc) { |
Rohit Vaswani | 341c203 | 2012-11-08 18:49:29 -0800 | [diff] [blame] | 96 | pr_err("%s failed %d\n", __func__, rc); |
Syed Rameez Mustafa | 9d16c4f | 2012-09-10 14:16:55 -0700 | [diff] [blame] | 97 | return; |
| 98 | } |
Gilad Avidov | 28e18eb | 2012-11-21 18:13:25 -0700 | [diff] [blame] | 99 | |
Syed Rameez Mustafa | 01d15eb | 2012-12-20 15:30:17 -0800 | [diff] [blame] | 100 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
| 101 | msm_gpiomux_install(msm_eth_configs, ARRAY_SIZE(msm_eth_configs)); |
Syed Rameez Mustafa | 01d15eb | 2012-12-20 15:30:17 -0800 | [diff] [blame] | 102 | #endif |
Gilad Avidov | 28e18eb | 2012-11-21 18:13:25 -0700 | [diff] [blame] | 103 | |
| 104 | msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs)); |
Syed Rameez Mustafa | 9d16c4f | 2012-09-10 14:16:55 -0700 | [diff] [blame] | 105 | } |