From patchwork Mon Aug 21 16:02:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 110560 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4242212obb; Mon, 21 Aug 2017 09:03:11 -0700 (PDT) X-Received: by 10.99.119.9 with SMTP id s9mr15373321pgc.439.1503331391627; Mon, 21 Aug 2017 09:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503331391; cv=none; d=google.com; s=arc-20160816; b=GvPYIcaxLt4/vMb1jdE0lXLbWYG4AC6hrTdnDsPWmaR52FXiDIawZsBkf9Tr8vdI/1 YTdPEF3XJzH0mD6gKhYoF8uZMJ8tBLpOWqmKw6TarWc/wtkXwjm2CkxfdI+XrRF5J87r 5UZonCV3tfGB+XqduGuh9uAEe21asxh00mB+Rjc+UHW6CK3kOFFaUWTeNNlJBaTt4pNA nluNew63hHU/TpR3s9I5XDKc9L/ruOhZz1AnhB/UvjCD88wq/p7EW2MZu0FSB4DC7Az5 wzP2JvJDiwk3YhM0P0IljR4p/IrnKn24F/8DFo+Vietg9u2WyHrTNthhPEbPFA0JOv9t PAog== 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=4HjYSeOIr1FrVYriP7o+BasjE7jp3EvWNRHUHlO0KZg=; b=Cmp4IL8DTZRr5QcowRcREZF2ooLRr1+aaFD380QqNMUmwTxiN7J8ALnr0Pd2Zuln4Z tBZTzAsbmTsR46beX7atjccVwXL9UyAHbRcfErjqoAv6p5o+lL4f174r5AEqP7AzYp3Z nbfj3JDk2KCbCkwLAh6gMO4EOGiAy4xvYsHoT+x4QDkbqbZLVsWIAWrELG90vA3dH6eB LFZ76cJbLiAN1NAONlRRxJSJIXpGexP3ioGUuIJh5FS3NaxzCRxaBl3QTX9IOIJwuNOX wn4qkYlz5VZ8U01kPGuNRqfzjSujcRNCcj+RPypc3LVPzjuGjHx5mYj/4vfxvNqwRGIq pv9A== 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=W2T1V4mN; 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 t191si7364544pgc.313.2017.08.21.09.03.10; Mon, 21 Aug 2017 09:03:11 -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=W2T1V4mN; 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 S932071AbdHUQDI (ORCPT + 6 others); Mon, 21 Aug 2017 12:03:08 -0400 Received: from mail-wr0-f171.google.com ([209.85.128.171]:38187 "EHLO mail-wr0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932101AbdHUQDH (ORCPT ); Mon, 21 Aug 2017 12:03:07 -0400 Received: by mail-wr0-f171.google.com with SMTP id p8so39037054wrf.5 for ; Mon, 21 Aug 2017 09:03:06 -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=vtGvtuKp+hmDN0nuu5DpYl6I7MCf8fDGQVP8RGVLE5Y=; b=W2T1V4mNSJ4WFz8klulrXLxdLiPh9+KOXgA8cVLElDVZnv7nQLEV5O7j6lnXF8LMl5 weRulofTmtQ3QU5ZnLwsnYLooo2J6ZPjj7urvsmm0CxnPM5RfMMVVb8UhlQIEeM9hsyd DU/6LqoYbpapbnoqPhe61p07HreKFKRSi+VdIm0DHJm1JEUpAHUCD/pnscbHgOYWY/9a IpPo2yNZAoLqnGeAZRBxFkPHDq0UITcBw/jRQ99mW5h3Cuyzj/irpjFHQLkerlGO0bCF 2++DiH/xWuYjbWnkefVE5vkDMeJeMwPpKajFEK3ic1VNbUf+6wHwe5vH82QAGNNMoVNS Z4+w== 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=vtGvtuKp+hmDN0nuu5DpYl6I7MCf8fDGQVP8RGVLE5Y=; b=ZAtITv9cAYxK1xrRUaCUzi+eoxRYX8Y6OUbMohQOK1yp6RxZWLPYPX2SineW9v5ClR sXFdH7psSaagkFO+MfYa4bPowW8ioz4Ehss8JmCcIYmICATbDnlzYJh6SqhO+8kCtl/s ypexyrXh1z0idC4BNa+Uct6/55G1B/F/vg7/RaPJYwDJUH7dtwMCi5aR08PuDVcfp6VU P5dJCHXC4iWoee7FsQXrqmAkP2IGw25jOqFocz2026bnikW5oGg0MEFz529epX4FBHVk hmC0FE0EnpbfVSfAAKkZzH/M5Z6nZuNfziJb3HkkmT5Iyr/dV839k0WQu4T3q9gPudZC URZg== X-Gm-Message-State: AHYfb5gSQWzyXw/qQoabI8oxr6T6/9maQs7eO2SK4Skxr/CxMowzOInZ qb65kkeOoEI7Oqx7 X-Received: by 10.223.196.10 with SMTP id v10mr461807wrf.5.1503331386121; Mon, 21 Aug 2017 09:03:06 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id 63sm8120063wra.30.2017.08.21.09.03.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Aug 2017 09:03:05 -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 01/16] mmc: meson-gx: fix mux mask definition Date: Mon, 21 Aug 2017 18:02:46 +0200 Message-Id: <20170821160301.21899-2-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 CCF generic mux will shift the mask using the value defined in shift Define the mask accordingly Reviewed-by: Kevin Hilman Signed-off-by: Jerome Brunet --- drivers/mmc/host/meson-gx-mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 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 de962c2d5e00..4217287923d4 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -366,7 +366,7 @@ static int meson_mmc_clk_init(struct meson_host *host) init.num_parents = MUX_CLK_NUM_PARENTS; host->mux.reg = host->regs + SD_EMMC_CLOCK; host->mux.shift = __bf_shf(CLK_SRC_MASK); - host->mux.mask = CLK_SRC_MASK; + host->mux.mask = CLK_SRC_MASK >> host->mux.shift; host->mux.flags = 0; host->mux.table = NULL; host->mux.hw.init = &init; From patchwork Mon Aug 21 16:02: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: 110586 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1494252qge; Mon, 21 Aug 2017 09:10:15 -0700 (PDT) X-Received: by 10.99.174.70 with SMTP id e6mr13563875pgp.246.1503331815136; Mon, 21 Aug 2017 09:10:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503331815; cv=none; d=google.com; s=arc-20160816; b=JKinYpJvvleCjAkpK5MTV5D+YtjwAHEPT1rwx/3JbNy5aeaYzei/vCF9SlR2LPqA4D qvudzo5E6FGfvqu5G4oOO+dEKkRVBSoWrUAk0i/yL33+opIjiRn3zyvBV6Ryc6qb+dwY zIxD3bcp9RxoedOrfpKVKoZu+9aRzD5PcohhacyUMR1tqc9iVEXIFNlScHxQv+QRvb/J u32zPlO+e6ctDinVdr9pQrDAxsp+jTq9U0PRaeJj9RiO1Zsuu4Ex/kmmpqNTu7Jc/QSA FvYxZKSbxS3WFrfmjodPtc3k+blwsHFAYOsjYG1VHwTR63DaYrZ+BuGSv6Nhx8U0trFl eg1g== 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=FJHs18Z4CXNKBBP3Uvk/e6a8XiMIWbTkvXDY9cLr9c4=; b=U71rypuP8C0NbACHKIMLAkTgT2yggqklYCnfhpoRzH/SZP32CW3U2wwHgPWdZCn3Ei lva7Oeau6xPlMRPneI+bhA2rU9fjmK2rkQrnUUJ0f5avyBAPggT+/cgnJRS8RzDjilvu xkgpfCcWKANCi/H23YLmfw1kN+QsnsHbm+3vrAuA6Ce+1D59rbydW7v9Z5JbBiI4Czt4 kNitAdtKzFeNGw1LfJbgyY2uRU3/Dx5/26j4e2fyEIg4slCFqKs0l7Ewsq5vy9mXrU8Z GI7bGd8lpJCi4GyuT7T48JjfCgVjK4MHwlr0enOFBzyEQBMN/4/2Vxi88Mzf1O65xF7i itBQ== 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=CY6ueAc7; 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 62si7022226plf.66.2017.08.21.09.10.14; Mon, 21 Aug 2017 09:10:15 -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=CY6ueAc7; 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 S1754305AbdHUQKN (ORCPT + 6 others); Mon, 21 Aug 2017 12:10:13 -0400 Received: from mail-wr0-f180.google.com ([209.85.128.180]:36621 "EHLO mail-wr0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754421AbdHUQDK (ORCPT ); Mon, 21 Aug 2017 12:03:10 -0400 Received: by mail-wr0-f180.google.com with SMTP id f8so66997947wrf.3 for ; Mon, 21 Aug 2017 09:03:10 -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=e/mkEh6vKb3w27VkaFQj3TwBFoTzGLL2dmtRmcksRPQ=; b=CY6ueAc7BrXQM3F4Ra0uWtNwubq01psnaT2P/baIPZ2e5mHcku9+TpFxw52MlPyy6M HBQZq6HqJP4ZgGyqqZrf11drU+xEpMJBgyPmpbZG7mWWC/TkIjgNnzTPPJAUGpRIEDvd qvDufflpDX9DVTAfopGd5bEwoGHshIHteBNL13Dz5CCdbmBVato/6olfhpXgP+AMHoEY hC7613hIM4Af7K3cJp5gPeP42cNh1UxymjCMK/8q11T42NtosBQ50SaTKgBzJ6+Tuqy+ 6vH2QBfaYWA7QigsoXQ2Cpb1Z0LryQjDWJf9QxUD9hQXlGMblQnP6X9spvhdhxyZXEcm uckw== 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=e/mkEh6vKb3w27VkaFQj3TwBFoTzGLL2dmtRmcksRPQ=; b=Nr93DR42KFA/c95QMYTjSlVB0ZlAImIhtDikkiJIL2vRdp8QY0y1UETwhNKnVfliif 4p4SLvLtHA1nQEQnUQ9/Fmn9H2UfQ8eW1Er7Bgs9123754JDzFijxyeyUT8f+j14PNWS cTQpU7ENVj8TbtgPJyg+I2EQXyDLdMBJH0wXGR1OPr+MB/8ATE3K5m+WvTSXMnm0umAI nJ8Y7+U52sIglWmFiGFzuXc6/IenzZ6jviC+hit94Q6lcVjF2PIBLo8MJgjEaBH62eNU +PGapO7vG+50vuRhbaEWT2K47i8fM3NeYCAWsSws71rjqvnwqs1g6xAihFDL6ZNsfRu8 Yrzw== X-Gm-Message-State: AHYfb5i8ysc19qI9CnEEzOiB7KNdzvx8KRXC/H+7EuxduhDdIvf9O1UP 5m4hmVtlISZMXY6Y X-Received: by 10.223.179.83 with SMTP id k19mr507430wrd.232.1503331389568; Mon, 21 Aug 2017 09:03:09 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id 63sm8120063wra.30.2017.08.21.09.03.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Aug 2017 09:03:09 -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 04/16] mmc: meson-gx: use _irqsave variant of spinlock Date: Mon, 21 Aug 2017 18:02:49 +0200 Message-Id: <20170821160301.21899-5-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 spinlock used in interrupt handler should use the _irqsave variant Fixes: 51c5d8447bd7 ("MMC: meson: initial support for GX platforms") Reviewed-by: Kevin Hilman Signed-off-by: Jerome Brunet --- drivers/mmc/host/meson-gx-mmc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 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 8a74a048db88..a399fbd415f4 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -727,6 +727,7 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id) struct mmc_command *cmd; struct mmc_data *data; u32 irq_en, status, raw_status; + unsigned long flag; irqreturn_t ret = IRQ_HANDLED; if (WARN_ON(!host)) @@ -739,7 +740,7 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id) data = cmd->data; - spin_lock(&host->lock); + spin_lock_irqsave(&host->lock, flag); irq_en = readl(host->regs + SD_EMMC_IRQ_EN); raw_status = readl(host->regs + SD_EMMC_STATUS); status = raw_status & irq_en; @@ -806,7 +807,7 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id) if (ret == IRQ_HANDLED) meson_mmc_request_done(host->mmc, cmd->mrq); - spin_unlock(&host->lock); + spin_unlock_irqrestore(&host->lock, flag); return ret; } From patchwork Mon Aug 21 16:02:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 110564 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4242580obb; Mon, 21 Aug 2017 09:03:28 -0700 (PDT) X-Received: by 10.99.133.65 with SMTP id u62mr16468924pgd.100.1503331408355; Mon, 21 Aug 2017 09:03:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503331408; cv=none; d=google.com; s=arc-20160816; b=h38kkXy+28Hmp7hYl47b69lksQcl6HmwHUV2iBjImt4plqqVbfT8uSaSMkezt1MetP uim9CIHNARD4zp8SIUsk3hiFHSI1aRv+2cyDf/pCfpYc0SvX6/xM61h6MV3BS5ZJsg9C 9jMMQBDWy49N3RpcBtOcnwgI9HyJ8+UKNI+HXXAMw+f7YB9WbzpN9x+WFG+4S+1OwpSM dtsPq9jWVfPaRQ7o/ysUOgkgQRF/wtW4HhDChMybOFiiGT9CTO8eUOftgeZs+3s9b+7s P/g5lvNm0h3BlFsrQpA92xq2cPJrQy0QFGbMPNB2Nq5fa6+BFOb3xPsgS8rmnytLPpPD 4Ybg== 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=TLlHD9sSl/Lfv+/UZCVll5axMv4dEe/NlaLvxPjRM0k=; b=vn5pbajU+NdeGE9YpbKLIBT/SfZeZPYMGyZVHlHqowvRXKks1o7pMircrhFV1MsbwT U35qzWJQJZBOxbPPCll/G81gTirSC/gLEF0l2z6UAAVs8KCRZVQsHzq/ThjPVdJ/L/VJ w6GLpNEZ1rsBZWzeLOCeOO0Fd2tjhk0wG769aGJYsLvm3wuVMv0D935ie7wKo133NqOg 2zXpkPxT5Cr6Q9Mx4OyE99lDxeZh5bm6vKZtn72o9Gb49nr7ndDCaCrjlKi5blwgPj74 aXV6svjLX+NxgCdigSU0T84agyJYN2kbSf8Xq03DFpKUgLurgClQA8rSCm1q0rV1/hX5 nPXA== 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=hegMe4qd; 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 b19si7567379pfh.86.2017.08.21.09.03.28; Mon, 21 Aug 2017 09:03:28 -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=hegMe4qd; 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 S1754499AbdHUQDZ (ORCPT + 6 others); Mon, 21 Aug 2017 12:03:25 -0400 Received: from mail-wr0-f169.google.com ([209.85.128.169]:37480 "EHLO mail-wr0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754454AbdHUQDR (ORCPT ); Mon, 21 Aug 2017 12:03:17 -0400 Received: by mail-wr0-f169.google.com with SMTP id z91so101575557wrc.4 for ; Mon, 21 Aug 2017 09:03:17 -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=DNSoQjIsa7AEBBP0HwX0AdrS4mGgMCPVhLtHMVbz0Ng=; b=hegMe4qdTA+IbI+SsXB4G/n42nL+yDmAmXEGFi2LaLR4z51RiJkCJQIOsoEiRIpdX5 2JdV15kp9yzqN1IgoGZ9+AphwWdBq4niiXO6dpMHuupdOoAXWQ7B7Y2t2NXNy/RpwHjF Gc+1kSGf8P5r5fMEBemE4H0Ayz1WT40Q80kaESgP8AKh7idZOFbeKTF1ga5fyCaA1fhb c5Vrzc/w/w/OvtjHm8xNAUVOPOiM3TLA7s8xANZwxLJSFD10tfZuSZAW9VpMFc3aep9A L3Ai8m5cHCRejZhWDEZr4hsZ6gv5lg1R2KaP8Y6N83AauU5W68IvhH/jg/DQCtU7rMSE 9fxQ== 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=DNSoQjIsa7AEBBP0HwX0AdrS4mGgMCPVhLtHMVbz0Ng=; b=CvutgFN4Do991XBnyXc3uU5ETUDr0NxS4cXgZ8jYOpV7lhxT8UhUnrk/dcmqfPLSK1 ZXVH60TvVR4oczb5jOlWUQAnLpGY2adfCCBvIvsrK0rOYSk5YH0h8h8BApkkHl5T2S7e ITsTo557RYgKUKIujtqxzzLNXjxn8BZ1VgsVe2fLjd6vC+fpP5qlLz96M9V/PlXII9gi jCcm5z/pkD59pwA3Pc9Whamv/TwnyVT05ub9jGHHuMA0fsZE8vzY2KqpW+Y1QB6y6CHi MEHNOzK7AhBXDMPil6YH8BN1MDTyr5E9PzjUsqcr9wzDfIxbflkD3yxVyA8uNnr8assx dgKw== X-Gm-Message-State: AHYfb5hAp0laNA7QZJ98zk6Nt1vxnBjN0lMWKks7u+aHpEN/kv9g057j M9Psz92HPsu7rRSNDlU= X-Received: by 10.28.9.72 with SMTP id 69mr2277345wmj.154.1503331396449; Mon, 21 Aug 2017 09:03:16 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id 63sm8120063wra.30.2017.08.21.09.03.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Aug 2017 09:03:15 -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 10/16] mmc: meson-gx: work around clk-stop issue Date: Mon, 21 Aug 2017 18:02:55 +0200 Message-Id: <20170821160301.21899-11-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 It seems that the mmc clock is also used and required, somehow, by the controller it self. It is shown during init, when writing to CFG while the divider is set to 0 will crash the SoC. During voltage switch, the controller may crash and the card may then fail to exit busy state if the clock is stopped. To avoid this, it is best to keep the clock running for the controller, except during rate change. However, we still need to be able to gate the clock out of the SoC. Let's use the pinmux for this, and fallback to gpio mode (pulled-down) when we need to gate the clock Reviewed-by: Kevin Hilman Signed-off-by: Jerome Brunet --- drivers/mmc/host/meson-gx-mmc.c | 74 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 68 insertions(+), 6 deletions(-) -- 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 0d3416dae8cf..c37e31dc709e 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -137,6 +137,10 @@ struct meson_host { struct clk *mmc_clk; unsigned long req_rate; + struct pinctrl *pinctrl; + struct pinctrl_state *pins_default; + struct pinctrl_state *pins_clk_gate; + unsigned int bounce_buf_size; void *bounce_buf; dma_addr_t bounce_dma_addr; @@ -272,6 +276,42 @@ static bool meson_mmc_timing_is_ddr(struct mmc_ios *ios) return false; } +/* + * Gating the clock on this controller is tricky. It seems the mmc clock + * is also used by the controller. It may crash during some operation if the + * clock is stopped. The safest thing to do, whenever possible, is to keep + * clock running at stop it at the pad using the pinmux. + */ +static void meson_mmc_clk_gate(struct meson_host *host) +{ + u32 cfg; + + if (host->pins_clk_gate) { + pinctrl_select_state(host->pinctrl, host->pins_clk_gate); + } else { + /* + * If the pinmux is not provided - default to the classic and + * unsafe method + */ + cfg = readl(host->regs + SD_EMMC_CFG); + cfg |= CFG_STOP_CLOCK; + writel(cfg, host->regs + SD_EMMC_CFG); + } +} + +static void meson_mmc_clk_ungate(struct meson_host *host) +{ + u32 cfg; + + if (host->pins_clk_gate) + pinctrl_select_state(host->pinctrl, host->pins_default); + + /* Make sure the clock is not stopped in the controller */ + cfg = readl(host->regs + SD_EMMC_CFG); + cfg &= ~CFG_STOP_CLOCK; + writel(cfg, host->regs + SD_EMMC_CFG); +} + static int meson_mmc_clk_set(struct meson_host *host, struct mmc_ios *ios) { struct mmc_host *mmc = host->mmc; @@ -288,9 +328,7 @@ static int meson_mmc_clk_set(struct meson_host *host, struct mmc_ios *ios) return 0; /* stop clock */ - cfg = readl(host->regs + SD_EMMC_CFG); - cfg |= CFG_STOP_CLOCK; - writel(cfg, host->regs + SD_EMMC_CFG); + meson_mmc_clk_gate(host); host->req_rate = 0; if (!rate) { @@ -299,6 +337,11 @@ static int meson_mmc_clk_set(struct meson_host *host, struct mmc_ios *ios) return 0; } + /* Stop the clock during rate change to avoid glitches */ + cfg = readl(host->regs + SD_EMMC_CFG); + cfg |= CFG_STOP_CLOCK; + writel(cfg, host->regs + SD_EMMC_CFG); + ret = clk_set_rate(host->mmc_clk, rate); if (ret) { dev_err(host->dev, "Unable to set cfg_div_clk to %lu. ret=%d\n", @@ -318,9 +361,7 @@ static int meson_mmc_clk_set(struct meson_host *host, struct mmc_ios *ios) dev_dbg(host->dev, "requested rate was %u\n", ios->clock); /* (re)start clock */ - cfg = readl(host->regs + SD_EMMC_CFG); - cfg &= ~CFG_STOP_CLOCK; - writel(cfg, host->regs + SD_EMMC_CFG); + meson_mmc_clk_ungate(host); return 0; } @@ -932,6 +973,27 @@ static int meson_mmc_probe(struct platform_device *pdev) goto free_host; } + host->pinctrl = devm_pinctrl_get(&pdev->dev); + if (IS_ERR(host->pinctrl)) { + ret = PTR_ERR(host->pinctrl); + goto free_host; + } + + host->pins_default = pinctrl_lookup_state(host->pinctrl, + PINCTRL_STATE_DEFAULT); + if (IS_ERR(host->pins_default)) { + ret = PTR_ERR(host->pins_default); + goto free_host; + } + + host->pins_clk_gate = pinctrl_lookup_state(host->pinctrl, + "clk-gate"); + if (IS_ERR(host->pins_clk_gate)) { + dev_warn(&pdev->dev, + "can't get clk-gate pinctrl, using clk_stop bit\n"); + host->pins_clk_gate = NULL; + } + host->core_clk = devm_clk_get(&pdev->dev, "core"); if (IS_ERR(host->core_clk)) { ret = PTR_ERR(host->core_clk); From patchwork Mon Aug 21 16:02:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 110566 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4243297obb; Mon, 21 Aug 2017 09:03:58 -0700 (PDT) X-Received: by 10.84.212.150 with SMTP id e22mr19646871pli.398.1503331438440; Mon, 21 Aug 2017 09:03:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503331438; cv=none; d=google.com; s=arc-20160816; b=RG1TEQ4C1Tz/6El4ot6jdHIeq45xjb/aQ52+hF4+4+/Yyb5J4LeuWdCVxlSIydN4wm kyhY9f6Qh9Pk3tZpd2Ajz5r2DC+5F8dFbIq5Vnks5HnmUlT3oss/k9mMjmvK81e4eUH8 wsODBJAzhPRzMS8LEZ3+s5ZcQTIZXItvVUF8F62Aii/VL8bMZQe6DdrpiwyEWkzU+5F0 w3PsuAebUc2lLN5Tx6I72IvWJ5GDFOsLKY13Ga5Lb1oosY46CUFfx9DZ81PJ3fLNe7R7 1STaaypArfbXOWOqyy47iQNYZAtxBubm8gcO3jLfdLjk2KljmyIrUEXVp69SWkUhOfxq i9dA== 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=IFWnSkNXFmDTgdFrGspHcwMEjJPGeQJhf6Zg/x48q0A=; b=UQ1J+cpnWcwv7l71j0wdpApIdaKIt7HVpEOfgIp/gaQ6EjA4HBO7tVt0KPA4U3gtZx Q/biPToVyx2TibACgLTITzwzqtcFo3pQvo3H4tlhQIqfJlhjhiMV3ROeLxOMoaReRvXX k0I92SfYXDVuD0MEKml1x9rvJU0hSvZR/ZpYyBwqlbqgRG6zKVkMwf09YRP7g8VwT/lF ROK9oIHU0gjl1bsHSv817Dncv5QfXcBOotzGfik87ncYRGftK+UH5Zi4L4AdxGT85D9s JwZMhHv+4fPjDCWgj3j6KDoPEIZF5tXWERxg7tp5vk/nQzgWTEVcJ/HbMcSpXjN+/vA/ 6kDA== 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=aDUfZH0K; 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.03.58; Mon, 21 Aug 2017 09:03:58 -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=aDUfZH0K; 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 S1754485AbdHUQDY (ORCPT + 6 others); Mon, 21 Aug 2017 12:03:24 -0400 Received: from mail-wr0-f179.google.com ([209.85.128.179]:38300 "EHLO mail-wr0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754474AbdHUQDS (ORCPT ); Mon, 21 Aug 2017 12:03:18 -0400 Received: by mail-wr0-f179.google.com with SMTP id p8so39041712wrf.5 for ; Mon, 21 Aug 2017 09:03:18 -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=+J6cG9wkbXpcC0qAwwD0lbK2ZfpGAAXFpuKx4Lvb8jQ=; b=aDUfZH0K0esNO4ig16Q99KfSycgMVT2UK8008jr3hVtoEGfdtsEoM4ob9vU2+Zmy65 U3IEVi5LLvQzkDo17m51cZUo/ZCNyPaeYowb9NZrfMIsy+zEMIYRJhhjaIPXkcv+kChF +yzRnkLXsmogkPJ6Vysj3MaGS4cb1y/dDGhP/Zj8x/BLkSv30IhBsoTnwnunDzRwSsdq tWS8ejh7FPSXJYJZ+DkyC5xSxpekeZE6SBnCkmBPYAUpZMjpoVLhbgg0fVMDLY8doimc kCSZW/oH6yp5SxEU0YwuZWuzZQXvfw911mRQxwc7VOVdNBGwgZEElPzmk054oPq7cpiM ZUMA== 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=+J6cG9wkbXpcC0qAwwD0lbK2ZfpGAAXFpuKx4Lvb8jQ=; b=TVVGpdRQ0UAEjRKv+Tk9u8y3p94afPiGu1khndBz6reXXxszl4uJ1EfDQ78szoSWsN VT4al0ttiJ81Rifs/ceSBLQ+1JqzWxebYi71+/jfXNC6pQe9/IeDxUeoO28l89qGmj9u uGgF3rtjXSCa/tCH3r7zvBn/9uDGcAEpXFpyUALeEz+cij0+MX+ptRUtGeO5Xa7jy5BR X39CgThAGsZ4wZOb1A6uBWtCRO4JG7F6lNKSAQkKfSC9kdB28rMlAht7iHPvyBTBHst3 3P/MeiLLdiAi8X0Y2fObbYIgrUW4k6tdH+ypOa4blhKUf61gaI3NRcNRp3zZzBhQCrtF 9ABg== X-Gm-Message-State: AHYfb5gfYIdZyIIWMygdXK+6juPYQldjkyHv3l4Anb0wZiSfVN+SlME2 KPf19xvFBf9tuVaX X-Received: by 10.28.157.1 with SMTP id g1mr4413242wme.111.1503331397400; Mon, 21 Aug 2017 09:03:17 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id 63sm8120063wra.30.2017.08.21.09.03.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Aug 2017 09:03:16 -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 11/16] mmc: meson-gx: simplify interrupt handler Date: Mon, 21 Aug 2017 18:02:56 +0200 Message-Id: <20170821160301.21899-12-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 No functional change, just improve interrupt handler readability Reviewed-by: Kevin Hilman Signed-off-by: Jerome Brunet --- drivers/mmc/host/meson-gx-mmc.c | 93 +++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 54 deletions(-) -- 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 c37e31dc709e..5203a9f76fe3 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -78,16 +78,22 @@ #define STATUS_BUSY BIT(31) #define SD_EMMC_IRQ_EN 0x4c -#define IRQ_EN_MASK GENMASK(13, 0) #define IRQ_RXD_ERR_MASK GENMASK(7, 0) #define IRQ_TXD_ERR BIT(8) #define IRQ_DESC_ERR BIT(9) #define IRQ_RESP_ERR BIT(10) +#define IRQ_CRC_ERR \ + (IRQ_RXD_ERR_MASK | IRQ_TXD_ERR | IRQ_DESC_ERR | IRQ_RESP_ERR) #define IRQ_RESP_TIMEOUT BIT(11) #define IRQ_DESC_TIMEOUT BIT(12) +#define IRQ_TIMEOUTS \ + (IRQ_RESP_TIMEOUT | IRQ_DESC_TIMEOUT) #define IRQ_END_OF_CHAIN BIT(13) #define IRQ_RESP_STATUS BIT(14) #define IRQ_SDIO BIT(15) +#define IRQ_EN_MASK \ + (IRQ_CRC_ERR | IRQ_TIMEOUTS | IRQ_END_OF_CHAIN | IRQ_RESP_STATUS |\ + IRQ_SDIO) #define SD_EMMC_CMD_CFG 0x50 #define SD_EMMC_CMD_ARG 0x54 @@ -761,57 +767,40 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id) struct mmc_data *data; u32 irq_en, status, raw_status; unsigned long flag; - irqreturn_t ret = IRQ_HANDLED; + irqreturn_t ret = IRQ_NONE; - if (WARN_ON(!host)) + if (WARN_ON(!host) || WARN_ON(!host->cmd)) return IRQ_NONE; - cmd = host->cmd; - - if (WARN_ON(!cmd)) - return IRQ_NONE; + spin_lock_irqsave(&host->lock, flag); + cmd = host->cmd; data = cmd->data; - - spin_lock_irqsave(&host->lock, flag); irq_en = readl(host->regs + SD_EMMC_IRQ_EN); raw_status = readl(host->regs + SD_EMMC_STATUS); status = raw_status & irq_en; - if (!status) { - dev_warn(host->dev, "Spurious IRQ! status=0x%08x, irq_en=0x%08x\n", - raw_status, irq_en); - ret = IRQ_NONE; - goto out; - } - - meson_mmc_read_resp(host->mmc, cmd); - cmd->error = 0; - if (status & IRQ_RXD_ERR_MASK) { - dev_dbg(host->dev, "Unhandled IRQ: RXD error\n"); - cmd->error = -EILSEQ; - } - if (status & IRQ_TXD_ERR) { - dev_dbg(host->dev, "Unhandled IRQ: TXD error\n"); - cmd->error = -EILSEQ; - } - if (status & IRQ_DESC_ERR) - dev_dbg(host->dev, "Unhandled IRQ: Descriptor error\n"); - if (status & IRQ_RESP_ERR) { - dev_dbg(host->dev, "Unhandled IRQ: Response error\n"); + if (status & IRQ_CRC_ERR) { + dev_dbg(host->dev, "CRC Error - status 0x%08x\n", status); cmd->error = -EILSEQ; + ret = IRQ_HANDLED; + goto out; } - if (status & IRQ_RESP_TIMEOUT) { - dev_dbg(host->dev, "Unhandled IRQ: Response timeout\n"); + + if (status & IRQ_TIMEOUTS) { + dev_dbg(host->dev, "Timeout - status 0x%08x\n", status); cmd->error = -ETIMEDOUT; + ret = IRQ_HANDLED; + goto out; } - if (status & IRQ_DESC_TIMEOUT) { - dev_dbg(host->dev, "Unhandled IRQ: Descriptor timeout\n"); - cmd->error = -ETIMEDOUT; + + meson_mmc_read_resp(host->mmc, cmd); + + if (status & IRQ_SDIO) { + dev_dbg(host->dev, "IRQ: SDIO TODO.\n"); + ret = IRQ_HANDLED; } - if (status & IRQ_SDIO) - dev_dbg(host->dev, "Unhandled IRQ: SDIO.\n"); if (status & (IRQ_END_OF_CHAIN | IRQ_RESP_STATUS)) { if (data && !cmd->error) @@ -819,26 +808,20 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id) if (meson_mmc_bounce_buf_read(data) || meson_mmc_get_next_command(cmd)) ret = IRQ_WAKE_THREAD; - } else { - dev_warn(host->dev, "Unknown IRQ! status=0x%04x: MMC CMD%u arg=0x%08x flags=0x%08x stop=%d\n", - status, cmd->opcode, cmd->arg, - cmd->flags, cmd->mrq->stop ? 1 : 0); - if (cmd->data) { - struct mmc_data *data = cmd->data; - - dev_warn(host->dev, "\tblksz %u blocks %u flags 0x%08x (%s%s)", - data->blksz, data->blocks, data->flags, - data->flags & MMC_DATA_WRITE ? "write" : "", - data->flags & MMC_DATA_READ ? "read" : ""); - } + else + ret = IRQ_HANDLED; } out: - /* ack all (enabled) interrupts */ - writel(status, host->regs + SD_EMMC_STATUS); + /* ack all enabled interrupts */ + writel(irq_en, host->regs + SD_EMMC_STATUS); if (ret == IRQ_HANDLED) meson_mmc_request_done(host->mmc, cmd->mrq); + else if (ret == IRQ_NONE) + dev_warn(host->dev, + "Unexpected IRQ! status=0x%08x, irq_en=0x%08x\n", + raw_status, irq_en); spin_unlock_irqrestore(&host->lock, flag); return ret; @@ -1018,10 +1001,12 @@ static int meson_mmc_probe(struct platform_device *pdev) /* Stop execution */ writel(0, host->regs + SD_EMMC_START); - /* clear, ack, enable all interrupts */ + /* clear, ack and enable interrupts */ writel(0, host->regs + SD_EMMC_IRQ_EN); - writel(IRQ_EN_MASK, host->regs + SD_EMMC_STATUS); - writel(IRQ_EN_MASK, host->regs + SD_EMMC_IRQ_EN); + writel(IRQ_CRC_ERR | IRQ_TIMEOUTS | IRQ_END_OF_CHAIN, + host->regs + SD_EMMC_STATUS); + writel(IRQ_CRC_ERR | IRQ_TIMEOUTS | IRQ_END_OF_CHAIN, + host->regs + SD_EMMC_IRQ_EN); ret = devm_request_threaded_irq(&pdev->dev, irq, meson_mmc_irq, meson_mmc_irq_thread, IRQF_SHARED, 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)