Skip to contentSkip to conversation

arm: mvebu: Enable gpio-fan for Thecus N2350 board

PATCH In review Tony Dinh 2 participants 3 messages Jun 20, 2023 – Jul 13, 2023 Arm (32-bit)

lore
Share & tools
lore

Tony Dinh

author
#0 lore raw

PATCH 1/1 arm: mvebu: Enable gpio-fan for Thecus N2350 board

Add gpio-fan in the DTS and enable the GPIO in board file to start the fan during boot.

Note that this patch depends on
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

---

 arch/arm/dts/armada-385-thecus-n2350.dts | 15 +++++++++++++++
 board/thecus/n2350/n2350.c               |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)
arch/arm/dts/armada-385-thecus-n2350.dts +15 -0
index 2ad5158c0c..253cf01130 100644
@@ -140,6 +140,16 @@
 		};
 	};
 
+	fan {
+		compatible = "gpio-fan";
+		gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>;
+		gpio-fan,speed-map = <	  0  0
+					600  1
+					3000 2 >;
+		pinctrl-0 = <&pmx_fan>;
+		pinctrl-names = "default";
+	};
+
 	usb3_0_power: v5-vbus0 {
 		compatible = "regulator-fixed";
 		regulator-name = "USB3_0_Power";
@@ -378,6 +388,11 @@
 		marvell,pins = "mpp17";
 		marvell,function = "gpio";
 	};
+
+	pmx_fan: pmx-fan {
+		marvell,pins = "mpp48";
+		marvell,function = "gpio";
+	};
 };
 
 &sdhci {
board/thecus/n2350/n2350.c +1 -1
index fd8f95f944..05b125fd7f 100644
@@ -25,7 +25,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define N2350_GPP_OUT_ENA_LOW	(~(BIT(20) | BIT(21) | BIT(24)))
 #define N2350_GPP_OUT_ENA_MID	(~(BIT(12) | BIT(13) | BIT(16) | BIT(19) | BIT(22)))
 #define N2350_GPP_OUT_VAL_LOW	(BIT(21) | BIT(24))
-#define N2350_GPP_OUT_VAL_MID	(BIT(0) | BIT(12) | BIT(13))
+#define N2350_GPP_OUT_VAL_MID	(BIT(0) | BIT(12) | BIT(13) | BIT(16))
 #define N2350_GPP_POL_LOW	0x0
 #define N2350_GPP_POL_MID	0x0
 
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Tony Dinh

Add gpio-fan in the DTS and enable the GPIO in board file to start the fan during boot.

Note that this patch depends on
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Thanks,
Stefan

Quoted 44 lines

---

  arch/arm/dts/armada-385-thecus-n2350.dts | 15 +++++++++++++++
  board/thecus/n2350/n2350.c               |  2 +-
  2 files changed, 16 insertions(+), 1 deletion(-)
arch/arm/dts/armada-385-thecus-n2350.dts +15 -0
index 2ad5158c0c..253cf01130 100644
@@ -140,6 +140,16 @@
  		};
  	};
 
+	fan {
+		compatible = "gpio-fan";
+		gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>;
+		gpio-fan,speed-map = <	  0  0
+					600  1
+					3000 2 >;
+		pinctrl-0 = <&pmx_fan>;
+		pinctrl-names = "default";
+	};
+
  	usb3_0_power: v5-vbus0 {
  		compatible = "regulator-fixed";
  		regulator-name = "USB3_0_Power";
@@ -378,6 +388,11 @@
  		marvell,pins = "mpp17";
  		marvell,function = "gpio";
  	};
+
+	pmx_fan: pmx-fan {
+		marvell,pins = "mpp48";
+		marvell,function = "gpio";
+	};
  };
 
  &sdhci {
board/thecus/n2350/n2350.c +0 -0
index fd8f95f944..05b125fd7f 100644

board/thecus/n2350/n2350.c DECLARE_GLOBAL_DATA_PTR; · line 31

Quoted 8 lines
board/thecus/n2350/n2350.c +1 -1
@@ -25,7 +25,7 @@ DECLARE_GLOBAL_DATA_PTR;
  #define N2350_GPP_OUT_ENA_LOW	(~(BIT(20) | BIT(21) | BIT(24)))
  #define N2350_GPP_OUT_ENA_MID	(~(BIT(12) | BIT(13) | BIT(16) | BIT(19) | BIT(22)))
  #define N2350_GPP_OUT_VAL_LOW	(BIT(21) | BIT(24))
-#define N2350_GPP_OUT_VAL_MID	(BIT(0) | BIT(12) | BIT(13))
+#define N2350_GPP_OUT_VAL_MID	(BIT(0) | BIT(12) | BIT(13) | BIT(16))
  #define N2350_GPP_POL_LOW	0x0
  #define N2350_GPP_POL_MID	0x0
 

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#2 lore raw
In reply to Tony Dinh
Quoted 7 lines · Tony Dinh

Add gpio-fan in the DTS and enable the GPIO in board file to start the fan during boot.

Note that this patch depends on
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Applied to u-boot-marvell/master

Thanks,
Stefan

Quoted 44 lines

---

  arch/arm/dts/armada-385-thecus-n2350.dts | 15 +++++++++++++++
  board/thecus/n2350/n2350.c               |  2 +-
  2 files changed, 16 insertions(+), 1 deletion(-)
arch/arm/dts/armada-385-thecus-n2350.dts +15 -0
index 2ad5158c0c..253cf01130 100644
@@ -140,6 +140,16 @@
  		};
  	};
 
+	fan {
+		compatible = "gpio-fan";
+		gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>;
+		gpio-fan,speed-map = <	  0  0
+					600  1
+					3000 2 >;
+		pinctrl-0 = <&pmx_fan>;
+		pinctrl-names = "default";
+	};
+
  	usb3_0_power: v5-vbus0 {
  		compatible = "regulator-fixed";
  		regulator-name = "USB3_0_Power";
@@ -378,6 +388,11 @@
  		marvell,pins = "mpp17";
  		marvell,function = "gpio";
  	};
+
+	pmx_fan: pmx-fan {
+		marvell,pins = "mpp48";
+		marvell,function = "gpio";
+	};
  };
 
  &sdhci {
board/thecus/n2350/n2350.c +0 -0
index fd8f95f944..05b125fd7f 100644

board/thecus/n2350/n2350.c DECLARE_GLOBAL_DATA_PTR; · line 31

Quoted 8 lines
board/thecus/n2350/n2350.c +1 -1
@@ -25,7 +25,7 @@ DECLARE_GLOBAL_DATA_PTR;
  #define N2350_GPP_OUT_ENA_LOW	(~(BIT(20) | BIT(21) | BIT(24)))
  #define N2350_GPP_OUT_ENA_MID	(~(BIT(12) | BIT(13) | BIT(16) | BIT(19) | BIT(22)))
  #define N2350_GPP_OUT_VAL_LOW	(BIT(21) | BIT(24))
-#define N2350_GPP_OUT_VAL_MID	(BIT(0) | BIT(12) | BIT(13))
+#define N2350_GPP_OUT_VAL_MID	(BIT(0) | BIT(12) | BIT(13) | BIT(16))
  #define N2350_GPP_POL_LOW	0x0
  #define N2350_GPP_POL_MID	0x0
 

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]