Paul Burton | da61fa5 | 2013-09-09 15:30:26 +0100 | [diff] [blame] | 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); |
Yangbo Lu | 5a8dbdc | 2015-04-22 13:57:00 +0800 | [diff] [blame] | 19 | #ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT |
| 20 | void mmc_adapter_card_type_ident(void); |
| 21 | #endif |
Paul Burton | da61fa5 | 2013-09-09 15:30:26 +0100 | [diff] [blame] | 22 | |
| 23 | #ifndef CONFIG_SPL_BUILD |
| 24 | |
Simon Glass | 4101f68 | 2016-02-29 15:25:34 -0700 | [diff] [blame] | 25 | unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start, |
Stephen Warren | 7c4213f | 2015-12-07 11:38:48 -0700 | [diff] [blame] | 26 | lbaint_t blkcnt); |
Paul Burton | da61fa5 | 2013-09-09 15:30:26 +0100 | [diff] [blame] | 27 | |
Simon Glass | 33fb211 | 2016-05-01 13:52:41 -0600 | [diff] [blame] | 28 | #ifdef CONFIG_BLK |
| 29 | ulong mmc_bwrite(struct udevice *dev, lbaint_t start, lbaint_t blkcnt, |
| 30 | const void *src); |
| 31 | #else |
| 32 | ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt, |
| 33 | const void *src); |
| 34 | #endif |
Paul Burton | da61fa5 | 2013-09-09 15:30:26 +0100 | [diff] [blame] | 35 | |
| 36 | #else /* CONFIG_SPL_BUILD */ |
| 37 | |
| 38 | /* SPL will never write or erase, declare dummies to reduce code size. */ |
| 39 | |
Simon Glass | e419a3e | 2016-05-14 14:03:09 -0600 | [diff] [blame] | 40 | #ifdef CONFIG_BLK |
| 41 | static inline unsigned long mmc_berase(struct udevice *dev, |
| 42 | lbaint_t start, lbaint_t blkcnt) |
| 43 | { |
| 44 | return 0; |
| 45 | } |
| 46 | |
| 47 | static inline ulong mmc_bwrite(struct udevice *dev, lbaint_t start, |
| 48 | lbaint_t blkcnt, const void *src) |
| 49 | { |
| 50 | return 0; |
| 51 | } |
| 52 | #else |
Simon Glass | 4101f68 | 2016-02-29 15:25:34 -0700 | [diff] [blame] | 53 | static inline unsigned long mmc_berase(struct blk_desc *block_dev, |
Stephen Warren | 7c4213f | 2015-12-07 11:38:48 -0700 | [diff] [blame] | 54 | lbaint_t start, lbaint_t blkcnt) |
Paul Burton | da61fa5 | 2013-09-09 15:30:26 +0100 | [diff] [blame] | 55 | { |
| 56 | return 0; |
| 57 | } |
| 58 | |
Simon Glass | 4101f68 | 2016-02-29 15:25:34 -0700 | [diff] [blame] | 59 | static inline ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start, |
Stephen Warren | 7c4213f | 2015-12-07 11:38:48 -0700 | [diff] [blame] | 60 | lbaint_t blkcnt, const void *src) |
Paul Burton | da61fa5 | 2013-09-09 15:30:26 +0100 | [diff] [blame] | 61 | { |
| 62 | return 0; |
| 63 | } |
Simon Glass | e419a3e | 2016-05-14 14:03:09 -0600 | [diff] [blame] | 64 | #endif |
Paul Burton | da61fa5 | 2013-09-09 15:30:26 +0100 | [diff] [blame] | 65 | |
| 66 | #endif /* CONFIG_SPL_BUILD */ |
| 67 | |
Simon Glass | c40fdca | 2016-05-01 13:52:35 -0600 | [diff] [blame] | 68 | /** |
| 69 | * mmc_get_next_devnum() - Get the next available MMC device number |
| 70 | * |
| 71 | * @return next available device number (0 = first), or -ve on error |
| 72 | */ |
| 73 | int mmc_get_next_devnum(void); |
| 74 | |
| 75 | /** |
| 76 | * mmc_do_preinit() - Get an MMC device ready for use |
| 77 | */ |
| 78 | void mmc_do_preinit(void); |
| 79 | |
| 80 | /** |
| 81 | * mmc_list_init() - Set up the list of MMC devices |
| 82 | */ |
| 83 | void mmc_list_init(void); |
| 84 | |
| 85 | /** |
| 86 | * mmc_list_add() - Add a new MMC device to the list of devices |
| 87 | * |
| 88 | * @mmc: Device to add |
| 89 | */ |
| 90 | void mmc_list_add(struct mmc *mmc); |
| 91 | |
Paul Burton | da61fa5 | 2013-09-09 15:30:26 +0100 | [diff] [blame] | 92 | #endif /* _MMC_PRIVATE_H_ */ |