{"id":816906,"url":"http://patchwork.ozlabs.org/api/patches/816906/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1506004213-22620-22-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-22-git-send-email-jjhiblot@ti.com>","list_archive_url":null,"date":"2017-09-21T14:30:08","name":"[U-Boot,v2,21/26] mmc: disable UHS modes if Vcc cannot be switched on and off","commit_ref":"04a2ea248f58b3b6216d0cd0a6b8698df8b14355","pull_url":null,"state":"accepted","archived":false,"hash":"a021a42c09d182c1a91bfee5a825f4f5a754d871","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-22-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/816906/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816906/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=\"wShJy8OF\";\n\tdkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xyfSX0k8Mz9sNc\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 22 Sep 2017 00:41:31 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid A4614C2203D; Thu, 21 Sep 2017 14:36:35 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 94E71C21FD8;\n\tThu, 21 Sep 2017 14:33:16 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 03704C2202D; Thu, 21 Sep 2017 14:31:17 +0000 (UTC)","from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80])\n\tby lists.denx.de (Postfix) with ESMTPS id ADB36C21E26\n\tfor <u-boot@lists.denx.de>; Thu, 21 Sep 2017 14:31:07 +0000 (UTC)","from dlelxv90.itg.ti.com ([172.17.2.17])\n\tby lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id v8LEV5aT002944; \n\tThu, 21 Sep 2017 09:31:05 -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 v8LEV57i020388; \n\tThu, 21 Sep 2017 09:31:05 -0500","from DFLE111.ent.ti.com (10.64.6.32) 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:31:05 -0500","from dflp33.itg.ti.com (10.64.6.16) by DFLE111.ent.ti.com\n\t(10.64.6.32) 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:31:05 -0500","from localhost (ileax41-snat.itg.ti.com [10.172.224.153])\n\tby dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8LEV3bG001294;\n\tThu, 21 Sep 2017 09:31:04 -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=1506004265;\n\tbh=UwlSn93FEiWC/rFme7NY8nwMh0Dj2yVk1ONTTPM57hI=;\n\th=From:To:CC:Subject:Date:In-Reply-To:References;\n\tb=wShJy8OFqay5qwETP613y/26/bznGyOjAvMhtDQ6LfHlrB1gUPmxSHwJO0Vo70Bo+\n\tR+cPy27ESjZOk7kr802Au3PM1rY/JYJokoL1bTpwofPOSm9hbA3ozrdcf2HTDB0EB7\n\tZym5VbV/ZGLZdd5Rg7XrYPugUCq1c3SP9T6B2u58=","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:30:08 +0200","Message-ID":"<1506004213-22620-22-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 21/26] mmc: disable UHS modes if Vcc cannot be\n\tswitched on and off","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":"If a power cycle cannot be done on Vcc, it is safer not to try the UHS\nmodes because we wouldn't be able to recover from an error occurring\nduring the UHS initialization.\n\nSigned-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>\n---\n drivers/mmc/mmc.c | 19 ++++++++++++++++---\n include/mmc.h     |  1 +\n 2 files changed, 17 insertions(+), 3 deletions(-)","diff":"diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c\nindex ca59e28..31accdd 100644\n--- a/drivers/mmc/mmc.c\n+++ b/drivers/mmc/mmc.c\n@@ -1451,7 +1451,7 @@ static int sd_select_mode_and_width(struct mmc *mmc)\n \tif (err)\n \t\treturn err;\n \t/* Restrict card's capabilities by what the host can do */\n-\tcaps = mmc->card_caps & (mmc->cfg->host_caps | MMC_MODE_1BIT);\n+\tcaps = mmc->card_caps & (mmc->host_caps | MMC_MODE_1BIT);\n \n \tif (!uhs_en)\n \t\tcaps &= ~UHS_CAPS;\n@@ -1599,7 +1599,7 @@ static int mmc_select_mode_and_width(struct mmc *mmc)\n \t\treturn err;\n \n \t/* Restrict card's capabilities by what the host can do */\n-\tmmc->card_caps &= (mmc->cfg->host_caps | MMC_MODE_1BIT);\n+\tmmc->card_caps &= (mmc->host_caps | MMC_MODE_1BIT);\n \n \t/* Only version 4 of MMC supports wider bus widths */\n \tif (mmc->version < MMC_VERSION_4)\n@@ -2182,6 +2182,8 @@ int mmc_start_init(struct mmc *mmc)\n \tbool uhs_en = supports_uhs(mmc->cfg->host_caps);\n \tint err;\n \n+\tmmc->host_caps = mmc->cfg->host_caps;\n+\n \t/* we pretend there's no card when init is NULL */\n \tno_card = mmc_getcd(mmc) == 0;\n #if !CONFIG_IS_ENABLED(DM_MMC)\n@@ -2205,7 +2207,18 @@ int mmc_start_init(struct mmc *mmc)\n \tif (err)\n \t\treturn err;\n \n-\terr = mmc_power_on(mmc);\n+\terr = mmc_power_cycle(mmc);\n+\tif (err) {\n+\t\t/*\n+\t\t * if power cycling is not supported, we should not try\n+\t\t * to use the UHS modes, because we wouldn't be able to\n+\t\t * recover from an error during the UHS initialization.\n+\t\t */\n+\t\tdebug(\"Unable to do a full power cycle. Disabling the UHS modes for safety\\n\");\n+\t\tuhs_en = false;\n+\t\tmmc->host_caps &= ~UHS_CAPS;\n+\t\terr = mmc_power_on(mmc);\n+\t}\n \tif (err)\n \t\treturn err;\n \ndiff --git a/include/mmc.h b/include/mmc.h\nindex ba4a13e8..59ea363 100644\n--- a/include/mmc.h\n+++ b/include/mmc.h\n@@ -544,6 +544,7 @@ struct mmc {\n \tuint clock;\n \tenum mmc_voltage signal_voltage;\n \tuint card_caps;\n+\tuint host_caps;\n \tuint ocr;\n \tuint dsr;\n \tuint dsr_imp;\n","prefixes":["U-Boot","v2","21/26"]}