Commit a626c8d418d5fd1f8429294e7efe3fa2e4ca90fe

Authored by Andrew Gabbasov
Committed by Pantelis Antoniou
1 parent 3f2da751be

mmc: Avoid extra duplicate entry in mmc device structure

The 'op_cond_response' field in mmc structure contains the response
from the last SEND_OP_COND MMC command while making iterational
polling of the card. Later it is copied to 'ocr' field, designed
to contain the OCR register value, which is actually the same
response from the same command. So, these fields have actually
the same data, just in different time periods. It's easier to use
the same 'ocr' field in both cases at once, without temporary using
of the 'op_cond_response' field.

Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com>

Showing 2 changed files with 7 additions and 7 deletions Side-by-side Diff

... ... @@ -362,8 +362,8 @@
362 362 if (use_arg && !mmc_host_is_spi(mmc)) {
363 363 cmd->cmdarg =
364 364 (mmc->cfg->voltages &
365   - (mmc->op_cond_response & OCR_VOLTAGE_MASK)) |
366   - (mmc->op_cond_response & OCR_ACCESS_MODE);
  365 + (mmc->ocr & OCR_VOLTAGE_MASK)) |
  366 + (mmc->ocr & OCR_ACCESS_MODE);
367 367  
368 368 if (mmc->cfg->host_caps & MMC_MODE_HC)
369 369 cmd->cmdarg |= OCR_HCS;
... ... @@ -371,7 +371,7 @@
371 371 err = mmc_send_cmd(mmc, cmd, NULL);
372 372 if (err)
373 373 return err;
374   - mmc->op_cond_response = cmd->response[0];
  374 + mmc->ocr = cmd->response[0];
375 375 return 0;
376 376 }
377 377  
... ... @@ -391,7 +391,7 @@
391 391 return err;
392 392  
393 393 /* exit if not busy (flag seems to be inverted) */
394   - if (mmc->op_cond_response & OCR_BUSY)
  394 + if (mmc->ocr & OCR_BUSY)
395 395 return 0;
396 396 }
397 397 return IN_PROGRESS;
... ... @@ -413,7 +413,7 @@
413 413 if (get_timer(start) > timeout)
414 414 return UNUSABLE_ERR;
415 415 udelay(100);
416   - } while (!(mmc->op_cond_response & OCR_BUSY));
  416 + } while (!(mmc->ocr & OCR_BUSY));
417 417  
418 418 if (mmc_host_is_spi(mmc)) { /* read OCR for spi */
419 419 cmd.cmdidx = MMC_CMD_SPI_READ_OCR;
420 420  
... ... @@ -424,10 +424,11 @@
424 424  
425 425 if (err)
426 426 return err;
  427 +
  428 + mmc->ocr = cmd.response[0];
427 429 }
428 430  
429 431 mmc->version = MMC_VERSION_UNKNOWN;
430   - mmc->ocr = cmd.response[0];
431 432  
432 433 mmc->high_capacity = ((mmc->ocr & OCR_HCS) == OCR_HCS);
433 434 mmc->rca = 1;
... ... @@ -356,7 +356,6 @@
356 356 char op_cond_pending; /* 1 if we are waiting on an op_cond command */
357 357 char init_in_progress; /* 1 if we have done mmc_start_init() */
358 358 char preinit; /* start init as early as possible */
359   - uint op_cond_response; /* the response byte from the last op_cond */
360 359 int ddr_mode;
361 360 };
362 361