From: Marek Vasut <marex@denx.de>
To: Yann GAUTIER <yann.gautier@foss.st.com>,
Ulf Hansson <ulf.hansson@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
linux-stm32@st-md-mailman.stormreply.com
Subject: Re: [Linux-stm32] [PATCH] [RFC] mmc: mmci: Add support for probing bus voltage level translator
Date: Wed, 13 Jan 2021 15:45:07 +0100 [thread overview]
Message-ID: <ccef7ae4-8cd7-4434-9632-917a4fb92f53@denx.de> (raw)
In-Reply-To: <f91fbdfc-453d-78a6-970a-5d6eecd443b2@foss.st.com>
On 1/13/21 3:21 PM, Yann GAUTIER wrote:
> On 1/13/21 12:52 PM, Marek Vasut wrote:
>> On 1/13/21 12:38 PM, Ulf Hansson wrote:
>> [...]
>>>>>> static int mmci_of_parse(struct device_node *np, struct
>>>>>> mmc_host *mmc)
>>>>>> {
>>>>>> struct mmci_host *host = mmc_priv(mmc);
>>>>>> @@ -1913,7 +1973,7 @@ static int mmci_of_parse(struct device_node
>>>>>> *np, struct mmc_host *mmc)
>>>>>> if (of_get_property(np, "st,neg-edge", NULL))
>>>>>> host->clk_reg_add |= MCI_STM32_CLK_NEGEDGE;
>>>>>> if (of_get_property(np, "st,use-ckin", NULL))
>>>>>> - host->clk_reg_add |= MCI_STM32_CLK_SELCKIN;
>>>>>> + mmci_probe_level_translator(mmc);
>>>>>
>>>>> I think you can make this change bit less invasive. Rather than having
>>>>> to shuffle code around in ->probe(), I suggest you call
>>>>> mmci_probe_level_translator() outside and after mmci_of_parse() has
>>>>> been called.
>>>>>
>>>>> In this way, you can also provide mmci_probe_level_translator() with a
>>>>> struct mmci_host *, rather than having to pick it up from
>>>>> mmc_priv(mmc), if you see what I mean.
>>>>>
>>>>> Of course, this also means in mmci_probe_level_translator() you will
>>>>> have to check if MCI_STM32_CLK_SELCKIN has been set, and if not then
>>>>> do an early return.
>>>>
>>>> Testing the translator presence when checking whether its enabled in DT
>>>> seems like the right place, but that's really just an implementation
>>>> detail.
>>>>
>>>> I am more interested in knowing whether adding
>>>> mmci_probe_level_translator() is even acceptable in the first place.
>>>> Is it ?
>>>
>>> Honestly, I don't know.
>>>
>>> I think I need to defer that question to Linus Walleij. And of course,
>>> it would be nice to get the opinion from Ludovic as well.
>>
>> Good, that's what I was hoping for too.
>
> Hi,
>
> Ludovic is out of office this week.
>
> The feature of detecting a level translator seems to be quite generic,
> and not dedicated to MMCI driver or the ST dedicated code, and with new
> st,* properties. It may be in generic mmc code. But I'll let Linus
> comment about that.
>
> I also wonder if this HW detection should be done in kernel, or if it
> should be done in Bootloader. But it may be more complex, to add the
> st,use_ckin in kernel DT if bootloader detects this translator.
Lets not attempt to hide inobvious functionality in bootloaders, the
kernel should be independent of bootloader where possible. And here it
is clearly and easily possible.
next prev parent reply other threads:[~2021-01-13 14:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-05 14:07 [PATCH] [RFC] mmc: mmci: Add support for probing bus voltage level translator Marek Vasut
2021-01-13 10:44 ` Ulf Hansson
2021-01-13 11:34 ` Marek Vasut
2021-01-13 11:38 ` Ulf Hansson
2021-01-13 11:52 ` Marek Vasut
2021-01-13 14:21 ` [Linux-stm32] " Yann GAUTIER
2021-01-13 14:45 ` Marek Vasut [this message]
2021-01-14 10:13 ` Yann GAUTIER
2021-01-15 22:49 ` Linus Walleij
2021-01-15 22:48 ` Linus Walleij
2021-01-15 22:47 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ccef7ae4-8cd7-4434-9632-917a4fb92f53@denx.de \
--to=marex@denx.de \
--cc=linus.walleij@linaro.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=ulf.hansson@linaro.org \
--cc=yann.gautier@foss.st.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.