AnsweredAssumed Answered

MMC/SD card removal/insertion not detected in Linux

Question asked by Christopher Braga on Oct 23, 2017

I have run in to the issue where adding or removing a SD card on the LS1088ARDB does not result in any response from Linux. No udev events or uevents are recorded in the kernel logs, and no udev events are seen when monitoring with "udevadm monitor". This issue is not with the SDHC itself, as I can perform both a firmware and Linux boot off of an SD card without issue. It is important to note that if Linux boots with an SD card present it is detected and the partitions within are properly enumerated, however removing the SD card is not detected and the /dev fs is not cleaned up. This can be seen below:

 

[ 4.018326] mmc0: new high speed SDHC card at address e624
[ 4.024100] mmcblk0: mmc0:e624 SL16G 14.8 GiB
[ 4.033159] mmcblk0: p1 p2 p3

 

 

The driver used by Linux for the eSDHC is sdhci-esdhc. As an interesting side note, if Linux boots up with no SD card inserted it detects "/dev/mmcblk0  /dev/mmcblk0boot0  /dev/mmcblk0boot1  /dev/mmcblk0rpmb". It is currently not clear to me why the MMC boot partitions (or any of the partitions) appear.

 

So far I have attempted the following solutions:

--------

1) Attempting to poll the device file (mmcblk0) does not cause the driver to re-query the card 

 

 

2) Investigation into the sysfs file system has not provided any device attributes that could be used to force the SDHC driver to re-enumerate the SD slot. It does not seem possible to force a re-scan like you would with a bus such as PCI.

 

3) I have confirmed that "IIC2_Base" within "Reset Configuration Word Status Register 13 (RCWSR13)" has been properly set to  "0b10 - SDHC_CD, SDHC_WP". The value of the register was read as 0x003fe05b.

 

4) Investigation into the SDHC registers indicates that the eSDHC "Interrupt signal enable register (IRQSIGEN)" located at address 2140038h currently contains the default value of 0x027f108b. From this result it can be see that the "Card interrupt interrupt enable (CINTIEN)" and "Card insertion interrupt enable (CINSIEN)" are not enabled by default. Likewise, the eSDHC register "Interrupt status enable register (IRQSTATEN)" at address 2140034h contains the default value of 0x027f108f and does not have "Card interrupt status enable (CINTSEN)" and "Card insertion status enable (CINSEN)" enabled.

 

Writing to these registers after booting into Linux to activate the card insertion and card interrupt enable fields unfortunately does not seem to have any effect in rectifying this issue. Once enabled no apparent change in behaviour is seen, and writing to the "Interrupt status register (IRQSTAT)" does not provoke a response.

----------


What is the cause of the SDHC controller not detecting SD card removal and addition? In addition, what is causing the SDHC controller to believe there are additional partitions present to begin with?

 

Any help with this issue would be greatly appreciated. At this point I am not sure how to proceed.

Outcomes