Message ID | 20221207131731.1291517-4-william.qiu@starfivetech.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp178761wrr; Wed, 7 Dec 2022 05:22:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ACPKO5qZKYnK8Hh+UI+2K3VbCEzOQvKT+uEeW2n/O1+BVEn7BVrhefWOfWbkn5z/n/JWl X-Received: by 2002:a17:903:1014:b0:189:adf6:771d with SMTP id a20-20020a170903101400b00189adf6771dmr33736587plb.102.1670419368153; Wed, 07 Dec 2022 05:22:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670419368; cv=none; d=google.com; s=arc-20160816; b=qfk+sCEs+vSPHQy/5udxFaJZUjPJ8qd/0SVv/SsDlIt/FXQnsV+RmIgpIZCRPDx2Vv lFpuqa+EDbXUPZHzfOVfKt80vwWQCJddCDlU2N1hibYsaRswny3PoFUB2KJg5DsP+/Xk yd9D5KE8HSI9x1LHO49pW58EZRsRZxPF5nG7R+gp+TfUUFi+lbGOchSUiSKOIh95aMWI bg/waHerjrHcPbKunkw65Nv93OiVxo3BiagG+PxToHA9yUqUCFke3ADwaQB1EpPYQMML lUaMi5q8uHfrgHlJ7i6zCI+qRy35QNsm/nmLR503rsJrVMDMvogGuKhOHfAqgKbaZiMi nvaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=MdQ2wUxsDT2CzKerJ4t3DNkqTlUEp/puzvkUJYwMX5I=; b=pNLTRzjBwy2tz6YrTbM39fO4zwky07dlVuZWedokg0jVhqFpruFX+DGQ+vGUGsREME hiH7ltdfocMkREUqdksTksYiOrJP4Ox6XXUBmkbWG2nv0TkXuWPZnIK4cp1KrC8i6BwI OipauK0q+okacgdO9nVlmd3w4J4JwRKju1bgd6a6nWGfBUmvYMUmf9SRhNZ8f00zvP0L VDc3FTAx7QTdlLfcHSvl1K6UuZHSXPgnd9vWmNmj4605Qc8ZuV8cfO1zBLcHZdsvz6pG PW0fc+fHO7C9f5LxL7PBcii9WdJvSabIZE95U2HfMHlxlgR0zPHLM5XznCZPQ3syWCzo WV4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u8-20020a170902b28800b00186db024863si19147789plr.612.2022.12.07.05.22.33; Wed, 07 Dec 2022 05:22:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229586AbiLGNRm convert rfc822-to-8bit (ORCPT <rfc822;b08248@gmail.com> + 99 others); Wed, 7 Dec 2022 08:17:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229828AbiLGNRh (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 7 Dec 2022 08:17:37 -0500 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EED591172; Wed, 7 Dec 2022 05:17:35 -0800 (PST) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id D0E4624E2AF; Wed, 7 Dec 2022 21:17:34 +0800 (CST) Received: from EXMBX068.cuchost.com (172.16.6.68) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 7 Dec 2022 21:17:35 +0800 Received: from williamqiu-virtual-machine.starfivetech.com (171.223.208.138) by EXMBX068.cuchost.com (172.16.6.68) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 7 Dec 2022 21:17:34 +0800 From: William Qiu <william.qiu@starfivetech.com> To: <linux-riscv@lists.infradead.org>, <devicetree@vger.kernel.org>, <linux-mmc@vger.kernel.org> CC: Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Jaehoon Chung <jh80.chung@samsung.com>, Ulf Hansson <ulf.hansson@linaro.org>, William Qiu <william.qiu@starfivetech.com>, <linux-kernel@vger.kernel.org> Subject: [PATCH v1 3/3] riscv: dts: starfive: Add mmc node Date: Wed, 7 Dec 2022 21:17:31 +0800 Message-ID: <20221207131731.1291517-4-william.qiu@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221207131731.1291517-1-william.qiu@starfivetech.com> References: <20221207131731.1291517-1-william.qiu@starfivetech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX068.cuchost.com (172.16.6.68) X-YovoleRuleAgent: yovoleflag Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751561659579422052?= X-GMAIL-MSGID: =?utf-8?q?1751561659579422052?= |
Series |
StarFive's SDIO/eMMC driver support
|
|
Commit Message
William Qiu
Dec. 7, 2022, 1:17 p.m. UTC
This adds the mmc node for the StarFive JH7110 SoC.
Set sdioo node to emmc and set sdio1 node to sd.
Signed-off-by: William Qiu <william.qiu@starfivetech.com>
---
.../jh7110-starfive-visionfive-v2.dts | 25 ++++++++++++
arch/riscv/boot/dts/starfive/jh7110.dtsi | 38 +++++++++++++++++++
2 files changed, 63 insertions(+)
Comments
On 07/12/2022 14:17, William Qiu wrote: > This adds the mmc node for the StarFive JH7110 SoC. > Set sdioo node to emmc and set sdio1 node to sd. > > Signed-off-by: William Qiu <william.qiu@starfivetech.com> > --- > .../jh7110-starfive-visionfive-v2.dts | 25 ++++++++++++ > arch/riscv/boot/dts/starfive/jh7110.dtsi | 38 +++++++++++++++++++ > 2 files changed, 63 insertions(+) > > diff --git a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts > index c8946cf3a268..6ef8e303c2e6 100644 > --- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts > +++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts > @@ -47,6 +47,31 @@ &clk_rtc { > clock-frequency = <32768>; > }; > > +&sdio0 { > + max-frequency = <100000000>; > + card-detect-delay = <300>; > + bus-width = <8>; > + cap-mmc-highspeed; > + mmc-ddr-1_8v; > + mmc-hs200-1_8v; > + non-removable; > + cap-mmc-hw-reset; > + post-power-on-delay-ms = <200>; > + status = "okay"; > +}; > + > +&sdio1 { > + max-frequency = <100000000>; > + card-detect-delay = <300>; > + bus-width = <4>; > + no-sdio; > + no-mmc; > + broken-cd; > + cap-sd-highspeed; > + post-power-on-delay-ms = <200>; > + status = "okay"; > +}; > + > &gmac0_rmii_refin { > clock-frequency = <50000000>; > }; > diff --git a/arch/riscv/boot/dts/starfive/jh7110.dtsi b/arch/riscv/boot/dts/starfive/jh7110.dtsi > index c22e8f1d2640..e90b085d7e41 100644 > --- a/arch/riscv/boot/dts/starfive/jh7110.dtsi > +++ b/arch/riscv/boot/dts/starfive/jh7110.dtsi > @@ -331,6 +331,11 @@ aoncrg: clock-controller@17000000 { > #reset-cells = <1>; > }; > > + sys_syscon: sys_syscon@13030000 { No underscores in node names, generic node names (syscon or system-controller) > + compatible = "syscon"; This is not allowed alone. > + reg = <0x0 0x13030000 0x0 0x1000>; > + }; > + > gpio: gpio@13040000 { > compatible = "starfive,jh7110-sys-pinctrl"; > reg = <0x0 0x13040000 0x0 0x10000>; > @@ -433,5 +438,38 @@ uart5: serial@12020000 { > reg-shift = <2>; > status = "disabled"; > }; > + > + /* unremovable emmc as mmcblk0 */ > + sdio0: mmc@16010000 { > + compatible = "starfive,jh7110-sdio"; > + reg = <0x0 0x16010000 0x0 0x10000>; > + clocks = <&syscrg JH7110_SYSCLK_SDIO0_AHB>, > + <&syscrg JH7110_SYSCLK_SDIO0_SDCARD>; > + clock-names = "biu","ciu"; > + resets = <&syscrg JH7110_SYSRST_SDIO0_AHB>; > + reset-names = "reset"; > + interrupts = <74>; > + fifo-depth = <32>; > + fifo-watermark-aligned; > + data-addr = <0>; > + starfive,sys-syscon = <&sys_syscon 0x14 0x1a 0x7c000000>; This does not match your bindings at all. "&sys_syscon" is a phandle, not a number of tuning retries, as you expect in your bindings. Best regards, Krzysztof
On Wed, Dec 07, 2022 at 04:14:53PM +0100, Krzysztof Kozlowski wrote: > On 07/12/2022 14:17, William Qiu wrote: > > This adds the mmc node for the StarFive JH7110 SoC. > > Set sdioo node to emmc and set sdio1 node to sd. > > > > Signed-off-by: William Qiu <william.qiu@starfivetech.com> > > --- > > .../jh7110-starfive-visionfive-v2.dts | 25 ++++++++++++ > > arch/riscv/boot/dts/starfive/jh7110.dtsi | 38 +++++++++++++++++++ > > 2 files changed, 63 insertions(+) > > > > diff --git a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts > > index c8946cf3a268..6ef8e303c2e6 100644 > > --- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts > > +++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts > > @@ -47,6 +47,31 @@ &clk_rtc { > > clock-frequency = <32768>; > > }; > > > > +&sdio0 { > > + max-frequency = <100000000>; > > + card-detect-delay = <300>; > > + bus-width = <8>; > > + cap-mmc-highspeed; > > + mmc-ddr-1_8v; > > + mmc-hs200-1_8v; > > + non-removable; > > + cap-mmc-hw-reset; > > + post-power-on-delay-ms = <200>; > > + status = "okay"; > > +}; > > + > > +&sdio1 { > > + max-frequency = <100000000>; > > + card-detect-delay = <300>; > > + bus-width = <4>; > > + no-sdio; > > + no-mmc; > > + broken-cd; > > + cap-sd-highspeed; > > + post-power-on-delay-ms = <200>; > > + status = "okay"; > > +}; > > + > > &gmac0_rmii_refin { > > clock-frequency = <50000000>; > > }; > > diff --git a/arch/riscv/boot/dts/starfive/jh7110.dtsi b/arch/riscv/boot/dts/starfive/jh7110.dtsi > > index c22e8f1d2640..e90b085d7e41 100644 > > --- a/arch/riscv/boot/dts/starfive/jh7110.dtsi > > +++ b/arch/riscv/boot/dts/starfive/jh7110.dtsi > > @@ -331,6 +331,11 @@ aoncrg: clock-controller@17000000 { > > #reset-cells = <1>; > > }; > > > > + sys_syscon: sys_syscon@13030000 { > > No underscores in node names, generic node names (syscon or > system-controller) > > > + compatible = "syscon"; > > This is not allowed alone. > > > + reg = <0x0 0x13030000 0x0 0x1000>; > > + }; > > + > > gpio: gpio@13040000 { > > compatible = "starfive,jh7110-sys-pinctrl"; > > reg = <0x0 0x13040000 0x0 0x10000>; > > @@ -433,5 +438,38 @@ uart5: serial@12020000 { > > reg-shift = <2>; > > status = "disabled"; > > }; > > + > > + /* unremovable emmc as mmcblk0 */ > > + sdio0: mmc@16010000 { > > + compatible = "starfive,jh7110-sdio"; > > + reg = <0x0 0x16010000 0x0 0x10000>; > > + clocks = <&syscrg JH7110_SYSCLK_SDIO0_AHB>, > > + <&syscrg JH7110_SYSCLK_SDIO0_SDCARD>; > > + clock-names = "biu","ciu"; > > + resets = <&syscrg JH7110_SYSRST_SDIO0_AHB>; > > + reset-names = "reset"; > > + interrupts = <74>; > > + fifo-depth = <32>; > > + fifo-watermark-aligned; > > + data-addr = <0>; > > + starfive,sys-syscon = <&sys_syscon 0x14 0x1a 0x7c000000>; > > This does not match your bindings at all. "&sys_syscon" is a phandle, > not a number of tuning retries, as you expect in your bindings. Additionally, a Link: to the documentation for where-ever these "random" numbers that are being used would be nice. +static int dw_mci_starfive_parse_dt(struct dw_mci *host) +{ + struct of_phandle_args args; + struct starfive_priv *priv; + int ret; + + priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + ret = of_parse_phandle_with_fixed_args(host->dev->of_node, + "starfive,sys-syscon", 3, 0, &args); + if (ret) { + dev_err(host->dev, "Failed to parse starfive,sys-syscon\n"); + return -EINVAL; + } + + priv->reg_syscon = syscon_node_to_regmap(args.np); + of_node_put(args.np); + if (IS_ERR(priv->reg_syscon)) + return PTR_ERR(priv->reg_syscon); + + priv->syscon_offset = args.args[0]; + priv->syscon_shift = args.args[1]; + priv->syscon_mask = args.args[2]; Given the driver, the property description just seems incorrect and this is actually the bit of the syscon that is relevant to the tuning process (perhaps where the find the tuning values?). Without public docs or a better description it is hard for (me at least) to know :) + + host->priv = priv; + + return 0; +}
On 2022/12/7 23:14, Krzysztof Kozlowski wrote: > On 07/12/2022 14:17, William Qiu wrote: >> This adds the mmc node for the StarFive JH7110 SoC. >> Set sdioo node to emmc and set sdio1 node to sd. >> >> Signed-off-by: William Qiu <william.qiu@starfivetech.com> >> --- >> .../jh7110-starfive-visionfive-v2.dts | 25 ++++++++++++ >> arch/riscv/boot/dts/starfive/jh7110.dtsi | 38 +++++++++++++++++++ >> 2 files changed, 63 insertions(+) >> >> diff --git a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts >> index c8946cf3a268..6ef8e303c2e6 100644 >> --- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts >> +++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts >> @@ -47,6 +47,31 @@ &clk_rtc { >> clock-frequency = <32768>; >> }; >> >> +&sdio0 { >> + max-frequency = <100000000>; >> + card-detect-delay = <300>; >> + bus-width = <8>; >> + cap-mmc-highspeed; >> + mmc-ddr-1_8v; >> + mmc-hs200-1_8v; >> + non-removable; >> + cap-mmc-hw-reset; >> + post-power-on-delay-ms = <200>; >> + status = "okay"; >> +}; >> + >> +&sdio1 { >> + max-frequency = <100000000>; >> + card-detect-delay = <300>; >> + bus-width = <4>; >> + no-sdio; >> + no-mmc; >> + broken-cd; >> + cap-sd-highspeed; >> + post-power-on-delay-ms = <200>; >> + status = "okay"; >> +}; >> + >> &gmac0_rmii_refin { >> clock-frequency = <50000000>; >> }; >> diff --git a/arch/riscv/boot/dts/starfive/jh7110.dtsi b/arch/riscv/boot/dts/starfive/jh7110.dtsi >> index c22e8f1d2640..e90b085d7e41 100644 >> --- a/arch/riscv/boot/dts/starfive/jh7110.dtsi >> +++ b/arch/riscv/boot/dts/starfive/jh7110.dtsi >> @@ -331,6 +331,11 @@ aoncrg: clock-controller@17000000 { >> #reset-cells = <1>; >> }; >> >> + sys_syscon: sys_syscon@13030000 { > > No underscores in node names, generic node names (syscon or > system-controller) Will fix. > >> + compatible = "syscon"; > > This is not allowed alone. Will fix. > >> + reg = <0x0 0x13030000 0x0 0x1000>; >> + }; >> + >> gpio: gpio@13040000 { >> compatible = "starfive,jh7110-sys-pinctrl"; >> reg = <0x0 0x13040000 0x0 0x10000>; >> @@ -433,5 +438,38 @@ uart5: serial@12020000 { >> reg-shift = <2>; >> status = "disabled"; >> }; >> + >> + /* unremovable emmc as mmcblk0 */ >> + sdio0: mmc@16010000 { >> + compatible = "starfive,jh7110-sdio"; >> + reg = <0x0 0x16010000 0x0 0x10000>; >> + clocks = <&syscrg JH7110_SYSCLK_SDIO0_AHB>, >> + <&syscrg JH7110_SYSCLK_SDIO0_SDCARD>; >> + clock-names = "biu","ciu"; >> + resets = <&syscrg JH7110_SYSRST_SDIO0_AHB>; >> + reset-names = "reset"; >> + interrupts = <74>; >> + fifo-depth = <32>; >> + fifo-watermark-aligned; >> + data-addr = <0>; >> + starfive,sys-syscon = <&sys_syscon 0x14 0x1a 0x7c000000>; > > This does not match your bindings at all. "&sys_syscon" is a phandle, > not a number of tuning retries, as you expect in your bindings. > Hi Krzysztof, The sys_syscon is one of system controller registers, and it is used to be the data strobe delay chain select. I will update its type and description in next version. Thanks, William Qiu > > Best regards, > Krzysztof >
On 2022/12/8 0:31, Conor Dooley wrote: > On Wed, Dec 07, 2022 at 04:14:53PM +0100, Krzysztof Kozlowski wrote: >> On 07/12/2022 14:17, William Qiu wrote: >> > This adds the mmc node for the StarFive JH7110 SoC. >> > Set sdioo node to emmc and set sdio1 node to sd. >> > >> > Signed-off-by: William Qiu <william.qiu@starfivetech.com> >> > --- >> > .../jh7110-starfive-visionfive-v2.dts | 25 ++++++++++++ >> > arch/riscv/boot/dts/starfive/jh7110.dtsi | 38 +++++++++++++++++++ >> > 2 files changed, 63 insertions(+) >> > >> > diff --git a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts >> > index c8946cf3a268..6ef8e303c2e6 100644 >> > --- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts >> > +++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts >> > @@ -47,6 +47,31 @@ &clk_rtc { >> > clock-frequency = <32768>; >> > }; >> > >> > +&sdio0 { >> > + max-frequency = <100000000>; >> > + card-detect-delay = <300>; >> > + bus-width = <8>; >> > + cap-mmc-highspeed; >> > + mmc-ddr-1_8v; >> > + mmc-hs200-1_8v; >> > + non-removable; >> > + cap-mmc-hw-reset; >> > + post-power-on-delay-ms = <200>; >> > + status = "okay"; >> > +}; >> > + >> > +&sdio1 { >> > + max-frequency = <100000000>; >> > + card-detect-delay = <300>; >> > + bus-width = <4>; >> > + no-sdio; >> > + no-mmc; >> > + broken-cd; >> > + cap-sd-highspeed; >> > + post-power-on-delay-ms = <200>; >> > + status = "okay"; >> > +}; >> > + >> > &gmac0_rmii_refin { >> > clock-frequency = <50000000>; >> > }; >> > diff --git a/arch/riscv/boot/dts/starfive/jh7110.dtsi b/arch/riscv/boot/dts/starfive/jh7110.dtsi >> > index c22e8f1d2640..e90b085d7e41 100644 >> > --- a/arch/riscv/boot/dts/starfive/jh7110.dtsi >> > +++ b/arch/riscv/boot/dts/starfive/jh7110.dtsi >> > @@ -331,6 +331,11 @@ aoncrg: clock-controller@17000000 { >> > #reset-cells = <1>; >> > }; >> > >> > + sys_syscon: sys_syscon@13030000 { >> >> No underscores in node names, generic node names (syscon or >> system-controller) >> >> > + compatible = "syscon"; >> >> This is not allowed alone. >> >> > + reg = <0x0 0x13030000 0x0 0x1000>; >> > + }; >> > + >> > gpio: gpio@13040000 { >> > compatible = "starfive,jh7110-sys-pinctrl"; >> > reg = <0x0 0x13040000 0x0 0x10000>; >> > @@ -433,5 +438,38 @@ uart5: serial@12020000 { >> > reg-shift = <2>; >> > status = "disabled"; >> > }; >> > + >> > + /* unremovable emmc as mmcblk0 */ >> > + sdio0: mmc@16010000 { >> > + compatible = "starfive,jh7110-sdio"; >> > + reg = <0x0 0x16010000 0x0 0x10000>; >> > + clocks = <&syscrg JH7110_SYSCLK_SDIO0_AHB>, >> > + <&syscrg JH7110_SYSCLK_SDIO0_SDCARD>; >> > + clock-names = "biu","ciu"; >> > + resets = <&syscrg JH7110_SYSRST_SDIO0_AHB>; >> > + reset-names = "reset"; >> > + interrupts = <74>; >> > + fifo-depth = <32>; >> > + fifo-watermark-aligned; >> > + data-addr = <0>; >> > + starfive,sys-syscon = <&sys_syscon 0x14 0x1a 0x7c000000>; >> >> This does not match your bindings at all. "&sys_syscon" is a phandle, >> not a number of tuning retries, as you expect in your bindings. > > Additionally, a Link: to the documentation for where-ever these "random" > numbers that are being used would be nice. > I will update in next version. > +static int dw_mci_starfive_parse_dt(struct dw_mci *host) > +{ > + struct of_phandle_args args; > + struct starfive_priv *priv; > + int ret; > + > + priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL); > + if (!priv) > + return -ENOMEM; > + > + ret = of_parse_phandle_with_fixed_args(host->dev->of_node, > + "starfive,sys-syscon", 3, 0, &args); > + if (ret) { > + dev_err(host->dev, "Failed to parse starfive,sys-syscon\n"); > + return -EINVAL; > + } > + > + priv->reg_syscon = syscon_node_to_regmap(args.np); > + of_node_put(args.np); > + if (IS_ERR(priv->reg_syscon)) > + return PTR_ERR(priv->reg_syscon); > + > + priv->syscon_offset = args.args[0]; > + priv->syscon_shift = args.args[1]; > + priv->syscon_mask = args.args[2]; > > Given the driver, the property description just seems incorrect and this > is actually the bit of the syscon that is relevant to the tuning process > (perhaps where the find the tuning values?). Without public docs or a > better description it is hard for (me at least) to know :) > Hi Conor, Thank you for taking time to review and provide helpful comments for this patch. I'll make the description better and more detailed in next version. Best regards, William Qiu > + > + host->priv = priv; > + > + return 0; > +}
Hi William, thanks for your patch! On Wed, Dec 7, 2022 at 2:17 PM William Qiu <william.qiu@starfivetech.com> wrote: > + starfive,sys-syscon = <&sys_syscon 0x14 0x1a 0x7c000000>; (...) > + starfive,sys-syscon = <&sys_syscon 0x9c 0x1 0x3e>; These are registster offsets and shifts. Don't define such stuff in your device tree, use #defines in the code and just provide the phandle. Yours, Linus Walleij
On 2022/12/9 5:15, Linus Walleij wrote: > Hi William, > > thanks for your patch! > > On Wed, Dec 7, 2022 at 2:17 PM William Qiu <william.qiu@starfivetech.com> wrote: > >> + starfive,sys-syscon = <&sys_syscon 0x14 0x1a 0x7c000000>; > (...) >> + starfive,sys-syscon = <&sys_syscon 0x9c 0x1 0x3e>; > > These are registster offsets and shifts. Don't define such stuff in your device > tree, use #defines in the code and just provide the phandle. > Hi Linus, I will use #define in code instead in device tree. Thank you for taking time to review and provide helpful comments for this patch. Best Regards, William Qiu > Yours, > Linus Walleij
On 2022/12/9 5:15, Linus Walleij wrote: > Hi William, > > thanks for your patch! > > On Wed, Dec 7, 2022 at 2:17 PM William Qiu <william.qiu@starfivetech.com> wrote: > >> + starfive,sys-syscon = <&sys_syscon 0x14 0x1a 0x7c000000>; > (...) >> + starfive,sys-syscon = <&sys_syscon 0x9c 0x1 0x3e>; > > These are registster offsets and shifts. Don't define such stuff in your device > tree, use #defines in the code and just provide the phandle. > Hi Linus, I'm sorry to bother you, but as for the definition of syscon, after discussing with my colleagues, we think it is easier to distinguish SDIO0 and SDIO1 by defining it in the device tree, and the code compatibility is better. I expected to discuss this issue with you in V2,, but I am not sure whether you have seen V2, so I can only ask for your advice in V1. Best Regards William Qiu > Yours, > Linus Walleij
diff --git a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts index c8946cf3a268..6ef8e303c2e6 100644 --- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts @@ -47,6 +47,31 @@ &clk_rtc { clock-frequency = <32768>; }; +&sdio0 { + max-frequency = <100000000>; + card-detect-delay = <300>; + bus-width = <8>; + cap-mmc-highspeed; + mmc-ddr-1_8v; + mmc-hs200-1_8v; + non-removable; + cap-mmc-hw-reset; + post-power-on-delay-ms = <200>; + status = "okay"; +}; + +&sdio1 { + max-frequency = <100000000>; + card-detect-delay = <300>; + bus-width = <4>; + no-sdio; + no-mmc; + broken-cd; + cap-sd-highspeed; + post-power-on-delay-ms = <200>; + status = "okay"; +}; + &gmac0_rmii_refin { clock-frequency = <50000000>; }; diff --git a/arch/riscv/boot/dts/starfive/jh7110.dtsi b/arch/riscv/boot/dts/starfive/jh7110.dtsi index c22e8f1d2640..e90b085d7e41 100644 --- a/arch/riscv/boot/dts/starfive/jh7110.dtsi +++ b/arch/riscv/boot/dts/starfive/jh7110.dtsi @@ -331,6 +331,11 @@ aoncrg: clock-controller@17000000 { #reset-cells = <1>; }; + sys_syscon: sys_syscon@13030000 { + compatible = "syscon"; + reg = <0x0 0x13030000 0x0 0x1000>; + }; + gpio: gpio@13040000 { compatible = "starfive,jh7110-sys-pinctrl"; reg = <0x0 0x13040000 0x0 0x10000>; @@ -433,5 +438,38 @@ uart5: serial@12020000 { reg-shift = <2>; status = "disabled"; }; + + /* unremovable emmc as mmcblk0 */ + sdio0: mmc@16010000 { + compatible = "starfive,jh7110-sdio"; + reg = <0x0 0x16010000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_SDIO0_AHB>, + <&syscrg JH7110_SYSCLK_SDIO0_SDCARD>; + clock-names = "biu","ciu"; + resets = <&syscrg JH7110_SYSRST_SDIO0_AHB>; + reset-names = "reset"; + interrupts = <74>; + fifo-depth = <32>; + fifo-watermark-aligned; + data-addr = <0>; + starfive,sys-syscon = <&sys_syscon 0x14 0x1a 0x7c000000>; + status = "disabled"; + }; + + sdio1: mmc@16020000 { + compatible = "starfive,jh7110-sdio"; + reg = <0x0 0x16020000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_SDIO1_AHB>, + <&syscrg JH7110_SYSCLK_SDIO1_SDCARD>; + clock-names = "biu","ciu"; + resets = <&syscrg JH7110_SYSRST_SDIO1_AHB>; + reset-names = "reset"; + interrupts = <75>; + fifo-depth = <32>; + fifo-watermark-aligned; + data-addr = <0>; + starfive,sys-syscon = <&sys_syscon 0x9c 0x1 0x3e>; + status = "disabled"; + }; }; };