linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Daney <ddaney@caviumnetworks.com>
To: Ulf Hansson <ulf.hansson@linaro.org>, Jan Glauber <jglauber@cavium.com>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Steven J . Hill" <Steven.Hill@cavium.com>,
	David Daney <david.daney@cavium.com>
Subject: Re: [PATCH v11 2/9] mmc: cavium: Add core MMC driver for Cavium SOCs
Date: Fri, 3 Mar 2017 10:39:11 -0800	[thread overview]
Message-ID: <59986cad-be37-27fd-f9fe-bb11579bc0ea@caviumnetworks.com> (raw)
In-Reply-To: <CAPDyKFpZs-WZ32NQTc3zY6RdWJecZkUvbEbszAJfv4H2Rw2JCQ@mail.gmail.com>

On 03/03/2017 03:47 AM, Ulf Hansson wrote:
> On 6 February 2017 at 14:39, Jan Glauber <jglauber@cavium.com> wrote:
[...]
>> +}
>> +
>> +static void prepare_ext_dma(struct mmc_host *mmc, struct mmc_request *mrq,
>> +                           union mio_emm_dma *emm_dma)
>> +{
>> +       struct cvm_mmc_slot *slot = mmc_priv(mmc);
>> +
>> +       /*
>> +        * Our MMC host hardware does not issue single commands,
>> +        * because that would require the driver and the MMC core
>> +        * to do work to determine the proper sequence of commands.
>
> I don't get this. The allowed sequence of the commands is determined
> by the SD/(e)MMC/SDIO spec and much of this knowledge is the
> responsibility of the mmc core.
>
>> +        * Instead, our hardware is superior to most other MMC bus
>
> No need to brag about your HW. Let's just describe how it works instead.
>
>> +        * hosts. The sequence of MMC commands required to execute
>> +        * a transfer are issued automatically by the bus hardware.
>
> What does this really mean? Is this about HW support for better
> dealing with data requests?


The entire comment should be removed.   It is laced with sarcasm that is 
very difficult for people not intimately familiar with the discussions 
to detect and decipher.

The real story is that the Cavium MMC hardware was designed based on a 
defective premise.  Hardwired in to the core of the MMC bus interface 
hardware is a multi-command synthesizer/sequencer that is hard coded to 
work with a limited subset of MMC-only command sequences.  This allows 
you to read data from the first few MB of an MMC device with only a 
handful of assembly language instructions contained in the on-die 
mask-ROM of the SoC.

When it comes to actually using the MMC/SD bus interface from within the 
Linux MMC framework, we have to apply a transform to the command 
sequences supplied by the Linux MMC core so that the command sequence 
synthesized by Cavium MMC hardware matches as closely as possible what 
was actually requested.  For many command sequences, the match between 
what is synthesized by the hardware and what was requested is not exact.

>
>> +        *
>> +        * - David Daney <ddaney@cavium.com>
>> +        */
>> +       emm_dma->val = 0;
>> +       emm_dma->s.bus_id = slot->bus_id;
>> +       emm_dma->s.dma_val = 1;
>> +       emm_dma->s.sector = (mrq->data->blksz == 512) ? 1 : 0;
>> +       emm_dma->s.rw = (mrq->data->flags & MMC_DATA_WRITE) ? 1 : 0;
>> +       emm_dma->s.block_cnt = mrq->data->blocks;
>> +       emm_dma->s.card_addr = mrq->cmd->arg;
>> +       if (mmc_card_mmc(mmc->card) || (mmc_card_sd(mmc->card) &&
>> +           (mmc->card->scr.cmds & SD_SCR_CMD23_SUPPORT)))
>> +               emm_dma->s.multi = 1;

Here is a prefect example.

If a multi-block transfer was requested, the hardware command 
synthesizer uses the "multi" bit to determine if it should generate a 
command sequence for a single multi-block transfer, or multiple 
single-block transfers.

Probably the MMC core would never request a multi-block transfer from a 
device that doesn't support it, but we check here just-in-case.



>> +
>> +       pr_debug("[%s] blocks: %u  multi: %d\n", (emm_dma->s.rw) ? "W" : "R",
>> +                mrq->data->blocks, emm_dma->s.multi);
>> +}
>> +

  reply	other threads:[~2017-03-03 19:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06 13:39 [PATCH v11 0/9] Cavium MMC driver Jan Glauber
2017-02-06 13:39 ` [PATCH v11 1/9] dt-bindings: mmc: Add Cavium SOCs MMC bindings Jan Glauber
2017-02-09  0:40   ` Rob Herring
2017-03-03 11:47   ` Ulf Hansson
2017-03-06 11:09     ` Jan Glauber
2017-02-06 13:39 ` [PATCH v11 2/9] mmc: cavium: Add core MMC driver for Cavium SOCs Jan Glauber
2017-03-03 11:47   ` Ulf Hansson
2017-03-03 18:39     ` David Daney [this message]
2017-03-07 10:49     ` Jan Glauber
2017-03-08  9:45       ` Ulf Hansson
2017-03-08 17:52         ` Jan Glauber
2017-02-06 13:39 ` [PATCH v11 3/9] mmc: cavium: Add MMC platform driver for Octeon SOCs Jan Glauber
2017-02-06 13:39 ` [PATCH v11 4/9] mmc: cavium: Work-around hardware bug on cn6xxx and cnf7xxx Jan Glauber
2017-02-06 13:39 ` [PATCH v11 5/9] mmc: cavium: Add support for Octeon cn7890 Jan Glauber
2017-02-06 13:39 ` [PATCH v11 6/9] mmc: cavium: Add MMC PCI driver for ThunderX SOCs Jan Glauber
2017-02-12  1:09   ` kbuild test robot
2017-02-13 15:24     ` Jan Glauber
2017-02-13 15:45       ` Ulf Hansson
2017-02-15 12:34         ` Arnd Bergmann
2017-02-15 13:54           ` Jan Glauber
2017-02-06 13:39 ` [PATCH v11 7/9] mmc: cavium: Add scatter-gather DMA support Jan Glauber
2017-02-12  1:27   ` kbuild test robot
2017-02-06 13:39 ` [PATCH v11 8/9] mmc: cavium: Support DDR mode for eMMC devices Jan Glauber
2017-02-06 13:39 ` [PATCH v11 9/9] MAINTAINERS: Add entry for Cavium MMC driver Jan Glauber

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=59986cad-be37-27fd-f9fe-bb11579bc0ea@caviumnetworks.com \
    --to=ddaney@caviumnetworks.com \
    --cc=Steven.Hill@cavium.com \
    --cc=david.daney@cavium.com \
    --cc=jglauber@cavium.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.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).