blob: 27b9e5f56f8c284d489e817d9a7e33fc5dc3f8b2 [file] [log] [blame]
Paul Burtonda61fa52013-09-09 15:30:26 +01001/*
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
15extern int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
16 struct mmc_data *data);
17extern int mmc_send_status(struct mmc *mmc, int timeout);
18extern int mmc_set_blocklen(struct mmc *mmc, int len);
Yangbo Lu5a8dbdc2015-04-22 13:57:00 +080019#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
20void mmc_adapter_card_type_ident(void);
21#endif
Paul Burtonda61fa52013-09-09 15:30:26 +010022
23#ifndef CONFIG_SPL_BUILD
24
Simon Glass4101f682016-02-29 15:25:34 -070025unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start,
Stephen Warren7c4213f2015-12-07 11:38:48 -070026 lbaint_t blkcnt);
Paul Burtonda61fa52013-09-09 15:30:26 +010027
Simon Glass33fb2112016-05-01 13:52:41 -060028#ifdef CONFIG_BLK
29ulong mmc_bwrite(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
30 const void *src);
31#else
32ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
33 const void *src);
34#endif
Paul Burtonda61fa52013-09-09 15:30:26 +010035
36#else /* CONFIG_SPL_BUILD */
37
38/* SPL will never write or erase, declare dummies to reduce code size. */
39
Simon Glass4101f682016-02-29 15:25:34 -070040static inline unsigned long mmc_berase(struct blk_desc *block_dev,
Stephen Warren7c4213f2015-12-07 11:38:48 -070041 lbaint_t start, lbaint_t blkcnt)
Paul Burtonda61fa52013-09-09 15:30:26 +010042{
43 return 0;
44}
45
Simon Glass4101f682016-02-29 15:25:34 -070046static inline ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start,
Stephen Warren7c4213f2015-12-07 11:38:48 -070047 lbaint_t blkcnt, const void *src)
Paul Burtonda61fa52013-09-09 15:30:26 +010048{
49 return 0;
50}
51
52#endif /* CONFIG_SPL_BUILD */
53
Simon Glassc40fdca2016-05-01 13:52:35 -060054/**
55 * mmc_get_next_devnum() - Get the next available MMC device number
56 *
57 * @return next available device number (0 = first), or -ve on error
58 */
59int mmc_get_next_devnum(void);
60
61/**
62 * mmc_do_preinit() - Get an MMC device ready for use
63 */
64void mmc_do_preinit(void);
65
66/**
67 * mmc_list_init() - Set up the list of MMC devices
68 */
69void mmc_list_init(void);
70
71/**
72 * mmc_list_add() - Add a new MMC device to the list of devices
73 *
74 * @mmc: Device to add
75 */
76void mmc_list_add(struct mmc *mmc);
77
Paul Burtonda61fa52013-09-09 15:30:26 +010078#endif /* _MMC_PRIVATE_H_ */