sunxi: Fix two H616 DRAM bugs
Subsystems (3)
Jernej Skrabec
maintainercover sunxi: Fix two H616 DRAM bugs
At closer inspection of H616 DRAM code I found two issues:
1. ODT is never configured due to missing CONFIG_ prefix in check
2. Dual rank read calibration never exits calibration mode
Only first issue is important to fix for currently supported boards. Fixing second one is future proofing.
Please take a look.
Best regards,
Jernej
Jernej Skrabec (2):
sunxi: fix H616 DRAM ODT support
sunxi: Fix H616 DRAM read calibration for dual rank
arch/arm/mach-sunxi/dram_sun50i_h616.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.35.0
Jernej Skrabec
maintainerPATCH 1/2 sunxi: fix H616 DRAM ODT support
Kconfig symbol is missing CONFIG_ prefix, so compiler will always skip ODT configuration.
Fix symbol name.
--- arch/arm/mach-sunxi/dram_sun50i_h616.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-sunxi/dram_sun50i_h616.c +1 -1
@@ -720,7 +720,7 @@ static bool mctl_phy_init(struct dram_para *para)writel (0x80 ,SUNXI_DRAM_PHY0_BASE +0x3dc );writel (0x80 ,SUNXI_DRAM_PHY0_BASE +0x45c ); -if (IS_ENABLED (DRAM_ODT_EN )) +if (IS_ENABLED (CONFIG_DRAM_ODT_EN ))mctl_phy_configure_odt ();clrsetbits_le32 (SUNXI_DRAM_PHY0_BASE +4 ,7 ,0xa );
Signature · 1 line
2.35.0
Re: [PATCH 1/2] sunxi: fix H616 DRAM ODT support
Quoted 4 lines · On Sat, 29 Jan 2022 16:58:42 +0100 Jernej Skrabec <[email protected]>…
Kconfigsymbol is missingCONFIG_prefix, so compiler will always skip ODT configuration.Fix symbol name.
Oops, nice catch!
Applied to sunxi/master.
Cheers,
Andre
Quoted 20 lines
Fixes f4317dbd06b6 ("sunxi: Add H616 DRAM support")Signed-off-by Jernej Skrabec <[email protected]>--- arch/arm/mach-sunxi/dram_sun50i_h616.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/mach-sunxi/dram_sun50i_h616.c +1
-1@@ -720,7 +720,7 @@ static bool mctl_phy_init(struct dram_para *para)writel (0x80 ,SUNXI_DRAM_PHY0_BASE +0x3dc );writel (0x80 ,SUNXI_DRAM_PHY0_BASE +0x45c ); -if (IS_ENABLED (DRAM_ODT_EN )) +if (IS_ENABLED (CONFIG_DRAM_ODT_EN ))mctl_phy_configure_odt ();clrsetbits_le32 (SUNXI_DRAM_PHY0_BASE +4 ,7 ,0xa );
Jernej Skrabec
maintainerPATCH 2/2 sunxi: Fix H616 DRAM read calibration for dual rank
In reply to Jernej SkrabecAlthough it isn't known what bit 0 in PHY reg 8 does, it's obvious that it has to be set before read calibration and cleared afterwards. This is already done for first rank, but not for second (copy & paste error.)
Fix it.
--- arch/arm/mach-sunxi/dram_sun50i_h616.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-sunxi/dram_sun50i_h616.c +1 -1
@@ -360,7 +360,7 @@ static bool mctl_phy_read_calibration(struct dram_para *para) } } -setbits_le32 (SUNXI_DRAM_PHY0_BASE +8 ,1 ); +clrbits_le32 (SUNXI_DRAM_PHY0_BASE +8 ,1 ); }clrbits_le32 (SUNXI_DRAM_PHY0_BASE +8 ,0x30 );
Signature · 1 line
2.35.0
Re: [PATCH 2/2] sunxi: Fix H616 DRAM read calibration for dual rank
Quoted 3 lines · On Sat, 29 Jan 2022 16:58:43 +0100 Jernej Skrabec <[email protected]>…
Although it isn't known what bit 0 in PHY reg 8 does, it's obvious that it has to be set before read calibration and cleared afterwards. This is already done for first rank, but not for second (copy & paste error.)
Indeed looks like it, from the logic point of view.
Quoted 5 lines
Fix it.
Fixes f4317dbd06b6 ("sunxi: Add H616 DRAM support")Signed-off-by Jernej Skrabec <[email protected]>
Applied to sunxi/master.
Cheers,
Andre
Quoted 17 lines
--- arch/arm/mach-sunxi/dram_sun50i_h616.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/mach-sunxi/dram_sun50i_h616.c +1
-1@@ -360,7 +360,7 @@ static bool mctl_phy_read_calibration(struct dram_para *para) } } -setbits_le32 (SUNXI_DRAM_PHY0_BASE +8 ,1 ); +clrbits_le32 (SUNXI_DRAM_PHY0_BASE +8 ,1 ); }clrbits_le32 (SUNXI_DRAM_PHY0_BASE +8 ,0x30 );