From patchwork Mon Aug 28 14:29:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9925673 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 5933160329 for ; Mon, 28 Aug 2017 14:32:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B4EF286CD for ; Mon, 28 Aug 2017 14:32:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FFA320881; Mon, 28 Aug 2017 14:32:56 +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=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW 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 858B520881 for ; Mon, 28 Aug 2017 14:32:55 +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=RumhX72eaY7DXj0ZMhdhC9V/hWylFyoyRdgIp9CllyQ=; b=Und2bSkyJBD3LUGjZZuhHPCH9f t4z9E0O4bs4hSwWg+h/y6fFUbNFAC8XCNefgryVDIAyOxuc+hNrbnTNd5cVDfx1YCnWRtFBxWQ1SU Cf4Xg3F6yEonTbw9qP0yfxzRBjgioY0Ol9gV6RWcZOJuIfaOVdOHjT3pPTRqFhbrd8ydcVD+dacM7 TDE3yUlJPGWlYGTDrDPqSa3UHh7oIcogtCqVDNS6Jph+FX7VEoFUNNyzIh/2bjrS1ihJ+5IJN6EhF 4W8QQNBnlzY/ge3nJG+mTVlqSSNqa1gmWhGOKyf51xhmxyvy6+wiYreS7x0eaYWXHC2ZcbxmlIeMQ QQx0+DCg==; 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 1dmL5v-0007ev-IB; Mon, 28 Aug 2017 14:32:51 +0000 Received: from mail-wr0-x236.google.com ([2a00:1450:400c:c0c::236]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dmL2z-0004X8-QY for linux-arm-kernel@lists.infradead.org; Mon, 28 Aug 2017 14:30:12 +0000 Received: by mail-wr0-x236.google.com with SMTP id k94so2261294wrc.0 for ; Mon, 28 Aug 2017 07:29:29 -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=b8v8ooREBElbOhWT16ulVZsQ/J87vqZwz24LvUYHGC8=; b=tGkyulfCIO+kRvqTF0jKpnOWSEfON6MaRNiLkphlxW0mSEQ/wgr+4R7s6Llteh8OBn iUR26aUKP91HNas5urMWtg+OMdr6reGjRRuJ9II0oQ2JG9qxfqUGZ7gggNEL70Bnzcm6 kQMyoqfPCzThKJR621pFOEePUhRgbWyhiytyBc7ztfuQlfJOvWYX2CCWOLo7AKVWJ+Iy CXciWMkBPfr01jxu1fL/P3EtPihsmpI+iZZ4i4nu29zFxBaLxloO8fBcg1wkmIBD8Qo5 JVFiMJ8+9/N1Nv0PHSixGgzDStEk74F+xdFBtCqkn+7m5xBvj8MFsNB39iuyhywTS7+L e9Kg== 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=b8v8ooREBElbOhWT16ulVZsQ/J87vqZwz24LvUYHGC8=; b=a90xpbypFVYD+Fk+q/Y+X5mAQ0xaMQg6jnMlBWZNmzyk4Bdu5no8sW1+AvULgzpOJ5 C4+C5Gv3Nhu8ZHh388OVL7REJC0dYFiNIWveglfPtucI1E+5XoiTxyK/RWQ4+wmzJjvL sfqnEKFP1tcvZwTyCfFX9UJwPD0Rq49gJKfvVKDOKi2SuXMFUMPOUbbgapy3WA8J19Py hSM5LnCU8uP2Mgx5AGMIc2nv0adVspu+4OCrQMYMu2A+SXgkBjwqZt/P30nh/QNK+2U6 xORP+LoT2QkUg+dc0GEL6hg4WczJ0/amiGOeITEWn1cIBVNeeX7Q4YGt+4hPHULqVDC2 lEUQ== X-Gm-Message-State: AHYfb5iiLNwwXG/GRrAQrVwI6Lr6YJ+kFNJ2VMUQB9PJ3YX1YatMDOfy OosVEYYbWb5ZLcJj X-Received: by 10.223.152.72 with SMTP id v66mr554556wrb.52.1503930568034; Mon, 28 Aug 2017 07:29:28 -0700 (PDT) Received: from localhost.localdomain (uluru.liltaz.com. [163.172.81.188]) by smtp.googlemail.com with ESMTPSA id z39sm604792wrz.61.2017.08.28.07.29.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Aug 2017 07:29:27 -0700 (PDT) From: Jerome Brunet To: Ulf Hansson , Kevin Hilman , Carlo Caione Subject: [PATCH v3 09/13] mmc: meson-gx: implement card_busy callback Date: Mon, 28 Aug 2017 16:29:11 +0200 Message-Id: <20170828142915.27020-10-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20170828142915.27020-1-jbrunet@baylibre.com> References: <20170828142915.27020-1-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170828_072950_532824_0B994B91 X-CRM114-Status: GOOD ( 11.63 ) 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 Implement the card_busy callback to be able to verify that the card is done dealing with voltage switch, when the support is added later on. Reviewed-by: Kevin Hilman 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 3914c3a82cc4..40fa7ae64c72 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) @@ -902,6 +903,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, @@ -909,6 +921,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)