From: Adrian Hunter <adrian.hunter@intel.com>
To: Chen Wang <unicornxw@gmail.com>,
aou@eecs.berkeley.edu, conor+dt@kernel.org, guoren@kernel.org,
inochiama@outlook.com, jszhang@kernel.org,
krzysztof.kozlowski+dt@linaro.org, palmer@dabbelt.com,
paul.walmsley@sifive.com, robh@kernel.org,
ulf.hansson@linaro.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org,
linux-riscv@lists.infradead.org, chao.wei@sophgo.com,
haijiao.liu@sophgo.com, xiaoguang.xing@sophgo.com,
tingzhu.wang@sophgo.com
Cc: Chen Wang <unicorn_wang@outlook.com>, Drew Fustini <drew@pdp7.com>
Subject: Re: [PATCH v6 4/8] mmc: sdhci-of-dwcmshc: factor out code into dwcmshc_rk35xx_init
Date: Thu, 8 Aug 2024 10:19:10 +0300 [thread overview]
Message-ID: <b87fb5fe-63e1-4f4e-bc7c-92a91becf61e@intel.com> (raw)
In-Reply-To: <4f1f2fa403ce7f0b4d79afb7d7e8a1690cde5d6c.1722847198.git.unicorn_wang@outlook.com>
On 5/08/24 12:18, Chen Wang wrote:
> From: Chen Wang <unicorn_wang@outlook.com>
>
> Continue factor out code fron probe into dwcmshc_rk35xx_init.
>
> Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
> Tested-by: Drew Fustini <drew@pdp7.com> # TH1520
> Tested-by: Inochi Amaoto <inochiama@outlook.com> # Duo and Huashan Pi
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/mmc/host/sdhci-of-dwcmshc.c | 34 ++++++++++++++---------------
> 1 file changed, 16 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
> index b272ec2ab232..55fba5ef37ba 100644
> --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
> +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
> @@ -711,12 +711,22 @@ static void rk35xx_sdhci_reset(struct sdhci_host *host, u8 mask)
> sdhci_reset(host, mask);
> }
>
> -static int dwcmshc_rk35xx_init(struct sdhci_host *host, struct dwcmshc_priv *dwc_priv)
> +static int dwcmshc_rk35xx_init(struct device *dev, struct sdhci_host *host,
> + struct dwcmshc_priv *dwc_priv)
> {
> static const char * const clk_ids[] = {"axi", "block", "timer"};
> - struct rk35xx_priv *priv = dwc_priv->priv;
> + struct rk35xx_priv *priv;
> int err;
>
> + priv = devm_kzalloc(dev, sizeof(struct rk35xx_priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + if (of_device_is_compatible(dev->of_node, "rockchip,rk3588-dwcmshc"))
> + priv->devtype = DWCMSHC_RK3588;
> + else
> + priv->devtype = DWCMSHC_RK3568;
> +
> priv->reset = devm_reset_control_array_get_optional_exclusive(mmc_dev(host->mmc));
> if (IS_ERR(priv->reset)) {
> err = PTR_ERR(priv->reset);
> @@ -739,6 +749,8 @@ static int dwcmshc_rk35xx_init(struct sdhci_host *host, struct dwcmshc_priv *dwc
> sdhci_writel(host, 0, DWCMSHC_EMMC_DLL_TXCLK);
> sdhci_writel(host, 0, DWCMSHC_EMMC_DLL_STRBIN);
>
> + dwc_priv->priv = priv;
> +
> return 0;
> }
>
> @@ -1184,7 +1196,6 @@ static int dwcmshc_probe(struct platform_device *pdev)
> struct sdhci_pltfm_host *pltfm_host;
> struct sdhci_host *host;
> struct dwcmshc_priv *priv;
> - struct rk35xx_priv *rk_priv = NULL;
> const struct sdhci_pltfm_data *pltfm_data;
> int err;
> u32 extra, caps;
> @@ -1241,20 +1252,7 @@ static int dwcmshc_probe(struct platform_device *pdev)
> host->mmc_host_ops.execute_tuning = dwcmshc_execute_tuning;
>
> if (pltfm_data == &sdhci_dwcmshc_rk35xx_pdata) {
> - rk_priv = devm_kzalloc(&pdev->dev, sizeof(struct rk35xx_priv), GFP_KERNEL);
> - if (!rk_priv) {
> - err = -ENOMEM;
> - goto err_clk;
> - }
> -
> - if (of_device_is_compatible(pdev->dev.of_node, "rockchip,rk3588-dwcmshc"))
> - rk_priv->devtype = DWCMSHC_RK3588;
> - else
> - rk_priv->devtype = DWCMSHC_RK3568;
> -
> - priv->priv = rk_priv;
> -
> - err = dwcmshc_rk35xx_init(host, priv);
> + err = dwcmshc_rk35xx_init(dev, host, priv);
> if (err)
> goto err_clk;
> }
> @@ -1290,7 +1288,7 @@ static int dwcmshc_probe(struct platform_device *pdev)
> dwcmshc_cqhci_init(host, pdev);
> }
>
> - if (rk_priv)
> + if (pltfm_data == &sdhci_dwcmshc_rk35xx_pdata)
> dwcmshc_rk35xx_postinit(host, priv);
>
> err = __sdhci_add_host(host);
WARNING: multiple messages have this Message-ID (diff)
From: Adrian Hunter <adrian.hunter@intel.com>
To: Chen Wang <unicornxw@gmail.com>,
aou@eecs.berkeley.edu, conor+dt@kernel.org, guoren@kernel.org,
inochiama@outlook.com, jszhang@kernel.org,
krzysztof.kozlowski+dt@linaro.org, palmer@dabbelt.com,
paul.walmsley@sifive.com, robh@kernel.org,
ulf.hansson@linaro.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org,
linux-riscv@lists.infradead.org, chao.wei@sophgo.com,
haijiao.liu@sophgo.com, xiaoguang.xing@sophgo.com,
tingzhu.wang@sophgo.com
Cc: Chen Wang <unicorn_wang@outlook.com>, Drew Fustini <drew@pdp7.com>
Subject: Re: [PATCH v6 4/8] mmc: sdhci-of-dwcmshc: factor out code into dwcmshc_rk35xx_init
Date: Thu, 8 Aug 2024 10:19:10 +0300 [thread overview]
Message-ID: <b87fb5fe-63e1-4f4e-bc7c-92a91becf61e@intel.com> (raw)
In-Reply-To: <4f1f2fa403ce7f0b4d79afb7d7e8a1690cde5d6c.1722847198.git.unicorn_wang@outlook.com>
On 5/08/24 12:18, Chen Wang wrote:
> From: Chen Wang <unicorn_wang@outlook.com>
>
> Continue factor out code fron probe into dwcmshc_rk35xx_init.
>
> Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
> Tested-by: Drew Fustini <drew@pdp7.com> # TH1520
> Tested-by: Inochi Amaoto <inochiama@outlook.com> # Duo and Huashan Pi
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/mmc/host/sdhci-of-dwcmshc.c | 34 ++++++++++++++---------------
> 1 file changed, 16 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
> index b272ec2ab232..55fba5ef37ba 100644
> --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
> +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
> @@ -711,12 +711,22 @@ static void rk35xx_sdhci_reset(struct sdhci_host *host, u8 mask)
> sdhci_reset(host, mask);
> }
>
> -static int dwcmshc_rk35xx_init(struct sdhci_host *host, struct dwcmshc_priv *dwc_priv)
> +static int dwcmshc_rk35xx_init(struct device *dev, struct sdhci_host *host,
> + struct dwcmshc_priv *dwc_priv)
> {
> static const char * const clk_ids[] = {"axi", "block", "timer"};
> - struct rk35xx_priv *priv = dwc_priv->priv;
> + struct rk35xx_priv *priv;
> int err;
>
> + priv = devm_kzalloc(dev, sizeof(struct rk35xx_priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + if (of_device_is_compatible(dev->of_node, "rockchip,rk3588-dwcmshc"))
> + priv->devtype = DWCMSHC_RK3588;
> + else
> + priv->devtype = DWCMSHC_RK3568;
> +
> priv->reset = devm_reset_control_array_get_optional_exclusive(mmc_dev(host->mmc));
> if (IS_ERR(priv->reset)) {
> err = PTR_ERR(priv->reset);
> @@ -739,6 +749,8 @@ static int dwcmshc_rk35xx_init(struct sdhci_host *host, struct dwcmshc_priv *dwc
> sdhci_writel(host, 0, DWCMSHC_EMMC_DLL_TXCLK);
> sdhci_writel(host, 0, DWCMSHC_EMMC_DLL_STRBIN);
>
> + dwc_priv->priv = priv;
> +
> return 0;
> }
>
> @@ -1184,7 +1196,6 @@ static int dwcmshc_probe(struct platform_device *pdev)
> struct sdhci_pltfm_host *pltfm_host;
> struct sdhci_host *host;
> struct dwcmshc_priv *priv;
> - struct rk35xx_priv *rk_priv = NULL;
> const struct sdhci_pltfm_data *pltfm_data;
> int err;
> u32 extra, caps;
> @@ -1241,20 +1252,7 @@ static int dwcmshc_probe(struct platform_device *pdev)
> host->mmc_host_ops.execute_tuning = dwcmshc_execute_tuning;
>
> if (pltfm_data == &sdhci_dwcmshc_rk35xx_pdata) {
> - rk_priv = devm_kzalloc(&pdev->dev, sizeof(struct rk35xx_priv), GFP_KERNEL);
> - if (!rk_priv) {
> - err = -ENOMEM;
> - goto err_clk;
> - }
> -
> - if (of_device_is_compatible(pdev->dev.of_node, "rockchip,rk3588-dwcmshc"))
> - rk_priv->devtype = DWCMSHC_RK3588;
> - else
> - rk_priv->devtype = DWCMSHC_RK3568;
> -
> - priv->priv = rk_priv;
> -
> - err = dwcmshc_rk35xx_init(host, priv);
> + err = dwcmshc_rk35xx_init(dev, host, priv);
> if (err)
> goto err_clk;
> }
> @@ -1290,7 +1288,7 @@ static int dwcmshc_probe(struct platform_device *pdev)
> dwcmshc_cqhci_init(host, pdev);
> }
>
> - if (rk_priv)
> + if (pltfm_data == &sdhci_dwcmshc_rk35xx_pdata)
> dwcmshc_rk35xx_postinit(host, priv);
>
> err = __sdhci_add_host(host);
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2024-08-08 7:19 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-05 9:15 [PATCH v6 0/8] mmc: sdhci-of-dwcmshc: Add Sophgo SG2042 support Chen Wang
2024-08-05 9:15 ` Chen Wang
2024-08-05 9:17 ` [PATCH v6 1/8] mmc: sdhci-of-dwcmshc: add common bulk optional clocks support Chen Wang
2024-08-05 9:17 ` Chen Wang
2024-08-08 7:17 ` Adrian Hunter
2024-08-08 7:17 ` Adrian Hunter
2025-07-22 18:33 ` Robin Murphy
2025-07-22 18:33 ` Robin Murphy
2025-07-22 18:33 ` Robin Murphy
2025-07-23 5:33 ` Adrian Hunter
2025-07-23 5:33 ` Adrian Hunter
2025-07-23 5:33 ` Adrian Hunter
2025-07-24 14:33 ` Diederik de Haas
2025-07-24 14:33 ` Diederik de Haas
2025-07-24 14:33 ` Diederik de Haas
2025-07-24 14:57 ` Adrian Hunter
2025-07-24 14:57 ` Adrian Hunter
2025-07-24 14:57 ` Adrian Hunter
2025-07-25 17:03 ` Diederik de Haas
2025-07-25 17:03 ` Diederik de Haas
2025-07-25 17:03 ` Diederik de Haas
2024-08-05 9:17 ` [PATCH v6 2/8] mmc: sdhci-of-dwcmshc: move two rk35xx functions Chen Wang
2024-08-05 9:17 ` Chen Wang
2024-08-08 7:18 ` Adrian Hunter
2024-08-08 7:18 ` Adrian Hunter
2024-08-05 9:17 ` [PATCH v6 3/8] mmc: sdhci-of-dwcmshc: factor out code for th1520_init() Chen Wang
2024-08-05 9:17 ` Chen Wang
2024-08-08 7:18 ` Adrian Hunter
2024-08-08 7:18 ` Adrian Hunter
2024-08-05 9:18 ` [PATCH v6 4/8] mmc: sdhci-of-dwcmshc: factor out code into dwcmshc_rk35xx_init Chen Wang
2024-08-05 9:18 ` Chen Wang
2024-08-08 7:19 ` Adrian Hunter [this message]
2024-08-08 7:19 ` Adrian Hunter
2024-08-05 9:18 ` [PATCH v6 5/8] mmc: sdhci-of-dwcmshc: add dwcmshc_pltfm_data Chen Wang
2024-08-05 9:18 ` Chen Wang
2024-08-08 7:19 ` Adrian Hunter
2024-08-08 7:19 ` Adrian Hunter
2024-08-05 9:19 ` [PATCH v6 6/8] dt-bindings: mmc: sdhci-of-dwcmhsc: Add Sophgo SG2042 support Chen Wang
2024-08-05 9:19 ` Chen Wang
2024-08-05 9:19 ` [PATCH v6 7/8] mmc: sdhci-of-dwcmshc: Add support for Sophgo SG2042 Chen Wang
2024-08-05 9:19 ` Chen Wang
2024-08-08 7:19 ` Adrian Hunter
2024-08-08 7:19 ` Adrian Hunter
2024-08-05 9:19 ` [PATCH v6 8/8] riscv: sophgo: dts: add mmc controllers for SG2042 SoC Chen Wang
2024-08-05 9:19 ` Chen Wang
2024-08-20 11:49 ` [PATCH v6 0/8] mmc: sdhci-of-dwcmshc: Add Sophgo SG2042 support Ulf Hansson
2024-08-20 11:49 ` Ulf Hansson
2024-08-26 2:59 ` (subset) " Inochi Amaoto
2024-08-26 2:59 ` Inochi Amaoto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b87fb5fe-63e1-4f4e-bc7c-92a91becf61e@intel.com \
--to=adrian.hunter@intel.com \
--cc=aou@eecs.berkeley.edu \
--cc=chao.wei@sophgo.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=drew@pdp7.com \
--cc=guoren@kernel.org \
--cc=haijiao.liu@sophgo.com \
--cc=inochiama@outlook.com \
--cc=jszhang@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=robh@kernel.org \
--cc=tingzhu.wang@sophgo.com \
--cc=ulf.hansson@linaro.org \
--cc=unicorn_wang@outlook.com \
--cc=unicornxw@gmail.com \
--cc=xiaoguang.xing@sophgo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.