From patchwork Thu Jan 28 19:31:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaotian Jing X-Patchwork-Id: 8158311 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5E8699F6DA for ; Fri, 29 Jan 2016 03:32:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8ACB52035D for ; Fri, 29 Jan 2016 03:32:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8B3EB20340 for ; Fri, 29 Jan 2016 03:32:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752111AbcA2DcQ (ORCPT ); Thu, 28 Jan 2016 22:32:16 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:23754 "EHLO mailgw02.hq.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751361AbcA2DcP (ORCPT ); Thu, 28 Jan 2016 22:32:15 -0500 Received: from mtkhts09.mediatek.inc [(172.21.101.70)] by mailgw02.hq.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 305124734; Fri, 29 Jan 2016 11:32:10 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkhts09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.266.1; Fri, 29 Jan 2016 11:32:09 +0800 From: Chaotian Jing To: Ulf Hansson CC: Matthias Brugger , Chaotian Jing , Geert Uytterhoeven , , , , , , Sascha Hauer Subject: [PATCH] mmc: mediatek: make sure clock is enabled when executing ops->card_busy() Date: Fri, 29 Jan 2016 03:31:54 +0800 Message-ID: <1454009514-6474-1-git-send-email-chaotian.jing@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty MIME-Version: 1.0 X-MTK: N Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, DATE_IN_PAST_06_12, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP add pm_runtime_get_sync() before access MSDC_PS register Signed-off-by: Chaotian Jing --- drivers/mmc/host/mtk-sd.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index 82a97ac..a56b16d 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -1054,13 +1054,15 @@ static int msdc_ops_switch_volt(struct mmc_host *mmc, struct mmc_ios *ios) static int msdc_card_busy(struct mmc_host *mmc) { struct msdc_host *host = mmc_priv(mmc); - u32 status = readl(host->base + MSDC_PS); + u32 status; - /* check if any pin between dat[0:3] is low */ - if (((status >> 16) & 0xf) != 0xf) - return 1; + pm_runtime_get_sync(host->dev); + status = readl(host->base + MSDC_PS); + pm_runtime_mark_last_busy(host->dev); + pm_runtime_put_autosuspend(host->dev); - return 0; + /* check if any pin between dat[0:3] is low */ + return !!(((status >> 16) & 0xf) != 0xf); } static void msdc_request_timeout(struct work_struct *work)