SD Card Detect Active High Detection Problem

We’ve recently had to change our Micro-CD card header. The card detect switch in the new header has the opposite operation as our previous header and due to the existing circuitry we’re forced to use an active-high card detect. We’re finding that the card is detected on boot-up, but if the card is removed and re-inserted during operation it is not detected.

We’ve based our device tree on imx6dl-colibri-eval-v3.dts tree and we’ve made the following mods to the tree:
Module Level: &usdhc1{ … cd-gpios = <&gpio2 5 GPIO_ACITVE_HIGH>; …};
Carrier Board Level: &usdhc1 { enable-active-high; … }

Because it’s successfully detected and auto-mounted at boot I think the dev tree is probably ok. Is there anything we could be missing that could cause the card to not be re-detected after removal?

Hi

Did you try to not invert the signal two times?

e.g. to either change from ‘GPIO_ACITVE_LOW’ to ‘GPIO_ACITVE_HIGH’ or to add ‘enable-active-high’ but not both.

Max

Hi Max, thanks for the response. Yes, we’ve tried each of those individually with no luck.

Hi

I tried it out. For me both solutions, either with a device tree property or with setting GPIO_ACTIVE_HIGH a logic ‘1’ on the cd gpio is interpreted as an inserted card.

Note that the boolean property is named ‘cd-inverted’, not ‘enable-active-high’. See the device-tree bindings here.

Did you compile and deploy your changed device tree and did you make sure that U-Boot then loads the device-tree which you changed and not some other, unchanged one?

Max

--- a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
@@ -998,6 +998,7 @@
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_usdhc1 &pinctrl_mmc_cd>;
        cd-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
+       cd-inverted;
        disable-wp;
        enable-sdio-wakeup;
        keep-power-in-suspend;

or

--- a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
@@ -997,7 +997,7 @@
        label = "MMC1";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_usdhc1 &pinctrl_mmc_cd>;
-       cd-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
+       cd-gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>;
        disable-wp;
        enable-sdio-wakeup;
        keep-power-in-suspend;