If it is a customized board, have you added the IOMUX for the cd as GPIO?
Have you checked the cd in the debug fs ?
Besides you said it is basic, We have seen any valuable information you have provided. You have ever debug something.
Here is the example in i.MX6UL evk board, which has a very detailed debug skill in the following ticket.
And it is linux knowledge
Simple GPIO Example - quandry
407 &iomuxc {
408 pinctrl-names = "default";
409 pinctrl-0 = <&pinctrl_hog_1>;
410 imx6ul-evk {
411 pinctrl_hog_1: hoggrp-1 {
412 fsl,pins = <
413 MX6UL_PAD_LCD_RESET__WDOG1_WDOG_ANY 0x30b0
414 MX6UL_PAD_UART1_RTS_B__GPIO1_IO19 0x17059 /* SD1 CD */
415 MX6UL_PAD_GPIO1_IO05__USDHC1_VSELECT 0x17059 /* SD1 VSELECT */
416 MX6UL_PAD_GPIO1_IO09__GPIO1_IO09 0x17059 /* SD1 RESET */
417 >;
root@imx6ulevk:~# cat /sys/kernel/debug/gpio
GPIOs 0-31, platform/209c000.gpio, 209c000.gpio:
gpio-3 (tsc_X- ) in hi
gpio-9 (VSD_3V3 ) out lo
gpio-19 (2190000.usdhc cd ) in hi
GPIOs 32-63, platform/20a0000.gpio, 20a0000.gpio:
GPIOs 64-95, platform/20a4000.gpio, 20a4000.gpio:
GPIOs 96-127, platform/20a8000.gpio, 20a8000.gpio:
gpio-119 (? ) out lo
GPIOs 128-159, platform/20ac000.gpio, 20ac000.gpio:
gpio-131 (? ) out lo
gpio-132 (headset detect ) in lo
gpio-135 (spi32766.0 ) out lo
gpio-136 (? ) out lo
gpio-138 (spi4.14 ) out lo
gpio-139 (spi4.14 ) out lo