SDMMC3_CD and SDMMC3_WP were swapped, how can I do

Hi All,

it was a schematic mistake, SD slot symbol error and they were swapped.
it is hard to rework to correct it, do it possible to fix it by SW setting?

Yes.

You need to swap the roles of the pins in the kernel.

Go to

arch/arm/mach-tegra/board-ardbeg-sdhci.c

or your board’s equivalent file where the SDHCI initialization takes place.

Locate the relevant platform_data struct:

static struct tegra_sdhci_platform_data tegra_sdhci_platform_data2 = {
	.cd_gpio = ARDBEG_SD_CD,
	.wp_gpio = -1,
	.power_gpio = -1,
	.tap_delay = 0,
	.trim_delay = 0x3,
	.uhs_mask = MMC_UHS_MASK_SDR104 |
		MMC_UHS_MASK_DDR50 | MMC_UHS_MASK_SDR50,
/*	.max_clk = 12000000, */
};

Put your actual pins under .cd_gpio and .wp_gpio, rebuild and install the kernel.

Thanks!!! you saved me.
and if I don’t need WP, can I disable it, set it as Hi-Z?

Yes. Just passing -1 instead should be enough for the controller to ignore it.