From patchwork Thu Feb 25 09:52:15 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: 387482 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 70D4AC433DB for ; Thu, 25 Feb 2021 09:53:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 34A1564EDB for ; Thu, 25 Feb 2021 09:53:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235334AbhBYJxO (ORCPT ); Thu, 25 Feb 2021 04:53:14 -0500 Received: from mx2.suse.de ([195.135.220.15]:39842 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235307AbhBYJxI (ORCPT ); Thu, 25 Feb 2021 04:53:08 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 37D69AD57; Thu, 25 Feb 2021 09:52:26 +0000 (UTC) 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, Rob Herring , Nicolas Saenz Julienne Cc: f.fainelli@gmail.com, phil@raspberrypi.com, tim.gover@raspberrypi.com, adrian.hunter@intel.com, sbranden@broadcom.com, alcooperx@gmail.com, linux-kernel@vger.kernel.org Subject: [RFC 1/2] ARM: dts: Fix-up EMMC2 controller's frequency Date: Thu, 25 Feb 2021 10:52:15 +0100 Message-Id: <20210225095216.28591-2-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210225095216.28591-1-nsaenzjulienne@suse.de> References: <20210225095216.28591-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Force emmc2's frequency to 150MHz as the default 100MHz (set by FW) seems to interfere with the VPU clock when setup at frequencies bigger than 500MHz, causing unwarranted SDHCI CMD hangs when no SD card is present. Signed-off-by: Nicolas Saenz Julienne --- arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts index 3b4ab947492a..9aa8408d9960 100644 --- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts @@ -257,6 +257,12 @@ &emmc2 { vqmmc-supply = <&sd_io_1v8_reg>; vmmc-supply = <&sd_vcc_reg>; broken-cd; + /* + * Force the frequency to 150MHz as the default 100MHz seems to + * interfere with the VPU clock when setup at frequencies bigger than + * 500MHz, causing unwarranted CMD hangs. + */ + clock-frequency = <150000000>; status = "okay"; }; From patchwork Thu Feb 25 09:52:16 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: 387964 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 3E4FCC433E0 for ; Thu, 25 Feb 2021 09:53:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E33C364EF5 for ; Thu, 25 Feb 2021 09:53:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235345AbhBYJxW (ORCPT ); Thu, 25 Feb 2021 04:53:22 -0500 Received: from mx2.suse.de ([195.135.220.15]:39868 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235046AbhBYJxI (ORCPT ); Thu, 25 Feb 2021 04:53:08 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1E5D2AAAE; Thu, 25 Feb 2021 09:52:27 +0000 (UTC) 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, Adrian Hunter , Ray Jui , Scott Branden Cc: f.fainelli@gmail.com, phil@raspberrypi.com, tim.gover@raspberrypi.com, alcooperx@gmail.com, Nicolas Saenz Julienne , Ulf Hansson , linux-kernel@vger.kernel.org Subject: [RFC 2/2] mmc: sdhci-iproc: Set clock frequency as per DT Date: Thu, 25 Feb 2021 10:52:16 +0100 Message-Id: <20210225095216.28591-3-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210225095216.28591-1-nsaenzjulienne@suse.de> References: <20210225095216.28591-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org devicetree might request a clock frequency different from whatever is set-up by the bootloader. Make sure to setup the new rate. Signed-off-by: Nicolas Saenz Julienne --- drivers/mmc/host/sdhci-iproc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c index ddeaf8e1f72f..536c382e2486 100644 --- a/drivers/mmc/host/sdhci-iproc.c +++ b/drivers/mmc/host/sdhci-iproc.c @@ -358,6 +358,16 @@ static int sdhci_iproc_probe(struct platform_device *pdev) ret = PTR_ERR(pltfm_host->clk); goto err; } + + if (pltfm_host->clock) { + ret = clk_set_rate(pltfm_host->clk, pltfm_host->clock); + if (ret) { + dev_err(dev, "failed to set host clk at %u Hz\n", + pltfm_host->clock); + goto err; + } + } + ret = clk_prepare_enable(pltfm_host->clk); if (ret) { dev_err(dev, "failed to enable host clk\n");