From: Pierre Ossman <drzeus@drzeus.cx>
To: Jordan Crouse <jordan.crouse@amd.com>
Cc: linux-mips@linux-mips.org, rmk+lkml@arm.linux.org.uk
Subject: Re: [PATCH] Force MMC/SD to 512 byte block sizes
Date: Fri, 06 Jan 2006 18:04:23 +0100 [thread overview]
Message-ID: <43BEA317.8010203@drzeus.cx> (raw)
In-Reply-To: <20060106164406.GA15617@cosmic.amd.com>
Jordan Crouse wrote:
> This patch is not specific to the AU1200 SD driver, but thats what
> we used to debug and verify this, so thats why it is applied against
> the linux-mips tree. Pierre, I'm sending this to you too, because I thought
> you may be interested.
Much appreciated. :)
>
> Large SD cards (>=2GB) report a physical block size greater then 512 bytes
> (2GB reports 1024, and 4GB reports 2048). However, a sample of different
> brands of USB attached SD readers have shown that the logical block size
> is still forced to 512 bytes.
>
> The original mmc_block code was setting the block size to whatever the
> card was reporting, thereby causing much pain and suffering when using
> a card initialized elsewhere (bad partition tables, invalid FAT tables, etc).
>
> This patch forces the block size to be 512 bytes, and adjusts the
> capacity accordingly. With this you should be able to happily use very
> large cards interchangeably between platforms. At least, it has worked for
> us.
>
>
> @@ -373,7 +383,7 @@ mmc_blk_set_blksize(struct mmc_blk_data
>
> mmc_card_claim_host(card);
> cmd.opcode = MMC_SET_BLOCKLEN;
> - cmd.arg = 1 << card->csd.read_blkbits;
> + cmd.arg = 1 << ((card->csd.read_blkbits > 9) ? 9 : card->csd.read_blkbits);
> cmd.flags = MMC_RSP_R1;
> err = mmc_wait_for_cmd(card->host, &cmd, 5);
> mmc_card_release_host(card);
This will not work. Some cards do not accept block sizes larger than the
one they've specified.
This issue has been discussed on the arm kernel ml and Russell has begun
producing patches to resolve the issue.
To solve the issue you're seeing we should lie to the block layer, not
the card. Which will cause problems when the block layer issues request
that cannot be mapped to a integer number of card blocks.
The issue is more complex than your patch suggests and I do not know
enough about the block layer to propose a way out.
Rgds
Pierre
next prev parent reply other threads:[~2006-01-06 17:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-06 16:44 [PATCH] Force MMC/SD to 512 byte block sizes Jordan Crouse
2006-01-06 16:59 ` Russell King
2006-01-06 17:42 ` Jordan Crouse
2006-01-09 17:49 ` Jordan Crouse
2006-01-06 17:04 ` Pierre Ossman [this message]
2006-01-06 17:50 ` Jordan Crouse
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=43BEA317.8010203@drzeus.cx \
--to=drzeus@drzeus.cx \
--cc=jordan.crouse@amd.com \
--cc=linux-mips@linux-mips.org \
--cc=rmk+lkml@arm.linux.org.uk \
/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