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 */
76 #ifdef CONFIG_MMC_TRACE
77 void mmmc_trace_before_send(struct mmc *mmc, struct mmc_cmd *cmd);
78 void mmmc_trace_after_send(struct mmc *mmc, struct mmc_cmd *cmd, int ret);
79 void mmc_trace_state(struct mmc *mmc, struct mmc_cmd *cmd);
81 static inline void mmmc_trace_before_send(struct mmc *mmc, struct mmc_cmd *cmd)
85 static inline void mmmc_trace_after_send(struct mmc *mmc, struct mmc_cmd *cmd,
90 static inline void mmc_trace_state(struct mmc *mmc, struct mmc_cmd *cmd)
96 * mmc_get_next_devnum() - Get the next available MMC device number
98 * @return next available device number (0 = first), or -ve on error
100 int mmc_get_next_devnum(void);
103 * mmc_do_preinit() - Get an MMC device ready for use
105 void mmc_do_preinit(void);
108 * mmc_list_init() - Set up the list of MMC devices
110 void mmc_list_init(void);
113 * mmc_list_add() - Add a new MMC device to the list of devices
115 * @mmc: Device to add
117 void mmc_list_add(struct mmc *mmc);
120 * mmc_switch_part() - Switch to a new MMC hardware partition
123 * @part_num: Hardware partition number
124 * @return 0 if OK, -ve on error
126 int mmc_switch_part(struct mmc *mmc, unsigned int part_num);
129 * mmc_switch() - Issue and MMC switch mode command
133 * @index: Cmdarg index
134 * @value: Cmdarg value
135 * @return 0 if OK, -ve on error
137 int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value);
139 #endif /* _MMC_PRIVATE_H_ */