0008-ARM-dts-Enable-Gemini-flash-access.patch 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. From 74631102645df8984acbdf67b731e4d437f27fed Mon Sep 17 00:00:00 2001
  2. From: Linus Walleij <[email protected]>
  3. Date: Thu, 11 Oct 2018 20:06:23 +0200
  4. Subject: [PATCH 08/18] ARM: dts: Enable Gemini flash access
  5. Some Gemini platforms have a parallel NOR flash which conflicts
  6. with use cases reusing some of the flash lines (such as CE1)
  7. for GPIO.
  8. Fix this on the D-Link DIR-685 and Itian SQ201 by creating
  9. "enabled" and "disabled" states for the flash pin control
  10. handle, and rely on the flash handling code to switch this
  11. in and out when accessed so these lines can be used
  12. for GPIO when flash is not accessed, and enable flash
  13. access.
  14. Signed-off-by: Linus Walleij <[email protected]>
  15. ---
  16. arch/arm/boot/dts/gemini-dlink-dir-685.dts | 35 +++++++++++++++-------
  17. arch/arm/boot/dts/gemini-sq201.dts | 31 ++++++++++---------
  18. 2 files changed, 41 insertions(+), 25 deletions(-)
  19. --- a/arch/arm/boot/dts/gemini-dlink-dir-685.dts
  20. +++ b/arch/arm/boot/dts/gemini-dlink-dir-685.dts
  21. @@ -64,7 +64,6 @@
  22. gpio-sck = <&gpio1 5 GPIO_ACTIVE_HIGH>;
  23. gpio-miso = <&gpio1 8 GPIO_ACTIVE_HIGH>;
  24. gpio-mosi = <&gpio1 7 GPIO_ACTIVE_HIGH>;
  25. - /* Collides with pflash CE1, not so cool */
  26. cs-gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
  27. num-chipselects = <1>;
  28. @@ -253,15 +252,18 @@
  29. soc {
  30. flash@30000000 {
  31. /*
  32. - * Flash access is by default disabled, because it
  33. - * collides with the Chip Enable signal for the display
  34. - * panel, that reuse the parallel flash Chip Select 1
  35. - * (CS1). Enabling flash makes graphics stop working.
  36. - *
  37. - * We might be able to hack around this by letting
  38. - * GPIO poke around in the flash controller registers.
  39. + * Flash access collides with the Chip Enable signal for
  40. + * the display panel, that reuse the parallel flash Chip
  41. + * Select 1 (CS1). We switch the pin control state so we
  42. + * enable these pins for flash access only when we need
  43. + * then, and when disabled they can be used for GPIO which
  44. + * is what the display panel needs.
  45. */
  46. - /* status = "okay"; */
  47. + status = "okay";
  48. + pinctrl-names = "enabled", "disabled";
  49. + pinctrl-0 = <&pflash_default_pins>;
  50. + pinctrl-1 = <&pflash_disabled_pins>;
  51. +
  52. /* 32MB of flash */
  53. reg = <0x30000000 0x02000000>;
  54. @@ -327,7 +329,6 @@
  55. "gpio0cgrp",
  56. "gpio0egrp",
  57. "gpio0fgrp",
  58. - "gpio0ggrp",
  59. "gpio0hgrp";
  60. };
  61. };
  62. @@ -342,6 +343,18 @@
  63. groups = "gpio1bgrp";
  64. };
  65. };
  66. + /*
  67. + * These GPIO groups will be mapped in over some
  68. + * of the flash pins when the flash is not in
  69. + * active use.
  70. + */
  71. + pflash_disabled_pins: pinctrl-pflash-disabled {
  72. + mux {
  73. + function = "gpio0";
  74. + groups = "gpio0ggrp", "gpio0igrp", "gpio0jgrp",
  75. + "gpio0kgrp";
  76. + };
  77. + };
  78. pinctrl-gmii {
  79. mux {
  80. function = "gmii";
  81. @@ -430,7 +443,7 @@
  82. };
  83. display-controller@6a000000 {
  84. - status = "okay";
  85. + status = "disabled";
  86. port@0 {
  87. reg = <0>;
  88. --- a/arch/arm/boot/dts/gemini-sq201.dts
  89. +++ b/arch/arm/boot/dts/gemini-sq201.dts
  90. @@ -41,14 +41,12 @@
  91. compatible = "gpio-leds";
  92. led-green-info {
  93. label = "sq201:green:info";
  94. - /* Conflict with parallel flash */
  95. gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
  96. default-state = "on";
  97. linux,default-trigger = "heartbeat";
  98. };
  99. led-green-usb {
  100. label = "sq201:green:usb";
  101. - /* Conflict with parallel and NAND flash */
  102. gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
  103. default-state = "off";
  104. linux,default-trigger = "usb-host";
  105. @@ -126,15 +124,10 @@
  106. soc {
  107. flash@30000000 {
  108. - /*
  109. - * Flash access can be enabled, with the side effect
  110. - * of disabling access to GPIO LED on GPIO0[20] which
  111. - * reuse one of the parallel flash chip select lines.
  112. - * Also the default firmware on the machine has the
  113. - * problem that since it uses the flash, the two LEDS
  114. - * on the right become numb.
  115. - */
  116. - /* status = "okay"; */
  117. + status = "okay";
  118. + pinctrl-names = "enabled", "disabled";
  119. + pinctrl-0 = <&pflash_default_pins>;
  120. + pinctrl-1 = <&pflash_disabled_pins>;
  121. /* 16MB of flash */
  122. reg = <0x30000000 0x01000000>;
  123. @@ -184,9 +177,7 @@
  124. mux {
  125. function = "gpio0";
  126. groups = "gpio0fgrp",
  127. - "gpio0ggrp",
  128. - "gpio0hgrp",
  129. - "gpio0kgrp";
  130. + "gpio0hgrp";
  131. };
  132. };
  133. /*
  134. @@ -199,6 +190,18 @@
  135. groups = "gpio1dgrp";
  136. };
  137. };
  138. + /*
  139. + * These GPIO groups will be mapped in over some
  140. + * of the flash pins when the flash is not in
  141. + * active use.
  142. + */
  143. + pflash_disabled_pins: pinctrl-pflash-disabled {
  144. + mux {
  145. + function = "gpio0";
  146. + groups = "gpio0ggrp", "gpio0igrp", "gpio0jgrp",
  147. + "gpio0kgrp";
  148. + };
  149. + };
  150. pinctrl-gmii {
  151. mux {
  152. function = "gmii";