* [PATCH v2 5/5] mmc: dw-mmc: fix the present flags for card detect
@ 2012-08-28 7:55 Jaehoon Chung
2012-08-28 14:04 ` Thomas Abraham
0 siblings, 1 reply; 3+ messages in thread
From: Jaehoon Chung @ 2012-08-28 7:55 UTC (permalink / raw)
To: linux-mmc
Cc: Chris Ball, Kyungmin Park, Will Newton, James Hogan,
Thomas Abraham, Seungwon Jeon
dw_mci_get_cd() is registered to call-back function.
If call host->ops->get_cd(), host didn't set any card present flag.
Then host didn't know whether card is present or not.
This patch fixed them.
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Singed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/mmc/host/dw_mmc.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 3642455..8a87d38 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -909,10 +909,13 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
present = (mci_readl(slot->host, CDETECT) & (1 << slot->id))
== 0 ? 1 : 0;
- if (present)
+ if (present) {
+ set_bit(DW_MMC_CARD_PRESENT, &slot->flags);
dev_dbg(&mmc->class_dev, "card is present\n");
- else
+ } else {
+ clear_bit(DW_MMC_CARD_PRESENT, &slot->flags);
dev_dbg(&mmc->class_dev, "card is not present\n");
+ }
return present;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 5/5] mmc: dw-mmc: fix the present flags for card detect
2012-08-28 7:55 [PATCH v2 5/5] mmc: dw-mmc: fix the present flags for card detect Jaehoon Chung
@ 2012-08-28 14:04 ` Thomas Abraham
2012-08-29 1:51 ` Jaehoon Chung
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Abraham @ 2012-08-28 14:04 UTC (permalink / raw)
To: Jaehoon Chung
Cc: linux-mmc, Chris Ball, Kyungmin Park, Will Newton, James Hogan,
Seungwon Jeon
On 28 August 2012 13:25, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> dw_mci_get_cd() is registered to call-back function.
> If call host->ops->get_cd(), host didn't set any card present flag.
> Then host didn't know whether card is present or not.
> This patch fixed them.
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> Singed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> drivers/mmc/host/dw_mmc.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 3642455..8a87d38 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -909,10 +909,13 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
> present = (mci_readl(slot->host, CDETECT) & (1 << slot->id))
> == 0 ? 1 : 0;
>
> - if (present)
> + if (present) {
> + set_bit(DW_MMC_CARD_PRESENT, &slot->flags);
> dev_dbg(&mmc->class_dev, "card is present\n");
> - else
> + } else {
> + clear_bit(DW_MMC_CARD_PRESENT, &slot->flags);
> dev_dbg(&mmc->class_dev, "card is not present\n");
> + }
>
> return present;
> }
> --
> 1.7.4.1
Isn't this already done in dw_mci_init_slot() function and other
places in the driver? I have tested with card insert/removal multiple
times and did not notice any failure.
Thanks,
Thomas.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 5/5] mmc: dw-mmc: fix the present flags for card detect
2012-08-28 14:04 ` Thomas Abraham
@ 2012-08-29 1:51 ` Jaehoon Chung
0 siblings, 0 replies; 3+ messages in thread
From: Jaehoon Chung @ 2012-08-29 1:51 UTC (permalink / raw)
To: Thomas Abraham
Cc: Jaehoon Chung, linux-mmc, Chris Ball, Kyungmin Park, Will Newton,
James Hogan, Seungwon Jeon
On 08/28/2012 11:04 PM, Thomas Abraham wrote:
> On 28 August 2012 13:25, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>> dw_mci_get_cd() is registered to call-back function.
>> If call host->ops->get_cd(), host didn't set any card present flag.
>> Then host didn't know whether card is present or not.
>> This patch fixed them.
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> Singed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> ---
>> drivers/mmc/host/dw_mmc.c | 7 +++++--
>> 1 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
>> index 3642455..8a87d38 100644
>> --- a/drivers/mmc/host/dw_mmc.c
>> +++ b/drivers/mmc/host/dw_mmc.c
>> @@ -909,10 +909,13 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
>> present = (mci_readl(slot->host, CDETECT) & (1 << slot->id))
>> == 0 ? 1 : 0;
>>
>> - if (present)
>> + if (present) {
>> + set_bit(DW_MMC_CARD_PRESENT, &slot->flags);
>> dev_dbg(&mmc->class_dev, "card is present\n");
>> - else
>> + } else {
>> + clear_bit(DW_MMC_CARD_PRESENT, &slot->flags);
>> dev_dbg(&mmc->class_dev, "card is not present\n");
>> + }
>>
>> return present;
>> }
>> --
>> 1.7.4.1
>
> Isn't this already done in dw_mci_init_slot() function and other
> places in the driver? I have tested with card insert/removal multiple
> times and did not notice any failure.
In my case, use the external cd-gpio pin and use the mmc_gpio_request_cd().
In that case, if didn't insert SD-card when boot at first time,
at next time host didn't recognize Sd-card.
And it's no problem that the code is placed into get_cd().
Best Regards,
Jaehoon Chung
>
> Thanks,
> Thomas.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-08-29 1:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-28 7:55 [PATCH v2 5/5] mmc: dw-mmc: fix the present flags for card detect Jaehoon Chung
2012-08-28 14:04 ` Thomas Abraham
2012-08-29 1:51 ` Jaehoon Chung
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox