From patchwork Tue Apr 6 10:48:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 12184827 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31F40C433ED for ; Tue, 6 Apr 2021 10:51:09 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C476E610C8 for ; Tue, 6 Apr 2021 10:51:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C476E610C8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=r7EkwWInT+Nqaw5Lk5U6eY7kEWq9EaPVMjvu6lUduTU=; b=XsfYsWpNcyX2EMmRWPNhYlheG ydVQrriXxyNjdwNwZtZ993zNL3tnK2Rj8Ivg/JbFln9WeSNYouQwfp+mplq0NcGioCFCR5mZMN1YL I7PEJ8xnHyp2IfT17oONCutZ86OSUGF7p0gV1Ta776bNJjczHuYF4YHSpJVkzW+QyDVI96GCSi5we +y5vzS0jDnBxNxniG7M+Ym1JK3+a1RErJRnc3+LNZGlSgm4LRDXhmfLZX1o2nmTKDup2BGugJEnrZ nwgD+36AX5T4LJs/LiIcxlWLFjkOR6prNIRJdhXkGeHRHEVqkKHJX6JXUedq+fLURdpSe5eQDT06K PgGD6S0FQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lTjGa-002DR9-7w; Tue, 06 Apr 2021 10:49:05 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lTjGW-002DQ7-5R; Tue, 06 Apr 2021 10:49:02 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4E0FD610C8; Tue, 6 Apr 2021 10:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617706138; bh=qH4KlpaZXLeo2J5NteL1furYr39Wn2/e7YBQvZKZESc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dVRyE1WbaMTjFkrR5clNrNDxUIaRmixlwQprgIidabaDwFG8bmijxKxpCWWSzKyXK sFASHJ2X+6gHsyXkWF7Nivu28WqPx+iz3LE2Siq5X8L8E79nIJS4sF58tODTN6gC8g HXWF+aKsNeWQgnAAyHcftnfh6P0MYB4gKK1XagQdEt6tHrcSKUgtEZI7+jPt7Tkt0a HC4J2d5H30sANrWPPSpPywcaj6cGA6kGLBNp9y3CkPJhuxL5br26kUDWJqKYpU94Kg GHa4b+XeUmnExuSB/xkzqbeiugGhnrlRRYCi/0vbXo9T5H6TnutHwhvGuMTEdGbk7F Zskuuao/RoAoQ== From: Nicolas Saenz Julienne To: linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, Ray Jui , Scott Branden , Saenz Julienne , Ulf Hansson , Stefan Wahren , Matthias Brugger , Adrian Hunter , Ray Jui , Scott Branden Cc: f.fainelli@gmail.com, phil@raspberrypi.com, tim.gover@raspberrypi.com, alcooperx@gmail.com, nsaenzjulienne@suse.de, linux-kernel@vger.kernel.org, robh@kernel.org, stefan.wahren@i2se.com Subject: [PATCH 2/3] mmc: sdhci-iproc: Cap min clock frequency on BCM2711 Date: Tue, 6 Apr 2021 12:48:03 +0200 Message-Id: <20210406104802.20898-3-nsaenz@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210406104802.20898-1-nsaenz@kernel.org> References: <20210406104802.20898-1-nsaenz@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210406_114900_532923_04825252 X-CRM114-Status: GOOD ( 11.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There is a known bug on BCM2711's SDHCI core integration where the controller will hang when the difference between the core clock and the bus clock is too great. Specifically this can be reproduced under the following conditions: - No SD card plugged in, polling thread is running, probing cards at 100KHz. - BCM2711's core clock configured at 500MHz or more. So set 200MHz as the minimum clock frequency available for that board. For more information on the issue see this: https://lore.kernel.org/linux-mmc/20210322185816.27582-1-nsaenz@kernel.org/T/#m11f2783a09b581da6b8a15f302625b43a6ecdeca Fixes: f84e411c85be ("mmc: sdhci-iproc: Add support for emmc2 of the BCM2711") Signed-off-by: Nicolas Saenz Julienne --- drivers/mmc/host/sdhci-iproc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c index ddeaf8e1f72f..1ef888e91f73 100644 --- a/drivers/mmc/host/sdhci-iproc.c +++ b/drivers/mmc/host/sdhci-iproc.c @@ -173,6 +173,23 @@ static unsigned int sdhci_iproc_get_max_clock(struct sdhci_host *host) return pltfm_host->clock; } +/* + * There is a known bug on BCM2711's SDHCI core integration where the + * controller will hang when the difference between the core clock and the bus + * clock is too great. Specifically this can be reproduced under the following + * conditions: + * + * - No SD card plugged in, polling thread is running, probing cards at + * 100KHz. + * - BCM2711's core clock configured at 500MHz or more + * + * So we set 200MHz as the minimum clock frequency available for that SoC. + */ +static unsigned int sdhci_iproc_bcm2711_get_min_clock(struct sdhci_host *host) +{ + return 200000; +} + static const struct sdhci_ops sdhci_iproc_ops = { .set_clock = sdhci_set_clock, .get_max_clock = sdhci_iproc_get_max_clock, @@ -271,6 +288,7 @@ static const struct sdhci_ops sdhci_iproc_bcm2711_ops = { .set_clock = sdhci_set_clock, .set_power = sdhci_set_power_and_bus_voltage, .get_max_clock = sdhci_iproc_get_max_clock, + .get_min_clock = sdhci_iproc_bcm2711_get_min_clock, .set_bus_width = sdhci_set_bus_width, .reset = sdhci_reset, .set_uhs_signaling = sdhci_set_uhs_signaling,