From patchwork Mon Mar 22 18:58:14 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: 407229 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=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 8EFFCC433E4 for ; Mon, 22 Mar 2021 18:59:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7281361994 for ; Mon, 22 Mar 2021 18:59:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232302AbhCVS7d (ORCPT ); Mon, 22 Mar 2021 14:59:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:40100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231802AbhCVS7X (ORCPT ); Mon, 22 Mar 2021 14:59:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EF46E6199F; Mon, 22 Mar 2021 18:59:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616439562; bh=y1ZkXj1p9qb2LpsafIaIzi+n5YFdfgSKB2+GzEoekEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rGZp0km82YYtIIZJ1y3Eqz/ipHYqARAf4K34McixWHy3ntDWvuqi29tI6ScpjeRL5 emytAe/owDssH0WhKUJa4RNP9uxv0P1KQl96j+GpZTbudc6i8hP4fMuzR0oAaAPY+K BpnsNRcKu+g5QC6YrzFSZNQY4ffg5EMRdsxVTvkbxT80XAM/89yOb0Qpwt7LDO/Swo d3EuzOmDOSmcThb78/R1mi29tTAXxf77izAoVF4BlNvgxFCY7/BAFHbwYZNdxL2ECz FZgs0wollp1HKmNUi71ETvdJ6yZRJg3cymEwo9tidjvlEJmQiI0uDxYMxDFdzzZH96 tHBbtwFWGh30A== 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, Saenz Julienne , Ulf Hansson , Ray Jui , Scott Branden Cc: f.fainelli@gmail.com, phil@raspberrypi.com, tim.gover@raspberrypi.com, adrian.hunter@intel.com, alcooperx@gmail.com, nsaenzjulienne@suse.de, linux-kernel@vger.kernel.org, Rob Herring Subject: [PATCH 1/4] dt-bindings: mmc: iproc-sdhci: Convert to json-schema Date: Mon, 22 Mar 2021 19:58:14 +0100 Message-Id: <20210322185816.27582-2-nsaenz@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210322185816.27582-1-nsaenz@kernel.org> References: <20210322185816.27582-1-nsaenz@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Convert the brcm,iproc-sdhci binding to DT schema format using json-schema Signed-off-by: Nicolas Saenz Julienne --- .../bindings/mmc/brcm,iproc-sdhci.yaml | 58 +++++++++++++++++++ .../bindings/mmc/brcm,sdhci-iproc.txt | 37 ------------ 2 files changed, 58 insertions(+), 37 deletions(-) create mode 100644 Documentation/devicetree/bindings/mmc/brcm,iproc-sdhci.yaml delete mode 100644 Documentation/devicetree/bindings/mmc/brcm,sdhci-iproc.txt diff --git a/Documentation/devicetree/bindings/mmc/brcm,iproc-sdhci.yaml b/Documentation/devicetree/bindings/mmc/brcm,iproc-sdhci.yaml new file mode 100644 index 000000000000..19d84f3ef9e6 --- /dev/null +++ b/Documentation/devicetree/bindings/mmc/brcm,iproc-sdhci.yaml @@ -0,0 +1,58 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mmc/brcm,iproc-sdhci.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Broadcom IPROC SDHCI controller + +maintainers: + - Nicolas Saenz Julienne + +allOf: + - $ref: mmc-controller.yaml# + +properties: + compatible: + enum: + - brcm,bcm2835-sdhci + - brcm,bcm2711-emmc2 + - brcm,sdhci-iproc-cygnus + - brcm,sdhci-iproc + + reg: + minItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + description: + Handle to core clock for the sdhci controller. + + sdhci,auto-cmd12: + type: boolean + description: Specifies that controller should use auto CMD12 + +required: + - compatible + - reg + - interrupts + - clocks + +unevaluatedProperties: false + +examples: + - | + sdhci0: sdhci@18041000 { + compatible = "brcm,sdhci-iproc-cygnus"; + reg = <0x18041000 0x100>; + interrupts = ; + clocks = <&lcpll0_clks BCM_CYGNUS_LCPLL0_SDIO_CLK>; + bus-width = <4>; + sdhci,auto-cmd12; + no-1-8-v; + }; + +... diff --git a/Documentation/devicetree/bindings/mmc/brcm,sdhci-iproc.txt b/Documentation/devicetree/bindings/mmc/brcm,sdhci-iproc.txt deleted file mode 100644 index 09d87cc1182a..000000000000 --- a/Documentation/devicetree/bindings/mmc/brcm,sdhci-iproc.txt +++ /dev/null @@ -1,37 +0,0 @@ -Broadcom IPROC SDHCI controller - -This file documents differences between the core properties described -by mmc.txt and the properties that represent the IPROC SDHCI controller. - -Required properties: -- compatible : Should be one of the following - "brcm,bcm2835-sdhci" - "brcm,bcm2711-emmc2" - "brcm,sdhci-iproc-cygnus" - "brcm,sdhci-iproc" - -Use brcm2835-sdhci for the eMMC controller on the BCM2835 (Raspberry Pi) and -bcm2711-emmc2 for the additional eMMC2 controller on BCM2711. - -Use sdhci-iproc-cygnus for Broadcom SDHCI Controllers -restricted to 32bit host accesses to SDHCI registers. - -Use sdhci-iproc for Broadcom SDHCI Controllers that allow standard -8, 16, 32-bit host access to SDHCI register. - -- clocks : The clock feeding the SDHCI controller. - -Optional properties: - - sdhci,auto-cmd12: specifies that controller should use auto CMD12. - -Example: - -sdhci0: sdhci@18041000 { - compatible = "brcm,sdhci-iproc-cygnus"; - reg = <0x18041000 0x100>; - interrupts = ; - clocks = <&lcpll0_clks BCM_CYGNUS_LCPLL0_SDIO_CLK>; - bus-width = <4>; - sdhci,auto-cmd12; - no-1-8-v; -}; From patchwork Mon Mar 22 18:58: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: 406364 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=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 CF775C433DB for ; Mon, 22 Mar 2021 19:00:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A96BA619A9 for ; Mon, 22 Mar 2021 19:00:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231819AbhCVS77 (ORCPT ); Mon, 22 Mar 2021 14:59:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:40128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230091AbhCVS71 (ORCPT ); Mon, 22 Mar 2021 14:59:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6FCCB61994; Mon, 22 Mar 2021 18:59:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616439566; bh=WlVTEDge8a2sWi1YSIL9GHQT08rBMoQZeeSuGahDmm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RaAg53L+LqoHwm+LT0HjGQ5rYxsxUuMG1d3ilweQGgHiRWwxLmzJ36II9eMGyzm96 V388kwNmgSef90LURzrBpjCBWx2tPd8yXqEjsgqAdPg8UEGOFeu9QA8XaCkHYwWdz/ htR5BgjklZO2zE4Kxrj52RJuejuYDYGwGV2I2ftvTVLPZIuSKbkBYmXOtRiquGmsng YcCHCGE2oohWT80QPiRpMrbz6JNqKZiWLTuqjUdhjkkkUhpD6lkdaMIErbPkx2yxjY CWxtKooosprYVrOLH4gYb5kKA5A7TkbGWuELuRCJeVoyt2uxL62CoJPnninquorhig up+/dd/Tm63TA== 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, Saenz Julienne , Ulf Hansson , Ray Jui , Scott Branden Cc: f.fainelli@gmail.com, phil@raspberrypi.com, tim.gover@raspberrypi.com, adrian.hunter@intel.com, alcooperx@gmail.com, nsaenzjulienne@suse.de, linux-kernel@vger.kernel.org, Rob Herring Subject: [PATCH 2/4] dt-bindings: mmc: iproc-sdhci: Add clock-frequency support Date: Mon, 22 Mar 2021 19:58:15 +0100 Message-Id: <20210322185816.27582-3-nsaenz@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210322185816.27582-1-nsaenz@kernel.org> References: <20210322185816.27582-1-nsaenz@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Users might want to choose a different clock frequency than whatever the bootloader provided at probe time. Add 'clock-frequency' bindings. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/mmc/brcm,iproc-sdhci.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/brcm,iproc-sdhci.yaml b/Documentation/devicetree/bindings/mmc/brcm,iproc-sdhci.yaml index 19d84f3ef9e6..9d0d97b2c0a7 100644 --- a/Documentation/devicetree/bindings/mmc/brcm,iproc-sdhci.yaml +++ b/Documentation/devicetree/bindings/mmc/brcm,iproc-sdhci.yaml @@ -35,6 +35,12 @@ properties: type: boolean description: Specifies that controller should use auto CMD12 + clock-frequency: + description: + Should be the frequency (in Hz) of the core clock. If this is specified + and the core clock is specified then we'll try to set the core clock to + this at probe time. + required: - compatible - reg From patchwork Mon Mar 22 18:58: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: 407228 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=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 2903EC433E1 for ; Mon, 22 Mar 2021 19:00:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DBFCA619A0 for ; Mon, 22 Mar 2021 19:00:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231643AbhCVS76 (ORCPT ); Mon, 22 Mar 2021 14:59:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:40248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232164AbhCVS73 (ORCPT ); Mon, 22 Mar 2021 14:59:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B935D619A8; Mon, 22 Mar 2021 18:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616439569; bh=3WJZ+xKT9j6gw9UE+xMc27OkZKOFyhJ+cIpSqbqXuBs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EKELXgM3XqhR4YSRZUHp5ZU6eoD1pjbdwmVJcdeBhnjS6ry1K/Zby/24yCwTti9tC 49eVr4lL9glgiM0uCESrbFBnqB3BDEE5nlOIl2RXQjFgebnynbMb/dOQZOv65rYyFf B1C6TuoB6PfEsXbCR+wvFspZy7Vt7m8sTxlvADHvo8g4t1uZRdEmCUq4n7lkzklP4/ 17o5pgqN5D4ce2YUnXcVrUE7fu8iqUESqsfX6Xwn7k5WzM3xUMz9c515t5Zs3J+IX6 iJ4IxHf67yTSbrML4p5LpYTZMwfXX5+Oj29sAys1IKKYMLUy5cnQhUMzyyUEkcKknc zNI95nDugy+xg== 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, Saenz Julienne , 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, ulf.hansson@linaro.org Subject: [PATCH 3/4] mmc: sdhci-iproc: Set clock frequency as per DT Date: Mon, 22 Mar 2021 19:58:16 +0100 Message-Id: <20210322185816.27582-4-nsaenz@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210322185816.27582-1-nsaenz@kernel.org> References: <20210322185816.27582-1-nsaenz@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Nicolas Saenz Julienne 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"); From patchwork Mon Mar 22 18:58:17 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: 406363 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=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 5BB3FC433E5 for ; Mon, 22 Mar 2021 19:00:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1062E61994 for ; Mon, 22 Mar 2021 19:00:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232245AbhCVS77 (ORCPT ); Mon, 22 Mar 2021 14:59:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:40266 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232292AbhCVS7g (ORCPT ); Mon, 22 Mar 2021 14:59:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E84396199F; Mon, 22 Mar 2021 18:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616439572; bh=s6ymiQxwePb20Kp2RAPsG0nP87bGAxMicsdfeJT0mC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ihW3OvOyJmZH+nfKxl3tTK7pmHcaotogYNZlucLYTpV+bfEmX8LFahc17He9AAf/m JYU76wRHhuZgoXBcm81UnVqOTWBZ7QZThqPjO/4o4m2uv3HZ6WNpmnNdzByFxdAbOa pCwMes1lQIQe1TQCu8sZKhVP9oXMINdp0rSi2DAkN+ZCzhG9xl1FueQeS7894UsLjE WRKkaByrfxKF3JudCMmXsq/0BfMly+vdsq6CPGsIJg2k7fJ8HB1lR1B5s5AgCPSPIY EPehDR2OZqWhTDuYF86UL5dX8fuH5bVa4VQo97ErS7g8gf1X86AP/Ax1gzrlWGgzvc unuKPEE9P1JFQ== 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, Saenz Julienne , 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, ulf.hansson@linaro.org Subject: [PATCH 4/4] ARM: dts: Fix-up EMMC2 controller's frequency Date: Mon, 22 Mar 2021 19:58:17 +0100 Message-Id: <20210322185816.27582-5-nsaenz@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210322185816.27582-1-nsaenz@kernel.org> References: <20210322185816.27582-1-nsaenz@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Nicolas Saenz Julienne 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 (a pretty common case). This ends up 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"; };