diff mbox

mmc: dw_mmc-rockchip: fix failing to mount partition with "discard"

Message ID 1456816373-32518-1-git-send-email-shawn.lin@rock-chips.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shawn Lin March 1, 2016, 7:12 a.m. UTC
Without MMC_CAP_ERASE support, we fail to mount partition
with "discard" option since mmc_queue_setup_discard is limited
for checking mmc_can_erase. Without doing mmc_queue_setup_discard,
blk_queue_discard fails to test QUEUE_FLAG_DISCARD flag, so we get
the following log from f2fs(actually similar to other file system):

mounting with "discard" option, but the device does not support discard

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/mmc/host/dw_mmc-rockchip.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Jaehoon Chung March 2, 2016, 1:29 a.m. UTC | #1
Hi Shawn.

On 03/01/2016 04:12 PM, Shawn Lin wrote:
> Without MMC_CAP_ERASE support, we fail to mount partition
> with "discard" option since mmc_queue_setup_discard is limited
> for checking mmc_can_erase. Without doing mmc_queue_setup_discard,
> blk_queue_discard fails to test QUEUE_FLAG_DISCARD flag, so we get
> the following log from f2fs(actually similar to other file system):
> 
> mounting with "discard" option, but the device does not support discard

We can enable MMC_CAP_ERASE by default, since other SoC also needs this capability.
I had sent some patch for enabling by default, but at that time i didn't remember why not enabled by default.
I will check that reason..and share the information.

Best Regards,
Jaehoon Chung

> 
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> ---
> 
>  drivers/mmc/host/dw_mmc-rockchip.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
> index 84e50f3..2eda118 100644
> --- a/drivers/mmc/host/dw_mmc-rockchip.c
> +++ b/drivers/mmc/host/dw_mmc-rockchip.c
> @@ -234,11 +234,20 @@ static int dw_mci_rockchip_init(struct dw_mci *host)
>  	return 0;
>  }
>  
> +/* Common capabilities of RK3288 SoC */
> +static unsigned long dw_mci_rk3288_dwmmc_caps[4] = {
> +	MMC_CAP_ERASE,
> +	MMC_CAP_ERASE,
> +	MMC_CAP_ERASE,
> +	MMC_CAP_ERASE,
> +};
> +
>  static const struct dw_mci_drv_data rk2928_drv_data = {
>  	.init			= dw_mci_rockchip_init,
>  };
>  
>  static const struct dw_mci_drv_data rk3288_drv_data = {
> +	.caps			= dw_mci_rk3288_dwmmc_caps,
>  	.set_ios		= dw_mci_rk3288_set_ios,
>  	.execute_tuning		= dw_mci_rk3288_execute_tuning,
>  	.parse_dt		= dw_mci_rk3288_parse_dt,
>
Shawn Lin March 2, 2016, 1:46 a.m. UTC | #2
? 2016/3/2 9:29, Jaehoon Chung ??:
> Hi Shawn.
>
> On 03/01/2016 04:12 PM, Shawn Lin wrote:
>> Without MMC_CAP_ERASE support, we fail to mount partition
>> with "discard" option since mmc_queue_setup_discard is limited
>> for checking mmc_can_erase. Without doing mmc_queue_setup_discard,
>> blk_queue_discard fails to test QUEUE_FLAG_DISCARD flag, so we get
>> the following log from f2fs(actually similar to other file system):
>>
>> mounting with "discard" option, but the device does not support discard
>
> We can enable MMC_CAP_ERASE by default, since other SoC also needs this capability.
> I had sent some patch for enabling by default, but at that time i didn't remember why not enabled by default.
> I will check that reason..and share the information.

Hi Jaehoon,

Thanks for checking that. I didn't notice this part of code either until
I began to develop f2fs last month.
yes, I can't find any reasons not to enable it for dw_mmc because I look
more into dwmmc-databooks to see if any version of IP can't support
ERASE/TRIM command, and find none of them. So, enabling it by default is
safe.

>
> Best Regards,
> Jaehoon Chung
>
>>
>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>> ---
>>
>>   drivers/mmc/host/dw_mmc-rockchip.c | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
>> index 84e50f3..2eda118 100644
>> --- a/drivers/mmc/host/dw_mmc-rockchip.c
>> +++ b/drivers/mmc/host/dw_mmc-rockchip.c
>> @@ -234,11 +234,20 @@ static int dw_mci_rockchip_init(struct dw_mci *host)
>>   	return 0;
>>   }
>>
>> +/* Common capabilities of RK3288 SoC */
>> +static unsigned long dw_mci_rk3288_dwmmc_caps[4] = {
>> +	MMC_CAP_ERASE,
>> +	MMC_CAP_ERASE,
>> +	MMC_CAP_ERASE,
>> +	MMC_CAP_ERASE,
>> +};
>> +
>>   static const struct dw_mci_drv_data rk2928_drv_data = {
>>   	.init			= dw_mci_rockchip_init,
>>   };
>>
>>   static const struct dw_mci_drv_data rk3288_drv_data = {
>> +	.caps			= dw_mci_rk3288_dwmmc_caps,
>>   	.set_ios		= dw_mci_rk3288_set_ios,
>>   	.execute_tuning		= dw_mci_rk3288_execute_tuning,
>>   	.parse_dt		= dw_mci_rk3288_parse_dt,
>>
>
>
>
>
Shawn Lin March 17, 2016, 3:46 p.m. UTC | #3
Hi jaehoon,

On 2016/3/2 9:29, Jaehoon Chung wrote:
> Hi Shawn.
>
> On 03/01/2016 04:12 PM, Shawn Lin wrote:
>> Without MMC_CAP_ERASE support, we fail to mount partition
>> with "discard" option since mmc_queue_setup_discard is limited
>> for checking mmc_can_erase. Without doing mmc_queue_setup_discard,
>> blk_queue_discard fails to test QUEUE_FLAG_DISCARD flag, so we get
>> the following log from f2fs(actually similar to other file system):
>>
>> mounting with "discard" option, but the device does not support discard
>
> We can enable MMC_CAP_ERASE by default, since other SoC also needs this capability.
> I had sent some patch for enabling by default, but at that time i didn't remember why not enabled by default.
> I will check that reason..and share the information.
>

Any good news? :)
Or let add it for dw_mmc by default?

