{"id":816901,"url":"http://patchwork.ozlabs.org/api/patches/816901/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1506004213-22620-9-git-send-email-jjhiblot@ti.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1506004213-22620-9-git-send-email-jjhiblot@ti.com>","list_archive_url":null,"date":"2017-09-21T14:29:55","name":"[U-Boot,v2,08/26] mmc: use mmc modes to select the correct bus speed","commit_ref":"05038576e0112a1547f1833bc17b70c34ce006bd","pull_url":null,"state":"accepted","archived":false,"hash":"b8059ad111e99f54c909d5d90d1aacc34b597fb8","submitter":{"id":70508,"url":"http://patchwork.ozlabs.org/api/people/70508/?format=json","name":"Jean-Jacques Hiblot","email":"jjhiblot@ti.com"},"delegate":{"id":12423,"url":"http://patchwork.ozlabs.org/api/users/12423/?format=json","username":"Jaehoon","first_name":"Jaehoon","last_name":"Chung","email":"jh80.chung@samsung.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/1506004213-22620-9-git-send-email-jjhiblot@ti.com/mbox/","series":[{"id":4400,"url":"http://patchwork.ozlabs.org/api/series/4400/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=4400","date":"2017-09-21T14:29:47","name":"mmc: Add support for HS200 and UHS modes","version":2,"mbox":"http://patchwork.ozlabs.org/series/4400/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816901/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816901/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ti.com header.i=@ti.com header.b=\"KBX7gigl\";\n\tdkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xyfPc43CQz9sNc\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 22 Sep 2017 00:39:00 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 4C216C22009; Thu, 21 Sep 2017 14:32:47 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 5953CC22005;\n\tThu, 21 Sep 2017 14:30:56 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 21BE0C21F14; Thu, 21 Sep 2017 14:30:42 +0000 (UTC)","from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77])\n\tby lists.denx.de (Postfix) with ESMTPS id 50631C21EAB\n\tfor <u-boot@lists.denx.de>; Thu, 21 Sep 2017 14:30:38 +0000 (UTC)","from dlelxv90.itg.ti.com ([172.17.2.17])\n\tby lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v8LEUZ2q029445; \n\tThu, 21 Sep 2017 09:30:35 -0500","from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25])\n\tby dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8LEUZJn019675; \n\tThu, 21 Sep 2017 09:30:35 -0500","from DFLE100.ent.ti.com (10.64.6.21) by DFLE104.ent.ti.com\n\t(10.64.6.25) with Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34;\n\tThu, 21 Sep 2017 09:30:35 -0500","from dlep32.itg.ti.com (157.170.170.100) by DFLE100.ent.ti.com\n\t(10.64.6.21) with Microsoft SMTP Server (version=TLS1_0,\n\tcipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend\n\tTransport; Thu, 21 Sep 2017 09:30:35 -0500","from localhost (ileax41-snat.itg.ti.com [10.172.224.153])\n\tby dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8LEUY58030734;\n\tThu, 21 Sep 2017 09:30:34 -0500"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,\n\tT_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com;\n\ts=ti-com-17Q1; t=1506004235;\n\tbh=DtoZLbVR1Nyhkcu8fVTNeNX9e4xBk7H5AmkwM7rpwww=;\n\th=From:To:CC:Subject:Date:In-Reply-To:References;\n\tb=KBX7gigl7bw4OoQG3xExoebVKvGwe3C5A7XsBAlQbd0XwuKLk1ULSehvxGF7aMCFz\n\tssAkh1l7tPh7VWT0NeIrMTG5z1ovYXGR4snRGJokJ42RsMuFvVQhY7sppm3tQqlXRa\n\t8XdrRgKXtOXy+z3KUDw6KoQtYKKYITYKVlchuc7g=","From":"Jean-Jacques Hiblot <jjhiblot@ti.com>","To":"<jh80.chung@samsung.com>, <trini@konsulko.com>, <kishon@ti.com>,\n\t<sjg@chromium.org>","Date":"Thu, 21 Sep 2017 16:29:55 +0200","Message-ID":"<1506004213-22620-9-git-send-email-jjhiblot@ti.com>","X-Mailer":"git-send-email 1.9.1","In-Reply-To":"<1506004213-22620-1-git-send-email-jjhiblot@ti.com>","References":"<1506004213-22620-1-git-send-email-jjhiblot@ti.com>","MIME-Version":"1.0","X-EXCLAIMER-MD-CONFIG":"e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180","Cc":"u-boot@lists.denx.de","Subject":"[U-Boot] [PATCH v2 08/26] mmc: use mmc modes to select the correct\n\tbus speed","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>\nReviewed-by: Simon Glass <sjg@chromium.org>\n---\n drivers/mmc/mmc.c | 39 ++++++++++++++++++++++++++++-----------\n 1 file changed, 28 insertions(+), 11 deletions(-)","diff":"diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c\nindex 0b74e78..382a9cf 100644\n--- a/drivers/mmc/mmc.c\n+++ b/drivers/mmc/mmc.c\n@@ -174,9 +174,34 @@ const char *mmc_mode_name(enum bus_mode mode)\n }\n #endif\n \n+static uint mmc_mode2freq(struct mmc *mmc, enum bus_mode mode)\n+{\n+\tstatic const int freqs[] = {\n+\t      [SD_LEGACY]\t= 25000000,\n+\t      [MMC_HS]\t\t= 26000000,\n+\t      [SD_HS]\t\t= 50000000,\n+\t      [UHS_SDR12]\t= 25000000,\n+\t      [UHS_SDR25]\t= 50000000,\n+\t      [UHS_SDR50]\t= 100000000,\n+\t      [UHS_SDR104]\t= 208000000,\n+\t      [UHS_DDR50]\t= 50000000,\n+\t      [MMC_HS_52]\t= 52000000,\n+\t      [MMC_DDR_52]\t= 52000000,\n+\t      [MMC_HS_200]\t= 200000000,\n+\t};\n+\n+\tif (mode == MMC_LEGACY)\n+\t\treturn mmc->legacy_speed;\n+\telse if (mode >= MMC_MODES_END)\n+\t\treturn 0;\n+\telse\n+\t\treturn freqs[mode];\n+}\n+\n static int mmc_select_mode(struct mmc *mmc, enum bus_mode mode)\n {\n \tmmc->selected_mode = mode;\n+\tmmc->tran_speed = mmc_mode2freq(mmc, mode);\n \tdebug(\"selecting mode %s (freq : %d MHz)\\n\", mmc_mode_name(mode),\n \t      mmc->tran_speed / 1000000);\n \treturn 0;\n@@ -1195,13 +1220,10 @@ static int sd_select_bus_freq_width(struct mmc *mmc)\n \tif (err)\n \t\treturn err;\n \n-\tif (mmc->card_caps & MMC_MODE_HS) {\n+\tif (mmc->card_caps & MMC_MODE_HS)\n \t\tmmc_select_mode(mmc, SD_HS);\n-\t\tmmc->tran_speed = 50000000;\n-\t} else {\n+\telse\n \t\tmmc_select_mode(mmc, SD_LEGACY);\n-\t\tmmc->tran_speed = 25000000;\n-\t}\n \n \treturn 0;\n }\n@@ -1323,11 +1345,8 @@ static int mmc_select_bus_freq_width(struct mmc *mmc)\n \t\t\tmmc_select_mode(mmc, MMC_DDR_52);\n \t\telse\n \t\t\tmmc_select_mode(mmc, MMC_HS_52);\n-\t\tmmc->tran_speed = 52000000;\n-\t} else if (mmc->card_caps & MMC_MODE_HS) {\n+\t} else if (mmc->card_caps & MMC_MODE_HS)\n \t\tmmc_select_mode(mmc, MMC_HS);\n-\t\tmmc->tran_speed = 26000000;\n-\t}\n \n \treturn err;\n }\n@@ -1599,7 +1618,6 @@ static int mmc_startup(struct mmc *mmc)\n \tmult = multipliers[((cmd.response[0] >> 3) & 0xf)];\n \n \tmmc->legacy_speed = freq * mult;\n-\tmmc->tran_speed = mmc->legacy_speed;\n \tmmc_select_mode(mmc, MMC_LEGACY);\n \n \tmmc->dsr_imp = ((cmd.response[1] >> 12) & 0x1);\n@@ -1674,7 +1692,6 @@ static int mmc_startup(struct mmc *mmc)\n \tif (err)\n \t\treturn err;\n \n-\tmmc_set_clock(mmc, mmc->tran_speed);\n \n \t/* Fix the block length for DDR mode */\n \tif (mmc->ddr_mode) {\n","prefixes":["U-Boot","v2","08/26"]}