Skip to contentSkip to conversation

SDHCI AM654 driver delaying boot time

DISCUSSION João Paulo Silva Gonçalves 5 participants 6 messages Nov 8, 2023 – Nov 14, 2023 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

Hello all,

We are trying to minimize boot time for our AM62 devices. Unfortunately, we have identified a delay of approximately 1.5 seconds caused by the sdhci_am654 driver. This delay is a result of a timeout within the driver (MAX_POWER_ON_TIMEOUT) and was introduced in commit 7ca0f16 ("mmc:
sdhci_am654: Add workaround for card detect debounce timer"). This issue arises only when there is no SD card present in the MMC slot.  We tested the driver with a lower timeout value and everything worked. However, as indicated in the commit message, this timeout may be related to the way the sdhci controller hardware IP works. Currently, the driver employs a sort of a "busy loop" to wait for this timeout to pass delaying the boot. Why is need to busy loop for this timeout? Is it possible to wait for it in the backgroud? Am I am missing something here?

Regards,
Joao Paulo

#1 lore raw
Quoted 8 lines · João Paulo Silva Gonçalves

Hello all,

We are trying to minimize boot time for our AM62 devices. Unfortunately, we have identified a delay of approximately 1.5 seconds caused by the sdhci_am654 driver. This delay is a result of a timeout within the driver (MAX_POWER_ON_TIMEOUT) and was introduced in commit 7ca0f16 ("mmc:
sdhci_am654: Add workaround for card detect debounce timer"). This issue arises only when there is no SD card present in the MMC slot.  We tested the driver with a lower timeout value and everything worked. However, as indicated in the commit message, this timeout may be related to the way the sdhci controller hardware IP works. Currently, the driver employs a sort of a "busy loop" to wait for this timeout to pass delaying the boot. Why is need to busy loop for this timeout? Is it possible to wait for it in the backgroud? Am I am missing something here?

I am not an mmc expert, but, Isn't this sequence part of the programmer manual in the TRM[1]? Either way, one additional issue I did end up with when I was doing beagleplay[2] was when i booted off emmc and runtime PM disabled SD/MMC interface, the MMC IP's CD mode would'nt work since the IP isn't clocked. So I switched the mux mode to GPIO to use mmc CD there. I haven't timed that approach where SDHCI_AM654_QUIRK_FORCE_CDTEST would get set.

[1] https://www.ti.com/lit/pdf/spruiv7
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts#n835

Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#2 lore raw

Hi Joao

Quoted 9 lines · Nishanth Menon
Quoted 8 lines · João Paulo Silva Gonçalves

Hello all,

We are trying to minimize boot time for our AM62 devices. Unfortunately, we have identified a delay of approximately 1.5 seconds caused by the sdhci_am654 driver. This delay is a result of a timeout within the driver (MAX_POWER_ON_TIMEOUT) and was introduced in commit 7ca0f16 ("mmc:
sdhci_am654: Add workaround for card detect debounce timer"). This issue arises only when there is no SD card present in the MMC slot.  We tested the driver with a lower timeout value and everything worked. However, as indicated in the commit message, this timeout may be related to the way the sdhci controller hardware IP works. Currently, the driver employs a sort of a "busy loop" to wait for this timeout to pass delaying the boot. Why is need to busy loop for this timeout? Is it possible to wait for it in the backgroud? Am I am missing something here?

sdhci_am654_write_power_on() does have usleep_range() of 1 to 10ms. If that isn't sufficient to preempt and allow other drivers to probe, then probably worth setting sleep_us in read_poll_timeout() call.

Quoted 11 lines

I am not an mmc expert, but, Isn't this sequence part of the programmer manual in the TRM[1]? Either way, one additional issue I did end up with when I was doing beagleplay[2] was when i booted off emmc and runtime PM disabled SD/MMC interface, the MMC IP's CD mode would'nt work since the IP isn't clocked. So I switched the mux mode to GPIO to use mmc CD there. I haven't timed that approach where SDHCI_AM654_QUIRK_FORCE_CDTEST would get set.

[1] https://www.ti.com/lit/pdf/spruiv7
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts#n835

Above is a good experiment to see if it helps boot time. Can you set SDCD line to GPIO and hook up using cd-gpios? You would also need to set ti,fails-without-test-cd

Signature · 2 lines
Regards
Vignesh
#3 lore raw
Quoted 27 lines · Vignesh Raghavendra

Hi Joao

Quoted 9 lines · Nishanth Menon
Quoted 8 lines · João Paulo Silva Gonçalves

Hello all,

We are trying to minimize boot time for our AM62 devices. Unfortunately, we have identified a delay of approximately 1.5 seconds caused by the sdhci_am654 driver. This delay is a result of a timeout within the driver (MAX_POWER_ON_TIMEOUT) and was introduced in commit 7ca0f16 ("mmc:
sdhci_am654: Add workaround for card detect debounce timer"). This issue arises only when there is no SD card present in the MMC slot.  We tested the driver with a lower timeout value and everything worked. However, as indicated in the commit message, this timeout may be related to the way the sdhci controller hardware IP works. Currently, the driver employs a sort of a "busy loop" to wait for this timeout to pass delaying the boot. Why is need to busy loop for this timeout? Is it possible to wait for it in the backgroud? Am I am missing something here?

sdhci_am654_write_power_on() does have usleep_range() of 1 to 10ms. If that isn't sufficient to preempt and allow other drivers to probe, then probably worth setting sleep_us in read_poll_timeout() call.

Quoted 9 lines

I am not an mmc expert, but, Isn't this sequence part of the programmer manual in the TRM[1]? Either way, one additional issue I did end up with when I was doing beagleplay[2] was when i booted off emmc and runtime PM disabled SD/MMC interface, the MMC IP's CD mode would'nt work since the IP isn't clocked. So I switched the mux mode to GPIO to use mmc CD there. I haven't timed that approach where SDHCI_AM654_QUIRK_FORCE_CDTEST would get set.

Quoted 8 lines
Quoted 2 lines

[1] https://www.ti.com/lit/pdf/spruiv7
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts#n835

Above is a good experiment to see if it helps boot time. Can you set SDCD line to GPIO and hook up using cd-gpios?  You would also need to set ti,fails-without-test-cd

I will try what Nishanth said about the gpio and also increase sleep_us. Thank for the insights!

Regards,
Joao Paulo Goncalves

#4 lore raw
In reply to Nishanth Menon

Hello Nishant,

Quoted 17 lines · Nishanth Menon
Quoted 15 lines · João Paulo Silva Gonçalves

Hello all,

We are trying to minimize boot time for our AM62 devices. Unfortunately, we have identified a delay of approximately 1.5 seconds caused by the sdhci_am654 driver. This delay is a result of a timeout within the driver (MAX_POWER_ON_TIMEOUT) and was introduced in commit 7ca0f16 ("mmc: sdhci_am654: Add workaround for card detect debounce timer"). This issue arises only when there is no SD card present in the MMC slot.  We tested the driver with a lower timeout value and everything worked. However, as indicated in the commit message, this timeout may be related to the way the sdhci controller hardware IP works. Currently, the driver employs a sort of a "busy loop" to wait for this timeout to pass delaying the boot. Why is need to busy loop for this timeout? Is it possible to wait for it in the backgroud? Am I am missing something here?

Quoted 2 lines

I am not an mmc expert, but, Isn't this sequence part of the programmer manual in the TRM[1]?

Probably original question from Joao was not fully understood.

It is clear why the code is waiting for the CD, the issue we are experiencing is that the whole boot is delayed by 1.5 seconds because of that piece of code for no reason.

- SD card exists in the system, but it's not used and the card slot is empty
- We boot from eMMC (that has no CD pin)
- Boot is delayed by 1.5 second because of that piece of code

Francesco

#5 lore raw
Quoted 25 lines · Francesco Dolcini

Hello Nishant,

Quoted 17 lines · Nishanth Menon
Quoted 15 lines · João Paulo Silva Gonçalves

Hello all,

We are trying to minimize boot time for our AM62 devices. Unfortunately, we have identified a delay of approximately 1.5 seconds caused by the sdhci_am654 driver. This delay is a result of a timeout within the driver (MAX_POWER_ON_TIMEOUT) and was introduced in commit 7ca0f16 ("mmc: sdhci_am654: Add workaround for card detect debounce timer"). This issue arises only when there is no SD card present in the MMC slot.  We tested the driver with a lower timeout value and everything worked. However, as indicated in the commit message, this timeout may be related to the way the sdhci controller hardware IP works. Currently, the driver employs a sort of a "busy loop" to wait for this timeout to pass delaying the boot. Why is need to busy loop for this timeout? Is it possible to wait for it in the backgroud? Am I am missing something here?

Quoted 2 lines

I am not an mmc expert, but, Isn't this sequence part of the programmer manual in the TRM[1]?

Probably original question from Joao was not fully understood.

Quoted 7 lines

It is clear why the code is waiting for the CD, the issue we are experiencing is that the whole boot is delayed by 1.5 seconds because of that piece of code for no reason.

- SD card exists in the system, but it's not used and the card slot is empty
- We boot from eMMC (that has no CD pin)
- Boot is delayed by 1.5 second because of that piece of code

So maybe don't use that code for eMMC?