Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp778880ybc; Sat, 16 Nov 2019 08:32:14 -0800 (PST) X-Google-Smtp-Source: APXvYqwe608EEvOD7R9sIO3kk7uQ5wMEhuScfNoc+Jx3h9mSKlsnuP1xrqPqK6VBGRP5e2yEogDh X-Received: by 2002:a17:906:70ca:: with SMTP id g10mr10827578ejk.141.1573921934239; Sat, 16 Nov 2019 08:32:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573921934; cv=none; d=google.com; s=arc-20160816; b=cU/YTDJy/ucAcMH4gZnvlsjOG/hi7XWLHyFxINzaC9Di0hD8623Y+yC+M/Hii07Xpy IeOyA905Rqvs+eImL4j4YxakNMReC7Lk2zZOJNfLHqNAGDSsQ88OrGHm19zYkb+VT6k7 66Oe1GgEpwh9jCatdG1zv3qwL1ASfLBEpb9YWg2L4qN+U2at4EuF8iSPbIRGJ9CETg7n EEPsT+8c1U4KW5iK5ln9OfGPjyGeTqMFOk01iAjdP4ugTQbeNg0kZS44MQbk0EUMqBVd OJ6JmJiedV3DN64q4e6LfrdNSmu+ou6N3/8ZHUAjILmE5i5iZJ6fwyY6GCWJRQV9qXSJ ML9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cTr3D5mNReBsTQkyyQaFjr/LBmZDOJuToRVo5WcvCzA=; b=GBVOozUFyoYOc0TgXd8OvALArUAQTJ3yOyjM45xZMDClwhQPrLyMg93zBQZGTzz9Lr W0pNmS9x7sz05L5syFWHIR4CHwLgnUd/XhMy2Nly2EzadenMXh3xj028q8QF99lySySX UBzxnmCDc8y2T/DqgzWmarRut5UeblCsr+KjTX/3CIHdc7VBtJ8pW7gGIkOqZh1lyDP0 Vp0iT6R9rwQmqqulx8TWQW5yZl7QUAHRipuucWiI3X0899HMq8J4Uad5hPm8Bw0c2jUV /VvlqyCsWdqI/lsW5jSLeKYRj2/UxfTyPEw9OXsK5jqffVQpBnTdNlpQN5NxWo1H22sr xO7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UWTAWPza; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k15si7733755ejr.327.2019.11.16.08.31.49; Sat, 16 Nov 2019 08:32:14 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=UWTAWPza; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727958AbfKPQ1V (ORCPT + 99 others); Sat, 16 Nov 2019 11:27:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:44846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727950AbfKPPli (ORCPT ); Sat, 16 Nov 2019 10:41:38 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 51D8620803; Sat, 16 Nov 2019 15:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573918897; bh=STG2Hmg0LoPyc4kntgruZckgQ/wfT/uWDxEsXM8w6mI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UWTAWPza5JCNnO6uW4diJ+r+oeeHwbtu3aSZ8EwE3XQO+isYEs+NlxDLMtduCC4xS Kjg/MskDRjRGZE92F2vmgOar5eNNQLTL01yOEMXLO/tcZG1oROtUsIpg11TORjGlNJ R6C+yguOqOFSBCsTxxniRwOa+aBbf6/rf+PPXcaQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chaotian Jing , Ulf Hansson , Sasha Levin , linux-mmc@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 024/237] mmc: mediatek: fill the actual clock for mmc debugfs Date: Sat, 16 Nov 2019 10:37:39 -0500 Message-Id: <20191116154113.7417-24-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chaotian Jing [ Upstream commit 56f6cbbed0463f1c78d602b17c315916cc1cd238 ] as the mmc core layer has the mmc->actual_clock, so fill it and drop msdc_host->sclk. Signed-off-by: Chaotian Jing Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- 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 f171cce5197de..621c914dc5c01 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -390,7 +390,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; @@ -635,10 +634,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; @@ -683,6 +682,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; } @@ -761,7 +761,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. */ @@ -772,7 +772,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 { @@ -787,7 +787,8 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz) sdr_set_field(host->base + tune_reg, 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, -- 2.20.1