mmc: sdhci: UHS-II support, skip signal_voltage_switch()
RFC PATCH v3 13/21 mmc: sdhci: UHS-II support, skip signal_voltage_switch()
From: AKASHI Takahiro <[email protected]>
sdhci_start_signal_voltage_switch() should be called only in UHS-I mode, and not for UHS-II mode.
--- drivers/mmc/host/sdhci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +6 -1
@@ -2623,8 +2623,13 @@ int sdhci_start_signal_voltage_switch(struct mmc_host *mmc,/* * Signal Voltage Switching is only applicable for Host Controllers * v3.00 and above. +* But for UHS2, the signal voltage is supplied by vdd2 which is +* already 1.8v so no voltage switch required. */ -if (host->version <SDHCI_SPEC_300 ) +if (host->version <SDHCI_SPEC_300 || + (IS_ENABLED (CONFIG_MMC_SDHCI_UHS2 ) && + host->version >=SDHCI_SPEC_400 && + host->mmc->flags &MMC_UHS2_SUPPORT ))return 0 ; ctrl =sdhci_readw (host,SDHCI_HOST_CONTROL2 );
Signature · 1 line
2.27.0
Adrian Hunter
maintainerQuoted 17 lines · Ben Chuang
From: AKASHI Takahiro <[email protected]>
sdhci_start_signal_voltage_switch()should be called only in UHS-I mode, and not for UHS-II mode.Signed-off-by Ben Chuang <[email protected]>Signed-off-by AKASHI Takahiro <[email protected]>--- drivers/mmc/host/sdhci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci.c +0
-0@@ -2623,8 +2623,13 @@ int sdhci_start_signal_voltage_switch(struct mmc_host *mmc,/*
drivers/mmc/host/sdhci.c int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, · line 2632
Quoted 10 lines
drivers/mmc/host/sdhci.c +6
-1* Signal Voltage Switching is only applicable for Host Controllers * v3.00 and above. +* But for UHS2, the signal voltage is supplied by vdd2 which is +* already 1.8v so no voltage switch required. */ -if (host->version <SDHCI_SPEC_300 ) +if (host->version <SDHCI_SPEC_300 || + (IS_ENABLED (CONFIG_MMC_SDHCI_UHS2 ) && + host->version >=SDHCI_SPEC_400 && + host->mmc->flags &MMC_UHS2_SUPPORT ))
Please look at hooking ->start_signal_voltage_switch() instead
Quoted 4 lines
drivers/mmc/host/sdhci.c +0
-0return 0 ; ctrl =sdhci_readw (host,SDHCI_HOST_CONTROL2 );
Adrian,
Quoted 22 lines · Adrian Hunter
Quoted 21 lines · Ben Chuang
From: AKASHI Takahiro <[email protected]>
sdhci_start_signal_voltage_switch()should be called only in UHS-I mode, and not for UHS-II mode.Signed-off-by Ben Chuang <[email protected]>Signed-off-by AKASHI Takahiro <[email protected]>--- drivers/mmc/host/sdhci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci.c +2
-0@@ -2623,8 +2623,13 @@ int sdhci_start_signal_voltage_switch(struct mmc_host *mmc,/* * Signal Voltage Switching is only applicable for Host Controllers * v3.00 and above. +* But for UHS2, the signal voltage is supplied by vdd2 which is +* already 1.8v so no voltage switch required.
Quoted 8 lines
drivers/mmc/host/sdhci.c int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, · line 2632
Quoted 6 lines
drivers/mmc/host/sdhci.c +4
-1*/ -if (host->version <SDHCI_SPEC_300 ) +if (host->version <SDHCI_SPEC_300 || + (IS_ENABLED (CONFIG_MMC_SDHCI_UHS2 ) && + host->version >=SDHCI_SPEC_400 && + host->mmc->flags &MMC_UHS2_SUPPORT ))Please look at hooking ->start_signal_voltage_switch() instead
Do you mean that you want every platform driver who wants to support UHS-II to set NULL to start_signal_voltage_switch hook even if this hack is platform agnostic?
(Another option is that it would be put in sdhci_uhs2_add_host() which is responsible to set MMC_UHS2_SUPPORT.)
-Takahiro Akashi
Quoted 7 lines
Quoted 6 lines
drivers/mmc/host/sdhci.c +0
-0return 0 ; ctrl =sdhci_readw (host,SDHCI_HOST_CONTROL2 );
Adrian Hunter
maintainerQuoted 34 lines · AKASHI Takahiro
Adrian,
Quoted 22 lines · Adrian Hunter
Quoted 21 lines · Ben Chuang
From: AKASHI Takahiro <[email protected]>
sdhci_start_signal_voltage_switch()should be called only in UHS-I mode, and not for UHS-II mode.Signed-off-by Ben Chuang <[email protected]>Signed-off-by AKASHI Takahiro <[email protected]>--- drivers/mmc/host/sdhci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci.c +2
-0@@ -2623,8 +2623,13 @@ int sdhci_start_signal_voltage_switch(struct mmc_host *mmc,/* * Signal Voltage Switching is only applicable for Host Controllers * v3.00 and above. +* But for UHS2, the signal voltage is supplied by vdd2 which is +* already 1.8v so no voltage switch required. Quoted 8 lines
drivers/mmc/host/sdhci.c int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, · line 2632
Quoted 6 lines
drivers/mmc/host/sdhci.c +4
-1*/ -if (host->version <SDHCI_SPEC_300 ) +if (host->version <SDHCI_SPEC_300 || + (IS_ENABLED (CONFIG_MMC_SDHCI_UHS2 ) && + host->version >=SDHCI_SPEC_400 && + host->mmc->flags &MMC_UHS2_SUPPORT ))Please look at hooking ->start_signal_voltage_switch() instead
Quoted 3 lines
Do you mean that you want every platform driver who wants to support UHS-II to set NULL to
start_signal_voltage_switchhook even if this hack is platform agnostic?
No, I see UHS-II as a separate layer i.e.
UHS-II host controller driver
| | | v | sdhci-uhs2 e.g. sdhci_uhs2_start_signal_voltage_switch | | v v
sdhci e.g. sdhci_start_signal_voltage_switch
Most things should go through sdhci-uhs2 but not nessarily everything.
Ben, Adrian,
Quoted 16 lines · Adrian Hunter
Quoted 15 lines · AKASHI Takahiro
Adrian,
Quoted 12 lines · Adrian Hunter
Quoted 11 lines · Ben Chuang
From: AKASHI Takahiro <[email protected]>
sdhci_start_signal_voltage_switch()should be called only in UHS-I mode, and not for UHS-II mode.Signed-off-by Ben Chuang <[email protected]>Signed-off-by AKASHI Takahiro <[email protected]>--- drivers/mmc/host/sdhci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/mmc/host/sdhci.c int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, · line 2627
Quoted 10 lines
drivers/mmc/host/sdhci.c +2
-0@@ -2623,8 +2623,13 @@ int sdhci_start_signal_voltage_switch(struct mmc_host *mmc,/* * Signal Voltage Switching is only applicable for Host Controllers * v3.00 and above. +* But for UHS2, the signal voltage is supplied by vdd2 which is +* already 1.8v so no voltage switch required.
I have been confused with this comment.
(I know it came from the original Intel code, not from Ben.)
If this comment is true,
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/mmc/host/sdhci.c int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, · line 2632
Quoted 6 lines
drivers/mmc/host/sdhci.c +4
-1*/ -if (host->version <SDHCI_SPEC_300 ) +if (host->version <SDHCI_SPEC_300 || + (IS_ENABLED (CONFIG_MMC_SDHCI_UHS2 ) && + host->version >=SDHCI_SPEC_400 && + host->mmc->flags &MMC_UHS2_SUPPORT ))
the condition above must be wrong since 'flags & MMC_UHS2_SUPPORT' is one of capabilities for a host controller, not a card while the selection of voltage depends on a card type.
So I wonder why this code still works.
I guess that it is because set_signal_voltage(), or other variant functions, will never be called for UHS-II cards under the current implementation.
Looking at mmc_sd_init_card(), we have added some hack:mmc_sd_init_card()
{
...
/* For UHS2, skip the UHS-I initialization. */
if ((host->flags & MMC_UHS2_SUPPORT) &&
(host->flags & MMC_UHS2_INITIALIZED))
goto done;
...
if (mmc_sd_card_using_v18(card)) {
if (mmc_host_set_uhs_voltage(host) ||
mmc_sd_init_uhs_card(card)) {
...
}Ben, can you confirm this?
(There is another callsite of mmc_host_set_uhs_voltage() though.)
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
Please look at hooking ->start_signal_voltage_switch() instead
Do you mean that you want every platform driver who wants to support UHS-II to set NULL to
start_signal_voltage_switchhook even if this hack is platform agnostic?No, I see UHS-II as a separate layer i.e.
UHS-II host controller driver
Quoted 8 lines
| | | v | sdhci-uhs2 e.g. sdhci_uhs2_start_signal_voltage_switch | | v vsdhci e.g.
sdhci_start_signal_voltage_switchMost things should go through sdhci-uhs2 but not nessarily everything.
What I meant by my previous comment is that we don't have to call any function, sdhci_uhs2_start_signal_voltage_switch in above example, for UHS-II cards in any case since it is always simply empty.
-Takahiro Akashi
Hi Takahiro,
Quoted 43 lines · AKASHI Takahiro
Ben, Adrian,
Quoted 16 lines · Adrian Hunter
Quoted 15 lines · AKASHI Takahiro
Adrian,
Quoted 12 lines · Adrian Hunter
Quoted 11 lines · Ben Chuang
From: AKASHI Takahiro <[email protected]>
sdhci_start_signal_voltage_switch()should be called only in UHS-I mode, and not for UHS-II mode.Signed-off-by Ben Chuang <[email protected]>Signed-off-by AKASHI Takahiro <[email protected]>--- drivers/mmc/host/sdhci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/mmc/host/sdhci.c int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, · line 2627
Quoted 10 lines
drivers/mmc/host/sdhci.c +2
-0@@ -2623,8 +2623,13 @@ int sdhci_start_signal_voltage_switch(struct mmc_host *mmc,/* * Signal Voltage Switching is only applicable for Host Controllers * v3.00 and above. +* But for UHS2, the signal voltage is supplied by vdd2 which is +* already 1.8v so no voltage switch required. I have been confused with this comment.
(I know it came from the original Intel code, not from Ben.)If this comment is true,
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/mmc/host/sdhci.c int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, · line 2632
Quoted 6 lines
drivers/mmc/host/sdhci.c +4
-1*/ -if (host->version <SDHCI_SPEC_300 ) +if (host->version <SDHCI_SPEC_300 || + (IS_ENABLED (CONFIG_MMC_SDHCI_UHS2 ) && + host->version >=SDHCI_SPEC_400 && + host->mmc->flags &MMC_UHS2_SUPPORT ))
Quoted 3 lines
the condition above must be wrong since 'flags &
MMC_UHS2_SUPPORT' is one of capabilities for a host controller, not a card while the selection of voltage depends on a card type.
The flag MMC_UHS2_SUPPORT is set at the beginning of mmc_uhs2_rescan_try_freq(). In UHS-II flow, it stays set.
If the attempt to UHS-II fails finally, it will be unset.
Quoted 20 lines
So I wonder why this code still works.
I guess that it is becauseset_signal_voltage(), or other variant functions, will never be called for UHS-II cards under the current implementation.Looking at
mmc_sd_init_card(), we have added some hack:mmc_sd_init_card(){ ... /* For UHS2, skip the UHS-I initialization. */ if ((host->flags & MMC_UHS2_SUPPORT) && (host->flags & MMC_UHS2_INITIALIZED)) goto done; ... if (mmc_sd_card_using_v18(card)) { if (mmc_host_set_uhs_voltage(host) || mmc_sd_init_uhs_card(card)) { ... }
Quoted 2 lines
Ben, can you confirm this?
(There is another callsite ofmmc_host_set_uhs_voltage()though.)
UHS-II cards use differential signals and don't need to signal voltage switch. But the main task is to set the parameters of UHS-II card interface.
Quoted 24 lines
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Please look at hooking ->start_signal_voltage_switch() instead
Do you mean that you want every platform driver who wants to support UHS-II to set NULL to
start_signal_voltage_switchhook even if this hack is platform agnostic?No, I see UHS-II as a separate layer i.e.
UHS-II host controller driver
Quoted 8 lines
| | | v | sdhci-uhs2 e.g. sdhci_uhs2_start_signal_voltage_switch | | v vsdhci e.g.
sdhci_start_signal_voltage_switchMost things should go through sdhci-uhs2 but not nessarily everything.
What I meant by my previous comment is that we don't have to call any function,
sdhci_uhs2_start_signal_voltage_switchin above example, for UHS-II cards in any case since it is always simply empty.-Takahiro Akashi
Quoted 47 lines · Ben Chuang
Hi Takahiro,
Quoted 43 lines · AKASHI Takahiro
Ben, Adrian,
Quoted 16 lines · Adrian Hunter
Quoted 15 lines · AKASHI Takahiro
Adrian,
Quoted 12 lines · Adrian Hunter
Quoted 11 lines · Ben Chuang
From: AKASHI Takahiro <[email protected]>
sdhci_start_signal_voltage_switch()should be called only in UHS-I mode, and not for UHS-II mode.Signed-off-by Ben Chuang <[email protected]>Signed-off-by AKASHI Takahiro <[email protected]>--- drivers/mmc/host/sdhci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/mmc/host/sdhci.c int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, · line 2627
Quoted 10 lines
drivers/mmc/host/sdhci.c +2
-0@@ -2623,8 +2623,13 @@ int sdhci_start_signal_voltage_switch(struct mmc_host *mmc,/* * Signal Voltage Switching is only applicable for Host Controllers * v3.00 and above. +* But for UHS2, the signal voltage is supplied by vdd2 which is +* already 1.8v so no voltage switch required. I have been confused with this comment.
(I know it came from the original Intel code, not from Ben.)If this comment is true,
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/mmc/host/sdhci.c +4
-1*/ -if (host->version <SDHCI_SPEC_300 ) +if (host->version <SDHCI_SPEC_300 || + (IS_ENABLED (CONFIG_MMC_SDHCI_UHS2 ) && + host->version >=SDHCI_SPEC_400 && + host->mmc->flags &MMC_UHS2_SUPPORT ))
Quoted 7 lines
Quoted 3 lines
the condition above must be wrong since 'flags &
MMC_UHS2_SUPPORT' is one of capabilities for a host controller, not a card while the selection of voltage depends on a card type.The flag
MMC_UHS2_SUPPORTis set at the beginning ofmmc_uhs2_rescan_try_freq(). In UHS-II flow, it stays set.
If the attempt to UHS-II fails finally, it will be unset.
Right, but MMC_UHS2_SUPPORT is also set, at least initially, in sdhci_uhs2_add_host(). It is confusing, isn't it?
As we discussed before, any card-specific properties, like UHS-II mode, should be placed in a card structure, not a host structure.
Quoted 20 lines
Quoted 20 lines
So I wonder why this code still works.
I guess that it is becauseset_signal_voltage(), or other variant functions, will never be called for UHS-II cards under the current implementation.Looking at
mmc_sd_init_card(), we have added some hack:mmc_sd_init_card(){ ... /* For UHS2, skip the UHS-I initialization. */ if ((host->flags & MMC_UHS2_SUPPORT) && (host->flags & MMC_UHS2_INITIALIZED)) goto done; ... if (mmc_sd_card_using_v18(card)) { if (mmc_host_set_uhs_voltage(host) || mmc_sd_init_uhs_card(card)) { ... }
Quoted 5 lines
Quoted 2 lines
Ben, can you confirm this?
(There is another callsite ofmmc_host_set_uhs_voltage()though.)UHS-II cards use differential signals and don't need to signal voltage switch. But the main task is to set the parameters of UHS-II card interface.
Whoever sets MMC_UHS2_SUPPORT (and MMC_UHS2_INITIALIZED), my assertion above (mmc_host_set_uhs_voltage, and hence [sdhci_]start_signal_voltage_switch(), is never called for UHS-II cards) will be valid, isn't it?
-Takahiro Akashi
Quoted 24 lines
Quoted 24 lines
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Please look at hooking ->start_signal_voltage_switch() instead
Do you mean that you want every platform driver who wants to support UHS-II to set NULL to
start_signal_voltage_switchhook even if this hack is platform agnostic?No, I see UHS-II as a separate layer i.e.
UHS-II host controller driver
Quoted 8 lines
| | | v | sdhci-uhs2 e.g. sdhci_uhs2_start_signal_voltage_switch | | v vsdhci e.g.
sdhci_start_signal_voltage_switchMost things should go through sdhci-uhs2 but not nessarily everything.
What I meant by my previous comment is that we don't have to call any function,
sdhci_uhs2_start_signal_voltage_switchin above example, for UHS-II cards in any case since it is always simply empty.-Takahiro Akashi
Quoted 53 lines · AKASHI Takahiro
Quoted 51 lines · Ben Chuang
Hi Takahiro,
Quoted 46 lines · AKASHI Takahiro
Ben, Adrian,
Quoted 16 lines · Adrian Hunter
Quoted 15 lines · AKASHI Takahiro
Adrian,
Quoted 12 lines · Adrian Hunter
Quoted 11 lines · Ben Chuang
From: AKASHI Takahiro <[email protected]>
sdhci_start_signal_voltage_switch()should be called only in UHS-I mode, and not for UHS-II mode.Signed-off-by Ben Chuang <[email protected]>Signed-off-by AKASHI Takahiro <[email protected]>--- drivers/mmc/host/sdhci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/mmc/host/sdhci.c int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, · line 2627
Quoted 10 lines
drivers/mmc/host/sdhci.c +2
-0@@ -2623,8 +2623,13 @@ int sdhci_start_signal_voltage_switch(struct mmc_host *mmc,/* * Signal Voltage Switching is only applicable for Host Controllers * v3.00 and above. +* But for UHS2, the signal voltage is supplied by vdd2 which is +* already 1.8v so no voltage switch required. I have been confused with this comment.
(I know it came from the original Intel code, not from Ben.)If this comment is true,
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/mmc/host/sdhci.c int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, · line 2632
Quoted 6 lines
drivers/mmc/host/sdhci.c +4
-1*/ -if (host->version <SDHCI_SPEC_300 ) +if (host->version <SDHCI_SPEC_300 || + (IS_ENABLED (CONFIG_MMC_SDHCI_UHS2 ) && + host->version >=SDHCI_SPEC_400 && + host->mmc->flags &MMC_UHS2_SUPPORT ))the condition above must be wrong since 'flags &
MMC_UHS2_SUPPORT' is one of capabilities for a host controller, not a card while the selection of voltage depends on a card type.
Quoted 6 lines
Quoted 3 lines
The flag
MMC_UHS2_SUPPORTis set at the beginning ofmmc_uhs2_rescan_try_freq(). In UHS-II flow, it stays set.
If the attempt to UHS-II fails finally, it will be unset.Right, but
MMC_UHS2_SUPPORTis also set, at least initially, insdhci_uhs2_add_host(). It is confusing, isn't it?
I think it can be removed from sdhci_uhs2_add_host() to avoid making confusion.
Quoted 60 lines
As we discussed before, any card-specific properties, like UHS-II mode, should be placed in a card structure, not a host structure.
Quoted 20 lines
Quoted 20 lines
So I wonder why this code still works.
I guess that it is becauseset_signal_voltage(), or other variant functions, will never be called for UHS-II cards under the current implementation.Looking at
mmc_sd_init_card(), we have added some hack:mmc_sd_init_card(){ ... /* For UHS2, skip the UHS-I initialization. */ if ((host->flags & MMC_UHS2_SUPPORT) && (host->flags & MMC_UHS2_INITIALIZED)) goto done; ... if (mmc_sd_card_using_v18(card)) { if (mmc_host_set_uhs_voltage(host) || mmc_sd_init_uhs_card(card)) { ... }Quoted 5 lines
Quoted 2 lines
Ben, can you confirm this?
(There is another callsite ofmmc_host_set_uhs_voltage()though.)UHS-II cards use differential signals and don't need to signal voltage switch. But the main task is to set the parameters of UHS-II card interface.
Whoever sets
MMC_UHS2_SUPPORT(andMMC_UHS2_INITIALIZED), my assertion above (mmc_host_set_uhs_voltage, and hence [sdhci_]start_signal_voltage_switch(), is never called for UHS-II cards) will be valid, isn't it?-Takahiro Akashi
Quoted 24 lines
Quoted 24 lines
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Please look at hooking ->start_signal_voltage_switch() instead
Do you mean that you want every platform driver who wants to support UHS-II to set NULL to
start_signal_voltage_switchhook even if this hack is platform agnostic?No, I see UHS-II as a separate layer i.e.
UHS-II host controller driver
Quoted 8 lines
| | | v | sdhci-uhs2 e.g. sdhci_uhs2_start_signal_voltage_switch | | v vsdhci e.g.
sdhci_start_signal_voltage_switchMost things should go through sdhci-uhs2 but not nessarily everything.
What I meant by my previous comment is that we don't have to call any function,
sdhci_uhs2_start_signal_voltage_switchin above example, for UHS-II cards in any case since it is always simply empty.-Takahiro Akashi
Ben,
Quoted 55 lines · Ben Chuang
Quoted 53 lines · AKASHI Takahiro
Quoted 51 lines · Ben Chuang
Hi Takahiro,
Quoted 46 lines · AKASHI Takahiro
Ben, Adrian,
Quoted 16 lines · Adrian Hunter
Quoted 15 lines · AKASHI Takahiro
Adrian,
Quoted 12 lines · Adrian Hunter
Quoted 11 lines · Ben Chuang
From: AKASHI Takahiro <[email protected]>
sdhci_start_signal_voltage_switch()should be called only in UHS-I mode, and not for UHS-II mode.Signed-off-by Ben Chuang <[email protected]>Signed-off-by AKASHI Takahiro <[email protected]>--- drivers/mmc/host/sdhci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/mmc/host/sdhci.c int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, · line 2627
Quoted 10 lines
drivers/mmc/host/sdhci.c +2
-0@@ -2623,8 +2623,13 @@ int sdhci_start_signal_voltage_switch(struct mmc_host *mmc,/* * Signal Voltage Switching is only applicable for Host Controllers * v3.00 and above. +* But for UHS2, the signal voltage is supplied by vdd2 which is +* already 1.8v so no voltage switch required. I have been confused with this comment.
(I know it came from the original Intel code, not from Ben.)If this comment is true,
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/mmc/host/sdhci.c int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, · line 2632
Quoted 6 lines
drivers/mmc/host/sdhci.c +4
-1*/ -if (host->version <SDHCI_SPEC_300 ) +if (host->version <SDHCI_SPEC_300 || + (IS_ENABLED (CONFIG_MMC_SDHCI_UHS2 ) && + host->version >=SDHCI_SPEC_400 && + host->mmc->flags &MMC_UHS2_SUPPORT ))the condition above must be wrong since 'flags &
MMC_UHS2_SUPPORT' is one of capabilities for a host controller, not a card while the selection of voltage depends on a card type.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
The flag
MMC_UHS2_SUPPORTis set at the beginning ofmmc_uhs2_rescan_try_freq(). In UHS-II flow, it stays set.
If the attempt to UHS-II fails finally, it will be unset.Right, but
MMC_UHS2_SUPPORTis also set, at least initially, insdhci_uhs2_add_host(). It is confusing, isn't it?I think it can be removed from
sdhci_uhs2_add_host()to avoid making confusion.
Okay,
Quoted 3 lines
Quoted 3 lines
As we discussed before, any card-specific properties, like UHS-II mode, should be placed in a card structure, not a host structure.
Do you have any idea on this?
I remember that Ulf also made a similar comment on the "core" side.
-Takahiro Akashi
Quoted 57 lines
Quoted 57 lines
Quoted 21 lines
Quoted 21 lines
So I wonder why this code still works.
I guess that it is becauseset_signal_voltage(), or other variant functions, will never be called for UHS-II cards under the current implementation.Looking at
mmc_sd_init_card(), we have added some hack:mmc_sd_init_card(){ ... /* For UHS2, skip the UHS-I initialization. */ if ((host->flags & MMC_UHS2_SUPPORT) && (host->flags & MMC_UHS2_INITIALIZED)) goto done; ... if (mmc_sd_card_using_v18(card)) { if (mmc_host_set_uhs_voltage(host) || mmc_sd_init_uhs_card(card)) { ... }Quoted 5 lines
Quoted 2 lines
Ben, can you confirm this?
(There is another callsite ofmmc_host_set_uhs_voltage()though.)UHS-II cards use differential signals and don't need to signal voltage switch. But the main task is to set the parameters of UHS-II card interface.
Whoever sets
MMC_UHS2_SUPPORT(andMMC_UHS2_INITIALIZED), my assertion above (mmc_host_set_uhs_voltage, and hence [sdhci_]start_signal_voltage_switch(), is never called for UHS-II cards) will be valid, isn't it?-Takahiro Akashi
Quoted 24 lines
Quoted 24 lines
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Please look at hooking ->start_signal_voltage_switch() instead
Do you mean that you want every platform driver who wants to support UHS-II to set NULL to
start_signal_voltage_switchhook even if this hack is platform agnostic?No, I see UHS-II as a separate layer i.e.
UHS-II host controller driver
Quoted 8 lines
| | | v | sdhci-uhs2 e.g. sdhci_uhs2_start_signal_voltage_switch | | v vsdhci e.g.
sdhci_start_signal_voltage_switchMost things should go through sdhci-uhs2 but not nessarily everything.
What I meant by my previous comment is that we don't have to call any function,
sdhci_uhs2_start_signal_voltage_switchin above example, for UHS-II cards in any case since it is always simply empty.-Takahiro Akashi
Quoted 68 lines · AKASHI Takahiro
Ben,
Quoted 55 lines · Ben Chuang
Quoted 53 lines · AKASHI Takahiro
Quoted 51 lines · Ben Chuang
Hi Takahiro,
Quoted 46 lines · AKASHI Takahiro
Ben, Adrian,
Quoted 16 lines · Adrian Hunter
Quoted 15 lines · AKASHI Takahiro
Adrian,
Quoted 12 lines · Adrian Hunter
Quoted 11 lines · Ben Chuang
From: AKASHI Takahiro <[email protected]>
sdhci_start_signal_voltage_switch()should be called only in UHS-I mode, and not for UHS-II mode.Signed-off-by Ben Chuang <[email protected]>Signed-off-by AKASHI Takahiro <[email protected]>--- drivers/mmc/host/sdhci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/mmc/host/sdhci.c int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, · line 2627
Quoted 10 lines
drivers/mmc/host/sdhci.c +2
-0@@ -2623,8 +2623,13 @@ int sdhci_start_signal_voltage_switch(struct mmc_host *mmc,/* * Signal Voltage Switching is only applicable for Host Controllers * v3.00 and above. +* But for UHS2, the signal voltage is supplied by vdd2 which is +* already 1.8v so no voltage switch required. I have been confused with this comment.
(I know it came from the original Intel code, not from Ben.)If this comment is true,
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/mmc/host/sdhci.c int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, · line 2632
Quoted 6 lines
drivers/mmc/host/sdhci.c +4
-1*/ -if (host->version <SDHCI_SPEC_300 ) +if (host->version <SDHCI_SPEC_300 || + (IS_ENABLED (CONFIG_MMC_SDHCI_UHS2 ) && + host->version >=SDHCI_SPEC_400 && + host->mmc->flags &MMC_UHS2_SUPPORT ))the condition above must be wrong since 'flags &
MMC_UHS2_SUPPORT' is one of capabilities for a host controller, not a card while the selection of voltage depends on a card type.Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
The flag
MMC_UHS2_SUPPORTis set at the beginning ofmmc_uhs2_rescan_try_freq(). In UHS-II flow, it stays set.
If the attempt to UHS-II fails finally, it will be unset.Right, but
MMC_UHS2_SUPPORTis also set, at least initially, insdhci_uhs2_add_host(). It is confusing, isn't it?I think it can be removed from
sdhci_uhs2_add_host()to avoid making confusion.
Quoted 8 lines
Okay,
Quoted 3 lines
Quoted 3 lines
As we discussed before, any card-specific properties, like UHS-II mode, should be placed in a card structure, not a host structure.
Do you have any idea on this?
I remember that Ulf also made a similar comment on the "core" side.
We may list those properties to do first. i.e. MMC_UHS2_INITIALIZED.
Quoted 60 lines
-Takahiro Akashi
Quoted 57 lines
Quoted 57 lines
Quoted 21 lines
Quoted 21 lines
So I wonder why this code still works.
I guess that it is becauseset_signal_voltage(), or other variant functions, will never be called for UHS-II cards under the current implementation.Looking at
mmc_sd_init_card(), we have added some hack:mmc_sd_init_card(){ ... /* For UHS2, skip the UHS-I initialization. */ if ((host->flags & MMC_UHS2_SUPPORT) && (host->flags & MMC_UHS2_INITIALIZED)) goto done; ... if (mmc_sd_card_using_v18(card)) { if (mmc_host_set_uhs_voltage(host) || mmc_sd_init_uhs_card(card)) { ... }Quoted 5 lines
Quoted 2 lines
Ben, can you confirm this?
(There is another callsite ofmmc_host_set_uhs_voltage()though.)UHS-II cards use differential signals and don't need to signal voltage switch. But the main task is to set the parameters of UHS-II card interface.
Whoever sets
MMC_UHS2_SUPPORT(andMMC_UHS2_INITIALIZED), my assertion above (mmc_host_set_uhs_voltage, and hence [sdhci_]start_signal_voltage_switch(), is never called for UHS-II cards) will be valid, isn't it?-Takahiro Akashi
Quoted 24 lines
Quoted 24 lines
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Please look at hooking ->start_signal_voltage_switch() instead
Do you mean that you want every platform driver who wants to support UHS-II to set NULL to
start_signal_voltage_switchhook even if this hack is platform agnostic?No, I see UHS-II as a separate layer i.e.
UHS-II host controller driver
Quoted 8 lines
| | | v | sdhci-uhs2 e.g. sdhci_uhs2_start_signal_voltage_switch | | v vsdhci e.g.
sdhci_start_signal_voltage_switchMost things should go through sdhci-uhs2 but not nessarily everything.
What I meant by my previous comment is that we don't have to call any function,
sdhci_uhs2_start_signal_voltage_switchin above example, for UHS-II cards in any case since it is always simply empty.-Takahiro Akashi
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 62 lines · Adrian Hunter
Quoted 51 lines · AKASHI Takahiro
Ben, Adrian,
Quoted 48 lines · Adrian Hunter
Quoted 33 lines · AKASHI Takahiro
Adrian,
Quoted 21 lines · Adrian Hunter
Quoted 20 lines · Ben Chuang
From: AKASHI Takahiro <[email protected]>
sdhci_start_signal_voltage_switch()should be called only in UHS-I mode, and not for UHS-II mode.Signed-off-by Ben Chuang <[email protected]>Signed-off-by AKASHI Takahiro <[email protected]>--- drivers/mmc/host/sdhci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci.c +1
-0@@ -2623,8 +2623,13 @@ int sdhci_start_signal_voltage_switch(struct mmc_host *mmc,/* * Signal Voltage Switching is only applicable for Host Controllers * v3.00 and above. +* But for UHS2, the signal voltage is supplied by vdd2 which is Quoted 8 lines
drivers/mmc/host/sdhci.c int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, · line 2632
Quoted 7 lines
drivers/mmc/host/sdhci.c +5
-1+* already 1.8v so no voltage switch required. */ -if (host->version <SDHCI_SPEC_300 ) +if (host->version <SDHCI_SPEC_300 || + (IS_ENABLED (CONFIG_MMC_SDHCI_UHS2 ) && + host->version >=SDHCI_SPEC_400 && + host->mmc->flags &MMC_UHS2_SUPPORT ))Please look at hooking ->start_signal_voltage_switch() instead
Quoted 3 lines
Do you mean that you want every platform driver who wants to support UHS-II to set NULL to
start_signal_voltage_switchhook even if this hack is platform agnostic?No, I see UHS-II as a separate layer i.e.
UHS-II host controller driver
| | | v | sdhci-uhs2 e.g. sdhci_uhs2_start_signal_voltage_switch | | v vsdhci e.g.
sdhci_start_signal_voltage_switchQuoted 5 lines
Quoted 1 line
Most things should go through sdhci-uhs2 but not nessarily everything.
What I meant by my previous comment is that we don't have to call any function,
sdhci_uhs2_start_signal_voltage_switchin above example, for UHS-II cards in any case since it is always simply empty.Please treat the
sdhci_uhs2_... host ops as functions for a UHS-II host controller in either UHS-II or legacy mode. i.e. it is up tosdhci-uhs2.cto call through tosdhci.cnot the other way around. e.g.
Quoted 6 lines
int
sdhci_uhs2_start_signal_voltage_switch(blah){ if (sdhci_uhs2_mode(host)) return 0; return sdhci_start_signal_valtage_switch(blah); }
Okay, the remaining issue is to clarify the meaning of MMC_UHS2_SUPPORT.
-Takhiro Akashi