mmc.c (5a8dbdc6b4b8b4b17c807c9bb23807cdc66f6feb) | mmc.c (a626c8d418d5fd1f8429294e7efe3fa2e4ca90fe) |
---|---|
1/* 2 * Copyright 2008, Freescale Semiconductor, Inc 3 * Andy Fleming 4 * 5 * Based vaguely on the Linux code 6 * 7 * SPDX-License-Identifier: GPL-2.0+ 8 */ --- 348 unchanged lines hidden (view full) --- 357 int err; 358 359 cmd->cmdidx = MMC_CMD_SEND_OP_COND; 360 cmd->resp_type = MMC_RSP_R3; 361 cmd->cmdarg = 0; 362 if (use_arg && !mmc_host_is_spi(mmc)) { 363 cmd->cmdarg = 364 (mmc->cfg->voltages & | 1/* 2 * Copyright 2008, Freescale Semiconductor, Inc 3 * Andy Fleming 4 * 5 * Based vaguely on the Linux code 6 * 7 * SPDX-License-Identifier: GPL-2.0+ 8 */ --- 348 unchanged lines hidden (view full) --- 357 int err; 358 359 cmd->cmdidx = MMC_CMD_SEND_OP_COND; 360 cmd->resp_type = MMC_RSP_R3; 361 cmd->cmdarg = 0; 362 if (use_arg && !mmc_host_is_spi(mmc)) { 363 cmd->cmdarg = 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 368 if (mmc->cfg->host_caps & MMC_MODE_HC) 369 cmd->cmdarg |= OCR_HCS; 370 } 371 err = mmc_send_cmd(mmc, cmd, NULL); 372 if (err) 373 return err; | 367 368 if (mmc->cfg->host_caps & MMC_MODE_HC) 369 cmd->cmdarg |= OCR_HCS; 370 } 371 err = mmc_send_cmd(mmc, cmd, NULL); 372 if (err) 373 return err; |
374 mmc->op_cond_response = cmd->response[0]; | 374 mmc->ocr = cmd->response[0]; |
375 return 0; 376} 377 378static int mmc_send_op_cond(struct mmc *mmc) 379{ 380 struct mmc_cmd cmd; 381 int err, i; 382 383 /* Some cards seem to need this */ 384 mmc_go_idle(mmc); 385 386 /* Asking to the card its capabilities */ 387 mmc->op_cond_pending = 1; 388 for (i = 0; i < 2; i++) { 389 err = mmc_send_op_cond_iter(mmc, &cmd, i != 0); 390 if (err) 391 return err; 392 393 /* exit if not busy (flag seems to be inverted) */ | 375 return 0; 376} 377 378static int mmc_send_op_cond(struct mmc *mmc) 379{ 380 struct mmc_cmd cmd; 381 int err, i; 382 383 /* Some cards seem to need this */ 384 mmc_go_idle(mmc); 385 386 /* Asking to the card its capabilities */ 387 mmc->op_cond_pending = 1; 388 for (i = 0; i < 2; i++) { 389 err = mmc_send_op_cond_iter(mmc, &cmd, i != 0); 390 if (err) 391 return err; 392 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 return 0; 396 } 397 return IN_PROGRESS; 398} 399 400static int mmc_complete_op_cond(struct mmc *mmc) 401{ 402 struct mmc_cmd cmd; --- 5 unchanged lines hidden (view full) --- 408 start = get_timer(0); 409 do { 410 err = mmc_send_op_cond_iter(mmc, &cmd, 1); 411 if (err) 412 return err; 413 if (get_timer(start) > timeout) 414 return UNUSABLE_ERR; 415 udelay(100); | 395 return 0; 396 } 397 return IN_PROGRESS; 398} 399 400static int mmc_complete_op_cond(struct mmc *mmc) 401{ 402 struct mmc_cmd cmd; --- 5 unchanged lines hidden (view full) --- 408 start = get_timer(0); 409 do { 410 err = mmc_send_op_cond_iter(mmc, &cmd, 1); 411 if (err) 412 return err; 413 if (get_timer(start) > timeout) 414 return UNUSABLE_ERR; 415 udelay(100); |
416 } while (!(mmc->op_cond_response & OCR_BUSY)); | 416 } while (!(mmc->ocr & OCR_BUSY)); |
417 418 if (mmc_host_is_spi(mmc)) { /* read OCR for spi */ 419 cmd.cmdidx = MMC_CMD_SPI_READ_OCR; 420 cmd.resp_type = MMC_RSP_R3; 421 cmd.cmdarg = 0; 422 423 err = mmc_send_cmd(mmc, &cmd, NULL); 424 425 if (err) 426 return err; | 417 418 if (mmc_host_is_spi(mmc)) { /* read OCR for spi */ 419 cmd.cmdidx = MMC_CMD_SPI_READ_OCR; 420 cmd.resp_type = MMC_RSP_R3; 421 cmd.cmdarg = 0; 422 423 err = mmc_send_cmd(mmc, &cmd, NULL); 424 425 if (err) 426 return err; |
427 428 mmc->ocr = cmd.response[0]; |
|
427 } 428 429 mmc->version = MMC_VERSION_UNKNOWN; | 429 } 430 431 mmc->version = MMC_VERSION_UNKNOWN; |
430 mmc->ocr = cmd.response[0]; | |
431 432 mmc->high_capacity = ((mmc->ocr & OCR_HCS) == OCR_HCS); 433 mmc->rca = 1; 434 435 return 0; 436} 437 438 --- 1144 unchanged lines hidden (view full) --- 1583 printf("MMC: no card present\n"); 1584#endif 1585 return NO_CARD_ERR; 1586 } 1587 1588 if (mmc->has_init) 1589 return 0; 1590 | 432 433 mmc->high_capacity = ((mmc->ocr & OCR_HCS) == OCR_HCS); 434 mmc->rca = 1; 435 436 return 0; 437} 438 439 --- 1144 unchanged lines hidden (view full) --- 1584 printf("MMC: no card present\n"); 1585#endif 1586 return NO_CARD_ERR; 1587 } 1588 1589 if (mmc->has_init) 1590 return 0; 1591 |
1591#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT 1592 mmc_adapter_card_type_ident(); 1593#endif | |
1594 board_mmc_power_init(); 1595 1596 /* made sure it's not NULL earlier */ 1597 err = mmc->cfg->ops->init(mmc); 1598 1599 if (err) 1600 return err; 1601 --- 135 unchanged lines hidden (view full) --- 1737static void do_preinit(void) 1738{ 1739 struct mmc *m; 1740 struct list_head *entry; 1741 1742 list_for_each(entry, &mmc_devices) { 1743 m = list_entry(entry, struct mmc, link); 1744 | 1592 board_mmc_power_init(); 1593 1594 /* made sure it's not NULL earlier */ 1595 err = mmc->cfg->ops->init(mmc); 1596 1597 if (err) 1598 return err; 1599 --- 135 unchanged lines hidden (view full) --- 1735static void do_preinit(void) 1736{ 1737 struct mmc *m; 1738 struct list_head *entry; 1739 1740 list_for_each(entry, &mmc_devices) { 1741 m = list_entry(entry, struct mmc, link); 1742 |
1745#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT 1746 mmc_set_preinit(m, 1); 1747#endif | |
1748 if (m->preinit) 1749 mmc_start_init(m); 1750 } 1751} 1752 1753 1754int mmc_initialize(bd_t *bis) 1755{ --- 136 unchanged lines hidden --- | 1743 if (m->preinit) 1744 mmc_start_init(m); 1745 } 1746} 1747 1748 1749int mmc_initialize(bd_t *bis) 1750{ --- 136 unchanged lines hidden --- |