board-krypton-gpiomux.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. #include <linux/init.h>
  14. #include <linux/ioport.h>
  15. #include <mach/board.h>
  16. #include <mach/gpio.h>
  17. #include <mach/gpiomux.h>
  18. #define KS8851_IRQ_GPIO 75
  19. #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
  20. static struct gpiomux_setting gpio_eth_config = {
  21. .pull = GPIOMUX_PULL_UP,
  22. .drv = GPIOMUX_DRV_2MA,
  23. .func = GPIOMUX_FUNC_GPIO,
  24. };
  25. static struct msm_gpiomux_config msm_eth_config[] = {
  26. {
  27. .gpio = KS8851_IRQ_GPIO,
  28. .settings = {
  29. [GPIOMUX_SUSPENDED] = &gpio_eth_config,
  30. }
  31. },
  32. };
  33. #endif
  34. static struct gpiomux_setting gpio_uart_config = {
  35. .func = GPIOMUX_FUNC_1,
  36. .drv = GPIOMUX_DRV_8MA,
  37. .pull = GPIOMUX_PULL_NONE,
  38. };
  39. static struct gpiomux_setting gpio_spi_config = {
  40. .func = GPIOMUX_FUNC_2,
  41. .drv = GPIOMUX_DRV_6MA,
  42. .pull = GPIOMUX_PULL_NONE,
  43. };
  44. static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
  45. {
  46. .gpio = 8, /* BLSP1 UART TX */
  47. .settings = {
  48. [GPIOMUX_SUSPENDED] = &gpio_uart_config,
  49. },
  50. },
  51. {
  52. .gpio = 9, /* BLSP1 UART RX */
  53. .settings = {
  54. [GPIOMUX_SUSPENDED] = &gpio_uart_config,
  55. },
  56. },
  57. {
  58. .gpio = 20, /* BLSP1 QUP6 SPI_DATA_MOSI */
  59. .settings = {
  60. [GPIOMUX_SUSPENDED] = &gpio_spi_config,
  61. },
  62. },
  63. {
  64. .gpio = 21, /* BLSP1 QUP6 SPI_DATA_MISO */
  65. .settings = {
  66. [GPIOMUX_SUSPENDED] = &gpio_spi_config,
  67. },
  68. },
  69. {
  70. .gpio = 23, /* BLSP1 QUP6 SPI_CLK */
  71. .settings = {
  72. [GPIOMUX_SUSPENDED] = &gpio_spi_config,
  73. },
  74. },
  75. {
  76. .gpio = 22, /* BLSP1 QUP6 SPI_CS */
  77. .settings = {
  78. [GPIOMUX_SUSPENDED] = &gpio_spi_config,
  79. },
  80. },
  81. };
  82. void __init msmkrypton_init_gpiomux(void)
  83. {
  84. int rc;
  85. rc = msm_gpiomux_init_dt();
  86. if (rc) {
  87. pr_err("%s failed %d\n", __func__, rc);
  88. return;
  89. }
  90. msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
  91. #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
  92. msm_gpiomux_install(msm_eth_config, ARRAY_SIZE(msm_eth_config));
  93. #endif
  94. }