{"id":816969,"url":"http://patchwork.ozlabs.org/api/patches/816969/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1506007346-10037-4-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":"<1506007346-10037-4-git-send-email-jjhiblot@ti.com>","list_archive_url":null,"date":"2017-09-21T15:22:06","name":"[U-Boot,03/23] mmc: omap_hsmmc: add support to set default io voltage","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"aacd88aea68144c910c6a9c6ae51cf6bf0bb2d5f","submitter":{"id":70508,"url":"http://patchwork.ozlabs.org/api/people/70508/?format=json","name":"Jean-Jacques Hiblot","email":"jjhiblot@ti.com"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/1506007346-10037-4-git-send-email-jjhiblot@ti.com/mbox/","series":[{"id":4414,"url":"http://patchwork.ozlabs.org/api/series/4414/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=4414","date":"2017-09-21T15:22:03","name":"mmc: omap5: Add support for UHS and HS200 modes","version":1,"mbox":"http://patchwork.ozlabs.org/series/4414/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816969/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816969/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=\"Q888BPDi\";\n\tdkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xygZy2WMcz9t4Z\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 22 Sep 2017 01:32:10 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 06C4AC220DF; Thu, 21 Sep 2017 15:30:25 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 20103C220A9;\n\tThu, 21 Sep 2017 15:30:23 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 3EF8CC22096; Thu, 21 Sep 2017 15:23:54 +0000 (UTC)","from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16])\n\tby lists.denx.de (Postfix) with ESMTPS id 64EA0C22096\n\tfor <u-boot@lists.denx.de>; Thu, 21 Sep 2017 15:23:50 +0000 (UTC)","from dflxv15.itg.ti.com ([128.247.5.124])\n\tby fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v8LFMmEQ009111; \n\tThu, 21 Sep 2017 10:22:48 -0500","from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31])\n\tby dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8LFMh1u009339;\n\tThu, 21 Sep 2017 10:22:43 -0500","from DLEE105.ent.ti.com (157.170.170.35) by DLEE101.ent.ti.com\n\t(157.170.170.31) 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 10:22:43 -0500","from dlep33.itg.ti.com (157.170.170.75) by DLEE105.ent.ti.com\n\t(157.170.170.35) 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 10:22:42 -0500","from localhost (ileax41-snat.itg.ti.com [10.172.224.153])\n\tby dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8LFMgIH000957;\n\tThu, 21 Sep 2017 10:22:42 -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=1506007368;\n\tbh=KEFIStLZ8PrAMJ7lhRwV4tl84kEDSLxeH61dQj3uGbg=;\n\th=From:To:CC:Subject:Date:In-Reply-To:References;\n\tb=Q888BPDiZwTvmNanrGf+QKlEcTLAbFmlxhm/l+cO8jX/NXNWvDmv5n76hCDg8q1Qm\n\tSQFjHTo7Tt7PE8yjmhZCSrNbE/Cuv6tKPadKU3ojaPit3bWFClUOZxodYZDdlrXA4n\n\thcLqcINgIJII27NIdtYJfkB1rsTRJGxrikgBUAC8=","From":"Jean-Jacques Hiblot <jjhiblot@ti.com>","To":"<jh80.chung@samsung.com>, <trini@konsulko.com>, <kishon@ti.com>,\n\t<sjg@chromium.org>, <lokeshvutla@ti.com>","Date":"Thu, 21 Sep 2017 17:22:06 +0200","Message-ID":"<1506007346-10037-4-git-send-email-jjhiblot@ti.com>","X-Mailer":"git-send-email 1.9.1","In-Reply-To":"<1506007346-10037-1-git-send-email-jjhiblot@ti.com>","References":"<1506007346-10037-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 03/23] mmc: omap_hsmmc: add support to set default\n\tio voltage","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\n\"ti,dual-volt\" is used in linux kernel to set the voltage capabilities.\nFor host controller dt nodes that doesn't have \"ti,dual-volt\",\nit's assumed 1.8v is the io voltage. This is not always true (like in\nthe case of beagle-x15 where the io lines are connected to 3.3v).\nHence if \"no-1-8-v\" property is set, io voltage will be set to 3v.\n\nSigned-off-by: Kishon Vijay Abraham I <kishon@ti.com>\nSigned-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>\n---\n arch/arm/include/asm/omap_mmc.h | 12 ++++++--\n drivers/mmc/omap_hsmmc.c        | 67 +++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 77 insertions(+), 2 deletions(-)","diff":"diff --git a/arch/arm/include/asm/omap_mmc.h b/arch/arm/include/asm/omap_mmc.h\nindex 102aec2..c4d326d 100644\n--- a/arch/arm/include/asm/omap_mmc.h\n+++ b/arch/arm/include/asm/omap_mmc.h\n@@ -65,6 +65,7 @@ struct omap_hsmmc_plat {\n \tstruct hsmmc *base_addr;\n \tstruct mmc mmc;\n \tbool cd_inverted;\n+\tu32 controller_flags;\n };\n \n /*\n@@ -124,8 +125,10 @@ struct omap_hsmmc_plat {\n #define DTW_8_BITMODE                   (0x1 << 5) /* CON[DW8]*/\n #define SDBP_PWROFF\t\t\t(0x0 << 8)\n #define SDBP_PWRON\t\t\t(0x1 << 8)\n+#define SDVS_MASK\t\t\t(0x7 << 9)\n #define SDVS_1V8\t\t\t(0x5 << 9)\n #define SDVS_3V0\t\t\t(0x6 << 9)\n+#define SDVS_3V3\t\t\t(0x7 << 9)\n #define DMA_SELECT\t\t\t(0x2 << 3)\n #define ICE_MASK\t\t\t(0x1 << 0)\n #define ICE_STOP\t\t\t(0x0 << 0)\n@@ -159,8 +162,13 @@ struct omap_hsmmc_plat {\n #define IE_CERR\t\t\t\t(0x01 << 28)\n #define IE_BADA\t\t\t\t(0x01 << 29)\n \n-#define VS30_3V0SUP\t\t\t(1 << 25)\n-#define VS18_1V8SUP\t\t\t(1 << 26)\n+#define VS33_3V3SUP\t\t\tBIT(24)\n+#define VS30_3V0SUP\t\t\tBIT(25)\n+#define VS18_1V8SUP\t\t\tBIT(26)\n+\n+#define IOV_3V3\t\t\t\t3300000\n+#define IOV_3V0\t\t\t\t3000000\n+#define IOV_1V8\t\t\t\t1800000\n \n /* Driver definitions */\n #define MMCSD_SECTOR_SIZE\t\t512\ndiff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c\nindex bab0cef..e0c7067 100644\n--- a/drivers/mmc/omap_hsmmc.c\n+++ b/drivers/mmc/omap_hsmmc.c\n@@ -74,6 +74,9 @@ struct omap_hsmmc_data {\n \tint wp_gpio;\n #endif\n #endif\n+#if CONFIG_IS_ENABLED(DM_MMC)\n+\tuint iov;\n+#endif\n \tu8 controller_flags;\n #ifndef CONFIG_OMAP34XX\n \tstruct omap_hsmmc_adma_desc *adma_desc_table;\n@@ -111,6 +114,8 @@ struct omap_hsmmc_adma_desc {\n  * that the bandwidth is always above 3MB/s).\n  */\n #define DMA_TIMEOUT_PER_MB\t333\n+#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT\t\tBIT(0)\n+#define OMAP_HSMMC_NO_1_8_V\t\t\tBIT(1)\n #define OMAP_HSMMC_USE_ADMA\t\t\tBIT(2)\n \n static int mmc_read_data(struct hsmmc *mmc_base, char *buf, unsigned int size);\n@@ -252,6 +257,58 @@ void mmc_init_stream(struct hsmmc *mmc_base)\n \twritel(readl(&mmc_base->con) & ~INIT_INITSTREAM, &mmc_base->con);\n }\n \n+#if CONFIG_IS_ENABLED(DM_MMC)\n+static void omap_hsmmc_conf_bus_power(struct mmc *mmc)\n+{\n+\tstruct hsmmc *mmc_base;\n+\tstruct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc);\n+\tu32 val;\n+\n+\tmmc_base = priv->base_addr;\n+\n+\tval = readl(&mmc_base->hctl) & ~SDVS_MASK;\n+\n+\tswitch (priv->iov) {\n+\tcase IOV_3V3:\n+\t\tval |= SDVS_3V3;\n+\t\tbreak;\n+\tcase IOV_3V0:\n+\t\tval |= SDVS_3V0;\n+\t\tbreak;\n+\tcase IOV_1V8:\n+\t\tval |= SDVS_1V8;\n+\t\tbreak;\n+\t}\n+\n+\twritel(val, &mmc_base->hctl);\n+}\n+\n+static void omap_hsmmc_set_capabilities(struct mmc *mmc)\n+{\n+\tstruct hsmmc *mmc_base;\n+\tstruct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc);\n+\tu32 val;\n+\n+\tmmc_base = priv->base_addr;\n+\tval = readl(&mmc_base->capa);\n+\n+\tif (priv->controller_flags & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {\n+\t\tval |= (VS30_3V0SUP | VS18_1V8SUP);\n+\t\tpriv->iov = IOV_3V0;\n+\t} else if (priv->controller_flags & OMAP_HSMMC_NO_1_8_V) {\n+\t\tval |= VS30_3V0SUP;\n+\t\tval &= ~VS18_1V8SUP;\n+\t\tpriv->iov = IOV_3V0;\n+\t} else {\n+\t\tval |= VS18_1V8SUP;\n+\t\tval &= ~VS30_3V0SUP;\n+\t\tpriv->iov = IOV_1V8;\n+\t}\n+\n+\twritel(val, &mmc_base->capa);\n+}\n+#endif\n+\n static int omap_hsmmc_init_setup(struct mmc *mmc)\n {\n \tstruct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc);\n@@ -286,9 +343,15 @@ static int omap_hsmmc_init_setup(struct mmc *mmc)\n \tif (reg_val & MADMA_EN)\n \t\tpriv->controller_flags |= OMAP_HSMMC_USE_ADMA;\n #endif\n+\n+#if CONFIG_IS_ENABLED(DM_MMC)\n+\tomap_hsmmc_set_capabilities(mmc);\n+\tomap_hsmmc_conf_bus_power(mmc);\n+#else\n \twritel(DTW_1_BITMODE | SDBP_PWROFF | SDVS_3V0, &mmc_base->hctl);\n \twritel(readl(&mmc_base->capa) | VS30_3V0SUP | VS18_1V8SUP,\n \t\t&mmc_base->capa);\n+#endif\n \n \treg_val = readl(&mmc_base->con) & RESERVED_MASK;\n \n@@ -1067,6 +1130,10 @@ static int omap_hsmmc_ofdata_to_platdata(struct udevice *dev)\n \tcfg->f_max = fdtdec_get_int(fdt, node, \"max-frequency\", 52000000);\n \tcfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;\n \tcfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;\n+\tif (fdtdec_get_bool(fdt, node, \"ti,dual-volt\"))\n+\t\tplat->controller_flags |= OMAP_HSMMC_SUPPORTS_DUAL_VOLT;\n+\tif (fdtdec_get_bool(fdt, node, \"no-1-8-v\"))\n+\t\tplat->controller_flags |= OMAP_HSMMC_NO_1_8_V;\n \n #ifdef OMAP_HSMMC_USE_GPIO\n \tplat->cd_inverted = fdtdec_get_bool(fdt, node, \"cd-inverted\");\n","prefixes":["U-Boot","03/23"]}