Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1639277imm; Sat, 13 Oct 2018 00:23:14 -0700 (PDT) X-Google-Smtp-Source: ACcGV638HKexMRqfqbZ6JBrQKm9b7PISvF/J0zSb/X6Dfpqn0LstIZawfiAotQ32nuDLuZFmHIjx X-Received: by 2002:a63:730c:: with SMTP id o12-v6mr8488925pgc.397.1539415394899; Sat, 13 Oct 2018 00:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539415394; cv=none; d=google.com; s=arc-20160816; b=lPVwh86coKh5WWZi6NLdPyQSW4DJ8IksybACkMzRMfhB/O7haMyUUCCL8mcZxnvf8L mIBwChx+8/rLt/bzy2kU1pgHduiyM3/qgPgSWgb28MJP+3a260u6xhZqUdpjWngj1gpA vUeq/XGHvHc3X2t3BwnJeWG1Yo+SFDcOxTNWozN+b5oBGmLLndOPkcQe/p2Z1cX56f/j Sa09+RjC6RCQz9+znVMIw9gq4gKAviSrnECsECMfLz8ENZ8Lnbx2HUB4qsYqOk60geAo bZDGS05uU3W7U3cIk8vbJddETvSwjO8MT0h5EbUCIcSU+j0vjA2HLcS+WzYIa2WsklTp QPYA== 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=iEKliX5GX/D1du9mbAV/trfhxHNpiLPBp03YwZOygfI=; b=CyiBVDWSalX7xPLSK0wgrgp4kRse/p3xHz6JmIb4PSgFXMokAhDmdRYO7qoog7uQF0 Qufakns+JgDfpqb4/AYP5bD2XKu+wfoGqFvslHNdJSuitWjJp5UoRospKCLJyNuyudui Qx2oS4Jx4AqsgUpt1zCblfrt6XWbTdqp7AftP2KeohP8iSpKwozBo2EX3tDvSXu5KKZJ 3sSThKAp5VeA8tfIRaZQb/eulM/vAtsbAEky1Vg1wYycZVFDjGK2hKH/1U5a0MYByKuO nC52ZaxNFolEgEQU//cRfaYS0NEZKU+/TUcJVf5jQqHoVlvTTTZdbl5IIuiS744X6NCf /AXQ== 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 31-v6si3427253pli.394.2018.10.13.00.22.59; Sat, 13 Oct 2018 00:23:14 -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 S1726419AbeJMO5W (ORCPT + 99 others); Sat, 13 Oct 2018 10:57:22 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:39152 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726329AbeJMO5W (ORCPT ); Sat, 13 Oct 2018 10:57:22 -0400 X-UUID: d7947cc62f9b4d58b981636c62b61373-20181013 X-UUID: d7947cc62f9b4d58b981636c62b61373-20181013 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 706254969; Sat, 13 Oct 2018 15:21:11 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sat, 13 Oct 2018 15:21: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; Sat, 13 Oct 2018 15:21: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/6] mmc: mediatek: fill the actual clock for mmc debugfs Date: Sat, 13 Oct 2018 15:20:46 +0800 Message-ID: <1539415250-32337-3-git-send-email-chaotian.jing@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1539415250-32337-1-git-send-email-chaotian.jing@mediatek.com> References: <1539415250-32337-1-git-send-email-chaotian.jing@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 8893F9788E1E3399626D3C4D1EE7F7E72F4B24570230ECC84056BC13CC534B3C2000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org as the mmc core layer has the mmc->actual_clock, so fill it and drop msdc_host->sclk. Signed-off-by: Chaotian Jing --- drivers/mmc/host/mtk-sd.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index 1c1c967..ef45f1d 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -391,7 +391,6 @@ struct msdc_host { struct clk *src_clk_cg; /* msdc source clock control gate */ u32 mclk; /* mmc subsystem clock frequency */ u32 src_clk_freq; /* source clock frequency */ - u32 sclk; /* SD/MS bus clock frequency */ unsigned char timing; bool vqmmc_enabled; u32 latch_ck; @@ -636,10 +635,10 @@ static void msdc_set_timeout(struct msdc_host *host, u32 ns, u32 clks) host->timeout_ns = ns; host->timeout_clks = clks; - if (host->sclk == 0) { + if (host->mmc->actual_clock == 0) { timeout = 0; } else { - clk_ns = 1000000000UL / host->sclk; + clk_ns = 1000000000UL / host->mmc->actual_clock; timeout = (ns + clk_ns - 1) / clk_ns + clks; /* in 1048576 sclk cycle unit */ timeout = (timeout + (0x1 << 20) - 1) >> 20; @@ -686,6 +685,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz) if (!hz) { dev_dbg(host->dev, "set mclk to 0\n"); host->mclk = 0; + host->mmc->actual_clock = 0; sdr_clr_bits(host->base + MSDC_CFG, MSDC_CFG_CKPDN); return; } @@ -764,7 +764,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz) while (!(readl(host->base + MSDC_CFG) & MSDC_CFG_CKSTB)) cpu_relax(); sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_CKPDN); - host->sclk = sclk; + host->mmc->actual_clock = sclk; host->mclk = hz; host->timing = timing; /* need because clk changed. */ @@ -775,7 +775,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz) * mmc_select_hs400() will drop to 50Mhz and High speed mode, * tune result of hs200/200Mhz is not suitable for 50Mhz */ - if (host->sclk <= 52000000) { + if (host->mmc->actual_clock <= 52000000) { writel(host->def_tune_para.iocon, host->base + MSDC_IOCON); writel(host->def_tune_para.pad_tune, host->base + tune_reg); } else { @@ -790,7 +790,8 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz) sdr_set_field(host->base + PAD_CMD_TUNE, MSDC_PAD_TUNE_CMDRRDLY, host->hs400_cmd_int_delay); - dev_dbg(host->dev, "sclk: %d, timing: %d\n", host->sclk, timing); + dev_dbg(host->dev, "sclk: %d, timing: %d\n", host->mmc->actual_clock, + timing); } static inline u32 msdc_cmd_find_resp(struct msdc_host *host, -- 1.8.1.1.dirty