* [PATCH] dw-mmc: enable trim in eMMC device
@ 2014-02-07 18:39 Puthikorn Voravootivat
2014-02-10 4:07 ` Jaehoon Chung
2014-02-10 22:54 ` [PATCH v2] mmc: " Puthikorn Voravootivat
0 siblings, 2 replies; 7+ messages in thread
From: Puthikorn Voravootivat @ 2014-02-07 18:39 UTC (permalink / raw)
To: Chris Ball, Seungwon Jeon
Cc: MMC list, Gwendal Grignou, Grant Grundler, Puthikorn Voravootivat
Force host to have erase capacity to enable trim or
discard feature in supported eMMC device.
Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
---
In mmc_init_queue() before setting up the discard function, mmc driver
will call mmc_can_erase() which will always return 0 because the host
erase capacity is not set anywhere. So to enable discard function, we
need to add erase capacity to the host.
drivers/mmc/host/dw_mmc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 55cd110..f47f1c1 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -55,6 +55,8 @@
#define DW_MCI_FREQ_MAX 200000000 /* unit: HZ */
#define DW_MCI_FREQ_MIN 400000 /* unit: HZ */
+#define DW_MCI_DEFAULT_CAPS (MMC_CAP_ERASE)
+
#ifdef CONFIG_MMC_DW_IDMAC
#define IDMAC_INT_CLR (SDMMC_IDMAC_INT_AI | SDMMC_IDMAC_INT_NI | \
SDMMC_IDMAC_INT_CES | SDMMC_IDMAC_INT_DU | \
@@ -2371,6 +2373,8 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
return ERR_PTR(-ENOMEM);
}
+ pdata->caps |= DW_MCI_DEFAULT_CAPS;
+
/* find out number of slots supported */
if (of_property_read_u32(dev->of_node, "num-slots",
&pdata->num_slots)) {
--
1.9.0.rc1.175.g0b1dcb5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] dw-mmc: enable trim in eMMC device
2014-02-07 18:39 [PATCH] dw-mmc: enable trim in eMMC device Puthikorn Voravootivat
@ 2014-02-10 4:07 ` Jaehoon Chung
2014-02-10 9:41 ` Ulf Hansson
2014-02-10 22:54 ` [PATCH v2] mmc: " Puthikorn Voravootivat
1 sibling, 1 reply; 7+ messages in thread
From: Jaehoon Chung @ 2014-02-10 4:07 UTC (permalink / raw)
To: Puthikorn Voravootivat, Chris Ball, Seungwon Jeon
Cc: MMC list, Gwendal Grignou, Grant Grundler
Hi,
On 02/08/2014 03:39 AM, Puthikorn Voravootivat wrote:
> Force host to have erase capacity to enable trim or
> discard feature in supported eMMC device.
>
> Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
> ---
> In mmc_init_queue() before setting up the discard function, mmc driver
> will call mmc_can_erase() which will always return 0 because the host
> erase capacity is not set anywhere. So to enable discard function, we
> need to add erase capacity to the host.
>
> drivers/mmc/host/dw_mmc.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 55cd110..f47f1c1 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -55,6 +55,8 @@
> #define DW_MCI_FREQ_MAX 200000000 /* unit: HZ */
> #define DW_MCI_FREQ_MIN 400000 /* unit: HZ */
>
> +#define DW_MCI_DEFAULT_CAPS (MMC_CAP_ERASE)
> +
This define didn't need.
> #ifdef CONFIG_MMC_DW_IDMAC
> #define IDMAC_INT_CLR (SDMMC_IDMAC_INT_AI | SDMMC_IDMAC_INT_NI | \
> SDMMC_IDMAC_INT_CES | SDMMC_IDMAC_INT_DU | \
> @@ -2371,6 +2373,8 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
> return ERR_PTR(-ENOMEM);
> }
>
> + pdata->caps |= DW_MCI_DEFAULT_CAPS;
> +
I didn't want to enable by default. If it's possible, how about using dt-file?
Well, if need to enable by default, just use the "pdata->caps |= MMC_CAPS_ERASE;"
Best Regards,
Jaehoon Chung
> /* find out number of slots supported */
> if (of_property_read_u32(dev->of_node, "num-slots",
> &pdata->num_slots)) {
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dw-mmc: enable trim in eMMC device
2014-02-10 4:07 ` Jaehoon Chung
@ 2014-02-10 9:41 ` Ulf Hansson
2014-02-10 9:53 ` Jaehoon Chung
0 siblings, 1 reply; 7+ messages in thread
From: Ulf Hansson @ 2014-02-10 9:41 UTC (permalink / raw)
To: Jaehoon Chung, Puthikorn Voravootivat
Cc: Chris Ball, Seungwon Jeon, MMC list, Gwendal Grignou,
Grant Grundler
On 10 February 2014 05:07, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> Hi,
>
> On 02/08/2014 03:39 AM, Puthikorn Voravootivat wrote:
>> Force host to have erase capacity to enable trim or
>> discard feature in supported eMMC device.
>>
>> Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
>> ---
>> In mmc_init_queue() before setting up the discard function, mmc driver
>> will call mmc_can_erase() which will always return 0 because the host
>> erase capacity is not set anywhere. So to enable discard function, we
>> need to add erase capacity to the host.
>>
>> drivers/mmc/host/dw_mmc.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
>> index 55cd110..f47f1c1 100644
>> --- a/drivers/mmc/host/dw_mmc.c
>> +++ b/drivers/mmc/host/dw_mmc.c
>> @@ -55,6 +55,8 @@
>> #define DW_MCI_FREQ_MAX 200000000 /* unit: HZ */
>> #define DW_MCI_FREQ_MIN 400000 /* unit: HZ */
>>
>> +#define DW_MCI_DEFAULT_CAPS (MMC_CAP_ERASE)
>> +
>
> This define didn't need.
>
>> #ifdef CONFIG_MMC_DW_IDMAC
>> #define IDMAC_INT_CLR (SDMMC_IDMAC_INT_AI | SDMMC_IDMAC_INT_NI | \
>> SDMMC_IDMAC_INT_CES | SDMMC_IDMAC_INT_DU | \
>> @@ -2371,6 +2373,8 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
>> return ERR_PTR(-ENOMEM);
>> }
>>
>> + pdata->caps |= DW_MCI_DEFAULT_CAPS;
>> +
> I didn't want to enable by default. If it's possible, how about using dt-file?
> Well, if need to enable by default, just use the "pdata->caps |= MMC_CAPS_ERASE;"
Why not push this one step further; remove MMC_CAPS_ERASE and make it
default enabled for all hosts?
Kind regards
Ulf Hansson
>
> Best Regards,
> Jaehoon Chung
>> /* find out number of slots supported */
>> if (of_property_read_u32(dev->of_node, "num-slots",
>> &pdata->num_slots)) {
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dw-mmc: enable trim in eMMC device
2014-02-10 9:41 ` Ulf Hansson
@ 2014-02-10 9:53 ` Jaehoon Chung
2014-02-10 19:53 ` Puthikorn Voravootivat
0 siblings, 1 reply; 7+ messages in thread
From: Jaehoon Chung @ 2014-02-10 9:53 UTC (permalink / raw)
To: Ulf Hansson, Jaehoon Chung, Puthikorn Voravootivat
Cc: Chris Ball, Seungwon Jeon, MMC list, Gwendal Grignou,
Grant Grundler
On 02/10/2014 06:41 PM, Ulf Hansson wrote:
> On 10 February 2014 05:07, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>> Hi,
>>
>> On 02/08/2014 03:39 AM, Puthikorn Voravootivat wrote:
>>> Force host to have erase capacity to enable trim or
>>> discard feature in supported eMMC device.
>>>
>>> Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
>>> ---
>>> In mmc_init_queue() before setting up the discard function, mmc driver
>>> will call mmc_can_erase() which will always return 0 because the host
>>> erase capacity is not set anywhere. So to enable discard function, we
>>> need to add erase capacity to the host.
>>>
>>> drivers/mmc/host/dw_mmc.c | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>>
>>> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
>>> index 55cd110..f47f1c1 100644
>>> --- a/drivers/mmc/host/dw_mmc.c
>>> +++ b/drivers/mmc/host/dw_mmc.c
>>> @@ -55,6 +55,8 @@
>>> #define DW_MCI_FREQ_MAX 200000000 /* unit: HZ */
>>> #define DW_MCI_FREQ_MIN 400000 /* unit: HZ */
>>>
>>> +#define DW_MCI_DEFAULT_CAPS (MMC_CAP_ERASE)
>>> +
>>
>> This define didn't need.
>>
>>> #ifdef CONFIG_MMC_DW_IDMAC
>>> #define IDMAC_INT_CLR (SDMMC_IDMAC_INT_AI | SDMMC_IDMAC_INT_NI | \
>>> SDMMC_IDMAC_INT_CES | SDMMC_IDMAC_INT_DU | \
>>> @@ -2371,6 +2373,8 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
>>> return ERR_PTR(-ENOMEM);
>>> }
>>>
>>> + pdata->caps |= DW_MCI_DEFAULT_CAPS;
>>> +
>> I didn't want to enable by default. If it's possible, how about using dt-file?
>> Well, if need to enable by default, just use the "pdata->caps |= MMC_CAPS_ERASE;"
>
> Why not push this one step further; remove MMC_CAPS_ERASE and make it
> default enabled for all hosts?
I think more better that All host used the MMC_CAP_ERASE by default, than this patch.
Best Regards,
Jaehoon Chung
>
> Kind regards
> Ulf Hansson
>
>>
>> Best Regards,
>> Jaehoon Chung
>>> /* find out number of slots supported */
>>> if (of_property_read_u32(dev->of_node, "num-slots",
>>> &pdata->num_slots)) {
>>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dw-mmc: enable trim in eMMC device
2014-02-10 9:53 ` Jaehoon Chung
@ 2014-02-10 19:53 ` Puthikorn Voravootivat
0 siblings, 0 replies; 7+ messages in thread
From: Puthikorn Voravootivat @ 2014-02-10 19:53 UTC (permalink / raw)
To: Jaehoon Chung
Cc: Ulf Hansson, Puthikorn Voravootivat, Chris Ball, Seungwon Jeon,
MMC list, Gwendal Grignou, Grant Grundler
OK, I will send a v2 patch to make MMC_CAP_ERASE default enabled for all host.
Best Regards,
Puthikorn Voravootivat
On Mon, Feb 10, 2014 at 1:53 AM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> On 02/10/2014 06:41 PM, Ulf Hansson wrote:
>> On 10 February 2014 05:07, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>>> Hi,
>>>
>>> On 02/08/2014 03:39 AM, Puthikorn Voravootivat wrote:
>>>> Force host to have erase capacity to enable trim or
>>>> discard feature in supported eMMC device.
>>>>
>>>> Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
>>>> ---
>>>> In mmc_init_queue() before setting up the discard function, mmc driver
>>>> will call mmc_can_erase() which will always return 0 because the host
>>>> erase capacity is not set anywhere. So to enable discard function, we
>>>> need to add erase capacity to the host.
>>>>
>>>> drivers/mmc/host/dw_mmc.c | 4 ++++
>>>> 1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
>>>> index 55cd110..f47f1c1 100644
>>>> --- a/drivers/mmc/host/dw_mmc.c
>>>> +++ b/drivers/mmc/host/dw_mmc.c
>>>> @@ -55,6 +55,8 @@
>>>> #define DW_MCI_FREQ_MAX 200000000 /* unit: HZ */
>>>> #define DW_MCI_FREQ_MIN 400000 /* unit: HZ */
>>>>
>>>> +#define DW_MCI_DEFAULT_CAPS (MMC_CAP_ERASE)
>>>> +
>>>
>>> This define didn't need.
>>>
>>>> #ifdef CONFIG_MMC_DW_IDMAC
>>>> #define IDMAC_INT_CLR (SDMMC_IDMAC_INT_AI | SDMMC_IDMAC_INT_NI | \
>>>> SDMMC_IDMAC_INT_CES | SDMMC_IDMAC_INT_DU | \
>>>> @@ -2371,6 +2373,8 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
>>>> return ERR_PTR(-ENOMEM);
>>>> }
>>>>
>>>> + pdata->caps |= DW_MCI_DEFAULT_CAPS;
>>>> +
>>> I didn't want to enable by default. If it's possible, how about using dt-file?
>>> Well, if need to enable by default, just use the "pdata->caps |= MMC_CAPS_ERASE;"
>>
>> Why not push this one step further; remove MMC_CAPS_ERASE and make it
>> default enabled for all hosts?
>
> I think more better that All host used the MMC_CAP_ERASE by default, than this patch.
>
> Best Regards,
> Jaehoon Chung
>
>>
>> Kind regards
>> Ulf Hansson
>>
>>>
>>> Best Regards,
>>> Jaehoon Chung
>>>> /* find out number of slots supported */
>>>> if (of_property_read_u32(dev->of_node, "num-slots",
>>>> &pdata->num_slots)) {
>>>>
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] mmc: enable trim in eMMC device
2014-02-07 18:39 [PATCH] dw-mmc: enable trim in eMMC device Puthikorn Voravootivat
2014-02-10 4:07 ` Jaehoon Chung
@ 2014-02-10 22:54 ` Puthikorn Voravootivat
2014-02-11 2:48 ` Jaehoon Chung
1 sibling, 1 reply; 7+ messages in thread
From: Puthikorn Voravootivat @ 2014-02-10 22:54 UTC (permalink / raw)
To: Chris Ball, Seungwon Jeon, Ulf Hansson
Cc: MMC list, Gwendal Grignou, Grant Grundler, Puthikorn Voravootivat
Force all host to have erase capacity to enable trim or
discard feature in supported eMMC device.
Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
---
V2 change:
Instead of add MMC_CAP_ERASE just only for dw_mmc, this patch adds
this capability to all host.
drivers/mmc/core/host.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 49bc403..a21f590 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -521,6 +521,8 @@ int mmc_add_host(struct mmc_host *host)
WARN_ON((host->caps & MMC_CAP_SDIO_IRQ) &&
!host->ops->enable_sdio_irq);
+ host->caps |= MMC_CAP_ERASE;
+
err = device_add(&host->class_dev);
if (err)
return err;
--
1.9.0.rc1.175.g0b1dcb5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] mmc: enable trim in eMMC device
2014-02-10 22:54 ` [PATCH v2] mmc: " Puthikorn Voravootivat
@ 2014-02-11 2:48 ` Jaehoon Chung
0 siblings, 0 replies; 7+ messages in thread
From: Jaehoon Chung @ 2014-02-11 2:48 UTC (permalink / raw)
To: Puthikorn Voravootivat, Chris Ball, Seungwon Jeon, Ulf Hansson
Cc: MMC list, Gwendal Grignou, Grant Grundler
As my understanding, if erase will be used by default, MMC_CAP_ERASE flags can be removed. isn't?
Best Regards,
Jaehoon Chung
On 02/11/2014 07:54 AM, Puthikorn Voravootivat wrote:
> Force all host to have erase capacity to enable trim or
> discard feature in supported eMMC device.
>
> Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
> ---
> V2 change:
> Instead of add MMC_CAP_ERASE just only for dw_mmc, this patch adds
> this capability to all host.
>
> drivers/mmc/core/host.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index 49bc403..a21f590 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -521,6 +521,8 @@ int mmc_add_host(struct mmc_host *host)
> WARN_ON((host->caps & MMC_CAP_SDIO_IRQ) &&
> !host->ops->enable_sdio_irq);
>
> + host->caps |= MMC_CAP_ERASE;
> +
> err = device_add(&host->class_dev);
> if (err)
> return err;
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-02-11 2:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-07 18:39 [PATCH] dw-mmc: enable trim in eMMC device Puthikorn Voravootivat
2014-02-10 4:07 ` Jaehoon Chung
2014-02-10 9:41 ` Ulf Hansson
2014-02-10 9:53 ` Jaehoon Chung
2014-02-10 19:53 ` Puthikorn Voravootivat
2014-02-10 22:54 ` [PATCH v2] mmc: " Puthikorn Voravootivat
2014-02-11 2:48 ` Jaehoon Chung
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).