Lines Matching +full:no +full:- +full:mmc
1 /* SPDX-License-Identifier: GPL-2.0+ */
24 /* SD/MMC version bits; 8 flags, 8 major, 8 minor, 8 change */
77 #define IS_SD(x) ((x)->version & SD_VERSION_SD)
78 #define IS_MMC(x) ((x)->version & MMC_VERSION_MMC)
173 #define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */
264 #define EXT_CSD_TIMING_LEGACY 0 /* no high speed */
336 /* Maximum block size for MMC */
339 /* The number of MMC physical partitions. These consist of:
340 * boot partitions (2), general purpose partitions (4) in MMC v4.4.
348 * struct mmc_uclass_priv - Holds information about a device used by the uclass
351 struct mmc *mmc; member
355 * mmc_get_mmc_dev() - get the MMC struct pointer for a device
361 * @return associated mmc struct pointer if available, else NULL
363 struct mmc *mmc_get_mmc_dev(struct udevice *dev);
394 struct mmc;
399 * send_cmd() - Send a command to the MMC device
404 * @return 0 if OK, -ve on error
410 * set_ios() - Set the I/O speed/width for an MMC device
413 * @return 0 if OK, -ve on error
418 * send_init_stream() - send the initialization stream: 74 clock cycles
426 * get_cd() - See whether a card is present
429 * @return 0 if not present, 1 if present, -ve on error
434 * get_wp() - See whether a card has write-protect enabled
437 * @return 0 if write-enabled, 1 if write-protected, -ve on error
443 * execute_tuning() - Start the tuning process
447 * @return 0 if OK, -ve on error
454 * wait_dat0() - wait until dat0 is in the target state
460 * @return 0 if dat0 is in the target state, -ve on error
466 #define mmc_get_ops(dev) ((struct dm_mmc_ops *)(dev)->driver->ops)
478 int mmc_set_ios(struct mmc *mmc);
479 void mmc_send_init_stream(struct mmc *mmc);
480 int mmc_getcd(struct mmc *mmc);
481 int mmc_getwp(struct mmc *mmc);
482 int mmc_execute_tuning(struct mmc *mmc, uint opcode);
483 int mmc_wait_dat0(struct mmc *mmc, int state, int timeout);
487 int (*send_cmd)(struct mmc *mmc,
489 int (*set_ios)(struct mmc *mmc);
490 int (*init)(struct mmc *mmc);
491 int (*getcd)(struct mmc *mmc);
492 int (*getwp)(struct mmc *mmc);
565 * With CONFIG_DM_MMC enabled, struct mmc can be accessed from the MMC device
568 * TODO struct mmc should be in mmc_private but it's hard to fix right now
570 struct mmc { struct
601 uint erase_grp_size; /* in 512-byte sectors */
604 uint hc_wp_grp_size; /* in 512-byte sectors */
626 struct udevice *dev; /* Device for this MMC controller */
633 u32 cardtype; /* cardtype read from the MMC */
647 uint enh_start; /* in 512-byte sectors */
648 uint enh_size; /* in 512-byte sectors, if 0 no enh area */
653 uint size; /* in 512-byte sectors */
666 struct mmc *mmc_create(const struct mmc_config *cfg, void *priv);
669 * mmc_bind() - Set up a new MMC device ready for probing
674 * @dev: MMC device to set up
675 * @mmc: MMC struct
676 * @cfg: MMC configuration
677 * @return 0 if OK, -ve on error
679 int mmc_bind(struct udevice *dev, struct mmc *mmc,
681 void mmc_destroy(struct mmc *mmc);
684 * mmc_unbind() - Unbind a MMC device's child block device
686 * @dev: MMC device
687 * @return 0 if OK, -ve on error
691 int mmc_init(struct mmc *mmc);
692 int mmc_send_tuning(struct mmc *mmc, u32 opcode, int *cmd_error);
697 int mmc_deinit(struct mmc *mmc);
701 * mmc_of_parse() - Parse the device tree to get the capabilities of the host
703 * @dev: MMC device
704 * @cfg: MMC configuration
705 * @return 0 if OK, -ve on error
709 int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size);
712 * mmc_voltage_to_mv() - Convert a mmc_voltage in mV
715 * @return the value in mV if OK, -EINVAL on error (invalid mmc_voltage value)
720 * mmc_set_clock() - change the bus clock
721 * @mmc: MMC struct
724 * @return 0 if OK, -ve on error
726 int mmc_set_clock(struct mmc *mmc, uint clock, bool disable);
731 struct mmc *find_mmc_device(int dev_num);
736 * get_mmc_num() - get the total MMC device number
738 * @return 0 if there is no MMC device, else the number of devices
741 int mmc_switch_part(struct mmc *mmc, unsigned int part_num);
742 int mmc_hwpart_config(struct mmc *mmc, const struct mmc_hwpart_conf *conf,
746 int mmc_getcd(struct mmc *mmc);
747 int board_mmc_getcd(struct mmc *mmc);
748 int mmc_getwp(struct mmc *mmc);
749 int board_mmc_getwp(struct mmc *mmc);
752 int mmc_set_dsr(struct mmc *mmc, u16 val);
754 int mmc_boot_partition_size_change(struct mmc *mmc, unsigned long bootsize,
757 int mmc_set_part_conf(struct mmc *mmc, u8 ack, u8 part_num, u8 access);
759 int mmc_set_boot_bus_width(struct mmc *mmc, u8 width, u8 reset, u8 mode);
761 int mmc_set_rst_n_function(struct mmc *mmc, u8 enable);
763 int mmc_rpmb_set_key(struct mmc *mmc, void *key);
764 int mmc_rpmb_get_counter(struct mmc *mmc, unsigned long *counter);
765 int mmc_rpmb_read(struct mmc *mmc, void *addr, unsigned short blk,
767 int mmc_rpmb_write(struct mmc *mmc, void *addr, unsigned short blk,
771 * mmc_rpmb_route_frames() - route RPMB data frames
772 * @mmc Pointer to a MMC device struct
785 int mmc_rpmb_route_frames(struct mmc *mmc, void *req, unsigned long reqlen,
789 int mmc_set_bkops_enable(struct mmc *mmc);
795 * the presence of SD/eMMC when no card detect logic is available.
797 * @param mmc Pointer to a MMC device struct
800 int mmc_get_op_cond(struct mmc *mmc);
808 * @param mmc Pointer to a MMC device struct
811 int mmc_start_init(struct mmc *mmc);
814 * Set preinit flag of mmc device.
816 * This will cause the device to be pre-inited during mmc_initialize(),
818 * Some eMMC devices take 200-300ms to init, but unfortunately they
822 * @param mmc Pointer to a MMC device struct
825 void mmc_set_preinit(struct mmc *mmc, int preinit);
828 #define mmc_host_is_spi(mmc) ((mmc)->cfg->host_caps & MMC_MODE_SPI) argument
830 #define mmc_host_is_spi(mmc) 0 argument
832 struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode);
837 int mmc_get_env_addr(struct mmc *mmc, int copy, u32 *env_addr);
839 extern uint mmc_get_env_part(struct mmc *mmc);
849 * mmc_get_blk_desc() - Get the block descriptor for an MMC device
851 * @mmc: MMC device
854 struct blk_desc *mmc_get_blk_desc(struct mmc *mmc);