Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp649240imm; Fri, 28 Sep 2018 04:41:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV61GVH0EPDQfY5fkp+46IgboAOCqm2MmEpnNOex2i4FPfZDvCQB6AbhcpaS6MQqcwGhnzWo5 X-Received: by 2002:a62:2904:: with SMTP id p4-v6mr16445414pfp.128.1538134906478; Fri, 28 Sep 2018 04:41:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538134906; cv=none; d=google.com; s=arc-20160816; b=RO6SFzxyQKBckkFoXvkbU91vgKDzdwP9bFTDPwwIoAX9J6Mg0bNQhl7Spd9LKxtLmm B6bAuVza30omqKVW7oNZIAoJBQjtknK4wxGW7GK8kh2EajLYwhn/v4NdvST68G3SaI8D Dm5bnlFl87MFNruVaU9VXEGZql5EYbzAeG2hcJYsBLMStiXAXcfTHZOWX1YO5feAuhjr VQsAU0AnD6rTgZsPUFXjY/9+IjEYg5EiQyc+dKKTAa/8W5flpisOWiDCyE/NF6WLQNNN Sl6DYL+JrxtHLBRQrHMJlWKDv9Bw5IMnBjfexYf/gnc9sNZ5D54hlanFx62OIwHvw+40 EYFQ== 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=ak6anlLu7MUErl44iIj6yrg3QxrN0n4PUC/0rV4TBpChIG3l7BFsN3AktFrvBkKwYt GooGPE9gVtTfvfWCykNASBDQMHxhVMMdRw89KAkYOsmr8daY4L1C958ZsHiIkFlRnk4a gMGlVprJDB7mj2B7jrwX2ET0xu0lYEG1Ngoiin41OO3KI51TaB1hEUvXA8g7titAJXYC lbSswZ819RLtdMnZstgAbkp5aW7kXNgUdHt0fIAvz3CJW9jG7L0dPGDekMhC3CO11Hi+ iAzuuQQOcM9hzL/yR2rNWFYl3mGOLxGlDJywBTuh9l3WTGqxBM+vAbDhI5k/GUU8/cil 62yg== 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 b11-v6si4366321pgt.44.2018.09.28.04.41.30; Fri, 28 Sep 2018 04:41:46 -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 S1729648AbeI1SEk (ORCPT + 99 others); Fri, 28 Sep 2018 14:04:40 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:57371 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729291AbeI1SEj (ORCPT ); Fri, 28 Sep 2018 14:04:39 -0400 X-UUID: 554169f8611342478881d40d46051314-20180928 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1956017505; Fri, 28 Sep 2018 19:41:11 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 28 Sep 2018 19:41:09 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 28 Sep 2018 19:41:09 +0800 From: Chaotian Jing To: Ulf Hansson CC: Rob Herring , Mark Rutland , Matthias Brugger , Chaotian Jing , Ryder Lee , Wolfram Sang , Sean Wang , , , , , , Subject: [PATCH 2/2] mmc: mediatek: add bus_clk control Date: Fri, 28 Sep 2018 19:40:55 +0800 Message-ID: <1538134855-11198-3-git-send-email-chaotian.jing@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1538134855-11198-1-git-send-email-chaotian.jing@mediatek.com> References: <1538134855-11198-1-git-send-email-chaotian.jing@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain 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