Re: [PATCH 1/4] [1/4] mmc: core: expose MMC_CAP2_CQE* to dt

From: Linus Walleij
Date: Fri Feb 21 2020 - 09:34:13 EST


On Mon, Feb 17, 2020 at 7:32 AM Chun-Hung Wu <chun-hung.wu@xxxxxxxxxxxx> wrote:

> Expose MMC_CAP2_CQE and MMC_CAP2_CQE_DCMD
> to host->caps2 if
> 1. "supports-cqe" is defined in dt and
> 2. "disable-cqe-dcmd" is not defined in dt.
>
> ---
> drivers/mmc/core/host.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index 105b7a7..efb0dbe 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -319,6 +319,14 @@ int mmc_of_parse(struct mmc_host *host)
> host->caps2 |= MMC_CAP2_NO_SD;
> if (device_property_read_bool(dev, "no-mmc"))
> host->caps2 |= MMC_CAP2_NO_MMC;
> + if (device_property_read_bool(dev, "supports-cqe"))
> + host->caps2 |= MMC_CAP2_CQE;

I don't understand why this is even a DT property as it should
be clear from the hosts compatible whether it supports CQE or
not. But it's too late to do anything about that I suppose, and
I just assume there is something I don't understand here.

> + /* Must be after "supports-cqe" check */
> + if (!device_property_read_bool(dev, "disable-cqe-dcmd")) {
> + if (host->caps2 & MMC_CAP2_CQE)
> + host->caps2 |= MMC_CAP2_CQE_DCMD;
> + }

This is the right place to do this I suppose. Disabling CQE
selectively is something you might wanna do for debugging.
Acked-by: Linus Walleij <linus.walleij@xxxxxxxxxx>

I see that some drivers are already parsing this DT property
on their own, should we follow up with patches so that these:

$ git grep 'supports-cqe'
drivers/mmc/host/sdhci-brcmstb.c: if
(device_property_read_bool(&pdev->dev, "supports-cqe")) {
drivers/mmc/host/sdhci-msm.c: if (of_property_read_bool(node, "supports-cqe"))
drivers/mmc/host/sdhci-tegra.c: if
(device_property_read_bool(host->mmc->parent, "supports-cqe"))

Make use of the central parsing instead?

Yours,
Linus Walleij