{"id":816905,"url":"http://patchwork.ozlabs.org/api/patches/816905/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1506004213-22620-17-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-17-git-send-email-jjhiblot@ti.com>","list_archive_url":null,"date":"2017-09-21T14:30:03","name":"[U-Boot,v2,16/26] mmc: add a new mmc parameter to disable mmc clock","commit_ref":"35f6782055c99410fbeae33ab28ea68de154360c","pull_url":null,"state":"accepted","archived":false,"hash":"d8a9c447a15c2e924ede723cfc8b0df709c6c860","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-17-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/816905/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816905/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=\"te/4QAvk\";\n\tdkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xyfRs5Lpvz9t3w\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 22 Sep 2017 00:40:57 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 88234C22020; Thu, 21 Sep 2017 14:33:20 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 94E7DC21FED;\n\tThu, 21 Sep 2017 14:31:33 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid B83B5C21E26; Thu, 21 Sep 2017 14:31:01 +0000 (UTC)","from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80])\n\tby lists.denx.de (Postfix) with ESMTPS id 686DBC21F29\n\tfor <u-boot@lists.denx.de>; Thu, 21 Sep 2017 14:30:55 +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 v8LEUrJ8002906; \n\tThu, 21 Sep 2017 09:30:53 -0500","from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21])\n\tby dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8LEUrKj019948; \n\tThu, 21 Sep 2017 09:30:53 -0500","from DFLE111.ent.ti.com (10.64.6.32) by DFLE100.ent.ti.com\n\t(10.64.6.21) 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:53 -0500","from dflp32.itg.ti.com (10.64.6.15) 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:30:53 -0500","from localhost (ileax41-snat.itg.ti.com [10.172.224.153])\n\tby dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8LEUpGV016484;\n\tThu, 21 Sep 2017 09:30:52 -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=1506004253;\n\tbh=K/1ytV+kbJP91flCpWSRiJro8WE1E6mPMBoZPTHK2f4=;\n\th=From:To:CC:Subject:Date:In-Reply-To:References;\n\tb=te/4QAvkZc9WkraHCNbPtZjScir+lDiz3ri/Z9xQ1KRsq1q22rA7tTO5yl2NPEo7B\n\t+7zL6iyqvmHIQTaIeIdfXGu0onNqjgOAPEh6+h1HP/VICrgdLd4ZMvpJt8hC4Br3a3\n\t3ll8rtDldWFRD4iJZBi+KrLb2Jqc8AWdBfLEttoU=","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:03 +0200","Message-ID":"<1506004213-22620-17-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 16/26] mmc: add a new mmc parameter to disable\n\tmmc clock","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":"From: Kishon Vijay Abraham I <kishon@ti.com>\n\nmmc clock has to be disabled in certain cases like during\nthe voltage switch sequence. Modify mmc_set_clock function\nto take disable as an argument that signifies if the\nclock has to be enabled or disabled.\n\nSigned-off-by: Kishon Vijay Abraham I <kishon@ti.com>\nSigned-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>\n---\n drivers/mmc/fsl_esdhc.c |  2 +-\n drivers/mmc/mmc.c       | 11 ++++++-----\n include/mmc.h           | 12 +++++++++++-\n 3 files changed, 18 insertions(+), 7 deletions(-)","diff":"diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c\nindex cc188c4..6b52c6a 100644\n--- a/drivers/mmc/fsl_esdhc.c\n+++ b/drivers/mmc/fsl_esdhc.c\n@@ -665,7 +665,7 @@ static int esdhc_init_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)\n #endif\n \n \t/* Set the initial clock speed */\n-\tmmc_set_clock(mmc, 400000);\n+\tmmc_set_clock(mmc, 400000, false);\n \n \t/* Disable the BRR and BWR bits in IRQSTAT */\n \tesdhc_clrbits32(&regs->irqstaten, IRQSTATEN_BRR | IRQSTATEN_BWR);\ndiff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c\nindex 65a3d8e..1c941a2 100644\n--- a/drivers/mmc/mmc.c\n+++ b/drivers/mmc/mmc.c\n@@ -1214,7 +1214,7 @@ static int mmc_set_ios(struct mmc *mmc)\n }\n #endif\n \n-int mmc_set_clock(struct mmc *mmc, uint clock)\n+int mmc_set_clock(struct mmc *mmc, uint clock, bool disable)\n {\n \tif (clock > mmc->cfg->f_max)\n \t\tclock = mmc->cfg->f_max;\n@@ -1223,6 +1223,7 @@ int mmc_set_clock(struct mmc *mmc, uint clock)\n \t\tclock = mmc->cfg->f_min;\n \n \tmmc->clock = clock;\n+\tmmc->clk_disable = disable;\n \n \treturn mmc_set_ios(mmc);\n }\n@@ -1322,7 +1323,7 @@ static int sd_select_mode_and_width(struct mmc *mmc)\n \n \t\t\t\t/* configure the bus mode (host) */\n \t\t\t\tmmc_select_mode(mmc, mwt->mode);\n-\t\t\t\tmmc_set_clock(mmc, mmc->tran_speed);\n+\t\t\t\tmmc_set_clock(mmc, mmc->tran_speed, false);\n \n \t\t\t\terr = sd_read_ssr(mmc);\n \t\t\t\tif (!err)\n@@ -1333,7 +1334,7 @@ static int sd_select_mode_and_width(struct mmc *mmc)\n error:\n \t\t\t\t/* revert to a safer bus speed */\n \t\t\t\tmmc_select_mode(mmc, SD_LEGACY);\n-\t\t\t\tmmc_set_clock(mmc, mmc->tran_speed);\n+\t\t\t\tmmc_set_clock(mmc, mmc->tran_speed, false);\n \t\t\t}\n \t\t}\n \t}\n@@ -1476,7 +1477,7 @@ static int mmc_select_mode_and_width(struct mmc *mmc)\n \n \t\t\t/* configure the bus mode (host) */\n \t\t\tmmc_select_mode(mmc, mwt->mode);\n-\t\t\tmmc_set_clock(mmc, mmc->tran_speed);\n+\t\t\tmmc_set_clock(mmc, mmc->tran_speed, false);\n \n \t\t\t/* do a transfer to check the configuration */\n \t\t\terr = mmc_read_and_compare_ext_csd(mmc);\n@@ -1950,7 +1951,7 @@ static void mmc_set_initial_state(struct mmc *mmc)\n \n \tmmc_select_mode(mmc, MMC_LEGACY);\n \tmmc_set_bus_width(mmc, 1);\n-\tmmc_set_clock(mmc, 0);\n+\tmmc_set_clock(mmc, 0, false);\n }\n \n static int mmc_power_on(struct mmc *mmc)\ndiff --git a/include/mmc.h b/include/mmc.h\nindex bd096ae..8d6e0f8 100644\n--- a/include/mmc.h\n+++ b/include/mmc.h\n@@ -472,6 +472,7 @@ struct mmc {\n \tvoid *priv;\n \tuint has_init;\n \tint high_capacity;\n+\tbool clk_disable; /* true if the clock can be turned off */\n \tuint bus_width;\n \tuint clock;\n \tenum mmc_voltage signal_voltage;\n@@ -567,7 +568,16 @@ int mmc_unbind(struct udevice *dev);\n int mmc_initialize(bd_t *bis);\n int mmc_init(struct mmc *mmc);\n int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size);\n-int mmc_set_clock(struct mmc *mmc, uint clock);\n+\n+/**\n+ * mmc_set_clock() - change the bus clock\n+ * @mmc:\tMMC struct\n+ * @clock:\tbus frequency in Hz\n+ * @disable:\tflag indicating if the clock must on or off\n+ * @return 0 if OK, -ve on error\n+ */\n+int mmc_set_clock(struct mmc *mmc, uint clock, bool disable);\n+\n struct mmc *find_mmc_device(int dev_num);\n int mmc_set_dev(int dev_num);\n void print_mmc_devices(char separator);\n","prefixes":["U-Boot","v2","16/26"]}