[PATCH] mmc: dw_mmc: fix dw_mci_get_cd
From: arnd@arndb.de (Arnd Bergmann)
Date: 2014-01-15 15:54:31
Also in:
linux-mmc
On Wednesday 15 January 2014, zhangfei wrote:
On 01/15/2014 10:38 PM, Seungwon Jeon wrote:quoted
quoted
Hmm, looks you are right. Though not see clearly mmc_gpio_get_cd declaratoin, other drivers directly set get_cd as mmc_gpio_get_cd. .get_cd = mmc_gpio_get_cd However, in our board cd =0 when card is deteced while cd=1 when card is removed. In order to mmc_gpio_get_cd return 1, MMC_CAP2_CD_ACTIVE_HIGH has to be set, as well as new property "caps2-mmc-cd-active-low".Ok, you could do more. mmc_gpio_get_cd() is expected to return non-zero if card is detection.quoted
I think your board seems not to use pull-up on GPIO line for card detection. So, MMC_CAP2_CD_ACTIVE_HIGH would be needed.Unfortunately, the specific cd pin can not be configured. Suspect on our board the cd =1 when card is inserted, can not measure as no clear resister and need check with hardware guy tomorrow. "cd-inverted" may be required as mentioned by Arnd. Will update the patch as following if no problem.
The patch looks right, but I wonder if a better longer-term solution would be to just the common mmc_of_parse() function rather than duplicating it in dw_mmc. Arnd