[PATCH v1 2/2] mmc: sdhci-npcm: Add NPCM SDHCI driver
Andy Shevchenko
andy.shevchenko at gmail.com
Thu Dec 1 02:50:04 AEDT 2022
On Wed, Nov 30, 2022 at 5:09 PM Tomer Maimon <tmaimon77 at gmail.com> wrote:
>
> Add Nuvoton NPCM BMC sdhci-pltfm controller driver.
...
> obj-$(CONFIG_MMC_S3C) += s3cmci.o
> obj-$(CONFIG_MMC_SDRICOH_CS) += sdricoh_cs.o
> obj-$(CONFIG_MMC_TMIO) += tmio_mmc.o
> +obj-$(CONFIG_MMC_SDHCI_NPCM) += sdhci-npcm.o
Keep it ordered by module name.
> obj-$(CONFIG_MMC_TMIO_CORE) += tmio_mmc_core.o
> obj-$(CONFIG_MMC_SDHI) += renesas_sdhi_core.o
> obj-$(CONFIG_MMC_SDHI_SYS_DMAC) += renesas_sdhi_sys_dmac.o
...
> +/*
> + * NPCM SDHC MMC host controller driver.
> + *
> + */
Too many lines for seems to be oneliner comment.
...
> +#include <linux/of.h>
I don't see how it's being used.
But it seems the mod_devicetable.h is missing.
...
> +static const struct sdhci_pltfm_data npcm_sdhci_pdata = {
> + .quirks = SDHCI_QUIRK_DELAY_AFTER_POWER,
> + .quirks2 = SDHCI_QUIRK2_STOP_WITH_TC |
> + SDHCI_QUIRK2_NO_1_8_V,
> +};
Why? Can't you use the sdhci as a library?
...
> +static int npcm_sdhci_probe(struct platform_device *pdev)
> +{
> + struct sdhci_pltfm_host *pltfm_host;
> + struct sdhci_host *host;
> + u32 caps;
> + int ret;
> +
> + host = sdhci_pltfm_init(pdev, &npcm_sdhci_pdata, 0);
> + if (IS_ERR(host))
> + return PTR_ERR(host);
> +
> + pltfm_host = sdhci_priv(host);
> + pltfm_host->clk = devm_clk_get(&pdev->dev, NULL);
> +
Blank line in a wrong position, should be before devm_clk_get().
> + if (!IS_ERR(pltfm_host->clk))
> + clk_prepare_enable(pltfm_host->clk);
Why not use a specific helper that gets the clock enabled?
> + caps = sdhci_readl(host, SDHCI_CAPABILITIES);
> + if (caps & SDHCI_CAN_DO_8BIT)
> + host->mmc->caps |= MMC_CAP_8_BIT_DATA;
> +
> + ret = mmc_of_parse(host->mmc);
> + if (ret)
> + goto err_sdhci_add;
> +
> + ret = sdhci_add_host(host);
> + if (ret)
> + goto err_sdhci_add;
> +
> + return 0;
> +
> +err_sdhci_add:
> + clk_disable_unprepare(pltfm_host->clk);
> + sdhci_pltfm_free(pdev);
> + return ret;
> +}
...
> +
Redundant blank line.
> +module_platform_driver(npcm_sdhci_driver);
--
With Best Regards,
Andy Shevchenko
More information about the openbmc
mailing list