From patchwork Fri Aug 4 17:43:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9881837 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ED003602B8 for ; Fri, 4 Aug 2017 17:46:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA6BA2891B for ; Fri, 4 Aug 2017 17:46:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEC1D28930; Fri, 4 Aug 2017 17:46:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 81E932891B for ; Fri, 4 Aug 2017 17:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ACEh3n9C5p+P7AvSPfg2pYmZbsPQsCSQ8VmAodB+6UU=; b=QHiPXMWY2T1zTWrZySP0H4mOry gBkjW81IhXb6f04Ur9UyCXRa+7z8LLCPub1cXpj0ejagIHjm++reQsdMpOk+eDLubb5VtizBxJt5z VP8VC3ZLwrnPToRls7lEuA0tcTxAYparBgYGhRGpVEiUdL6h1VFzfpNBfeEn+jgaOSBENajiYq0vp OI3N2jwDHJfNgYtazHPniVNQVQNRdIPP7MP5EIIbIPutCZo2/m+BWaG4vxSeICSY+P/Yy6+KFAa3s 8d5kgwf44XIrO8Ku5FeSdyZn8Ol3sLc7k3meSUHzwGS0OfR4NMzcBlLoFNB5ekAuBH+tyj4eBoUAq NXIi32pg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ddgg8-0000j8-Tq; Fri, 04 Aug 2017 17:46:28 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ddgeO-0006Yi-5R for linux-arm-kernel@bombadil.infradead.org; Fri, 04 Aug 2017 17:44:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=8CtsuORPhVgF/OeAmGNoR5BfCTh1VWtRWrFA0Ogw1sI=; b=EhUR/uUvx0oqqE8IPZXyAEms1 2L+ipO6AOPnZ2twLvD12ufnDo7A0FTMTR01A3gCT+JYDt39zzd+whZXkpuARZe83lNTXuwWiVKbu2 T0BrfedIrFl0yT0nsmAuXM0tXQFwgIvp2TWW/t0al5YNu8p3lvTssmT4hwPEZ5p+y2of21mlmU0St oEihR5IpcNEB8MVN+GkwFl09q3OVzI0V/V47OPMgHs70xTFe71LnIIJuFx5LktCzFQRWEuUUzGoVG MmQnDR3Q1TGMzEqt3Pt6SAQ4uDX21/0eJYdJpzQ5mvZMQJ1GKQKa65bnWjcCpo9U5/Om3H7N4dbIb vHFQ56McQ==; Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ddgeJ-0005gW-9X for linux-arm-kernel@lists.infradead.org; Fri, 04 Aug 2017 17:44:38 +0000 Received: by mail-wm0-x229.google.com with SMTP id t201so25293559wmt.1 for ; Fri, 04 Aug 2017 10:44:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8CtsuORPhVgF/OeAmGNoR5BfCTh1VWtRWrFA0Ogw1sI=; b=ruNZxVT0QMxua7a3DUJf8JfJ8FNrxarph5QSMFZg2O7pB3+Lkm+QvX8i3Pk2bqKslJ gQtlldU9bBuWoaSBiR9SDyLg6WiyNb7gaBZhKAApE+PFWGaR4RmGZmWN2tbGZBi8HP+D A/af8URXds7JTEYI4PVVzrv5pp+XeXNwq7gLiutiNl6rmVjZoe65dFyXgnORRG7HKxn+ TLX2ttbTHOEERdmbHHbyeBaHkluGoUvmM2jOB+qH4/rtmSt1wrQXMj5CArI/ikYyYxg+ pgIH30pLoQxCkaVa/8LfP+H0KPECSpZ2siJMjNwHedDfHYOC0k42ko4BUCkCerUMLfwT 5EAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8CtsuORPhVgF/OeAmGNoR5BfCTh1VWtRWrFA0Ogw1sI=; b=Q0/XVcEurE6CtFazf7h5+tIadoVs30bTm5y0v+31X1AP7BiHDttD+K1HBVm1XJ7yUT 3teOPOrWeQdBVHIqXcBd0se9mghl2cchJ+s1evufDxR1sy9yC2FUar5KXBpPLtEWb08K lW2sb/qJ/bPZwIQ7CJVY2upRwls2JxyWn8luXTCJ5RoAmeIFW7j4ibb9SVwE1wHEIvSz ihs/EYJSH+Avf6Iz6asY/V0txDBSNvI2xpvZaSHCMBhEtO6pw7ohICtZ7z1oGIbtk9+u +jswjdxYk+O0Gf+n+FzdUIxwYyKTv9LcXaBSNGrseRnJeImSfQlW2dSQLU018wrol1/5 aJng== X-Gm-Message-State: AHYfb5gYLuJGJ7ruXhB5EaAIEcUApi6l7iRZM19lQ2jR63uJsa5ArLBh fxeJjQBFsUv8jV8l X-Received: by 10.28.94.19 with SMTP id s19mr1748019wmb.15.1501868653996; Fri, 04 Aug 2017 10:44:13 -0700 (PDT) Received: from localhost.localdomain (cag06-3-82-243-161-21.fbx.proxad.net. [82.243.161.21]) by smtp.googlemail.com with ESMTPSA id p17sm996082wma.45.2017.08.04.10.44.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Aug 2017 10:44:13 -0700 (PDT) From: Jerome Brunet To: Ulf Hansson , Kevin Hilman , Carlo Caione Subject: [PATCH 10/14] mmc: meson-gx: implement card_busy callback Date: Fri, 4 Aug 2017 19:43:49 +0200 Message-Id: <20170804174353.16486-11-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170804174353.16486-1-jbrunet@baylibre.com> References: <20170804174353.16486-1-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170804_184435_352000_34687BC0 X-CRM114-Status: GOOD ( 12.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The card_busy callback is important to then add the voltage switch callback as it allow to verify that the card is done dealing with the voltage switch Signed-off-by: Jerome Brunet --- drivers/mmc/host/meson-gx-mmc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index d876b80db27d..33ab341a8b33 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -76,6 +76,7 @@ #define SD_EMMC_STATUS 0x48 #define STATUS_BUSY BIT(31) +#define STATUS_DATI GENMASK(23, 16) #define SD_EMMC_IRQ_EN 0x4c #define IRQ_RXD_ERR_MASK GENMASK(7, 0) @@ -845,6 +846,17 @@ static void meson_mmc_cfg_init(struct meson_host *host) writel(cfg, host->regs + SD_EMMC_CFG); } +static int meson_mmc_card_busy(struct mmc_host *mmc) +{ + struct meson_host *host = mmc_priv(mmc); + u32 regval; + + regval = readl(host->regs + SD_EMMC_STATUS); + + /* We are only interrested in lines 0 to 3, so mask the other ones */ + return !(FIELD_GET(STATUS_DATI, regval) & 0xf); +} + static const struct mmc_host_ops meson_mmc_ops = { .request = meson_mmc_request, .set_ios = meson_mmc_set_ios, @@ -852,6 +864,7 @@ static const struct mmc_host_ops meson_mmc_ops = { .pre_req = meson_mmc_pre_req, .post_req = meson_mmc_post_req, .execute_tuning = meson_mmc_execute_tuning, + .card_busy = meson_mmc_card_busy, }; static int meson_mmc_probe(struct platform_device *pdev)