[PATCH linux dev-4.10 03/10] aspeed: barreleye: Debounce BMC_PWBTN_IN_N through devicetree

Andrew Jeffery andrew at aj.id.au
Thu Apr 27 16:08:16 AEST 2017


This is a breaking change for userspace, as the GPIO is now represented
as a key-code from a GPIO keyboard input.

Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
---
 arch/arm/boot/dts/aspeed-bmc-opp-barreleye.dts | 11 +++++++++++
 arch/arm/mach-aspeed/aspeed.c                  |  8 --------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-barreleye.dts b/arch/arm/boot/dts/aspeed-bmc-opp-barreleye.dts
index b1a482144370..47a6167b8e6c 100644
--- a/arch/arm/boot/dts/aspeed-bmc-opp-barreleye.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-opp-barreleye.dts
@@ -74,6 +74,17 @@
 			gpios = <&gpio ASPEED_GPIO(N, 7) GPIO_ACTIVE_HIGH>;
 		};
 	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+
+		gpioe0 {
+			gpios = <&gpio ASPEED_GPIO(E, 0) GPIO_ACTIVE_LOW>;
+			label = "bmc_pwbtn_in_n";
+			linux,code = <0>;
+			debounce-interval = <20>;
+		};
+	};
 };
 
 &pinctrl {
diff --git a/arch/arm/mach-aspeed/aspeed.c b/arch/arm/mach-aspeed/aspeed.c
index 21084c72aee7..2333670f5c1d 100644
--- a/arch/arm/mach-aspeed/aspeed.c
+++ b/arch/arm/mach-aspeed/aspeed.c
@@ -73,14 +73,6 @@ static void __init do_barreleye_setup(void)
 	writel(reg, AST_IO(AST_BASE_GPIO | 0x20));
 	writel(0xC738F20A, AST_IO(AST_BASE_GPIO | 0x24));
 	writel(0x0031FFAF, AST_IO(AST_BASE_GPIO | 0x80));
-
-	/* Select TIMER3 as debounce timer */
-	writel(0x00000001, AST_IO(AST_BASE_GPIO | 0x48));
-	writel(0x00000001, AST_IO(AST_BASE_GPIO | 0x4C));
-
-	/* Set debounce timer to 480000 cycles, with a pclk of 48MHz,
-	 * corresponds to 20 ms. This time was found by experimentation */
-	writel(0x000EA600, AST_IO(AST_BASE_GPIO | 0x58));
 }
 
 static void __init do_palmetto_setup(void)
-- 
2.9.3



More information about the openbmc mailing list