Re: [PATCH 1/5] mmc: sdhci-of-arasan: Fix SDHCI_RESET_ALL for CQHCI

From: Adrian Hunter
Date: Tue Oct 18 2022 - 13:59:22 EST


On 18/10/22 19:59, Brian Norris wrote:
> Hi Adrian,
>
> On Tue, Oct 18, 2022 at 07:13:28PM +0300, Adrian Hunter wrote:
>> On 18/10/22 06:57, Brian Norris wrote:
>>> So like these other patches, deactivate CQHCI when resetting the
>>> controller. Also, move around the DT/caps handling, because
>>> sdhci_setup_host() performs resets before we've initialized CQHCI. This
>>> is the pattern followed in other SDHCI/CQHCI drivers.
>>
>> Did you consider just checking host->mmc->cqe_private like
>> sdhci_cqhci_reset() ?
>
> I did not, although I am doing so now.
>
> My first thought is that this feels a bit too private. Is the host
> driver supposed to be memorizing the details of the CQHCI layer?

Some drivers need to access CQHCI registers and get the reference
to cqhci_host from cqe_private, so that is already accepted.

>
> But on the plus side, that would remove some contortions needed here
> (and also in sdhci-brcmstb.c).
>
> Here's another option I previously considered: teaching
> cqhci_deactivate() to check cqe_private itself. That would have the same
> benefits, while keeping the private details in cqhci-core.c. How do you
> like that?

I don't mind either way.

>
> (Tiny downside: cqhci-core.c got its rename in v5.12, so backporting
> this to -stable would get slightly more difficult.)
>
> Brian