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: 9913409 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 DF4F260382 for ; Mon, 21 Aug 2017 17:24:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C94BE28686 for ; Mon, 21 Aug 2017 17:24:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE2B128708; Mon, 21 Aug 2017 17:24:29 +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 4D35C28686 for ; Mon, 21 Aug 2017 17:24:29 +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=05pxN5Nbd8gXjEo2yduVLEiPUh8QrHKY1lc9k5pFbUU=; b=u6PQUoJ4OVS8l57NG9PJWEHvsk 4Kg/By7+8V7m67voBLj2QqsEX9Q8/qDs2LabdRvOhxS6OHmfpV2ShGtZ7MnpfZaLtNUK34LdcWlcd 6x+hanIv4DSBoI8SM7z7hoNTUeInVoo3SDNRHjO/Co6JFb5DOwAIlec1HRp/rRTo69sQy3lG1Q1Mx cGw9qiql917yPxJTDifLoyztL7iv9xBn8pjqQVz7p07UzEv7GXahVIWFpfTAFiOYB4pKxpGUlmDxt LGCLQhHn7GXOQOZAFrCquMS77vVcpSS+jeTkgqUqY7H/jSTvkhndrRgRhwgWo5KeBHlj70ZaAYDlj VgWh+wlA==; 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 1djqRA-0002UB-0Z; Mon, 21 Aug 2017 17:24:28 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1djqLg-0005WC-TK for linux-arm-kernel@bombadil.infradead.org; Mon, 21 Aug 2017 17:18:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=VxfX1DbdV8SrS/I8W60mAJ5EDTpMvDEaLW+3qt31leM=; b=oPoSwMaZplpB4ITSFxIsoncWU ZqlOg+1/4yUkfFp7W4/d2yqRqVMcWKGa7bOCEdcn6VCCYFKCTDkXoZEpo/W6iCyUH1gPeVRtn1fUk J489XbTB+gEnQJtrezVuwEuT2sM6XOkJyFoFhR7ChIDY3VPVhvCUnhAoOjpTOOsLcHRcdgYwsOHzw 9G5/DhtJQ67PaBu6LmG/owKWakz1YVQIqeg+MZl+HSEDmkQKRdw9o2KEnp1wD3Gs78HtQl5yB4y2I BHvQ7V/sF/mqqywWywQErKkiN9jRPoge+fMrpKPqJ+Q+ZmdlIlTZhNxTL0kfQn55Cp/RIZZ6kh0VK 2uNLxCbRQ==; Received: from mail-wr0-x22b.google.com ([2a00:1450:400c:c0c::22b]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1djpB1-0006dV-92 for linux-arm-kernel@lists.infradead.org; Mon, 21 Aug 2017 16:03:44 +0000 Received: by mail-wr0-x22b.google.com with SMTP id k46so28391672wre.2 for ; Mon, 21 Aug 2017 09:03:20 -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=rIlHcFYTMP4cebkad6vcdrQmfZbQaUHqo9GiUd/PENO9Zjecnt41QiXF9oj4ufHekY NBg5ts09ktlDRHmtwh9Q5ZCUx+Mi1XcAUREutPvdjF/IXg0rN58Zn4a8rm1tWaqQmHbx Grosu8YVh8hl365iKKyeWaCuPnU1qXOwZTDRqmPEQsY8IVeeIbn6CutjOgPPuJVgOG2e 3kWHfjQg4kgPG41CJirmqtKqWykDFqIot+YLgGWfC9WeS2Ee5YUNvOb5XYUd/03Bw1wT OCDC/ab7mvjkz/rbtSf5HBJHrcejiJb3sDOfJESYMsLWjD7ovOTyrkyZAhW9AH2+kMeT 7dAA== X-Gm-Message-State: AHYfb5iRWke7GBFobhtcBZX4HPFF6zuzTZ+0jaGET1oAKhgQMIugYyJ6 4LOTI70GBC+W91pq 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 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> 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 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 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)