Message ID | 1437569590-5228-9-git-send-email-aisheng.dong@freescale.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org> X-Original-To: patchwork-linux-arm@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 484809F1D4 for <patchwork-linux-arm@patchwork.kernel.org>; Wed, 22 Jul 2015 14:07:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF8482058C for <patchwork-linux-arm@patchwork.kernel.org>; Wed, 22 Jul 2015 14:07:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F19BB20649 for <patchwork-linux-arm@patchwork.kernel.org>; Wed, 22 Jul 2015 14:07:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZHudv-0007Ls-S0; Wed, 22 Jul 2015 14:05:07 +0000 Received: from mail-bl2on0127.outbound.protection.outlook.com ([65.55.169.127] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZHucr-00068W-CK for linux-arm-kernel@lists.infradead.org; Wed, 22 Jul 2015 14:04:05 +0000 Received: from BN3PR0301CA0077.namprd03.prod.outlook.com (10.160.152.173) by BN3PR03MB1413.namprd03.prod.outlook.com (10.163.34.20) with Microsoft SMTP Server (TLS) id 15.1.225.19; Wed, 22 Jul 2015 14:03:39 +0000 Received: from BY2FFO11FD053.protection.gbl (2a01:111:f400:7c0c::179) by BN3PR0301CA0077.outlook.office365.com (2a01:111:e400:401e::45) with Microsoft SMTP Server (TLS) id 15.1.219.17 via Frontend Transport; Wed, 22 Jul 2015 14:03:38 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; gmail.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD053.mail.protection.outlook.com (10.1.15.190) with Microsoft SMTP Server (TLS) id 15.1.213.8 via Frontend Transport; Wed, 22 Jul 2015 14:03:38 +0000 Received: from shlinux2.ap.freescale.net (shlinux2.ap.freescale.net [10.192.224.44]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t6ME2iY6019637; Wed, 22 Jul 2015 07:03:32 -0700 From: Dong Aisheng <aisheng.dong@freescale.com> To: <linux-mmc@vger.kernel.org> Subject: [PATCH V2 08/11] mmc: sdhci: make max-frequency property in device tree work Date: Wed, 22 Jul 2015 20:53:07 +0800 Message-ID: <1437569590-5228-9-git-send-email-aisheng.dong@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437569590-5228-1-git-send-email-aisheng.dong@freescale.com> References: <1437569590-5228-1-git-send-email-aisheng.dong@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD053; 1:+CFZBYH/7zf1xqpnV5EMN6mByC9CK2pZf/9fZ9uFe5C5zjtw1jc09ZrujgpQt6W9MC0TCLVdd5O3XORhm22bybQQ40HJvPHDsMv81kZf9WKHFRBnEIHCnhvy0NmUPtjGWIVcHU81V6jRjDeQuNCmjSBI5IkVq3Ox/WaWzzDqaO7oC9HS8c8bYk3lrK5OKWZyLmyo5PL54+LsfxwsYKLNnbZ+QvC6LBIrj9nkscnWjl6Ms6XsmLSlfthz3taT8BCbmr6NRd95oyLxsMY9VBCz/BrM5AHHA8G4q5fLmfuq3BdLInykHhxw4IbJsZ87nCIPi2G8KEyuKr8p4Od+39cEpbNQNabeBwcrHqGK3KWReNe7RusoiKr/7/963+5pcNOzbae3XzRaQ/v0FELgIqWevHPGyO1psx4o1yC3ZBExrGrnKSuGjoQpctX/PFUuPSZt X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(189002)(199003)(229853001)(33646002)(5003940100001)(104016003)(87936001)(47776003)(85426001)(19580405001)(19580395003)(6806004)(46102003)(5001960100002)(2351001)(110136002)(36756003)(189998001)(86362001)(2950100001)(48376002)(62966003)(77156002)(77096005)(76176999)(106466001)(50226001)(50986999)(50466002)(92566002)(105606002); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR03MB1413; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB1413; 2:ZqfQPL5OrWfL2BOvVxYYzFDkg6UQkYFVebw0w05r+Bqo/J3F9sjOteh5DZc9jwGTsAMXyGK7hHFQf01ReBBfFn9G4rAPDPHju5k62DPbcuMvmoYRN7M2t3GjzBtHnvlHQS5rxBRL28waAqKgEUHrUfqSxCp1gw4AkgxMjdpg6fk=; 3:bJsMKGCRoe27p28RPDPlVb+FpgrnLWFI9DxWxLESLDUykyT4yUzFxccyMBQpyVRULWhqFIw3hx2uoN1IS3+dRDJA8st8CXNPSPifUDrds9Ez62Kcvo1RuhzZSe/ynCn6uq7NBS0fkg4pSvxKEQ0F0ysz5yfi9utohpiQr0gtMf5LWWyEIGJBWmFgXtX9QUv93G48o6bALjundFmaegpUPkBOz+MWjB7Cyud9RiNUOrY=; 25:CBTDHoY7PmSO8atCQ1fzcrsRovAaDxCB+m9OGpqwZ/WuVtnNdaChdmhJvdzYd4G5yQqbvZIe3NdDhVaLT3lz4/6aUuEHYQtvNsUP2v3X4Z9amIDuPQYC35WglRkQWFjRYNViyyyo0eEq0825qCWGaL9k5ooNOXEjYWPsVF25yp1EzOiTpZrNjRVFvtNmLZfzcEHPmgnQlqYuak2li85VVsQxTh4aqrHbU/C58lOP1hqGguGsDajQiT7/7+sEL8Qwf3U1ob18hLz5x3Nx7JNVbA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR03MB1413; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB1413; 20:z3MTTH2BN/Y/RAqLa9GfAkwux1f4UXN4weA67OuwcXImvDLyMO5YWnwOglXZwrsX7sqF25E1Sbjqg6eb4dB7fVbOhPf9hZwwljeU40tZ/y85yDTYyglavDAjjemoKPn0o2CPrYSa85F/Yi62r/GflbzEuPhClftmhgafdSdrbLphTKGzCrormRMeNBIuEvZPglcWsAkxS9CGSChNSzaV0E4bhQV/D9aD177nHF8JX/3uyStgkw0AJDZS3FpDVyTDnkbjHBC5+gFTT/iRNwGDMWJXoP3cLZpwRCBH9L2zx3MtnDWZigx+YUjhDddZiK7zS+GX4931vEHbb23GUuuVxnjFMTJs2wG81CN+LaafVMw=; 4:04sz3a2vgB3TKaGYA2A8Lk4ZtOCL1kfi7J49iTkkxZ/rWW5+Tu+vFPB1j1cDaSzRie0MdXgRLh83C9+1EeQVKLI8hSZ+rhFABaYiT4W0ulQf4VEvSKAfpqd8wCb4/ErV1n7PaMiPVx4Zzs7cr3IwQb3lk9RAgtakM+3pOUSpxPg8RNCL9ikYaY+cWglQQ+0kKhoMg4AzGgZgKqQ1rn+LTmsF9qMfP8eYS/IGKRy3j+gPWBzxzBe9QOG0j9L8DCE/uYLemf0XbeQDV0dwLhw0C5/B3gyKDfGiW62a6uwisjI= BN3PR03MB1413: X-MS-Exchange-Organization-RulesExecuted X-Microsoft-Antispam-PRVS: <BN3PR03MB141381AAF490C19EB88F0B738A830@BN3PR03MB1413.namprd03.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BN3PR03MB1413; BCL:0; PCL:0; RULEID:; SRVR:BN3PR03MB1413; X-Forefront-PRVS: 0645BEB7AA X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB1413; 23:B4w3IL7LD5zE7BA0acEP6lyIclt4aPRh+mHlhDYG0lkf23ZbyKQS3gNkPD779G9ztqpDe862OV2sgikYGk3zJh81VGnd+uuqhW/Sn54VDjspcvVsa0lp3c6VKOQpuJSpIEFKIAgHEHW/8aTq/36929e4nFxTqdjkk9S3etI/lxXX4ge+CPndKPsHr5+Fh917cjjLW2VsL4QCAsYNgoseG32hoGEu6N+IMuxpimczCj7NIYerkC6EQQA1YWosu3nnpg2tfRne3jeoAwlTLSlS7JNElrTLMJ3Q5tWXKGOZf28gPaKzON3+RbRnXx2R7oo6wBofH0wgJvWhp7ywje4trTVCN4HIDCt9w+NyO4b+dqYUV0kVKOkBGpXh3Upf6soKTMY2yQpl36nPSkV4wOIAU69K5kphJnR0PDP7gy7BOSaGrdQwVLUliNA00if3r5zyBVmYa9se4tJtHOf/FER4+IuMQjoHtylZ8/mdkZqrECjw7swtHCBVkwvqedsQccYZ12TZuP58yHr3H0FZL8HmnewWESzRKhXSOfUG4pHkkdAZn6t/KdH1cQ7ybtrRzivWxyF+aE1fOPqPupreO4igFoulBNfetg75UsNxlmObQi/c18l/Z+zXStL8HA6tGv+ueHOmVR09mEioUG0R6Q7I1PdcT1aUmGgKkQ8I6mCrPPhVdC7IqQSkNHYtR4iXOOSgCJmUtfTMpy9I3ujVfpkwuFlFWD9eGuQ0muBzmnpODc4jzcPa5GszACw5ClP7kK0IqZepCNfR3TSQ9OLrwRx2JtEelQNrVY93zex/e6wPiA7NnSrZn7MpKEJpjZs4hUewPqZfC7panCsZ6QzXIsRqfKZAQeSooZq13gxhDzBz7Eo/wTTRASa0LXe4J6zMJxxKWjc+vbnssiuPef+eqDhWPg== X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB1413; 5:joyq8/GX8xsT6qWyCZHh7E7yWKxx2o/9sQM/LMyOOlkszTyvW9slYDc6cqciON38KJl9sp7+/M4st37gS4mzOfmF8VPv5ifRgWVkqngXMHbgv4OZuPJ7HbLKonF4SnFngefZEOXgRHXy7j3zJBNYaQ==; 24:yOp/RxqgueanTXiejRawwMaF+Ghw+UmKCkbK1+dhaBqh/45ph787QHv3uQ1IykBX8EAQ5FDjZ2LX+xw2j/KMDD0ENCLV+ckj8Y1FNtCzvF4=; 20:eviXaJpFTYIPDWN7VLwvCDv3BIZii9Frn6cY4jSXHJwNAOv+Uw8yFe2zSIU0yCcdyI8Yj1SklPiVGBOy/p1SWA== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2015 14:03:38.0286 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR03MB1413 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150722_070401_867425_0A07EB02 X-CRM114-Status: GOOD ( 13.88 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Cc: fabio.estevam@freescale.com, marex@denx.de, ulf.hansson@linaro.org, hs@denx.de, p.zabel@pengutronix.de, tharvey@gateworks.com, shawn.guo@linaro.org, s.hauer@pengutronix.de, ipaton0@gmail.com, chris@printf.net, rabeeh@solid-run.com, troy.kisky@boundarydevices.com, smoch@web.de, gwenhael.goavec-merou@armadeus.com, rmk+kernel@arm.linux.org.uk, lisovy@gmail.com, s.trumtrar@pengutronix.de, robertcnelson@gmail.com, b29396@freescale.com, linux-arm-kernel@lists.infradead.org, LW@KARO-electronics.de Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 947033d..c83d110 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2874,6 +2874,7 @@ int sdhci_add_host(struct sdhci_host *host) u32 max_current_caps; unsigned int ocr_avail; unsigned int override_timeout_clk; + u32 max_clk; int ret; WARN_ON(host == NULL); @@ -3058,18 +3059,22 @@ int sdhci_add_host(struct sdhci_host *host) * Set host parameters. */ mmc->ops = &sdhci_ops; - mmc->f_max = host->max_clk; + max_clk = host->max_clk; + if (host->ops->get_min_clock) mmc->f_min = host->ops->get_min_clock(host); else if (host->version >= SDHCI_SPEC_300) { if (host->clk_mul) { mmc->f_min = (host->max_clk * host->clk_mul) / 1024; - mmc->f_max = host->max_clk * host->clk_mul; + max_clk = host->max_clk * host->clk_mul; } else mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300; } else mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200; + if (!mmc->f_max || (mmc->f_max && (mmc->f_max > max_clk))) + mmc->f_max = max_clk; + if (!(host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK)) { host->timeout_clk = (caps[0] & SDHCI_TIMEOUT_CLK_MASK) >> SDHCI_TIMEOUT_CLK_SHIFT;
Device tree provides option to specify the max freqency with property "max-frequency" in dts and common parse function mmc_of_parse() will parse it and use this value to set host->f_max to tell the MMC core the maxinum frequency the host works. However, current sdhci driver will finally overwrite this value with host->max_clk regardless of the max-frequency property. This patch makes sure not overwrite the max-frequency set from device tree and do basic sanity check. Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com> --- drivers/mmc/host/sdhci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)