Skip to content

Commit

Permalink
arm64: dts: imx8mm-venice: Fix the SPI chipselect polarity
Browse files Browse the repository at this point in the history
The conversion of the spi-imx driver to use GPIO descriptors
in commit 8cdcd8a ("spi: imx/fsl-lpspi: Convert to GPIO descriptors")
helped to detect the following SPI chipselect polarity mismatch on an
imx6q-sabresd for example:

[    4.854337] m25p80@0 enforce active low on chipselect handle

Prior to the above commit, the chipselect polarity passed via cs-gpios
property was ignored and considered active-low.

The reason for such mismatch is clearly explained in the comments inside
drivers/gpio/gpiolib-of.c:

* SPI children have active low chip selects
* by default. This can be specified negatively
* by just omitting "spi-cs-high" in the
* device node, or actively by tagging on
* GPIO_ACTIVE_LOW as flag in the device
* tree. If the line is simultaneously
* tagged as active low in the device tree
* and has the "spi-cs-high" set, we get a
* conflict and the "spi-cs-high" flag will
* take precedence.

To properly represent the SPI chipselect polarity, change it to active-low
when the "spi-cs-high" property is absent.

Signed-off-by: Fabio Estevam <[email protected]>
Reviewed-By: Tim Harvey <[email protected]>
Signed-off-by: Shawn Guo <[email protected]>
  • Loading branch information
fabioestevam authored and Shawn Guo committed Sep 22, 2021
1 parent bdd166b commit c6fe862
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion arch/arm64/boot/dts/freescale/imx8mm-venice-gw71xx.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
&ecspi2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_spi2>;
cs-gpios = <&gpio5 13 GPIO_ACTIVE_HIGH>;
cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
status = "okay";
};

Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
&ecspi2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_spi2>;
cs-gpios = <&gpio5 13 GPIO_ACTIVE_HIGH>;
cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
status = "okay";
};

Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
&ecspi2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_spi2>;
cs-gpios = <&gpio5 13 GPIO_ACTIVE_HIGH>;
cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
status = "okay";
};

Expand Down

0 comments on commit c6fe862

Please sign in to comment.