From: Alif Zakuan Yuslaimi <[email protected]> According to Cyclone5 SoC handbook, software must write to static cfg register after writing to any SDR register for it to take effect.
Without setting this static cfg bit, F2SDRAM port will not work. Signed-off-by: Alif Zakuan Yuslaimi <[email protected]> --- arch/arm/mach-socfpga/include/mach/misc.h | 1 + drivers/fpga/socfpga_gen5.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/arm/mach-socfpga/include/mach/misc.h b/arch/arm/mach-socfpga/include/mach/misc.h index 0b80e952131..da228115304 100644 --- a/arch/arm/mach-socfpga/include/mach/misc.h +++ b/arch/arm/mach-socfpga/include/mach/misc.h @@ -26,6 +26,7 @@ static inline void socfpga_fpga_add(void *fpga_desc) {} #ifdef CONFIG_TARGET_SOCFPGA_GEN5 void socfpga_sdram_remap_zero(void); +void socfpga_sdram_apply_static_cfg(void); static inline bool socfpga_is_booting_from_fpga(void) { if ((__image_copy_start >= (char *)SOCFPGA_FPGA_SLAVES_ADDRESS) && diff --git a/drivers/fpga/socfpga_gen5.c b/drivers/fpga/socfpga_gen5.c index 964a5cc8789..ce06275ce11 100644 --- a/drivers/fpga/socfpga_gen5.c +++ b/drivers/fpga/socfpga_gen5.c @@ -8,6 +8,7 @@ #include <asm/io.h> #include <linux/errno.h> #include <asm/arch/fpga_manager.h> +#include <asm/arch/misc.h> #include <asm/arch/reset_manager.h> #include <asm/arch/system_manager.h> @@ -204,6 +205,7 @@ int socfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size) /* Disable all signals from FPGA to HPS SDRAM */ #define SDR_CTRLGRP_FPGAPORTRST_ADDRESS 0x5080 writel(0, SOCFPGA_SDR_ADDRESS + SDR_CTRLGRP_FPGAPORTRST_ADDRESS); + socfpga_sdram_apply_static_cfg(); /* Disable all axi bridge (hps2fpga, lwhps2fpga & fpga2hps) */ socfpga_bridges_reset(1); -- 2.43.7

