pinctrl-uniphier-sld3.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * Copyright (C) 2016 Socionext Inc.
  3. * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <dm/device.h>
  8. #include <dm/pinctrl.h>
  9. #include "pinctrl-uniphier.h"
  10. static const unsigned emmc_pins[] = {55, 56, 60};
  11. static const int emmc_muxvals[] = {1, 1, 1};
  12. static const unsigned emmc_dat8_pins[] = {57};
  13. static const int emmc_dat8_muxvals[] = {1};
  14. static const unsigned ether_mii_pins[] = {35, 107, 108, 109, 110, 111, 112,
  15. 113};
  16. static const int ether_mii_muxvals[] = {1, 2, 2, 2, 2, 2, 2, 2};
  17. static const unsigned ether_rmii_pins[] = {35};
  18. static const int ether_rmii_muxvals[] = {1};
  19. static const unsigned i2c0_pins[] = {36};
  20. static const int i2c0_muxvals[] = {0};
  21. static const unsigned nand_pins[] = {38, 39, 40, 58, 59};
  22. static const int nand_muxvals[] = {1, 1, 1, 1, 1};
  23. static const unsigned nand_cs1_pins[] = {41};
  24. static const int nand_cs1_muxvals[] = {1};
  25. static const unsigned sd_pins[] = {42, 43, 44, 45};
  26. static const int sd_muxvals[] = {1, 1, 1, 1};
  27. static const unsigned system_bus_pins[] = {46, 50, 51, 53, 54, 73, 74, 75, 76,
  28. 77, 78, 79, 80, 88, 89, 91, 92, 99};
  29. static const int system_bus_muxvals[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  30. 1, 1, 1, 1, 1};
  31. static const unsigned system_bus_cs0_pins[] = {93};
  32. static const int system_bus_cs0_muxvals[] = {1};
  33. static const unsigned system_bus_cs1_pins[] = {94};
  34. static const int system_bus_cs1_muxvals[] = {1};
  35. static const unsigned system_bus_cs2_pins[] = {95};
  36. static const int system_bus_cs2_muxvals[] = {1};
  37. static const unsigned system_bus_cs3_pins[] = {96};
  38. static const int system_bus_cs3_muxvals[] = {1};
  39. static const unsigned system_bus_cs4_pins[] = {81};
  40. static const int system_bus_cs4_muxvals[] = {1};
  41. static const unsigned system_bus_cs5_pins[] = {82};
  42. static const int system_bus_cs5_muxvals[] = {1};
  43. static const unsigned uart0_pins[] = {63, 64};
  44. static const int uart0_muxvals[] = {0, 1};
  45. static const unsigned uart1_pins[] = {65, 66};
  46. static const int uart1_muxvals[] = {0, 1};
  47. static const unsigned uart2_pins[] = {96, 102};
  48. static const int uart2_muxvals[] = {2, 2};
  49. static const unsigned usb0_pins[] = {13, 14};
  50. static const int usb0_muxvals[] = {0, 1};
  51. static const unsigned usb1_pins[] = {15, 16};
  52. static const int usb1_muxvals[] = {0, 1};
  53. static const unsigned usb2_pins[] = {17, 18};
  54. static const int usb2_muxvals[] = {0, 1};
  55. static const unsigned usb3_pins[] = {19, 20};
  56. static const int usb3_muxvals[] = {0, 1};
  57. static const struct uniphier_pinctrl_group uniphier_sld3_groups[] = {
  58. UNIPHIER_PINCTRL_GROUP_SPL(emmc),
  59. UNIPHIER_PINCTRL_GROUP_SPL(emmc_dat8),
  60. UNIPHIER_PINCTRL_GROUP(ether_mii),
  61. UNIPHIER_PINCTRL_GROUP(ether_rmii),
  62. UNIPHIER_PINCTRL_GROUP(i2c0),
  63. UNIPHIER_PINCTRL_GROUP(nand),
  64. UNIPHIER_PINCTRL_GROUP(nand_cs1),
  65. UNIPHIER_PINCTRL_GROUP(sd),
  66. UNIPHIER_PINCTRL_GROUP(system_bus),
  67. UNIPHIER_PINCTRL_GROUP(system_bus_cs0),
  68. UNIPHIER_PINCTRL_GROUP(system_bus_cs1),
  69. UNIPHIER_PINCTRL_GROUP(system_bus_cs2),
  70. UNIPHIER_PINCTRL_GROUP(system_bus_cs3),
  71. UNIPHIER_PINCTRL_GROUP(system_bus_cs4),
  72. UNIPHIER_PINCTRL_GROUP(system_bus_cs5),
  73. UNIPHIER_PINCTRL_GROUP_SPL(uart0),
  74. UNIPHIER_PINCTRL_GROUP_SPL(uart1),
  75. UNIPHIER_PINCTRL_GROUP_SPL(uart2),
  76. UNIPHIER_PINCTRL_GROUP(usb0),
  77. UNIPHIER_PINCTRL_GROUP(usb1),
  78. UNIPHIER_PINCTRL_GROUP(usb2),
  79. UNIPHIER_PINCTRL_GROUP(usb3)
  80. };
  81. static const char * const uniphier_sld3_functions[] = {
  82. UNIPHIER_PINMUX_FUNCTION_SPL(emmc),
  83. UNIPHIER_PINMUX_FUNCTION(ether_mii),
  84. UNIPHIER_PINMUX_FUNCTION(ether_rmii),
  85. UNIPHIER_PINMUX_FUNCTION(i2c0),
  86. UNIPHIER_PINMUX_FUNCTION(nand),
  87. UNIPHIER_PINMUX_FUNCTION(sd),
  88. UNIPHIER_PINMUX_FUNCTION(system_bus),
  89. UNIPHIER_PINMUX_FUNCTION_SPL(uart0),
  90. UNIPHIER_PINMUX_FUNCTION_SPL(uart1),
  91. UNIPHIER_PINMUX_FUNCTION_SPL(uart2),
  92. UNIPHIER_PINMUX_FUNCTION(usb0),
  93. UNIPHIER_PINMUX_FUNCTION(usb1),
  94. UNIPHIER_PINMUX_FUNCTION(usb2),
  95. UNIPHIER_PINMUX_FUNCTION(usb3),
  96. };
  97. static struct uniphier_pinctrl_socdata uniphier_sld3_pinctrl_socdata = {
  98. .groups = uniphier_sld3_groups,
  99. .groups_count = ARRAY_SIZE(uniphier_sld3_groups),
  100. .functions = uniphier_sld3_functions,
  101. .functions_count = ARRAY_SIZE(uniphier_sld3_functions),
  102. .caps = UNIPHIER_PINCTRL_CAPS_MUX_4BIT,
  103. };
  104. static int uniphier_sld3_pinctrl_probe(struct udevice *dev)
  105. {
  106. return uniphier_pinctrl_probe(dev, &uniphier_sld3_pinctrl_socdata);
  107. }
  108. static const struct udevice_id uniphier_sld3_pinctrl_match[] = {
  109. { .compatible = "socionext,uniphier-sld3-pinctrl" },
  110. { /* sentinel */ }
  111. };
  112. U_BOOT_DRIVER(uniphier_sld3_pinctrl) = {
  113. .name = "uniphier-sld3-pinctrl",
  114. .id = UCLASS_PINCTRL,
  115. .of_match = of_match_ptr(uniphier_sld3_pinctrl_match),
  116. .probe = uniphier_sld3_pinctrl_probe,
  117. .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv),
  118. .ops = &uniphier_pinctrl_ops,
  119. };