Micro SD card issues on custom TX2i-based board

Hello,
We finally solved the issue, it is a bug in the kernel shipped with the board. We solved it by setting the parameter override_active_level to false in the call to mmc_gpiod_request_cd in the mmc_gpiod_request_cd() call at drivers/mmc/core/host.c:236. (there are most likely more elegant ways to patch this, but we had already wasted enough time on this…).
In the device tree, the values we used are:

sdhci@3400000 {
	cd-gpios = <&tegra_main_gpio TEGRA_MAIN_GPIO(P, 5) 0>;
   	// wp-gpios = <&tegra_main_gpio TEGRA_MAIN_GPIO(P, 4) 0>;
	cd-inverted;
	// wp-inverted;
	uhs-mask = <0x8>;
	status = "okay";
};

Best,
Rob