From patchwork Sun Sep 8 10:12:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 173336 Delivered-To: patches@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3002967ilq; Sun, 8 Sep 2019 03:12:43 -0700 (PDT) X-Received: by 2002:ac2:52b8:: with SMTP id r24mr13247033lfm.131.1567937563617; Sun, 08 Sep 2019 03:12:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567937563; cv=none; d=google.com; s=arc-20160816; b=BVwUC4Z8i/WA0nVi3AxUZ1ctRagKUa/5BoiXvelJk9BcFqSUU2MhIDk45ZhlV7gtRD Lt2M1GH79DwsX6GWDSQWm+3Nuim/yfMlZ+o91HGNN8KppJPWsqWN3chPh9szQm3Z/yXR Yfw0v7wfbPvhBtZOpRacEgOaK6+OF4NN1drphQXjh2Q+hWQQ+Iv2E4Lz01dLRxUWdJ+E a5FwajerWpWvNbGCo6Bc4B4vUmmkEE6MH3ou1kWD4TfqtZXtzqgyty+YOY+QDt/06w4Z KrZb9Yhkj56sgmlYbUNl+K6TYHNNEJi6DRhNhELs59MoxaFgnfoMvzUdzWPAACgX4cHd VBWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=njwNwAwc6r0dkq3naz0El9lnBpKIVIeF99HX8Xzv4dE=; b=EaSJ9QyL6cXke8E7hGH5nHoIA8WV9KyTA6+SuBtv2/Bb0NYvHrIsv2IHTi2Fkw84EX ih/+j6bgQ4ZL/jkBs2qL4jiE7/ZS/oAD0v7Wpn9V/xeP+4k9WOMzYlG9NW8ZpApMaUDO m9pnPgxRHnNGvqrns9AIfUm2fsPLcTIgg1kPJLwWOYka0KsH00TVI+a6lRKjj8najFOA C3+gM+wUzbxi1tinh6jBMsHWqujnUldOPRH9AwgNtoejTmkPjZ4GwO4al9yDL1WW1ocP MiPjYQlXw0NctGMvx3yYwP++Bc+vjkva1kXrVaSk0u/5xSqiNsfMzH8Lv7N0GMt7doJa UqiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WY/PSxE6"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id r26sor5675484ljm.1.2019.09.08.03.12.43 for (Google Transport Security); Sun, 08 Sep 2019 03:12:43 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WY/PSxE6"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=njwNwAwc6r0dkq3naz0El9lnBpKIVIeF99HX8Xzv4dE=; b=WY/PSxE68qVV9583kfNBuDbYuUpdPB+qveDxNuOd0xhevC45Z2dpWbWg3WoA4MjpAG Mc9TplI8Vz7PzhC8BF/Masppqn+si9//Kow3TlGfcY3MXI/nmOJMNP8gA3KmIZoqOyEv WRWSc7+aH7p5jqfiO7PUYleEHDNP5OlQo2NV4lTY5JOJ1SAb9YdoAKs7JHsuNWC+G6yl 3wu8eSlKNQCSxPPgGe9++aKJ0jjfBSO64Tua3fD7kXXfo/dGaAaKpCefSg2Sugel94e4 An5JKrcuaZG80RHNmKuTLeH/Dbhc/c845T38mjOOJc9x5QuWwooeWNoF19P63Iw7IzGV 8dLQ== 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=njwNwAwc6r0dkq3naz0El9lnBpKIVIeF99HX8Xzv4dE=; b=T/SCN1aBGosdEeKafbDUekciVZdSOFMMmH+E2FL9Wsm7sVHEoPnmedXTmyuz8bLqOw POKoiz8EOj4+hu+lYCn64e2hJLKZdQ89kTp8ljZH7HKSGwMThQRdKCsCHKQXq7ewHpPc u9WjgUUPxhWcqGxu9GebszkGgV/N0M2NqQUptNA5E2JotuViHvu9yvxS2kjd3WJOlF0Y yJfdrZMNm1ny/ZjB1IJhpoFe0T9H9tBG4ro6sWB6S4IyvyYr3KswioEdRiWps/0yAOGU hktIPVWbYGOHPmQoa+9zcW0m6ei6LmpXiwWo4/YlQ4OPRnsivfBpf9+bX2Ib0uA0nvkw maSA== X-Gm-Message-State: APjAAAVW6eBoNR7fgrcoRzYYti5XHGlt8hXrTr5PZAO2Gwl/tPcsbiv4 9jqx+FEZGrKF3TGm7Sn1jdUqM/Vb X-Google-Smtp-Source: APXvYqw5LzDY8B2YTdCvLHuC2pxw+qjmoU1Z7hBcb+FHPXc+nj5c8+wJj+AdAqhGC00CKThlLHZ02Q== X-Received: by 2002:a2e:1415:: with SMTP id u21mr12369659ljd.22.1567937563298; Sun, 08 Sep 2019 03:12:43 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([185.122.190.73]) by smtp.gmail.com with ESMTPSA id h25sm2444849lfj.81.2019.09.08.03.12.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2019 03:12:42 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Douglas Anderson , Matthias Kaehlcke Cc: Shawn Lin , Jaehoon Chung , Yong Mao , Chaotian Jing , linux-kernel@vger.kernel.org Subject: [PATCH v2 01/11] mmc: core: Add helper function to indicate if SDIO IRQs is enabled Date: Sun, 8 Sep 2019 12:12:26 +0200 Message-Id: <20190908101236.2802-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908101236.2802-1-ulf.hansson@linaro.org> References: <20190908101236.2802-1-ulf.hansson@linaro.org> To avoid each host driver supporting SDIO IRQs, from keeping track internally about if SDIO IRQs has been claimed, let's introduce a common helper function, sdio_irq_claimed(). The function returns true if SDIO IRQs are claimed, via using the information about the number of claimed irqs. This is safe, even without any locks, as long as the helper function is called only from runtime/system suspend callbacks of the host driver. Tested-by: Matthias Kaehlcke Signed-off-by: Ulf Hansson --- Changes in v2: - Renamed function to sdio_irq_claimed(). --- include/linux/mmc/host.h | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.17.1 Reviewed-by: Douglas Anderson diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 4a351cb7f20f..a9d52a4d5041 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -493,6 +493,15 @@ void mmc_command_done(struct mmc_host *host, struct mmc_request *mrq); void mmc_cqe_request_done(struct mmc_host *host, struct mmc_request *mrq); +/* + * May be called from host driver's system/runtime suspend/resume callbacks, + * to know if SDIO IRQs has been claimed. +*/ +static inline bool sdio_irq_claimed(struct mmc_host *host) +{ + return host->sdio_irqs > 0; +} + static inline void mmc_signal_sdio_irq(struct mmc_host *host) { host->ops->enable_sdio_irq(host, 0); From patchwork Sun Sep 8 10:12:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 173337 Delivered-To: patches@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3002982ilq; Sun, 8 Sep 2019 03:12:45 -0700 (PDT) X-Received: by 2002:a2e:91d9:: with SMTP id u25mr12016579ljg.85.1567937564957; Sun, 08 Sep 2019 03:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567937564; cv=none; d=google.com; s=arc-20160816; b=fqFiQudH3sGUZM1FpwjGnUK9B639zVHVIIawnL9XrViIqeTD5goRuQq8jmm0vusHBm Jzy9h8YVAhrPFeTVwHFY6jVJ/VW5s15bfkaggDGC4j13wgQrPj65KmGzkY8eN39hOCK3 kU1c1Etz/O6p74JAu2dvGu3xZcGGgdK6ju2ok3hhb0Lz/gDmVXM7IrE1v8vqUWV0lsqi DyUgZOVwvi9g9WFqZ0CS4SnifdR3K7CkLXZ2iU03GV5H8unAS0DGKugyzruZQUKQNWEB JSe79nH1SxbKF5nzVE/7/dMv5H0wUEMnLibk655o1OJ+ZUcpfQDSIRhUlNJR09FQaWbn intA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7+P+cYx230fGzdea2f5uH2L1U7ubNclgEZwd45XPj+c=; b=h4b0BYbYKiDJv9f2Ub+tH2I56mxbMn1fDUpiH6hfC3HELFSKle/r4V/GonTJiIHDZp USAWzn21hgjMoC0j9dRd8o7rrfKRX4kYgf22EdWLyNadbesqzFRbVRhLwKMCn1g+agXj wUa09ep2VcdvaFFHhMKZ/E4sjdOtltDYQOiQuLrq5ek4DaiP3wh2erScfBAO6nyDmD2z ywp9DB5bSa1yMdDy7ycwotNRqa7/8ypHchePHDMAA6YrNmGyiywdKW4/hWMyKDGiyIEm JgGR+xgzJUCCe/xLJ2AyrhXqt5inEkthSrL6ywh4dk5BAI6Zj7iQpXstV+xx3g7A1BTX IxyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MuIWFNy4; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id z12sor5646854ljc.0.2019.09.08.03.12.44 for (Google Transport Security); Sun, 08 Sep 2019 03:12:44 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MuIWFNy4; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7+P+cYx230fGzdea2f5uH2L1U7ubNclgEZwd45XPj+c=; b=MuIWFNy4Uu/WuQujI3WpAnPQN7hQjKKrIACQtyJmDl9F1BuOgykCmjH6TEkGxO5kO0 1r697iLCtkg0JGaT6SPeg/4Z6qdddHsW02ee6t2vqK1f2ou42EqQ4LblJy7Vmj1t5iV2 rUB+qTGNpoR9VM08EoU+/of9I3Zr+iY2+i2RSikrhZPEp551ZDnIW0kYxmZiwR5TL6Qp zArFDlzIksZN+FzgPGi9LAWJP/GMEV71AfbGi9N+RX4poRuYhEYHcApF3n6Ol7k7Le6B NGiDjUxneaOf1lHy5+ShuMbBz7pktD3jf7bDJIzNGJDOHYEo73Qn0+13/WlyCvNWm3C0 DFAQ== 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=7+P+cYx230fGzdea2f5uH2L1U7ubNclgEZwd45XPj+c=; b=E9n3dYlfXHnrpmTPfAQ0Yzu5MaC4g1OrPg4VCULrkxqP89Xil+8W7uBU7wiDpgdI7k BIRIev4CvTXtOnOG3NpGxFMUIIExIHcxN1oqvii1MCL//4mjFTPNJNMme9u8aFGUox9J Xv+8vyEvgaeovgI9dpmv6r0ZpWNbb4+jsH1Rxs2g6a7onmCuuE5zWwvGf9K2EEr+syry Lnlw0qu1Aq2DvdC65s2EoKvsXav+493oGK/kya9uFylAOTFmdEbIQlnFWCUMUW87DJmp U5ZrAY15HN2GrqR6sZNeI3uPF/5t3GhnUPxyYmDERMwVvrnvR372MFJCn3z4q1bcg1S7 Z3jQ== X-Gm-Message-State: APjAAAWfpvNmVrDwKErE8fAWjZ1SVB1XdiOGvFCjaE/ir7C0TEf+OsMy OW45DfXO+hsExroUK2L9JfUhwWcK X-Google-Smtp-Source: APXvYqyeDghhAOKZpDvXuAhHjLZvljJG/Qs1XijQtmIcegh9WgeMYfGtbWrv7shtlHbwygv65v7kKQ== X-Received: by 2002:a2e:9e19:: with SMTP id e25mr8211035ljk.152.1567937564569; Sun, 08 Sep 2019 03:12:44 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([185.122.190.73]) by smtp.gmail.com with ESMTPSA id h25sm2444849lfj.81.2019.09.08.03.12.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2019 03:12:43 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Douglas Anderson , Matthias Kaehlcke Cc: Shawn Lin , Jaehoon Chung , Yong Mao , Chaotian Jing , linux-kernel@vger.kernel.org Subject: [PATCH v2 02/11] mmc: dw_mmc: Re-store SDIO IRQs mask at system resume Date: Sun, 8 Sep 2019 12:12:27 +0200 Message-Id: <20190908101236.2802-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908101236.2802-1-ulf.hansson@linaro.org> References: <20190908101236.2802-1-ulf.hansson@linaro.org> In cases when SDIO IRQs have been enabled, runtime suspend is prevented by the driver. However, this still means dw_mci_runtime_suspend|resume() gets called during system suspend/resume, via pm_runtime_force_suspend|resume(). This means during system suspend/resume, the register context of the dw_mmc device most likely loses its register context, even in cases when SDIO IRQs have been enabled. To re-enable the SDIO IRQs during system resume, the dw_mmc driver currently relies on the mmc core to re-enable the SDIO IRQs when it resumes the SDIO card, but this isn't the recommended solution. Instead, it's better to deal with this locally in the dw_mmc driver, so let's do that. Tested-by: Matthias Kaehlcke Signed-off-by: Ulf Hansson --- drivers/mmc/host/dw_mmc.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.17.1 Reviewed-by: Douglas Anderson diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index eea52e2c5a0c..79c55c7b4afd 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -3460,6 +3460,10 @@ int dw_mci_runtime_resume(struct device *dev) /* Force setup bus to guarantee available clock output */ dw_mci_setup_bus(host->slot, true); + /* Re-enable SDIO interrupts. */ + if (sdio_irq_claimed(host->slot->mmc)) + __dw_mci_enable_sdio_irq(host->slot, 1); + /* Now that slots are all setup, we can enable card detect */ dw_mci_enable_cd(host); From patchwork Sun Sep 8 10:12:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 173338 Delivered-To: patches@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3003002ilq; Sun, 8 Sep 2019 03:12:46 -0700 (PDT) X-Received: by 2002:ac2:4352:: with SMTP id o18mr12877979lfl.164.1567937566221; Sun, 08 Sep 2019 03:12:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567937566; cv=none; d=google.com; s=arc-20160816; b=hDFg4A9CcEoG3Ko1Q4SwziObTYh/YuQWUvLrO5+eYpCV17vS6Zth2YY0qM8nyumlMu 2Bwp1tJLGqQBxX7bcHvJAO2hZ7Fer2a65NbjKf8oosuDTACDrYkexWLyGKRpVgvSJV9D gaHxHgZymXlEDmXO+Akk1OyjrBEBUYcKGPFucPreWdJ4vucKe9zoTGt+ZN/X9NqhRfkC pz0celrm1JJBkTXxnlxySTlo9MuoAHeUTT5zcIv5ZK6FiUz0hSdHrJ2pCE509vNI8lry ZJ2M35onrafotQyLsd3u+oygxDnOVYQcjUzcs/nG24pTSneH3OFPX/xVtUfg3fcCT3+q tsXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xyicSoe6hBPX50Bq7X1NmDZdoCyXZNomcUNAFE37PKY=; b=jh6C+dX6ji2wnfk+eUxIfLlePTsVpGQYb9AOAOcV8GBndkR1dwwyLw8iiGVxHD3YgR x2MTDWtlIpKSzabxxM8W1Q0mR0bbNXVvemhztEN9ygPFtBzEn4q8txawjYPYwcojXFlI Qkd/ZusESSmJ4fdHCgDLC7garf7SvPHNkcC+tHaNPK/uOorIclROGdsCt84GaYY/723f FHueOGM7FbCwVW8tdfzX+YE+Km5NbgPfjSRDZJNlIvN5oLLlrbPktOn6t0p7DJThz5Pw VvU5Ob43RGwEiqzolFgPq/K94pQBvC0qOtZkChl3o5u6MA1fywKrGs+rycV/4EGXu4Hu fcbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Edn66P4S; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id z22sor3119079lfb.26.2019.09.08.03.12.46 for (Google Transport Security); Sun, 08 Sep 2019 03:12:46 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Edn66P4S; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xyicSoe6hBPX50Bq7X1NmDZdoCyXZNomcUNAFE37PKY=; b=Edn66P4SYLLch2VlatADxUAdLd0tfPrivUo4T6tVpdrp6UL1oMk62JvZ/hUJkvl87r Y4Rm76XwOcNH2VYEBygULdW5dVpM0jJkgDrgRJ3tLHe0DbyD+VC17UKw8QcWIoEhLW6g UxzARtbao3FE7GweeUr4Qonq+zdqyH5yT9dMcyQ1L2uBx0oU/N8x9O8wa1/WcKH5sb9d 9/HHhGHe1Lb5zmI73R/bjlpLVEaAc/mzChuooMB7S9eV3mxlP4d21X0xNbO8k6ssorLY I6whMaBA6Wswcg0rkCzfsWxj+NH2NnWVUScQXOlFfJOwxwNbJgeZyOXxMOyxOgKhTBsk GmQw== 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=xyicSoe6hBPX50Bq7X1NmDZdoCyXZNomcUNAFE37PKY=; b=RBgwW0m4rY54cvNpzUz3NMlEJF10Q7NxS+cBXxv36iKiier0Ot07nml++4vQRtk1RO /ZC0k8cx6gIFXcUGKxP8F6uHl8WAza1wZdwkCrcCljg3MQNxIWi/CW6di19lA6UP3hS+ UnoPPGIY+Xtc6PUM/MGIbndTqV2zNW6tnptBnm4HJQ6bhXsHDApCfXUZiqX4OJfMeIvP n4YLE9a7mQw5Zp7Z6t1j1XqW7YAcofdWVqd10ID2KXrCJP8EGCWbMlCsrAx4k1thkBG7 aOOLcJriDU/HVIr1K8c6z2kQU21DYCFPpUS8kuYyES/CD7fCurqlDBrwYAUDhTbVNCMB aJpA== X-Gm-Message-State: APjAAAU/xAUQzNacN+vjIsO2rlOB6/E0ut2gcvQQ8IToBJZGwx7LzPGQ I/Fe6Rd6wnAKwIrzkx50X9tp+Xa7 X-Google-Smtp-Source: APXvYqx9rsoHVDfNzT1ZVdZm1qIiEGkOqHceJPLVcgXZDKXrF+hMW6kC9XtCo2PmnIfoI33u7rdyTA== X-Received: by 2002:ac2:508b:: with SMTP id f11mr12898573lfm.153.1567937565846; Sun, 08 Sep 2019 03:12:45 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([185.122.190.73]) by smtp.gmail.com with ESMTPSA id h25sm2444849lfj.81.2019.09.08.03.12.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2019 03:12:45 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Douglas Anderson , Matthias Kaehlcke Cc: Shawn Lin , Jaehoon Chung , Yong Mao , Chaotian Jing , linux-kernel@vger.kernel.org Subject: [PATCH v2 03/11] mmc: mtk-sd: Re-store SDIO IRQs mask at system resume Date: Sun, 8 Sep 2019 12:12:28 +0200 Message-Id: <20190908101236.2802-4-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908101236.2802-1-ulf.hansson@linaro.org> References: <20190908101236.2802-1-ulf.hansson@linaro.org> In cases when SDIO IRQs have been enabled, runtime suspend is prevented by the driver. However, this still means msdc_runtime_suspend|resume() gets called during system suspend/resume, via pm_runtime_force_suspend|resume(). This means during system suspend/resume, the register context of the mtk-sd device most likely loses its register context, even in cases when SDIO IRQs have been enabled. To re-enable the SDIO IRQs during system resume, the mtk-sd driver currently relies on the mmc core to re-enable the SDIO IRQs when it resumes the SDIO card, but this isn't the recommended solution. Instead, it's better to deal with this locally in the mtk-sd driver, so let's do that. Signed-off-by: Ulf Hansson --- drivers/mmc/host/mtk-sd.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.1 diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index 6946bb040a28..ae7688098b7b 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -2408,6 +2408,9 @@ static void msdc_save_reg(struct msdc_host *host) } else { host->save_para.pad_tune = readl(host->base + tune_reg); } + + if (sdio_irq_claimed(host->mmc)) + __msdc_enable_sdio_irq(host, 1); } static void msdc_restore_reg(struct msdc_host *host) From patchwork Sun Sep 8 10:12:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 173339 Delivered-To: patches@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3003025ilq; Sun, 8 Sep 2019 03:12:47 -0700 (PDT) X-Received: by 2002:a19:7d55:: with SMTP id y82mr12583280lfc.106.1567937567430; Sun, 08 Sep 2019 03:12:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567937567; cv=none; d=google.com; s=arc-20160816; b=oJ8Cy7x/4TkaceQlYVPwcAL8svL/vDikM7+Vk+pBCr3m3cevNuknqtJcqYY5WqiYeC VxASnQAsMD5wxWiodHqIvc/5MqGsrsmhcUpyLfWrGIbDnz1XbBY9I65N0zhz8VLjMSHz XRdr10HjSzvabpkzWp6kjLisqsAzPT1v2hfNjN94nxJA4k8GKF9iuPfk4/hIoBLMbiUy kPOd57nHPNMHuouo/tUIKTk8HnjsBDdwwebKiyyaMrcWWPW3wv5qKJ+0b+cNXF1yJpb5 OF1zTHJdpzDe4jmB798T2ml520c/jbtlmR1ByVsIDwYkLCMwP1G8Y+RD1qtoaqcIF/4d gITg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mZN0trNPMDGK13UKBqW2zdfZhLOq96vtybPEWVfKPNw=; b=WDkEYfXhzdDQbo9RfXM1iccr2SqRwOH4QlPYaTLwdW29jZi01PMhZ5yGNWkNSj6O9M yvwlYuOPNAWSTiFM5PeGnUIYHSxIXMa7RHV7UGju4j27uUaFQutUZD+pb8xIvqqYF+Vg Ytj6IxUK3c5J7n7QhkoGHUqXtC/Nn6f5oxIoVYWSDrJg2jlldUhQ3ngch1M7GmUGCiB3 U8DlwLlze6voqsXapx/o79X18Dc1u1Jv0T5Y7NfFTb7tALTaQYcb66VXKzg/ut1WkMFB vaL23aJsWhH0knhoy5aL1SrYjhuwmk2wLoJ3+E2Uakms37ax1ZCahC8j7Lmh/lSLh4Pu KkNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eSu4o+D1; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id u8sor3673473ljj.24.2019.09.08.03.12.47 for (Google Transport Security); Sun, 08 Sep 2019 03:12:47 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eSu4o+D1; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mZN0trNPMDGK13UKBqW2zdfZhLOq96vtybPEWVfKPNw=; b=eSu4o+D14VPgj3Ynxc1N1DEPmO10ApZ1GvVsFUrqtPJRSKRwUCmUZEqTh5FWANi7DK Kx64es6+u0lX/QzhJ/Hvb+fUy2CtpUpvq5Tr54WwKwARFAjar4rmQ1Jpaie44uXp4MC7 QGvl/fbYdwdScf/L7DTqStNqxyq33b3BxDiLmUEikDGOeS7vx6IGbkV8Jpso8WWIlJz8 dN5erHSXWrVGemR8IYO3b1NBA4od7jAry3DZwPuZ2xdh/lXu48W8NULkDXHQTapEeAtx mxwDAZdX5djBy2GJSZv7T0XqRugKn5DVVOEWGnXscoIR6tjY/yFJAaJUsZw+UN3/J64X dfsQ== 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=mZN0trNPMDGK13UKBqW2zdfZhLOq96vtybPEWVfKPNw=; b=idv5UMpnZWlhGFMYtbenyWwZWykG+cJodOePt7dkb48i17F6uZbKCsB+luVFXaWC1n fl2zuQgo/s9jTVkAHo3MtKO+5ySdpT4MzieznTSndh3d4CRlkP8k/aA8TqSSsRhNTf4s sNA7JGLVPfi430Pz3rrcINz8mAinBJCmK4K2xnp0d3w6cXrBr9zs3yfDdUGLFi5KMLSz esb2xn5tMaPmXdvZEUu/4Rljc7CgpY94qTy9HMPXmWBHjdcVoZeImA8VX9npy8o1VOXY HWy7b/3Hk8DeaGKl2npzyFm1UK+ZFdooy5l1zH2KSSvTxQsf+gY9SkW2RwjF+o12qSfl 21bw== X-Gm-Message-State: APjAAAWiZdEXaBl0ZdLRGfqlEAAL4UHLZPuNMbbMzpL3O/Dnt5Fmkq+U ncWztUeEcD1M9Sbwh73OGaq1KaYK X-Google-Smtp-Source: APXvYqz8cu6BKIqcffnELf83zGndaKhR4JEUPbfnLof3jUsv/FRYX5HaVItHDHcK51dNgNqZHOapSQ== X-Received: by 2002:a2e:331a:: with SMTP id d26mr12181565ljc.239.1567937567102; Sun, 08 Sep 2019 03:12:47 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([185.122.190.73]) by smtp.gmail.com with ESMTPSA id h25sm2444849lfj.81.2019.09.08.03.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2019 03:12:46 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Douglas Anderson , Matthias Kaehlcke Cc: Shawn Lin , Jaehoon Chung , Yong Mao , Chaotian Jing , linux-kernel@vger.kernel.org Subject: [PATCH v2 04/11] mmc: core: Move code to get pending SDIO IRQs to a function Date: Sun, 8 Sep 2019 12:12:29 +0200 Message-Id: <20190908101236.2802-5-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908101236.2802-1-ulf.hansson@linaro.org> References: <20190908101236.2802-1-ulf.hansson@linaro.org> From: Matthias Kaehlcke To improve code quality, let's move the code that gets pending SDIO IRQs from process_sdio_pending_irqs() into a dedicated function. Signed-off-by: Matthias Kaehlcke [Ulf: Converted function into static] Tested-by: Matthias Kaehlcke Signed-off-by: Ulf Hansson --- drivers/mmc/core/sdio_irq.c | 46 ++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 16 deletions(-) -- 2.17.1 Reviewed-by: Douglas Anderson diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c index 0bcc5e83bd1a..f75043266984 100644 --- a/drivers/mmc/core/sdio_irq.c +++ b/drivers/mmc/core/sdio_irq.c @@ -27,6 +27,34 @@ #include "core.h" #include "card.h" +static int sdio_get_pending_irqs(struct mmc_host *host, u8 *pending) +{ + struct mmc_card *card = host->card; + int ret; + + WARN_ON(!host->claimed); + + ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, pending); + if (ret) { + pr_debug("%s: error %d reading SDIO_CCCR_INTx\n", + mmc_card_id(card), ret); + return ret; + } + + if (*pending && mmc_card_broken_irq_polling(card) && + !(host->caps & MMC_CAP_SDIO_IRQ)) { + unsigned char dummy; + + /* A fake interrupt could be created when we poll SDIO_CCCR_INTx + * register with a Marvell SD8797 card. A dummy CMD52 read to + * function 0 register 0xff can avoid this. + */ + mmc_io_rw_direct(card, 0, 0, 0xff, 0, &dummy); + } + + return 0; +} + static int process_sdio_pending_irqs(struct mmc_host *host) { struct mmc_card *card = host->card; @@ -49,23 +77,9 @@ static int process_sdio_pending_irqs(struct mmc_host *host) return 1; } - ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending); - if (ret) { - pr_debug("%s: error %d reading SDIO_CCCR_INTx\n", - mmc_card_id(card), ret); + ret = sdio_get_pending_irqs(host, &pending); + if (ret) return ret; - } - - if (pending && mmc_card_broken_irq_polling(card) && - !(host->caps & MMC_CAP_SDIO_IRQ)) { - unsigned char dummy; - - /* A fake interrupt could be created when we poll SDIO_CCCR_INTx - * register with a Marvell SD8797 card. A dummy CMD52 read to - * function 0 register 0xff can avoid this. - */ - mmc_io_rw_direct(card, 0, 0, 0xff, 0, &dummy); - } count = 0; for (i = 1; i <= 7; i++) { From patchwork Sun Sep 8 10:12:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 173340 Delivered-To: patches@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3003051ilq; Sun, 8 Sep 2019 03:12:48 -0700 (PDT) X-Received: by 2002:ac2:5971:: with SMTP id h17mr9675318lfp.16.1567937568721; Sun, 08 Sep 2019 03:12:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567937568; cv=none; d=google.com; s=arc-20160816; b=RaC+RsUHCihOEv38G9AGzinrojYiQCDlCO2U94mFBXCYksWHHYKRmZKwBD/9CAnViu siQ48i3zN/LjEdsvQpa4wx5Z3OA+8cc5ptTgtkH8CcE0yEfKORmj3guQhKteYHjxhY8B 03uGr05X7hGdl7Ff+X3GWaNDiwehoSiQ9OpK1eLhllDq5PhcYX8teVv0hjf2uQK0fds2 Dfgvz+mD8z7AnlzrgnkildkAqsHlyR8+QbUi/5sfg4R3PUpDdtKjLwpP18z/3kmI39Yq 9ZcWpfI48gw0ATj/jLzpvdbPYenvjPRImuglonaFBhSmQaoMLAOEZhX6lOnTzBvwHn0K Tp9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pKTLA8BPyKLX9YHHuPwtPhpXH4h+0Jxv8uz/z0H2wn8=; b=pFtVg2vfiNxK4OVMlLpzm+T+RhVup0+UwkDj0ialG1l1Bxfn+hN82Un6SIqNSsViQR 6LNKh0y/tculbphpobPcWSb1/s6D+7KLH0JdEss+LbXpUf4Mn6TpWPkSk/48xmu2hfaa joIw+/ZkR9Hq4jO2YWpiLYoV1bNuTPrb3zNC6CJkSR6uMKq30wIIB63dp/hETBJSyj6w f0g2Ug4YZkQruvhJ+tX2xrr4avmebsRCQgtOha6Z4Rgm52D6KrYWG8GZu46sI1J8x9hH CfWgoWd8ac81eO5cqJEOVHnFFkqAStr1WgpeP2ceY+sxAocP9kDLHsBGKh39Yc+3ZXFK 8J2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IQz6usR0; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id w21sor5604438ljg.10.2019.09.08.03.12.48 for (Google Transport Security); Sun, 08 Sep 2019 03:12:48 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IQz6usR0; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pKTLA8BPyKLX9YHHuPwtPhpXH4h+0Jxv8uz/z0H2wn8=; b=IQz6usR0dVKguJznE5uwgQrDgBPq+1KDURHrwgj3B68bVWnvG2HpejbwXV9o6x03hg pyD2rFKEQDWaN6d7CyUM3W+CVs5ggKUaha1XE9GRYfAOzqxXfMBEVIZm8lk/DrYuUQnn K7l1WXgCWy6jJdGeZBSzs/1QfBLwMWj2atFZx/+W7lS9Xvdzrn5uMXDX9WHecRub2lvS ELZw9+sZ4PTrhnXh7MyZKGtpHyHieSHzeOS0SepU5vOln6djN8SVpBgfE7uFQUFvv2TD fr88VUn+pZjfn552rf6/wS00NR7kdexqpXWiL3uAZQcwUfAW5HmaY+1p0i6F2nBnxLPS RQeA== 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=pKTLA8BPyKLX9YHHuPwtPhpXH4h+0Jxv8uz/z0H2wn8=; b=cD/t1Nag28QhOZvSqwG/1V87ttWMSR4utDvYlH0mP4DGDQqF/ynnbs2R26vptXeZPi mnp2ar+Z6d73FK+xpsIWBtJZS+B9THb+7znK+k4Lf8s6JFdIqYVvE/JMMEyrrpSYgBZF huGEbAGXVjQ7TDWrHZjZtYA4VbimK7HMPRsMZag+c62aWESve/SGz+oBnSRFX2C/7Zew NXARwPq2Ht4dbZbCO/qjPuZhnBzjlFOBWZHUJYDuBn6YaoWyc8TtATvg4h6VNmcrDult ze9725djZ6SBaTE3LXsKTQSVFzKdaAwnq2JZ7HbNpx3STu7npGrHQfu9ASq5RENxdH6E Ar8g== X-Gm-Message-State: APjAAAXNFfCD2hf7+RPEWToCYPu9NE6tQvGDZC30+mos+TeeZSUWCDOX FSOsVf4T3Uhk0tbsSagSCiMnwzkH X-Google-Smtp-Source: APXvYqzIBrVCzTFMAkkD8zaEddXTkXDJL2QuHMc/BkCaUp14332Xlp3p1Xir6bNKkkBPWLadqtU6RA== X-Received: by 2002:a2e:958c:: with SMTP id w12mr11761091ljh.98.1567937568383; Sun, 08 Sep 2019 03:12:48 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([185.122.190.73]) by smtp.gmail.com with ESMTPSA id h25sm2444849lfj.81.2019.09.08.03.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2019 03:12:47 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Douglas Anderson , Matthias Kaehlcke Cc: Shawn Lin , Jaehoon Chung , Yong Mao , Chaotian Jing , linux-kernel@vger.kernel.org Subject: [PATCH v2 05/11] mmc: core: Clarify sdio_irq_pending flag for MMC_CAP2_SDIO_IRQ_NOTHREAD Date: Sun, 8 Sep 2019 12:12:30 +0200 Message-Id: <20190908101236.2802-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908101236.2802-1-ulf.hansson@linaro.org> References: <20190908101236.2802-1-ulf.hansson@linaro.org> The sdio_irq_pending flag is used to let host drivers indicate that it has signaled an IRQ. If that is the case and we only have a single SDIO func that have claimed an SDIO IRQ, our assumption is that we can avoid reading the SDIO_CCCR_INTx register and just call the SDIO func irq handler immediately. This makes sense, but the flag is set/cleared in a somewhat messy order, let's fix that up according to below. First, the flag is currently set in sdio_run_irqs(), which is executed as a work that was scheduled from sdio_signal_irq(). To make it more implicit that the host have signaled an IRQ, let's instead immediately set the flag in sdio_signal_irq(). This also makes the behavior consistent with host drivers that uses the legacy, mmc_signal_sdio_irq() API. This have no functional impact, because we don't expect host drivers to call sdio_signal_irq() until after the work (sdio_run_irqs()) have been executed anyways. Second, currently we never clears the flag when using the sdio_run_irqs() work, but only when using the sdio_irq_thread(). Let make the behavior consistent, by moving the flag to be cleared inside the common process_sdio_pending_irqs() function. Additionally, tweak the behavior of the flag slightly, by avoiding to clear it unless we processed the SDIO IRQ. The purpose with this at this point, is to keep the information about whether there have been an SDIO IRQ signaled by the host, so at system resume we can decide to process it without reading the SDIO_CCCR_INTx register. Tested-by: Matthias Kaehlcke Reviewed-by: Matthias Kaehlcke Signed-off-by: Ulf Hansson --- Changes in v2: - Re-wrote changelog. --- drivers/mmc/core/sdio_irq.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c index f75043266984..0962a4357d54 100644 --- a/drivers/mmc/core/sdio_irq.c +++ b/drivers/mmc/core/sdio_irq.c @@ -59,6 +59,7 @@ static int process_sdio_pending_irqs(struct mmc_host *host) { struct mmc_card *card = host->card; int i, ret, count; + bool sdio_irq_pending = host->sdio_irq_pending; unsigned char pending; struct sdio_func *func; @@ -66,13 +67,16 @@ static int process_sdio_pending_irqs(struct mmc_host *host) if (mmc_card_suspended(card)) return 0; + /* Clear the flag to indicate that we have processed the IRQ. */ + host->sdio_irq_pending = false; + /* * Optimization, if there is only 1 function interrupt registered * and we know an IRQ was signaled then call irq handler directly. * Otherwise do the full probe. */ func = card->sdio_single_irq; - if (func && host->sdio_irq_pending) { + if (func && sdio_irq_pending) { func->irq_handler(func); return 1; } @@ -110,7 +114,6 @@ static void sdio_run_irqs(struct mmc_host *host) { mmc_claim_host(host); if (host->sdio_irqs) { - host->sdio_irq_pending = true; process_sdio_pending_irqs(host); if (host->ops->ack_sdio_irq) host->ops->ack_sdio_irq(host); @@ -128,6 +131,7 @@ void sdio_irq_work(struct work_struct *work) void sdio_signal_irq(struct mmc_host *host) { + host->sdio_irq_pending = true; queue_delayed_work(system_wq, &host->sdio_irq_work, 0); } EXPORT_SYMBOL_GPL(sdio_signal_irq); @@ -173,7 +177,6 @@ static int sdio_irq_thread(void *_host) if (ret) break; ret = process_sdio_pending_irqs(host); - host->sdio_irq_pending = false; mmc_release_host(host); /* From patchwork Sun Sep 8 10:12:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 173341 Delivered-To: patches@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3003070ilq; Sun, 8 Sep 2019 03:12:50 -0700 (PDT) X-Received: by 2002:a19:9104:: with SMTP id t4mr12006727lfd.179.1567937570082; Sun, 08 Sep 2019 03:12:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567937570; cv=none; d=google.com; s=arc-20160816; b=ylimVbQtNEiTNnGau12HGBK6YO5MpHwWtWIMlPEs168WNVPUTHlCDgH2+ehOns2Gza 7zNS2qj9ZlBo9pEnjL6wfvxUh5BFxG5oBh3VwZ24t6Bvsqpm+Xr4AA3kPvw1JNG2Md69 pP8hbjuqKdc3dcOCgiu+PAe4cI34Czxj8wmyp7PgVMUsadr8hxbF1S4mFsXWbuPoW2xl vw+U/ZrnjA9NPm4D7mNBcWRR91R8i0QOHe/1cU/GlczzBehuKw4kBmq9tTApxDYPuaeh m19If8rvVtnncPDLT0GTZ6AId+I3Yn/jdhvg56s9ci1AjxEIRESTU9G6erePRn6y8xPr b7ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0sPoOSzMWXk49KLRI+pedfbA4qsHre5+gtEz1gpf9mk=; b=0anFMtCRMolswpJMW4tB48y4wTfX7VEhw5RHVjNlDZ3moSJtXf45+q9jUX7BAqmVas RIyqaYzr29OIoS5bxSQDj7toBn68WwSZLHUrF4RA1apo/v5HwCkPZY7ZK1y5eYLYIuBk nDDfoAu7rnBCq8JtrkEmScfhZHWLuWHlHosx0Gni8pKgybLE7ylRj81wkMUPuVXRuijp BF4Cj5/BaldYmPNH6sT2QicxQ6oUTADv6ayTt2A37HPUU0OeSkH54j+8UAB8a83ZcuBo dXKOJIryXPqd4HerOKbRYxV0KRQoceqUyG84qwTWUfo2Dy8WaVP8stw9E6YZPenyHhZY F7aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="sV/VcYZ2"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id b13sor5647460lji.28.2019.09.08.03.12.49 for (Google Transport Security); Sun, 08 Sep 2019 03:12:50 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="sV/VcYZ2"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0sPoOSzMWXk49KLRI+pedfbA4qsHre5+gtEz1gpf9mk=; b=sV/VcYZ2BooaL1Ed4/JLXyL+FFPx5r/Fg0Pt5aluWRCqss/4oGxxSjBGWqBioYI5RU v4SxQ+SPBdlAysfX9R6Yy8SxWWzozZ5+wno5kdF3I4MiVMlRlGDB+R9wkXB9MB4D73Fo QvbA14N96UHo/B3KRfTNMSLbH2q4XbwA8aJMyG+FCAnJ1t+3xd8D3cKKursF++iAAyP5 Dg2CIP52xIMApN5VBqLNAmTEL3rx8ZvpvLizycZnrIBFpcWnhCOd9MBJl9v/72ZLiAu+ GAOKWgrHwEeV9PfQ2dFG/yN7qLDoEQ8qtD19py0d52XwpqCzGz6z8vjZ5hShIlC9/swQ oMmQ== 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=0sPoOSzMWXk49KLRI+pedfbA4qsHre5+gtEz1gpf9mk=; b=kWUtMiGGbOzV3ipuAp3ZjLfPtd67gk64BdAbw3WqDozeDRKvlOgjsGZNc6awoUUn+T v7J56/6/l8mnC/l7GESFgvVlc7UPRRiCSFrG5lFxlwbff3Eqcy6X3LImbjndKlL7WHM1 rAyZUbVe4JhnQaWkVLLB6Fq5U/qlp5QX1jSqx0VJ3vEYmWymadgr5EE4j5G0wRm3iMZf DPfuCiItmDANrDr2rD7xUuxRTXwzaZuPkQ55aK5n0ohXEFVtpOBAm7ojosHPWN4R9UC4 JWHAh0o0I1zsYFTSzvKgd/eVopQxF7O4bQC4kwmDmZbqIsChVF2yuEGJ5JMTqcJKlUbh Rukw== X-Gm-Message-State: APjAAAX62CAf5XzCfJSi/V49LPuxQC3CTfbqipxBe2RTKGFd475JYId0 cO38lv7AWH1yTaAeFnu9gmcbPB2D X-Google-Smtp-Source: APXvYqxsu+ihTaK46jp2BGSVrQH8cszNNO0DDP2bedFXjb8aIitfZqu6ZSJZy99q998j7SGRNa6VEA== X-Received: by 2002:a2e:b4e3:: with SMTP id s3mr12408526ljm.143.1567937569769; Sun, 08 Sep 2019 03:12:49 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([185.122.190.73]) by smtp.gmail.com with ESMTPSA id h25sm2444849lfj.81.2019.09.08.03.12.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2019 03:12:49 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Douglas Anderson , Matthias Kaehlcke Cc: Shawn Lin , Jaehoon Chung , Yong Mao , Chaotian Jing , linux-kernel@vger.kernel.org Subject: [PATCH v2 06/11] mmc: core: Clarify that the ->ack_sdio_irq() callback is mandatory Date: Sun, 8 Sep 2019 12:12:31 +0200 Message-Id: <20190908101236.2802-7-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908101236.2802-1-ulf.hansson@linaro.org> References: <20190908101236.2802-1-ulf.hansson@linaro.org> For the MMC_CAP2_SDIO_IRQ_NOTHREAD case and when using sdio_signal_irq(), the ->ack_sdio_irq() is already mandatory, which was not the case for those host drivers that called sdio_run_irqs() directly. As there are no longer any drivers calling sdio_run_irqs(), let's clarify the code by dropping the unnecessary check and explicitly state that the callback is mandatory in the header file. Tested-by: Matthias Kaehlcke Reviewed-by: Matthias Kaehlcke Signed-off-by: Ulf Hansson --- drivers/mmc/core/sdio_irq.c | 3 +-- include/linux/mmc/host.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 Reviewed-by: Douglas Anderson diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c index 0962a4357d54..d7965b53a6d2 100644 --- a/drivers/mmc/core/sdio_irq.c +++ b/drivers/mmc/core/sdio_irq.c @@ -115,8 +115,7 @@ static void sdio_run_irqs(struct mmc_host *host) mmc_claim_host(host); if (host->sdio_irqs) { process_sdio_pending_irqs(host); - if (host->ops->ack_sdio_irq) - host->ops->ack_sdio_irq(host); + host->ops->ack_sdio_irq(host); } mmc_release_host(host); } diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index a9d52a4d5041..0e6afe66cf68 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -128,6 +128,7 @@ struct mmc_host_ops { int (*get_cd)(struct mmc_host *host); void (*enable_sdio_irq)(struct mmc_host *host, int enable); + /* Mandatory callback when using MMC_CAP2_SDIO_IRQ_NOTHREAD. */ void (*ack_sdio_irq)(struct mmc_host *host); /* optional callback for HC quirks */ From patchwork Sun Sep 8 10:12:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 173342 Delivered-To: patches@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3003104ilq; Sun, 8 Sep 2019 03:12:51 -0700 (PDT) X-Received: by 2002:a19:8c1d:: with SMTP id o29mr12981460lfd.73.1567937571524; Sun, 08 Sep 2019 03:12:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567937571; cv=none; d=google.com; s=arc-20160816; b=OzVUB5sGg+sHkg8C0im/jxOvXJLDttJ1fvHFUXCKx4/DPX29r3V+zV+WhqY1OJ/pIY hWJPyCUprjZTQ7zx5CbKFsq7l0NmWpVXKuLyXj1pzF/dxnL7K7X5gAknmvI1WOHUybmv pyZa9xmpTBUE44B9ICgGUiPxu3ZdI2Q6Ef5hcwgFObwRJ+uKNSPylKseFAf71zpDmizE RGwBSReQspWSbdUn6gKo+WDHrOwlV1v/KHJv/y/tVfRsmC2FB/yRIPb6IgE+Th4Ta/K+ YWGGuzGFHg5km9YSi1m6J51I6P4rIKI217r0+Ms61A7vKj+spKOCYON0Jy52XC5eU6LU qtSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UID+ZGhCw2nacez8i2dJLwbGqoz8PrG/hBN9ucQUcBM=; b=Xtye8hy6oCKT3GIqU6ycrBnxDkqaGkDdesHzW6nG23U10wQs1Ym0GAmcYjITR4mX4s +qZjt76ld6fzSNZPGLBh4r4ksjz4A3MOwi6ZVs+Ib0nMpCRmzZdrfBCHNeO/7ObDy7xF njC8HHkiuLharEhT5TPuGogIEiLaRW1iyL7G860+bLDvhICzYmd6hpPbHc2TTbG60kyR ofuWIj67bQLvjqDUVL4hWjFoM2Mmr/f98xwacCsBc6w3nly6Rth/nXLwg/gHI+wdDqY3 /tYMfK3I4/KKutS3HkyzsKOdvWlTwAWpegKX8T23ncU6Nw23VeHmWArxDPRgJfvG9qgk j1ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JWKbtRyO; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id v14sor5609668ljd.44.2019.09.08.03.12.51 for (Google Transport Security); Sun, 08 Sep 2019 03:12:51 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JWKbtRyO; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UID+ZGhCw2nacez8i2dJLwbGqoz8PrG/hBN9ucQUcBM=; b=JWKbtRyO0r3UuwtokOdSoGl+Qf/PvjY0KfogNnlWS4LqEPt+bQ4pkFFt9NpCar4TDq W1r8Fe8rk49pFBluMRr1txg9wAIB49kpZODvn0Mnilqv8bsUcf7ZTbMf6YW8PJBpX7Ex 3Xw6tuU/X3GNLeHcEs0bIW1qDFZjE1eIHpkqNdxy2jEn8miLTHs6EgPGlfBVqDGcMB/u uWihWHGjsi7HHCXw/LYUooLZBAIDrzLsDLdcE2uC+KHRK+rvtJxkXVKXoygNCSbCAoe7 60tdgjYPNwKx08Cw/FmtwpUMuZinuyZ7Aiq6w5r6wjMlldyIkK+g/tn0wqRskNnoNMxO z5WQ== 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=UID+ZGhCw2nacez8i2dJLwbGqoz8PrG/hBN9ucQUcBM=; b=IXCIdzNGZALsqWMl+xMrSqSSigfEQr0JLFNRIAHjMmqGB3CvHbufTAqVKcNowWQXgP g6qVlT7P4OHWqwRQjIhlY8S1Ay/JuEbz/Dl8dztJt5osXIM694XeOFLal/9dS5mC2kh9 V/+OFLWT5KiL7WZKDWRZKveMVl+/VVCmfbL0JbQMt98g19y9kL8Fydh7LW9JE7kehDzH IW+2YZrI5zPEex+OCOJP483MoPktM7vOBeDkHKN9io+73I1YR4mblDhAn7Mu//34TyeM ozqd/Gyl+YpT37JQQllbD9UAwbUdMGzfmmAeTqmp7xav1MYlhu1izTz9+JGoFqUc8qXY 7wbw== X-Gm-Message-State: APjAAAULckNXotMOrVn+XY1hq63BypnJ5sg4fc1nFKAtXKOKA1f6Mbrg J6oYOUSNR0DGOBXvIRj9lNgyXMYL X-Google-Smtp-Source: APXvYqxN5OLcZWms4eihOTuBGpXa6p5URvzKGYMW1aNgnfvEAUegHDBj6ZcMriUHcGTZYMRYr+R5GQ== X-Received: by 2002:a2e:5714:: with SMTP id l20mr12019190ljb.122.1567937571210; Sun, 08 Sep 2019 03:12:51 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([185.122.190.73]) by smtp.gmail.com with ESMTPSA id h25sm2444849lfj.81.2019.09.08.03.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2019 03:12:50 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Douglas Anderson , Matthias Kaehlcke Cc: Shawn Lin , Jaehoon Chung , Yong Mao , Chaotian Jing , linux-kernel@vger.kernel.org Subject: [PATCH v2 07/11] mmc: core: WARN if SDIO IRQs are enabled for non-powered card in suspend Date: Sun, 8 Sep 2019 12:12:32 +0200 Message-Id: <20190908101236.2802-8-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908101236.2802-1-ulf.hansson@linaro.org> References: <20190908101236.2802-1-ulf.hansson@linaro.org> To make sure SDIO func drivers behaves correctly during system suspend/resume, let add a WARN_ON in case the condition is a non-powered SDIO card and there are some SDIO IRQs still being claimed. Tested-by: Matthias Kaehlcke Reviewed-by: Matthias Kaehlcke Signed-off-by: Ulf Hansson --- drivers/mmc/core/sdio.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.17.1 diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 8dd8fc32ecca..c557f1519b77 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -951,6 +951,8 @@ static int mmc_sdio_pre_suspend(struct mmc_host *host) */ static int mmc_sdio_suspend(struct mmc_host *host) { + WARN_ON(host->sdio_irqs && !mmc_card_keep_power(host)); + /* Prevent processing of SDIO IRQs in suspended state. */ mmc_card_set_suspended(host->card); cancel_delayed_work_sync(&host->sdio_irq_work); From patchwork Sun Sep 8 10:12:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 173343 Delivered-To: patches@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3003124ilq; Sun, 8 Sep 2019 03:12:53 -0700 (PDT) X-Received: by 2002:ac2:43c5:: with SMTP id u5mr12827345lfl.47.1567937572919; Sun, 08 Sep 2019 03:12:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567937572; cv=none; d=google.com; s=arc-20160816; b=fK1YMSKl6/E9EYCAQ7NZQmwzHXZCadiy0b/uzfhDWYP6xTWORw2R+2nTEIUCppv4pp w2FdTd//z+2uBxl1sREJKc09m3F5mWtXXccrsI/X0m9aKlw9iGiUkVjWUuaRtjmz0+my vjtCNayYKVjOTBE+LnUIJDRlTrWUVrMShnsOpt/cXuZS6OQMkqeUWb6ORvjXEI+1phVF ayJoYQM7+oHpmRWSCPLmHmqjkaU70M+545Df/oYp4xWE12PGF3hZdUo/Wz4EqLqeYO7i 0NVvhHxl2xLlop6PI0xj5BRhNbKpBw6C3UnN5bAzBsJ3Kn48kpsUWsE/uI6p61k9P/yM cNhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IS0lVdK7iQppkNRcA/eyYIxzfqUhjc4kqGnbAO0Nu8w=; b=f67Fb+MjC+RgSnLAQm6E2xQLw7j4B2DVCm/ytCvYFt5J6ytYrtUU0b/s1U4G4/m1b/ sF8/hsh1Uu+okI3lDE/OHU3bivRziYIW2ECPukqFXmQE2ACOC83+Wa56G1a0xUNMd8OC bBnHJYPffNFXfgxzp1FKEVT7IwJdq8ZCJ3hTd+tOaWhtaRwnyYWtpWhdwdBPuS5QijFE 4HJNyFN2y5hvnnQWNU8+KluhZDxCNBnFTl4zGmchRbHk/+XEMo2lA5xpX66tTb8TyEVB ZJXoOTeOJjtOgLh1dtCmBPaK75a6zAXzVC9cf8VB8Z/RPreE+6lXqS2ebHUrrQgHyyXA onMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XFSAECu6; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id a3sor3291640ljh.8.2019.09.08.03.12.52 for (Google Transport Security); Sun, 08 Sep 2019 03:12:52 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XFSAECu6; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IS0lVdK7iQppkNRcA/eyYIxzfqUhjc4kqGnbAO0Nu8w=; b=XFSAECu6eOchqjUmGfyiFNgZMWo+bvmAT0zhqDXFcxcLzZrltHNIhcmRSv6/JryE1v O7KAHIvW8AEktgkrl5abCIN6g137fTZuN4+UmVwn4Dj2e2sNi9d2vV/hsiwPd60aQTFH XvqkGnJe7W7dOLIGZdBWH4Hh8IqcxzSxuI6G+wN6mcnHoOlW2p6DxoTimAa2YJiDD9gc j3GVp5WR9XwBthfZyvCewUxTDky7uxpl5uaHcw0fRYk5TMEe4Mdm00mLfgPWbaVLnGc9 kLxXihevliSWwN6eOghy0521aMhpFk72hI395y5Jn7kPWbXKLcP4MaCBH2xufp3mlztK VoTA== 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=IS0lVdK7iQppkNRcA/eyYIxzfqUhjc4kqGnbAO0Nu8w=; b=OMiC+OFoHcFYashnPcBtShnRz38OL/C2RHK/6N7kxITrYHxSFED9KNBX1juaFYZ3e2 CNRS9QXEVC0KLG6jh36ZIYKlexVMlK56qFpmv09Qi6BCCZkEiLpSoOpF5uk5ye3bo2LU jeFpMA06aMscj1hAPkYRfJVZFvO0ayiUDSEzLQVPjFNKJU/LVDv2vuEVvDzHsToAAVcE pChGvjByMoVolO+hQ8YFNHrNZHq8jdKAKMu4Z06AU0G1K6KjySonFL5OumQP6SbB41CV sJLJIhSUy1KfjXllbghNz7Z0FUUSSzHfTMrHER3Yk+ZjNAIZuMOY7tJ0eDaqkPFR5daL WIJg== X-Gm-Message-State: APjAAAWSiZk8F6gTeNjBGFDs16/S0HNctiaZXRGD6gY23rK7l5avnIR2 GBTxwbzuLKCCR6Mr89IJ6RftIh5M X-Google-Smtp-Source: APXvYqzGa5ufeqoMMCyIUrEeU7LqbusZnxDO1ItjP4toDSXg19lvkKmBEh9+NqDHY2u1hfysc1HBJg== X-Received: by 2002:a2e:b1c4:: with SMTP id e4mr12099214lja.101.1567937572577; Sun, 08 Sep 2019 03:12:52 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([185.122.190.73]) by smtp.gmail.com with ESMTPSA id h25sm2444849lfj.81.2019.09.08.03.12.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2019 03:12:52 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Douglas Anderson , Matthias Kaehlcke Cc: Shawn Lin , Jaehoon Chung , Yong Mao , Chaotian Jing , linux-kernel@vger.kernel.org Subject: [PATCH v2 08/11] mmc: core: Fixup processing of SDIO IRQs during system suspend/resume Date: Sun, 8 Sep 2019 12:12:33 +0200 Message-Id: <20190908101236.2802-9-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908101236.2802-1-ulf.hansson@linaro.org> References: <20190908101236.2802-1-ulf.hansson@linaro.org> System suspend/resume of SDIO cards, with SDIO IRQs enabled and when using MMC_CAP2_SDIO_IRQ_NOTHREAD is unfortunate still suffering from a fragile behaviour. Some problems have been taken care of so far, but more issues remains. For example, calling the ->ack_sdio_irq() callback to let host drivers re-enable the SDIO IRQs is a bad idea, unless the IRQ have been consumed, which may not be the case during system suspend/resume. This may lead to that a host driver re-signals the same SDIO IRQ over and over again, causing a storm of IRQs and gives a ping-pong effect towards the sdio_irq_work(). Moreover, calling the ->enable_sdio_irq() callback at system resume to re-enable already enabled SDIO IRQs for the host, causes the runtime PM count for some host drivers to become in-balanced. This then leads to the host to remain runtime resumed, no matter if it's needed or not. To fix these problems, let's check if process_sdio_pending_irqs() actually consumed the SDIO IRQ, before we continue to ack the IRQ by invoking the ->ack_sdio_irq() callback. Additionally, there should be no need to re-enable SDIO IRQs as the host driver already knows if they were enabled at system suspend, thus also whether it needs to re-enable them at system resume. For this reason, drop the call to ->enable_sdio_irq() during system resume. In regards to these changes there is yet another issue, which is when there is an SDIO IRQ being signaled by the host driver, but after the SDIO card has been system suspended. Currently these IRQs are just thrown away, while we should at least make sure to try to consume them when the SDIO card has been system resumed. Fix this by queueing a sdio_irq_work() after we system resumed the SDIO card. Tested-by: Matthias Kaehlcke Reviewed-by: Matthias Kaehlcke Signed-off-by: Ulf Hansson --- Changes in v2: - Queue a sdio_irq_work() rather using sdio_signal_irq(). --- drivers/mmc/core/sdio.c | 2 +- drivers/mmc/core/sdio_irq.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) -- 2.17.1 Reviewed-by: Douglas Anderson diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index c557f1519b77..26cabd53ddc5 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -1015,7 +1015,7 @@ static int mmc_sdio_resume(struct mmc_host *host) if (!(host->caps2 & MMC_CAP2_SDIO_IRQ_NOTHREAD)) wake_up_process(host->sdio_irq_thread); else if (host->caps & MMC_CAP_SDIO_IRQ) - host->ops->enable_sdio_irq(host, 1); + queue_delayed_work(system_wq, &host->sdio_irq_work, 0); } out: diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c index d7965b53a6d2..900871073bd7 100644 --- a/drivers/mmc/core/sdio_irq.c +++ b/drivers/mmc/core/sdio_irq.c @@ -115,7 +115,8 @@ static void sdio_run_irqs(struct mmc_host *host) mmc_claim_host(host); if (host->sdio_irqs) { process_sdio_pending_irqs(host); - host->ops->ack_sdio_irq(host); + if (!host->sdio_irq_pending) + host->ops->ack_sdio_irq(host); } mmc_release_host(host); } From patchwork Sun Sep 8 10:12:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 173344 Delivered-To: patches@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3003139ilq; Sun, 8 Sep 2019 03:12:54 -0700 (PDT) X-Received: by 2002:a2e:9981:: with SMTP id w1mr11435689lji.155.1567937574220; Sun, 08 Sep 2019 03:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567937574; cv=none; d=google.com; s=arc-20160816; b=KYuxVJ5mkGI07ULVCmHgZFQpGLN0YnpLzKVEnY3S47n7gidXTwx9MLtswacxQFpk3U TlUcgDFpYQurtrKVPXynFeaFKAIe/GGOj5xzonOxffpdHN/yYgqQdnmHWZQVXQTPaPTy ddcx/Hx1eDx0O3o4X9ZvSC0e2Kyj/pK99GwnmCkpuittlUUKy6UalTv/0SkLKsN7+FBm S92OIbAWDzXDPP4a/VTA/DSuJdmF34U6MWV9GmutLzLvvuhb4r24e/jp1Iu22iM2o8Ln Tat3/CI5/D0348piuRB+D5ZU/aVuZAKxlt+VXbkmFu6oOj0X3ozi+XptpNiHPoNgz8EP 2x8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UBQNfgH478Agi6Qq65UuCm0AdFgtpDY1/4Ukd7tPN04=; b=hlx3lyGZzJaaPsWUas1K22nIRLeZpuYsSBZ7Sf1a8FFJDpbE4YLTRerIGQhGpFwdTD Fsld7D/5t6y5k4PFCMxf72MxPasJaSCPgPlWT/GR6T/fsvTtiOqxQFtaLJuwW7wIluII mwFp3NcfUrfsRxx6q/zllnUk3NHj8m+ZxJvQrbT+QFY8zNHg12DqNpvVQK0//ofXli+c CBNiCJt7Nflmzsh8ZcWsv11t07YzCJ1R9ZI72cd1yPD6yKron+J8eal+KMV83W5RsLY6 vqD+xtnrmyW+4Mt0bwdjn8aX0uS7s5O6xEEcT+VJ/fXGRDDtCP7l4U38mIEQS9w+Uqsy YqTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mcwgjbdp; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 13sor3120823lft.12.2019.09.08.03.12.54 for (Google Transport Security); Sun, 08 Sep 2019 03:12:54 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mcwgjbdp; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UBQNfgH478Agi6Qq65UuCm0AdFgtpDY1/4Ukd7tPN04=; b=Mcwgjbdp32PK8AZUMsmSzkK40Pkz9/HfpmUTEvkfaXJir+M1fqFP9wGs7zB3qW+3by X5GgXP39/Npz/F+rDuxpX5aPchObiqqORL9ZlkuVhbpwB+GFTVF7lub61Evi0KKMCezt Dqw6YkxkDH/JmWHtRO/poQ31ezNS6Psl/exogXW7T0ppn4elIzW2We2net4M5m9JGbHu g3aACABD48I4MJnMvQk/ClIIG2b67EDRyRtu1/O5m8QGdNBfBol/CPk5DbIfeeHSs8Ap 2nqZDZM+ZAlZEhT9VcPp+fUkBFIMMBx4t5RzmA0fGreFt8Pje7ZKBQ8S/7rcd5abLAY0 0pSQ== 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=UBQNfgH478Agi6Qq65UuCm0AdFgtpDY1/4Ukd7tPN04=; b=aV9eE4K5zm2s5qYGxsS13GTNXBcaWcCv9TD7CVofYxPHITdyMvaNnIVhk3Qzbs08qu hJ3WBDX8esJJgBZk+/MFu0kZtBu7BLn+3ezB61h6Z1/HuiMKvNaCafducric/wZtnuJ7 CH3PPgoJ9ehr1hJX3E72LS51dY7rE2wIh7Bww4kwhz5Jrjws5+jEWiMjmQRNcHnBXXuX osK7Bllxj+RizRohb3TLTqLjoGKT6bESZXqUP4K0eoWS+5b7/MC0fC2LHydwZ5UCyKaq dRCCaC9oKWJ6nstkpD1ViiiC6DdEnmoUm3vkTWgUlqkKfu9LQPt01Ffd1ZSLbIw9Fo6b dT+w== X-Gm-Message-State: APjAAAV+JMyYFUE15iyVGwRsR/E6h3puqvO7yWm6tc/XF+TqHYLkbxgV 94+j8PzFQduW8pD5zJkGVMQd7R5c X-Google-Smtp-Source: APXvYqwAZcqc8OF77Bx7ciHC787UfAzR/Jk/8p6iWyWeRbk6Ie4qBOLjOvzlPaRvFZEofbuug/3pUQ== X-Received: by 2002:ac2:4a82:: with SMTP id l2mr12357581lfp.85.1567937573894; Sun, 08 Sep 2019 03:12:53 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([185.122.190.73]) by smtp.gmail.com with ESMTPSA id h25sm2444849lfj.81.2019.09.08.03.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2019 03:12:53 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Douglas Anderson , Matthias Kaehlcke Cc: Shawn Lin , Jaehoon Chung , Yong Mao , Chaotian Jing , linux-kernel@vger.kernel.org Subject: [PATCH v2 09/11] mmc: sdhci: Drop redundant check in sdhci_ack_sdio_irq() Date: Sun, 8 Sep 2019 12:12:34 +0200 Message-Id: <20190908101236.2802-10-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908101236.2802-1-ulf.hansson@linaro.org> References: <20190908101236.2802-1-ulf.hansson@linaro.org> The sdhci_ack_sdio_irq() is called only when SDIO IRQs are enabled. Therefore, let's drop the redundant check of the internal SDHCI_SDIO_IRQ_ENABLED flag and just re-enable the IRQs immediately. Reviewed-by: Matthias Kaehlcke Signed-off-by: Ulf Hansson --- drivers/mmc/host/sdhci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.17.1 Acked-by: Adrian Hunter diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index d814dc004bad..efa6cda8c991 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2163,8 +2163,7 @@ static void sdhci_ack_sdio_irq(struct mmc_host *mmc) unsigned long flags; spin_lock_irqsave(&host->lock, flags); - if (host->flags & SDHCI_SDIO_IRQ_ENABLED) - sdhci_enable_sdio_irq_nolock(host, true); + sdhci_enable_sdio_irq_nolock(host, true); spin_unlock_irqrestore(&host->lock, flags); } From patchwork Sun Sep 8 10:12:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 173345 Delivered-To: patches@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3003163ilq; Sun, 8 Sep 2019 03:12:55 -0700 (PDT) X-Received: by 2002:ac2:46d8:: with SMTP id p24mr12365586lfo.58.1567937575498; Sun, 08 Sep 2019 03:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567937575; cv=none; d=google.com; s=arc-20160816; b=WB8gpMQexcooX0FpB+29epgBMud0GFeYHv+VnBAyBTAUq9SP0B4g/lo4SK5mJwDc5S qBecSUs89xVXcgT+R38tCgSRdquU1wWndsLygEUgjiKeNdo9Q6qqlrEuiF3EN7irYRqT 8o1sxng+aVXaqcYWXnFf9YrQGEH7r2QuFfO2B+s1QZ7wE4qT5UHksDmz4lVkrMPzp90h Dp2rcVZOUU46Czhd36sHxC5rk47xfRt5IVBgahMQ2S9OD+OEUqNGF10GW2Dr4S13CVhv H9eAto6estLG5bVIl+OInzo5AlhgQ1W0fTN0ppoNQoBDXOGGMRPMpIzELhRrWxumQVQT BoBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5zrGMk6c5cb0M1x8zsNcOkvdniWaOPlcPy4iCtlrTl4=; b=wVwqT02KDmHxRtCHJpJGaf4ATQmvUjFo2aL2EjIEicu7MGFuZXx6rrOskBFr6IkVxh L5dH57EGgzBBjmY7TR7okL0F/L0HBVuXHNY07wA2HS+SQl/sgEm5Cb1+KZmyVcHAAtRC wTuGWUEy6UYi1HWpvbh5NpdLxVxUHkCzfulqmia57mXjDhHVmqDeYhCVAjSBM97IQDwT KyTbktZ0rqn3XUJt6zNRp82aER4DZm+0rY59y/e3yxV9iHpTncfcILofGkKBsXYfg5J1 bDvZhgJgQdvvb9Mt+Aq7uKcj9vC8ae6Zm6FnEC3pzKaTy7JsLqmcU5zN/dF5TFiEe28l Y2Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vWwSgVO5; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id b13sor5647503lji.28.2019.09.08.03.12.55 for (Google Transport Security); Sun, 08 Sep 2019 03:12:55 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vWwSgVO5; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5zrGMk6c5cb0M1x8zsNcOkvdniWaOPlcPy4iCtlrTl4=; b=vWwSgVO5bQmVjTg9XGVOg1JwKfaGOeU5DoEK42mODEMxLoCclaYnnwIseOTMWWHbBh F3E4KzUNzR61+PXOwEw3flA+Ba9KM+Ar9b8d3f4yVvBGDDAcwTswppvM58oyvZ7YCW0+ sapWoQ4VfTRnxTy4UlDX6vFaMZVB6CKJEBlbwurWDpM//fCXRUYZR20x1dAWfSw9S8il QAYYHXScDT82khZgpuDsorpbZJpiyHh8gI1vJk/HkVPEhj80wK1Y0w+xYR1peDezLF4/ dAgMIj0+4xC3qZ0Sl93vDZ02RidwOj0tXOjC6NqKJ7ldmpoixvZ6UQcc/GYX6LILGu0X yXYA== 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=5zrGMk6c5cb0M1x8zsNcOkvdniWaOPlcPy4iCtlrTl4=; b=AGsozGrotb6q2HsBGGo6umD/UlweJ6qUVC/xa+ksUSRV4U6ue/xg/yOCuOPzLARTnk oMAswH2ORxhEaearnF4ylILbrN6+y4ZvwAmyjxnuOXcgJe1RiHacKv39lwReQbF7CFRm XHmR2Al0hAs58h7oafKPpNqQtbhIlhzHSVpOpKJFR/sd/w24bs2kr+Z26gsvyfVYROGO XH/kcpmuaIHMKCztonTt78cLneoRehdzbH2PBcZRcj2tWjch+McjxiX1OaKTZz9Rb3NL QAPOeoCBkYiApkgoU4xH8f6SUgzcqNmuvt6ul1/YUL5V9aM3GUlQupgL+7q6SRpQqlpy qVvQ== X-Gm-Message-State: APjAAAW63P+p6idl5i4oqVT3nbI9QRedefdu3OPA2bE4A3LBnmraudMA Os3738QME7X0PDb7vls1HplWcMX4 X-Google-Smtp-Source: APXvYqyFTCo8tbr+nsWc1VNOXSwNzLmkbiROCceBH4C65Lg3RihNh1XyaLzQ+MfTrmzCbU3uuFshKw== X-Received: by 2002:a2e:874a:: with SMTP id q10mr11554083ljj.187.1567937575164; Sun, 08 Sep 2019 03:12:55 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([185.122.190.73]) by smtp.gmail.com with ESMTPSA id h25sm2444849lfj.81.2019.09.08.03.12.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2019 03:12:54 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Douglas Anderson , Matthias Kaehlcke Cc: Shawn Lin , Jaehoon Chung , Yong Mao , Chaotian Jing , linux-kernel@vger.kernel.org Subject: [PATCH v2 10/11] mmc: sdhci: Drop redundant code for SDIO IRQs Date: Sun, 8 Sep 2019 12:12:35 +0200 Message-Id: <20190908101236.2802-11-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908101236.2802-1-ulf.hansson@linaro.org> References: <20190908101236.2802-1-ulf.hansson@linaro.org> Nowadays sdhci prevents runtime suspend when SDIO IRQs are enabled. However, some variants such as sdhci-esdhc-imx's, tries to allow runtime suspend while having the SDIO IRQs enabled, but without supporting remote wakeups. This support is a bit questionable, especially if the host device have a PM domain attached that can be power gated, but more importantly, the code have also become redundant (which was not the case when it was introduced). Rather than keeping the redundant code around, let's drop it and leave this to be revisited later on. Signed-off-by: Ulf Hansson --- drivers/mmc/host/sdhci-esdhc-imx.c | 34 +++++++++++++----------------- drivers/mmc/host/sdhci.c | 2 +- drivers/mmc/host/sdhci.h | 5 ----- 3 files changed, 16 insertions(+), 25 deletions(-) -- 2.17.1 diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 776a94216248..1c988d6a2433 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1666,12 +1666,10 @@ static int sdhci_esdhc_runtime_suspend(struct device *dev) if (host->tuning_mode != SDHCI_TUNING_MODE_3) mmc_retune_needed(host->mmc); - if (!sdhci_sdio_irq_enabled(host)) { - imx_data->actual_clock = host->mmc->actual_clock; - esdhc_pltfm_set_clock(host, 0); - clk_disable_unprepare(imx_data->clk_per); - clk_disable_unprepare(imx_data->clk_ipg); - } + imx_data->actual_clock = host->mmc->actual_clock; + esdhc_pltfm_set_clock(host, 0); + clk_disable_unprepare(imx_data->clk_per); + clk_disable_unprepare(imx_data->clk_ipg); clk_disable_unprepare(imx_data->clk_ahb); if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS) @@ -1695,15 +1693,15 @@ static int sdhci_esdhc_runtime_resume(struct device *dev) if (err) goto remove_pm_qos_request; - if (!sdhci_sdio_irq_enabled(host)) { - err = clk_prepare_enable(imx_data->clk_per); - if (err) - goto disable_ahb_clk; - err = clk_prepare_enable(imx_data->clk_ipg); - if (err) - goto disable_per_clk; - esdhc_pltfm_set_clock(host, imx_data->actual_clock); - } + err = clk_prepare_enable(imx_data->clk_per); + if (err) + goto disable_ahb_clk; + + err = clk_prepare_enable(imx_data->clk_ipg); + if (err) + goto disable_per_clk; + + esdhc_pltfm_set_clock(host, imx_data->actual_clock); err = sdhci_runtime_resume_host(host, 0); if (err) @@ -1715,11 +1713,9 @@ static int sdhci_esdhc_runtime_resume(struct device *dev) return err; disable_ipg_clk: - if (!sdhci_sdio_irq_enabled(host)) - clk_disable_unprepare(imx_data->clk_ipg); + clk_disable_unprepare(imx_data->clk_ipg); disable_per_clk: - if (!sdhci_sdio_irq_enabled(host)) - clk_disable_unprepare(imx_data->clk_per); + clk_disable_unprepare(imx_data->clk_per); disable_ahb_clk: clk_disable_unprepare(imx_data->clk_ahb); remove_pm_qos_request: diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index efa6cda8c991..4c4285387b47 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -3048,7 +3048,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) spin_lock(&host->lock); - if (host->runtime_suspended && !sdhci_sdio_irq_enabled(host)) { + if (host->runtime_suspended) { spin_unlock(&host->lock); return IRQ_NONE; } diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index cf3d1ed91909..8effaac61c3a 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -753,11 +753,6 @@ static inline void sdhci_read_caps(struct sdhci_host *host) __sdhci_read_caps(host, NULL, NULL, NULL); } -static inline bool sdhci_sdio_irq_enabled(struct sdhci_host *host) -{ - return !!(host->flags & SDHCI_SDIO_IRQ_ENABLED); -} - u16 sdhci_calc_clk(struct sdhci_host *host, unsigned int clock, unsigned int *actual_clock); void sdhci_set_clock(struct sdhci_host *host, unsigned int clock); From patchwork Sun Sep 8 10:12:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 173346 Delivered-To: patches@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3003190ilq; Sun, 8 Sep 2019 03:12:57 -0700 (PDT) X-Received: by 2002:a19:431e:: with SMTP id q30mr12613016lfa.171.1567937576936; Sun, 08 Sep 2019 03:12:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567937576; cv=none; d=google.com; s=arc-20160816; b=DQvvIrrR8rrKCC+Rza9XQTp/ZYWeFjIBw3JnopRqqhpSl81hYZ29/0yBK+A+szjITP WSAv3xFiTy2DQz2aFUh4y0t728aplICNqqfbQwfyFPGnOf21rNUmVdp55cRpLYL4l/GS A1zvGuSlHkVDnIioDHy+DX7JsRzIwvO2iZIKn9soVcjYfrJ4Th/6oIwoYVTyvbLL8mfz ut8FSzjrChlJH12FDVcoFO3fL9YhEsf5nBAoetrwzngosaaNwM2j6bwi32Iotiuf/Ijt bd/Ecbp5K2hfsreKaiNPu7Syfp7z7ztQ3NoeFC00N+RWdv3jHjSo1LGOAF3g7hPnFTBk FQgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3w96KtsEyQIf1hGAVsd0wnGyK35jZHwym8BrQsTbnec=; b=rybXDmRKInlfMcCunF/BQZ/rUad7MeoL5C4S3F/4fbwTPdLSh+/MLSmeaE5hPDYD1n HcjhTEtKDACkt/Ad+YIFwPhCN7CFAjVu/cgu/29pHd07V5bp5Yku0WNpSyWEJl+yL76R pyO/AwpNF4ByAuX2wO2KYHFsXZaBqMmqSJGWByvHluW3ClokNMFS+mVAMAQuiRCjT2wm BAeILTj54HtZHFHhor9FGIq245I0IRe3ItqysAeK2t86LF5VxxI+Z0S8+iccr+nvOMYU M3fCL5/CHx+cBZG74GNOHbN4TY+dRFvxm/ocOfDISl9RQ6zAaf2XnJRh5h+wtoS2O6sJ q3Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fLGdd4+B; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id w7sor3226747lfn.2.2019.09.08.03.12.56 for (Google Transport Security); Sun, 08 Sep 2019 03:12:56 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fLGdd4+B; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3w96KtsEyQIf1hGAVsd0wnGyK35jZHwym8BrQsTbnec=; b=fLGdd4+BgfMFa2gyfbBQXvCUukG5s+sE/ms976Wf2QRgaMPYjEzEyWGYVWAPY5Grdr +3vSvz+rJQTCMmu7qd+DM0m5dasetQHBbMpOWzIkE9yWH5udVAC+2qjqKuYd4Tu0we5M ErE26ZXoCKnSk2fSQcsXmvVyB7XdJ9FSieot7Hn9AFLkUeTjA5vLWjPpeC7KwlEgiCYZ 1FLHq+8xlEXxx+A1TOko8hMSDhfTmSyXxjigJ7MS9muhjwiHEGZ6mOGwKIVJhhbQv6eY vNf0aIlnQpAOBPJNpHdlV5HFzUuGa4nltukhJbeoiWL1T+FPuAnF65iVfkOHI28c4WXR 1CQg== 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=3w96KtsEyQIf1hGAVsd0wnGyK35jZHwym8BrQsTbnec=; b=aJ+n6zU6ZOiXudqYFuW8n09TdZQcrm3+/Ku7Tc3NvIs8KXcG8X8REFknur+/el+sEh NupPzn4gpID1sen4Yli/lOSIqZLBxecrUXVpMPzDo3xer8jdLxunJMeCleg1wkHUWz3c ROxZF2HtVsY626/vuWY/FhgKg8X7aNyGiczbwmSgq2UNnY8VQggJtaZSKJCnkejWc6yd SkGmHczTWuug816n5QOICEfJihmrGfFkNA/3SkcpR472tzA4skNUME6KpoTfMrlnZFJh XFdL4olCvtsLnaFiNIH72e8Pgyw47m5g5hBU2pwnRD2EKn1BEsPYWlqaH7mc7C6Jv2vB vmPA== X-Gm-Message-State: APjAAAXo8CWbbvpxDkcjo3SMhCPVruLNWuynHWCI7MsgFwVWma689eNj eNZK32Wj+cF9HoTmaDzij7pQE/D7 X-Google-Smtp-Source: APXvYqxC+7Ix/scWWeDIi59L/pZevcfUOeJNswESUdyorlg79fmFVsljPaZy8gFr/5NJfCk+RW/2fg== X-Received: by 2002:a19:3fd1:: with SMTP id m200mr12542682lfa.18.1567937576585; Sun, 08 Sep 2019 03:12:56 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([185.122.190.73]) by smtp.gmail.com with ESMTPSA id h25sm2444849lfj.81.2019.09.08.03.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2019 03:12:55 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Douglas Anderson , Matthias Kaehlcke Cc: Shawn Lin , Jaehoon Chung , Yong Mao , Chaotian Jing , linux-kernel@vger.kernel.org Subject: [PATCH v2 11/11] mmc: sdhci: Convert to use sdio_irq_claimed() Date: Sun, 8 Sep 2019 12:12:36 +0200 Message-Id: <20190908101236.2802-12-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908101236.2802-1-ulf.hansson@linaro.org> References: <20190908101236.2802-1-ulf.hansson@linaro.org> Instead of keeping track of whether SDIO IRQs have been enabled via an internal sdhci status flag, avoid the open-coding and convert into using sdio_irq_claimed(). Reviewed-by: Matthias Kaehlcke Signed-off-by: Ulf Hansson --- drivers/mmc/host/sdhci.c | 7 +------ drivers/mmc/host/sdhci.h | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) -- 2.17.1 diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 4c4285387b47..4b297f397326 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2144,11 +2144,6 @@ void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable) pm_runtime_get_noresume(host->mmc->parent); spin_lock_irqsave(&host->lock, flags); - if (enable) - host->flags |= SDHCI_SDIO_IRQ_ENABLED; - else - host->flags &= ~SDHCI_SDIO_IRQ_ENABLED; - sdhci_enable_sdio_irq_nolock(host, enable); spin_unlock_irqrestore(&host->lock, flags); @@ -3382,7 +3377,7 @@ int sdhci_runtime_resume_host(struct sdhci_host *host, int soft_reset) host->runtime_suspended = false; /* Enable SDIO IRQ */ - if (host->flags & SDHCI_SDIO_IRQ_ENABLED) + if (sdio_irq_claimed(mmc)) sdhci_enable_sdio_irq_nolock(host, true); /* Enable Card Detection */ diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 8effaac61c3a..a29c4cd2d92e 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -512,7 +512,6 @@ struct sdhci_host { #define SDHCI_AUTO_CMD12 (1<<6) /* Auto CMD12 support */ #define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */ #define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */ -#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ #define SDHCI_USE_64_BIT_DMA (1<<12) /* Use 64-bit DMA */ #define SDHCI_HS400_TUNING (1<<13) /* Tuning for HS400 */ #define SDHCI_SIGNALING_330 (1<<14) /* Host is capable of 3.3V signaling */