1 /*
2  * Copyright (c) 2015-2017, Renesas Electronics Corporation. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 /**
8  * @file  emmc_def.h
9  * @brief eMMC boot is expecting this header file
10  *
11  */
12 
13 #ifndef EMMC_DEF_H
14 #define EMMC_DEF_H
15 
16 #include "emmc_std.h"
17 
18 /* ************************ HEADER (INCLUDE) SECTION *********************** */
19 
20 /* ***************** MACROS, CONSTANTS, COMPILATION FLAGS ****************** */
21 #define EMMC_POWER_ON		(1U)
22 
23 /* ********************** STRUCTURES, TYPE DEFINITIONS ********************* */
24 
25 /* ********************** DECLARATION OF EXTERNAL DATA ********************* */
26 extern st_mmc_base mmc_drv_obj;
27 
28 /* ************************** FUNCTION PROTOTYPES ************************** */
29 
30 /** @brief for assembler program
31  */
32 uint32_t _rom_emmc_finalize(void);
33 
34 /** @brief eMMC driver API
35  */
36 EMMC_ERROR_CODE rcar_emmc_init(void);
37 EMMC_ERROR_CODE emmc_terminate(void);
38 EMMC_ERROR_CODE rcar_emmc_memcard_power(uint8_t mode);
39 EMMC_ERROR_CODE rcar_emmc_mount(void);
40 EMMC_ERROR_CODE emmc_set_request_mmc_clock(uint32_t *freq);
41 EMMC_ERROR_CODE emmc_send_idle_cmd(uint32_t arg);
42 EMMC_ERROR_CODE emmc_select_partition(EMMC_PARTITION_ID id);
43 EMMC_ERROR_CODE emmc_read_sector(uint32_t *buff_address_virtual,
44 				 uint32_t sector_number, uint32_t count,
45 				 uint32_t feature_flags);
46 EMMC_ERROR_CODE emmc_write_sector(uint32_t *buff_address_virtual,
47 				  uint32_t sector_number, uint32_t count,
48 				  uint32_t feature_flags);
49 EMMC_ERROR_CODE emmc_erase_sector(uint32_t *start_address,
50 				  uint32_t *end_address);
51 uint32_t emmc_bit_field(uint8_t *data, uint32_t top, uint32_t bottom);
52 
53 /** @brief interrupt service
54  */
55 uint32_t emmc_interrupt(void);
56 
57 /** @brief DMA
58  */
59 
60 /** @brief send command API
61  */
62 EMMC_ERROR_CODE emmc_exec_cmd(uint32_t error_mask, uint32_t *response);
63 void emmc_make_nontrans_cmd(HAL_MEMCARD_COMMAND cmd, uint32_t arg);
64 void emmc_make_trans_cmd(HAL_MEMCARD_COMMAND cmd, uint32_t arg,
65 			 uint32_t *buff_address_virtual, uint32_t len,
66 			 HAL_MEMCARD_OPERATION dir,
67 			 HAL_MEMCARD_DATA_TRANSFER_MODE transfer_mode);
68 EMMC_ERROR_CODE emmc_set_ext_csd(uint32_t arg);
69 
70 /** @brief for error information
71  */
72 void emmc_write_error_info(uint16_t func_no, EMMC_ERROR_CODE error_code);
73 void emmc_write_error_info_func_no(uint16_t func_no);
74 
75 /* ********************************* CODE ********************************** */
76 
77 #endif /* EMMC_DEF_H */
78 /* ******************************** END ************************************ */
79