From patchwork Fri May 12 18:16:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 99728 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp445006qge; Fri, 12 May 2017 11:30:06 -0700 (PDT) X-Received: by 10.80.137.228 with SMTP id h33mr1249911edh.126.1494613806057; Fri, 12 May 2017 11:30:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494613806; cv=none; d=google.com; s=arc-20160816; b=FouOUiWpK95cgmBFHIy8iBMtZxnS20ppFytvywz1y//pIz9U/e1ErFmmBbbzb5TmFO k7D7P97Bo2GXtnvJ739Q3fI5gAR0b36h9rjDaKxKXJAs6E13u4e4ddUQzF9JVyAKn5GJ 0rSd0M22u9fVMIyda7e+BMEenciZR2zKNKYp9XNpJ/Ai49fQXRT5m9grSjDk6gzz0Td+ o7eN93dcHhYv0Vuji5ysHkYOlgJhn9O7NqTJHEtvor22rbrT6yOTniwjW3HMQbBrrRB2 h7ARlWb9JGjQ9Fa49TVGCzwKB+QwyDc856WEerc8PMNzrCtoo8N5Cx5jJqeTzueRJRRf SjGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=b2e7zudQwlUYDSZrnw/OY5NpeUnH04/ysWq9RBatwdM=; b=zxOd7Ty87Ac367VkFx/sWheUZ6kV8k46QYN++PHuGNVHaTMRtYkm4UBNRP6mjx8Zst dIVrIRlaGBhc66XcPXkeVVbAKNCOAVRbAD1gvehm9G93vmgraaCFvwNwX7ln6RLnJCxF XzvPkEFt5P3vQIK8l6g6GwNJ9PprysodYk84K2XFS22x/uIvL/KOXM3w+Ayj4xcGR57B hKArEBTr8la8ajDAs4wLjvJJMEkLOWGL8FGRWJ7IREs4JAwW4JhUJlS0qXnBMg7bPbz6 VW4FX8BXNPlD86TEaURXnd9PrIscAE5a0OxO5YXpJmoKf4WGJoCfS+SrukMRfSOcBi/P vRhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id z24si6042966edc.188.2017.05.12.11.30.05; Fri, 12 May 2017 11:30:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ti.com Received: by lists.denx.de (Postfix, from userid 105) id 9A0D0C22075; Fri, 12 May 2017 18:18:49 +0000 (UTC) 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, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 98046C21F7B; Fri, 12 May 2017 18:17:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 67887C22025; Fri, 12 May 2017 18:17:06 +0000 (UTC) Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by lists.denx.de (Postfix) with ESMTPS id C49B7C21F71 for ; Fri, 12 May 2017 18:17:00 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v4CIGx2c028399; Fri, 12 May 2017 13:16:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1494613019; bh=Sm2KN2Zl1MN6HRZ/do06UshzJoOWN8pLwlnBY4irYV0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=XSv2ZSc7AC3qe+G/bsAzjwTQiwtaEfV0Ee5Gz9BNne1DMtAm571dMyDpca+iJrlws woifFs0I49Ourd+WSUyk6y1lVY4uIXC66rNti2JPX6HNAVUcGaqkeyncBHJckgm5wT RPdWDS/dvAvWucW3JBDdsdUMkJ+DqFs3mmLhbAKg= Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v4CIGxOQ021699; Fri, 12 May 2017 13:16:59 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.294.0; Fri, 12 May 2017 13:16:58 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v4CIGwsD019708; Fri, 12 May 2017 13:16:58 -0500 From: Jean-Jacques Hiblot To: , , , , Date: Fri, 12 May 2017 20:16:31 +0200 Message-ID: <1494613000-8156-14-git-send-email-jjhiblot@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1494613000-8156-1-git-send-email-jjhiblot@ti.com> References: <1494613000-8156-1-git-send-email-jjhiblot@ti.com> MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 13/22] mmc: Add a new callback function to enable/disable vdd X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Kishon Vijay Abraham I Add a new callback function *set_vdd* which can be used by the platform mmc driver to enable or disable vdd. The mmc core can use *mmc_set_vdd* in order to invoke the callback function. This will be used during power cycle where the specification requires vdd to be disabled for 1ms and enabled again. Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Jean-Jacques Hiblot --- drivers/mmc/mmc-uclass.c | 14 ++++++++++++++ drivers/mmc/mmc.c | 12 +++++++++++- include/mmc.h | 12 ++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index 9c07871..e1f7995 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -52,6 +52,20 @@ int mmc_set_ios(struct mmc *mmc) return dm_mmc_set_ios(mmc->dev); } +int dm_mmc_set_vdd(struct udevice *dev, bool enable) +{ + struct dm_mmc_ops *ops = mmc_get_ops(dev); + + if (!ops->set_vdd) + return -ENOSYS; + return ops->set_vdd(dev, enable); +} + +int mmc_set_vdd(struct mmc *mmc, bool enable) +{ + return dm_mmc_set_vdd(mmc->dev, enable); +} + int dm_mmc_get_wp(struct udevice *dev) { struct dm_mmc_ops *ops = mmc_get_ops(dev); diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 10af81d..d40a22b 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1194,6 +1194,16 @@ static inline int bus_width(uint cap) } #ifndef CONFIG_DM_MMC_OPS +static int mmc_set_vdd(struct mmc *mmc, bool enable) +{ + int ret = 0; + + if (mmc->cfg->ops->set_vdd) + ret = mmc->cfg->ops->set_vdd(mmc, enable); + + return ret; +} + static int mmc_set_ios(struct mmc *mmc) { int ret = 0; @@ -1942,7 +1952,7 @@ int mmc_start_init(struct mmc *mmc) return err; #endif mmc->ddr_mode = 0; - + mmc_set_vdd(mmc, true); /* First try to set 3.3V. If it fails set to 1.8V */ err = mmc_set_signal_voltage(mmc, MMC_SIGNAL_VOLTAGE_330); if (err != 0) diff --git a/include/mmc.h b/include/mmc.h index 89cb26c..43d37a4 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -352,6 +352,15 @@ struct dm_mmc_ops { int (*set_ios)(struct udevice *dev); /** + * set_vdd() - Enable or Disable the Vdd line + * + * @dev: Device to update + * @enable: true or false to enable or disable Vdd respectively + * @return 0 if OK, -ve on error + */ + int (*set_vdd)(struct udevice *dev, bool enable); + + /** * get_cd() - See whether a card is present * * @dev: Device to check @@ -373,11 +382,13 @@ struct dm_mmc_ops { int dm_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, struct mmc_data *data); int dm_mmc_set_ios(struct udevice *dev); +int dm_mmc_set_vdd(struct udevice *dev, bool enable); int dm_mmc_get_cd(struct udevice *dev); int dm_mmc_get_wp(struct udevice *dev); /* Transition functions for compatibility */ int mmc_set_ios(struct mmc *mmc); +int mmc_set_vdd(struct mmc *mmc, bool enable); int mmc_getcd(struct mmc *mmc); int mmc_getwp(struct mmc *mmc); @@ -387,6 +398,7 @@ struct mmc_ops { struct mmc_cmd *cmd, struct mmc_data *data); int (*set_ios)(struct mmc *mmc); int (*init)(struct mmc *mmc); + int (*set_vdd)(struct mmc *mmc, bool enable); int (*getcd)(struct mmc *mmc); int (*getwp)(struct mmc *mmc); };