From patchwork Mon Aug 21 16:02:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 110567 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4243393obb; Mon, 21 Aug 2017 09:04:02 -0700 (PDT) X-Received: by 10.99.37.4 with SMTP id l4mr7468876pgl.408.1503331442862; Mon, 21 Aug 2017 09:04:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503331442; cv=none; d=google.com; s=arc-20160816; b=YcKfJye73NFjMJZ3Rmdj/B5+9ecOmivQ7Vt3z+idabeWcatPeV0WtJtu7NraVAN4Uf mFUALjOtIqI+fN3qtraHQ6jAUEHICQnUptfRlhksMPu1eWV5RGnRvuzZgUFaBhVVvqiZ kS8fjPn/bfWJvt2kzUCjuVHox6My4/46jwVTkoZYQY4BVi7Kvqe3Kk322xsaycyL1T5U P6h/XDYy4LZIgn0+XOXzhNwF8QYyrrms8RChLRnKdTmx3tYLuYhO8ohoQHWcas/sk86z ZLc3oNH6Q4GaDpJ8JrnIyhCtzuIEVJCToUo0oGNJ1bxxF1DcF2OFLFdyLx8NKhSun0a6 vYcg== 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=Kaz2/d29J572l0tFaVnlzG+AosgmelxhGY6A0JOa7Lo=; b=aHe/J/Pkv67PekoiQVrgnAw2HuxjUv3Hq7X2R+xOKCkZjDzGA+YVTYTQS/tuk1lfpv Gj6FLtzi7CnYpKZG+DBfkz6ZzcVU8d0KB0GGtNZYf9xltmTbwubOUhf/gWlbCVk61POS FBGjh5Es8yNDRSechOcCWmoD888tVM+v+mQdz2ONXEDq8aHFiZ0xhumHHy5iZ5MXEtkT zbWF9RzWxla0fr2t3nkNw5eF8lOkNFbYj9bvjWlZJLneTRLTUL2kes7C+L+i3ZBm+buA 1kPWPiPbFYLRu+6q/N42TtC+Brrf4dQ7KRsUH4xryDcV99pxSzMUlF1fvzO1H2Ln5qPV Pizg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=Soph3+Ky; 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 q67si7423553pgq.557.2017.08.21.09.04.02; Mon, 21 Aug 2017 09:04:02 -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.s=20150623 header.b=Soph3+Ky; 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 S1754476AbdHUQEA (ORCPT + 6 others); Mon, 21 Aug 2017 12:04:00 -0400 Received: from mail-wr0-f179.google.com ([209.85.128.179]:38310 "EHLO mail-wr0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754327AbdHUQDT (ORCPT ); Mon, 21 Aug 2017 12:03:19 -0400 Received: by mail-wr0-f179.google.com with SMTP id p8so39042070wrf.5 for ; Mon, 21 Aug 2017 09:03:19 -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=VxfX1DbdV8SrS/I8W60mAJ5EDTpMvDEaLW+3qt31leM=; b=Soph3+Kyw5EV4/rEQuF7k3DzmC+AlyFpQfRmnSAtWqrTn0XbnS970uaPT9dQg7Li+s aNxtGBmWAiMbEv3M1oZabZmvNQ2t53CJNeiTmghbAUOyyaswqbaQRWGaOZ8bI8MdBK92 yJfa8rATSsAwn3VAgBccf5JlX5SxM7UaAMbHInHMPZLCvbRtWRLXX10feBLPOZnukPzA UsUNGcWk6r5g9dKmUtjs2jwRu2EI4LaZVOULLijipOL6rkNdOT1AX3ANms1sDahVTiYs s3ZnMIvYCmMqTMYMfOvN1aiqNX4q8Qo6qVIjtHUOodIfZzEfNVkBWTAkwoineYDS0NpS vkRg== 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=VxfX1DbdV8SrS/I8W60mAJ5EDTpMvDEaLW+3qt31leM=; b=dWmUC6O5fRoNETykkvWijaUlTdvyMi0SZIu8ADQe9dgO88OSaITJscE/iwx3IWJ2PK TqHGTk7eBSrjUF0JQEM2UhV05RxsLlqyxwOgV3SRMnzL9c8be/69lv/Y/9lITJIPtef5 M1iXC8cP7eY4Mjpa/luFb9vcoedaJ9YQZhlhkpZDZ0qfxp7/SLpVPIv4ulnnM2QVdKJ6 O49O5MHsw8jC9Tj5mIrtnMvySPzDfBvSduGigM/Tr8wojCk00Hi0Y/STE9/xhZxjCYSU p+ieqWHwpl4t97wzcPBZsItt7sWrKrTTOl78fPRr5/JsRjYxB8TPgiKk7vFhaPrZv05m psUg== X-Gm-Message-State: AHYfb5jQHfol5lcgyCGEsELTpJMQomVSrvmPgTEFebSBg/oX8mEsg7uV m1oml/EwmQYI3Yqj X-Received: by 10.223.179.211 with SMTP id x19mr11817450wrd.7.1503331398357; Mon, 21 Aug 2017 09:03:18 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id 63sm8120063wra.30.2017.08.21.09.03.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Aug 2017 09:03:17 -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 v2 12/16] mmc: meson-gx: implement card_busy callback Date: Mon, 21 Aug 2017 18:02:57 +0200 Message-Id: <20170821160301.21899-13-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20170821160301.21899-1-jbrunet@baylibre.com> References: <20170821160301.21899-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 Reviewed-by: Kevin Hilman Signed-off-by: Jerome Brunet --- drivers/mmc/host/meson-gx-mmc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.9.5 -- 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 5203a9f76fe3..441ebf2b0146 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) @@ -903,6 +904,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, @@ -910,6 +922,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)