From patchwork Mon Feb 12 20:13:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 10214379 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BFF7260153 for ; Mon, 12 Feb 2018 20:14:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6D4028C94 for ; Mon, 12 Feb 2018 20:14:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9990D28CB4; Mon, 12 Feb 2018 20:14:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E40D028C94 for ; Mon, 12 Feb 2018 20:14:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753523AbeBLUOZ (ORCPT ); Mon, 12 Feb 2018 15:14:25 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:50705 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752536AbeBLUOY (ORCPT ); Mon, 12 Feb 2018 15:14:24 -0500 Received: from localhost.localdomain ([95.90.209.156]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.167]) with ESMTPSA (Nemesis) id 0M7Fkw-1eZYR22HRO-00x4X6; Mon, 12 Feb 2018 21:14:02 +0100 From: Stefan Wahren To: Ulf Hansson Cc: Eric Anholt , Ray Jui , Scott Branden , Jon Mason , linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-mmc@vger.kernel.org, Phil Elwell , Stefan Wahren Subject: [PATCH] mmc: bcm2835: Don't overwrite max frequency unconditionally Date: Mon, 12 Feb 2018 21:13:44 +0100 Message-Id: <1518466424-30229-1-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.7.4 X-Provags-ID: V03:K0:92dBSC0M9Dyp9TBA4rMykUrFg1Ixo698J3rkoJ9gPolqqQNBo5F 9O11UbZJ4NbBmp7HX9S/LF5aKEEKCs19VfZfi2Ldz2hWQBCBO7KT/gDbfmjABLhqVejNksU BF3K8IFdv/0BMSZglwXGjRht4XL+6EOUJWcQHudYc8prf9Q3hYTpmV9T44zxU3RN6DP+M1C Xj/T19eByx1dlW3aGQugg== X-UI-Out-Filterresults: notjunk:1; V01:K0:cNpYAIHxSFU=:h/KrPq/j91tEkBEysbzOyu 4vaI0MmY8WL7SyoixEoWAgUgYd/rN3YnMx+4lpiVCLo96wsAtlBqO/6g1CdnHuSTnF49Wsf1a WmepNZ3jYqOw5xKGclpn6qqvKidAW/drG8JHYfDDNqrKdctwVEZMz3szS2ju/kxJ3MEMYA44u OYP7Qn0KPCIFik6HdTY2Xa05/PZ9jE+omwfn/ceUXEsNGwJby+imUOUdkz/X++U9MtF0CcEPk npKWIpDaYUEBMeZ0gmtd0zPU5ym1hSyTa3boNkCUc6XlMolMf82cWSKBOxcGeNJ0087nXTu3h l0zHP+2ngdIE5uOt5pNYxrv5ovNM01djLwzY+GHG4GbumvEFxMuxSKKpubxMFLGwm3/y3kFuT b44swAaNcvjgcH1+bpSmqto8MiHgLGkETB/lEISvI8qxFLbYwOs3+wTt/GmDYAIYWit5Vpu/X cQ8OV+yj8REHSF6SOzOoCw7Kx0dDizp7PBAjhnbtj25tgGr8+mTPsKgoOvX5ToQPUI1w4ZzWi KzjFnRGCKO4vs6XLdHJ+0IFBZkgx4+sfKrv8Qw6wKLKqgVWN2bRAydY+yXTKYCt/uLVy2Ux1Y QS3FdM5udWAAtkvV0J6hu0X3aiVxMudaCovbWRZFGutbj+5nrMOe5O6rX9dsqNNr+fq2uWWFL vGQhbMpy1+ySXRRgGnW2YAYGZ19HJD9RD7uF7iTG3gm5HKSo7/kfGg3adbvAOx3CHghYxQTjd G5CClostgOvnpqBcbyuvYASFqgoDff/EiTP4B3CCywjn1a2+Mq1aQ1bRrCw= Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Phil Elwell The optional DT parameter max-frequency could init the max bus frequency. So take care of this, before setting the max bus frequency. Fixes: 660fc733bd74 ("mmc: bcm2835: Add new driver for the sdhost controller.") Signed-off-by: Phil Elwell Signed-off-by: Stefan Wahren --- drivers/mmc/host/bcm2835.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c index 229dc18..768972a 100644 --- a/drivers/mmc/host/bcm2835.c +++ b/drivers/mmc/host/bcm2835.c @@ -1265,7 +1265,8 @@ static int bcm2835_add_host(struct bcm2835_host *host) char pio_limit_string[20]; int ret; - mmc->f_max = host->max_clk; + if (!mmc->f_max || mmc->f_max > host->max_clk) + mmc->f_max = host->max_clk; mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV; mmc->max_busy_timeout = ~0 / (mmc->f_max / 1000);