Re: [PATCH 1/2] mmc: Add SD/SDIO driver for Sunplus SP7021

From: Philipp Zabel
Date: Tue Nov 02 2021 - 10:34:27 EST


On Fri, 2021-10-29 at 13:57 +0800, LH.Kuo wrote:
[...]
> --- /dev/null
> +++ b/drivers/mmc/host/sunplus_sd2.c
> @@ -0,0 +1,1069 @@
[...]
> +static void spsdc_controller_init(struct spsdc_host *host)
> +{
> + u32 value;
> + int ret = reset_control_assert(host->rstc);
> +
> + if (!ret) {
> + mdelay(1);

Consider using usleep_range(), see Documentation/timers/timers-howto.rst

[...]
> +static int spsdc_drv_probe(struct platform_device *pdev)
> +{
> + int ret = 0;
> + struct mmc_host *mmc;
> + struct resource *resource;
> + struct spsdc_host *host;
> + unsigned int mode;
> +
> + mmc = mmc_alloc_host(sizeof(*host), &pdev->dev);
> + if (!mmc) {
> + ret = -ENOMEM;
> + goto probe_free_host;
> + }
> +
> + host = mmc_priv(mmc);
> + host->mmc = mmc;
> + host->power_state = MMC_POWER_OFF;
> + host->dma_int_threshold = 1024;
> + host->dmapio_mode = SPSDC_DMA_MODE;
> +
> + host->clk = devm_clk_get(&pdev->dev, NULL);
> + if (IS_ERR(host->clk)) {
> + spsdc_pr(ERROR, "Can not find clock source\n");
> + ret = PTR_ERR(host->clk);
> + goto probe_free_host;
> + }
> +
> + host->rstc = devm_reset_control_get(&pdev->dev, NULL);

Please use devm_reset_control_get_exclusive() instead.

regards
Philipp