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 |
| 57 | |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 58 | static struct msm_gpiomux_config msm_blsp_configs[] __initdata = { |
Sathish Ambley | e3154b4 | 2012-04-09 10:59:09 -0700 | [diff] [blame^] | 59 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
| 60 | { |
| 61 | .gpio = 0, /* BLSP1 QUP SPI_DATA_MOSI */ |
| 62 | .settings = { |
| 63 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 64 | }, |
| 65 | }, |
| 66 | { |
| 67 | .gpio = 1, /* BLSP1 QUP SPI_DATA_MISO */ |
| 68 | .settings = { |
| 69 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 70 | }, |
| 71 | }, |
| 72 | { |
| 73 | .gpio = 3, /* BLSP1 QUP SPI_CLK */ |
| 74 | .settings = { |
| 75 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 76 | }, |
| 77 | }, |
| 78 | { |
| 79 | .gpio = 9, /* BLSP1 QUP SPI_CS_N */ |
| 80 | .settings = { |
| 81 | [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config, |
| 82 | }, |
| 83 | }, |
| 84 | #endif |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 85 | { |
| 86 | .gpio = 45, /* BLSP8 UART TX */ |
| 87 | .settings = { |
| 88 | [GPIOMUX_SUSPENDED] = &gpio_uart_config, |
| 89 | }, |
| 90 | }, |
| 91 | { |
| 92 | .gpio = 46, /* BLSP8 UART RX */ |
| 93 | .settings = { |
| 94 | [GPIOMUX_SUSPENDED] = &gpio_uart_config, |
| 95 | }, |
| 96 | }, |
| 97 | }; |
| 98 | |
| 99 | void __init msm_copper_init_gpiomux(void) |
| 100 | { |
| 101 | int rc; |
| 102 | |
| 103 | rc = msm_gpiomux_init(NR_GPIO_IRQS); |
| 104 | if (rc) { |
| 105 | pr_err(KERN_ERR "msmcopper_init_gpiomux failed %d\n", rc); |
| 106 | return; |
| 107 | } |
| 108 | |
Sathish Ambley | e3154b4 | 2012-04-09 10:59:09 -0700 | [diff] [blame^] | 109 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
| 110 | msm_gpiomux_install(msm_eth_configs, ARRAY_SIZE(msm_eth_configs)); |
| 111 | #endif |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 112 | msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs)); |
| 113 | } |