Sheetal Tigadoli | b015670 | 2020-01-05 14:59:04 +0530 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2016 - 2020, Broadcom |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef EMMC_API_H |
| 8 | #define EMMC_API_H |
| 9 | |
| 10 | #include "bcm_emmc.h" |
| 11 | #include "emmc_pboot_hal_memory_drv.h" |
| 12 | |
| 13 | #ifdef INCLUDE_EMMC_DRIVER_ERASE_CODE |
| 14 | /* |
| 15 | * The erasable unit of the eMMC is the Erase Group |
| 16 | * Erase group is measured in write blocks which |
| 17 | * are the basic writable units of the Device |
| 18 | * EMMC_ERASE_GROUP_SIZE is the number of writeable |
| 19 | * units (each unit is 512 bytes) |
| 20 | */ |
| 21 | |
| 22 | /* Start address (sector) */ |
| 23 | #define EMMC_ERASE_START_BLOCK 0x0 |
| 24 | /* Number of blocks to be erased */ |
| 25 | #define EMMC_ERASE_BLOCK_COUNT 0x1 |
| 26 | |
| 27 | #define EMMC_ERASE_USER_AREA 0 |
| 28 | #define EMMC_ERASE_BOOT_PARTITION1 1 |
| 29 | #define EMMC_ERASE_BOOT_PARTITION2 2 |
| 30 | |
| 31 | /* eMMC partition to be erased */ |
| 32 | #define EMMC_ERASE_PARTITION EMMC_ERASE_USER_AREA |
| 33 | #endif |
| 34 | |
| 35 | uint32_t bcm_emmc_init(bool card_rdy_only); |
| 36 | void emmc_deinit(void); |
| 37 | |
| 38 | #ifdef INCLUDE_EMMC_DRIVER_ERASE_CODE |
| 39 | int emmc_erase(uintptr_t mem_addr, size_t num_of_blocks, uint32_t partition); |
| 40 | #endif |
| 41 | |
| 42 | uint32_t emmc_partition_select(uint32_t partition); |
| 43 | uint32_t emmc_read(uintptr_t mem_addr, uintptr_t storage_addr, |
| 44 | size_t storage_size, size_t bytes_to_read); |
| 45 | uint32_t emmc_write(uintptr_t mem_addr, uintptr_t data_addr, |
| 46 | size_t bytes_to_write); |
| 47 | #endif /* EMMC_API_H */ |