2013-09-09 14:30:26 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2008,2010 Freescale Semiconductor, Inc
|
|
|
|
* Andy Fleming
|
|
|
|
*
|
|
|
|
* Based (loosely) on the Linux code
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MMC_PRIVATE_H_
|
|
|
|
#define _MMC_PRIVATE_H_
|
|
|
|
|
|
|
|
#include <mmc.h>
|
|
|
|
|
|
|
|
extern int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
|
|
|
|
struct mmc_data *data);
|
|
|
|
extern int mmc_send_status(struct mmc *mmc, int timeout);
|
|
|
|
extern int mmc_set_blocklen(struct mmc *mmc, int len);
|
2015-04-22 05:57:00 +00:00
|
|
|
#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
|
|
|
|
void mmc_adapter_card_type_ident(void);
|
|
|
|
#endif
|
2013-09-09 14:30:26 +00:00
|
|
|
|
2017-07-04 19:31:19 +00:00
|
|
|
#if CONFIG_IS_ENABLED(BLK)
|
2016-06-13 05:30:15 +00:00
|
|
|
ulong mmc_bread(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
|
|
|
|
void *dst);
|
|
|
|
#else
|
|
|
|
ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
|
|
|
|
void *dst);
|
|
|
|
#endif
|
|
|
|
|
2018-01-04 14:23:32 +00:00
|
|
|
#if CONFIG_IS_ENABLED(MMC_WRITE)
|
2013-09-09 14:30:26 +00:00
|
|
|
|
2017-07-04 19:31:19 +00:00
|
|
|
#if CONFIG_IS_ENABLED(BLK)
|
2016-05-01 19:52:41 +00:00
|
|
|
ulong mmc_bwrite(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
|
|
|
|
const void *src);
|
2016-10-01 20:43:17 +00:00
|
|
|
ulong mmc_berase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt);
|
2016-05-01 19:52:41 +00:00
|
|
|
#else
|
|
|
|
ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
|
|
|
|
const void *src);
|
2016-10-01 20:43:17 +00:00
|
|
|
ulong mmc_berase(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt);
|
2016-05-01 19:52:41 +00:00
|
|
|
#endif
|
2013-09-09 14:30:26 +00:00
|
|
|
|
2018-01-04 14:23:32 +00:00
|
|
|
#else /* CONFIG_SPL_MMC_WRITE is not defined */
|
2013-09-09 14:30:26 +00:00
|
|
|
|
2016-09-28 09:16:18 +00:00
|
|
|
/* declare dummies to reduce code size. */
|
2013-09-09 14:30:26 +00:00
|
|
|
|
2017-07-04 19:31:19 +00:00
|
|
|
#if CONFIG_IS_ENABLED(BLK)
|
2016-05-14 20:03:09 +00:00
|
|
|
static inline unsigned long mmc_berase(struct udevice *dev,
|
|
|
|
lbaint_t start, lbaint_t blkcnt)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline ulong mmc_bwrite(struct udevice *dev, lbaint_t start,
|
|
|
|
lbaint_t blkcnt, const void *src)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#else
|
2016-02-29 22:25:34 +00:00
|
|
|
static inline unsigned long mmc_berase(struct blk_desc *block_dev,
|
2015-12-07 18:38:48 +00:00
|
|
|
lbaint_t start, lbaint_t blkcnt)
|
2013-09-09 14:30:26 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-02-29 22:25:34 +00:00
|
|
|
static inline ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start,
|
2015-12-07 18:38:48 +00:00
|
|
|
lbaint_t blkcnt, const void *src)
|
2013-09-09 14:30:26 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2016-05-14 20:03:09 +00:00
|
|
|
#endif
|
2013-09-09 14:30:26 +00:00
|
|
|
|
|
|
|
#endif /* CONFIG_SPL_BUILD */
|
|
|
|
|
2016-06-13 05:30:20 +00:00
|
|
|
#ifdef CONFIG_MMC_TRACE
|
|
|
|
void mmmc_trace_before_send(struct mmc *mmc, struct mmc_cmd *cmd);
|
|
|
|
void mmmc_trace_after_send(struct mmc *mmc, struct mmc_cmd *cmd, int ret);
|
|
|
|
void mmc_trace_state(struct mmc *mmc, struct mmc_cmd *cmd);
|
|
|
|
#else
|
|
|
|
static inline void mmmc_trace_before_send(struct mmc *mmc, struct mmc_cmd *cmd)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void mmmc_trace_after_send(struct mmc *mmc, struct mmc_cmd *cmd,
|
|
|
|
int ret)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void mmc_trace_state(struct mmc *mmc, struct mmc_cmd *cmd)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-05-01 19:52:35 +00:00
|
|
|
/**
|
|
|
|
* mmc_get_next_devnum() - Get the next available MMC device number
|
|
|
|
*
|
|
|
|
* @return next available device number (0 = first), or -ve on error
|
|
|
|
*/
|
|
|
|
int mmc_get_next_devnum(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* mmc_do_preinit() - Get an MMC device ready for use
|
|
|
|
*/
|
|
|
|
void mmc_do_preinit(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* mmc_list_init() - Set up the list of MMC devices
|
|
|
|
*/
|
|
|
|
void mmc_list_init(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* mmc_list_add() - Add a new MMC device to the list of devices
|
|
|
|
*
|
|
|
|
* @mmc: Device to add
|
|
|
|
*/
|
|
|
|
void mmc_list_add(struct mmc *mmc);
|
|
|
|
|
2016-06-13 05:30:15 +00:00
|
|
|
/**
|
|
|
|
* mmc_switch_part() - Switch to a new MMC hardware partition
|
|
|
|
*
|
|
|
|
* @mmc: MMC device
|
|
|
|
* @part_num: Hardware partition number
|
|
|
|
* @return 0 if OK, -ve on error
|
|
|
|
*/
|
|
|
|
int mmc_switch_part(struct mmc *mmc, unsigned int part_num);
|
|
|
|
|
2016-06-13 05:30:18 +00:00
|
|
|
/**
|
|
|
|
* mmc_switch() - Issue and MMC switch mode command
|
|
|
|
*
|
|
|
|
* @mmc: MMC device
|
|
|
|
* @set: Unused
|
|
|
|
* @index: Cmdarg index
|
|
|
|
* @value: Cmdarg value
|
|
|
|
* @return 0 if OK, -ve on error
|
|
|
|
*/
|
|
|
|
int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value);
|
|
|
|
|
2013-09-09 14:30:26 +00:00
|
|
|
#endif /* _MMC_PRIVATE_H_ */
|