Skip to contentSkip to conversation

arm: dts: imx7d-sdb: Fix enet by setting soft spi mode to 3 for extended io

PATCH New Christian Bräuner Sørensen 2 participants 2 messages Feb 19, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: dts: imx7d-sdb: Fix enet by setting soft spi mode to 3 for extended io

This patch sets SPI MODE 3 for the fairchild 74HC595 device that is used to reset the ethernet device, which fixes ethernet.

Reasoning:
The imx7dsabresd board uses SPI for setting the extended IO. One of the purposes of this extended IO, is having the ability to set ENET_RST i.e. reset the ethernet PHY. Without proper reset of the PHY, ethernet does not work.

commit 0e146993bb3d ("spi: add support for all spi modes with soft spi") broke network support for boards using imx7d-sdb, since it actually corrected default SPI mode setting for the software emulated soft_spi to 0, i.e. CPHA to 0 and CPOL to 0.
Previously, the driver defaulted to CPHA 1 and CPOL 1 (i.e. spi mode 3). After the default SPI mode is now 0 (which is the correct default value) we now need to actively set CPHA and CPOL to 1 for the specific devices that actually needs this.

---

 arch/arm/dts/imx7d-sdb.dts | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/dts/imx7d-sdb.dts +2 -0
index 8191ac7c33..6ed21ce8b0 100644
@@ -58,6 +58,8 @@
 			reg = <0>;
 			registers-number = <1>;
 			spi-max-frequency = <100000>;
+			spi-cpha;
+			spi-cpol;
 		};
 	};
 
Signature · 1 line
2.25.1
reviewer
#1 lore raw

PATCH 1/1 arm: dts: imx7d-sdb: Fix enet by setting soft spi mode to 3 for extended io

Hi Christian,

Quoted 4 lines · Christian Br?uner S?rensen

This patch sets SPI MODE 3 for the fairchild 74HC595 device that is used to reset the ethernet device, which fixes ethernet.

Quoted 8 lines

Reasoning:
The imx7dsabresd board uses SPI for setting the extended IO. One of the purposes of this extended IO, is having the ability to set ENET_RST i.e. reset the ethernet PHY. Without proper reset of the PHY, ethernet does not work.

commit 0e146993bb3d ("spi: add support for all spi modes with soft spi") broke network support for boards using imx7d-sdb, since it actually

Shouldn't this commit be reverted then?

I suppose it introduced regressions on other boards too.

Quoted 18 lines

corrected default SPI mode setting for the software emulated soft_spi to 0, i.e. CPHA to 0 and CPOL to 0.
Previously, the driver defaulted to CPHA 1 and CPOL 1 (i.e. spi mode 3). After the default SPI mode is now 0 (which is the correct default value) we now need to actively set CPHA and CPOL to 1 for the specific devices that actually needs this.

---

 arch/arm/dts/imx7d-sdb.dts | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/dts/imx7d-sdb.dts +0 -0
index 8191ac7c33..6ed21ce8b0 100644

arch/arm/dts/imx7d-sdb.dts line 62

Quoted 5 lines
arch/arm/dts/imx7d-sdb.dts +2 -0
@@ -58,6 +58,8 @@
                        reg = <0>;
                        registers-number = <1>;
                        spi-max-frequency = <100000>;
+                       spi-cpha
+                       spi-cpol;

It is not good that we deviate from the devicetree used in Linux.

Johannes/Jagan,

Any suggestions as to how to properly fix the regression?

Thanks