Lines Matching refs:mmc
19 static void print_mmcinfo(struct mmc *mmc) in print_mmcinfo() argument
27 printf("Device: %s\n", mmc->cfg->name); in print_mmcinfo()
28 printf("Manufacturer ID: %x\n", mmc->cid[0] >> 24); in print_mmcinfo()
29 printf("OEM: %x\n", (mmc->cid[0] >> 8) & 0xffff); in print_mmcinfo()
30 printf("Name: %c%c%c%c%c \n", mmc->cid[0] & 0xff, in print_mmcinfo()
31 (mmc->cid[1] >> 24), (mmc->cid[1] >> 16) & 0xff, in print_mmcinfo()
32 (mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff); in print_mmcinfo()
34 printf("Timing Interface: %s\n", timing[mmc->timing]); in print_mmcinfo()
35 printf("Tran Speed: %d\n", mmc->clock); in print_mmcinfo()
36 printf("Rd Block Len: %d\n", mmc->read_bl_len); in print_mmcinfo()
38 printf("%s version %d.%d", IS_SD(mmc) ? "SD" : "MMC", in print_mmcinfo()
39 EXTRACT_SDMMC_MAJOR_VERSION(mmc->version), in print_mmcinfo()
40 EXTRACT_SDMMC_MINOR_VERSION(mmc->version)); in print_mmcinfo()
41 if (EXTRACT_SDMMC_CHANGE_VERSION(mmc->version) != 0) in print_mmcinfo()
42 printf(".%d", EXTRACT_SDMMC_CHANGE_VERSION(mmc->version)); in print_mmcinfo()
45 printf("High Capacity: %s\n", mmc->high_capacity ? "Yes" : "No"); in print_mmcinfo()
47 print_size(mmc->capacity, "\n"); in print_mmcinfo()
49 printf("Bus Width: %d-bit%s\n", mmc->bus_width, in print_mmcinfo()
50 mmc_card_ddr(mmc) ? " DDR" : ""); in print_mmcinfo()
53 print_size(((u64)mmc->erase_grp_size) << 9, "\n"); in print_mmcinfo()
55 if (!IS_SD(mmc) && mmc->version >= MMC_VERSION_4_41) { in print_mmcinfo()
56 bool has_enh = (mmc->part_support & ENHNCD_SUPPORT) != 0; in print_mmcinfo()
57 bool usr_enh = has_enh && (mmc->part_attr & EXT_CSD_ENH_USR); in print_mmcinfo()
60 print_size(((u64)mmc->hc_wp_grp_size) << 9, "\n"); in print_mmcinfo()
63 print_size(mmc->capacity_user, usr_enh ? " ENH" : ""); in print_mmcinfo()
64 if (mmc->wr_rel_set & EXT_CSD_WR_DATA_REL_USR) in print_mmcinfo()
70 print_size(mmc->enh_user_start, "\n"); in print_mmcinfo()
72 print_size(mmc->enh_user_size, "\n"); in print_mmcinfo()
75 print_size(mmc->capacity_boot, has_enh ? " ENH\n" : "\n"); in print_mmcinfo()
77 print_size(mmc->capacity_rpmb, has_enh ? " ENH\n" : "\n"); in print_mmcinfo()
79 for (i = 0; i < ARRAY_SIZE(mmc->capacity_gp); i++) { in print_mmcinfo()
81 (mmc->part_attr & EXT_CSD_ENH_GP(i)); in print_mmcinfo()
82 if (mmc->capacity_gp[i]) { in print_mmcinfo()
84 print_size(mmc->capacity_gp[i], in print_mmcinfo()
86 if (mmc->wr_rel_set & EXT_CSD_WR_DATA_REL_GP(i)) in print_mmcinfo()
94 static struct mmc *init_mmc_device(int dev, bool force_init) in init_mmc_device()
96 struct mmc *mmc; in init_mmc_device() local
97 mmc = find_mmc_device(dev); in init_mmc_device()
98 if (!mmc) { in init_mmc_device()
104 mmc->has_init = 0; in init_mmc_device()
105 if (mmc_init(mmc)) in init_mmc_device()
107 return mmc; in init_mmc_device()
111 struct mmc *mmc; in do_mmcinfo() local
122 mmc = init_mmc_device(curr_device, false); in do_mmcinfo()
123 if (!mmc) in do_mmcinfo()
126 print_mmcinfo(mmc); in do_mmcinfo()
135 struct mmc *mmc; in do_mmc_test_secure_storage() local
147 mmc = init_mmc_device(curr_device, false); in do_mmc_test_secure_storage()
148 if (!mmc) in do_mmc_test_secure_storage()
193 struct mmc *mmc; in init_rpmb() local
204 mmc = init_mmc_device(curr_device, false); in init_rpmb()
205 if (!mmc) in init_rpmb()
208 if (!(mmc->version & MMC_VERSION_MMC)) { in init_rpmb()
212 if (mmc->version < MMC_VERSION_4_41) { in init_rpmb()
219 temp_original_part = mmc->block_dev.hwpart; in init_rpmb()
222 temp_original_part = mmc_get_blk_desc(mmc)->hwpart; in init_rpmb()
251 struct mmc *mmc = find_mmc_device(curr_device); in do_readcounter() local
252 if (!mmc) in do_readcounter()
255 ret = read_counter(mmc, requestpackets); in do_readcounter()
266 struct mmc *mmc = find_mmc_device(curr_device); in do_programkey() local
267 if (!mmc) in do_programkey()
273 ret = program_key(mmc, requestpackets); in do_programkey()
284 struct mmc *mmc = find_mmc_device(curr_device); in do_authenticatedread() local
285 if (!mmc) in do_authenticatedread()
291 ret = authenticated_read(mmc, requestpackets, block_count); in do_authenticatedread()
302 struct mmc *mmc = find_mmc_device(curr_device); in do_authenticatedwrite() local
303 if (!mmc) in do_authenticatedwrite()
309 ret = authenticated_write(mmc, requestpackets); in do_authenticatedwrite()
317 struct mmc *do_returnmmc(void) in do_returnmmc()
319 struct mmc *mmc; in do_returnmmc() local
324 mmc = find_mmc_device(curr_device); in do_returnmmc()
329 return mmc; in do_returnmmc()
347 struct mmc *mmc = find_mmc_device(curr_device); in do_mmcrpmb_key() local
355 if (mmc_rpmb_set_key(mmc, key_addr)) { in do_mmcrpmb_key()
368 struct mmc *mmc = find_mmc_device(curr_device); in do_mmcrpmb_read() local
382 n = mmc_rpmb_read(mmc, addr, blk, cnt, key_addr); in do_mmcrpmb_read()
396 struct mmc *mmc = find_mmc_device(curr_device); in do_mmcrpmb_write() local
408 n = mmc_rpmb_write(mmc, addr, blk, cnt, key_addr); in do_mmcrpmb_write()
419 struct mmc *mmc = find_mmc_device(curr_device); in do_mmcrpmb_counter() local
421 if (mmc_rpmb_get_counter(mmc, &counter)) in do_mmcrpmb_counter()
438 struct mmc *mmc; in do_mmcrpmb() local
453 mmc = init_mmc_device(curr_device, false); in do_mmcrpmb()
454 if (!mmc) in do_mmcrpmb()
457 if (!(mmc->version & MMC_VERSION_MMC)) { in do_mmcrpmb()
461 if (mmc->version < MMC_VERSION_4_41) { in do_mmcrpmb()
467 original_part = mmc->block_dev.hwpart; in do_mmcrpmb()
469 original_part = mmc_get_blk_desc(mmc)->hwpart; in do_mmcrpmb()
487 struct mmc *mmc; in do_mmc_read() local
498 mmc = init_mmc_device(curr_device, false); in do_mmc_read()
499 if (!mmc) in do_mmc_read()
505 n = blk_dread(mmc_get_blk_desc(mmc), blk, cnt, addr); in do_mmc_read()
513 struct mmc *mmc; in do_mmc_write() local
524 mmc = init_mmc_device(curr_device, false); in do_mmc_write()
525 if (!mmc) in do_mmc_write()
531 if (mmc_getwp(mmc) == 1) { in do_mmc_write()
535 n = blk_dwrite(mmc_get_blk_desc(mmc), blk, cnt, addr); in do_mmc_write()
543 struct mmc *mmc; in do_mmc_erase() local
552 mmc = init_mmc_device(curr_device, false); in do_mmc_erase()
553 if (!mmc) in do_mmc_erase()
559 if (mmc_getwp(mmc) == 1) { in do_mmc_erase()
563 n = blk_derase(mmc_get_blk_desc(mmc), blk, cnt); in do_mmc_erase()
571 struct mmc *mmc; in do_mmc_rescan() local
573 mmc = init_mmc_device(curr_device, true); in do_mmc_rescan()
574 if (!mmc) in do_mmc_rescan()
583 struct mmc *mmc; in do_mmc_part() local
585 mmc = init_mmc_device(curr_device, false); in do_mmc_part()
586 if (!mmc) in do_mmc_part()
602 struct mmc *mmc; in do_mmc_dev() local
627 mmc = init_mmc_device(dev, false); in do_mmc_dev()
628 if (!mmc) in do_mmc_dev()
638 if (mmc->part_config == MMCPART_NOAVAILABLE) in do_mmc_dev()
642 curr_device, mmc_get_blk_desc(mmc)->hwpart); in do_mmc_dev()
725 struct mmc *mmc; in do_mmc_hwpartition() local
730 mmc = init_mmc_device(curr_device, false); in do_mmc_hwpartition()
731 if (!mmc) in do_mmc_hwpartition()
793 if (!mmc_hwpart_config(mmc, &pconf, mode)) { in do_mmc_hwpartition()
809 struct mmc *mmc; in do_mmc_bootbus() local
819 mmc = init_mmc_device(dev, false); in do_mmc_bootbus()
820 if (!mmc) in do_mmc_bootbus()
823 if (IS_SD(mmc)) { in do_mmc_bootbus()
829 return mmc_set_boot_bus_width(mmc, width, reset, mode); in do_mmc_bootbus()
835 struct mmc *mmc; in do_mmc_boot_resize() local
844 mmc = init_mmc_device(dev, false); in do_mmc_boot_resize()
845 if (!mmc) in do_mmc_boot_resize()
848 if (IS_SD(mmc)) { in do_mmc_boot_resize()
853 if (mmc_boot_partition_size_change(mmc, bootsize, rpmbsize)) { in do_mmc_boot_resize()
863 static int mmc_partconf_print(struct mmc *mmc) in mmc_partconf_print() argument
867 if (mmc->part_config == MMCPART_NOAVAILABLE) { in mmc_partconf_print()
868 printf("No part_config info for ver. 0x%x\n", mmc->version); in mmc_partconf_print()
872 access = EXT_CSD_EXTRACT_PARTITION_ACCESS(mmc->part_config); in mmc_partconf_print()
873 ack = EXT_CSD_EXTRACT_BOOT_ACK(mmc->part_config); in mmc_partconf_print()
874 part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config); in mmc_partconf_print()
888 struct mmc *mmc; in do_mmc_partconf() local
896 mmc = init_mmc_device(dev, false); in do_mmc_partconf()
897 if (!mmc) in do_mmc_partconf()
900 if (IS_SD(mmc)) { in do_mmc_partconf()
906 return mmc_partconf_print(mmc); in do_mmc_partconf()
913 return mmc_set_part_conf(mmc, ack, part_num, access); in do_mmc_partconf()
919 struct mmc *mmc; in do_mmc_rst_func() local
938 mmc = init_mmc_device(dev, false); in do_mmc_rst_func()
939 if (!mmc) in do_mmc_rst_func()
942 if (IS_SD(mmc)) { in do_mmc_rst_func()
947 return mmc_set_rst_n_function(mmc, enable); in do_mmc_rst_func()
953 struct mmc *mmc; in do_mmc_setdsr() local
961 mmc = find_mmc_device(curr_device); in do_mmc_setdsr()
962 if (!mmc) { in do_mmc_setdsr()
966 ret = mmc_set_dsr(mmc, val); in do_mmc_setdsr()
969 mmc->has_init = 0; in do_mmc_setdsr()
970 if (mmc_init(mmc)) in do_mmc_setdsr()
983 struct mmc *mmc; in do_mmc_bkops_enable() local
990 mmc = init_mmc_device(dev, false); in do_mmc_bkops_enable()
991 if (!mmc) in do_mmc_bkops_enable()
994 if (IS_SD(mmc)) { in do_mmc_bkops_enable()
999 return mmc_set_bkops_enable(mmc); in do_mmc_bkops_enable()
1059 mmc, 29, 1, do_mmcops,