Skip to content

Commit 137cd71

Browse files
committed
ARM: dts: Enable Gemini flash access
Some Gemini platforms have a parallel NOR flash which conflicts with use cases reusing some of the flash lines (such as CE1) for GPIO. Fix this on the D-Link DIR-685 and Itian SQ201 by creating "enabled" and "disabled" states for the flash pin control handle, and rely on the flash handling code to switch this in and out when accessed so these lines can be used for GPIO when flash is not accessed, and enable flash access. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 738a05e commit 137cd71

File tree

2 files changed

+41
-25
lines changed

2 files changed

+41
-25
lines changed

arch/arm/boot/dts/gemini-dlink-dir-685.dts

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
gpio-sck = <&gpio1 5 GPIO_ACTIVE_HIGH>;
6565
gpio-miso = <&gpio1 8 GPIO_ACTIVE_HIGH>;
6666
gpio-mosi = <&gpio1 7 GPIO_ACTIVE_HIGH>;
67-
/* Collides with pflash CE1, not so cool */
6867
cs-gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
6968
num-chipselects = <1>;
7069

@@ -253,15 +252,18 @@
253252
soc {
254253
flash@30000000 {
255254
/*
256-
* Flash access is by default disabled, because it
257-
* collides with the Chip Enable signal for the display
258-
* panel, that reuse the parallel flash Chip Select 1
259-
* (CS1). Enabling flash makes graphics stop working.
260-
*
261-
* We might be able to hack around this by letting
262-
* GPIO poke around in the flash controller registers.
255+
* Flash access collides with the Chip Enable signal for
256+
* the display panel, that reuse the parallel flash Chip
257+
* Select 1 (CS1). We switch the pin control state so we
258+
* enable these pins for flash access only when we need
259+
* then, and when disabled they can be used for GPIO which
260+
* is what the display panel needs.
263261
*/
264-
/* status = "okay"; */
262+
status = "okay";
263+
pinctrl-names = "enabled", "disabled";
264+
pinctrl-0 = <&pflash_default_pins>;
265+
pinctrl-1 = <&pflash_disabled_pins>;
266+
265267
/* 32MB of flash */
266268
reg = <0x30000000 0x02000000>;
267269

@@ -327,7 +329,6 @@
327329
"gpio0cgrp",
328330
"gpio0egrp",
329331
"gpio0fgrp",
330-
"gpio0ggrp",
331332
"gpio0hgrp";
332333
};
333334
};
@@ -342,6 +343,18 @@
342343
groups = "gpio1bgrp";
343344
};
344345
};
346+
/*
347+
* These GPIO groups will be mapped in over some
348+
* of the flash pins when the flash is not in
349+
* active use.
350+
*/
351+
pflash_disabled_pins: pinctrl-pflash-disabled {
352+
mux {
353+
function = "gpio0";
354+
groups = "gpio0ggrp", "gpio0igrp", "gpio0jgrp",
355+
"gpio0kgrp";
356+
};
357+
};
345358
pinctrl-gmii {
346359
mux {
347360
function = "gmii";
@@ -430,7 +443,7 @@
430443
};
431444

432445
display-controller@6a000000 {
433-
status = "okay";
446+
status = "disabled";
434447

435448
port@0 {
436449
reg = <0>;

arch/arm/boot/dts/gemini-sq201.dts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,12 @@
4141
compatible = "gpio-leds";
4242
led-green-info {
4343
label = "sq201:green:info";
44-
/* Conflict with parallel flash */
4544
gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
4645
default-state = "on";
4746
linux,default-trigger = "heartbeat";
4847
};
4948
led-green-usb {
5049
label = "sq201:green:usb";
51-
/* Conflict with parallel and NAND flash */
5250
gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
5351
default-state = "off";
5452
linux,default-trigger = "usb-host";
@@ -126,15 +124,10 @@
126124

127125
soc {
128126
flash@30000000 {
129-
/*
130-
* Flash access can be enabled, with the side effect
131-
* of disabling access to GPIO LED on GPIO0[20] which
132-
* reuse one of the parallel flash chip select lines.
133-
* Also the default firmware on the machine has the
134-
* problem that since it uses the flash, the two LEDS
135-
* on the right become numb.
136-
*/
137-
/* status = "okay"; */
127+
status = "okay";
128+
pinctrl-names = "enabled", "disabled";
129+
pinctrl-0 = <&pflash_default_pins>;
130+
pinctrl-1 = <&pflash_disabled_pins>;
138131
/* 16MB of flash */
139132
reg = <0x30000000 0x01000000>;
140133

@@ -184,9 +177,7 @@
184177
mux {
185178
function = "gpio0";
186179
groups = "gpio0fgrp",
187-
"gpio0ggrp",
188-
"gpio0hgrp",
189-
"gpio0kgrp";
180+
"gpio0hgrp";
190181
};
191182
};
192183
/*
@@ -199,6 +190,18 @@
199190
groups = "gpio1dgrp";
200191
};
201192
};
193+
/*
194+
* These GPIO groups will be mapped in over some
195+
* of the flash pins when the flash is not in
196+
* active use.
197+
*/
198+
pflash_disabled_pins: pinctrl-pflash-disabled {
199+
mux {
200+
function = "gpio0";
201+
groups = "gpio0ggrp", "gpio0igrp", "gpio0jgrp",
202+
"gpio0kgrp";
203+
};
204+
};
202205
pinctrl-gmii {
203206
mux {
204207
function = "gmii";

0 commit comments

Comments
 (0)