/linux-4.4.14/drivers/mmc/core/ |
H A D | mmc.c | 119 if (card->ext_csd.erase_group_def & 1) mmc_set_erase_size() 120 card->erase_size = card->ext_csd.hc_erase_size; mmc_set_erase_size() 185 u8 card_type = card->ext_csd.raw_card_type; mmc_select_card_type() 238 card->ext_csd.hs_max_dtr = hs_max_dtr; mmc_select_card_type() 239 card->ext_csd.hs200_max_dtr = hs200_max_dtr; mmc_select_card_type() 243 static void mmc_manage_enhanced_area(struct mmc_card *card, u8 *ext_csd) mmc_manage_enhanced_area() argument 250 card->ext_csd.enhanced_area_offset = -EINVAL; mmc_manage_enhanced_area() 251 card->ext_csd.enhanced_area_size = -EINVAL; mmc_manage_enhanced_area() 258 if ((ext_csd[EXT_CSD_PARTITION_SUPPORT] & 0x2) && mmc_manage_enhanced_area() 259 (ext_csd[EXT_CSD_PARTITION_ATTRIBUTE] & 0x1)) { mmc_manage_enhanced_area() 260 if (card->ext_csd.partition_setting_completed) { mmc_manage_enhanced_area() 262 ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE]; mmc_manage_enhanced_area() 264 ext_csd[EXT_CSD_HC_WP_GRP_SIZE]; mmc_manage_enhanced_area() 269 card->ext_csd.enhanced_area_offset = mmc_manage_enhanced_area() 270 (((unsigned long long)ext_csd[139]) << 24) + mmc_manage_enhanced_area() 271 (((unsigned long long)ext_csd[138]) << 16) + mmc_manage_enhanced_area() 272 (((unsigned long long)ext_csd[137]) << 8) + mmc_manage_enhanced_area() 273 (((unsigned long long)ext_csd[136])); mmc_manage_enhanced_area() 275 card->ext_csd.enhanced_area_offset <<= 9; mmc_manage_enhanced_area() 279 card->ext_csd.enhanced_area_size = mmc_manage_enhanced_area() 280 (ext_csd[142] << 16) + (ext_csd[141] << 8) + mmc_manage_enhanced_area() 281 ext_csd[140]; mmc_manage_enhanced_area() 282 card->ext_csd.enhanced_area_size *= mmc_manage_enhanced_area() 284 card->ext_csd.enhanced_area_size <<= 9; mmc_manage_enhanced_area() 292 static void mmc_manage_gp_partitions(struct mmc_card *card, u8 *ext_csd) mmc_manage_gp_partitions() argument 300 * If ext_csd has the size of general purpose partitions, mmc_manage_gp_partitions() 303 if (ext_csd[EXT_CSD_PARTITION_SUPPORT] & mmc_manage_gp_partitions() 306 ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE]; mmc_manage_gp_partitions() 308 ext_csd[EXT_CSD_HC_WP_GRP_SIZE]; mmc_manage_gp_partitions() 311 if (!ext_csd[EXT_CSD_GP_SIZE_MULT + idx * 3] && mmc_manage_gp_partitions() 312 !ext_csd[EXT_CSD_GP_SIZE_MULT + idx * 3 + 1] && mmc_manage_gp_partitions() 313 !ext_csd[EXT_CSD_GP_SIZE_MULT + idx * 3 + 2]) mmc_manage_gp_partitions() 315 if (card->ext_csd.partition_setting_completed == 0) { mmc_manage_gp_partitions() 321 (ext_csd[EXT_CSD_GP_SIZE_MULT + idx * 3 + 2] mmc_manage_gp_partitions() 323 (ext_csd[EXT_CSD_GP_SIZE_MULT + idx * 3 + 1] mmc_manage_gp_partitions() 325 ext_csd[EXT_CSD_GP_SIZE_MULT + idx * 3]; mmc_manage_gp_partitions() 342 static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd) mmc_decode_ext_csd() argument 350 card->ext_csd.raw_ext_csd_structure = ext_csd[EXT_CSD_STRUCTURE]; mmc_decode_ext_csd() 352 if (card->ext_csd.raw_ext_csd_structure > 2) { mmc_decode_ext_csd() 355 card->ext_csd.raw_ext_csd_structure); mmc_decode_ext_csd() 371 card->ext_csd.rev = ext_csd[EXT_CSD_REV]; mmc_decode_ext_csd() 373 card->ext_csd.raw_sectors[0] = ext_csd[EXT_CSD_SEC_CNT + 0]; mmc_decode_ext_csd() 374 card->ext_csd.raw_sectors[1] = ext_csd[EXT_CSD_SEC_CNT + 1]; mmc_decode_ext_csd() 375 card->ext_csd.raw_sectors[2] = ext_csd[EXT_CSD_SEC_CNT + 2]; mmc_decode_ext_csd() 376 card->ext_csd.raw_sectors[3] = ext_csd[EXT_CSD_SEC_CNT + 3]; mmc_decode_ext_csd() 377 if (card->ext_csd.rev >= 2) { mmc_decode_ext_csd() 378 card->ext_csd.sectors = mmc_decode_ext_csd() 379 ext_csd[EXT_CSD_SEC_CNT + 0] << 0 | mmc_decode_ext_csd() 380 ext_csd[EXT_CSD_SEC_CNT + 1] << 8 | mmc_decode_ext_csd() 381 ext_csd[EXT_CSD_SEC_CNT + 2] << 16 | mmc_decode_ext_csd() 382 ext_csd[EXT_CSD_SEC_CNT + 3] << 24; mmc_decode_ext_csd() 385 if (card->ext_csd.sectors > (2u * 1024 * 1024 * 1024) / 512) mmc_decode_ext_csd() 389 card->ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; mmc_decode_ext_csd() 392 card->ext_csd.raw_s_a_timeout = ext_csd[EXT_CSD_S_A_TIMEOUT]; mmc_decode_ext_csd() 393 card->ext_csd.raw_erase_timeout_mult = mmc_decode_ext_csd() 394 ext_csd[EXT_CSD_ERASE_TIMEOUT_MULT]; mmc_decode_ext_csd() 395 card->ext_csd.raw_hc_erase_grp_size = mmc_decode_ext_csd() 396 ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE]; mmc_decode_ext_csd() 397 if (card->ext_csd.rev >= 3) { mmc_decode_ext_csd() 398 u8 sa_shift = ext_csd[EXT_CSD_S_A_TIMEOUT]; mmc_decode_ext_csd() 399 card->ext_csd.part_config = ext_csd[EXT_CSD_PART_CONFIG]; mmc_decode_ext_csd() 402 card->ext_csd.part_time = 10 * ext_csd[EXT_CSD_PART_SWITCH_TIME]; mmc_decode_ext_csd() 404 if (card->ext_csd.part_time && mmc_decode_ext_csd() 405 card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME) mmc_decode_ext_csd() 406 card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME; mmc_decode_ext_csd() 410 card->ext_csd.sa_timeout = mmc_decode_ext_csd() 411 1 << ext_csd[EXT_CSD_S_A_TIMEOUT]; mmc_decode_ext_csd() 412 card->ext_csd.erase_group_def = mmc_decode_ext_csd() 413 ext_csd[EXT_CSD_ERASE_GROUP_DEF]; mmc_decode_ext_csd() 414 card->ext_csd.hc_erase_timeout = 300 * mmc_decode_ext_csd() 415 ext_csd[EXT_CSD_ERASE_TIMEOUT_MULT]; mmc_decode_ext_csd() 416 card->ext_csd.hc_erase_size = mmc_decode_ext_csd() 417 ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] << 10; mmc_decode_ext_csd() 419 card->ext_csd.rel_sectors = ext_csd[EXT_CSD_REL_WR_SEC_C]; mmc_decode_ext_csd() 425 if (ext_csd[EXT_CSD_BOOT_MULT] && mmc_boot_partition_access(card->host)) { mmc_decode_ext_csd() 427 part_size = ext_csd[EXT_CSD_BOOT_MULT] << 17; mmc_decode_ext_csd() 436 card->ext_csd.raw_hc_erase_gap_size = mmc_decode_ext_csd() 437 ext_csd[EXT_CSD_HC_WP_GRP_SIZE]; mmc_decode_ext_csd() 438 card->ext_csd.raw_sec_trim_mult = mmc_decode_ext_csd() 439 ext_csd[EXT_CSD_SEC_TRIM_MULT]; mmc_decode_ext_csd() 440 card->ext_csd.raw_sec_erase_mult = mmc_decode_ext_csd() 441 ext_csd[EXT_CSD_SEC_ERASE_MULT]; mmc_decode_ext_csd() 442 card->ext_csd.raw_sec_feature_support = mmc_decode_ext_csd() 443 ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT]; mmc_decode_ext_csd() 444 card->ext_csd.raw_trim_mult = mmc_decode_ext_csd() 445 ext_csd[EXT_CSD_TRIM_MULT]; mmc_decode_ext_csd() 446 card->ext_csd.raw_partition_support = ext_csd[EXT_CSD_PARTITION_SUPPORT]; mmc_decode_ext_csd() 447 card->ext_csd.raw_driver_strength = ext_csd[EXT_CSD_DRIVER_STRENGTH]; mmc_decode_ext_csd() 448 if (card->ext_csd.rev >= 4) { mmc_decode_ext_csd() 449 if (ext_csd[EXT_CSD_PARTITION_SETTING_COMPLETED] & mmc_decode_ext_csd() 451 card->ext_csd.partition_setting_completed = 1; mmc_decode_ext_csd() 453 card->ext_csd.partition_setting_completed = 0; mmc_decode_ext_csd() 455 mmc_manage_enhanced_area(card, ext_csd); mmc_decode_ext_csd() 457 mmc_manage_gp_partitions(card, ext_csd); mmc_decode_ext_csd() 459 card->ext_csd.sec_trim_mult = mmc_decode_ext_csd() 460 ext_csd[EXT_CSD_SEC_TRIM_MULT]; mmc_decode_ext_csd() 461 card->ext_csd.sec_erase_mult = mmc_decode_ext_csd() 462 ext_csd[EXT_CSD_SEC_ERASE_MULT]; mmc_decode_ext_csd() 463 card->ext_csd.sec_feature_support = mmc_decode_ext_csd() 464 ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT]; mmc_decode_ext_csd() 465 card->ext_csd.trim_timeout = 300 * mmc_decode_ext_csd() 466 ext_csd[EXT_CSD_TRIM_MULT]; mmc_decode_ext_csd() 473 card->ext_csd.boot_ro_lock = ext_csd[EXT_CSD_BOOT_WP]; mmc_decode_ext_csd() 474 card->ext_csd.boot_ro_lockable = true; mmc_decode_ext_csd() 477 card->ext_csd.raw_pwr_cl_52_195 = mmc_decode_ext_csd() 478 ext_csd[EXT_CSD_PWR_CL_52_195]; mmc_decode_ext_csd() 479 card->ext_csd.raw_pwr_cl_26_195 = mmc_decode_ext_csd() 480 ext_csd[EXT_CSD_PWR_CL_26_195]; mmc_decode_ext_csd() 481 card->ext_csd.raw_pwr_cl_52_360 = mmc_decode_ext_csd() 482 ext_csd[EXT_CSD_PWR_CL_52_360]; mmc_decode_ext_csd() 483 card->ext_csd.raw_pwr_cl_26_360 = mmc_decode_ext_csd() 484 ext_csd[EXT_CSD_PWR_CL_26_360]; mmc_decode_ext_csd() 485 card->ext_csd.raw_pwr_cl_200_195 = mmc_decode_ext_csd() 486 ext_csd[EXT_CSD_PWR_CL_200_195]; mmc_decode_ext_csd() 487 card->ext_csd.raw_pwr_cl_200_360 = mmc_decode_ext_csd() 488 ext_csd[EXT_CSD_PWR_CL_200_360]; mmc_decode_ext_csd() 489 card->ext_csd.raw_pwr_cl_ddr_52_195 = mmc_decode_ext_csd() 490 ext_csd[EXT_CSD_PWR_CL_DDR_52_195]; mmc_decode_ext_csd() 491 card->ext_csd.raw_pwr_cl_ddr_52_360 = mmc_decode_ext_csd() 492 ext_csd[EXT_CSD_PWR_CL_DDR_52_360]; mmc_decode_ext_csd() 493 card->ext_csd.raw_pwr_cl_ddr_200_360 = mmc_decode_ext_csd() 494 ext_csd[EXT_CSD_PWR_CL_DDR_200_360]; mmc_decode_ext_csd() 497 if (card->ext_csd.rev >= 5) { mmc_decode_ext_csd() 503 if (ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1) { mmc_decode_ext_csd() 504 card->ext_csd.bkops = 1; mmc_decode_ext_csd() 505 card->ext_csd.man_bkops_en = mmc_decode_ext_csd() 506 (ext_csd[EXT_CSD_BKOPS_EN] & mmc_decode_ext_csd() 508 card->ext_csd.raw_bkops_status = mmc_decode_ext_csd() 509 ext_csd[EXT_CSD_BKOPS_STATUS]; mmc_decode_ext_csd() 510 if (!card->ext_csd.man_bkops_en) mmc_decode_ext_csd() 516 if (!broken_hpi && (ext_csd[EXT_CSD_HPI_FEATURES] & 0x1)) { mmc_decode_ext_csd() 517 card->ext_csd.hpi = 1; mmc_decode_ext_csd() 518 if (ext_csd[EXT_CSD_HPI_FEATURES] & 0x2) mmc_decode_ext_csd() 519 card->ext_csd.hpi_cmd = MMC_STOP_TRANSMISSION; mmc_decode_ext_csd() 521 card->ext_csd.hpi_cmd = MMC_SEND_STATUS; mmc_decode_ext_csd() 526 card->ext_csd.out_of_int_time = mmc_decode_ext_csd() 527 ext_csd[EXT_CSD_OUT_OF_INTERRUPT_TIME] * 10; mmc_decode_ext_csd() 530 card->ext_csd.rel_param = ext_csd[EXT_CSD_WR_REL_PARAM]; mmc_decode_ext_csd() 531 card->ext_csd.rst_n_function = ext_csd[EXT_CSD_RST_N_FUNCTION]; mmc_decode_ext_csd() 536 card->ext_csd.raw_rpmb_size_mult = ext_csd[EXT_CSD_RPMB_MULT]; mmc_decode_ext_csd() 537 if (ext_csd[EXT_CSD_RPMB_MULT] && mmc_host_cmd23(card->host)) { mmc_decode_ext_csd() 538 mmc_part_add(card, ext_csd[EXT_CSD_RPMB_MULT] << 17, mmc_decode_ext_csd() 545 card->ext_csd.raw_erased_mem_count = ext_csd[EXT_CSD_ERASED_MEM_CONT]; mmc_decode_ext_csd() 546 if (ext_csd[EXT_CSD_ERASED_MEM_CONT]) mmc_decode_ext_csd() 552 if (card->ext_csd.rev >= 6) { mmc_decode_ext_csd() 553 card->ext_csd.feature_support |= MMC_DISCARD_FEATURE; mmc_decode_ext_csd() 555 card->ext_csd.generic_cmd6_time = 10 * mmc_decode_ext_csd() 556 ext_csd[EXT_CSD_GENERIC_CMD6_TIME]; mmc_decode_ext_csd() 557 card->ext_csd.power_off_longtime = 10 * mmc_decode_ext_csd() 558 ext_csd[EXT_CSD_POWER_OFF_LONG_TIME]; mmc_decode_ext_csd() 560 card->ext_csd.cache_size = mmc_decode_ext_csd() 561 ext_csd[EXT_CSD_CACHE_SIZE + 0] << 0 | mmc_decode_ext_csd() 562 ext_csd[EXT_CSD_CACHE_SIZE + 1] << 8 | mmc_decode_ext_csd() 563 ext_csd[EXT_CSD_CACHE_SIZE + 2] << 16 | mmc_decode_ext_csd() 564 ext_csd[EXT_CSD_CACHE_SIZE + 3] << 24; mmc_decode_ext_csd() 566 if (ext_csd[EXT_CSD_DATA_SECTOR_SIZE] == 1) mmc_decode_ext_csd() 567 card->ext_csd.data_sector_size = 4096; mmc_decode_ext_csd() 569 card->ext_csd.data_sector_size = 512; mmc_decode_ext_csd() 571 if ((ext_csd[EXT_CSD_DATA_TAG_SUPPORT] & 1) && mmc_decode_ext_csd() 572 (ext_csd[EXT_CSD_TAG_UNIT_SIZE] <= 8)) { mmc_decode_ext_csd() 573 card->ext_csd.data_tag_unit_size = mmc_decode_ext_csd() 574 ((unsigned int) 1 << ext_csd[EXT_CSD_TAG_UNIT_SIZE]) * mmc_decode_ext_csd() 575 (card->ext_csd.data_sector_size); mmc_decode_ext_csd() 577 card->ext_csd.data_tag_unit_size = 0; mmc_decode_ext_csd() 580 card->ext_csd.max_packed_writes = mmc_decode_ext_csd() 581 ext_csd[EXT_CSD_MAX_PACKED_WRITES]; mmc_decode_ext_csd() 582 card->ext_csd.max_packed_reads = mmc_decode_ext_csd() 583 ext_csd[EXT_CSD_MAX_PACKED_READS]; mmc_decode_ext_csd() 585 card->ext_csd.data_sector_size = 512; mmc_decode_ext_csd() 589 if (card->ext_csd.rev >= 7) { mmc_decode_ext_csd() 590 memcpy(card->ext_csd.fwrev, &ext_csd[EXT_CSD_FIRMWARE_VERSION], mmc_decode_ext_csd() 592 card->ext_csd.ffu_capable = mmc_decode_ext_csd() 593 (ext_csd[EXT_CSD_SUPPORTED_MODE] & 0x1) && mmc_decode_ext_csd() 594 !(ext_csd[EXT_CSD_FW_CONFIG] & 0x1); mmc_decode_ext_csd() 602 u8 *ext_csd; mmc_read_ext_csd() local 608 err = mmc_get_ext_csd(card, &ext_csd); mmc_read_ext_csd() 633 err = mmc_decode_ext_csd(card, ext_csd); mmc_read_ext_csd() 634 kfree(ext_csd); mmc_read_ext_csd() 651 err = !((card->ext_csd.raw_partition_support == mmc_compare_ext_csds() 653 (card->ext_csd.raw_erased_mem_count == mmc_compare_ext_csds() 655 (card->ext_csd.rev == mmc_compare_ext_csds() 657 (card->ext_csd.raw_ext_csd_structure == mmc_compare_ext_csds() 659 (card->ext_csd.raw_card_type == mmc_compare_ext_csds() 661 (card->ext_csd.raw_s_a_timeout == mmc_compare_ext_csds() 663 (card->ext_csd.raw_hc_erase_gap_size == mmc_compare_ext_csds() 665 (card->ext_csd.raw_erase_timeout_mult == mmc_compare_ext_csds() 667 (card->ext_csd.raw_hc_erase_grp_size == mmc_compare_ext_csds() 669 (card->ext_csd.raw_sec_trim_mult == mmc_compare_ext_csds() 671 (card->ext_csd.raw_sec_erase_mult == mmc_compare_ext_csds() 673 (card->ext_csd.raw_sec_feature_support == mmc_compare_ext_csds() 675 (card->ext_csd.raw_trim_mult == mmc_compare_ext_csds() 677 (card->ext_csd.raw_sectors[0] == mmc_compare_ext_csds() 679 (card->ext_csd.raw_sectors[1] == mmc_compare_ext_csds() 681 (card->ext_csd.raw_sectors[2] == mmc_compare_ext_csds() 683 (card->ext_csd.raw_sectors[3] == mmc_compare_ext_csds() 685 (card->ext_csd.raw_pwr_cl_52_195 == mmc_compare_ext_csds() 687 (card->ext_csd.raw_pwr_cl_26_195 == mmc_compare_ext_csds() 689 (card->ext_csd.raw_pwr_cl_52_360 == mmc_compare_ext_csds() 691 (card->ext_csd.raw_pwr_cl_26_360 == mmc_compare_ext_csds() 693 (card->ext_csd.raw_pwr_cl_200_195 == mmc_compare_ext_csds() 695 (card->ext_csd.raw_pwr_cl_200_360 == mmc_compare_ext_csds() 697 (card->ext_csd.raw_pwr_cl_ddr_52_195 == mmc_compare_ext_csds() 699 (card->ext_csd.raw_pwr_cl_ddr_52_360 == mmc_compare_ext_csds() 701 (card->ext_csd.raw_pwr_cl_ddr_200_360 == mmc_compare_ext_csds() 718 MMC_DEV_ATTR(ffu_capable, "%d\n", card->ext_csd.ffu_capable); 726 card->ext_csd.enhanced_area_offset); 727 MMC_DEV_ATTR(enhanced_area_size, "%u\n", card->ext_csd.enhanced_area_size); 728 MMC_DEV_ATTR(raw_rpmb_size_mult, "%#x\n", card->ext_csd.raw_rpmb_size_mult); 729 MMC_DEV_ATTR(rel_sectors, "%#x\n", card->ext_csd.rel_sectors); 737 if (card->ext_csd.rev < 7) { mmc_fwrev_show() 741 card->ext_csd.fwrev); mmc_fwrev_show() 783 struct mmc_ext_csd *ext_csd = &card->ext_csd; __mmc_select_powerclass() local 790 pwrclass_val = ext_csd->raw_pwr_cl_26_195; __mmc_select_powerclass() 793 ext_csd->raw_pwr_cl_52_195 : __mmc_select_powerclass() 794 ext_csd->raw_pwr_cl_ddr_52_195; __mmc_select_powerclass() 796 pwrclass_val = ext_csd->raw_pwr_cl_200_195; __mmc_select_powerclass() 808 pwrclass_val = ext_csd->raw_pwr_cl_26_360; __mmc_select_powerclass() 811 ext_csd->raw_pwr_cl_52_360 : __mmc_select_powerclass() 812 ext_csd->raw_pwr_cl_ddr_52_360; __mmc_select_powerclass() 815 ext_csd->raw_pwr_cl_ddr_200_360 : __mmc_select_powerclass() 816 ext_csd->raw_pwr_cl_200_360; __mmc_select_powerclass() 836 card->ext_csd.generic_cmd6_time); __mmc_select_powerclass() 881 max_dtr > card->ext_csd.hs200_max_dtr) mmc_set_bus_speed() 882 max_dtr = card->ext_csd.hs200_max_dtr; mmc_set_bus_speed() 883 else if (mmc_card_hs(card) && max_dtr > card->ext_csd.hs_max_dtr) mmc_set_bus_speed() 884 max_dtr = card->ext_csd.hs_max_dtr; mmc_set_bus_speed() 933 card->ext_csd.generic_cmd6_time); mmc_select_bus_width() 942 * compare ext_csd previously read in 1 bit mode mmc_select_bus_width() 943 * against ext_csd at new bus width mmc_select_bus_width() 971 card->ext_csd.generic_cmd6_time, mmc_select_hs() 1001 card->ext_csd.generic_cmd6_time); mmc_select_hs_ddr() 1082 max_dtr = card->ext_csd.hs_max_dtr; mmc_select_hs400() 1089 card->ext_csd.generic_cmd6_time, mmc_select_hs400() 1110 card->ext_csd.generic_cmd6_time); mmc_select_hs400() 1122 card->ext_csd.generic_cmd6_time, mmc_select_hs400() 1165 max_dtr = card->ext_csd.hs_max_dtr; mmc_hs400_to_hs200() 1171 val, card->ext_csd.generic_cmd6_time, mmc_hs400_to_hs200() 1186 EXT_CSD_BUS_WIDTH_8, card->ext_csd.generic_cmd6_time, mmc_hs400_to_hs200() 1203 val, card->ext_csd.generic_cmd6_time, true, mmc_hs400_to_hs200() 1230 card_drv_type = card->ext_csd.raw_driver_strength | mmc_select_driver_type() 1234 card->ext_csd.hs200_max_dtr, mmc_select_driver_type() 1283 card->ext_csd.generic_cmd6_time, mmc_select_hs200() 1509 if (card->ext_csd.partition_setting_completed || mmc_init_card() 1510 (card->ext_csd.rev >= 3 && (host->caps2 & MMC_CAP2_HC_ERASE_SZ))) { mmc_init_card() 1513 card->ext_csd.generic_cmd6_time); mmc_init_card() 1525 card->ext_csd.enhanced_area_offset = -EINVAL; mmc_init_card() 1526 card->ext_csd.enhanced_area_size = -EINVAL; mmc_init_card() 1528 card->ext_csd.erase_group_def = 1; mmc_init_card() 1541 if (card->ext_csd.part_config & EXT_CSD_PART_CONFIG_ACC_MASK) { mmc_init_card() 1542 card->ext_csd.part_config &= ~EXT_CSD_PART_CONFIG_ACC_MASK; mmc_init_card() 1544 card->ext_csd.part_config, mmc_init_card() 1545 card->ext_csd.part_time); mmc_init_card() 1551 * Enable power_off_notification byte in the ext_csd register mmc_init_card() 1553 if (card->ext_csd.rev >= 6) { mmc_init_card() 1557 card->ext_csd.generic_cmd6_time); mmc_init_card() 1566 card->ext_csd.power_off_notification = EXT_CSD_POWER_ON; mmc_init_card() 1602 if (card->ext_csd.hpi) { mmc_init_card() 1605 card->ext_csd.generic_cmd6_time); mmc_init_card() 1613 card->ext_csd.hpi_en = 1; mmc_init_card() 1620 if (card->ext_csd.cache_size > 0) { mmc_init_card() 1623 card->ext_csd.generic_cmd6_time); mmc_init_card() 1633 card->ext_csd.cache_ctrl = 0; mmc_init_card() 1636 card->ext_csd.cache_ctrl = 1; mmc_init_card() 1644 if (card->ext_csd.max_packed_writes >= 3 && mmc_init_card() 1645 card->ext_csd.max_packed_reads >= 5 && mmc_init_card() 1650 card->ext_csd.generic_cmd6_time); mmc_init_card() 1656 card->ext_csd.packed_event_en = 0; mmc_init_card() 1659 card->ext_csd.packed_event_en = 1; mmc_init_card() 1677 return (card && card->ext_csd.rev >= 3); mmc_can_sleep() 1684 unsigned int timeout_ms = DIV_ROUND_UP(card->ext_csd.sa_timeout, 10000); mmc_sleep() 1733 (card->ext_csd.power_off_notification == EXT_CSD_POWER_ON); mmc_can_poweroff_notify() 1738 unsigned int timeout = card->ext_csd.generic_cmd6_time; mmc_poweroff_notify() 1743 timeout = card->ext_csd.power_off_longtime; mmc_poweroff_notify() 1753 card->ext_csd.power_off_notification = EXT_CSD_NO_POWER_NOTIFICATION; mmc_poweroff_notify() 1967 rst_n_function = card->ext_csd.rst_n_function; mmc_can_reset()
|
H A D | debugfs.c | 307 u8 *ext_csd; mmc_ext_csd_open() local 315 err = mmc_get_ext_csd(card, &ext_csd); mmc_ext_csd_open() 321 n += sprintf(buf + n, "%02x", ext_csd[i]); mmc_ext_csd_open() 326 kfree(ext_csd); mmc_ext_csd_open() 384 if (!debugfs_create_file("ext_csd", S_IRUSR, root, card, mmc_add_card_debugfs()
|
H A D | mmc_ops.c | 396 u8 *ext_csd; mmc_get_ext_csd() local 405 * As the ext_csd is so large and mostly unused, we don't store the mmc_get_ext_csd() 408 ext_csd = kzalloc(512, GFP_KERNEL); mmc_get_ext_csd() 409 if (!ext_csd) mmc_get_ext_csd() 412 err = mmc_send_cxd_data(card, card->host, MMC_SEND_EXT_CSD, ext_csd, mmc_get_ext_csd() 415 kfree(ext_csd); mmc_get_ext_csd() 417 *new_ext_csd = ext_csd; mmc_get_ext_csd() 765 if (!card->ext_csd.hpi) { mmc_send_hpi_cmd() 771 opcode = card->ext_csd.hpi_cmd; mmc_send_hpi_cmd()
|
H A D | core.c | 317 if (!card->ext_csd.man_bkops_en || mmc_card_doing_bkops(card)) mmc_start_bkops() 327 if (!card->ext_csd.raw_bkops_status) mmc_start_bkops() 330 if (card->ext_csd.raw_bkops_status < EXT_CSD_BKOPS_LEVEL_2 && mmc_start_bkops() 335 if (card->ext_csd.raw_bkops_status >= EXT_CSD_BKOPS_LEVEL_2) { mmc_start_bkops() 672 if (!card->ext_csd.hpi_en) { mmc_interrupt_hpi() 708 prg_wait = jiffies + msecs_to_jiffies(card->ext_csd.out_of_int_time); mmc_interrupt_hpi() 786 u8 *ext_csd; mmc_read_bkops_status() local 789 err = mmc_get_ext_csd(card, &ext_csd); mmc_read_bkops_status() 794 card->ext_csd.raw_bkops_status = ext_csd[EXT_CSD_BKOPS_STATUS]; mmc_read_bkops_status() 795 card->ext_csd.raw_exception_status = ext_csd[EXT_CSD_EXP_EVENTS_STATUS]; mmc_read_bkops_status() 796 kfree(ext_csd); mmc_read_bkops_status() 1930 } else if (card->ext_csd.hc_erase_size) { mmc_init_erase() 1931 card->pref_erase = card->ext_csd.hc_erase_size; mmc_init_erase() 1959 (arg == MMC_TRIM_ARG && card->ext_csd.rev >= 6)) { mmc_mmc_erase_timeout() 1960 erase_timeout = card->ext_csd.trim_timeout; mmc_mmc_erase_timeout() 1961 } else if (card->ext_csd.erase_group_def & 1) { mmc_mmc_erase_timeout() 1964 erase_timeout = card->ext_csd.trim_timeout; mmc_mmc_erase_timeout() 1966 erase_timeout = card->ext_csd.hc_erase_timeout; mmc_mmc_erase_timeout() 2000 erase_timeout *= card->ext_csd.sec_erase_mult; mmc_mmc_erase_timeout() 2002 erase_timeout *= card->ext_csd.sec_trim_mult; mmc_mmc_erase_timeout() 2195 !(card->ext_csd.sec_feature_support & EXT_CSD_SEC_ER_EN)) mmc_erase() 2199 !(card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN)) mmc_erase() 2264 if ((card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) && mmc_can_trim() 2277 if (card->ext_csd.feature_support & MMC_DISCARD_FEATURE) mmc_can_discard() 2287 if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE) mmc_can_sanitize() 2295 if ((card->ext_csd.sec_feature_support & EXT_CSD_SEC_ER_EN) && mmc_can_secure_erase_trim() 2384 if (mmc_card_mmc(card) && !(card->ext_csd.erase_group_def & 1)) mmc_calc_max_discard() 2749 (card->ext_csd.cache_size > 0) && mmc_flush_cache() 2750 (card->ext_csd.cache_ctrl & 1)) { mmc_flush_cache()
|
/linux-4.4.14/drivers/mmc/card/ |
H A D | block.c | 206 if (card->ext_csd.boot_ro_lock & EXT_CSD_BOOT_WP_B_PERM_WP_EN) power_ro_lock_show() 208 else if (card->ext_csd.boot_ro_lock & EXT_CSD_BOOT_WP_B_PWR_WP_EN) power_ro_lock_show() 238 card->ext_csd.boot_ro_lock | power_ro_lock_store() 240 card->ext_csd.part_time); power_ro_lock_store() 244 card->ext_csd.boot_ro_lock |= EXT_CSD_BOOT_WP_B_PWR_WP_EN; power_ro_lock_store() 753 u8 part_config = card->ext_csd.part_config; mmc_blk_part_switch() 760 card->ext_csd.part_time); mmc_blk_part_switch() 764 card->ext_csd.part_config = part_config; mmc_blk_part_switch() 1282 if (!(card->ext_csd.rel_param & EXT_CSD_WR_REL_PARAM_EN)) { mmc_apply_rel_rw() 1284 if (!IS_ALIGNED(brq->cmd.arg, card->ext_csd.rel_sectors)) mmc_apply_rel_rw() 1287 if (brq->data.blocks > card->ext_csd.rel_sectors) mmc_apply_rel_rw() 1288 brq->data.blocks = card->ext_csd.rel_sectors; mmc_apply_rel_rw() 1289 else if (brq->data.blocks < card->ext_csd.rel_sectors) mmc_apply_rel_rw() 1422 u8 *ext_csd; mmc_blk_packed_err_check() local 1436 err = mmc_get_ext_csd(card, &ext_csd); mmc_blk_packed_err_check() 1438 pr_err("%s: error %d sending ext_csd\n", mmc_blk_packed_err_check() 1443 if ((ext_csd[EXT_CSD_EXP_EVENTS_STATUS] & mmc_blk_packed_err_check() 1445 (ext_csd[EXT_CSD_PACKED_CMD_STATUS] & mmc_blk_packed_err_check() 1447 if (ext_csd[EXT_CSD_PACKED_CMD_STATUS] & mmc_blk_packed_err_check() 1450 ext_csd[EXT_CSD_PACKED_FAILURE_INDEX] - 1; mmc_blk_packed_err_check() 1458 kfree(ext_csd); mmc_blk_packed_err_check() 1559 do_data_tag = (card->ext_csd.data_tag_unit_size) && mmc_blk_rw_rq_prep() 1563 card->ext_csd.data_tag_unit_size); mmc_blk_rw_rq_prep() 1647 bool en_rel_wr = card->ext_csd.rel_param & EXT_CSD_WR_REL_PARAM_EN; mmc_blk_prep_packed_list() 1659 max_packed_rw = card->ext_csd.max_packed_writes; mmc_blk_prep_packed_list() 1779 do_data_tag = (card->ext_csd.data_tag_unit_size) && mmc_blk_packed_hdr_wrq_prep() 1783 card->ext_csd.data_tag_unit_size); mmc_blk_packed_hdr_wrq_prep() 1959 (card->ext_csd.data_sector_size == 4096)) { mmc_blk_issue_rw_rq() 2275 card->ext_csd.data_sector_size); mmc_blk_alloc_req() 2290 ((card->ext_csd.rel_param & EXT_CSD_WR_REL_PARAM_EN) || mmc_blk_alloc_req() 2291 card->ext_csd.rel_sectors)) { mmc_blk_alloc_req() 2299 card->ext_csd.packed_event_en) { mmc_blk_alloc_req() 2323 size = card->ext_csd.sectors; mmc_blk_alloc() 2409 card->ext_csd.boot_ro_lockable) mmc_blk_remove_req() 2449 card->ext_csd.boot_ro_lockable) { mmc_add_disk() 2452 if (card->ext_csd.boot_ro_lock & EXT_CSD_BOOT_WP_B_PWR_WP_DIS) mmc_add_disk()
|
H A D | mmc_test.c | 596 return card->ext_csd.sectors; mmc_test_capacity()
|
/linux-4.4.14/include/linux/mmc/ |
H A D | card.h | 295 struct mmc_ext_csd ext_csd; /* mmc v4 extended card specific */ member in struct:mmc_card 335 return card->ext_csd.data_sector_size == 4096; mmc_large_sector()
|