Lines Matching refs:mmc
19 static void print_mmcinfo(struct mmc *mmc) in print_mmcinfo() argument
23 printf("Device: %s\n", mmc->cfg->name); in print_mmcinfo()
24 printf("Manufacturer ID: %x\n", mmc->cid[0] >> 24); in print_mmcinfo()
25 printf("OEM: %x\n", (mmc->cid[0] >> 8) & 0xffff); in print_mmcinfo()
26 printf("Name: %c%c%c%c%c \n", mmc->cid[0] & 0xff, in print_mmcinfo()
27 (mmc->cid[1] >> 24), (mmc->cid[1] >> 16) & 0xff, in print_mmcinfo()
28 (mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff); in print_mmcinfo()
30 printf("Bus Speed: %d\n", mmc->clock); in print_mmcinfo()
32 printf("Mode: %s\n", mmc_mode_name(mmc->selected_mode)); in print_mmcinfo()
33 mmc_dump_capabilities("card capabilities", mmc->card_caps); in print_mmcinfo()
34 mmc_dump_capabilities("host capabilities", mmc->host_caps); 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->ddr_mode ? " DDR" : ""); in print_mmcinfo()
54 print_size(((u64)mmc->erase_grp_size) << 9, "\n"); in print_mmcinfo()
57 if (!IS_SD(mmc) && mmc->version >= MMC_VERSION_4_41) { in print_mmcinfo()
58 bool has_enh = (mmc->part_support & ENHNCD_SUPPORT) != 0; in print_mmcinfo()
59 bool usr_enh = has_enh && (mmc->part_attr & EXT_CSD_ENH_USR); in print_mmcinfo()
66 print_size(((u64)mmc->hc_wp_grp_size) << 9, "\n"); in print_mmcinfo()
70 print_size(mmc->capacity_user, usr_enh ? " ENH" : ""); in print_mmcinfo()
71 if (mmc->wr_rel_set & EXT_CSD_WR_DATA_REL_USR) in print_mmcinfo()
77 print_size(mmc->enh_user_start, "\n"); in print_mmcinfo()
79 print_size(mmc->enh_user_size, "\n"); in print_mmcinfo()
82 print_size(mmc->capacity_boot, has_enh ? " ENH\n" : "\n"); in print_mmcinfo()
84 print_size(mmc->capacity_rpmb, has_enh ? " ENH\n" : "\n"); in print_mmcinfo()
86 for (i = 0; i < ARRAY_SIZE(mmc->capacity_gp); i++) { in print_mmcinfo()
88 (mmc->part_attr & EXT_CSD_ENH_GP(i)); in print_mmcinfo()
89 if (mmc->capacity_gp[i]) { in print_mmcinfo()
91 print_size(mmc->capacity_gp[i], in print_mmcinfo()
93 if (mmc->wr_rel_set & EXT_CSD_WR_DATA_REL_GP(i)) in print_mmcinfo()
99 ret = mmc_send_ext_csd(mmc, ext_csd); in print_mmcinfo()
123 static struct mmc *init_mmc_device(int dev, bool force_init) in init_mmc_device()
125 struct mmc *mmc; in init_mmc_device() local
126 mmc = find_mmc_device(dev); in init_mmc_device()
127 if (!mmc) { in init_mmc_device()
132 if (!mmc_getcd(mmc)) in init_mmc_device()
136 mmc->has_init = 0; in init_mmc_device()
137 if (mmc_init(mmc)) in init_mmc_device()
141 struct blk_desc *bd = mmc_get_blk_desc(mmc); in init_mmc_device()
145 return mmc; in init_mmc_device()
151 struct mmc *mmc; in do_mmcinfo() local
162 mmc = init_mmc_device(curr_device, false); in do_mmcinfo()
163 if (!mmc) in do_mmcinfo()
166 print_mmcinfo(mmc); in do_mmcinfo()
187 struct mmc *mmc = find_mmc_device(curr_device); in do_mmcrpmb_key() local
195 if (mmc_rpmb_set_key(mmc, key_addr)) { in do_mmcrpmb_key()
209 struct mmc *mmc = find_mmc_device(curr_device); in do_mmcrpmb_read() local
223 n = mmc_rpmb_read(mmc, addr, blk, cnt, key_addr); in do_mmcrpmb_read()
238 struct mmc *mmc = find_mmc_device(curr_device); in do_mmcrpmb_write() local
250 n = mmc_rpmb_write(mmc, addr, blk, cnt, key_addr); in do_mmcrpmb_write()
262 struct mmc *mmc = find_mmc_device(curr_device); in do_mmcrpmb_counter() local
264 if (mmc_rpmb_get_counter(mmc, &counter)) in do_mmcrpmb_counter()
281 struct mmc *mmc; in do_mmcrpmb() local
296 mmc = init_mmc_device(curr_device, false); in do_mmcrpmb()
297 if (!mmc) in do_mmcrpmb()
300 if (!(mmc->version & MMC_VERSION_MMC)) { in do_mmcrpmb()
304 if (mmc->version < MMC_VERSION_4_41) { in do_mmcrpmb()
310 original_part = mmc->block_dev.hwpart; in do_mmcrpmb()
312 original_part = mmc_get_blk_desc(mmc)->hwpart; in do_mmcrpmb()
330 struct mmc *mmc; in do_mmc_read() local
341 mmc = init_mmc_device(curr_device, false); in do_mmc_read()
342 if (!mmc) in do_mmc_read()
348 n = blk_dread(mmc_get_blk_desc(mmc), blk, cnt, addr); in do_mmc_read()
374 struct mmc *mmc; in do_mmc_sparse_write() local
390 mmc = init_mmc_device(curr_device, false); in do_mmc_sparse_write()
391 if (!mmc) in do_mmc_sparse_write()
397 if (mmc_getwp(mmc) == 1) { in do_mmc_sparse_write()
402 dev_desc = mmc_get_blk_desc(mmc); in do_mmc_sparse_write()
423 struct mmc *mmc; in do_mmc_write() local
434 mmc = init_mmc_device(curr_device, false); in do_mmc_write()
435 if (!mmc) in do_mmc_write()
441 if (mmc_getwp(mmc) == 1) { in do_mmc_write()
445 n = blk_dwrite(mmc_get_blk_desc(mmc), blk, cnt, addr); in do_mmc_write()
454 struct mmc *mmc; in do_mmc_erase() local
463 mmc = init_mmc_device(curr_device, false); in do_mmc_erase()
464 if (!mmc) in do_mmc_erase()
470 if (mmc_getwp(mmc) == 1) { in do_mmc_erase()
474 n = blk_derase(mmc_get_blk_desc(mmc), blk, cnt); in do_mmc_erase()
484 struct mmc *mmc; in do_mmc_rescan() local
486 mmc = init_mmc_device(curr_device, true); in do_mmc_rescan()
487 if (!mmc) in do_mmc_rescan()
497 struct mmc *mmc; in do_mmc_part() local
499 mmc = init_mmc_device(curr_device, false); in do_mmc_part()
500 if (!mmc) in do_mmc_part()
517 struct mmc *mmc; in do_mmc_dev() local
535 mmc = init_mmc_device(dev, true); in do_mmc_dev()
536 if (!mmc) in do_mmc_dev()
546 if (mmc->part_config == MMCPART_NOAVAILABLE) in do_mmc_dev()
550 curr_device, mmc_get_blk_desc(mmc)->hwpart); in do_mmc_dev()
634 struct mmc *mmc; in do_mmc_hwpartition() local
639 mmc = init_mmc_device(curr_device, false); in do_mmc_hwpartition()
640 if (!mmc) in do_mmc_hwpartition()
702 if (!mmc_hwpart_config(mmc, &pconf, mode)) { in do_mmc_hwpartition()
719 struct mmc *mmc; in do_mmc_bootbus() local
729 mmc = init_mmc_device(dev, false); in do_mmc_bootbus()
730 if (!mmc) in do_mmc_bootbus()
733 if (IS_SD(mmc)) { in do_mmc_bootbus()
739 return mmc_set_boot_bus_width(mmc, width, reset, mode); in do_mmc_bootbus()
746 struct mmc *mmc; in do_mmc_boot_resize() local
755 mmc = init_mmc_device(dev, false); in do_mmc_boot_resize()
756 if (!mmc) in do_mmc_boot_resize()
759 if (IS_SD(mmc)) { in do_mmc_boot_resize()
764 if (mmc_boot_partition_size_change(mmc, bootsize, rpmbsize)) { in do_mmc_boot_resize()
774 static int mmc_partconf_print(struct mmc *mmc) in mmc_partconf_print() argument
778 if (mmc->part_config == MMCPART_NOAVAILABLE) { in mmc_partconf_print()
779 printf("No part_config info for ver. 0x%x\n", mmc->version); in mmc_partconf_print()
783 access = EXT_CSD_EXTRACT_PARTITION_ACCESS(mmc->part_config); in mmc_partconf_print()
784 ack = EXT_CSD_EXTRACT_BOOT_ACK(mmc->part_config); in mmc_partconf_print()
785 part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config); in mmc_partconf_print()
799 struct mmc *mmc; in do_mmc_partconf() local
807 mmc = init_mmc_device(dev, false); in do_mmc_partconf()
808 if (!mmc) in do_mmc_partconf()
811 if (IS_SD(mmc)) { in do_mmc_partconf()
817 return mmc_partconf_print(mmc); in do_mmc_partconf()
824 return mmc_set_part_conf(mmc, ack, part_num, access); in do_mmc_partconf()
831 struct mmc *mmc; in do_mmc_rst_func() local
850 mmc = init_mmc_device(dev, false); in do_mmc_rst_func()
851 if (!mmc) in do_mmc_rst_func()
854 if (IS_SD(mmc)) { in do_mmc_rst_func()
859 return mmc_set_rst_n_function(mmc, enable); in do_mmc_rst_func()
865 struct mmc *mmc; in do_mmc_setdsr() local
873 mmc = find_mmc_device(curr_device); in do_mmc_setdsr()
874 if (!mmc) { in do_mmc_setdsr()
878 ret = mmc_set_dsr(mmc, val); in do_mmc_setdsr()
881 mmc->has_init = 0; in do_mmc_setdsr()
882 if (mmc_init(mmc)) in do_mmc_setdsr()
895 struct mmc *mmc; in do_mmc_bkops_enable() local
902 mmc = init_mmc_device(dev, false); in do_mmc_bkops_enable()
903 if (!mmc) in do_mmc_bkops_enable()
906 if (IS_SD(mmc)) { in do_mmc_bkops_enable()
911 return mmc_set_bkops_enable(mmc); in do_mmc_bkops_enable()
919 struct mmc *mmc; in do_mmc_boot_wp() local
921 mmc = init_mmc_device(curr_device, false); in do_mmc_boot_wp()
922 if (!mmc) in do_mmc_boot_wp()
924 if (IS_SD(mmc)) { in do_mmc_boot_wp()
928 err = mmc_boot_wp(mmc); in do_mmc_boot_wp()
996 mmc, 29, 1, do_mmcops,