linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ulf.hansson@linaro.org (Ulf Hansson)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 2/2] mmc: meson-mx-sdio: Add a driver for the Amlogic Meson8 and Meson8b SoCs
Date: Wed, 12 Jul 2017 15:42:45 +0200	[thread overview]
Message-ID: <CAPDyKFoKaT_3MVF7SrS8bVm7iG=y6K+-R1+YNj=9bTS6qNrcug@mail.gmail.com> (raw)
In-Reply-To: <CAFBinCA-goSsyq7bo=ozPRnOqc8br4KDJJ_Lao5h==Xneh02nw@mail.gmail.com>

On 11 July 2017 at 23:23, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
> Hi Ulf,
>
> sorry for the delay, I've been pretty busy.
> however, I'll have more time to work in this driver this and next week
>
> On Mon, Jun 19, 2017 at 1:50 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>>>
>>>> [...]
>>>>
>>>>>>> +       if (!(cmd->flags & MMC_RSP_CRC))
>>>>>>> +               send |= MESON_MX_SDIO_SEND_RESP_WITHOUT_CRC7;
>>>>>>> +
>>>>>>> +       if (cmd->flags & MMC_RSP_BUSY)
>>>>>>> +               send |= MESON_MX_SDIO_SEND_CHECK_DAT0_BUSY;
>>>>>>
>>>>>> In case the controller has HW support of busy detection, please
>>>>>> consider to enable MMC_CAP_WAIT_WHILE_BUSY for this driver. Then also
>>>>>> assign host->max_busy_timeout a good value.
>>>>> the IRQS register has bit 4 (CMD_BUSY) - but apart from that there is
>>>>> no other documentation (about timeout values, etc.). the vendor driver
>>>>> also neither uses MMC_CAP_WAIT_WHILE_BUSY nor host->max_busy_timeout
>>>>> should I leave this as it is?
>>>>
>>>> Please don't just leave it as is. This is an important thing to get right.
>>>>
>>>> You should be able to explore this area and see how the controller
>>>> behaves without too much of documentation. Regarding timeouts, it may
>>>> very well be that the controller don't have a timeout, which is why
>>>> you need a software timeout. That's not so uncommon actually.
>>> during my experiments I've never seen an interrupt when a command
>>> timed out (nor could I find information about a timeout register in
>>> the documentation). do you have any pointers (like a previous mail
>>> where you've explained) how I can "explore the controller's timeout
>>> behavior"?
>>
>> Sorry, I don't have an pointers.
>>
>> Anyway. If you do a big erase operation on an SD card, the card should
>> signal busy on DAT0 for a rather long time.
> erase operation = mount sd card; rm big_file.bin; sync ?
> or is there some other way?

There is tool called fstrim, maybe you can you that as well.

Don't forget that the mount options of the fs also matters of what
will happen for the so called discard operations (translates to erase
in SD).

>
>> You could probably explore how long it takes for the card to respond
>> under those circumstances, and try both with and without
>> MESON_MX_SDIO_SEND_CHECK_DAT0_BUSY.
> so I simply read the card status through sysfs? or would I need to get
> some of this information from the controller?
> I found that the IRQC register contains a few interesting bits:
>     u32 sdio_force_data:6; /*[13:8]
>         * Write operation: Data forced by software
>         * Read operation: {CLK,CMD,DAT[3:0]}*/
> I dumped these while transferring some data, the values seem to be
> changing constantly (0x3f, 0x1f, 0x20, ...)
> if I interpret those bits correctly then they are the status of the
> corresponding pin

Okay! So if the controller doesn't fully support HW busy detection,
you should at least be able to implement the ->card_busy() host ops,
which is used to poll the DAT0 line for busy detection.

>
>> Of course you also need to try with and without
>> MMC_CAP_WAIT_WHILE_BUSY, as the core may sometimes convert R1B to R1
>> responses depending on that cap.
> so MESON_MX_SDIO_SEND_CHECK_DAT0_BUSY + MMC_CAP_WAIT_WHILE_BUSY should
> go together?
> and MESON_MX_SDIO_SEND_CHECK_DAT0_BUSY should not be set when
> MMC_CAP_WAIT_WHILE_BUSY isn't?

Yeah, something like that.

So if you controller fully supports HW busy detection, the driver
should set MMC_CAP_WAIT_WHILE_BUSY and then act accordingly when R1B
responses are expected.

[...]

Kind regards
Uffe

  reply	other threads:[~2017-07-12 13:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-06 17:18 [RFC 0/2] Add support for Meson MX "SDIO" MMC driver Martin Blumenstingl
2017-05-06 17:18 ` [RFC 1/2] dt-bindings: mmc: Document the Amlogic Meson8 and Meson8b SDIO bindings Martin Blumenstingl
2017-05-12 19:05   ` Rob Herring
2017-05-29 10:04   ` Ulf Hansson
2017-05-06 17:18 ` [RFC 2/2] mmc: meson-mx-sdio: Add a driver for the Amlogic Meson8 and Meson8b SoCs Martin Blumenstingl
2017-05-07 20:25   ` Martin Blumenstingl
2017-05-29 14:38   ` Ulf Hansson
2017-06-03 16:37     ` Martin Blumenstingl
2017-06-07 16:15       ` Ulf Hansson
2017-06-09 21:51         ` Martin Blumenstingl
2017-06-19 11:50           ` Ulf Hansson
2017-07-11 21:23             ` Martin Blumenstingl
2017-07-12 13:42               ` Ulf Hansson [this message]
2017-07-18 11:17                 ` Martin Blumenstingl
2017-05-10  8:44 ` [RFC 0/2] Add support for Meson MX "SDIO" MMC driver Ulf Hansson
2017-05-10 19:22   ` Martin Blumenstingl
2017-05-11  9:39     ` Ulf Hansson
2017-05-11 20:44       ` Martin Blumenstingl
2017-05-24 20:37         ` Martin Blumenstingl
2017-05-27  2:48         ` Daniel Drake
2017-05-27 14:25           ` Martin Blumenstingl

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='CAPDyKFoKaT_3MVF7SrS8bVm7iG=y6K+-R1+YNj=9bTS6qNrcug@mail.gmail.com' \
    --to=ulf.hansson@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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).