> Best Regards,
> Jaehoon Chung
>
>>
>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>> ---
>>
>>   drivers/mmc/host/dw_mmc-rockchip.c | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
>> index 84e50f3..2eda118 100644
>> --- a/drivers/mmc/host/dw_mmc-rockchip.c
>> +++ b/drivers/mmc/host/dw_mmc-rockchip.c
>> @@ -234,11 +234,20 @@ static int dw_mci_rockchip_init(struct dw_mci *host)
>>   	return 0;
>>   }
>>
>> +/* Common capabilities of RK3288 SoC */
>> +static unsigned long dw_mci_rk3288_dwmmc_caps[4] = {
>> +	MMC_CAP_ERASE,
>> +	MMC_CAP_ERASE,
>> +	MMC_CAP_ERASE,
>> +	MMC_CAP_ERASE,
>> +};
>> +
>>   static const struct dw_mci_drv_data rk2928_drv_data = {
>>   	.init			= dw_mci_rockchip_init,
>>   };
>>
>>   static const struct dw_mci_drv_data rk3288_drv_data = {
>> +	.caps			= dw_mci_rk3288_dwmmc_caps,
>>   	.set_ios		= dw_mci_rk3288_set_ios,
>>   	.execute_tuning		= dw_mci_rk3288_execute_tuning,
>>   	.parse_dt		= dw_mci_rk3288_parse_dt,
>>
>
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
>
Jaehoon Chung March 18, 2016, 1:47 a.m. UTC | #4
Hi Shawn,

On 03/18/2016 12:46 AM, Shawn Lin wrote:
> Hi jaehoon,
> 
> On 2016/3/2 9:29, Jaehoon Chung wrote:
>> Hi Shawn.
>>
>> On 03/01/2016 04:12 PM, Shawn Lin wrote:
>>> Without MMC_CAP_ERASE support, we fail to mount partition
>>> with "discard" option since mmc_queue_setup_discard is limited
>>> for checking mmc_can_erase. Without doing mmc_queue_setup_discard,
>>> blk_queue_discard fails to test QUEUE_FLAG_DISCARD flag, so we get
>>> the following log from f2fs(actually similar to other file system):
>>>
>>> mounting with "discard" option, but the device does not support discard
>>
>> We can enable MMC_CAP_ERASE by default, since other SoC also needs this capability.
>> I had sent some patch for enabling by default, but at that time i didn't remember why not enabled by default.
>> I will check that reason..and share the information.
>>
> 
> Any good news? :)
> Or let add it for dw_mmc by default?

