Abhimanyu Kapur | a6e2774 | 2013-03-18 16:39:31 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2013, The Linux Foundation. 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 | |
Abhi | af868f5 | 2013-06-10 15:22:18 -0700 | [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 | }; |
| 28 | |
| 29 | static struct msm_gpiomux_config msm_eth_config[] = { |
| 30 | { |
| 31 | .gpio = KS8851_IRQ_GPIO, |
| 32 | .settings = { |
| 33 | [GPIOMUX_SUSPENDED] = &gpio_eth_config, |
| 34 | } |
| 35 | }, |
| 36 | }; |
| 37 | #endif |
| 38 | |
Abhimanyu Kapur | a6e2774 | 2013-03-18 16:39:31 -0700 | [diff] [blame] | 39 | static struct gpiomux_setting gpio_uart_config = { |
| 40 | .func = GPIOMUX_FUNC_1, |
| 41 | .drv = GPIOMUX_DRV_8MA, |
| 42 | .pull = GPIOMUX_PULL_NONE, |
| 43 | }; |
| 44 | |
Abhi | af868f5 | 2013-06-10 15:22:18 -0700 | [diff] [blame] | 45 | static struct gpiomux_setting gpio_spi_config = { |
| 46 | .func = GPIOMUX_FUNC_2, |
| 47 | .drv = GPIOMUX_DRV_6MA, |
| 48 | .pull = GPIOMUX_PULL_NONE, |
| 49 | }; |
| 50 | |
Abhimanyu Kapur | a6e2774 | 2013-03-18 16:39:31 -0700 | [diff] [blame] | 51 | static struct msm_gpiomux_config msm_blsp_configs[] __initdata = { |
| 52 | { |
| 53 | .gpio = 8, /* BLSP1 UART TX */ |
| 54 | .settings = { |
| 55 | [GPIOMUX_SUSPENDED] = &gpio_uart_config, |
| 56 | }, |
| 57 | }, |
| 58 | { |
| 59 | .gpio = 9, /* BLSP1 UART RX */ |
| 60 | .settings = { |
| 61 | [GPIOMUX_SUSPENDED] = &gpio_uart_config, |
| 62 | }, |
| 63 | }, |
Abhi | af868f5 | 2013-06-10 15:22:18 -0700 | [diff] [blame] | 64 | { |
| 65 | .gpio = 20, /* BLSP1 QUP6 SPI_DATA_MOSI */ |
| 66 | .settings = { |
| 67 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 68 | }, |
| 69 | }, |
| 70 | { |
| 71 | .gpio = 21, /* BLSP1 QUP6 SPI_DATA_MISO */ |
| 72 | .settings = { |
| 73 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 74 | }, |
| 75 | }, |
| 76 | { |
| 77 | .gpio = 23, /* BLSP1 QUP6 SPI_CLK */ |
| 78 | .settings = { |
| 79 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 80 | }, |
| 81 | }, |
| 82 | { |
| 83 | .gpio = 22, /* BLSP1 QUP6 SPI_CS */ |
| 84 | .settings = { |
| 85 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 86 | }, |
| 87 | }, |
Abhimanyu Kapur | a6e2774 | 2013-03-18 16:39:31 -0700 | [diff] [blame] | 88 | }; |
| 89 | |
| 90 | void __init msmkrypton_init_gpiomux(void) |
| 91 | { |
| 92 | int rc; |
| 93 | |
| 94 | rc = msm_gpiomux_init_dt(); |
| 95 | if (rc) { |
| 96 | pr_err("%s failed %d\n", __func__, rc); |
| 97 | return; |
| 98 | } |
| 99 | |
| 100 | msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs)); |
Abhi | af868f5 | 2013-06-10 15:22:18 -0700 | [diff] [blame] | 101 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
| 102 | msm_gpiomux_install(msm_eth_config, ARRAY_SIZE(msm_eth_config)); |
| 103 | #endif |
Abhimanyu Kapur | a6e2774 | 2013-03-18 16:39:31 -0700 | [diff] [blame] | 104 | } |