From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] ARM: shmobile: silk: add SDHI1 DT support
Date: Tue, 06 Oct 2015 20:12:51 +0000 [thread overview]
Message-ID: <56142B43.5090800@cogentembedded.com> (raw)
In-Reply-To: <CANqRtoT40KiX8RQdmCfTu2z4_1H9UH+Kmoe_yOAjZS-hrqssRg@mail.gmail.com>
Hello.
Sorry for tyhe long delay, I've been busy with other things. Now I'm
dealing with SDHI again, this time for the Porter board.
On 09/29/2015 11:44 AM, Magnus Damm wrote:
>>>>>>>>>> Define the SILK board dependent part of the SDHI1 (connected to
>>>>>>>>>> micro-SD slot)
>>>>>>>>>> device nodes along with the necessary voltage regulators.
>>>>>>>>>>
>>>>>>>>>> Based on the original patch by Vladimir Barinov
>>>>>>>>>> <vladimir.barinov@cogentembedded.com>.
>>>>>>>>>>
>>>>>>>>>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>>>>>>>>>>
>>>>>>>>>> ---
>>>>>>>>>> This patch is against 'renesas-devel-20150810-v4.2-rc6' tag of
>>>>>>>>>> Simon Horman's
>>>>>>>>>> 'renesas.git' repo plus the R8A7794/SILK QSPI patches just
>>>>>>>>>> re-posted. It needs
>>>>>>>>>> the R8A7794 GPIO patches in order to compile.
>>>>>>>>>>
>>>>>>>>>> Changes in version 2:
>>>>>>>>>> - removed not working SDHI0 stuff, renamed the patch;
>>>>>>>>>> - replaced SDHI1's "wp-gpios" property with "disable-wp".
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I am wondering if you could explain the motivation for the
>>>>>>>>> "disable-wp"
>>>>>>>>> update
>>>>>>>>
>>>>>>>>
>>>>>>>> Please see the comment in mmc_sd_get_ro().
>>>>>>>>
>>>>>>>>> and weather it is appropriate for other r8a779* dts files.
>>>>>>>>
>>>>>>>>
>>>>>>>> In case of micro-SD slots, yes.
>>>>>>>
>>>>>>>
>>>>>>> The MMC binding document says it should only be specified if the
>>>>>>> controller has WP detection logic. We, so far, seem to have been
>>>>>>> replying on
>>>>>>> the GPIOs despite this logic is present (according to the R-Car gen2
>>>>>>> SDHI
>>>>>>> manuals I have). The driver will first call mmc_gpio_get_ro() and when
>>>>>>> that
>>>>>>> fails due to "wp-gpios" not being specified, it proceeds to reading
>>>>>>> the
>>>>>>> register but that is forbidden by TMIO_MMC_WRPROTECT_DISABLE flag set
>>>>>>> for
>>>>>>> the R-Car gen1/2 chips, so 0 is always returned from
>>>>>>> tmio_mmc_get_ro().
>>>>>>> There seems to be no point in going that far (and doing the runtime PM
>>>>>>> dances) --
>>>>>
>>>>>
>>>>> Alternatively, the driver could be fixed to check the flag before
>>>>> the RPM
>>>>> call unlike what it does now.
>>>>
>>>>
>>>> If the driver can be updated to do the right thing then that seems
>>>> preferable to me. If so would it be the case that the presence of the
>>>> "disable-wp" property would not have any run-time effect?
>>>>>
>>>>>
>>>>>>> and MMC_CAP2_NO_WRITE_PROTECT (set when "disable-wp" is specified)
>>>>>>> prohibits
>>>>>>> doing that...
>>>>>>
>>>>>>
>>>>>> That sounds reasonable to me.
>>>>>
>>>>>
>>>>> I'm still wondering why TMIO_MMC_WRPROTECT_DISABLE is set for the
>>>>> R-Car
>>>>> SoCs. Morimoto-san, any comments? Your change logs are too terse. :-)
>>>>
>>>>
>>>> I will follow up on this.
>>
>>
>> [...]
>>>
>>> Now what is the issue that you guys are having?
>>
>>
>> My main issue is that I don't understand why checking the write protect
>> bit is always prohibited for the R-Car SoCs (by setting
>> TMIO_MMC_WRPROTECT_DISABLE), i.e. it can only be read via GPIO (though that
>> GPIO is just an alias of the WP signal).
> I believe the reason is that we decided to keep it simple - so we
> preferred to use GPIO instead of native SDHI signals. So GPIO WP
> instead of the not-always-present SDHI WP signal. Historically CD and
> WP may on some boards be routed on different pins than the SDHI CD and
> WP lines, and if we support both GPIO and native SDHI signals we need
> to handle both cases.
If you look at the driver code, it's already capable of handling both cases.
> With GPIO there is only one case to handle. And
> it is not exactly hot path to handle WP and CD so the overhead must be
> minimal.
[...]
> The on-chip SoC SDHI devices in DT and the driver on R-Car Gen2
> assumes no WP and CD signals by default. It is up to each board to
> opt-in to add the GPIOs for WP and CD. It is very simple and should
> make it possible to power down the SDHI instances if no cards are
> inserted and let the GPIO IRQ wake up things for us.
Again, if you look at the driver code, it first powers up the controller,
(thru runtime PM) and only then checks the TMIO_MMC_WRPROTECT_DISABLE flag.
That's what I tried to change but didn't succeed because the current MMC code
will have already powered up the controller by that time.
> I still don't understand what the real problem is though...
The original issue revolved around the "disable-wp" prop. The common MMC
bindings say that this prop should only be used "when the controller has a
dedicated write-protect detection logic". This logic is obviously present but
its use seems suppressed on the R-Car SoCs by the infamous flag... :-)
> Thanks,
>
> / magnus
MBR, Sergei
next prev parent reply other threads:[~2015-10-06 20:12 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-21 22:25 [PATCH 0/2] Add R8A7794/SILK board SDHI DT support Sergei Shtylyov
2015-02-21 22:26 ` [PATCH 1/2] ARM: shmobile: r8a7794: add " Sergei Shtylyov
2015-02-23 0:28 ` Kuninori Morimoto
2015-02-23 11:18 ` Geert Uytterhoeven
2015-02-23 11:16 ` Geert Uytterhoeven
2015-02-23 22:00 ` Simon Horman
2015-02-21 22:27 ` [PATCH 2/2] ARM: shmobile: silk: add SDHI0/1 " Sergei Shtylyov
2015-02-22 0:45 ` Magnus Damm
2015-02-22 14:54 ` Sergei Shtylyov
2015-02-23 22:01 ` Simon Horman
2015-02-24 4:28 ` Magnus Damm
2015-08-10 22:44 ` [PATCH v2] ARM: shmobile: silk: add SDHI1 " Sergei Shtylyov
2015-08-12 1:26 ` Simon Horman
2015-08-21 20:57 ` Sergei Shtylyov
2015-08-21 22:18 ` Sergei Shtylyov
2015-09-02 2:29 ` Simon Horman
2015-09-04 23:47 ` Sergei Shtylyov
2015-09-18 0:21 ` Simon Horman
2015-09-18 2:56 ` Magnus Damm
2015-09-22 23:19 ` Sergei Shtylyov
2015-09-29 8:44 ` Magnus Damm
2015-10-06 20:12 ` Sergei Shtylyov [this message]
2015-09-22 23:22 ` Sergei Shtylyov
2015-08-13 22:47 ` Sergei Shtylyov
2015-10-16 21:37 ` Sergei Shtylyov
2015-10-18 11:04 ` Sergei Shtylyov
2015-10-19 0:46 ` Simon Horman
2015-10-20 17:58 ` Sergei Shtylyov
2015-10-21 0:31 ` Simon Horman
2015-10-21 18:13 ` Sergei Shtylyov
2015-10-22 0:54 ` Simon Horman
2015-10-21 23:04 ` [PATCH 1/2] ARM: shmobile: r8a7790: fix "gpio-ranges" props Sergei Shtylyov
2015-10-23 0:19 ` Simon Horman
2015-10-21 23:05 ` [PATCH 2/2] ARM: shmobile: r8a7791: " Sergei Shtylyov
2015-10-22 11:06 ` Geert Uytterhoeven
2015-10-23 0:20 ` Simon Horman
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=56142B43.5090800@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--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).