From: Eric Nelson <eric.nelson@boundarydevices.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH RFC] fsl_esdhc: flush cache after non-read operation
Date: Fri, 28 Mar 2014 07:36:42 -0700 [thread overview]
Message-ID: <533588FA.7030708@boundarydevices.com> (raw)
In-Reply-To: <CAOMZO5DrgQZz-KMWqVKhPPQm=tgk==O7HM4aY4vF1bkKe9qbRw@mail.gmail.com>
Hi Hector,
On 03/28/2014 06:49 AM, Fabio Estevam wrote:
> On Fri, Mar 28, 2014 at 7:15 AM, Hector Palacios
> <hector.palacios@digi.com> wrote:
>> Cache was invalidated on the read operation, but it should
>> also be flushed otherwise.
>>
>> Signed-off-by: Hector Palacios <hector.palacios@digi.com>
>
> Thanks, Hector.
>
> Adding Marek on Cc as well.
>
>
>> ---
>>
>> Notes:
>> After enabling L2 cache on i.MX6 I found out that many times
>> when running the 'gpt' command to partition a uSD card, the
>> data was not written at all, or was badly written to the media.
>>
>> This patch seems to solve it but I'm not sure if that's the
>> right place to flush the cache. Could someone please comment?
>>
>> Thank you.
>>
>> drivers/mmc/fsl_esdhc.c | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
>> index e945c0a470ca..5ef575eb0272 100644
>> --- a/drivers/mmc/fsl_esdhc.c
>> +++ b/drivers/mmc/fsl_esdhc.c
>> @@ -253,6 +253,16 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
>> return 0;
>> }
>>
>> +static void check_and_flush_dcache_range
>> + (struct mmc_cmd *cmd,
>> + struct mmc_data *data) {
>> + unsigned start = (unsigned)data->dest ;
>> + unsigned size = roundup(ARCH_DMA_MINALIGN,
>> + data->blocks*data->blocksize);
>> + unsigned end = start+size ;
>> + flush_dcache_range(start, end);
>> +}
>> +
>> static void check_and_invalidate_dcache_range
>> (struct mmc_cmd *cmd,
>> struct mmc_data *data) {
>> @@ -401,6 +411,8 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
>> #endif
>> if (data->flags & MMC_DATA_READ)
>> check_and_invalidate_dcache_range(cmd, data);
>> + else
>> + check_and_flush_dcache_range(cmd, data);
>> }
Since this comes after the wait for completion, this is
clearly not the right fix.
If this patch is fixing the problem, the issue must be somewhere else.
Can you verify that the call to flush_dcache_range() in the
esdhc_setup_data routine is being called prior to esdhc_send_command?
next prev parent reply other threads:[~2014-03-28 14:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-28 10:15 [U-Boot] [PATCH RFC] fsl_esdhc: flush cache after non-read operation Hector Palacios
2014-03-28 13:49 ` Fabio Estevam
2014-03-28 14:36 ` Eric Nelson [this message]
2014-03-29 3:45 ` Marek Vasut
2014-03-31 8:23 ` Hector Palacios
2014-03-31 8:37 ` Marek Vasut
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=533588FA.7030708@boundarydevices.com \
--to=eric.nelson@boundarydevices.com \
--cc=u-boot@lists.denx.de \
/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