From patchwork Thu Sep 21 14:30:05 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: 113265 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp2109628qgf; Thu, 21 Sep 2017 07:42:53 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAXX5pin//df3oxvYM6HxmiB4LMGhP/Hp3idZzDNkyJ5LieszuDJ70VHxd/n8CirPWArxSs X-Received: by 10.80.179.247 with SMTP id t52mr1393100edd.237.1506004973680; Thu, 21 Sep 2017 07:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506004973; cv=none; d=google.com; s=arc-20160816; b=JaHnlPo8qdaBIBFcjG5ll3s1Cu3XOYLFUdFe89OoFdVlGXWTMACferOeI7wGDDENlH iGM4ekrNCLFVuWHWFwCm0epNBAKeZTWy+bsEwbHPVpblhRf+YrGcjoDlwj6BUnCCxA2M oPha9oCiaruvYpSZCut3U33nngSmV3EoKVmE6SCdgpcd9AXTmGx3JvM/l5Vftw82P/qG NkN/T0eW6+F5VqiTpnBTUNWtDdDoYKAGF92QZlJjBUWI/AYFjkoyoS4CqcOiGveCb50J tVO9N7c4IruOaAKV6EMlPPz2xzZaA/KbsTSS2E2oroHP1bSpSixL8VNAYXlEBIQjM7yy pH4w== 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=OlrCuy+REpJseH6S03jrGsFVybSLDq/FR7vEWhajWlM=; b=0WDTZJqx3imuQUflAOq0EI41hQBSPN9HU3lhCSTeT2V8aRFIeDyRInDTKoAoVJnL6k DukwiiXRqbFllXCxMthVPBoDMg4BEzxPNL4weV/7smEgw8keIQaCoZtAONbBD6BhYq7p gZLWENBCoTz5EpLwGzZlEXXzEeKeeb5zIQW65e1+XNDoxW+N8CFyJ+P+d/HkoolKkz1j os0313lAXAvG6oPDTHQK/Rds//PSWFtoNCHcroNKN83khrEJbmX76+wnQ0CyC/NLK2fm exAHN5noHEXVAPC0PpDrrbU/WbjTVDfTufJWzS/BrsL8slcHYMeOVLWmN5bHNrL81XXb /cmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=kC6dHHei; 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=QUARANTINE 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 l17si1526491eda.40.2017.09.21.07.42.53; Thu, 21 Sep 2017 07:42:53 -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 header.s=ti-com-17Q1 header.b=kC6dHHei; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: by lists.denx.de (Postfix, from userid 105) id 43A6FC2205E; Thu, 21 Sep 2017 14:33:55 +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 9036FC2201A; Thu, 21 Sep 2017 14:31:40 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EAD3DC21FFC; Thu, 21 Sep 2017 14:31:06 +0000 (UTC) Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by lists.denx.de (Postfix) with ESMTPS id 93A1EC21E54 for ; Thu, 21 Sep 2017 14:31:00 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id v8LEUwnT000414; Thu, 21 Sep 2017 09:30:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1506004258; bh=ErXj4KX0mAkuGR2mQV9WLgGM8M00zM+0fE0KUrh1CH4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=kC6dHHei18Xgyp7uCioBF0+dxB8mypgPXiWL7ZOLLbtqk8MfNMByNFYbaWnbdRDEH Jcq136T0UOQDuGhmJQSoiOLsMfWjkvRJiW8UhEwjv2A6RFRo5iQpuldDfrXfMCvlSS JdpObH63/6eToS+6VFHeT2HA2263eVLmPYeWiimE= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8LEUwRv028958; Thu, 21 Sep 2017 09:30:58 -0500 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Thu, 21 Sep 2017 09:30:58 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Thu, 21 Sep 2017 09:30:58 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8LEUuTY030995; Thu, 21 Sep 2017 09:30:57 -0500 From: Jean-Jacques Hiblot To: , , , Date: Thu, 21 Sep 2017 16:30:05 +0200 Message-ID: <1506004213-22620-19-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 18/26] mmc: Add a execute_tuning() callback to the mmc operations. 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 Tuning is a mandatory step in the initialization of SDR104 and HS200 modes. This callback execute the tuning process. Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Jean-Jacques Hiblot --- drivers/mmc/mmc-uclass.c | 14 ++++++++++++++ drivers/mmc/mmc.c | 5 +++++ include/mmc.h | 11 +++++++++++ 3 files changed, 30 insertions(+) diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index 9c6a8ba..60cc0ac 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -92,6 +92,20 @@ int mmc_getcd(struct mmc *mmc) return dm_mmc_get_cd(mmc->dev); } +int dm_mmc_execute_tuning(struct udevice *dev, uint opcode) +{ + struct dm_mmc_ops *ops = mmc_get_ops(dev); + + if (!ops->execute_tuning) + return -ENOSYS; + return ops->execute_tuning(dev, opcode); +} + +int mmc_execute_tuning(struct mmc *mmc, uint opcode) +{ + return dm_mmc_execute_tuning(mmc->dev, opcode); +} + struct mmc *mmc_get_mmc_dev(struct udevice *dev) { struct mmc_uclass_priv *upriv; diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 1f9730e..3e2e549 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1199,6 +1199,11 @@ static inline int bus_width(uint cap) } #if !CONFIG_IS_ENABLED(DM_MMC) +static int mmc_execute_tuning(struct mmc *mmc, uint opcode) +{ + return -ENOTSUPP; +} + static void mmc_send_init_stream(struct mmc *mmc) { } diff --git a/include/mmc.h b/include/mmc.h index 8d6e0f8..56fa869 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -383,6 +383,15 @@ struct dm_mmc_ops { * @return 0 if write-enabled, 1 if write-protected, -ve on error */ int (*get_wp)(struct udevice *dev); + + /** + * execute_tuning() - Start the tuning process + * + * @dev: Device to start the tuning + * @opcode: Command opcode to send + * @return 0 if OK, -ve on error + */ + int (*execute_tuning)(struct udevice *dev, uint opcode); }; #define mmc_get_ops(dev) ((struct dm_mmc_ops *)(dev)->driver->ops) @@ -393,12 +402,14 @@ int dm_mmc_set_ios(struct udevice *dev); void dm_mmc_send_init_stream(struct udevice *dev); int dm_mmc_get_cd(struct udevice *dev); int dm_mmc_get_wp(struct udevice *dev); +int dm_mmc_execute_tuning(struct udevice *dev, uint opcode); /* Transition functions for compatibility */ int mmc_set_ios(struct mmc *mmc); void mmc_send_init_stream(struct mmc *mmc); int mmc_getcd(struct mmc *mmc); int mmc_getwp(struct mmc *mmc); +int mmc_execute_tuning(struct mmc *mmc, uint opcode); #else struct mmc_ops {