0007-pinctrl-gemini-Fix-GMAC-groups.patch 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. From e7759c44e0c20dd6b5a259300acdc7350ea6dd32 Mon Sep 17 00:00:00 2001
  2. From: Linus Walleij <[email protected]>
  3. Date: Mon, 6 Nov 2017 21:27:34 +0100
  4. Subject: [PATCH 07/31] pinctrl: gemini: Fix GMAC groups
  5. The GMII groups need to be split across GMAC0 and GMAC1 since
  6. GMAC0 is always available but GMAC1 masks GPIO2 lines 0-7
  7. so we might want just one interface out.
  8. Signed-off-by: Linus Walleij <[email protected]>
  9. ---
  10. drivers/pinctrl/pinctrl-gemini.c | 79 +++++++++++++++++++++++++++-------------
  11. 1 file changed, 54 insertions(+), 25 deletions(-)
  12. --- a/drivers/pinctrl/pinctrl-gemini.c
  13. +++ b/drivers/pinctrl/pinctrl-gemini.c
  14. @@ -96,6 +96,13 @@ struct gemini_pin_group {
  15. * you are stuck with it.
  16. */
  17. #define GLOBAL_MISC_CTRL 0x30
  18. +#define GEMINI_GMAC_IOSEL_MASK GENMASK(28, 27)
  19. +/* Not really used */
  20. +#define GEMINI_GMAC_IOSEL_GMAC0_GMII BIT(28)
  21. +/* Activated with GMAC1 */
  22. +#define GEMINI_GMAC_IOSEL_GMAC0_GMAC1_RGMII BIT(27)
  23. +/* This will be the default */
  24. +#define GEMINI_GMAC_IOSEL_GMAC0_RGMII_GMAC1_GPIO2 0
  25. #define TVC_CLK_PAD_ENABLE BIT(20)
  26. #define PCI_CLK_PAD_ENABLE BIT(17)
  27. #define LPC_CLK_PAD_ENABLE BIT(16)
  28. @@ -109,8 +116,8 @@ struct gemini_pin_group {
  29. #define NAND_PADS_DISABLE BIT(2)
  30. #define PFLASH_PADS_DISABLE BIT(1)
  31. #define SFLASH_PADS_DISABLE BIT(0)
  32. -#define PADS_MASK (GENMASK(9, 0) | BIT(16) | BIT(17) | BIT(20))
  33. -#define PADS_MAXBIT 20
  34. +#define PADS_MASK (GENMASK(9, 0) | BIT(16) | BIT(17) | BIT(20) | BIT(27))
  35. +#define PADS_MAXBIT 27
  36. /* Ordered by bit index */
  37. static const char * const gemini_padgroups[] = {
  38. @@ -516,9 +523,12 @@ static const unsigned int usb_3512_pins[
  39. };
  40. /* GMII, ethernet pins */
  41. -static const unsigned int gmii_3512_pins[] = {
  42. - 311, 240, 258, 276, 294, 312, 241, 259, 277, 295, 313, 242, 260, 278, 296,
  43. - 315, 297, 279, 261, 243, 316, 298, 280, 262, 244, 317, 299, 281
  44. +static const unsigned int gmii_gmac0_3512_pins[] = {
  45. + 240, 241, 242, 258, 259, 260, 276, 277, 278, 294, 295, 311, 312, 313
  46. +};
  47. +
  48. +static const unsigned int gmii_gmac1_3512_pins[] = {
  49. + 243, 244, 261, 262, 279, 280, 281, 296, 297, 298, 299, 315, 316, 317
  50. };
  51. static const unsigned int pci_3512_pins[] = {
  52. @@ -668,10 +678,10 @@ static const unsigned int gpio1c_3512_pi
  53. /* The GPIO1D (28-31) pins overlap with LCD and TVC */
  54. static const unsigned int gpio1d_3512_pins[] = { 246, 319, 301, 283 };
  55. -/* The GPIO2A (0-3) pins overlap with GMII and extended parallel flash */
  56. +/* The GPIO2A (0-3) pins overlap with GMII GMAC1 and extended parallel flash */
  57. static const unsigned int gpio2a_3512_pins[] = { 315, 297, 279, 261 };
  58. -/* The GPIO2B (4-7) pins overlap with GMII, extended parallel flash and LCD */
  59. +/* The GPIO2B (4-7) pins overlap with GMII GMAC1, extended parallel flash and LCD */
  60. static const unsigned int gpio2b_3512_pins[] = { 262, 244, 317, 299 };
  61. /* The GPIO2C (8-31) pins overlap with PCI */
  62. @@ -738,9 +748,16 @@ static const struct gemini_pin_group gem
  63. .num_pins = ARRAY_SIZE(usb_3512_pins),
  64. },
  65. {
  66. - .name = "gmiigrp",
  67. - .pins = gmii_3512_pins,
  68. - .num_pins = ARRAY_SIZE(gmii_3512_pins),
  69. + .name = "gmii_gmac0_grp",
  70. + .pins = gmii_gmac0_3512_pins,
  71. + .num_pins = ARRAY_SIZE(gmii_gmac0_3512_pins),
  72. + },
  73. + {
  74. + .name = "gmii_gmac1_grp",
  75. + .pins = gmii_gmac1_3512_pins,
  76. + .num_pins = ARRAY_SIZE(gmii_gmac1_3512_pins),
  77. + /* Bring out RGMII on the GMAC1 pins */
  78. + .value = GEMINI_GMAC_IOSEL_GMAC0_GMAC1_RGMII,
  79. },
  80. {
  81. .name = "pcigrp",
  82. @@ -954,14 +971,15 @@ static const struct gemini_pin_group gem
  83. .name = "gpio2agrp",
  84. .pins = gpio2a_3512_pins,
  85. .num_pins = ARRAY_SIZE(gpio2a_3512_pins),
  86. - /* Conflict with GMII and extended parallel flash */
  87. + .mask = GEMINI_GMAC_IOSEL_GMAC0_GMAC1_RGMII,
  88. + /* Conflict with GMII GMAC1 and extended parallel flash */
  89. },
  90. {
  91. .name = "gpio2bgrp",
  92. .pins = gpio2b_3512_pins,
  93. .num_pins = ARRAY_SIZE(gpio2b_3512_pins),
  94. - /* Conflict with GMII, extended parallel flash and LCD */
  95. - .mask = LCD_PADS_ENABLE,
  96. + /* Conflict with GMII GMAC1, extended parallel flash and LCD */
  97. + .mask = LCD_PADS_ENABLE | GEMINI_GMAC_IOSEL_GMAC0_GMAC1_RGMII,
  98. },
  99. {
  100. .name = "gpio2cgrp",
  101. @@ -1441,9 +1459,12 @@ static const unsigned int usb_3516_pins[
  102. };
  103. /* GMII, ethernet pins */
  104. -static const unsigned int gmii_3516_pins[] = {
  105. - 306, 307, 308, 309, 310, 325, 326, 327, 328, 329, 330, 345, 346, 347,
  106. - 348, 349, 350, 351, 367, 368, 369, 370, 371, 386, 387, 389, 390, 391
  107. +static const unsigned int gmii_gmac0_3516_pins[] = {
  108. + 306, 307, 325, 326, 327, 328, 345, 346, 347, 348, 367, 368, 386, 387
  109. +};
  110. +
  111. +static const unsigned int gmii_gmac1_3516_pins[] = {
  112. + 308, 309, 310, 329, 330, 349, 350, 351, 369, 370, 371, 389, 390, 391
  113. };
  114. static const unsigned int pci_3516_pins[] = {
  115. @@ -1585,10 +1606,10 @@ static const unsigned int gpio1c_3516_pi
  116. /* The GPIO1D (28-31) pins overlap with TVC */
  117. static const unsigned int gpio1d_3516_pins[] = { 353, 311, 394, 374 };
  118. -/* The GPIO2A (0-3) pins overlap with GMII and extended parallel flash */
  119. +/* The GPIO2A (0-3) pins overlap with GMII GMAC1 and extended parallel flash */
  120. static const unsigned int gpio2a_3516_pins[] = { 308, 369, 389, 329 };
  121. -/* The GPIO2B (4-7) pins overlap with GMII, extended parallel flash and LCD */
  122. +/* The GPIO2B (4-7) pins overlap with GMII GMAC1, extended parallel flash and LCD */
  123. static const unsigned int gpio2b_3516_pins[] = { 391, 351, 310, 371 };
  124. /* The GPIO2C (8-31) pins overlap with PCI */
  125. @@ -1660,9 +1681,16 @@ static const struct gemini_pin_group gem
  126. .num_pins = ARRAY_SIZE(usb_3516_pins),
  127. },
  128. {
  129. - .name = "gmiigrp",
  130. - .pins = gmii_3516_pins,
  131. - .num_pins = ARRAY_SIZE(gmii_3516_pins),
  132. + .name = "gmii_gmac0_grp",
  133. + .pins = gmii_gmac0_3516_pins,
  134. + .num_pins = ARRAY_SIZE(gmii_gmac0_3516_pins),
  135. + },
  136. + {
  137. + .name = "gmii_gmac1_grp",
  138. + .pins = gmii_gmac1_3516_pins,
  139. + .num_pins = ARRAY_SIZE(gmii_gmac1_3516_pins),
  140. + /* Bring out RGMII on the GMAC1 pins */
  141. + .value = GEMINI_GMAC_IOSEL_GMAC0_GMAC1_RGMII,
  142. },
  143. {
  144. .name = "pcigrp",
  145. @@ -1861,14 +1889,15 @@ static const struct gemini_pin_group gem
  146. .name = "gpio2agrp",
  147. .pins = gpio2a_3516_pins,
  148. .num_pins = ARRAY_SIZE(gpio2a_3516_pins),
  149. - /* Conflict with GMII and extended parallel flash */
  150. + .mask = GEMINI_GMAC_IOSEL_GMAC0_GMAC1_RGMII,
  151. + /* Conflict with GMII GMAC1 and extended parallel flash */
  152. },
  153. {
  154. .name = "gpio2bgrp",
  155. .pins = gpio2b_3516_pins,
  156. .num_pins = ARRAY_SIZE(gpio2b_3516_pins),
  157. - /* Conflict with GMII, extended parallel flash and LCD */
  158. - .mask = LCD_PADS_ENABLE,
  159. + /* Conflict with GMII GMAC1, extended parallel flash and LCD */
  160. + .mask = LCD_PADS_ENABLE | GEMINI_GMAC_IOSEL_GMAC0_GMAC1_RGMII,
  161. },
  162. {
  163. .name = "gpio2cgrp",
  164. @@ -1971,7 +2000,7 @@ static const char * const icegrps[] = {
  165. static const char * const idegrps[] = { "idegrp" };
  166. static const char * const satagrps[] = { "satagrp" };
  167. static const char * const usbgrps[] = { "usbgrp" };
  168. -static const char * const gmiigrps[] = { "gmiigrp" };
  169. +static const char * const gmiigrps[] = { "gmii_gmac0_grp", "gmii_gmac1_grp" };
  170. static const char * const pcigrps[] = { "pcigrp" };
  171. static const char * const lpcgrps[] = { "lpcgrp" };
  172. static const char * const lcdgrps[] = { "lcdgrp" };