1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright 2008,2010 Freescale Semiconductor, Inc
7 * Based (loosely) on the Linux code
10 #ifndef _MMC_PRIVATE_H_
11 #define _MMC_PRIVATE_H_
15 int mmc_send_status(struct mmc *mmc, unsigned int *status);
16 int mmc_poll_for_busy(struct mmc *mmc, int timeout);
18 int mmc_set_blocklen(struct mmc *mmc, int len);
20 #if CONFIG_IS_ENABLED(BLK)
21 ulong mmc_bread(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
24 ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
28 #if CONFIG_IS_ENABLED(MMC_WRITE)
30 #if CONFIG_IS_ENABLED(BLK)
31 ulong mmc_bwrite(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
33 ulong mmc_berase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt);
35 ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
37 ulong mmc_berase(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt);
40 #else /* CONFIG_SPL_MMC_WRITE is not defined */
42 /* declare dummies to reduce code size. */
44 #if CONFIG_IS_ENABLED(BLK)
45 static inline unsigned long mmc_berase(struct udevice *dev,
46 lbaint_t start, lbaint_t blkcnt)
51 static inline ulong mmc_bwrite(struct udevice *dev, lbaint_t start,
52 lbaint_t blkcnt, const void *src)
57 static inline unsigned long mmc_berase(struct blk_desc *block_dev,
58 lbaint_t start, lbaint_t blkcnt)
63 static inline ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start,
64 lbaint_t blkcnt, const void *src)
70 #endif /* CONFIG_XPL_BUILD */
72 #ifdef CONFIG_MMC_TRACE
73 void mmmc_trace_before_send(struct mmc *mmc, struct mmc_cmd *cmd);
74 void mmmc_trace_after_send(struct mmc *mmc, struct mmc_cmd *cmd, int ret);
75 void mmc_trace_state(struct mmc *mmc, struct mmc_cmd *cmd);
77 static inline void mmmc_trace_before_send(struct mmc *mmc, struct mmc_cmd *cmd)
81 static inline void mmmc_trace_after_send(struct mmc *mmc, struct mmc_cmd *cmd,
86 static inline void mmc_trace_state(struct mmc *mmc, struct mmc_cmd *cmd)
92 * mmc_get_next_devnum() - Get the next available MMC device number
94 * Return: next available device number (0 = first), or -ve on error
96 int mmc_get_next_devnum(void);
99 * mmc_do_preinit() - Get an MMC device ready for use
101 void mmc_do_preinit(void);
104 * mmc_list_init() - Set up the list of MMC devices
106 void mmc_list_init(void);
109 * mmc_list_add() - Add a new MMC device to the list of devices
111 * @mmc: Device to add
113 void mmc_list_add(struct mmc *mmc);
116 * mmc_switch_part() - Switch to a new MMC hardware partition
119 * @part_num: Hardware partition number
120 * Return: 0 if OK, -ve on error
122 int mmc_switch_part(struct mmc *mmc, unsigned int part_num);
125 * mmc_switch() - Issue and MMC switch mode command
129 * @index: Cmdarg index
130 * @value: Cmdarg value
131 * Return: 0 if OK, -ve on error
133 int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value);
135 #endif /* _MMC_PRIVATE_H_ */