"so probably is not configured as GPIO.."
- Double check this, it may help you to fix your problem. I was surprised, because even the iMX6 processor which we use has this SD_CD alternate feature, but they do not use it in software. They always configure the pin as GPIO.
"I´m currently using the EVK device tree"
- so, if they are using Card Detect and you are not connecting the pin to the SD slot, than software will not detect card on your board.
This is from device tree for OpenRex:
&usdhc2 { |
| pinctrl-names = "default"; |
| pinctrl-0 = <&pinctrl_usdhc2>; |
| bus-width = <4>; |
| cd-gpios = <&gpio1 4 0>; |
| wp-gpios = <&gpio1 2 0>; |
| no-1-8-v; |
| keep-power-in-suspend; |
| enable-sdio-wakeup; |
| status = "okay"; |
| }; |
pinctrl_usdhc2: usdhc2grp { |
| fsl,pins = < |
| MX6QDL_PAD_SD2_CMD__SD2_CMD 0x17059 |
| MX6QDL_PAD_SD2_CLK__SD2_CLK 0x10059 |
| MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17059 |
| MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059 |
| MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059 |
| MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17059 |
| MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x80000000 /* CD */ |
| MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 /* WP */ |
| >; |
| }; |
You can see, the software CD is using a pin configured as GPIO. Basically, if you set this GPIO with pull down internal resistor, than the software should always behave like a card is inserted. That is my theory, but I do not know if that will work
Also, maybe in your software it is configured differently.