#include <io.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
#include <reg/reg-smhc.h>
#include <sys-gpio.h>
#include <log.h>
#include "sys-mmc.h"
Go to the source code of this file.
◆ MMC_REG_FIFO_OS
| #define MMC_REG_FIFO_OS (0x200) |
◆ SDHCI_DEFAULT_CLK_FACTOR_M_OFFSET
| #define SDHCI_DEFAULT_CLK_FACTOR_M_OFFSET (0) |
◆ SDHCI_DEFAULT_CLK_FACTOR_N_OFFSET
| #define SDHCI_DEFAULT_CLK_FACTOR_N_OFFSET (8) |
◆ SDHCI_DEFAULT_CLK_GATE_OFFSET
| #define SDHCI_DEFAULT_CLK_GATE_OFFSET |
( |
|
x | ) |
(x) |
◆ SDHCI_DEFAULT_CLK_RST_OFFSET
| #define SDHCI_DEFAULT_CLK_RST_OFFSET |
( |
|
x | ) |
(16 + x) |
◆ SMHC_DATA_TIMEOUT
| #define SMHC_DATA_TIMEOUT 0xfffff |
◆ SMHC_DES_BUFFER_MAX_LEN
◆ SMHC_DES_NUM_SHIFT
| #define SMHC_DES_NUM_SHIFT 12 /* smhc2!! */ |
◆ SMHC_DMA_TIMEOUT
| #define SMHC_DMA_TIMEOUT 0xffffff |
◆ SMHC_RESP_TIMEOUT
| #define SMHC_RESP_TIMEOUT 0xff |
◆ SMHC_TIMEOUT
| #define SMHC_TIMEOUT 0xfffff |
◆ SMHC_WAITBUSY_TIMEOUT
| #define SMHC_WAITBUSY_TIMEOUT 0xfffff |
◆ sunxi_sdhci_clk_t
◆ sunxi_sdhci_host_t
◆ sunxi_sdhci_pinctrl_t
◆ sunxi_sdhci_t
◆ sunxi_sdhci_timing_t
◆ anonymous enum
| Enumerator |
|---|
| MMC_CONTROLLER_0 | |
| MMC_CONTROLLER_1 | |
| MMC_CONTROLLER_2 | |
◆ sunxi_sdhci_type_t
| Enumerator |
|---|
| MMC_TYPE_SD | |
| MMC_TYPE_EMMC | |
◆ __attribute__()
◆ sunxi_sdhci_core_init()
Initialize the core functionality of the SDHC controller.
This function initializes the core functionality of the SDHC controller, including resetting the controller, setting timeout values, configuring thresholds and debug parameters, and releasing the eMMC reset signal.
- Parameters
-
| sdhci | Pointer to the SDHC controller structure. |
- Returns
- Returns 0 on success, -1 on failure.
◆ sunxi_sdhci_dump_reg()
Dump the contents of the SDHCI registers.
This function dumps the contents of the SDHCI registers for a given SD card host controller.
- Parameters
-
| sdhci | A pointer to the structure representing the SD card host controller. |
- Returns
- void
- Note
- This function is useful for debugging and analyzing the state of the SD card controller.
◆ sunxi_sdhci_get_mclk()
Get the current clock frequency of the SDHC controller.
This function retrieves the current clock frequency of the specified SDHC controller.
- Parameters
-
| sdhci | Pointer to the SDHC controller structure. |
- Returns
- Current clock frequency in Hertz.
◆ sunxi_sdhci_init()
Initialize the SDHC controller.
This function initializes the SDHC controller by configuring its parameters, capabilities, and features based on the provided SDHC structure. It sets up the controller's timing mode, supported voltages, host capabilities, clock frequency limits, and register addresses. Additionally, it configures pin settings and enables clocks for the SDHC controller.
- Parameters
-
| sdhci | Pointer to the SDHC structure. |
- Returns
- Returns 0 on success, -1 on failure.
◆ sunxi_sdhci_set_ios()
Set the I/O settings for the SDHC controller.
This function configures the I/O settings for the SDHC controller based on the provided MMC clock, bus width, and speed mode.
- Parameters
-
| sdhci | Pointer to the SDHC controller structure. |
- Returns
- void
◆ sunxi_sdhci_set_mclk()
Set the SDHC controller's clock frequency.
This function sets the clock frequency for the specified SDHC controller.
- Parameters
-
| sdhci | Pointer to the SDHC controller structure. |
| clk_hz | Desired clock frequency in Hertz. |
- Returns
- Returns 0 on success, -1 on failure.
◆ sunxi_sdhci_update_phase()
Update phase for the SDHC controller.
This function updates the phase for the specified SDHC controller.
- Parameters
-
| sdhci | Pointer to the SDHC controller structure. |
- Returns
- Returns 0 on success.
◆ sunxi_sdhci_xfer()
Perform a data transfer operation on the SDHC controller.
This function performs a data transfer operation on the SDHC controller, including sending a command and managing data transfer if present. It also handles error conditions such as fatal errors and card busy status.
- Parameters
-
| sdhci | Pointer to the SDHC controller structure. |
| cmd | Pointer to the MMC command structure. |
| data | Pointer to the MMC data structure. |
- Returns
- Returns 0 on success, -1 on failure.
◆ __pad0__
◆ buf_addr
◆ data_buf_dummy
◆ data_buf_sz
◆ des_chain
◆ dic
◆ end_of_ring
◆ err_flag
◆ first_desc
◆ last_desc
◆ next_desc_addr
◆ own