Lines Matching refs:ext_csd
38 int read_extcsd(int fd, __u8 *ext_csd) in read_extcsd() argument
43 memset(ext_csd, 0, sizeof(__u8) * 512); in read_extcsd()
50 mmc_ioc_cmd_set_data(idata, ext_csd); in read_extcsd()
99 void print_writeprotect_status(__u8 *ext_csd) in print_writeprotect_status() argument
102 __u8 ext_csd_rev = ext_csd[EXT_CSD_REV]; in print_writeprotect_status()
107 " [BOOT_WP_STATUS]: 0x%02x\n", ext_csd[174]); in print_writeprotect_status()
109 reg = ext_csd[EXT_CSD_BOOT_WP]; in print_writeprotect_status()
135 __u8 ext_csd[512]; in do_writeprotect_get() local
150 ret = read_extcsd(fd, ext_csd); in do_writeprotect_get()
156 print_writeprotect_status(ext_csd); in do_writeprotect_get()
163 __u8 ext_csd[512], value; in do_writeprotect_set() local
178 ret = read_extcsd(fd, ext_csd); in do_writeprotect_set()
184 value = ext_csd[EXT_CSD_BOOT_WP] | in do_writeprotect_set()
199 __u8 ext_csd[512], native_sector_size, data_sector_size, wr_rel_param; in do_disable_512B_emulation() local
212 ret = read_extcsd(fd, ext_csd); in do_disable_512B_emulation()
218 wr_rel_param = ext_csd[EXT_CSD_WR_REL_PARAM]; in do_disable_512B_emulation()
219 native_sector_size = ext_csd[EXT_CSD_NATIVE_SECTOR_SIZE]; in do_disable_512B_emulation()
220 data_sector_size = ext_csd[EXT_CSD_DATA_SECTOR_SIZE]; in do_disable_512B_emulation()
243 __u8 ext_csd[512]; in do_write_boot_en() local
267 ret = read_extcsd(fd, ext_csd); in do_write_boot_en()
273 value = ext_csd[EXT_CSD_PART_CONFIG]; in do_write_boot_en()
309 __u8 ext_csd[512]; in do_boot_bus_conditions_set() local
357 ret = read_extcsd(fd, ext_csd); in do_boot_bus_conditions_set()
363 ext_csd[EXT_CSD_BOOT_BUS_CONDITIONS], value); in do_boot_bus_conditions_set()
378 __u8 ext_csd[512]; in do_hwreset() local
393 ret = read_extcsd(fd, ext_csd); in do_hwreset()
399 if ((ext_csd[EXT_CSD_RST_N_FUNCTION] & EXT_CSD_RST_N_EN_MASK) == in do_hwreset()
406 if ((ext_csd[EXT_CSD_RST_N_FUNCTION] & EXT_CSD_RST_N_EN_MASK) == in do_hwreset()
437 __u8 ext_csd[512], value = 0; in do_write_bkops_en() local
452 ret = read_extcsd(fd, ext_csd); in do_write_bkops_en()
458 if (!(ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1)) { in do_write_bkops_en()
501 unsigned int get_sector_count(__u8 *ext_csd) in get_sector_count() argument
503 return (ext_csd[EXT_CSD_SEC_COUNT_3] << 24) | in get_sector_count()
504 (ext_csd[EXT_CSD_SEC_COUNT_2] << 16) | in get_sector_count()
505 (ext_csd[EXT_CSD_SEC_COUNT_1] << 8) | in get_sector_count()
506 ext_csd[EXT_CSD_SEC_COUNT_0]; in get_sector_count()
509 int is_blockaddresed(__u8 *ext_csd) in is_blockaddresed() argument
511 unsigned int sectors = get_sector_count(ext_csd); in is_blockaddresed()
516 unsigned int get_hc_wp_grp_size(__u8 *ext_csd) in get_hc_wp_grp_size() argument
518 return ext_csd[221]; in get_hc_wp_grp_size()
521 unsigned int get_hc_erase_grp_size(__u8 *ext_csd) in get_hc_erase_grp_size() argument
523 return ext_csd[224]; in get_hc_erase_grp_size()
573 __u8 ext_csd[512]; in check_enhanced_area_total_limit() local
581 ret = read_extcsd(fd, ext_csd); in check_enhanced_area_total_limit()
586 wp_sz = get_hc_wp_grp_size(ext_csd); in check_enhanced_area_total_limit()
587 erase_sz = get_hc_erase_grp_size(ext_csd); in check_enhanced_area_total_limit()
589 regl = (ext_csd[EXT_CSD_GP_SIZE_MULT_4_2] << 16) | in check_enhanced_area_total_limit()
590 (ext_csd[EXT_CSD_GP_SIZE_MULT_4_1] << 8) | in check_enhanced_area_total_limit()
591 ext_csd[EXT_CSD_GP_SIZE_MULT_4_0]; in check_enhanced_area_total_limit()
593 if (ext_csd[EXT_CSD_PARTITIONS_ATTRIBUTE] & EXT_CSD_ENH_4) { in check_enhanced_area_total_limit()
599 regl = (ext_csd[EXT_CSD_GP_SIZE_MULT_3_2] << 16) | in check_enhanced_area_total_limit()
600 (ext_csd[EXT_CSD_GP_SIZE_MULT_3_1] << 8) | in check_enhanced_area_total_limit()
601 ext_csd[EXT_CSD_GP_SIZE_MULT_3_0]; in check_enhanced_area_total_limit()
603 if (ext_csd[EXT_CSD_PARTITIONS_ATTRIBUTE] & EXT_CSD_ENH_3) { in check_enhanced_area_total_limit()
609 regl = (ext_csd[EXT_CSD_GP_SIZE_MULT_2_2] << 16) | in check_enhanced_area_total_limit()
610 (ext_csd[EXT_CSD_GP_SIZE_MULT_2_1] << 8) | in check_enhanced_area_total_limit()
611 ext_csd[EXT_CSD_GP_SIZE_MULT_2_0]; in check_enhanced_area_total_limit()
613 if (ext_csd[EXT_CSD_PARTITIONS_ATTRIBUTE] & EXT_CSD_ENH_2) { in check_enhanced_area_total_limit()
619 regl = (ext_csd[EXT_CSD_GP_SIZE_MULT_1_2] << 16) | in check_enhanced_area_total_limit()
620 (ext_csd[EXT_CSD_GP_SIZE_MULT_1_1] << 8) | in check_enhanced_area_total_limit()
621 ext_csd[EXT_CSD_GP_SIZE_MULT_1_0]; in check_enhanced_area_total_limit()
623 if (ext_csd[EXT_CSD_PARTITIONS_ATTRIBUTE] & EXT_CSD_ENH_1) { in check_enhanced_area_total_limit()
629 regl = (ext_csd[EXT_CSD_ENH_SIZE_MULT_2] << 16) | in check_enhanced_area_total_limit()
630 (ext_csd[EXT_CSD_ENH_SIZE_MULT_1] << 8) | in check_enhanced_area_total_limit()
631 ext_csd[EXT_CSD_ENH_SIZE_MULT_0]; in check_enhanced_area_total_limit()
633 if (ext_csd[EXT_CSD_PARTITIONS_ATTRIBUTE] & EXT_CSD_ENH_USR) { in check_enhanced_area_total_limit()
639 regl = (ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT_2] << 16) | in check_enhanced_area_total_limit()
640 (ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT_1] << 8) | in check_enhanced_area_total_limit()
641 ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT_0]; in check_enhanced_area_total_limit()
651 total_sz = get_sector_count(ext_csd) / 2; in check_enhanced_area_total_limit()
667 __u8 ext_csd[512]; in do_create_gp_partition() local
704 ret = read_extcsd(fd, ext_csd); in do_create_gp_partition()
711 if (ext_csd[EXT_CSD_PARTITION_SETTING_COMPLETED]) { in do_create_gp_partition()
716 align = 512l * get_hc_wp_grp_size(ext_csd) * get_hc_erase_grp_size(ext_csd); in do_create_gp_partition()
752 value = ext_csd[EXT_CSD_PARTITIONS_ATTRIBUTE]; in do_create_gp_partition()
766 value = ext_csd[address]; in do_create_gp_partition()
792 __u8 ext_csd[512]; in do_enh_area_set() local
815 ret = read_extcsd(fd, ext_csd); in do_enh_area_set()
822 if (!(ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & EXT_CSD_ENH_ATTRIBUTE_EN)) in do_enh_area_set()
829 if (ext_csd[EXT_CSD_PARTITION_SETTING_COMPLETED]) in do_enh_area_set()
835 align = 512l * get_hc_wp_grp_size(ext_csd) * get_hc_erase_grp_size(ext_csd); in do_enh_area_set()
839 enh_start_addr = start_kib * 1024 / (is_blockaddresed(ext_csd) ? 512 : 1); in do_enh_area_set()
910 value = ext_csd[EXT_CSD_PARTITIONS_ATTRIBUTE] | EXT_CSD_ENH_USR; in do_enh_area_set()
934 __u8 ext_csd[512]; in do_write_reliability_set() local
956 ret = read_extcsd(fd, ext_csd); in do_write_reliability_set()
963 if (ext_csd[EXT_CSD_PARTITION_SETTING_COMPLETED]) in do_write_reliability_set()
970 if (!(ext_csd[EXT_CSD_WR_REL_PARAM] & HS_CTRL_REL)) { in do_write_reliability_set()
976 value = ext_csd[EXT_CSD_WR_REL_SET] | (1<<partition); in do_write_reliability_set()
995 __u8 ext_csd[512], ext_csd_rev, reg; in do_read_extcsd() local
1012 ret = read_extcsd(fd, ext_csd); in do_read_extcsd()
1018 ext_csd_rev = ext_csd[EXT_CSD_REV]; in do_read_extcsd()
1056 reg = ext_csd[EXT_CSD_S_CMD_SET]; in do_read_extcsd()
1061 reg = ext_csd[EXT_CSD_HPI_FEATURE]; in do_read_extcsd()
1071 ext_csd[502]); in do_read_extcsd()
1075 ext_csd[501]); in do_read_extcsd()
1077 ext_csd[500]); in do_read_extcsd()
1079 ext_csd[499]); in do_read_extcsd()
1082 ext_csd[498]); in do_read_extcsd()
1084 ext_csd[497]); in do_read_extcsd()
1086 " [CONTEXT_CAPABILITIES: 0x%02x]\n", ext_csd[496]); in do_read_extcsd()
1088 ext_csd[495]); in do_read_extcsd()
1090 " [EXT_SUPPORT: 0x%02x]\n", ext_csd[494]); in do_read_extcsd()
1092 ext_csd[248]); in do_read_extcsd()
1094 ext_csd[247]); in do_read_extcsd()
1096 ext_csd[249] << 0 | (ext_csd[250] << 8) | in do_read_extcsd()
1097 (ext_csd[251] << 16) | (ext_csd[252] << 24)); in do_read_extcsd()
1104 " [BKOPS_STATUS: 0x%02x]\n", ext_csd[246]); in do_read_extcsd()
1109 " [INI_TIMEOUT_AP: 0x%02x]\n", ext_csd[241]); in do_read_extcsd()
1113 " [PWR_CL_DDR_52_360: 0x%02x]\n", ext_csd[239]); in do_read_extcsd()
1115 " [PWR_CL_DDR_52_195: 0x%02x]\n", ext_csd[238]); in do_read_extcsd()
1121 " [PWR_CL_200_360: 0x%02x]\n", ext_csd[237]); in do_read_extcsd()
1123 " [PWR_CL_200_195: 0x%02x]\n", ext_csd[236]); in do_read_extcsd()
1126 printf(" [MIN_PERF_DDR_W_8_52: 0x%02x]\n", ext_csd[235]); in do_read_extcsd()
1127 printf(" [MIN_PERF_DDR_R_8_52: 0x%02x]\n", ext_csd[234]); in do_read_extcsd()
1129 printf("TRIM Multiplier [TRIM_MULT: 0x%02x]\n", ext_csd[232]); in do_read_extcsd()
1131 ext_csd[231]); in do_read_extcsd()
1135 ext_csd[230]); in do_read_extcsd()
1137 ext_csd[229]); in do_read_extcsd()
1139 reg = ext_csd[EXT_CSD_BOOT_INFO]; in do_read_extcsd()
1149 printf("Boot partition size [BOOT_SIZE_MULTI: 0x%02x]\n", ext_csd[226]); in do_read_extcsd()
1150 printf("Access size [ACC_SIZE: 0x%02x]\n", ext_csd[225]); in do_read_extcsd()
1152 reg = get_hc_erase_grp_size(ext_csd); in do_read_extcsd()
1158 ext_csd[223]); in do_read_extcsd()
1160 ext_csd[222]); in do_read_extcsd()
1162 reg = get_hc_wp_grp_size(ext_csd); in do_read_extcsd()
1165 printf(" i.e. %lu KiB\n", 512l * get_hc_erase_grp_size(ext_csd) * reg); in do_read_extcsd()
1167 printf("Sleep current (VCC) [S_C_VCC: 0x%02x]\n", ext_csd[220]); in do_read_extcsd()
1168 printf("Sleep current (VCCQ) [S_C_VCCQ: 0x%02x]\n", ext_csd[219]); in do_read_extcsd()
1170 printf("Sleep/awake timeout [S_A_TIMEOUT: 0x%02x]\n", ext_csd[217]); in do_read_extcsd()
1173 unsigned int sectors = get_sector_count(ext_csd); in do_read_extcsd()
1175 if (is_blockaddresed(ext_csd)) in do_read_extcsd()
1182 printf(" [MIN_PERF_W_8_52: 0x%02x]\n", ext_csd[210]); in do_read_extcsd()
1183 printf(" [MIN_PERF_R_8_52: 0x%02x]\n", ext_csd[209]); in do_read_extcsd()
1184 printf(" [MIN_PERF_W_8_26_4_52: 0x%02x]\n", ext_csd[208]); in do_read_extcsd()
1185 printf(" [MIN_PERF_R_8_26_4_52: 0x%02x]\n", ext_csd[207]); in do_read_extcsd()
1187 printf(" [MIN_PERF_W_4_26: 0x%02x]\n", ext_csd[206]); in do_read_extcsd()
1188 printf(" [MIN_PERF_R_4_26: 0x%02x]\n", ext_csd[205]); in do_read_extcsd()
1191 printf(" [PWR_CL_26_360: 0x%02x]\n", ext_csd[203]); in do_read_extcsd()
1192 printf(" [PWR_CL_52_360: 0x%02x]\n", ext_csd[202]); in do_read_extcsd()
1193 printf(" [PWR_CL_26_195: 0x%02x]\n", ext_csd[201]); in do_read_extcsd()
1194 printf(" [PWR_CL_52_195: 0x%02x]\n", ext_csd[200]); in do_read_extcsd()
1199 "[PARTITION_SWITCH_TIME: 0x%02x]\n", ext_csd[199]); in do_read_extcsd()
1201 " [OUT_OF_INTERRUPT_TIME: 0x%02x]\n", ext_csd[198]); in do_read_extcsd()
1209 ext_csd[197]); in do_read_extcsd()
1212 reg = ext_csd[196]; in do_read_extcsd()
1221 printf("CSD structure version [CSD_STRUCTURE: 0x%02x]\n", ext_csd[194]); in do_read_extcsd()
1223 printf("Command set [CMD_SET: 0x%02x]\n", ext_csd[191]); in do_read_extcsd()
1224 printf("Command set revision [CMD_SET_REV: 0x%02x]\n", ext_csd[189]); in do_read_extcsd()
1225 printf("Power class [POWER_CLASS: 0x%02x]\n", ext_csd[187]); in do_read_extcsd()
1227 ext_csd[185]); in do_read_extcsd()
1230 ext_csd[181]); in do_read_extcsd()
1231 reg = ext_csd[EXT_CSD_BOOT_CFG]; in do_read_extcsd()
1267 ext_csd[178]); in do_read_extcsd()
1269 ext_csd[177]); in do_read_extcsd()
1271 " [ERASE_GROUP_DEF: 0x%02x]\n", ext_csd[EXT_CSD_ERASE_GROUP_DEF]); in do_read_extcsd()
1273 print_writeprotect_status(ext_csd); in do_read_extcsd()
1278 " [USER_WP]: 0x%02x\n", ext_csd[171]); in do_read_extcsd()
1280 printf("FW configuration [FW_CONFIG]: 0x%02x\n", ext_csd[169]); in do_read_extcsd()
1281 printf("RPMB Size [RPMB_SIZE_MULT]: 0x%02x\n", ext_csd[168]); in do_read_extcsd()
1283 reg = ext_csd[EXT_CSD_WR_REL_SET]; in do_read_extcsd()
1299 reg = ext_csd[EXT_CSD_WR_REL_PARAM]; in do_read_extcsd()
1311 " [BKOPS_EN]: 0x%02x\n", ext_csd[163]); in do_read_extcsd()
1313 " [RST_N_FUNCTION]: 0x%02x\n", ext_csd[162]); in do_read_extcsd()
1314 printf("HPI management [HPI_MGMT]: 0x%02x\n", ext_csd[161]); in do_read_extcsd()
1315 reg = ext_csd[EXT_CSD_PARTITIONING_SUPPORT]; in do_read_extcsd()
1327 regl = (ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT_2] << 16) | in do_read_extcsd()
1328 (ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT_1] << 8) | in do_read_extcsd()
1329 ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT_0]; in do_read_extcsd()
1333 unsigned int wp_sz = get_hc_wp_grp_size(ext_csd); in do_read_extcsd()
1334 unsigned int erase_sz = get_hc_erase_grp_size(ext_csd); in do_read_extcsd()
1338 ext_csd[EXT_CSD_PARTITIONS_ATTRIBUTE]); in do_read_extcsd()
1339 reg = ext_csd[EXT_CSD_PARTITION_SETTING_COMPLETED]; in do_read_extcsd()
1349 " [GP_SIZE_MULT_4]: 0x%06x\n", (ext_csd[154] << 16) | in do_read_extcsd()
1350 (ext_csd[153] << 8) | ext_csd[152]); in do_read_extcsd()
1351 printf(" [GP_SIZE_MULT_3]: 0x%06x\n", (ext_csd[151] << 16) | in do_read_extcsd()
1352 (ext_csd[150] << 8) | ext_csd[149]); in do_read_extcsd()
1353 printf(" [GP_SIZE_MULT_2]: 0x%06x\n", (ext_csd[148] << 16) | in do_read_extcsd()
1354 (ext_csd[147] << 8) | ext_csd[146]); in do_read_extcsd()
1355 printf(" [GP_SIZE_MULT_1]: 0x%06x\n", (ext_csd[145] << 16) | in do_read_extcsd()
1356 (ext_csd[144] << 8) | ext_csd[143]); in do_read_extcsd()
1358 regl = (ext_csd[EXT_CSD_ENH_SIZE_MULT_2] << 16) | in do_read_extcsd()
1359 (ext_csd[EXT_CSD_ENH_SIZE_MULT_1] << 8) | in do_read_extcsd()
1360 ext_csd[EXT_CSD_ENH_SIZE_MULT_0]; in do_read_extcsd()
1364 get_hc_erase_grp_size(ext_csd) * in do_read_extcsd()
1365 get_hc_wp_grp_size(ext_csd)); in do_read_extcsd()
1367 regl = (ext_csd[EXT_CSD_ENH_START_ADDR_3] << 24) | in do_read_extcsd()
1368 (ext_csd[EXT_CSD_ENH_START_ADDR_2] << 16) | in do_read_extcsd()
1369 (ext_csd[EXT_CSD_ENH_START_ADDR_1] << 8) | in do_read_extcsd()
1370 ext_csd[EXT_CSD_ENH_START_ADDR_0]; in do_read_extcsd()
1373 printf(" i.e. %lu bytes offset\n", (is_blockaddresed(ext_csd) ? in do_read_extcsd()
1378 " [SEC_BAD_BLK_MGMNT]: 0x%02x\n", ext_csd[134]); in do_read_extcsd()
1386 ext_csd[131]); in do_read_extcsd()
1389 ext_csd[130]); in do_read_extcsd()
1394 j, ext_csd[j]); in do_read_extcsd()
1397 ext_csd[63]); in do_read_extcsd()
1399 ext_csd[62]); in do_read_extcsd()
1400 printf("Sector size [DATA_SECTOR_SIZE]: 0x%02x\n", ext_csd[61]); in do_read_extcsd()
1403 ext_csd[60]); in do_read_extcsd()
1405 ext_csd[59]); in do_read_extcsd()
1407 "[DYNCAP_NEEDED]: 0x%02x\n", ext_csd[58]); in do_read_extcsd()
1410 (ext_csd[57] << 8) | ext_csd[56]); in do_read_extcsd()
1413 (ext_csd[55] << 8) | ext_csd[54]); in do_read_extcsd()
1416 (ext_csd[53] << 8) | ext_csd[52]); in do_read_extcsd()
1420 " [CONTEXT_CONF[%d]]: 0x%02x\n", j, ext_csd[j]); in do_read_extcsd()
1423 " [PACKED_COMMAND_STATUS]: 0x%02x\n", ext_csd[36]); in do_read_extcsd()
1425 " [PACKED_FAILURE_INDEX]: 0x%02x\n", ext_csd[35]); in do_read_extcsd()
1427 " [POWER_OFF_NOTIFICATION]: 0x%02x\n", ext_csd[34]); in do_read_extcsd()
1429 " [CACHE_CTRL]: 0x%02x\n", ext_csd[33]); in do_read_extcsd()
1978 __u8 ext_csd[512]; in do_cache_ctrl() local
1993 ret = read_extcsd(fd, ext_csd); in do_cache_ctrl()
1999 if (ext_csd[EXT_CSD_REV] < EXT_CSD_REV_V4_5) { in do_cache_ctrl()
2007 if (!(ext_csd[EXT_CSD_CACHE_SIZE_3] || in do_cache_ctrl()
2008 ext_csd[EXT_CSD_CACHE_SIZE_2] || in do_cache_ctrl()
2009 ext_csd[EXT_CSD_CACHE_SIZE_1] || in do_cache_ctrl()
2010 ext_csd[EXT_CSD_CACHE_SIZE_0])) { in do_cache_ctrl()