Jin Hong | 690e335 | 2012-05-02 09:25:05 -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 | |
| 20 | static struct gpiomux_setting gpio_uart_config = { |
| 21 | .func = GPIOMUX_FUNC_2, |
| 22 | .drv = GPIOMUX_DRV_16MA, |
| 23 | .pull = GPIOMUX_PULL_NONE, |
| 24 | .dir = GPIOMUX_OUT_HIGH, |
| 25 | }; |
| 26 | |
Rohit Vaswani | 0045df4 | 2012-06-29 16:21:48 -0700 | [diff] [blame] | 27 | static struct gpiomux_setting gpio_spi_cs_config = { |
| 28 | .func = GPIOMUX_FUNC_9, |
| 29 | .drv = GPIOMUX_DRV_12MA, |
| 30 | .pull = GPIOMUX_PULL_NONE, |
| 31 | }; |
| 32 | |
| 33 | static struct gpiomux_setting gpio_spi_config = { |
| 34 | .func = GPIOMUX_FUNC_2, |
| 35 | .drv = GPIOMUX_DRV_12MA, |
| 36 | .pull = GPIOMUX_PULL_NONE, |
| 37 | }; |
| 38 | |
Jin Hong | 690e335 | 2012-05-02 09:25:05 -0700 | [diff] [blame] | 39 | static struct msm_gpiomux_config msm_blsp_configs[] __initdata = { |
| 40 | { |
| 41 | .gpio = 45, /* BLSP1 UART TX */ |
| 42 | .settings = { |
| 43 | [GPIOMUX_SUSPENDED] = &gpio_uart_config, |
| 44 | }, |
| 45 | }, |
| 46 | { |
| 47 | .gpio = 46, /* BLSP1 UART RX */ |
| 48 | .settings = { |
| 49 | [GPIOMUX_SUSPENDED] = &gpio_uart_config, |
| 50 | }, |
| 51 | }, |
Rohit Vaswani | 0045df4 | 2012-06-29 16:21:48 -0700 | [diff] [blame] | 52 | { |
| 53 | .gpio = 69, /* BLSP6 QUP SPI_CS_N */ |
| 54 | .settings = { |
| 55 | [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config, |
| 56 | }, |
| 57 | }, |
| 58 | { |
| 59 | .gpio = 20, /* BLSP6 QUP SPI_DATA_MOSI */ |
| 60 | .settings = { |
| 61 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 62 | }, |
| 63 | }, |
| 64 | { |
| 65 | .gpio = 21, /* BLSP6 QUP SPI_DATA_MISO */ |
| 66 | .settings = { |
| 67 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 68 | }, |
| 69 | }, |
| 70 | { |
| 71 | .gpio = 23, /* BLSP6 QUP SPI_CLK */ |
| 72 | .settings = { |
| 73 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 74 | }, |
| 75 | }, |
| 76 | |
Jin Hong | 690e335 | 2012-05-02 09:25:05 -0700 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | void __init msm9625_init_gpiomux(void) |
| 80 | { |
| 81 | int rc; |
| 82 | |
| 83 | rc = msm_gpiomux_init(NR_GPIO_IRQS); |
| 84 | if (rc) { |
| 85 | pr_err(KERN_ERR "msm9625_init_gpiomux failed %d\n", rc); |
| 86 | return; |
| 87 | } |
| 88 | |
| 89 | msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs)); |
| 90 | } |