emmc_api.h 1.2 KB

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