linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: AKASHI Takahiro <takahiro.akashi@linaro.org>,
	Ben Chuang <benchuanggli@gmail.com>,
	ulf.hansson@linaro.org, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org, ben.chuang@genesyslogic.com.tw,
	greg.tu@genesyslogic.com.tw
Subject: Re: [RFC PATCH V3 12/21] mmc: sdhci: UHS-II support, add hooks for additional operations
Date: Fri, 25 Sep 2020 12:02:29 +0300	[thread overview]
Message-ID: <14c80da3-5ef5-fba3-8b98-3c50f6241475@intel.com> (raw)
In-Reply-To: <20200924093538.GA35720@laputa>

On 24/09/20 12:35 pm, AKASHI Takahiro wrote:
> Adrian,
> 
> This is, hopefully, my last reply to your comments on this patch#12.
> 
> Regarding _request() and _send_command() (and more),
> 
> On Fri, Aug 21, 2020 at 05:08:32PM +0300, Adrian Hunter wrote:
>> On 10/07/20 2:10 pm, Ben Chuang wrote:
>>> From: Ben Chuang <ben.chuang@genesyslogic.com.tw>
>>>
>>> In this commit, UHS-II related operations will be called via a function
>>> pointer array, sdhci_uhs2_ops, in order to make UHS-II support as
>>> a kernel module.
>>> This array will be initialized only if CONFIG_MMC_SDHCI_UHS2 is enabled
>>> and when the UHS-II module is loaded. Otherwise, all the functions
>>> stay void.
>>>
>   (snip)
> 
>> Again, this is what I want to avoid.  I would like to have 3 kinds of functions:
>> 	- SD mode only
>> 	- UHS-II only
>> 	- SD functions with no UHS-II code, that can also be used by UHS-II
>> i.e. I don't want to mix UHS-II code and SD mode code in the same function.
>>
>> I think sdhci-uhs2.c should provide a request function and a send_command function.
>> I would start by removing everything you may not need, and then see if you have any problems.
>> e.g.
>>
>> void uhs2_request(struct mmc_host *mmc, struct mmc_request *mrq)
>> {
>> 	struct sdhci_host *host = mmc_priv(mmc);
>> 	struct mmc_command *cmd;
>> 	unsigned long flags;
>>
>> 	if (!host->uhs2_mode) {
>> 		sdhci_request(mmc, mrq);
>> 		return;
>> 	}
>>
>> 	spin_lock_irqsave(&host->lock, flags);
>> 	uhs2_send_command(host, cmd);
>> 	spin_unlock_irqrestore(&host->lock, flags);
>> }
>> EXPORT_SYMBOL_GPL(uhs2_request);
>>
>> For sdhci_prepare_data(), I would factor out the dma part, so
>>
>> static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd)
>> {
>> 	struct mmc_data *data = cmd->data;
>>
>> 	sdhci_initialize_data(host, data);
>>
>> 	sdhci_prepare_dma(host, data);
>>
>> 	sdhci_set_block_info(host, data);
>> }
>>
>> The you could export sdhci_initialize_data() and sdhci_prepare_dma() for uhs2.
>>
>>>  }
>>>  
>>>  #if IS_ENABLED(CONFIG_MMC_SDHCI_EXTERNAL_DMA)
>>> @@ -1439,6 +1463,13 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
>>>  	u16 mode = 0;
>>>  	struct mmc_data *data = cmd->data;
>>>  
>>> +	if (IS_ENABLED(CONFIG_MMC_SDHCI_UHS2) &&
>>> +	    host->mmc->flags & MMC_UHS2_SUPPORT) {
>>> +		if (sdhci_uhs2_ops.set_transfer_mode)
>>> +			sdhci_uhs2_ops.set_transfer_mode(host, cmd);
>>> +		return;
>>> +	}
>>> +
>>
>> Once you provide uhs2_request() and uhs2_send_command(), the transfer mode setting can be done in sdhci-uhs2.c
> 
> If I try to make changes as you suggested above, a lot of other uhs2-flavored
> functions will also be created due to calling dependency/sequences
> and for "completeness" compared to uhs counterparts.
> They probably include
>     sdhci_uhs2_prepare_data()
>     sdhci_uhs2_external_dma_prepare_data()
>     sdhci_uhs2_send_command()
>     sdhci_uhs2_send_command_try()
>     sdhci_uhs2_send_tuning()
>     sdhci_uhs2_request()
>     sdhci_uhs2_request_atomic()
>     sdhci_uhs2_thread_irq()
>     sdhci_uhs2_irq()
>     sdhci_uhs2_cmd_irq()
>     sdhci_uhs2_finish_command()
>     sdhci_uhs2_resume_host()
>     __sdhci_uhs2_add_host()
>     sdhci_uhs2_add_host()
> (Some may not be used under the current drivers.)
> 
> In addition, a bunch of functions in sdhci.c will also have to be exported
> to uhs2 as "global" functions instead of "static."
> 
> Is this all that you expect to see?

Yes.  Add what you need.

      reply	other threads:[~2020-09-25  9:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10 11:10 [RFC PATCH V3 12/21] mmc: sdhci: UHS-II support, add hooks for additional operations Ben Chuang
2020-08-21 14:08 ` Adrian Hunter
2020-09-16  8:05   ` AKASHI Takahiro
2020-09-16 10:00     ` Adrian Hunter
2020-09-17  2:31       ` AKASHI Takahiro
2020-09-17  4:52         ` Adrian Hunter
2020-09-17  5:16           ` AKASHI Takahiro
2020-09-17  5:12   ` AKASHI Takahiro
2020-09-17 10:12     ` Ben Chuang
2020-09-18  1:15       ` AKASHI Takahiro
2020-09-18 10:27         ` Ben Chuang
2020-09-24  9:46           ` AKASHI Takahiro
2020-09-25  7:59             ` Ben Chuang
2020-09-18  6:38   ` AKASHI Takahiro
2020-09-18 10:50     ` Ben Chuang
2020-09-24  9:57       ` AKASHI Takahiro
2020-09-25  7:55         ` Ben Chuang
2020-09-24  9:35   ` AKASHI Takahiro
2020-09-25  9:02     ` Adrian Hunter [this message]

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=14c80da3-5ef5-fba3-8b98-3c50f6241475@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=ben.chuang@genesyslogic.com.tw \
    --cc=benchuanggli@gmail.com \
    --cc=greg.tu@genesyslogic.com.tw \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=takahiro.akashi@linaro.org \
    --cc=ulf.hansson@linaro.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).