[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0cc0aab1-f7bf-4a87-af5a-22cf842fbf80@kernel.org>
Date: Fri, 28 Jun 2024 09:31:01 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Shan-Chun Hung <shanchun1218@...il.com>, ulf.hansson@...aro.org,
robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
adrian.hunter@...el.com, p.zabel@...gutronix.de, pbrobinson@...il.com,
serghox@...il.com, mcgrof@...nel.org,
prabhakar.mahadev-lad.rj@...renesas.com, forbidden405@...look.com,
tmaimon77@...il.com, andy.shevchenko@...il.com,
linux-arm-kernel@...ts.infradead.org, linux-mmc@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: ychuang3@...oton.com, schung@...oton.com
Subject: Re: [PATCH v2 2/2] mmc: sdhci-of-ma35d1: Add Nuvoton MA35D1 SDHCI
driver
On 26/06/2024 11:49, Shan-Chun Hung wrote:
> Add the SDHCI driver for the MA35D1 platform. It is based upon the
> SDHCI interface, but requires some extra initialization.
>
> +static int ma35_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct sdhci_pltfm_host *pltfm_host;
> + struct sdhci_host *host;
> + struct ma35_priv *priv;
> + int err;
> + u32 extra, ctl;
> +
> + host = sdhci_pltfm_init(pdev, &sdhci_ma35_pdata, sizeof(struct ma35_priv));
> + if (IS_ERR(host))
> + return PTR_ERR(host);
> +
> + err = devm_add_action_or_reset(dev, ma35_sdhci_pltfm_free, pdev);
> + if (err)
> + return dev_err_probe(dev, err, "Failed to register sdhci_pltfm_free action\n");
> +
> + /* Extra adma table cnt for cross 128M boundary handling. */
> + extra = DIV_ROUND_UP_ULL(dma_get_required_mask(dev), SZ_128M);
> + extra = min(extra, SDHCI_MAX_SEGS);
> +
> + host->adma_table_cnt += extra;
> + pltfm_host = sdhci_priv(host);
> + priv = sdhci_pltfm_priv(pltfm_host);
> +
> + pltfm_host->clk = devm_clk_get_optional_enabled(dev, NULL);
> + if (IS_ERR(pltfm_host->clk))
> + return dev_err_probe(dev, IS_ERR(pltfm_host->clk), "failed to get clk\n");
Ykes, you cannot return IS_ERR.
> +
> + err = mmc_of_parse(host->mmc);
> + if (err)
> + return err;
> +
> + priv->rst = devm_reset_control_get_exclusive(dev, NULL);
> + if (IS_ERR(priv->rst))
> + return dev_err_probe(dev, PTR_ERR(priv->rst), "failed to get reset control\n");
> +
Best regards,
Krzysztof
Powered by blists - more mailing lists