You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2021/02/26 07:12:05 UTC

[mynewt-core] branch master updated: mmc: Decrease mmc/sd initialization time

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 7362378  mmc: Decrease mmc/sd initialization time
7362378 is described below

commit 7362378c079ef200b1cf34e9321c0118612cc4d7
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Thu Feb 25 12:25:58 2021 +0100

    mmc: Decrease mmc/sd initialization time
    
    SD specification section "6.4.1 Power Up"
    requires 74 clocks with high CS.
    Code was sending 592 clocks (it was sending 74 bytes).
    
    Now code sends 10 bytes (80 cycles).
---
 hw/drivers/mmc/src/mmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/drivers/mmc/src/mmc.c b/hw/drivers/mmc/src/mmc.c
index c600ce6..e5c3336 100644
--- a/hw/drivers/mmc/src/mmc.c
+++ b/hw/drivers/mmc/src/mmc.c
@@ -221,8 +221,8 @@ mmc_init(int spi_num, void *spi_cfg, int ss_pin)
 
     hal_gpio_write(mmc->ss_pin, 0);
 
-    /* send the required >= 74 clock cycles */
-    for (i = 0; i < 74; i++) {
+    /* send the required >= 74 clock cycles (10 bytes, 80 clock cycles). */
+    for (i = 0; i < 10; i++) {
         hal_spi_tx_val(mmc->spi_num, 0xff);
     }