MarvellEmbeddedProcessors / mv-ddr-marvell

20 stars 23 forks source link

mv_ddr: a38x: Fix Synchronous vs Asynchronous mode determination #35

Closed elkablo closed 2 years ago

elkablo commented 2 years ago

Before commit 4c289425752f ("mv_ddr: a38x: add support for ddr async mode"), Asynchornous Mode was only used when the CPU Subsystem Clock Options[4:0] field in the SAR1 register was set to value 0x13: CPU at 2 GHz and DDR at 933 MHz.

Then commit 4c289425752f ("mv_ddr: a38x: add support for ddr async mode") added support for Asynchornous Modes with frequencies other than 933 MHz (but at least 467 MHz), but the code it added to check for whether Asynchornous Mode should be used is wrong: it checks whether the frequency setting in board DDR topology map is set to value other than MV_DDR_FREQ_SAR.

Thus boards which define a specific value, greater than 400 MHz, for DDR frequency in their board topology (e.g. Turris Omnia defines MV_DDR_FREQ_800), are incorrectly put into Asynchornous Mode after that commit.

The A38x Functional Specification, section 10.12 DRAM Clocking, says: In Synchornous mode, the DRAM and CPU clocks are edge aligned and run in 1:2 or 1:3 CPU to DRAM frequency ratios.

Change the check for whether Asynchornous Mode should be used according to this explanation in Functional Specification.

Signed-off-by: Marek Behún marek.behun@nic.cz

elkablo commented 2 years ago

The patch was also sent to U-Boot:

http://patchwork.ozlabs.org/project/uboot/patch/20220104145749.18626-1-kabel@kernel.org/