Skip to content

Commit

Permalink
arch/risc-v/src/mpfs/mpfs_ddr.c: Clean up the TXDLY verify step
Browse files Browse the repository at this point in the history
Just verify that the delay for the selected clock != 0

Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
Jukka Laitinen authored and xiaoxiang781216 committed Jan 22, 2025
1 parent e8cc1d3 commit 6ca6608
Showing 1 changed file with 5 additions and 39 deletions.
44 changes: 5 additions & 39 deletions arch/risc-v/src/mpfs/mpfs_ddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -3420,6 +3420,7 @@ static int mpfs_training_verify(void)
uint32_t i;
uint32_t off_taps;
uint32_t width_taps;
uint32_t gt_clk_sel;

while (!(getreg32(MPFS_DDR_CSR_APB_STAT_DFI_TRAINING_COMPLETE) & 0x01) &&
--retries);
Expand Down Expand Up @@ -3522,47 +3523,12 @@ static int mpfs_training_verify(void)

/* Extra checks */

uint32_t temp = 0;
uint32_t gt_clk_sel = getreg32(MPFS_CFG_DDR_SGMII_PHY_GT_CLK_SEL) &
0x03;
/* Check the GT_TXDLY result for the selected clock */

if ((getreg32(MPFS_CFG_DDR_SGMII_PHY_GT_TXDLY) & 0xff) == 0)
{
temp++;
if (gt_clk_sel == 0)
{
t_status |= 0x01;
}
}

if (((getreg32(MPFS_CFG_DDR_SGMII_PHY_GT_TXDLY) >> 8) & 0xff) == 0)
{
temp++;
if (gt_clk_sel == 1)
{
t_status |= 0x01;
}
}

if (((getreg32(MPFS_CFG_DDR_SGMII_PHY_GT_TXDLY) >> 16) & 0xff) == 0)
{
temp++;
if (gt_clk_sel == 2)
{
t_status |= 0x01;
}
}

if (((getreg32(MPFS_CFG_DDR_SGMII_PHY_GT_TXDLY) >> 24) & 0xff) == 0)
{
temp++;
if (gt_clk_sel == 3)
{
t_status |= 0x01;
}
}
gt_clk_sel = getreg32(MPFS_CFG_DDR_SGMII_PHY_GT_CLK_SEL) & 0x03;

if (temp > 1)
if (((getreg32(MPFS_CFG_DDR_SGMII_PHY_GT_TXDLY) >> (gt_clk_sel * 8)) &
0xff) == 0)
{
t_status |= 0x01;
}
Expand Down

0 comments on commit 6ca6608

Please sign in to comment.