Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1447250imm; Fri, 28 Sep 2018 19:30:48 -0700 (PDT) X-Google-Smtp-Source: ACcGV63L6aZ3TMG/p/hO8HKSWezZGsLKG9JbvnFPWs0yW8ES8SQzXdQDPwf9dJaBAPho9gHcxZm1 X-Received: by 2002:a62:3001:: with SMTP id w1-v6mr1276641pfw.19.1538188248853; Fri, 28 Sep 2018 19:30:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538188248; cv=none; d=google.com; s=arc-20160816; b=Rxyl0qxT1EkNOtyrVMdnWj2YNV3nje9T87ofDqp56gQ4W2Rn+l0tfqVcIXERl1bfIR OkxwGGfJukwPVcnOR4ETZTj7OtLdXQdTtTDLwTmQv75DXdAvNf5mU727mAOeG0sQpKNi jHAKxu3fwRhwAJudHb0lbmDPZsurphHkqq2fZAP0fX91QCrkjXoiXivXBW0Qrsz7UfTQ qieTDFswg7fOVuSsPf0+a/s+p8Pu2wjAFXz71VSQm3+datWo/1acTdzRIzpgANBJ/xAa +f6CWZnp7CjAvPUyAboIDebljh+5Pb3/wYJf8BZHd2jUj7rTm8k+dfwB6amsWFoiiViG TKPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=G8FnGzKAHIp6GIXLBzeQMqgvqV2HF1LCBSijBwYgjpg=; b=JaIBXDt42kIJuU4gQWw2NN+mJJIBqK5w+hDw2ZVqgYVKrW7mf8oOSt1deVt9S37rGl lriEFzPW5p6REwhZl15xs40DXkpPck9HhHRSBUKEDGYkHemn//na8I9CbqYskDRTUkHD W1AxWar8Qb8Fy9YUsECGrULj53IxEZXbWJC1iCwQWeilgqdirqBVlTqQN4LsFGQMjuRv g8qMsUgZnYT4etWxw0GzLEZ9ABLNopjhnwQe50hiC526lv2693HuDpIh3TVXQViTLS+X /Q8Q/P2v8rQZeuTa+usY13JYx7TTVoKsijNDzCJZ/OnF8WQWR/t3ezxW8HCjyxIoP/8h xnCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 k4-v6si6339151pfc.328.2018.09.28.19.30.34; Fri, 28 Sep 2018 19:30:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727462AbeI2I4v (ORCPT + 99 others); Sat, 29 Sep 2018 04:56:51 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:59682 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727355AbeI2I4u (ORCPT ); Sat, 29 Sep 2018 04:56:50 -0400 X-UUID: 0677bb2924024f129c3e3487994d181e-20180929 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 455522438; Sat, 29 Sep 2018 10:30:04 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sat, 29 Sep 2018 10:30:02 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Sat, 29 Sep 2018 10:30:01 +0800 From: Chaotian Jing To: Ulf Hansson CC: Rob Herring , Mark Rutland , Matthias Brugger , Chaotian Jing , Ryder Lee , Wolfram Sang , Sean Wang , , , , , , Subject: [PATCH v1 2/2] mmc: mediatek: add bus_clk control Date: Sat, 29 Sep 2018 10:29:55 +0800 Message-ID: <1538188195-3608-2-git-send-email-chaotian.jing@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1538188195-3608-1-git-send-email-chaotian.jing@mediatek.com> References: <1538188195-3608-1-git-send-email-chaotian.jing@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: CDF554A6A90584992D63062400167C931FBC488D909A985C62635BD44C11D7622000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org when gate MSDC0_HCLK, access register will hang, even the MSDC driver will never accessing register after HCLK was gated, but for safety, need gate the bus_clk(which used to access register) too. Signed-off-by: Chaotian Jing --- drivers/mmc/host/mtk-sd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index 0484138..1c1c967 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -387,6 +387,7 @@ struct msdc_host { struct clk *src_clk; /* msdc source clock */ struct clk *h_clk; /* msdc h_clk */ + struct clk *bus_clk; /* bus clock which used to access register */ struct clk *src_clk_cg; /* msdc source clock control gate */ u32 mclk; /* mmc subsystem clock frequency */ u32 src_clk_freq; /* source clock frequency */ @@ -660,12 +661,14 @@ static void msdc_gate_clock(struct msdc_host *host) { clk_disable_unprepare(host->src_clk_cg); clk_disable_unprepare(host->src_clk); + clk_disable_unprepare(host->bus_clk); clk_disable_unprepare(host->h_clk); } static void msdc_ungate_clock(struct msdc_host *host) { clk_prepare_enable(host->h_clk); + clk_prepare_enable(host->bus_clk); clk_prepare_enable(host->src_clk); clk_prepare_enable(host->src_clk_cg); while (!(readl(host->base + MSDC_CFG) & MSDC_CFG_CKSTB)) @@ -1900,6 +1903,9 @@ static int msdc_drv_probe(struct platform_device *pdev) goto host_free; } + host->bus_clk = devm_clk_get(&pdev->dev, "bus_clk"); + if (IS_ERR(host->bus_clk)) + host->bus_clk = NULL; /*source clock control gate is optional clock*/ host->src_clk_cg = devm_clk_get(&pdev->dev, "source_cg"); if (IS_ERR(host->src_clk_cg)) -- 1.8.1.1.dirty