linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Mike Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	linux-clk <linux-clk@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Ziji Hu <huziji@marvell.com>, Jimmy Xu <zmxu@marvell.com>,
	Jisheng Zhang <jszhang@marvell.com>,
	Nadav Haklai <nadavh@marvell.com>, Ryan Gao <ygao@marvell.com>,
	Doug Jones <dougj@marvell.com>, Victor Gu <xigu@marvell.com>,
	"Wei(SOCP) Liu" <liuw@marvell.com>,
	Wilson Ding <dingwei@marvell.com>,
	Yehuda Yitschak <yehuday@marvell.com>,
	Marcin Wojtas <mw@semihalf.com>, Hanna Hawa <hannah@marvell.com>,
	Kostya Porotchkin <kostap@marvell.com>
Subject: Re: [PATCH v5 06/12] mmc: sdhci-xenon: Add Marvell Xenon SDHC core functionality
Date: Mon, 30 Jan 2017 11:15:20 +0100	[thread overview]
Message-ID: <CAPDyKFrQ15bLCApOdf8BXUyyjcxQehqP=aW1hM=NKfwYmcCYOw@mail.gmail.com> (raw)
In-Reply-To: <1f0cc488-75f0-cff3-1386-070717aa7220@intel.com>

On 30 January 2017 at 10:40, Adrian Hunter <adrian.hunter@intel.com> wrote:
> On 30/01/17 11:10, Ulf Hansson wrote:
>> On 28 January 2017 at 09:16, Adrian Hunter <adrian.hunter@intel.com> wrote:
>>> On 27/01/2017 5:12 p.m., Ulf Hansson wrote:
>>>>
>>>> On 26 January 2017 at 13:39, Adrian Hunter <adrian.hunter@intel.com>
>>>> wrote:
>>>>>
>>>>> On 26/01/17 12:50, Ulf Hansson wrote:
>>>>>>
>>>>>> On 11 January 2017 at 18:19, Gregory CLEMENT
>>>>>> <gregory.clement@free-electrons.com> wrote:
>>>>>>>
>>>>>>> +                       priv->init_card_type = MMC_TYPE_MMC;
>>>>>>> +                       mmc->caps |= MMC_CAP_NONREMOVABLE;
>>>>>>> +
>>>>>>> +                       /*
>>>>>>> +                        * Force to clear BUS_TEST to
>>>>>>> +                        * skip bus_test_pre and bus_test_post
>>>>>>> +                        */
>>>>>>> +                       mmc->caps &= ~MMC_CAP_BUS_WIDTH_TEST;
>>>>>>> +                       mmc->caps2 |= MMC_CAP2_HC_ERASE_SZ |
>>>>>>
>>>>>>
>>>>>> This cap is a bit strange. It was added several years ago by Adrian
>>>>>> Hunter, but I am wondering about the reason to why it's needed.
>>>>>>
>>>>>
>>>>> MMC_CAP2_HC_ERASE_SZ relates to EXT-CSD ERASE_GROUP_DEF.
>>>>>
>>>>> I think it was added to enable people to choose whether they wanted a
>>>>> large
>>>>> or small erase granularity.  That probably doesn't matter if the card
>>>>> supports TRIM.
>>>>>
>>>>
>>>> Huh, the erase/trim/discard code in the mmc core is really hairy. :-)
>>>>
>>>> In mmc_calc_max_discard() the following code/comment exists:
>>>>
>>>> /*
>>>>  * Without erase_group_def set, MMC erase timeout depends on clock
>>>>  * frequence which can change.  In that case, the best choice is
>>>>  * just the preferred erase size.
>>>>  */
>>>> if (mmc_card_mmc(card) && !(card->ext_csd.erase_group_def & 1))
>>>>      return card->pref_erase;
>>>>
>>>>
>>>> This makes me wonder.
>>>>
>>>> So, when we haven't enabled the high capacity erase groups in the
>>>> EXT_CSD register (ext_csd.erase_group_def), we will use the pref_erase
>>>> size.
>>>>
>>>> In the other case, as when having MMC_CAP2_HC_ERASE_SZ set (which will
>>>> set ext_csd.erase_group_def),  we will instead  do some calculations
>>>> to find out the max discards.
>>>>
>>>> Are you saying that these calculations doesn't matter much - or are
>>>> you saying that we always want to do them?
>>>
>>>
>>> No, I was saying that if you have TRIM then TRIM is preferred to ERASE so
>>> the erase group size does not come into play when discarding, since ERASE
>>> granularity is erase groups whereas TRIM granularity is sectors.
>>
>> Right. Thanks for clarifying.
>>
>>>
>>> However ERASE_GROUP_DEF also affects the size of write protect groups.
>>
>> In either case.
>>
>> What do you think of removing MMC_CAP2_HC_ERASE_SZ? I don't like these
>> kind of soft polices, it's better if we can decide on a common
>> behaviour - whatever that is.
>
> Changing the value of ERASE_GROUP_DEF could be a problem, for example the
> spec. says:
>
> "Similarly if the host set ERASE_GROUP_DEF bit for a device that the default
> write protect was already set in some of the area in the previous power
> cycle, then the device may show unknown behavior when host issue write
> or erase commands to the device. In application, it is mandatory for host to
> use same ERASE GROUP DEF value to the device all the time."
>
> Whether or not there is anyone that would actually be affected is hard to know.

