210-v6.2-pinctrl-mt7986-allow-configuring-uart-rx-tx-and-rts-.patch 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. From f76e8bc416bebb0f7b9f57b1247eae945421c0b9 Mon Sep 17 00:00:00 2001
  2. From: Sam Shih <[email protected]>
  3. Date: Sat, 8 Oct 2022 18:48:06 +0200
  4. Subject: [PATCH 1/2] pinctrl: mt7986: allow configuring uart rx/tx and rts/cts
  5. separately
  6. Some mt7986 boards use uart rts/cts pins as gpio,
  7. This patch allows to change rts/cts to gpio mode, but keep
  8. rx/tx as UART function.
  9. Signed-off-by: Frank Wunderlich <[email protected]>
  10. Signed-off-by: Sam Shih <[email protected]>
  11. Link: https://lore.kernel.org/r/[email protected]
  12. Signed-off-by: Linus Walleij <[email protected]>
  13. ---
  14. drivers/pinctrl/mediatek/pinctrl-mt7986.c | 32 ++++++++++++++++++-----
  15. 1 file changed, 25 insertions(+), 7 deletions(-)
  16. --- a/drivers/pinctrl/mediatek/pinctrl-mt7986.c
  17. +++ b/drivers/pinctrl/mediatek/pinctrl-mt7986.c
  18. @@ -675,11 +675,17 @@ static int mt7986_uart1_1_funcs[] = { 4,
  19. static int mt7986_spi1_2_pins[] = { 29, 30, 31, 32, };
  20. static int mt7986_spi1_2_funcs[] = { 1, 1, 1, 1, };
  21. -static int mt7986_uart1_2_pins[] = { 29, 30, 31, 32, };
  22. -static int mt7986_uart1_2_funcs[] = { 3, 3, 3, 3, };
  23. +static int mt7986_uart1_2_rx_tx_pins[] = { 29, 30, };
  24. +static int mt7986_uart1_2_rx_tx_funcs[] = { 3, 3, };
  25. -static int mt7986_uart2_0_pins[] = { 29, 30, 31, 32, };
  26. -static int mt7986_uart2_0_funcs[] = { 4, 4, 4, 4, };
  27. +static int mt7986_uart1_2_cts_rts_pins[] = { 31, 32, };
  28. +static int mt7986_uart1_2_cts_rts_funcs[] = { 3, 3, };
  29. +
  30. +static int mt7986_uart2_0_rx_tx_pins[] = { 29, 30, };
  31. +static int mt7986_uart2_0_rx_tx_funcs[] = { 4, 4, };
  32. +
  33. +static int mt7986_uart2_0_cts_rts_pins[] = { 31, 32, };
  34. +static int mt7986_uart2_0_cts_rts_funcs[] = { 4, 4, };
  35. static int mt7986_spi0_pins[] = { 33, 34, 35, 36, };
  36. static int mt7986_spi0_funcs[] = { 1, 1, 1, 1, };
  37. @@ -708,6 +714,12 @@ static int mt7986_pcie_reset_funcs[] = {
  38. static int mt7986_uart1_pins[] = { 42, 43, 44, 45, };
  39. static int mt7986_uart1_funcs[] = { 1, 1, 1, 1, };
  40. +static int mt7986_uart1_rx_tx_pins[] = { 42, 43, };
  41. +static int mt7986_uart1_rx_tx_funcs[] = { 1, 1, };
  42. +
  43. +static int mt7986_uart1_cts_rts_pins[] = { 44, 45, };
  44. +static int mt7986_uart1_cts_rts_funcs[] = { 1, 1, };
  45. +
  46. static int mt7986_uart2_pins[] = { 46, 47, 48, 49, };
  47. static int mt7986_uart2_funcs[] = { 1, 1, 1, 1, };
  48. @@ -749,6 +761,8 @@ static const struct group_desc mt7986_gr
  49. PINCTRL_PIN_GROUP("wifi_led", mt7986_wifi_led),
  50. PINCTRL_PIN_GROUP("i2c", mt7986_i2c),
  51. PINCTRL_PIN_GROUP("uart1_0", mt7986_uart1_0),
  52. + PINCTRL_PIN_GROUP("uart1_rx_tx", mt7986_uart1_rx_tx),
  53. + PINCTRL_PIN_GROUP("uart1_cts_rts", mt7986_uart1_cts_rts),
  54. PINCTRL_PIN_GROUP("pcie_clk", mt7986_pcie_clk),
  55. PINCTRL_PIN_GROUP("pcie_wake", mt7986_pcie_wake),
  56. PINCTRL_PIN_GROUP("spi1_0", mt7986_spi1_0),
  57. @@ -760,8 +774,10 @@ static const struct group_desc mt7986_gr
  58. PINCTRL_PIN_GROUP("spi1_1", mt7986_spi1_1),
  59. PINCTRL_PIN_GROUP("uart1_1", mt7986_uart1_1),
  60. PINCTRL_PIN_GROUP("spi1_2", mt7986_spi1_2),
  61. - PINCTRL_PIN_GROUP("uart1_2", mt7986_uart1_2),
  62. - PINCTRL_PIN_GROUP("uart2_0", mt7986_uart2_0),
  63. + PINCTRL_PIN_GROUP("uart1_2_rx_tx", mt7986_uart1_2_rx_tx),
  64. + PINCTRL_PIN_GROUP("uart1_2_cts_rts", mt7986_uart1_2_cts_rts),
  65. + PINCTRL_PIN_GROUP("uart2_0_rx_tx", mt7986_uart2_0_rx_tx),
  66. + PINCTRL_PIN_GROUP("uart2_0_cts_rts", mt7986_uart2_0_cts_rts),
  67. PINCTRL_PIN_GROUP("spi0", mt7986_spi0),
  68. PINCTRL_PIN_GROUP("spi0_wp_hold", mt7986_spi0_wp_hold),
  69. PINCTRL_PIN_GROUP("uart2_1", mt7986_uart2_1),
  70. @@ -800,7 +816,9 @@ static const char *mt7986_pwm_groups[] =
  71. static const char *mt7986_spi_groups[] = {
  72. "spi0", "spi0_wp_hold", "spi1_0", "spi1_1", "spi1_2", "spi1_3", };
  73. static const char *mt7986_uart_groups[] = {
  74. - "uart1_0", "uart1_1", "uart1_2", "uart1_3_rx_tx", "uart1_3_cts_rts",
  75. + "uart1_0", "uart1_1", "uart1_rx_tx", "uart1_cts_rts",
  76. + "uart1_2_rx_tx", "uart1_2_cts_rts",
  77. + "uart1_3_rx_tx", "uart1_3_cts_rts", "uart2_0_rx_tx", "uart2_0_cts_rts",
  78. "uart2_0", "uart2_1", "uart0", "uart1", "uart2",
  79. };
  80. static const char *mt7986_wdt_groups[] = { "watchdog", };