xref: /rk3399_rockchip-uboot/drivers/mmc/mmc_private.h (revision 1598dfcb101c2c3aaac68a4ac8fc9bdef2293eaa)
1 /*
2  * Copyright 2008,2010 Freescale Semiconductor, Inc
3  * Andy Fleming
4  *
5  * Based (loosely) on the Linux code
6  *
7  * SPDX-License-Identifier:	GPL-2.0+
8  */
9 
10 #ifndef _MMC_PRIVATE_H_
11 #define _MMC_PRIVATE_H_
12 
13 #include <mmc.h>
14 
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);
21 #endif
22 
23 #ifndef CONFIG_SPL_BUILD
24 
25 unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start,
26 			 lbaint_t blkcnt);
27 
28 unsigned long mmc_bwrite(struct blk_desc *block_dev, lbaint_t start,
29 			 lbaint_t blkcnt, const void *src);
30 
31 #else /* CONFIG_SPL_BUILD */
32 
33 /* SPL will never write or erase, declare dummies to reduce code size. */
34 
35 static inline unsigned long mmc_berase(struct blk_desc *block_dev,
36 				       lbaint_t start, lbaint_t blkcnt)
37 {
38 	return 0;
39 }
40 
41 static inline ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start,
42 			       lbaint_t blkcnt, const void *src)
43 {
44 	return 0;
45 }
46 
47 #endif /* CONFIG_SPL_BUILD */
48 
49 /**
50  * mmc_get_next_devnum() - Get the next available MMC device number
51  *
52  * @return next available device number (0 = first), or -ve on error
53  */
54 int mmc_get_next_devnum(void);
55 
56 /**
57  * mmc_do_preinit() - Get an MMC device ready for use
58  */
59 void mmc_do_preinit(void);
60 
61 /**
62  * mmc_list_init() - Set up the list of MMC devices
63  */
64 void mmc_list_init(void);
65 
66 /**
67  * mmc_list_add() - Add a new MMC device to the list of devices
68  *
69  * @mmc:	Device to add
70  */
71 void mmc_list_add(struct mmc *mmc);
72 
73 #endif /* _MMC_PRIVATE_H_ */
74