From: Hector Palacios <hector.palacios@digi.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH RFC] fsl_esdhc: flush cache after non-read operation
Date: Mon, 31 Mar 2014 10:23:50 +0200 [thread overview]
Message-ID: <53392616.2020405@digi.com> (raw)
In-Reply-To: <533588FA.7030708@boundarydevices.com>
Hi,
On 03/28/2014 03:36 PM, Eric Nelson wrote:
> 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>
After further testing it looks like I misinterpreted the results:
First, please disregard the patch as it does not fix anything.
Second, 'mmc part' command seems to be returning cached data after I use 'gpt' command
to partition the uSD card. I can reproduce it as follows (consider mmc 1 is my uSD card):
1. Write random data to corrupt the partition table
=> mmc dev 1
=> mmc write $loadaddr 0 30
2. Check partition table is corrupt
=> mmc part (shows error invalid GPT)
3. Soft reset the target
4. Write a correct partition table
=> mmc dev 1
=> gpt write mmc 1 "..."
5. Read back partition table
=> mmc part
At this point 'mmc part' returns again an incorrect partition table. However, if after
a while I do an 'mmc rescan' or a soft reset and rerun the 'mmc part' command, it will
show the correct partition table was written.
The partition table is read during mmc_init():
int test_part_efi(block_dev_desc_t * dev_desc)
{
ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, legacymbr, 1, dev_desc->blksz);
/* Read legacy MBR from block 0 and validate it */
if ((dev_desc->block_read(dev_desc->dev, 0, 1, (ulong *)legacymbr) != 1)
|| (is_pmbr_valid(legacymbr) != 1)) {
return -1;
}
return 0;
}
Could it be that the read partition table is cached so that after writing it with
'gpt', reading it again returns cached data instead of physical data, just written?
--
H?ctor Palacios
next prev parent reply other threads:[~2014-03-31 8:23 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
2014-03-29 3:45 ` Marek Vasut
2014-03-31 8:23 ` Hector Palacios [this message]
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=53392616.2020405@digi.com \
--to=hector.palacios@digi.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