]>
git.ipfire.org Git - people/ms/u-boot.git/blob - drivers/mmc/mmc_private.h
2 * Copyright 2008,2010 Freescale Semiconductor, Inc
5 * Based (loosely) on the Linux code
7 * SPDX-License-Identifier: GPL-2.0+
10 #ifndef _MMC_PRIVATE_H_
11 #define _MMC_PRIVATE_H_
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);
24 ulong
mmc_bread(struct udevice
*dev
, lbaint_t start
, lbaint_t blkcnt
,
27 ulong
mmc_bread(struct blk_desc
*block_dev
, lbaint_t start
, lbaint_t blkcnt
,
31 #if !(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SAVEENV))
34 ulong
mmc_bwrite(struct udevice
*dev
, lbaint_t start
, lbaint_t blkcnt
,
36 ulong
mmc_berase(struct udevice
*dev
, lbaint_t start
, lbaint_t blkcnt
);
38 ulong
mmc_bwrite(struct blk_desc
*block_dev
, lbaint_t start
, lbaint_t blkcnt
,
40 ulong
mmc_berase(struct blk_desc
*block_dev
, lbaint_t start
, lbaint_t blkcnt
);
43 #else /* CONFIG_SPL_BUILD and CONFIG_SPL_SAVEENV is not defined */
45 /* declare dummies to reduce code size. */
48 static inline unsigned long mmc_berase(struct udevice
*dev
,
49 lbaint_t start
, lbaint_t blkcnt
)
54 static inline ulong
mmc_bwrite(struct udevice
*dev
, lbaint_t start
,
55 lbaint_t blkcnt
, const void *src
)
60 static inline unsigned long mmc_berase(struct blk_desc
*block_dev
,
61 lbaint_t start
, lbaint_t blkcnt
)
66 static inline ulong
mmc_bwrite(struct blk_desc
*block_dev
, lbaint_t start
,
67 lbaint_t blkcnt
, const void *src
)
73 #endif /* CONFIG_SPL_BUILD */
75 #ifdef CONFIG_MMC_TRACE
76 void mmmc_trace_before_send(struct mmc
*mmc
, struct mmc_cmd
*cmd
);
77 void mmmc_trace_after_send(struct mmc
*mmc
, struct mmc_cmd
*cmd
, int ret
);
78 void mmc_trace_state(struct mmc
*mmc
, struct mmc_cmd
*cmd
);
80 static inline void mmmc_trace_before_send(struct mmc
*mmc
, struct mmc_cmd
*cmd
)
84 static inline void mmmc_trace_after_send(struct mmc
*mmc
, struct mmc_cmd
*cmd
,
89 static inline void mmc_trace_state(struct mmc
*mmc
, struct mmc_cmd
*cmd
)
95 * mmc_get_next_devnum() - Get the next available MMC device number
97 * @return next available device number (0 = first), or -ve on error
99 int mmc_get_next_devnum(void);
102 * mmc_do_preinit() - Get an MMC device ready for use
104 void mmc_do_preinit(void);
107 * mmc_list_init() - Set up the list of MMC devices
109 void mmc_list_init(void);
112 * mmc_list_add() - Add a new MMC device to the list of devices
114 * @mmc: Device to add
116 void mmc_list_add(struct mmc
*mmc
);
119 * mmc_switch_part() - Switch to a new MMC hardware partition
122 * @part_num: Hardware partition number
123 * @return 0 if OK, -ve on error
125 int mmc_switch_part(struct mmc
*mmc
, unsigned int part_num
);
128 * mmc_switch() - Issue and MMC switch mode command
132 * @index: Cmdarg index
133 * @value: Cmdarg value
134 * @return 0 if OK, -ve on error
136 int mmc_switch(struct mmc
*mmc
, u8 set
, u8 index
, u8 value
);
138 #endif /* _MMC_PRIVATE_H_ */