Lines Matching refs:mmc
16 static void print_mmcinfo(struct mmc *mmc) in print_mmcinfo() argument
20 printf("Device: %s\n", mmc->cfg->name); in print_mmcinfo()
21 printf("Manufacturer ID: %x\n", mmc->cid[0] >> 24); in print_mmcinfo()
22 printf("OEM: %x\n", (mmc->cid[0] >> 8) & 0xffff); in print_mmcinfo()
23 printf("Name: %c%c%c%c%c \n", mmc->cid[0] & 0xff, in print_mmcinfo()
24 (mmc->cid[1] >> 24), (mmc->cid[1] >> 16) & 0xff, in print_mmcinfo()
25 (mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff); in print_mmcinfo()
27 printf("Bus Speed: %d\n", mmc->clock); in print_mmcinfo()
29 printf("Mode : %s\n", mmc_mode_name(mmc->selected_mode)); in print_mmcinfo()
30 mmc_dump_capabilities("card capabilities", mmc->card_caps); in print_mmcinfo()
31 mmc_dump_capabilities("host capabilities", mmc->host_caps); in print_mmcinfo()
33 printf("Rd Block Len: %d\n", mmc->read_bl_len); in print_mmcinfo()
35 printf("%s version %d.%d", IS_SD(mmc) ? "SD" : "MMC", in print_mmcinfo()
36 EXTRACT_SDMMC_MAJOR_VERSION(mmc->version), in print_mmcinfo()
37 EXTRACT_SDMMC_MINOR_VERSION(mmc->version)); in print_mmcinfo()
38 if (EXTRACT_SDMMC_CHANGE_VERSION(mmc->version) != 0) in print_mmcinfo()
39 printf(".%d", EXTRACT_SDMMC_CHANGE_VERSION(mmc->version)); in print_mmcinfo()
42 printf("High Capacity: %s\n", mmc->high_capacity ? "Yes" : "No"); in print_mmcinfo()
44 print_size(mmc->capacity, "\n"); in print_mmcinfo()
46 printf("Bus Width: %d-bit%s\n", mmc->bus_width, in print_mmcinfo()
47 mmc->ddr_mode ? " DDR" : ""); in print_mmcinfo()
51 print_size(((u64)mmc->erase_grp_size) << 9, "\n"); in print_mmcinfo()
54 if (!IS_SD(mmc) && mmc->version >= MMC_VERSION_4_41) { in print_mmcinfo()
55 bool has_enh = (mmc->part_support & ENHNCD_SUPPORT) != 0; in print_mmcinfo()
56 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()
64 print_size(mmc->capacity_user, usr_enh ? " ENH" : ""); in print_mmcinfo()
65 if (mmc->wr_rel_set & EXT_CSD_WR_DATA_REL_USR) in print_mmcinfo()
71 print_size(mmc->enh_user_start, "\n"); in print_mmcinfo()
73 print_size(mmc->enh_user_size, "\n"); in print_mmcinfo()
76 print_size(mmc->capacity_boot, has_enh ? " ENH\n" : "\n"); in print_mmcinfo()
78 print_size(mmc->capacity_rpmb, has_enh ? " ENH\n" : "\n"); in print_mmcinfo()
80 for (i = 0; i < ARRAY_SIZE(mmc->capacity_gp); i++) { in print_mmcinfo()
82 (mmc->part_attr & EXT_CSD_ENH_GP(i)); in print_mmcinfo()
83 if (mmc->capacity_gp[i]) { in print_mmcinfo()
85 print_size(mmc->capacity_gp[i], in print_mmcinfo()
87 if (mmc->wr_rel_set & EXT_CSD_WR_DATA_REL_GP(i)) in print_mmcinfo()
95 static struct mmc *init_mmc_device(int dev, bool force_init) in init_mmc_device()
97 struct mmc *mmc; in init_mmc_device() local
98 mmc = find_mmc_device(dev); in init_mmc_device()
99 if (!mmc) { in init_mmc_device()
105 mmc->has_init = 0; in init_mmc_device()
106 if (mmc_init(mmc)) in init_mmc_device()
108 return mmc; in init_mmc_device()
112 struct mmc *mmc; in do_mmcinfo() local
123 mmc = init_mmc_device(curr_device, false); in do_mmcinfo()
124 if (!mmc) in do_mmcinfo()
127 print_mmcinfo(mmc); in do_mmcinfo()
147 struct mmc *mmc = find_mmc_device(curr_device); in do_mmcrpmb_key() local
155 if (mmc_rpmb_set_key(mmc, key_addr)) { in do_mmcrpmb_key()
168 struct mmc *mmc = find_mmc_device(curr_device); in do_mmcrpmb_read() local
182 n = mmc_rpmb_read(mmc, addr, blk, cnt, key_addr); in do_mmcrpmb_read()
196 struct mmc *mmc = find_mmc_device(curr_device); in do_mmcrpmb_write() local
208 n = mmc_rpmb_write(mmc, addr, blk, cnt, key_addr); in do_mmcrpmb_write()
219 struct mmc *mmc = find_mmc_device(curr_device); in do_mmcrpmb_counter() local
221 if (mmc_rpmb_get_counter(mmc, &counter)) in do_mmcrpmb_counter()
238 struct mmc *mmc; in do_mmcrpmb() local
253 mmc = init_mmc_device(curr_device, false); in do_mmcrpmb()
254 if (!mmc) in do_mmcrpmb()
257 if (!(mmc->version & MMC_VERSION_MMC)) { in do_mmcrpmb()
261 if (mmc->version < MMC_VERSION_4_41) { in do_mmcrpmb()
267 original_part = mmc->block_dev.hwpart; in do_mmcrpmb()
269 original_part = mmc_get_blk_desc(mmc)->hwpart; in do_mmcrpmb()
287 struct mmc *mmc; in do_mmc_read() local
298 mmc = init_mmc_device(curr_device, false); in do_mmc_read()
299 if (!mmc) in do_mmc_read()
305 n = blk_dread(mmc_get_blk_desc(mmc), blk, cnt, addr); in do_mmc_read()
331 struct mmc *mmc; in do_mmc_sparse_write() local
347 mmc = init_mmc_device(curr_device, false); in do_mmc_sparse_write()
348 if (!mmc) in do_mmc_sparse_write()
354 if (mmc_getwp(mmc) == 1) { in do_mmc_sparse_write()
359 dev_desc = mmc_get_blk_desc(mmc); in do_mmc_sparse_write()
380 struct mmc *mmc; in do_mmc_write() local
391 mmc = init_mmc_device(curr_device, false); in do_mmc_write()
392 if (!mmc) in do_mmc_write()
398 if (mmc_getwp(mmc) == 1) { in do_mmc_write()
402 n = blk_dwrite(mmc_get_blk_desc(mmc), blk, cnt, addr); in do_mmc_write()
410 struct mmc *mmc; in do_mmc_erase() local
419 mmc = init_mmc_device(curr_device, false); in do_mmc_erase()
420 if (!mmc) in do_mmc_erase()
426 if (mmc_getwp(mmc) == 1) { in do_mmc_erase()
430 n = blk_derase(mmc_get_blk_desc(mmc), blk, cnt); in do_mmc_erase()
440 struct mmc *mmc; in do_mmc_rescan() local
442 mmc = init_mmc_device(curr_device, true); in do_mmc_rescan()
443 if (!mmc) in do_mmc_rescan()
452 struct mmc *mmc; in do_mmc_part() local
454 mmc = init_mmc_device(curr_device, false); in do_mmc_part()
455 if (!mmc) in do_mmc_part()
471 struct mmc *mmc; in do_mmc_dev() local
489 mmc = init_mmc_device(dev, true); in do_mmc_dev()
490 if (!mmc) in do_mmc_dev()
500 if (mmc->part_config == MMCPART_NOAVAILABLE) in do_mmc_dev()
504 curr_device, mmc_get_blk_desc(mmc)->hwpart); in do_mmc_dev()
587 struct mmc *mmc; in do_mmc_hwpartition() local
592 mmc = init_mmc_device(curr_device, false); in do_mmc_hwpartition()
593 if (!mmc) in do_mmc_hwpartition()
655 if (!mmc_hwpart_config(mmc, &pconf, mode)) { in do_mmc_hwpartition()
672 struct mmc *mmc; in do_mmc_bootbus() local
682 mmc = init_mmc_device(dev, false); in do_mmc_bootbus()
683 if (!mmc) in do_mmc_bootbus()
686 if (IS_SD(mmc)) { in do_mmc_bootbus()
692 return mmc_set_boot_bus_width(mmc, width, reset, mode); in do_mmc_bootbus()
698 struct mmc *mmc; in do_mmc_boot_resize() local
707 mmc = init_mmc_device(dev, false); in do_mmc_boot_resize()
708 if (!mmc) in do_mmc_boot_resize()
711 if (IS_SD(mmc)) { in do_mmc_boot_resize()
716 if (mmc_boot_partition_size_change(mmc, bootsize, rpmbsize)) { in do_mmc_boot_resize()
726 static int mmc_partconf_print(struct mmc *mmc) in mmc_partconf_print() argument
730 if (mmc->part_config == MMCPART_NOAVAILABLE) { in mmc_partconf_print()
731 printf("No part_config info for ver. 0x%x\n", mmc->version); in mmc_partconf_print()
735 access = EXT_CSD_EXTRACT_PARTITION_ACCESS(mmc->part_config); in mmc_partconf_print()
736 ack = EXT_CSD_EXTRACT_BOOT_ACK(mmc->part_config); in mmc_partconf_print()
737 part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config); in mmc_partconf_print()
751 struct mmc *mmc; in do_mmc_partconf() local
759 mmc = init_mmc_device(dev, false); in do_mmc_partconf()
760 if (!mmc) in do_mmc_partconf()
763 if (IS_SD(mmc)) { in do_mmc_partconf()
769 return mmc_partconf_print(mmc); in do_mmc_partconf()
776 return mmc_set_part_conf(mmc, ack, part_num, access); in do_mmc_partconf()
782 struct mmc *mmc; in do_mmc_rst_func() local
801 mmc = init_mmc_device(dev, false); in do_mmc_rst_func()
802 if (!mmc) in do_mmc_rst_func()
805 if (IS_SD(mmc)) { in do_mmc_rst_func()
810 return mmc_set_rst_n_function(mmc, enable); in do_mmc_rst_func()
816 struct mmc *mmc; in do_mmc_setdsr() local
824 mmc = find_mmc_device(curr_device); in do_mmc_setdsr()
825 if (!mmc) { in do_mmc_setdsr()
829 ret = mmc_set_dsr(mmc, val); in do_mmc_setdsr()
832 mmc->has_init = 0; in do_mmc_setdsr()
833 if (mmc_init(mmc)) in do_mmc_setdsr()
846 struct mmc *mmc; in do_mmc_bkops_enable() local
853 mmc = init_mmc_device(dev, false); in do_mmc_bkops_enable()
854 if (!mmc) in do_mmc_bkops_enable()
857 if (IS_SD(mmc)) { in do_mmc_bkops_enable()
862 return mmc_set_bkops_enable(mmc); in do_mmc_bkops_enable()
925 mmc, 29, 1, do_mmcops,