2 * Copyright 2008,2010 Freescale Semiconductor, Inc
5 * Based (loosely) on the Linux code
7 * SPDX-License-Identifier: GPL-2.0+
10 #ifndef _MMC_PRIVATE_H_
11 #define _MMC_PRIVATE_H_
15 extern int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
16 struct mmc_data *data);
17 extern int mmc_send_status(struct mmc *mmc, int timeout);
18 extern int mmc_set_blocklen(struct mmc *mmc, int len);
19 #ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
20 void mmc_adapter_card_type_ident(void);
24 ulong mmc_bread(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
27 ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
31 #ifndef CONFIG_SPL_BUILD
33 unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start,
37 ulong mmc_bwrite(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
40 ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
44 #else /* CONFIG_SPL_BUILD */
46 /* SPL will never write or erase, declare dummies to reduce code size. */
49 static inline unsigned long mmc_berase(struct udevice *dev,
50 lbaint_t start, lbaint_t blkcnt)
55 static inline ulong mmc_bwrite(struct udevice *dev, lbaint_t start,
56 lbaint_t blkcnt, const void *src)
61 static inline unsigned long mmc_berase(struct blk_desc *block_dev,
62 lbaint_t start, lbaint_t blkcnt)
67 static inline ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start,
68 lbaint_t blkcnt, const void *src)
74 #endif /* CONFIG_SPL_BUILD */
77 * mmc_get_next_devnum() - Get the next available MMC device number
79 * @return next available device number (0 = first), or -ve on error
81 int mmc_get_next_devnum(void);
84 * mmc_do_preinit() - Get an MMC device ready for use
86 void mmc_do_preinit(void);
89 * mmc_list_init() - Set up the list of MMC devices
91 void mmc_list_init(void);
94 * mmc_list_add() - Add a new MMC device to the list of devices
98 void mmc_list_add(struct mmc *mmc);
101 * mmc_switch_part() - Switch to a new MMC hardware partition
104 * @part_num: Hardware partition number
105 * @return 0 if OK, -ve on error
107 int mmc_switch_part(struct mmc *mmc, unsigned int part_num);
110 * mmc_switch() - Issue and MMC switch mode command
114 * @index: Cmdarg index
115 * @value: Cmdarg value
116 * @return 0 if OK, -ve on error
118 int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value);
120 #endif /* _MMC_PRIVATE_H_ */