Skip to content

Commit

Permalink
Merge pull request #111 from YuzukiHD/dev
Browse files Browse the repository at this point in the history
[driver] fix tm4 timing data
  • Loading branch information
SamulKyull committed Jun 16, 2024
2 parents fa7a075 + 2743371 commit 66a66e6
Show file tree
Hide file tree
Showing 6 changed files with 217 additions and 170 deletions.
6 changes: 3 additions & 3 deletions board/avaota-a1/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ sunxi_sdhci_t sdhci0 = {
.clk_ctrl_base = CCU_BASE + CCU_SMHC_BGR_REG,
.clk_base = CCU_BASE + CCU_SMHC0_CLK_REG,
.sdhci_mmc_type = MMC_TYPE_SD,
.max_clk = 200 * 1000 * 1000,
.width = SMHC_WIDTH_4BIT,
.max_clk = MMC_CLK_50M,
.width = 50000000,
.dma_des_addr = SDRAM_BASE + 0x30080000,
.pinctrl = {
.gpio_clk = {GPIO_PIN(GPIO_PORTF, 2), GPIO_PERIPH_MUX2},
Expand All @@ -80,7 +80,7 @@ sunxi_sdhci_t sdhci2 = {
.clk_ctrl_base = CCU_BASE + CCU_SMHC_BGR_REG,
.clk_base = CCU_BASE + CCU_SMHC2_CLK_REG,
.sdhci_mmc_type = MMC_TYPE_EMMC,
.max_clk = 25 * 1000 * 1000,
.max_clk = 25000000,
.width = SMHC_WIDTH_8BIT,
.dma_des_addr = SDRAM_BASE + 0x30080000,
.pinctrl = {
Expand Down
18 changes: 9 additions & 9 deletions include/drivers/mmc/sys-mmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,20 +378,20 @@ typedef struct mmc {
int sunxi_mmc_init(void *sdhci_hdl);

/**
* @brief Reads blocks from the SD/MMC card.
* @brief Read blocks from the Sunxi MMC block device
*
* This function reads blocks from the SD/MMC card starting from the specified block address.
* It supports reading multiple blocks and handles high capacity cards appropriately.
* This function reads a specified number of blocks from the Sunxi MMC block device
* and stores the data into the destination buffer.
*
* @param sdhci Pointer to the SDHCI controller structure.
* @param dst Pointer to the destination buffer where the data will be stored.
* @param start Start block address from where to read the data.
* @param blkcnt Number of blocks to read.
* @return Number of blocks read on success, 0 otherwise.
* @param sdhci Pointer to the Sunxi SD Host Controller instance
* @param dst Pointer to the destination buffer where the read data will be stored
* @param start The starting block number to read from
* @param blkcnt The number of blocks to read
*
* @return Returns 0 on success, or an error code if the operation fails
*/
uint32_t sunxi_mmc_blk_read(void *sdhci, void *dst, uint32_t start, uint32_t blkcnt);


#ifdef __cplusplus
}
#endif// __cplusplus
Expand Down
31 changes: 21 additions & 10 deletions include/drivers/mmc/sys-sdcard.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,33 @@ typedef struct {
extern sdmmc_pdata_t card0;

/**
* Initialize the SDMMC controller with the specified platform data and SDHCI driver.
* @brief Initialize the SD/MMC interface
*
* @param data Pointer to the SDMMC platform data structure.
* @param hci Pointer to the SDHCI driver instance.
* @return 0 if successful, or an error code if failed.
* Initializes the SD/MMC interface using the provided data structure and SD Host Controller instance.
* It sets the SD Host Controller instance and the online status in the data structure, and then initializes
* the MMC device. If the initialization is successful, it prints a message indicating the type of card detected
* and returns 0; otherwise, it returns -1.
*
* @param data Pointer to the SD/MMC platform data structure
* @param hci Pointer to the Sunxi SD Host Controller instance
*
* @return Returns 0 on success, or -1 if the initialization fails
*/
int sdmmc_init(sdmmc_pdata_t *data, sunxi_sdhci_t *hci);

/**
* Read data from the SDMMC card into the provided buffer.
* @brief Read blocks from the SD/MMC device
*
* Reads a specified number of blocks from the SD/MMC device using the provided platform data structure,
* destination buffer, block number, and block count. It calls the underlying function for reading blocks
* from the Sunxi MMC block device and returns the result.
*
* @param data Pointer to the SD/MMC platform data structure
* @param buf Pointer to the destination buffer where the read data will be stored
* @param blkno The starting block number to read from
* @param blkcnt The number of blocks to read
*
* @param data Pointer to the SDMMC platform data structure.
* @param buf Pointer to the destination buffer to store the read data.
* @param blkno The starting block number to read from.
* @param blkcnt The number of blocks to read.
* @return The total number of bytes read, or an error code if failed.
* @return Returns 0 on success, or an error code if the operation fails
*/
uint32_t sdmmc_blk_read(sdmmc_pdata_t *data, uint8_t *buf, uint32_t blkno, uint32_t blkcnt);

Expand Down
Loading

0 comments on commit 66a66e6

Please sign in to comment.