This commit is contained in:
刘可亮
2025-07-22 11:15:46 +08:00
parent d164b333ed
commit 11c97ef399
2870 changed files with 951307 additions and 26675 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, ArtInChip Technology Co., Ltd
* Copyright (c) 2023-2025, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -320,6 +320,18 @@ void hal_sdmc_set_phase(struct aic_sdmc_host *host, u32 drv, u32 smp)
sdmc_writel(host, SDMC_DLYCTRL, temp);
}
void hal_sdmc_set_delay(struct aic_sdmc_host *host, u32 drv, u32 smp)
{
u32 temp = 0;
temp = sdmc_readl(host, SDMC_DLYCTRL);
temp &= ~SDMC_DLYCTRL_CLK_DRV_DLY_MASK;
temp &= ~SDMC_DLYCTRL_CLK_SMP_DLY_MASK;
temp |= drv << SDMC_DLYCTRL_CLK_DRV_DLY_SHIFT |
smp << SDMC_DLYCTRL_CLK_SMP_DLY_SHIFT;
sdmc_writel(host, SDMC_DLYCTRL, temp);
}
void hal_sdmc_set_buswidth(struct aic_sdmc_host *host, u32 buswidth)
{
u32 val = 0;
@@ -402,6 +414,33 @@ void hal_sdmc_fifo_init(struct aic_sdmc_host *host, u32 *thd)
(512 << SDMC_CTC_CARDTHR_SHIFT) | SDMC_CTC_CARDRDTHR_EN);
}
void hal_sdmc_soft_reset(struct aic_sdmc_host *host)
{
u32 temp = 0;
temp = sdmc_readl(host, SDMC_INTEN);
sdmc_writel(host, SDMC_INTEN, 0);
sdmc_writel(host, SDMC_IDMAINTEN, 0);
if (hal_sdmc_reset(host, SDMC_HCTRL1_RESET_ALL)) {
pr_err("Failed to reset!\n");
return;
}
sdmc_writel(host, SDMC_INTEN, temp);
hal_sdmc_set_cmd(host, SDMC_CMD_PRV_DAT_WAIT | SDMC_CMD_UPD_CLK | SDMC_CMD_START);
if (hal_sdmc_wait_cmd_started(host)) {
pr_err("Failed to wait cmd started!\n");
return;
}
temp = sdmc_readl(host, SDMC_OINTST);
sdmc_writel(host, SDMC_OINTST, temp);
}
void hal_sdmc_init(struct aic_sdmc_host *host)
{
sdmc_writel(host, SDMC_OINTST, 0xFFFFFFFF);