Okay. I am going to submit a patch that just removes the behaviour for
MMC_CAP2_HC_ERASE_SZ and the cap itself.

The cap isn't particular widely used anyway. Let's see what people think of it.

Thanks a lot for you input!

Kind regards
Uffe

  reply	other threads:[~2017-01-30 10:18 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-11 17:19 [PATCH v5 00/12] mmc: Add support to Marvell Xenon SD Host Controller Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 01/12] clk: apn806: Add eMMC clock to system controller driver Gregory CLEMENT
2017-01-21  0:16   ` Stephen Boyd
2017-01-11 17:19 ` [PATCH v5 02/12] mmc: sdhci: Export sdhci_set_ios() from sdhci.c Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 03/12] mmc: sdhci: Export sdhci_start_signal_voltage_switch() in sdhci.c Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 04/12] mmc: sdhci: Export sdhci_enable_sdio_irq() from sdhci.c Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 05/12] dt: bindings: Add bindings for Marvell Xenon SD Host Controller Gregory CLEMENT
2017-01-13 20:16   ` Rob Herring
2017-01-26 10:49   ` Ulf Hansson
2017-01-27 10:04     ` Gregory CLEMENT
2017-01-27 15:36       ` Ulf Hansson
2017-01-27 17:25         ` Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 06/12] mmc: sdhci-xenon: Add Marvell Xenon SDHC core functionality Gregory CLEMENT
2017-01-26 10:50   ` Ulf Hansson
2017-01-26 12:39     ` Adrian Hunter
2017-01-27 15:12       ` Ulf Hansson
2017-01-28  8:16         ` Adrian Hunter
2017-01-30  9:10           ` Ulf Hansson
2017-01-30  9:40             ` Adrian Hunter
2017-01-30 10:15               ` Ulf Hansson [this message]
2017-01-27 16:39     ` Ziji Hu
2017-01-30  8:41       ` Ulf Hansson
2017-01-30 15:12         ` Ziji Hu
2017-01-11 17:19 ` [PATCH v5 07/12] mmc: sdhci-xenon: Add support to PHYs of Marvell Xenon SDHC Gregory CLEMENT
2017-01-26 11:29   ` Ulf Hansson
2017-01-27 17:10     ` Ziji Hu
2017-01-11 17:19 ` [PATCH v5 08/12] mmc: sdhci-xenon: Add SoC PHY PAD voltage control Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 09/12] MAINTAINERS: add entry for Marvell Xenon MMC Host Controller drivers Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 10/12] arm64: dts: marvell: add eMMC support for Armada 37xx Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 11/12] arm64: dts: marvell: add sdhci support for Armada 7K/8K Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 12/12] arm64: configs: enable SDHCI driver for Xenon Gregory CLEMENT

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='CAPDyKFrQ15bLCApOdf8BXUyyjcxQehqP=aW1hM=NKfwYmcCYOw@mail.gmail.com' \
    --to=ulf.hansson@linaro.org \
    --cc=adrian.hunter@intel.com \
    --cc=andrew@lunn.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dingwei@marvell.com \
    --cc=dougj@marvell.com \
    --cc=gregory.clement@free-electrons.com \
    --cc=hannah@marvell.com \
    --cc=huziji@marvell.com \
    --cc=jason@lakedaemon.net \
    --cc=jszhang@marvell.com \
    --cc=kostap@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=liuw@marvell.com \
    --cc=mturquette@baylibre.com \
    --cc=mw@semihalf.com \
    --cc=nadavh@marvell.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=xigu@marvell.com \
    --cc=yehuday@marvell.com \
    --cc=ygao@marvell.com \
    --cc=zmxu@marvell.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 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).