User`s guide

Adding Support for the i.MX53 ESDHC
i.MX53 System Development User’s Guide, Rev. 1
15-4 Freescale Semiconductor
400 KHz and 50 MHz. sdhc_get_card_det_status() and sdhc_write_protect() functions are used for card
detection and write protection.
15.2.4 Setting Up Card Detection
The SD connector includes an output pin (CD) that changes its state according to the card insertion status.
In some cases, CD is not connected to the processor. In those cases, the function should return true to signal
that the card is always connected. When CD is connected, the SD card connector triggers the load of the
SD into the available devices. After insertion, the system detects the SD and loads the MMC device under
/dev folder (/dev/mmcblk*).
To set up card detection, first modify sdhc_get_card_det_status() function by adding an entry for your SD
device for detecting when the SD card has been inserted in the slot. This function is located under your
platform at <ltib>/linux/arch/arm/mach-mx5/mx53_<board name>.c
static unsigned int sdhc_get_card_det_status(struct device *dev){
int ret;
// SD's Card support for i.MX53 <custom board name>
if (board_is_mx53_<custom board>()) { // SD1 Card support for i.MX53 <custom board name>
if (to_platform_device(dev)->id == 0) {
ret = gpio_get_value(IOMUX_TO_GPIO(MX53_PIN_GPIO_1));
}
// SD2 Card support for i.MX53 <custom board name>
else if(to_platform_device(dev)->id == 1) {
ret = gpio_get_value(IOMUX_TO_GPIO(MX53_PIN_GPIO_4));
}
// SD3 Card support for i.MX53 <custom board name>
else if(to_platform_device(dev)->id == 2) {
ret = 1;
}
// SD4 Card support for i.MX53 <custom board name>
else if(to_platform_device(dev)->id == 3) {
ret = 1;
}
else {
ret = 1;
} // SD's Card support for i.MX53 Default Board
} else {
if (to_platform_device(dev)->id == 0) {
ret = gpio_get_value(IOMUX_TO_GPIO(MX53_PIN_EIM_DA13));
} else{ /* config the det pin for SDHC3 */
ret = gpio_get_value(IOMUX_TO_GPIO(MX53_PIN_EIM_DA11));
}
}
return ret;
}
Next, configure the pin as a general purpose input in the platform GPIO file located at
<ltib>/linux/arch/arm/mach-mx5/mx53_<board name>_gpio.c.
static struct mxc_iomux_pin_cfg __initdata mx53_<board name>_iomux_pins[] = {
...
{ /* SDHC2 SD_CD */
MX53_PIN_GPIO_4, IOMUX_CONFIG_GPIO,
},