mmc: core: use the broken-cd for non-removable card
PATCH v2 8/8 mmc: core: use the broken-cd for non-removable card
Some SoC is used the broken card-detection.
And it should be also used the "non-removable".
Even if card is "non-removable", it didn't always use the cd-gpio.
If it's used only broken-cd, then card-detect interrupt is polling.
--- drivers/mmc/core/core.c | 4 ++-- drivers/mmc/core/host.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/mmc/core/core.c +2 -2
@@ -2460,8 +2460,8 @@ void mmc_rescan(struct work_struct *work)*/ mmc_bus_put (host); -if (!(host->caps &MMC_CAP_NONREMOVABLE ) && host->ops->get_cd && - host->ops->get_cd (host) ==0 ) { +if (host->ops->get_cd && host->ops->get_cd (host) ==0 && + !(host->caps &MMC_CAP_NONREMOVABLE )) {mmc_claim_host (host);mmc_power_off (host);mmc_release_host (host);
drivers/mmc/core/host.c +3 -3
@@ -356,6 +356,9 @@ int mmc_of_parse(struct mmc_host *host)* configuration is performed. */ +if (of_find_property (np,"broken-cd" , &len)) + host->caps |=MMC_CAP_NEEDS_POLL ; +/* Parse Card Detection */ if (of_find_property (np,"non-removable" , &len)) { host->caps |=MMC_CAP_NONREMOVABLE ;
@@ -364,9 +367,6 @@ int mmc_of_parse(struct mmc_host *host) explicit_inv_cd =of_property_read_bool (np,"cd-inverted" ); -if (of_find_property (np,"broken-cd" , &len)) - host->caps |=MMC_CAP_NEEDS_POLL ; - gpio =of_get_named_gpio_flags (np,"cd-gpios" ,0 , &flags);if (gpio == -EPROBE_DEFER )return gpio;
Signature · 1 line
1.7.9.5
Quoted 17 lines · Jaehoon Chung
Some SoC is used the broken card-detection.
And it should be also used the "non-removable".
Even if card is "non-removable", it didn't always use the cd-gpio.If it's used only broken-cd, then card-detect interrupt is polling.
Signed-off-by Jaehoon Chung <[email protected]>--- drivers/mmc/core/core.c | 4 ++-- drivers/mmc/core/host.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)drivers/mmc/core/core.c +0
-0
drivers/mmc/core/core.c void mmc_rescan(struct work_struct *work) · line 2464
Quoted 7 lines
drivers/mmc/core/core.c +2
-2@@ -2460,8 +2460,8 @@ void mmc_rescan(struct work_struct *work)*/ mmc_bus_put (host); -if (!(host->caps &MMC_CAP_NONREMOVABLE ) && host->ops->get_cd && - host->ops->get_cd (host) ==0 ) { +if (host->ops->get_cd && host->ops->get_cd (host) ==0 && + !(host->caps &MMC_CAP_NONREMOVABLE )) {
What's the difference here?
Quoted 8 lines
drivers/mmc/core/core.c +0
-0mmc_claim_host (host);mmc_power_off (host);mmc_release_host (host);drivers/mmc/core/host.c +0
-0
drivers/mmc/core/host.c int mmc_of_parse(struct mmc_host *host) · line 361
Quoted 6 lines
drivers/mmc/core/host.c +3
-0@@ -356,6 +356,9 @@ int mmc_of_parse(struct mmc_host *host)* configuration is performed. */ +if (of_find_property (np,"broken-cd" , &len)) + host->caps |=MMC_CAP_NEEDS_POLL ; +
No. There are no meaning in using MMC_CAP_NEEDS_POLL in conjunction with MMC_CAP_NONREMOVABLE.
Using MMC_CAP_NONREMOVABLE, will allow mmc_rescan to detect a card - only for one iteration. Thus MMC_CAP_NEEDS_POLL will have no effect.
Kind regards
Uffe
Quoted 15 lines
drivers/mmc/core/host.c +0
-4/* Parse Card Detection */ if (of_find_property (np,"non-removable" , &len)) { host->caps |=MMC_CAP_NONREMOVABLE ;@@ -364,9 +367,6 @@ int mmc_of_parse(struct mmc_host *host) explicit_inv_cd =of_property_read_bool (np,"cd-inverted" ); -if (of_find_property (np,"broken-cd" , &len)) - host->caps |=MMC_CAP_NEEDS_POLL ; - gpio =of_get_named_gpio_flags (np,"cd-gpios" ,0 , &flags);if (gpio == -EPROBE_DEFER )return gpio; --1.7.9.5
Dear, Ulf.
Quoted 21 lines · Ulf Hansson
Quoted 20 lines · Jaehoon Chung
Some SoC is used the broken card-detection.
And it should be also used the "non-removable".
Even if card is "non-removable", it didn't always use the cd-gpio.If it's used only broken-cd, then card-detect interrupt is polling.
Signed-off-by Jaehoon Chung <[email protected]>--- drivers/mmc/core/core.c | 4 ++-- drivers/mmc/core/host.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)drivers/mmc/core/core.c +0
-0@@ -2460,8 +2460,8 @@ void mmc_rescan(struct work_struct *work)*/ mmc_bus_put (host);
Quoted 6 lines
drivers/mmc/core/core.c void mmc_rescan(struct work_struct *work) · line 2464
Quoted 4 lines
drivers/mmc/core/core.c +2
-2-if (!(host->caps &MMC_CAP_NONREMOVABLE ) && host->ops->get_cd && - host->ops->get_cd (host) ==0 ) { +if (host->ops->get_cd && host->ops->get_cd (host) ==0 && + !(host->caps &MMC_CAP_NONREMOVABLE )) {What's the difference here?
eMMC is non-removable card. So i added the "non-removable" property at dt file. Then first checking !(host->caps & MMC_CAP_NONREMOVABLE), and didn't call get_cd(). In case of dw-mmc.c, after calling get_cd(), CARD_PRESENT bit is set at dw_mci_get_cd(). I didn't check other driver how it work.
If you didn't this change, i will change the dw-mmc controller.
Quoted 19 lines
Quoted 9 lines
drivers/mmc/core/core.c +0
-0mmc_claim_host (host);mmc_power_off (host);mmc_release_host (host);drivers/mmc/core/host.c +0
-0drivers/mmc/core/host.c int mmc_of_parse(struct mmc_host *host) · line 361
Quoted 6 lines
drivers/mmc/core/host.c +3
-0@@ -356,6 +356,9 @@ int mmc_of_parse(struct mmc_host *host)* configuration is performed. */ +if (of_find_property (np,"broken-cd" , &len)) + host->caps |=MMC_CAP_NEEDS_POLL ; +No. There are no meaning in using
MMC_CAP_NEEDS_POLLin conjunction withMMC_CAP_NONREMOVABLE.
Quoted 2 lines
Using
MMC_CAP_NONREMOVABLE, will allowmmc_rescanto detect a card - only for one iteration. ThusMMC_CAP_NEEDS_POLLwill have no effect.
Sorry. You're right. It's no meaning. I will maintain the original code.
Best Regards,
Jaehoon Chung
Quoted 25 lines
Kind regards
UffeQuoted 14 lines
drivers/mmc/core/host.c +0
-4/* Parse Card Detection */ if (of_find_property (np,"non-removable" , &len)) { host->caps |=MMC_CAP_NONREMOVABLE ;@@ -364,9 +367,6 @@ int mmc_of_parse(struct mmc_host *host) explicit_inv_cd =of_property_read_bool (np,"cd-inverted" ); -if (of_find_property (np,"broken-cd" , &len)) - host->caps |=MMC_CAP_NEEDS_POLL ; - gpio =of_get_named_gpio_flags (np,"cd-gpios" ,0 , &flags);if (gpio == -EPROBE_DEFER )return gpio; --Quoted 1 line
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 31 lines · Jaehoon Chung
Dear, Ulf.
Quoted 21 lines · Ulf Hansson
Quoted 20 lines · Jaehoon Chung
Some SoC is used the broken card-detection.
And it should be also used the "non-removable".
Even if card is "non-removable", it didn't always use the cd-gpio.If it's used only broken-cd, then card-detect interrupt is polling.
Signed-off-by Jaehoon Chung <[email protected]>--- drivers/mmc/core/core.c | 4 ++-- drivers/mmc/core/host.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)drivers/mmc/core/core.c +0
-0@@ -2460,8 +2460,8 @@ void mmc_rescan(struct work_struct *work)*/ mmc_bus_put (host);Quoted 6 lines
drivers/mmc/core/core.c void mmc_rescan(struct work_struct *work) · line 2464
Quoted 4 lines
drivers/mmc/core/core.c +2
-2-if (!(host->caps &MMC_CAP_NONREMOVABLE ) && host->ops->get_cd && - host->ops->get_cd (host) ==0 ) { +if (host->ops->get_cd && host->ops->get_cd (host) ==0 && + !(host->caps &MMC_CAP_NONREMOVABLE )) {What's the difference here?
Quoted 5 lines
eMMC is non-removable card. So i added the "non-removable" property at dt file. Then first checking !(host->caps &
MMC_CAP_NONREMOVABLE), and didn't callget_cd(). In case ofdw-mmc.c, after callingget_cd(),CARD_PRESENTbit is set atdw_mci_get_cd(). I didn't check other driver how it work.
If you didn't this change, i will change the dw-mmc controller.
Thanks for the clarification.
I would then suggest you to change in dw-mmc instead, since I think using the MMC_CAP_NONREMOVABLE flag, indicates that the .get_cd callback is not needed.
Kind regards
Ulf Hansson
Quoted 53 lines
Quoted 20 lines
Quoted 10 lines
drivers/mmc/core/core.c +0
-0mmc_claim_host (host);mmc_power_off (host);mmc_release_host (host);drivers/mmc/core/host.c +0
-0drivers/mmc/core/host.c int mmc_of_parse(struct mmc_host *host) · line 361
Quoted 6 lines
drivers/mmc/core/host.c +3
-0@@ -356,6 +356,9 @@ int mmc_of_parse(struct mmc_host *host)* configuration is performed. */ +if (of_find_property (np,"broken-cd" , &len)) + host->caps |=MMC_CAP_NEEDS_POLL ; +No. There are no meaning in using
MMC_CAP_NEEDS_POLLin conjunction withMMC_CAP_NONREMOVABLE.Quoted 2 lines
Using
MMC_CAP_NONREMOVABLE, will allowmmc_rescanto detect a card - only for one iteration. ThusMMC_CAP_NEEDS_POLLwill have no effect.Sorry. You're right. It's no meaning. I will maintain the original code.
Best Regards,
Jaehoon ChungQuoted 25 lines
Kind regards
UffeQuoted 14 lines
drivers/mmc/core/host.c +0
-4/* Parse Card Detection */ if (of_find_property (np,"non-removable" , &len)) { host->caps |=MMC_CAP_NONREMOVABLE ;@@ -364,9 +367,6 @@ int mmc_of_parse(struct mmc_host *host) explicit_inv_cd =of_property_read_bool (np,"cd-inverted" ); -if (of_find_property (np,"broken-cd" , &len)) - host->caps |=MMC_CAP_NEEDS_POLL ; - gpio =of_get_named_gpio_flags (np,"cd-gpios" ,0 , &flags);if (gpio == -EPROBE_DEFER )return gpio; --Quoted 1 line
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 38 lines · Ulf Hansson
Quoted 31 lines · Jaehoon Chung
Dear, Ulf.
Quoted 21 lines · Ulf Hansson
Quoted 20 lines · Jaehoon Chung
Some SoC is used the broken card-detection.
And it should be also used the "non-removable".
Even if card is "non-removable", it didn't always use the cd-gpio.If it's used only broken-cd, then card-detect interrupt is polling.
Signed-off-by Jaehoon Chung <[email protected]>--- drivers/mmc/core/core.c | 4 ++-- drivers/mmc/core/host.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)drivers/mmc/core/core.c +0
-0@@ -2460,8 +2460,8 @@ void mmc_rescan(struct work_struct *work)*/ mmc_bus_put (host);Quoted 6 lines
drivers/mmc/core/core.c void mmc_rescan(struct work_struct *work) · line 2464
Quoted 4 lines
drivers/mmc/core/core.c +2
-2-if (!(host->caps &MMC_CAP_NONREMOVABLE ) && host->ops->get_cd && - host->ops->get_cd (host) ==0 ) { +if (host->ops->get_cd && host->ops->get_cd (host) ==0 && + !(host->caps &MMC_CAP_NONREMOVABLE )) {What's the difference here?
Quoted 5 lines
eMMC is non-removable card. So i added the "non-removable" property at dt file. Then first checking !(host->caps &
MMC_CAP_NONREMOVABLE), and didn't callget_cd(). In case ofdw-mmc.c, after callingget_cd(),CARD_PRESENTbit is set atdw_mci_get_cd(). I didn't check other driver how it work.
If you didn't this change, i will change the dw-mmc controller.
Quoted 5 lines
Thanks for the clarification.
I would then suggest you to change in dw-mmc instead, since I think using the
MMC_CAP_NONREMOVABLEflag, indicates that the .get_cd callback is not needed.
It's reasonable. I will consider to change this into dw_mmc.c.
Best Regards,
Jaehoon Chung
Quoted 58 lines
Kind regards
Ulf HanssonQuoted 53 lines
Quoted 20 lines
Quoted 10 lines
drivers/mmc/core/core.c +0
-0mmc_claim_host (host);mmc_power_off (host);mmc_release_host (host);drivers/mmc/core/host.c +0
-0drivers/mmc/core/host.c int mmc_of_parse(struct mmc_host *host) · line 361
Quoted 6 lines
drivers/mmc/core/host.c +3
-0@@ -356,6 +356,9 @@ int mmc_of_parse(struct mmc_host *host)* configuration is performed. */ +if (of_find_property (np,"broken-cd" , &len)) + host->caps |=MMC_CAP_NEEDS_POLL ; +No. There are no meaning in using
MMC_CAP_NEEDS_POLLin conjunction withMMC_CAP_NONREMOVABLE.Quoted 2 lines
Using
MMC_CAP_NONREMOVABLE, will allowmmc_rescanto detect a card - only for one iteration. ThusMMC_CAP_NEEDS_POLLwill have no effect.Sorry. You're right. It's no meaning. I will maintain the original code.
Best Regards,
Jaehoon ChungQuoted 25 lines
Kind regards
UffeQuoted 14 lines
drivers/mmc/core/host.c +0
-4/* Parse Card Detection */ if (of_find_property (np,"non-removable" , &len)) { host->caps |=MMC_CAP_NONREMOVABLE ;@@ -364,9 +367,6 @@ int mmc_of_parse(struct mmc_host *host) explicit_inv_cd =of_property_read_bool (np,"cd-inverted" ); -if (of_find_property (np,"broken-cd" , &len)) - host->caps |=MMC_CAP_NEEDS_POLL ; - gpio =of_get_named_gpio_flags (np,"cd-gpios" ,0 , &flags);if (gpio == -EPROBE_DEFER )return gpio; --Quoted 1 line
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html