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: 109443 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp2474265qge; Fri, 4 Aug 2017 10:44:22 -0700 (PDT) X-Received: by 10.84.231.197 with SMTP id g5mr3708255pln.152.1501868662384; Fri, 04 Aug 2017 10:44:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501868662; cv=none; d=google.com; s=arc-20160816; b=wfRS1In7oO0ilaNJgaVle7jzNBQDIbqMCCY/1xrkfYGWQLBUDmxIw07BrjvObsoAxH QI8749Y2jd7W9HNFw8ErWcs6zEMOaQ5VgnTI+hSGWhp3oluebpgQahXZC2P2LgsMyYA1 5HZ77tuiDaHEW9GvKgSYC/YqZYTOHRzBFnXrX9ETrNGRiZ83bc9pEXm9mK1voIROD93I 0Eoi2JKzQ0Hz3pvw0wgxplSLPRQWgS8Spw5I6EwLkmwV7K1e3UxQcu9wDZX8eTo8YI+V Z4dKGJ7Xd4jkt/efjEgeEOoZXE1vQ2fmUNTwAhJCQQabmy2+5vBBSa4x/BLjCrNV/t76 ZzwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=qfDI1qGBRtR+DxvoJuJ2d5NnyN8cZHB8XAkki9clxOk=; b=MzCHXY2UP4g+QenxlaYczrxSS9of8oiMtkuXiRsZ4qpBG3E33AEb38r4cA2i1ReilC cqgtUcamRmCUVXjUso6rSUTEl3YVHZ+YQ85I2EQr9GlRrJhyvpwonzVh03VmbcDqFgab MgFR8IMHrMTpyPr/kotqa6ixyZRMTueSohBXLbCfAhPF4iJ3JZvA09dtJyotSARBcjJa bwY9VOvYOJ0J20uFri7L+Bq8gRevPooIhlevHvSSFA4OppLdocYjO5Z8/WGWpnU+Ijkn JLUExphnSVuk6IYVhkrrbDxUbNTMX7tTCu2R27rZssYBwhu0FpC/PP1jaDd6PKNDL6pW TbXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com header.b=ruNZxVT0; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d5si1596563plj.158.2017.08.04.10.44.22; Fri, 04 Aug 2017 10:44:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com header.b=ruNZxVT0; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753219AbdHDRoU (ORCPT + 6 others); Fri, 4 Aug 2017 13:44:20 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:35540 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753146AbdHDRoP (ORCPT ); Fri, 4 Aug 2017 13:44:15 -0400 Received: by mail-wm0-f49.google.com with SMTP id m85so25330699wma.0 for ; Fri, 04 Aug 2017 10:44:14 -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=ucvuDTyB4zEX44ddnxJa/OWz5w1KL0yX9JeRjHfkYvA71VzaXZwbAsr4bexgQW55CS phguR/QFyCB14u+PmTwMfZBMCv3N/Ur+XFLhv/rljzBsRzDHvbGNGMiOJG0UhFKdyvHx y7l532yQyowwIOf4oNkGbta643PAluVGVooPZAxeGpmKbMt/C4tVL9NVRDqaAOT+W8K2 w9U4w5FfWxeB0lkK5P8lD5u6FL1KDdp1ECVhnCaRu18ohQwkx/oFW9CXfuJeeNi9xjAE Ijhyt9VBgx7RZ7BlNY0b+Mp1ZkiXA1NYw3vgg2gPzJKsMkGzUpqiWtbCpobDH2ZhL3CC BIiA== X-Gm-Message-State: AHYfb5hNB94IGohx1tuJSkWmxMuETksphLYrN6h3MFQl4JMnJ8OAwDAP FNhSPxj5b7chzjhI 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 Cc: Jerome Brunet , linux-mmc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org 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(+) -- 2.9.4 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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)