Sorry for replying too late..I had other tasks..:(
Today or Tomorrow, i will apply the patches related with dw-mmcc controller.
And will request to pull to Ulf.

I didn't check...but i think this patch will be applied on dw_mmc-rockchip.
After then..we can use it by default in future.

Refer to below.
https://patchwork.kernel.org/patch/4240491/

Best Regards,
Jaehoon Chung

> 
>> Best Regards,
>> Jaehoon Chung
>>
>>>
>>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>>> ---
>>>
>>>   drivers/mmc/host/dw_mmc-rockchip.c | 9 +++++++++
>>>   1 file changed, 9 insertions(+)
>>>
>>> diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
>>> index 84e50f3..2eda118 100644
>>> --- a/drivers/mmc/host/dw_mmc-rockchip.c
>>> +++ b/drivers/mmc/host/dw_mmc-rockchip.c
>>> @@ -234,11 +234,20 @@ static int dw_mci_rockchip_init(struct dw_mci *host)
>>>       return 0;
>>>   }
>>>
>>> +/* Common capabilities of RK3288 SoC */
>>> +static unsigned long dw_mci_rk3288_dwmmc_caps[4] = {
>>> +    MMC_CAP_ERASE,
>>> +    MMC_CAP_ERASE,
>>> +    MMC_CAP_ERASE,
>>> +    MMC_CAP_ERASE,
>>> +};
>>> +
>>>   static const struct dw_mci_drv_data rk2928_drv_data = {
>>>       .init            = dw_mci_rockchip_init,
>>>   };
>>>
>>>   static const struct dw_mci_drv_data rk3288_drv_data = {
>>> +    .caps            = dw_mci_rk3288_dwmmc_caps,
>>>       .set_ios        = dw_mci_rk3288_set_ios,
>>>       .execute_tuning        = dw_mci_rk3288_execute_tuning,
>>>       .parse_dt        = dw_mci_rk3288_parse_dt,
>>>
>>
>>
>> _______________________________________________
>> Linux-rockchip mailing list
>> Linux-rockchip@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-rockchip
>>
> 
>
Shawn Lin March 18, 2016, 4:46 a.m. UTC | #5
Hi Jaehoon,

On 2016-3-18 9:47, Jaehoon Chung wrote:
> Hi Shawn,
>
> On 03/18/2016 12:46 AM, Shawn Lin wrote:
>> Hi jaehoon,
>>
>> On 2016/3/2 9:29, Jaehoon Chung wrote:
>>> Hi Shawn.
>>>
>>> On 03/01/2016 04:12 PM, Shawn Lin wrote:
>>>> Without MMC_CAP_ERASE support, we fail to mount partition
>>>> with "discard" option since mmc_queue_setup_discard is limited
>>>> for checking mmc_can_erase. Without doing mmc_queue_setup_discard,
>>>> blk_queue_discard fails to test QUEUE_FLAG_DISCARD flag, so we get
>>>> the following log from f2fs(actually similar to other file system):
>>>>
>>>> mounting with "discard" option, but the device does not support discard
>>>
>>> We can enable MMC_CAP_ERASE by default, since other SoC also needs this capability.
>>> I had sent some patch for enabling by default, but at that time i didn't remember why not enabled by default.
>>> I will check that reason..and share the information.
>>>
>>
>> Any good news? :)
>> Or let add it for dw_mmc by default?
>
> Sorry for replying too late..I had other tasks..:(
> Today or Tomorrow, i will apply the patches related with dw-mmcc controller.
> And will request to pull to Ulf.
>
> I didn't check...but i think this patch will be applied on dw_mmc-rockchip.
> After then..we can use it by default in future.
>

Thanks. That's a good plan.

> Refer to below.
> https://patchwork.kernel.org/patch/4240491/

yes, I also found this patch and it was not merge yet.
So we still need MMC_CAP_ERASE to make sure we can enable
discard unless the cap is removed in future.


>
> Best Regards,
> Jaehoon Chung
>
>>
>>> Best Regards,
>>> Jaehoon Chung
>>>
>>>>
>>>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>>>> ---
>>>>
>>>>    drivers/mmc/host/dw_mmc-rockchip.c | 9 +++++++++
>>>>    1 file changed, 9 insertions(+)
>>>>
>>>> diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
>>>> index 84e50f3..2eda118 100644
>>>> --- a/drivers/mmc/host/dw_mmc-rockchip.c
>>>> +++ b/drivers/mmc/host/dw_mmc-rockchip.c
>>>> @@ -234,11 +234,20 @@ static int dw_mci_rockchip_init(struct dw_mci *host)
>>>>        return 0;
>>>>    }
>>>>
>>>> +/* Common capabilities of RK3288 SoC */
>>>> +static unsigned long dw_mci_rk3288_dwmmc_caps[4] = {
>>>> +    MMC_CAP_ERASE,
>>>> +    MMC_CAP_ERASE,
>>>> +    MMC_CAP_ERASE,
>>>> +    MMC_CAP_ERASE,
>>>> +};
>>>> +
>>>>    static const struct dw_mci_drv_data rk2928_drv_data = {
>>>>        .init            = dw_mci_rockchip_init,
>>>>    };
>>>>
>>>>    static const struct dw_mci_drv_data rk3288_drv_data = {
>>>> +    .caps            = dw_mci_rk3288_dwmmc_caps,
>>>>        .set_ios        = dw_mci_rk3288_set_ios,
>>>>        .execute_tuning        = dw_mci_rk3288_execute_tuning,
>>>>        .parse_dt        = dw_mci_rk3288_parse_dt,
>>>>
>>>
>>>
>>> _______________________________________________
>>> Linux-rockchip mailing list
>>> Linux-rockchip@lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/linux-rockchip
>>>
>>
>>
>
>
>
>
Jaehoon Chung March 29, 2016, 1:17 a.m. UTC | #6
Hi Shawn,

Sorry for applying late.
Applied on my repository.

Best Regards,
Jaehoon Chung

On 03/01/2016 04:12 PM, Shawn Lin wrote:
> Without MMC_CAP_ERASE support, we fail to mount partition
> with "discard" option since mmc_queue_setup_discard is limited
> for checking mmc_can_erase. Without doing mmc_queue_setup_discard,
> blk_queue_discard fails to test QUEUE_FLAG_DISCARD flag, so we get
> the following log from f2fs(actually similar to other file system):
> 
> mounting with "discard" option, but the device does not support discard
> 
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> ---
> 
>  drivers/mmc/host/dw_mmc-rockchip.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
> index 84e50f3..2eda118 100644
> --- a/drivers/mmc/host/dw_mmc-rockchip.c
> +++ b/drivers/mmc/host/dw_mmc-rockchip.c
> @@ -234,11 +234,20 @@ static int dw_mci_rockchip_init(struct dw_mci *host)
>  	return 0;
>  }
>  
> +/* Common capabilities of RK3288 SoC */
> +static unsigned long dw_mci_rk3288_dwmmc_caps[4] = {
> +	MMC_CAP_ERASE,
> +	MMC_CAP_ERASE,
> +	MMC_CAP_ERASE,
> +	MMC_CAP_ERASE,
> +};
> +
>  static const struct dw_mci_drv_data rk2928_drv_data = {
>  	.init			= dw_mci_rockchip_init,
>  };
>  
>  static const struct dw_mci_drv_data rk3288_drv_data = {
> +	.caps			= dw_mci_rk3288_dwmmc_caps,
>  	.set_ios		= dw_mci_rk3288_set_ios,
>  	.execute_tuning		= dw_mci_rk3288_execute_tuning,
>  	.parse_dt		= dw_mci_rk3288_parse_dt,
>
diff mbox

Patch

diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
index 84e50f3..2eda118 100644
--- a/drivers/mmc/host/dw_mmc-rockchip.c
+++ b/drivers/mmc/host/dw_mmc-rockchip.c
@@ -234,11 +234,20 @@  static int dw_mci_rockchip_init(struct dw_mci *host)
 	return 0;
 }
 
+/* Common capabilities of RK3288 SoC */
+static unsigned long dw_mci_rk3288_dwmmc_caps[4] = {
+	MMC_CAP_ERASE,
+	MMC_CAP_ERASE,
+	MMC_CAP_ERASE,
+	MMC_CAP_ERASE,
+};
+
 static const struct dw_mci_drv_data rk2928_drv_data = {
 	.init			= dw_mci_rockchip_init,
 };
 
 static const struct dw_mci_drv_data rk3288_drv_data = {
+	.caps			= dw_mci_rk3288_dwmmc_caps,
 	.set_ios		= dw_mci_rk3288_set_ios,
 	.execute_tuning		= dw_mci_rk3288_execute_tuning,
 	.parse_dt		= dw_mci_rk3288_parse_dt,