[source] apm821xx: detect sd-card media changes for the WNDR4700

LEDE Commits lede-commits at lists.infradead.org
Thu Sep 8 04:40:11 PDT 2016


blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/f7c1d9c8a551dea1dfe50cbac4d84f949191887d

commit f7c1d9c8a551dea1dfe50cbac4d84f949191887d
Author: Christian Lamparter <chunkeey at googlemail.com>
AuthorDate: Tue Aug 30 19:42:38 2016 +0200

    apm821xx: detect sd-card media changes for the WNDR4700
    
    The insertion or removal of the sd-card cannot be detected
    by the hardware itself. This is by design. To workaround this,
    for the WNDR4700 unload/load the dwc2 module in case the
    the special SD CARD GPIO line is low/high.
    
    Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 target/linux/apm821xx/base-files/etc/rc.button/BTN_1 | 19 +++++++++++++++++++
 target/linux/apm821xx/dts/wndr4700.dts               |  2 +-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/target/linux/apm821xx/base-files/etc/rc.button/BTN_1 b/target/linux/apm821xx/base-files/etc/rc.button/BTN_1
new file mode 100755
index 0000000..9956412
--- /dev/null
+++ b/target/linux/apm821xx/base-files/etc/rc.button/BTN_1
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+. /lib/functions.sh
+. /lib/apm821xx.sh
+
+BOARD=$(apm821xx_board_name)
+
+if [ $BOARD == "wndr4700" ]; then
+	case "$ACTION" in
+	released)
+		rmmod dwc2
+	;;
+	pressed)
+		modprobe dwc2
+	;;
+	esac
+fi
+
+return 0
diff --git a/target/linux/apm821xx/dts/wndr4700.dts b/target/linux/apm821xx/dts/wndr4700.dts
index 9a2ceb9..caaf05b 100644
--- a/target/linux/apm821xx/dts/wndr4700.dts
+++ b/target/linux/apm821xx/dts/wndr4700.dts
@@ -432,7 +432,7 @@
 
 				sdcard {
 					label = "SDCard inserted";
-					gpios = <&GPIO0 7 0>;
+					gpios = <&GPIO0 7 1>;
 					linux,code = <0x101>; /* BTN_1 */
 				};
 			};



More information about the lede-commits mailing list