Skip to content

Commit 66a66e6

Browse files
authored
Merge pull request #111 from YuzukiHD/dev
[driver] fix tm4 timing data
2 parents fa7a075 + 2743371 commit 66a66e6

File tree

6 files changed

+217
-170
lines changed

6 files changed

+217
-170
lines changed

board/avaota-a1/board.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ sunxi_sdhci_t sdhci0 = {
5858
.clk_ctrl_base = CCU_BASE + CCU_SMHC_BGR_REG,
5959
.clk_base = CCU_BASE + CCU_SMHC0_CLK_REG,
6060
.sdhci_mmc_type = MMC_TYPE_SD,
61-
.max_clk = 200 * 1000 * 1000,
62-
.width = SMHC_WIDTH_4BIT,
61+
.max_clk = MMC_CLK_50M,
62+
.width = 50000000,
6363
.dma_des_addr = SDRAM_BASE + 0x30080000,
6464
.pinctrl = {
6565
.gpio_clk = {GPIO_PIN(GPIO_PORTF, 2), GPIO_PERIPH_MUX2},
@@ -80,7 +80,7 @@ sunxi_sdhci_t sdhci2 = {
8080
.clk_ctrl_base = CCU_BASE + CCU_SMHC_BGR_REG,
8181
.clk_base = CCU_BASE + CCU_SMHC2_CLK_REG,
8282
.sdhci_mmc_type = MMC_TYPE_EMMC,
83-
.max_clk = 25 * 1000 * 1000,
83+
.max_clk = 25000000,
8484
.width = SMHC_WIDTH_8BIT,
8585
.dma_des_addr = SDRAM_BASE + 0x30080000,
8686
.pinctrl = {

include/drivers/mmc/sys-mmc.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -378,20 +378,20 @@ typedef struct mmc {
378378
int sunxi_mmc_init(void *sdhci_hdl);
379379

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

394-
395395
#ifdef __cplusplus
396396
}
397397
#endif// __cplusplus

include/drivers/mmc/sys-sdcard.h

+21-10
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,33 @@ typedef struct {
2828
extern sdmmc_pdata_t card0;
2929

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

3945
/**
40-
* Read data from the SDMMC card into the provided buffer.
46+
* @brief Read blocks from the SD/MMC device
47+
*
48+
* Reads a specified number of blocks from the SD/MMC device using the provided platform data structure,
49+
* destination buffer, block number, and block count. It calls the underlying function for reading blocks
50+
* from the Sunxi MMC block device and returns the result.
51+
*
52+
* @param data Pointer to the SD/MMC platform data structure
53+
* @param buf Pointer to the destination buffer where the read data will be stored
54+
* @param blkno The starting block number to read from
55+
* @param blkcnt The number of blocks to read
4156
*
42-
* @param data Pointer to the SDMMC platform data structure.
43-
* @param buf Pointer to the destination buffer to store the read data.
44-
* @param blkno The starting block number to read from.
45-
* @param blkcnt The number of blocks to read.
46-
* @return The total number of bytes read, or an error code if failed.
57+
* @return Returns 0 on success, or an error code if the operation fails
4758
*/
4859
uint32_t sdmmc_blk_read(sdmmc_pdata_t *data, uint8_t *buf, uint32_t blkno, uint32_t blkcnt);
4960

0 commit comments

Comments
 (0)