aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaehoon Chung <jh80.chung@samsung.com>2013-07-18 00:34:41 -0400
committerChris Ball <cjb@laptop.org>2013-08-24 23:07:38 -0400
commit77776fd0a4cc541b9a528eacc1d31ca47eb1ae7a (patch)
tree77587901f32cd6fb25e5b1ec48ee5acc443ab0a5
parent7fca96758e977497c67a424006c60aaf2d3db212 (diff)
mmc: sd: fix the maximum au_size for SD3.0
Since SD Physical Layer specification V3.0, AU_SIZE is supported up to 0xf. So If SD-card is supported v3.0, then max_au should be 0xf. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/core/sd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 1240a85a9aa2..5e8823dc3ef6 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -215,7 +215,7 @@ static int mmc_decode_scr(struct mmc_card *card)
215static int mmc_read_ssr(struct mmc_card *card) 215static int mmc_read_ssr(struct mmc_card *card)
216{ 216{
217 unsigned int au, es, et, eo; 217 unsigned int au, es, et, eo;
218 int err, i; 218 int err, i, max_au;
219 u32 *ssr; 219 u32 *ssr;
220 220
221 if (!(card->csd.cmdclass & CCC_APP_SPEC)) { 221 if (!(card->csd.cmdclass & CCC_APP_SPEC)) {
@@ -239,12 +239,15 @@ static int mmc_read_ssr(struct mmc_card *card)
239 for (i = 0; i < 16; i++) 239 for (i = 0; i < 16; i++)
240 ssr[i] = be32_to_cpu(ssr[i]); 240 ssr[i] = be32_to_cpu(ssr[i]);
241 241
242 /* SD3.0 increases max AU size to 64MB (0xF) from 4MB (0x9) */
243 max_au = card->scr.sda_spec3 ? 0xF : 0x9;
244
242 /* 245 /*
243 * UNSTUFF_BITS only works with four u32s so we have to offset the 246 * UNSTUFF_BITS only works with four u32s so we have to offset the
244 * bitfield positions accordingly. 247 * bitfield positions accordingly.
245 */ 248 */
246 au = UNSTUFF_BITS(ssr, 428 - 384, 4); 249 au = UNSTUFF_BITS(ssr, 428 - 384, 4);
247 if (au > 0 && au <= 9) { 250 if (au > 0 && au <= max_au) {
248 card->ssr.au = 1 << (au + 4); 251 card->ssr.au = 1 << (au + 4);
249 es = UNSTUFF_BITS(ssr, 408 - 384, 16); 252 es = UNSTUFF_BITS(ssr, 408 - 384, 16);
250 et = UNSTUFF_BITS(ssr, 402 - 384, 6); 253 et = UNSTUFF_BITS(ssr, 402 - 384, 6);