Add FPGA, SDRAM, SPL loadfs U-boot & booting to console
Subsystems (5)
v3 cover Add FPGA, SDRAM, SPL loadfs U-boot & booting to console
From: Tien Fong Chee <[email protected]>
This patchset adding FPGA and SDRAM drivers, enable fpga loadfs to program FPGA , SPL loading U-boot and booting to U-boot console. This version mainly resolved comments from Marek in [v2].
This series is working on top of u-boot-socfpga.git -
http://git.denx.de/u-boot-socfpga.git .
[v2]: https://www.mail-archive.com/u-boot at lists.denx.de/msg265192.html
v2 -> v3 changes:
-----------------
- Fixed the commit header tags.
- Added return -EINVAL when loader could not be started.
- Fixed yoda programming style.
- Created generic firmware loader.
- Used regular macros instead bitfields.
- re-orderd some patches.
Patchset history
----------------
[v1]: https://www.mail-archive.com/u-boot at lists.denx.de/msg261831.html
Tien Fong Chee (20):
ARM: socfpga: Description on FPGA RBF properties at Arria 10 FPGA
manager
dts: Add FPGA bitstream properties to Arria 10 DTS
arm: socfpga: Add Arria 10 SoCFPGA programming interface
dts: Enable fpga-mgr node build for Arria 10 SPL
fs: Enable generic filesystems interface support in SPL.
common: Generic firmware loader for file system
arm: socfpga: Fix with the correct polling status bit
arm: socfpga: Add drivers for programing FPGA from flash
arm: socfpga: Rename the gen5 sdram driver to more specific name
arm: socfpga: Add DRAM bank size initialization function
arm: socfpga: Add DDR driver for Arria 10
configs: Add DDR Kconfig support for Arria 10
arm: socfpga: Enable SPL memory allocation
arm: socfpga: Improve comments for Intel SoCFPGA program header
arm: socfpga: Enhance Intel SoCFPGA program header to support Arria 10
arm: socfpga: Adding clock frequency info for U-boot
arm: socfpga: Adding SoCFPGA info for both SPL and U-boot
arm: socfpga: Enable function visible to other file
arm: socfpga: Enable DDR working
arm: socfpga: Enable SPL booting U-boot
arch/arm/dts/socfpga_arria10.dtsi | 6 +
arch/arm/mach-socfpga/Kconfig | 1 +
arch/arm/mach-socfpga/board.c | 18 +
arch/arm/mach-socfpga/include/mach/boot0.h | 11 +-
.../include/mach/fpga_manager_arria10.h | 28 +
arch/arm/mach-socfpga/include/mach/sdram.h | 434 +-----------
arch/arm/mach-socfpga/include/mach/sdram_arria10.h | 2 +
.../include/mach/{sdram.h => sdram_gen5.h} | 6 +-
arch/arm/mach-socfpga/misc_arria10.c | 5 -
arch/arm/mach-socfpga/spl.c | 62 ++
cmd/fpga.c | 2 +-
common/Makefile | 2 +
common/load_fs.c | 163 +++++
common/spl/Kconfig | 8 +
common/spl/spl_mmc.c | 2 +-
configs/socfpga_arria10_defconfig | 57 +-
doc/README.SPL | 1 +
.../fpga/altera-socfpga-a10-fpga-mgr.txt | 11 +
drivers/ddr/altera/Kconfig | 2 +-
drivers/ddr/altera/Makefile | 3 +-
drivers/ddr/altera/sdram_arria10.c | 736 +++++++++++++++++++++
drivers/ddr/altera/{sdram.c => sdram_gen5.c} | 0
drivers/fpga/altera.c | 40 +-
drivers/fpga/fpga.c | 8 +
drivers/fpga/socfpga_arria10.c | 442 ++++++++++++-
fs/Makefile | 1 +
include/altera.h | 6 +
include/configs/socfpga_common.h | 23 +-
include/fpga.h | 2 +
include/load_fs.h | 40 ++
include/spl.h | 2 +
31 files changed, 1659 insertions(+), 465 deletions(-)
copy arch/arm/mach-socfpga/include/mach/{sdram.h => sdram_gen5.h} (99%)
create mode 100644 common/load_fs.c
create mode 100644 drivers/ddr/altera/sdram_arria10.c
rename drivers/ddr/altera/{sdram.c => sdram_gen5.c} (100%)
create mode 100644 include/load_fs.hSignature · 1 line
2.2.0
PATCH v3 1/20 ARM: socfpga: Description on FPGA RBF properties at Arria 10 FPGA manager
From: Tien Fong Chee <[email protected]>
This patch adds description on properties about location of FPGA RBFs are stored, type and functionality of RBF used to configure FPGA.
--- doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt | 11 +++++++++++ 1 file changed, 11 insertions(+)
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +11 -0
@@ -7,6 +7,14 @@ Required properties: - The second index is for writing FPGA configuration data. - resets : Phandle and reset specifier for the device's reset. - clocks : Clocks used by the device. +- altr,bitstream_periph : FPGA peripheral raw binary file which is used to + initialize FPGA IOs, PLL, IO48 and DDR. +- altr,bitstream_core : FPGA core raw binary file contains FPGA design which is + used to program FPGA CRAM and ERAM. +- altr,bitstream_devpart : Partition of flash device where bitstream files are + stored. + <dev[:part]> - dev is flash device number, part is + flash device partition. Example:
@@ -16,4 +24,7 @@ Example: 0xffcfe400 0x20>; clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; + altr,bitstream_periph = "ghrd_10as066n2.periph.rbf.mkimage"; + altr,bitstream_core = "ghrd_10as066n2.core.rbf.mkimage"; + altr,bitstream_devpart = "0:1"; };
Signature · 1 line
2.2.0
PATCH v3 2/20 dts: Add FPGA bitstream properties to Arria 10 DTS
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
These FPGA bitstream properties would help bootloader to understand how to configure FPGA and where to look the FPGA RBF files during booting.
--- arch/arm/dts/socfpga_arria10.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/dts/socfpga_arria10.dtsi +5 -0
@@ -538,6 +538,11 @@ clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; reset-names = "fpgamgr"; + altr,bitstream_periph = + "ghrd_10as066n2.periph.rbf.mkimage"; + altr,bitstream_core = + "ghrd_10as066n2.core.rbf.mkimage"; + altr,bitstream_devpart = "0:1"; }; i2c0: i2c at ffc02200 {
Signature · 1 line
2.2.0
PATCH v3 3/20 arm: socfpga: Add Arria 10 SoCFPGA programming interface
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Add code necessary into the FPGA driver framework in U-Boot so it can be used via the 'fpga' command for programing Arria 10 SoCFPGA.
--- cmd/fpga.c | 2 +- drivers/fpga/altera.c | 40 ++++++++++++++++++++++++++++++++-------- drivers/fpga/fpga.c | 8 ++++++++ include/fpga.h | 2 ++ 4 files changed, 43 insertions(+), 9 deletions(-)
cmd/fpga.c +1 -1
@@ -363,7 +363,7 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga, "(Xilinx only)\n"#endif #if defined(CONFIG_CMD_FPGA_LOADFS ) -"Load device from filesystem (FAT by default) (Xilinx only)\n" +"Load device from filesystem (FAT by default)\n" " loadfs [dev] [address] [image size] [blocksize] <interface>\n" " [<dev[:part]>] <filename>\n"#endif
drivers/fpga/altera.c +32 -8
@@ -23,25 +23,31 @@ static const struct altera_fpga {enum altera_family family;const char *name;int (*load)(Altera_desc *,const void *,size_t ); +int (*loadfs)(Altera_desc *,const void *,size_t ,fpga_fs_info *);int (*dump)(Altera_desc *,const void *,size_t );int (*info)(Altera_desc *); } altera_fpga[] = { #if defined(CONFIG_FPGA_ACEX1K) - { Altera_ACEX1K, "ACEX1K", ACEX1K_load, ACEX1K_dump, ACEX1K_info }, - { Altera_CYC2, "ACEX1K", ACEX1K_load, ACEX1K_dump, ACEX1K_info }, + { Altera_ACEX1K, "ACEX1K", ACEX1K_load, NULL, ACEX1K_dump, + ACEX1K_info }, + { Altera_CYC2, "ACEX1K", ACEX1K_load, NULL, ACEX1K_dump, + ACEX1K_info }, #elif defined(CONFIG_FPGA_CYCLON2) - { Altera_ACEX1K, "CycloneII", CYC2_load, CYC2_dump, CYC2_info }, - { Altera_CYC2, "CycloneII", CYC2_load, CYC2_dump, CYC2_info }, + { Altera_ACEX1K, "CycloneII", CYC2_load, NULL, CYC2_dump, CYC2_info }, + { Altera_CYC2, "CycloneII", CYC2_load, NULL, CYC2_dump, CYC2_info }, #endif #if defined(CONFIG_FPGA_STRATIX_II) - { Altera_StratixII, "StratixII", StratixII_load, + { Altera_StratixII, "StratixII", StratixII_load, NULL, StratixII_dump, StratixII_info }, #endif #if defined(CONFIG_FPGA_STRATIX_V) - { Altera_StratixV, "StratixV", stratixv_load, NULL, NULL }, + { Altera_StratixV, "StratixV", stratixv_load, NULL, NULL, NULL }, #endif -#if defined(CONFIG_FPGA_SOCFPGA) - { Altera_SoCFPGA, "SoC FPGA", socfpga_load, NULL, NULL }, +#if defined(CONFIG_FPGA_SOCFPGA) && defined(CONFIG_CMD_FPGA_LOADFS) + { Altera_SoCFPGA, "SoC FPGA", socfpga_load, socfpga_loadfs, NULL, + NULL }, +#elif defined(CONFIG_FPGA_SOCFPGA) + { Altera_SoCFPGA, "SoC FPGA", socfpga_load, NULL, NULL, NULL }, #endif };
@@ -174,3 +180,21 @@ int altera_info(Altera_desc *desc)return FPGA_SUCCESS ; } + +#if defined(CONFIG_CMD_FPGA_LOADFS ) +int altera_loadfs (Altera_desc *desc,const void *buf,size_t bsize, +fpga_fs_info *fpga_fsinfo) +{ +const struct altera_fpga *fpga =altera_desc_to_fpga (desc, __func__); + +if (!fpga) +return FPGA_FAIL ; + +debug_cond (FPGA_DEBUG ,"%s: Launching the %s FS Loader...\n" , + __func__, fpga->name); +if (fpga->loadfs) +return fpga->loadfs (desc, buf, bsize, fpga_fsinfo); + +return -EINVAL ; +} +#endif
drivers/fpga/fpga.c +8 -0
@@ -198,6 +198,14 @@ int fpga_fsload(int devnum, const void *buf, size_t size,fpga_no_sup ((char *)__func__,"Xilinx devices" );#endif break ; +#if defined(CONFIG_FPGA_ALTERA ) +case fpga_altera: + ret_val =altera_loadfs (desc->devdesc, buf, size, + fpga_fsinfo); +#else +fpga_no_sup ((char *)__func__,"Altera devices" ); +#endif +break ;default :printf ("%s: Invalid or unsupported device type %d\n" , __func__, desc->devtype);
include/fpga.h +2 -0
@@ -56,8 +56,10 @@ int fpga_count(void);const fpga_desc *const fpga_get_desc (int devnum);int fpga_load (int devnum,const void *buf,size_t bsize,bitstream_type bstype); +#if defined(CONFIG_CMD_FPGA_LOADFS )int fpga_fsload (int devnum,const void *buf,size_t size,fpga_fs_info *fpga_fsinfo); +#endif int fpga_loadbitstream (int devnum,char *fpgadata,size_t size,bitstream_type bstype);int fpga_dump (int devnum,const void *buf,size_t bsize);
Signature · 1 line
2.2.0
Dinh Nguyen
maintainerPATCH v3 3/20 arm: socfpga: Add Arria 10 SoCFPGA programming interface
Please run get_maintainer on this patch. I think you need to include a few more people.
Quoted 50 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add code necessary into the FPGA driver framework in U-Boot so it can be used via the 'fpga' command for programing Arria 10 SoCFPGA.
Signed-off-by Tien Fong Chee <[email protected]>--- cmd/fpga.c | 2 +- drivers/fpga/altera.c | 40 ++++++++++++++++++++++++++++++++-------- drivers/fpga/fpga.c | 8 ++++++++ include/fpga.h | 2 ++ 4 files changed, 43 insertions(+), 9 deletions(-)cmd/fpga.c +1
-1@@ -363,7 +363,7 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga, "(Xilinx only)\n"#endif #if defined(CONFIG_CMD_FPGA_LOADFS ) -"Load device from filesystem (FAT by default) (Xilinx only)\n" +"Load device from filesystem (FAT by default)\n " loadfs [dev] [address] [image size] [blocksize] <interface>\n" " [<dev[:part]>] <filename>\n" #endifdrivers/fpga/altera.c +6
-4@@ -23,25 +23,31 @@ static const struct altera_fpga {enum altera_family family;const char *name;int (*load)(Altera_desc *,const void *,size_t ); +int (*loadfs)(Altera_desc *,const void *,size_t ,fpga_fs_info *);int (*dump)(Altera_desc *,const void *,size_t );int (*info)(Altera_desc *); } altera_fpga[] = { #if defined(CONFIG_FPGA_ACEX1K) - { Altera_ACEX1K, "ACEX1K", ACEX1K_load, ACEX1K_dump, ACEX1K_info }, - { Altera_CYC2, "ACEX1K", ACEX1K_load, ACEX1K_dump, ACEX1K_info }, + { Altera_ACEX1K, "ACEX1K", ACEX1K_load, NULL, ACEX1K_dump, + ACEX1K_info }, + { Altera_CYC2, "ACEX1K", ACEX1K_load, NULL, ACEX1K_dump, + ACEX1K_info }, #elif defined(CONFIG_FPGA_CYCLON2) - { Altera_ACEX1K, "CycloneII", CYC2_load, CYC2_dump, CYC2_info }, - { Altera_CYC2, "CycloneII", CYC2_load, CYC2_dump, CYC2_info }, + { Altera_ACEX1K, "CycloneII", CYC2_load, NULL, CYC2_dump, CYC2_info },
drivers/fpga/altera.c static const struct altera_fpga { · line 44
Quoted 10 lines
drivers/fpga/altera.c +3
-2+ { Altera_CYC2, "CycloneII", CYC2_load, NULL, CYC2_dump, CYC2_info }, #endif #if defined(CONFIG_FPGA_STRATIX_II) - { Altera_StratixII, "StratixII", StratixII_load, + { Altera_StratixII, "StratixII", StratixII_load, NULL, StratixII_dump, StratixII_info }, #endif #if defined(CONFIG_FPGA_STRATIX_V) - { Altera_StratixV, "StratixV", stratixv_load, NULL, NULL }, + { Altera_StratixV, "StratixV", stratixv_load, NULL, NULL, NULL },
What is the purpose of the above 3 changes if this patch is for Arria10?
Dinh
Chee
PATCH v3 3/20 arm: socfpga: Add Arria 10 SoCFPGA programming interface
Quoted 4 lines · Dinh Nguyen
Please run
get_maintaineron this patch. I think you need to include a
few more people.
Okay.
Quoted 70 lines · tien.fong.chee at intel.com
Quoted 69 lines
From: Tien Fong Chee <[email protected]>
Add code necessary into the FPGA driver framework in U-Boot so it can be used via the 'fpga' command for programing Arria 10 SoCFPGA.
Signed-off-by Tien Fong Chee <[email protected]>---
cmd/fpga.c | 2 +-
drivers/fpga/altera.c | 40 ++++++++++++++++++++++++++++++++------- -
drivers/fpga/fpga.c | 8 ++++++++
include/fpga.h | 2 ++4 files changed, 43 insertions(+), 9 deletions(-)cmd/fpga.c +0
-0@@ -363,7 +363,7 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga,"(Xilinx only)\n"
#endif
#ifdefined(CONFIG_CMD_FPGA_LOADFS)cmd/fpga.c +0
-1- "Load device from filesystem (FAT by default) (Xilinxonly)\n"
cmd/fpga.c +1
-0+ "Load device from filesystem (FAT by default)\n" loadfs [dev] [address] [image size] [blocksize] <interface>\n"
" [<dev[:part]>] <filename>\n" #endifdrivers/fpga/altera.c +0
-0@@ -23,25 +23,31 @@ static const struct altera_fpga { enum altera_family family; const char *name;int (*load)(Altera_desc *, const
void *,size_t);drivers/fpga/altera.c +1
-0+ int (*loadfs)(Altera_desc *, const void *, size_t,
fpga_fs_info*);
int (*dump)(Altera_desc *, const
void *,size_t);
int (*info)(Altera_desc *);
} altera_fpga[] = {
#ifdefined(CONFIG_FPGA_ACEX1K)drivers/fpga/altera.c +0
-1- { Altera_ACEX1K, "ACEX1K", ACEX1K_load, ACEX1K_dump,
ACEX1K_info},drivers/fpga/altera.c +0
-1- { Altera_CYC2, "ACEX1K", ACEX1K_load, ACEX1K_dump,
ACEX1K_info},drivers/fpga/altera.c +4
-0+ { Altera_ACEX1K,"ACEX1K" , ACEX1K_load,NULL , ACEX1K_dump, + ACEX1K_info }, + { Altera_CYC2, "ACEX1K", ACEX1K_load, NULL, ACEX1K_dump, + ACEX1K_info },#elif
defined(CONFIG_FPGA_CYCLON2)drivers/fpga/altera.c +0
-1- { Altera_ACEX1K, "CycloneII", CYC2_load, CYC2_dump,
CYC2_info},drivers/fpga/altera.c +0
-1- { Altera_CYC2, "CycloneII", CYC2_load, CYC2_dump,
CYC2_info},drivers/fpga/altera.c +1
-0+ { Altera_ACEX1K, "CycloneII", CYC2_load, NULL, CYC2_dump,
CYC2_info},drivers/fpga/altera.c +1
-0+ { Altera_CYC2, "CycloneII", CYC2_load, NULL, CYC2_dump,
CYC2_info},
#endif
#ifdefined(CONFIG_FPGA_STRATIX_II)drivers/fpga/altera.c +1
-1- { Altera_StratixII, "StratixII", StratixII_load, + { Altera_StratixII, "StratixII", StratixII_load, NULL,StratixII_dump,
StratixII_info},
Quoted 9 lines
Quoted 6 lines
#endif
#ifdefined(CONFIG_FPGA_STRATIX_V)drivers/fpga/altera.c +0
-1- { Altera_StratixV,"StratixV" , stratixv_load,NULL ,NULL },
drivers/fpga/altera.c +1
-0+ { Altera_StratixV, "StratixV", stratixv_load, NULL, NULL,NULL },
What is the purpose of the above 3 changes if this patch is for Arria10?
I only added new lines related to fpga loadfs. I believe above 3 changes were due to location change when new lines were appended on top of them.
Quoted 1 line
Dinh
Chee
PATCH v3 3/20 arm: socfpga: Add Arria 10 SoCFPGA programming interface
In reply to tien.fong.chee at intel.comcmd/fpga.c
Quoted 18 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add code necessary into the FPGA driver framework in U-Boot so it can be used via the 'fpga' command for programing Arria 10 SoCFPGA.
Signed-off-by Tien Fong Chee <[email protected]>---
cmd/fpga.c | 2 +-
drivers/fpga/altera.c | 40 ++++++++++++++++++++++++++++++++-------- drivers/fpga/fpga.c | 8 ++++++++
include/fpga.h | 2 ++4 files changed, 43 insertions(+), 9 deletions(-)cmd/fpga.c +0
-0
Add more reviewers.
Quoted 130 lines
cmd/fpga.c +0
-0@@ -363,7 +363,7 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga,"(Xilinx only)\n"
#endif
#ifdefined(CONFIG_CMD_FPGA_LOADFS)cmd/fpga.c +0
-1- "Load device from filesystem (FAT by default) (Xilinxonly)\n"
cmd/fpga.c +1
-0+ "Load device from filesystem (FAT by default)\n"" loadfs [dev] [address] [image size] [blocksize] <interface>\n"
" [<dev[:part]>] <filename>\n" #endifdrivers/fpga/altera.c +0
-0@@ -23,25 +23,31 @@ static const struct altera_fpga { enum altera_family family; const char *name;int (*load)(Altera_desc *, const void
*,size_t);drivers/fpga/altera.c +1
-0+ int (*loadfs)(Altera_desc *, const void *, size_t,
fpga_fs_info*);
int (*dump)(Altera_desc *, const void
*,size_t);
int (*info)(Altera_desc *);
} altera_fpga[] = {
#ifdefined(CONFIG_FPGA_ACEX1K)drivers/fpga/altera.c +0
-1- { Altera_ACEX1K, "ACEX1K", ACEX1K_load, ACEX1K_dump,
ACEX1K_info},drivers/fpga/altera.c +0
-1- { Altera_CYC2, "ACEX1K", ACEX1K_load, ACEX1K_dump,
ACEX1K_info},drivers/fpga/altera.c +4
-0+ { Altera_ACEX1K,"ACEX1K" , ACEX1K_load,NULL , ACEX1K_dump, + ACEX1K_info }, + { Altera_CYC2, "ACEX1K", ACEX1K_load, NULL, ACEX1K_dump, + ACEX1K_info },#elif
defined(CONFIG_FPGA_CYCLON2)drivers/fpga/altera.c +0
-1- { Altera_ACEX1K, "CycloneII", CYC2_load, CYC2_dump,
CYC2_info},drivers/fpga/altera.c +0
-1- { Altera_CYC2, "CycloneII", CYC2_load, CYC2_dump,
CYC2_info},drivers/fpga/altera.c +1
-0+ { Altera_ACEX1K, "CycloneII", CYC2_load, NULL, CYC2_dump,
CYC2_info},drivers/fpga/altera.c +1
-0+ { Altera_CYC2, "CycloneII", CYC2_load, NULL, CYC2_dump,
CYC2_info},
#endif
#ifdefined(CONFIG_FPGA_STRATIX_II)drivers/fpga/altera.c +1
-1- { Altera_StratixII, "StratixII", StratixII_load, + { Altera_StratixII, "StratixII", StratixII_load, NULL,StratixII_dump,
StratixII_info},
#endif
#ifdefined(CONFIG_FPGA_STRATIX_V)drivers/fpga/altera.c +1
-1- { Altera_StratixV, "StratixV", stratixv_load, NULL, NULL }, + { Altera_StratixV, "StratixV", stratixv_load, NULL, NULL,NULL },
#endifdrivers/fpga/altera.c +2
-2-#if defined(CONFIG_FPGA_SOCFPGA) - { Altera_SoCFPGA, "SoC FPGA", socfpga_load, NULL, NULL }, +#if defined(CONFIG_FPGA_SOCFPGA ) && defined(CONFIG_CMD_FPGA_LOADFS ) + { Altera_SoCFPGA, "SoC FPGA", socfpga_load, socfpga_loadfs,NULL,
drivers/fpga/altera.c +3
-0+ NULL }, +#elif defined(CONFIG_FPGA_SOCFPGA ) + { Altera_SoCFPGA,"SoC FPGA" , socfpga_load,NULL ,NULL ,NULL },
#endif
};drivers/fpga/altera.c +0
-0@@ -174,3 +180,21 @@ int altera_info(Altera_desc *desc)
returnFPGA_SUCCESS;
}drivers/fpga/altera.c +6
-0+ +#if defined(CONFIG_CMD_FPGA_LOADFS ) +int altera_loadfs (Altera_desc *desc,const void *buf,size_t bsize, + fpga_fs_info *fpga_fsinfo) +{ + const struct altera_fpga *fpga = altera_desc_to_fpga(desc,
__func__);drivers/fpga/altera.c +5
-0+ +if (!fpga) +return FPGA_FAIL ; + + debug_cond(FPGA_DEBUG, "%s: Launching the %s FSLoader...\n",
drivers/fpga/altera.c +7
-0+ __func__, fpga->name); +if (fpga->loadfs) +return fpga->loadfs (desc, buf, bsize, fpga_fsinfo); + + return -EINVAL; +} +#endif drivers/fpga/fpga.c +0
-0@@ -198,6 +198,14 @@ int fpga_fsload(int devnum, const void *buf, size_t size,
fpga_no_sup((char *)__func__, "Xilinx devices");
#endif
break;drivers/fpga/fpga.c +3
-0+#if defined(CONFIG_FPGA_ALTERA ) +case fpga_altera: + ret_val = altera_loadfs(desc->devdesc, buf,size,
drivers/fpga/fpga.c +3
-0+ fpga_fsinfo); +#else + fpga_no_sup((char *)__func__, "Alteradevices");
drivers/fpga/fpga.c +2
-0+#endif +break ;default:
printf("%s: Invalid or unsupported device type %d\n",
__func__,desc->devtype);include/fpga.h +2
-0@@ -56,8 +56,10 @@ int fpga_count(void); const fpga_desc *const fpga_get_desc(int devnum); int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype); +#if defined(CONFIG_CMD_FPGA_LOADFS ) int fpga_fsload(int devnum, const void *buf, size_t size, fpga_fs_info *fpga_fsinfo); +#endif int fpga_loadbitstream(int devnum, char *fpgadata, size_t size, bitstream_type bstype); int fpga_dump(int devnum, const void *buf, size_t bsize);
PATCH v3 4/20 dts: Enable fpga-mgr node build for Arria 10 SPL
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
fpga-mgr node is required in SPL, because SPL needs information from the node to configure FPGA in Arria 10.
--- arch/arm/dts/socfpga_arria10.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/dts/socfpga_arria10.dtsi +1 -0
@@ -532,6 +532,7 @@ }; fpga_mgr: fpga-mgr at ffd03000 { + u-boot,dm-pre-reloc; compatible = "altr,socfpga-a10-fpga-mgr"; reg = <0xffd03000 0x100 0xffcfe400 0x20>;
Signature · 1 line
2.2.0
PATCH v3 5/20 fs: Enable generic filesystems interface support in SPL.
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Enable generic filesystem interface drivers(fs.c and fat/) build for SPL. This would allow generic filesystem being used in SPL.
--- common/spl/Kconfig | 8 ++++++++ doc/README.SPL | 1 + fs/Makefile | 1 + 3 files changed, 10 insertions(+)
common/spl/Kconfig +8 -0
@@ -304,6 +304,14 @@ config SPL_ETH_SUPPORT is required since the network stack uses a number of environment variables. See also SPL_NET_SUPPORT. +config SPL_FS_GENERIC + bool "Support Generic filesystems interface driver" + help + Enable support for generic filesystems interface with SPL. This + permits U-Boot (or Linux in Falcon mode) to be loaded from a generic + filesystem from within SPL. Support for the underlying block + device (e.g. MMC or USB) must be enabled separately. + config SPL_EXT_SUPPORT bool "Support EXT filesystems" help
doc/README.SPL +1 -0
@@ -55,6 +55,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT (drivers/mtd/spi/libspi_flash.o) CONFIG_SPL_SPI_SUPPORT (drivers/spi/libspi.o) CONFIG_SPL_FAT_SUPPORT (fs/fat/libfat.o) CONFIG_SPL_EXT_SUPPORT +CONFIG_SPL_FS_GENERIC (fs/fs.o fat/) CONFIG_SPL_LIBGENERIC_SUPPORT (lib/libgeneric.o) CONFIG_SPL_POWER_SUPPORT (drivers/power/libpower.o) CONFIG_SPL_NAND_SUPPORT (drivers/mtd/nand/libnand.o)
fs/Makefile +1 -0
@@ -7,6 +7,7 @@ # ifdef CONFIG_SPL_BUILD +obj-$(CONFIG_SPL_FS_GENERIC) += fs.o fat/ obj-$(CONFIG_SPL_FAT_SUPPORT) += fat/ obj-$(CONFIG_SPL_EXT_SUPPORT) += ext4/ else
Signature · 1 line
2.2.0
PATCH v3 6/20 common: Generic firmware loader for file system
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Generic firmware loader framework contains some common functionality which is reusable by any specific file system firmware loader.
--- common/Makefile | 2 + common/load_fs.c | 163 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/load_fs.h | 40 ++++++++++++++ 3 files changed, 205 insertions(+) create mode 100644 common/load_fs.c create mode 100644 include/load_fs.h
common/Makefile +2 -0
@@ -130,3 +130,5 @@ obj-$(CONFIG_CMD_DFU) += dfu.o obj-y += command.o obj-y += s_record.o obj-y += xyzModem.o + +obj-y += load_fs.o
common/load_fs.c new file +163 -0
163 lines not on this page · raw message
include/load_fs.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* Copyright (C) 2017 Intel Corporation <www.intel.com> +* +* SPDX-License-Identifier: GPL-2.0 +*/ + + +#ifndef _LOAD_FS_H_ +#define _LOAD_FS_H_ + +#include <errno.h> + +enum flash_storage { +FLASH_STORAGE_NAND , +FLASH_STORAGE_SF , +FLASH_STORAGE_MMC , +FLASH_STORAGE_USB , +FLASH_STORAGE_SATA , +}; + +enum flash_flags { +FLASH_STORAGE_RAW ,/* Stored in raw memory */ +FLASH_STORAGE_FS ,/* Stored within a file system */ +FLASH_STORAGE_FIT ,/* Stored inside a FIT image */ +}; + +struct flash_location { +char *name; +enum flash_storage storage; +enum flash_flags flags; +u32 offset;/* offset from start of storage */ +char *devpart;/* Use the load command dev:part conventions */ +char *mtdpart;/* MTD partition for ubi part */ +char *ubivol;/* UBI volume-name for ubifsmount */ +}; + +int load_fs (struct flash_location *location,void *file_info, +const void *load_addr,size_t bsize); +int flash_select_fs_dev (struct flash_location *location); +#endif
Signature · 1 line
2.2.0
Dinh Nguyen
maintainerPATCH v3 6/20 common: Generic firmware loader for file system
Quoted 5 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Generic firmware loader framework contains some common functionality which is reusable by any specific file system firmware loader.
Quoted 8 lines
Signed-off-by Tien Fong Chee <[email protected]>--- common/Makefile | 2 + common/load_fs.c | 163 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/load_fs.h | 40 ++++++++++++++ 3 files changed, 205 insertions(+) create mode 100644 common/load_fs.c create mode 100644 include/load_fs.h
There is alot of change here and the commit message doesn't tell me anything! Please describe, in detail, what your patch is doing.
Also you need to include more people in the review path for this patch.
Dinh
PATCH v3 6/20 common: Generic firmware loader for file system
Quoted 17 lines · Dinh Nguyen
Quoted 5 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Generic firmware loader framework contains some common functionality which is reusable by any specific file system firmware loader.
Quoted 8 lines
Signed-off-by Tien Fong Chee <[email protected]>--- common/Makefile | 2 + common/load_fs.c | 163 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/load_fs.h | 40 ++++++++++++++ 3 files changed, 205 insertions(+) create mode 100644 common/load_fs.c create mode 100644 include/load_fs.h
Quoted 4 lines
There is alot of change here and the commit message doesn't tell me anything! Please describe, in detail, what your patch is doing.
Also you need to include more people in the review path for this patch.
And pull it out of the series and convert the splash loader to use this. It seems my comment about factoring out code from the splash loader was ignored, sigh ...
Quoted 2 lines
Dinh
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v3 6/20 common: Generic firmware loader for file system
Quoted 21 lines · Marek Vasut
Quoted 20 lines · Dinh Nguyen
Quoted 16 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Generic firmware loader framework contains some common functionality
which is reusable by any specific file system firmware loader.Signed-off-by Tien Fong Chee <[email protected]>---
common/Makefile | 2 +
common/load_fs.c | 163
++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/load_fs.h | 40 ++++++++++++++3 files changed, 205 insertions(+)create mode 100644
common/load_fs.c
create mode 100644include/load_fs.h
Quoted 5 lines
Quoted 5 lines
There is alot of change here and the commit message doesn't tell me anything! Please describe, in detail, what your patch is doing.
Also you need to include more people in the review path for this patch.
These are the code factored out from splash loader, contains some common functions which can be used by other file system loader such as fpga loadfs.
Okay, i will include more peoples.
Quoted 6 lines
And pull it out of the series and convert the splash loader to use this.
It seems my comment about factoring out code from the splash loader was
ignored, sigh ...
I didn't ignore your comment, i factored out the common code from splash loader and put in more generic function name and file name. Then, i will replace these generic fs loader with splash fs loader at different patchset.
Quoted 4 lines
Quoted 3 lines
Dinh
PATCH v3 6/20 common: Generic firmware loader for file system
Tien Fong,
Quoted 22 lines · Marek Vasut
Quoted 21 lines · Dinh Nguyen
Quoted 20 lines · tien.fong.chee at intel.com
Quoted 16 lines
From: Tien Fong Chee <[email protected]>
Generic firmware loader framework contains some common functionality
which is reusable by any specific file system firmware loader.Signed-off-by Tien Fong Chee <[email protected]>---
common/Makefile | 2 +
common/load_fs.c | 163
++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/load_fs.h | 40 ++++++++++++++3 files changed, 205 insertions(+)create mode 100644
common/load_fs.c
create mode 100644include/load_fs.h
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
There is alot of change here and the commit message doesn't tell me anything! Please describe, in detail, what your patch is doing.
Also you need to include more people in the review path for this patch.
These are the code factored out from splash loader, contains some common functions which can be used by other file system loader such as fpga loadfs.
Would it be possible to provide ./doc entry to explain how one can use this set of tools (splash/loadfs loaders) ?
Quoted 12 lines
Okay, i will include more peoples.
Quoted 6 lines
And pull it out of the series and convert the splash loader to use this.
It seems my comment about factoring out code from the splash loader was
ignored, sigh ...I didn't ignore your comment, i factored out the common code from splash loader and put in more generic function name and file name. Then, i will replace these generic fs loader with splash fs loader at different patchset.
Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Dinh
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Chee
PATCH v3 6/20 common: Generic firmware loader for file system
Quoted 37 lines · Lukasz Majewski
Tien Fong,
Quoted 35 lines · Marek Vasut
Quoted 33 lines · Dinh Nguyen
Quoted 31 lines · tien.fong.chee at intel.com
Quoted 10 lines
From: Tien Fong Chee <[email protected]>
Generic firmware loader framework contains some common functionality
which is reusable by any specific file system firmware loader.Signed-off-by Tien Fong Chee <[email protected]>Quoted 8 lines
---
common/Makefile | 2 +
common/load_fs.c | 163
++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/load_fs.h | 40 ++++++++++++++3 files changed, 205 insertions(+)create mode 100644
common/load_fs.c
create mode 100644include/load_fs.hThere is alot of change here and the commit message doesn't tell
me anything! Please describe, in detail, what your patch is doing.Also you need to include more people in the review path for this
patch.
Quoted 8 lines
Quoted 4 lines
These are the code factored out from splash loader, contains some common functions which can be used by other file system loader such as
fpga loadfs.Would it be possible to provide ./doc entry to explain how one can use
this set of tools (splash/loadfs loaders) ?
Sure. I will provide a./doc or comment in next version. Basically, the idea is factoring out the common code which specific handlle image in file format loading from flash to target(memory/device) between splash loader and fpga loadfs. So, you will see i have declared a few weak functions, which is used for defined speficic handling algorithm such as get_file, and fs_loading.
Initially, my plan is creating a more generic function name and geneirc file name, then replacing those splash_loader fs at separate patch set.
Now, i am working directly on splash loader. Anyway, i also like more discussion and good comments while i am working on it.
Thanks.
Quoted 37 lines
Quoted 19 lines
Okay, i will include more peoples.
Quoted 9 lines
And pull it out of the series and convert the splash loader to use
this.
It seems my comment about factoring out code from the splash loader
was
ignored, sigh ...I didn't ignore your comment, i factored out the common code from splash loader and put in more generic function name and file name. Then, i will replace these generic fs loader with splash fs loader at
different patchset.Quoted 3 lines
Quoted 3 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Dinh
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-bootBest regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
PATCH v3 6/20 common: Generic firmware loader for file system
Hi Tien Fong,
Quoted 53 lines · Lukasz Majewski
Quoted 37 lines
Tien Fong,
Quoted 35 lines · Marek Vasut
Quoted 33 lines · Dinh Nguyen
Quoted 31 lines · tien.fong.chee at intel.com
Quoted 10 lines
From: Tien Fong Chee <[email protected]>
Generic firmware loader framework contains some common functionality
which is reusable by any specific file system firmware loader.Signed-off-by Tien Fong Chee <[email protected]>Quoted 8 lines
---
common/Makefile | 2 +
common/load_fs.c | 163
++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/load_fs.h | 40 ++++++++++++++3 files changed, 205 insertions(+)create mode 100644
common/load_fs.c
create mode 100644include/load_fs.hThere is alot of change here and the commit message doesn't tell
me anything! Please describe, in detail, what your patch is doing.Also you need to include more people in the review path for this
patch.Quoted 8 lines
Quoted 4 lines
These are the code factored out from splash loader, contains some common functions which can be used by other file system loader such as
fpga loadfs.Would it be possible to provide ./doc entry to explain how one can use
this set of tools (splash/loadfs loaders) ?Sure. I will provide a./doc or comment in next version. Basically, the idea is factoring out the common code which specific handlle image in file format loading from flash to target(memory/device) between splash loader and fpga loadfs. So, you will see i have declared a few weak functions, which is used for defined speficic handling algorithm such as
get_file, andfs_loading.
Quoted 6 lines
Initially, my plan is creating a more generic function name and geneirc file name, then replacing those
splash_loaderfs at separate patch set.Now, i am working directly on splash loader. Anyway, i also like more discussion and good comments while i am working on it.
I've asked for a documentation, since I do have one idea in the back of my head.
I'm wondering if other SoCs could benefit from this solution? For example when we treat the FPGA as a DSP processor which needs to have bitstream ( or better firmware ) loaded to some physical address. I'm also wondering if your work would allow for start/stop of the code execution?
It would be best to have some kind of common code and extensions per soc/architecture.
I cannot help much with review/design phase since I know very little on this particular Altera (up.. sorry Intel) solution.
Please add me to CC for your further work.
Quoted 41 lines
Thanks.
Quoted 38 lines
Quoted 19 lines
Okay, i will include more peoples.
Quoted 9 lines
And pull it out of the series and convert the splash loader to use
this.
It seems my comment about factoring out code from the splash loader
was
ignored, sigh ...I didn't ignore your comment, i factored out the common code from splash loader and put in more generic function name and file name. Then, i will replace these generic fs loader with splash fs loader at
different patchset.Quoted 3 lines
Quoted 3 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Dinh
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-bootBest regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email:
wd at denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
PATCH v3 6/20 common: Generic firmware loader for file system
On 10/27/2017 12:35 PM, Lukasz Majewski wrote:
[...]
Quoted 37 lines
Quoted 30 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 7 lines
common/Makefile | 2 +
common/load_fs.c | 163
++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/load_fs.h | 40 ++++++++++++++3 files changed, 205 insertions(+)create mode 100644
common/load_fs.c
create mode 100644include/load_fs.hThere is alot of change here and the commit message doesn't tell
me anything! Please describe, in detail, what your patch is doing.Also you need to include more people in the review path for this
patch.Quoted 8 lines
Quoted 4 lines
These are the code factored out from splash loader, contains some common functions which can be used by other file system loader such as
fpga loadfs.Would it be possible to provide ./doc entry to explain how one can use
this set of tools (splash/loadfs loaders) ?Sure. I will provide a./doc or comment in next version. Basically, the idea is factoring out the common code which specific handlle image in file format loading from flash to target(memory/device) between splash loader and fpga loadfs. So, you will see i have declared a few weak functions, which is used for defined speficic handling algorithm such as
get_file, andfs_loading.Quoted 6 lines
Initially, my plan is creating a more generic function name and geneirc file name, then replacing those
splash_loaderfs at separate patch set.Now, i am working directly on splash loader. Anyway, i also like more discussion and good comments while i am working on it.
Quoted 8 lines
I've asked for a documentation, since I do have one idea in the back of my head.
I'm wondering if other SoCs could benefit from this solution? For example when we treat the FPGA as a DSP processor which needs to have bitstream ( or better firmware ) loaded to some physical address. I'm also wondering if your work would allow for start/stop of the code execution?
This is supposed to be a firmware loader (kind-of like the firmware loader in Linux), so I have no idea what you mean by "start/stop" execution.
Quoted 2 lines
It would be best to have some kind of common code and extensions per soc/architecture.
I can't see a usecase for that.
Quoted 2 lines
I cannot help much with review/design phase since I know very little on this particular Altera (up.. sorry Intel) solution.[...]
Signature · 2 lines
Best regards, Marek Vasut
PATCH v3 6/20 common: Generic firmware loader for file system
Hi Marek,
Quoted 42 lines · Lukasz Majewski
[...]
Quoted 40 lines
Quoted 30 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 7 lines
common/Makefile | 2 +
common/load_fs.c | 163
++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/load_fs.h | 40 ++++++++++++++3 files changed, 205 insertions(+)create mode 100644
common/load_fs.c
create mode 100644include/load_fs.hThere is alot of change here and the commit message doesn't tell
me anything! Please describe, in detail, what your patch is doing.Also you need to include more people in the review path for this
patch.Quoted 8 lines
Quoted 4 lines
These are the code factored out from splash loader, contains some common functions which can be used by other file system loader such as
fpga loadfs.Would it be possible to provide ./doc entry to explain how one can use
this set of tools (splash/loadfs loaders) ?Sure. I will provide a./doc or comment in next version. Basically, the idea is factoring out the common code which specific handlle image in file format loading from flash to target(memory/device) between splash loader and fpga loadfs. So, you will see i have declared a few weak functions, which is used for defined speficic handling algorithm such as
get_file, andfs_loading.Quoted 6 lines
Initially, my plan is creating a more generic function name and geneirc file name, then replacing those
splash_loaderfs at separate patch set.Now, i am working directly on splash loader. Anyway, i also like more discussion and good comments while i am working on it.
I've asked for a documentation, since I do have one idea in the back of my head.
Quoted 8 lines
Quoted 5 lines
I'm wondering if other SoCs could benefit from this solution? For example when we treat the FPGA as a DSP processor which needs to have bitstream ( or better firmware ) loaded to some physical address. I'm also wondering if your work would allow for start/stop of the code execution?
This is supposed to be a firmware loader (kind-of like the firmware loader in Linux),
So in principle I should be able to load any bitstream (firmware) to any FPGA/SoC/whatever.
I do have in mind the ADI's SHARC DSP cores...
Quoted 2 lines
so I have no idea what you mean by "start/stop"
execution.
Ok. This can be done in a separate driver. No issues with that.
Quoted 5 lines
Quoted 3 lines
It would be best to have some kind of common code and extensions per soc/architecture.
I can't see a usecase for that.
The use case would be to reuse/tweak this code to be able to load firmware for the SHARC DSP processors.
Quoted 3 lines
Quoted 3 lines
I cannot help much with review/design phase since I know very little on this particular Altera (up.. sorry Intel) solution.[...]
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
PATCH v3 6/20 common: Generic firmware loader for file system
Quoted 50 lines · Lukasz Majewski
Hi Marek,
Quoted 48 lines · Lukasz Majewski
[...]
Quoted 45 lines
Quoted 30 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 7 lines
common/Makefile | 2 +
common/load_fs.c | 163
++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/load_fs.h | 40 ++++++++++++++3 files changed, 205 insertions(+)create mode 100644
common/load_fs.c
create mode 100644include/load_fs.hThere is alot of change here and the commit message doesn't tell
me anything! Please describe, in detail, what your patch is doing.Also you need to include more people in the review path for this
patch.Quoted 8 lines
Quoted 4 lines
These are the code factored out from splash loader, contains some common functions which can be used by other file system loader such as
fpga loadfs.Would it be possible to provide ./doc entry to explain how one can use
this set of tools (splash/loadfs loaders) ?Sure. I will provide a./doc or comment in next version. Basically, the idea is factoring out the common code which specific handlle image in file format loading from flash to target(memory/device) between splash loader and fpga loadfs. So, you will see i have declared a few weak functions, which is used for defined speficic handling algorithm such as
get_file, andfs_loading.Quoted 6 lines
Initially, my plan is creating a more generic function name and geneirc file name, then replacing those
splash_loaderfs at separate patch set.Now, i am working directly on splash loader. Anyway, i also like more discussion and good comments while i am working on it.
I've asked for a documentation, since I do have one idea in the back of my head.
I'm wondering if other SoCs could benefit from this solution? For example when we treat the FPGA as a DSP processor which needs to have bitstream ( or better firmware ) loaded to some physical address. I'm also wondering if your work would allow for start/stop of the code execution?
Quoted 4 lines
Quoted 2 lines
This is supposed to be a firmware loader (kind-of like the firmware loader in Linux),
So in principle I should be able to load any bitstream (firmware)
Yes, using this framework.
Quoted 2 lines
to
any FPGA/SoC/whatever.
No, this part is up to you to implement.
Quoted 1 line
I do have in mind the ADI's SHARC DSP cores...
The part which calls the firmware loader API and pushes it into those cores is up to you to implement.
Quoted 4 lines
Quoted 2 lines
so I have no idea what you mean by "start/stop"
execution.Ok. This can be done in a separate driver. No issues with that.
IMO it indeed should.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
It would be best to have some kind of common code and extensions per soc/architecture.
I can't see a usecase for that.
The use case would be to reuse/tweak this code to be able to load firmware for the SHARC DSP processors.
I think your driver will use the firmware loader indeed, but this functionality you described would be part of some driver for that hardware, not the FW loader.
Signature · 2 lines
Best regards, Marek Vasut
PATCH v3 6/20 common: Generic firmware loader for file system
Hi Marek,
Quoted 69 lines · Lukasz Majewski
Quoted 51 lines
Hi Marek,
Quoted 49 lines · Lukasz Majewski
[...]
Quoted 46 lines
Quoted 31 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 7 lines
common/Makefile | 2 +
common/load_fs.c | 163
++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/load_fs.h | 40 ++++++++++++++3 files changed, 205 insertions(+)create mode 100644
common/load_fs.c
create mode 100644include/load_fs.hThere is alot of change here and the commit message doesn't tell
me anything! Please describe, in detail, what your patch is doing.Also you need to include more people in the review path for this
patch.Quoted 8 lines
Quoted 4 lines
These are the code factored out from splash loader, contains some common functions which can be used by other file system loader such as
fpga loadfs.Would it be possible to provide ./doc entry to explain how one can use
this set of tools (splash/loadfs loaders) ?Sure. I will provide a./doc or comment in next version. Basically, the idea is factoring out the common code which specific handlle image in file format loading from flash to target(memory/device) between splash loader and fpga loadfs. So, you will see i have declared a few weak functions, which is used for defined speficic handling algorithm such as
get_file, andfs_loading.Quoted 6 lines
Initially, my plan is creating a more generic function name and geneirc file name, then replacing those
splash_loaderfs at separate patch set.Now, i am working directly on splash loader. Anyway, i also like more discussion and good comments while i am working on it.
I've asked for a documentation, since I do have one idea in the back of my head.
I'm wondering if other SoCs could benefit from this solution? For example when we treat the FPGA as a DSP processor which needs to have bitstream ( or better firmware ) loaded to some physical address. I'm also wondering if your work would allow for start/stop of the code execution?
Quoted 4 lines
Quoted 2 lines
This is supposed to be a firmware loader (kind-of like the firmware loader in Linux),
So in principle I should be able to load any bitstream (firmware)
Yes, using this framework.
Quoted 2 lines
to
any FPGA/SoC/whatever.No, this part is up to you to implement.
Quoted 1 line
I do have in mind the ADI's SHARC DSP cores...
The part which calls the firmware loader API and pushes it into those cores is up to you to implement.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
so I have no idea what you mean by "start/stop"
execution.Ok. This can be done in a separate driver. No issues with that.
IMO it indeed should.
Ok.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
It would be best to have some kind of common code and extensions per soc/architecture.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
I can't see a usecase for that.
The use case would be to reuse/tweak this code to be able to load firmware for the SHARC DSP processors.
I think your driver will use the firmware loader indeed, but this functionality you described would be part of some driver for that hardware, not the FW loader.
Unfortunately, there is no such "driver" available from the vendor - hence I'm poking around to see what can be "reused".
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171029/21d6d245/attachment.sig>
PATCH v3 6/20 common: Generic firmware loader for file system
Quoted 2 lines · Lukasz Majewski
Hi Marek,
[...]
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
It would be best to have some kind of common code and extensions per soc/architecture.
I can't see a usecase for that.
The use case would be to reuse/tweak this code to be able to load firmware for the SHARC DSP processors.
Quoted 6 lines
Quoted 3 lines
I think your driver will use the firmware loader indeed, but this functionality you described would be part of some driver for that hardware, not the FW loader.
Unfortunately, there is no such "driver" available from the vendor - hence I'm poking around to see what can be "reused".
Generic FW loader to load whatever blob + whatever driver to install it into the HW. You likely need to write the driver part then.
Signature · 2 lines
Best regards, Marek Vasut
PATCH v3 7/20 arm: socfpga: Fix with the correct polling status bit
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Commit 2baa997240d ("arm: socfpga: Add FPGA driver support for Arria 10") Polling the wrong status bit. Fix with correct polling status bit.
--- drivers/fpga/socfpga_arria10.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/fpga/socfpga_arria10.c +4 -3
@@ -112,13 +112,14 @@ static int wait_for_nconfig_pin_and_nstatus_pin(void)unsigned long mask =ALT_FPGAMGR_IMGCFG_STAT_F2S_NCONFIG_PIN_SET_MSK |ALT_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN_SET_MSK ; -/* Poll until f2s_nconfig_pin and f2s_nstatus_pin; loop until de-asserted, -* timeout at 1000ms +/* +* Poll until f2s_nconfig_pin and f2s_nstatus_pin; loop until +* de-asserted, timeout at 1000ms */ return wait_for_bit (__func__, &fpga_manager_base->imgcfg_stat, mask, - false,FPGA_TIMEOUT_MSEC , false); + true,FPGA_TIMEOUT_MSEC , false); }static int wait_for_f2s_nstatus_pin (unsigned long value)
Signature · 1 line
2.2.0
Dinh Nguyen
maintainerPATCH v3 7/20 arm: socfpga: Fix with the correct polling status bit
Quoted 4 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Commit
2baa997240d("arm: socfpga: Add FPGA driver support for Arria 10") Polling the wrong status bit. Fix with correct polling status bit.
This message doesn't reflect what the patch is doing. The patch is checking for the bit be set or cleared, not the status bit.
Dinh
Quoted 31 lines
Fixes 2baa997240d ("arm: socfpga: Add FPGA driver support for Arria 10")Signed-off-by Tien Fong Chee <[email protected]>--- drivers/fpga/socfpga_arria10.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/fpga/socfpga_arria10.c +4
-3@@ -112,13 +112,14 @@ static int wait_for_nconfig_pin_and_nstatus_pin(void)unsigned long mask =ALT_FPGAMGR_IMGCFG_STAT_F2S_NCONFIG_PIN_SET_MSK |ALT_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN_SET_MSK ; -/* Poll until f2s_nconfig_pin and f2s_nstatus_pin; loop until de-asserted, -* timeout at 1000ms +/* +* Poll until f2s_nconfig_pin and f2s_nstatus_pin; loop until +* de-asserted, timeout at 1000ms */ return wait_for_bit (__func__, &fpga_manager_base->imgcfg_stat, mask, - false,FPGA_TIMEOUT_MSEC , false); + true,FPGA_TIMEOUT_MSEC , false); }static int wait_for_f2s_nstatus_pin (unsigned long value)
Chee
PATCH v3 7/20 arm: socfpga: Fix with the correct polling status bit
Quoted 11 lines · Dinh Nguyen
Quoted 6 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Commit
2baa997240d("arm: socfpga: Add FPGA driver support for Arria 10")
Polling the wrong status bit. Fix with correct polling status bit.This message doesn't reflect what the patch is doing. The patch is checking for the bit be set or cleared, not the status bit.
This is not status register bit. This is just for false or true status. I can improve the comment.
Quoted 40 lines
Dinh
Quoted 39 lines
Fixes 2baa997240d ("arm: socfpga: Add FPGA driver support forArria 10")
Signed-off-by Tien Fong Chee <[email protected]>---
drivers/fpga/socfpga_arria10.c | 7 ++++---1 file changed, 4 insertions(+), 3 deletions(-)drivers/fpga/socfpga_arria10.c +0
-0@@ -112,13 +112,14 @@ static intwait_for_nconfig_pin_and_nstatus_pin (void)unsigned long mask =
ALT_FPGAMGR_IMGCFG_STAT_F2S_NCONFIG_PIN_SET_MSK|ALT_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN_SET_MSK;drivers/fpga/socfpga_arria10.c +0
-1-/* Poll until f2s_nconfig_pin and f2s_nstatus_pin; loop until de-asserted,
drivers/fpga/socfpga_arria10.c +2
-1- * timeout at 1000ms +/* +* Poll until f2s_nconfig_pin and f2s_nstatus_pin; loop until
drivers/fpga/socfpga_arria10.c +1
-0+ * de-asserted, timeout at 1000ms*/
return wait_for_bit(__func__,&fpga_manager_base->imgcfg_stat, mask,drivers/fpga/socfpga_arria10.c +1
-1- false, FPGA_TIMEOUT_MSEC, false); + true, FPGA_TIMEOUT_MSEC, false);}
static intwait_for_f2s_nstatus_pin(unsigned long value)
PATCH v3 8/20 arm: socfpga: Add drivers for programing FPGA from flash
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
These drivers handle FPGA program operation from flash loading RBF to memory and then to program FPGA.
--- .../include/mach/fpga_manager_arria10.h | 28 ++ drivers/fpga/socfpga_arria10.c | 435 ++++++++++++++++++++- include/altera.h | 6 + 3 files changed, 467 insertions(+), 2 deletions(-)
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +28 -0
@@ -8,6 +8,8 @@#ifndef _FPGA_MANAGER_ARRIA10_H_#define _FPGA_MANAGER_ARRIA10_H_ +#include <asm/cache.h> +#define ALT_FPGAMGR_IMGCFG_STAT_F2S_CRC_ERROR_SET_MSK BIT(0)#define ALT_FPGAMGR_IMGCFG_STAT_F2S_EARLY_USERMODE_SET_MSK BIT(1)#define ALT_FPGAMGR_IMGCFG_STAT_F2S_USERMODE_SET_MSK BIT(2)
@@ -89,11 +91,37 @@ struct socfpga_fpga_manager {u32 imgcfg_fifo_status; }; +#if defined(CONFIG_CMD_FPGA_LOADFS ) +enum rbf_type {unknown, periph_section, core_section}; +enum rbf_security {invalid, unencrypted, encrypted}; + +struct rbf_info { +enum rbf_type section; +enum rbf_security security; +}; + +struct flash_info { +char *interface; +char *dev_part; +char *filename; +int fstype; +u32 remaining; +u32 flash_offset; +struct rbf_info rbfinfo; +struct image_header header; +}; +#endif +/* Functions */ int fpgamgr_program_init (u32 * rbf_data,size_t rbf_size);int fpgamgr_program_finish (void );int is_fpgamgr_user_mode (void );int fpgamgr_wait_early_user_mode (void ); +#if defined(CONFIG_CMD_FPGA_LOADFS ) +const char *get_cff_filename (const void *fdt,int *len,u32 core); +const char *get_cff_devpart (const void *fdt,int *len); +#endif +void set_flash_devpart (char *name,char *devpart);#endif /* __ASSEMBLY__ */
drivers/fpga/socfpga_arria10.c +433 -2
474 lines not on this page · raw message
include/altera.h +6 -0
@@ -84,6 +84,10 @@ typedef struct {extern int altera_load (Altera_desc *desc,const void *image,size_t size);extern int altera_dump (Altera_desc *desc,const void *buf,size_t bsize);extern int altera_info (Altera_desc *desc); +#if defined(CONFIG_CMD_FPGA_LOADFS ) +int altera_loadfs (Altera_desc *desc,const void *buf,size_t bsize, +fpga_fs_info *fpga_fsinfo); +#endif /* Board specific implementation specific function types *********************************************************************/
@@ -111,6 +115,8 @@ typedef struct {#ifdef CONFIG_FPGA_SOCFPGA int socfpga_load (Altera_desc *desc,const void *rbf_data,size_t rbf_size); +int socfpga_loadfs (Altera_desc *desc,const void *buf,size_t bsize, +fpga_fs_info *fpga_fsinfo);#endif #ifdef CONFIG_FPGA_STRATIX_V
Signature · 1 line
2.2.0
Dinh Nguyen
maintainerPATCH v3 8/20 arm: socfpga: Add drivers for programing FPGA from flash
Quoted 11 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
These drivers handle FPGA program operation from flash loading RBF to memory and then to program FPGA.
Signed-off-by Tien Fong Chee <[email protected]>--- .../include/mach/fpga_manager_arria10.h | 28 ++ drivers/fpga/socfpga_arria10.c | 435 ++++++++++++++++++++- include/altera.h | 6 + 3 files changed, 467 insertions(+), 2 deletions(-)
Yikes, 467 changes in 1 patch and 2 line commit message? Anyway you can split up the patch to smaller parts? And please update the commit message to be a bit more descriptive?
Thanks,
Dinh
Chee
PATCH v3 8/20 arm: socfpga: Add drivers for programing FPGA from flash
Quoted 15 lines · Dinh Nguyen
Quoted 6 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
These drivers handle FPGA program operation from flash loading RBF to memory and then to program FPGA.
Quoted 7 lines
Signed-off-by Tien Fong Chee <[email protected]>---
.../include/mach/fpga_manager_arria10.h | 28 ++ drivers/fpga/socfpga_arria10.c | 435
++++++++++++++++++++-
include/altera.h | 6 +3 files changed, 467 insertions(+), 2 deletions(-)
Quoted 5 lines
Yikes, 467 changes in 1 patch and 2 line commit message? Anyway you can
split up the patch to smaller parts? And please update the commit message to be a bit more descriptive?
I can improve the commit messages. This patch serves for one purpose, adding all necessary functions required by fpga loadfs, so that fpga lodfs can support implementation as described above.
Quoted 2 lines
Thanks,
Dinh
PATCH v3 9/20 arm: socfpga: Rename the gen5 sdram driver to more specific name
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Current sdram driver is only applied to gen5 device, hence it is better to rename sdram driver to more specific name which is related to gen5 device.
---
arch/arm/mach-socfpga/include/mach/sdram.h | 432 +--------------------
.../include/mach/{sdram.h => sdram_gen5.h} | 6 +-
drivers/ddr/altera/Makefile | 2 +-
drivers/ddr/altera/{sdram.c => sdram_gen5.c} | 0
4 files changed, 7 insertions(+), 433 deletions(-)
copy arch/arm/mach-socfpga/include/mach/{sdram.h => sdram_gen5.h} (99%)
rename drivers/ddr/altera/{sdram.c => sdram_gen5.c} (100%)arch/arm/mach-socfpga/include/mach/sdram.h +3 -429
@@ -8,435 +8,9 @@#ifndef __ASSEMBLY__ -unsigned long sdram_calculate_size (void ); -int sdram_mmr_init_full (unsigned int sdr_phy_reg); -int sdram_calibration_full (void ); - -const struct socfpga_sdram_config *socfpga_get_sdram_config (void ); - -void socfpga_get_seq_ac_init (const u32 **init,unsigned int *nelem); -void socfpga_get_seq_inst_init (const u32 **init,unsigned int *nelem); -const struct socfpga_sdram_rw_mgr_config *socfpga_get_sdram_rwmgr_config (void ); -const struct socfpga_sdram_io_config *socfpga_get_sdram_io_config (void ); -const struct socfpga_sdram_misc_config *socfpga_get_sdram_misc_config (void ); - -#define SDR_CTRLGRP_ADDRESS (SOCFPGA_SDR_ADDRESS | 0x5000) - -struct socfpga_sdr_ctrl { -u32 ctrl_cfg; -u32 dram_timing1; -u32 dram_timing2; -u32 dram_timing3; -u32 dram_timing4;/* 0x10 */ -u32 lowpwr_timing; -u32 dram_odt; -u32 extratime1; -u32 __padding0[3 ]; -u32 dram_addrw;/* 0x2c */ -u32 dram_if_width;/* 0x30 */ -u32 dram_dev_width; -u32 dram_sts; -u32 dram_intr; -u32 sbe_count;/* 0x40 */ -u32 dbe_count; -u32 err_addr; -u32 drop_count; -u32 drop_addr;/* 0x50 */ -u32 lowpwr_eq; -u32 lowpwr_ack; -u32 static_cfg; -u32 ctrl_width;/* 0x60 */ -u32 cport_width; -u32 cport_wmap; -u32 cport_rmap; -u32 rfifo_cmap;/* 0x70 */ -u32 wfifo_cmap; -u32 cport_rdwr; -u32 port_cfg; -u32 fpgaport_rst;/* 0x80 */ -u32 __padding1; -u32 fifo_cfg; -u32 protport_default; -u32 prot_rule_addr;/* 0x90 */ -u32 prot_rule_id; -u32 prot_rule_data; -u32 prot_rule_rdwr; -u32 __padding2[3 ]; -u32 mp_priority;/* 0xac */ -u32 mp_weight0;/* 0xb0 */ -u32 mp_weight1; -u32 mp_weight2; -u32 mp_weight3; -u32 mp_pacing0;/* 0xc0 */ -u32 mp_pacing1; -u32 mp_pacing2; -u32 mp_pacing3; -u32 mp_threshold0;/* 0xd0 */ -u32 mp_threshold1; -u32 mp_threshold2; -u32 __padding3[29 ]; -u32 phy_ctrl0;/* 0x150 */ -u32 phy_ctrl1; -u32 phy_ctrl2; -}; - -/* SDRAM configuration structure for the SPL. */ -struct socfpga_sdram_config { -u32 ctrl_cfg; -u32 dram_timing1; -u32 dram_timing2; -u32 dram_timing3; -u32 dram_timing4; -u32 lowpwr_timing; -u32 dram_odt; -u32 extratime1; -u32 dram_addrw; -u32 dram_if_width; -u32 dram_dev_width; -u32 dram_intr; -u32 lowpwr_eq; -u32 static_cfg; -u32 ctrl_width; -u32 cport_width; -u32 cport_wmap; -u32 cport_rmap; -u32 rfifo_cmap; -u32 wfifo_cmap; -u32 cport_rdwr; -u32 port_cfg; -u32 fpgaport_rst; -u32 fifo_cfg; -u32 mp_priority; -u32 mp_weight0; -u32 mp_weight1; -u32 mp_weight2; -u32 mp_weight3; -u32 mp_pacing0; -u32 mp_pacing1; -u32 mp_pacing2; -u32 mp_pacing3; -u32 mp_threshold0; -u32 mp_threshold1; -u32 mp_threshold2; -u32 phy_ctrl0; -}; - -struct socfpga_sdram_rw_mgr_config { -u8 activate_0_and_1; -u8 activate_0_and_1_wait1; -u8 activate_0_and_1_wait2; -u8 activate_1; -u8 clear_dqs_enable; -u8 guaranteed_read; -u8 guaranteed_read_cont; -u8 guaranteed_write; -u8 guaranteed_write_wait0; -u8 guaranteed_write_wait1; -u8 guaranteed_write_wait2; -u8 guaranteed_write_wait3; -u8 idle; -u8 idle_loop1; -u8 idle_loop2; -u8 init_reset_0_cke_0; -u8 init_reset_1_cke_0; -u8 lfsr_wr_rd_bank_0; -u8 lfsr_wr_rd_bank_0_data; -u8 lfsr_wr_rd_bank_0_dqs; -u8 lfsr_wr_rd_bank_0_nop; -u8 lfsr_wr_rd_bank_0_wait; -u8 lfsr_wr_rd_bank_0_wl_1; -u8 lfsr_wr_rd_dm_bank_0; -u8 lfsr_wr_rd_dm_bank_0_data; -u8 lfsr_wr_rd_dm_bank_0_dqs; -u8 lfsr_wr_rd_dm_bank_0_nop; -u8 lfsr_wr_rd_dm_bank_0_wait; -u8 lfsr_wr_rd_dm_bank_0_wl_1; -u8 mrs0_dll_reset; -u8 mrs0_dll_reset_mirr; -u8 mrs0_user; -u8 mrs0_user_mirr; -u8 mrs1; -u8 mrs1_mirr; -u8 mrs2; -u8 mrs2_mirr; -u8 mrs3; -u8 mrs3_mirr; -u8 precharge_all; -u8 read_b2b; -u8 read_b2b_wait1; -u8 read_b2b_wait2; -u8 refresh_all; -u8 rreturn; -u8 sgle_read; -u8 zqcl; - -u8 true_mem_data_mask_width; -u8 mem_address_mirroring; -u8 mem_data_mask_width; -u8 mem_data_width; -u8 mem_dq_per_read_dqs; -u8 mem_dq_per_write_dqs; -u8 mem_if_read_dqs_width; -u8 mem_if_write_dqs_width; -u8 mem_number_of_cs_per_dimm; -u8 mem_number_of_ranks; -u8 mem_virtual_groups_per_read_dqs; -u8 mem_virtual_groups_per_write_dqs; -}; - -struct socfpga_sdram_io_config { -u16 delay_per_opa_tap; -u8 delay_per_dchain_tap; -u8 delay_per_dqs_en_dchain_tap; -u8 dll_chain_length; -u8 dqdqs_out_phase_max; -u8 dqs_en_delay_max; -u8 dqs_en_delay_offset; -u8 dqs_en_phase_max; -u8 dqs_in_delay_max; -u8 dqs_in_reserve; -u8 dqs_out_reserve; -u8 io_in_delay_max; -u8 io_out1_delay_max; -u8 io_out2_delay_max; -u8 shift_dqs_en_when_shift_dqs; -}; - -struct socfpga_sdram_misc_config { -u32 reg_file_init_seq_signature; -u8 afi_rate_ratio; -u8 calib_lfifo_offset; -u8 calib_vfifo_offset; -u8 enable_super_quick_calibration; -u8 max_latency_count_width; -u8 read_valid_fifo_size; -u8 tinit_cntr0_val; -u8 tinit_cntr1_val; -u8 tinit_cntr2_val; -u8 treset_cntr0_val; -u8 treset_cntr1_val; -u8 treset_cntr2_val; -}; - -#define SDR_CTRLGRP_CTRLCFG_NODMPINS_LSB 23 -#define SDR_CTRLGRP_CTRLCFG_NODMPINS_MASK 0x00800000 -#define SDR_CTRLGRP_CTRLCFG_DQSTRKEN_LSB 22 -#define SDR_CTRLGRP_CTRLCFG_DQSTRKEN_MASK 0x00400000 -#define SDR_CTRLGRP_CTRLCFG_STARVELIMIT_LSB 16 -#define SDR_CTRLGRP_CTRLCFG_STARVELIMIT_MASK 0x003f0000 -#define SDR_CTRLGRP_CTRLCFG_REORDEREN_LSB 15 -#define SDR_CTRLGRP_CTRLCFG_REORDEREN_MASK 0x00008000 -#define SDR_CTRLGRP_CTRLCFG_ECCCORREN_LSB 11 -#define SDR_CTRLGRP_CTRLCFG_ECCCORREN_MASK 0x00000800 -#define SDR_CTRLGRP_CTRLCFG_ECCEN_LSB 10 -#define SDR_CTRLGRP_CTRLCFG_ECCEN_MASK 0x00000400 -#define SDR_CTRLGRP_CTRLCFG_ADDRORDER_LSB 8 -#define SDR_CTRLGRP_CTRLCFG_ADDRORDER_MASK 0x00000300 -#define SDR_CTRLGRP_CTRLCFG_MEMBL_LSB 3 -#define SDR_CTRLGRP_CTRLCFG_MEMBL_MASK 0x000000f8 -#define SDR_CTRLGRP_CTRLCFG_MEMTYPE_LSB 0 -#define SDR_CTRLGRP_CTRLCFG_MEMTYPE_MASK 0x00000007 -/* Register template: sdr::ctrlgrp::dramtiming1 */ -#define SDR_CTRLGRP_DRAMTIMING1_TRFC_LSB 24 -#define SDR_CTRLGRP_DRAMTIMING1_TRFC_MASK 0xff000000 -#define SDR_CTRLGRP_DRAMTIMING1_TFAW_LSB 18 -#define SDR_CTRLGRP_DRAMTIMING1_TFAW_MASK 0x00fc0000 -#define SDR_CTRLGRP_DRAMTIMING1_TRRD_LSB 14 -#define SDR_CTRLGRP_DRAMTIMING1_TRRD_MASK 0x0003c000 -#define SDR_CTRLGRP_DRAMTIMING1_TCL_LSB 9 -#define SDR_CTRLGRP_DRAMTIMING1_TCL_MASK 0x00003e00 -#define SDR_CTRLGRP_DRAMTIMING1_TAL_LSB 4 -#define SDR_CTRLGRP_DRAMTIMING1_TAL_MASK 0x000001f0 -#define SDR_CTRLGRP_DRAMTIMING1_TCWL_LSB 0 -#define SDR_CTRLGRP_DRAMTIMING1_TCWL_MASK 0x0000000f -/* Register template: sdr::ctrlgrp::dramtiming2 */ -#define SDR_CTRLGRP_DRAMTIMING2_TWTR_LSB 25 -#define SDR_CTRLGRP_DRAMTIMING2_TWTR_MASK 0x1e000000 -#define SDR_CTRLGRP_DRAMTIMING2_TWR_LSB 21 -#define SDR_CTRLGRP_DRAMTIMING2_TWR_MASK 0x01e00000 -#define SDR_CTRLGRP_DRAMTIMING2_TRP_LSB 17 -#define SDR_CTRLGRP_DRAMTIMING2_TRP_MASK 0x001e0000 -#define SDR_CTRLGRP_DRAMTIMING2_TRCD_LSB 13 -#define SDR_CTRLGRP_DRAMTIMING2_TRCD_MASK 0x0001e000 -#define SDR_CTRLGRP_DRAMTIMING2_TREFI_LSB 0 -#define SDR_CTRLGRP_DRAMTIMING2_TREFI_MASK 0x00001fff -/* Register template: sdr::ctrlgrp::dramtiming3 */ -#define SDR_CTRLGRP_DRAMTIMING3_TCCD_LSB 19 -#define SDR_CTRLGRP_DRAMTIMING3_TCCD_MASK 0x00780000 -#define SDR_CTRLGRP_DRAMTIMING3_TMRD_LSB 15 -#define SDR_CTRLGRP_DRAMTIMING3_TMRD_MASK 0x00078000 -#define SDR_CTRLGRP_DRAMTIMING3_TRC_LSB 9 -#define SDR_CTRLGRP_DRAMTIMING3_TRC_MASK 0x00007e00 -#define SDR_CTRLGRP_DRAMTIMING3_TRAS_LSB 4 -#define SDR_CTRLGRP_DRAMTIMING3_TRAS_MASK 0x000001f0 -#define SDR_CTRLGRP_DRAMTIMING3_TRTP_LSB 0 -#define SDR_CTRLGRP_DRAMTIMING3_TRTP_MASK 0x0000000f -/* Register template: sdr::ctrlgrp::dramtiming4 */ -#define SDR_CTRLGRP_DRAMTIMING4_MINPWRSAVECYCLES_LSB 20 -#define SDR_CTRLGRP_DRAMTIMING4_MINPWRSAVECYCLES_MASK 0x00f00000 -#define SDR_CTRLGRP_DRAMTIMING4_PWRDOWNEXIT_LSB 10 -#define SDR_CTRLGRP_DRAMTIMING4_PWRDOWNEXIT_MASK 0x000ffc00 -#define SDR_CTRLGRP_DRAMTIMING4_SELFRFSHEXIT_LSB 0 -#define SDR_CTRLGRP_DRAMTIMING4_SELFRFSHEXIT_MASK 0x000003ff -/* Register template: sdr::ctrlgrp::lowpwrtiming */ -#define SDR_CTRLGRP_LOWPWRTIMING_CLKDISABLECYCLES_LSB 16 -#define SDR_CTRLGRP_LOWPWRTIMING_CLKDISABLECYCLES_MASK 0x000f0000 -#define SDR_CTRLGRP_LOWPWRTIMING_AUTOPDCYCLES_LSB 0 -#define SDR_CTRLGRP_LOWPWRTIMING_AUTOPDCYCLES_MASK 0x0000ffff -/* Register template: sdr::ctrlgrp::dramaddrw */ -#define SDR_CTRLGRP_DRAMADDRW_CSBITS_LSB 13 -#define SDR_CTRLGRP_DRAMADDRW_CSBITS_MASK 0x0000e000 -#define SDR_CTRLGRP_DRAMADDRW_BANKBITS_LSB 10 -#define SDR_CTRLGRP_DRAMADDRW_BANKBITS_MASK 0x00001c00 -#define SDR_CTRLGRP_DRAMADDRW_ROWBITS_LSB 5 -#define SDR_CTRLGRP_DRAMADDRW_ROWBITS_MASK 0x000003e0 -#define SDR_CTRLGRP_DRAMADDRW_COLBITS_LSB 0 -#define SDR_CTRLGRP_DRAMADDRW_COLBITS_MASK 0x0000001f -/* Register template: sdr::ctrlgrp::dramifwidth */ -#define SDR_CTRLGRP_DRAMIFWIDTH_IFWIDTH_LSB 0 -#define SDR_CTRLGRP_DRAMIFWIDTH_IFWIDTH_MASK 0x000000ff -/* Register template: sdr::ctrlgrp::dramdevwidth */ -#define SDR_CTRLGRP_DRAMDEVWIDTH_DEVWIDTH_LSB 0 -#define SDR_CTRLGRP_DRAMDEVWIDTH_DEVWIDTH_MASK 0x0000000f -/* Register template: sdr::ctrlgrp::dramintr */ -#define SDR_CTRLGRP_DRAMINTR_INTREN_LSB 0 -#define SDR_CTRLGRP_DRAMINTR_INTREN_MASK 0x00000001 -#define SDR_CTRLGRP_LOWPWREQ_SELFRFSHMASK_LSB 4 -#define SDR_CTRLGRP_LOWPWREQ_SELFRFSHMASK_MASK 0x00000030 -/* Register template: sdr::ctrlgrp::staticcfg */ -#define SDR_CTRLGRP_STATICCFG_APPLYCFG_LSB 3 -#define SDR_CTRLGRP_STATICCFG_APPLYCFG_MASK 0x00000008 -#define SDR_CTRLGRP_STATICCFG_USEECCASDATA_LSB 2 -#define SDR_CTRLGRP_STATICCFG_USEECCASDATA_MASK 0x00000004 -#define SDR_CTRLGRP_STATICCFG_MEMBL_LSB 0 -#define SDR_CTRLGRP_STATICCFG_MEMBL_MASK 0x00000003 -/* Register template: sdr::ctrlgrp::ctrlwidth */ -#define SDR_CTRLGRP_CTRLWIDTH_CTRLWIDTH_LSB 0 -#define SDR_CTRLGRP_CTRLWIDTH_CTRLWIDTH_MASK 0x00000003 -/* Register template: sdr::ctrlgrp::cportwidth */ -#define SDR_CTRLGRP_CPORTWIDTH_CMDPORTWIDTH_LSB 0 -#define SDR_CTRLGRP_CPORTWIDTH_CMDPORTWIDTH_MASK 0x000fffff -/* Register template: sdr::ctrlgrp::cportwmap */ -#define SDR_CTRLGRP_CPORTWMAP_CPORTWFIFOMAP_LSB 0 -#define SDR_CTRLGRP_CPORTWMAP_CPORTWFIFOMAP_MASK 0x3fffffff -/* Register template: sdr::ctrlgrp::cportrmap */ -#define SDR_CTRLGRP_CPORTRMAP_CPORTRFIFOMAP_LSB 0 -#define SDR_CTRLGRP_CPORTRMAP_CPORTRFIFOMAP_MASK 0x3fffffff -/* Register template: sdr::ctrlgrp::rfifocmap */ -#define SDR_CTRLGRP_RFIFOCMAP_RFIFOCPORTMAP_LSB 0 -#define SDR_CTRLGRP_RFIFOCMAP_RFIFOCPORTMAP_MASK 0x00ffffff -/* Register template: sdr::ctrlgrp::wfifocmap */ -#define SDR_CTRLGRP_WFIFOCMAP_WFIFOCPORTMAP_LSB 0 -#define SDR_CTRLGRP_WFIFOCMAP_WFIFOCPORTMAP_MASK 0x00ffffff -/* Register template: sdr::ctrlgrp::cportrdwr */ -#define SDR_CTRLGRP_CPORTRDWR_CPORTRDWR_LSB 0 -#define SDR_CTRLGRP_CPORTRDWR_CPORTRDWR_MASK 0x000fffff -/* Register template: sdr::ctrlgrp::portcfg */ -#define SDR_CTRLGRP_PORTCFG_AUTOPCHEN_LSB 10 -#define SDR_CTRLGRP_PORTCFG_AUTOPCHEN_MASK 0x000ffc00 -#define SDR_CTRLGRP_PORTCFG_PORTPROTOCOL_LSB 0 -#define SDR_CTRLGRP_PORTCFG_PORTPROTOCOL_MASK 0x000003ff -/* Register template: sdr::ctrlgrp::fifocfg */ -#define SDR_CTRLGRP_FIFOCFG_INCSYNC_LSB 10 -#define SDR_CTRLGRP_FIFOCFG_INCSYNC_MASK 0x00000400 -#define SDR_CTRLGRP_FIFOCFG_SYNCMODE_LSB 0 -#define SDR_CTRLGRP_FIFOCFG_SYNCMODE_MASK 0x000003ff -/* Register template: sdr::ctrlgrp::mppriority */ -#define SDR_CTRLGRP_MPPRIORITY_USERPRIORITY_LSB 0 -#define SDR_CTRLGRP_MPPRIORITY_USERPRIORITY_MASK 0x3fffffff -/* Register template: sdr::ctrlgrp::mpweight::mpweight_0 */ -#define SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_0_STATICWEIGHT_31_0_LSB 0 -#define SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_0_STATICWEIGHT_31_0_MASK 0xffffffff -/* Register template: sdr::ctrlgrp::mpweight::mpweight_1 */ -#define SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_1_SUMOFWEIGHTS_13_0_LSB 18 -#define SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_1_SUMOFWEIGHTS_13_0_MASK 0xfffc0000 -#define SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_1_STATICWEIGHT_49_32_LSB 0 -#define SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_1_STATICWEIGHT_49_32_MASK 0x0003ffff -/* Register template: sdr::ctrlgrp::mpweight::mpweight_2 */ -#define SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_2_SUMOFWEIGHTS_45_14_LSB 0 -#define SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_2_SUMOFWEIGHTS_45_14_MASK 0xffffffff -/* Register template: sdr::ctrlgrp::mpweight::mpweight_3 */ -#define SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_3_SUMOFWEIGHTS_63_46_LSB 0 -#define SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_3_SUMOFWEIGHTS_63_46_MASK 0x0003ffff -/* Register template: sdr::ctrlgrp::mppacing::mppacing_0 */ -#define SDR_CTRLGRP_MPPACING_MPPACING_0_THRESHOLD1_31_0_LSB 0 -#define SDR_CTRLGRP_MPPACING_MPPACING_0_THRESHOLD1_31_0_MASK 0xffffffff -/* Register template: sdr::ctrlgrp::mppacing::mppacing_1 */ -#define SDR_CTRLGRP_MPPACING_MPPACING_1_THRESHOLD2_3_0_LSB 28 -#define SDR_CTRLGRP_MPPACING_MPPACING_1_THRESHOLD2_3_0_MASK 0xf0000000 -#define SDR_CTRLGRP_MPPACING_MPPACING_1_THRESHOLD1_59_32_LSB 0 -#define SDR_CTRLGRP_MPPACING_MPPACING_1_THRESHOLD1_59_32_MASK 0x0fffffff -/* Register template: sdr::ctrlgrp::mppacing::mppacing_2 */ -#define SDR_CTRLGRP_MPPACING_MPPACING_2_THRESHOLD2_35_4_LSB 0 -#define SDR_CTRLGRP_MPPACING_MPPACING_2_THRESHOLD2_35_4_MASK 0xffffffff -/* Register template: sdr::ctrlgrp::mppacing::mppacing_3 */ -#define SDR_CTRLGRP_MPPACING_MPPACING_3_THRESHOLD2_59_36_LSB 0 -#define SDR_CTRLGRP_MPPACING_MPPACING_3_THRESHOLD2_59_36_MASK 0x00ffffff -/* Register template: sdr::ctrlgrp::mpthresholdrst::mpthresholdrst_0 */ -#define \ -SDR_CTRLGRP_MPTHRESHOLDRST_0_THRESHOLDRSTCYCLES_31_0_LSB 0 -#define \ -SDR_CTRLGRP_MPTHRESHOLDRST_0_THRESHOLDRSTCYCLES_31_0_MASK \ -0xffffffff -/* Register template: sdr::ctrlgrp::mpthresholdrst::mpthresholdrst_1 */ -#define \ -SDR_CTRLGRP_MPTHRESHOLDRST_1_THRESHOLDRSTCYCLES_63_32_LSB 0 -#define \ -SDR_CTRLGRP_MPTHRESHOLDRST_1_THRESHOLDRSTCYCLES_63_32_MASK \ -0xffffffff -/* Register template: sdr::ctrlgrp::mpthresholdrst::mpthresholdrst_2 */ -#define \ -SDR_CTRLGRP_MPTHRESHOLDRST_2_THRESHOLDRSTCYCLES_79_64_LSB 0 -#define \ -SDR_CTRLGRP_MPTHRESHOLDRST_2_THRESHOLDRSTCYCLES_79_64_MASK \ -0x0000ffff -/* Register template: sdr::ctrlgrp::remappriority */ -#define SDR_CTRLGRP_REMAPPRIORITY_PRIORITYREMAP_LSB 0 -#define SDR_CTRLGRP_REMAPPRIORITY_PRIORITYREMAP_MASK 0x000000ff -/* Register template: sdr::ctrlgrp::phyctrl::phyctrl_0 */ -#define SDR_CTRLGRP_PHYCTRL_PHYCTRL_0_SAMPLECOUNT_19_0_LSB 12 -#define SDR_CTRLGRP_PHYCTRL_PHYCTRL_0_SAMPLECOUNT_19_0_WIDTH 20 -#define SDR_CTRLGRP_PHYCTRL_PHYCTRL_0_SAMPLECOUNT_19_0_SET (x) \ - (((x) << 12) & 0xfffff000) -#define SDR_CTRLGRP_PHYCTRL_PHYCTRL_0_ADDLATSEL_SET (x) \ - (((x) << 10) & 0x00000c00) -#define SDR_CTRLGRP_PHYCTRL_PHYCTRL_0_DQSLOGICDELAYEN_SET (x) \ - (((x) << 6) & 0x000000c0) -#define SDR_CTRLGRP_PHYCTRL_PHYCTRL_0_RESETDELAYEN_SET (x) \ - (((x) << 8) & 0x00000100) -#define SDR_CTRLGRP_PHYCTRL_PHYCTRL_0_LPDDRDIS_SET (x) \ - (((x) << 9) & 0x00000200) -#define SDR_CTRLGRP_PHYCTRL_PHYCTRL_0_DQSDELAYEN_SET (x) \ - (((x) << 4) & 0x00000030) -#define SDR_CTRLGRP_PHYCTRL_PHYCTRL_0_DQDELAYEN_SET (x) \ - (((x) << 2) & 0x0000000c) -#define SDR_CTRLGRP_PHYCTRL_PHYCTRL_0_ACDELAYEN_SET (x) \ - (((x) << 0) & 0x00000003) -/* Register template: sdr::ctrlgrp::phyctrl::phyctrl_1 */ -#define SDR_CTRLGRP_PHYCTRL_PHYCTRL_1_LONGIDLESAMPLECOUNT_19_0_WIDTH 20 -#define SDR_CTRLGRP_PHYCTRL_PHYCTRL_1_LONGIDLESAMPLECOUNT_19_0_SET (x) \ - (((x) << 12) & 0xfffff000) -#define SDR_CTRLGRP_PHYCTRL_PHYCTRL_1_SAMPLECOUNT_31_20_SET (x) \ - (((x) << 0) & 0x00000fff) -/* Register template: sdr::ctrlgrp::phyctrl::phyctrl_2 */ -#define SDR_CTRLGRP_PHYCTRL_PHYCTRL_2_LONGIDLESAMPLECOUNT_31_20_SET (x) \ - (((x) << 0) & 0x00000fff) -/* Register template: sdr::ctrlgrp::dramodt */ -#define SDR_CTRLGRP_DRAMODT_READ_LSB 4 -#define SDR_CTRLGRP_DRAMODT_READ_MASK 0x000000f0 -#define SDR_CTRLGRP_DRAMODT_WRITE_LSB 0 -#define SDR_CTRLGRP_DRAMODT_WRITE_MASK 0x0000000f -/* Field instance: sdr::ctrlgrp::dramsts */ -#define SDR_CTRLGRP_DRAMSTS_DBEERR_MASK 0x00000008 -#define SDR_CTRLGRP_DRAMSTS_SBEERR_MASK 0x00000004 -/* Register template: sdr::ctrlgrp::extratime1 */ -#define SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_LSB 20 -#define SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_BC_LSB 24 -#define SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_DIFF_LSB 28 - -/* SDRAM width macro for configuration with ECC */ -#define SDRAM_WIDTH_32BIT_WITH_ECC 40 -#define SDRAM_WIDTH_16BIT_WITH_ECC 24 +#if defined(CONFIG_TARGET_SOCFPGA_GEN5 ) +#include <asm/arch/sdram_gen5.h> +#endif #endif #endif /* _SDRAM_H_ */
arch/arm/mach-socfpga/include/mach/sdram_gen5.h renamed from arch/arm/mach-socfpga/include/mach/sdram.h +3 -3
@@ -3,8 +3,8 @@* * SPDX-License-Identifier: GPL-2.0+ */ -#ifndef _SDRAM_H_ -#define _SDRAM_H_ +#ifndef _SOCFPGA_SDRAM_GEN5_H_ +#define _SOCFPGA_SDRAM_GEN5_H_#ifndef __ASSEMBLY__
@@ -439,4 +439,4 @@ SDR_CTRLGRP_MPTHRESHOLDRST_2_THRESHOLDRSTCYCLES_79_64_MASK \#define SDRAM_WIDTH_16BIT_WITH_ECC 24#endif -#endif /* _SDRAM_H_ */ +#endif /* _SOCFPGA_SDRAM_GEN5_H_ */
drivers/ddr/altera/Makefile +1 -1
@@ -9,5 +9,5 @@ # ifdef CONFIG_ALTERA_SDRAM -obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += sdram.o sequencer.o +obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += sdram_gen5.o sequencer.o endif
drivers/ddr/altera/sdram_gen5.c renamed from drivers/ddr/altera/sdram.c +0 -0
Signature · 1 line
2.2.0
PATCH v3 10/20 arm: socfpga: Add DRAM bank size initialization function
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Add function for both multiple DRAM bank and single DRAM bank size initialization. This common functionality could be used by every single SOCFPGA board.
--- arch/arm/mach-socfpga/board.c | 7 +++++++ include/configs/socfpga_common.h | 1 + 2 files changed, 8 insertions(+)
arch/arm/mach-socfpga/board.c +7 -0
@@ -29,6 +29,13 @@ int board_init(void)return 0 ; } +int dram_init_banksize (void ) +{ +fdtdec_setup_memory_banksize (); + +return 0 ; +} +#ifdef CONFIG_USB_GADGET struct dwc2_plat_otg_data socfpga_otg_data = { .usb_gusbcfg = 0x1417,
include/configs/socfpga_common.h +1 -0
@@ -43,6 +43,7 @@ (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +#define CONFIG_SYS_SDRAM_SIZE PHYS_SDRAM_1_SIZE#ifdef CONFIG_SOCFPGA_VIRTUAL_TARGET #define CONFIG_SYS_TEXT_BASE 0x08000040#else
Signature · 1 line
2.2.0
PATCH v3 11/20 arm: socfpga: Add DDR driver for Arria 10
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Add DDR driver suppport for Arria 10.
--- arch/arm/mach-socfpga/include/mach/sdram.h | 2 + arch/arm/mach-socfpga/include/mach/sdram_arria10.h | 2 + drivers/ddr/altera/Makefile | 1 + drivers/ddr/altera/sdram_arria10.c | 736 +++++++++++++++++++++ 4 files changed, 741 insertions(+) create mode 100644 drivers/ddr/altera/sdram_arria10.c
arch/arm/mach-socfpga/include/mach/sdram.h +2 -0
@@ -10,6 +10,8 @@#if defined(CONFIG_TARGET_SOCFPGA_GEN5 )#include <asm/arch/sdram_gen5.h> +#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) +#include <asm/arch/sdram_arria10.h> #endif #endif
arch/arm/mach-socfpga/include/mach/sdram_arria10.h +2 -0
@@ -8,6 +8,7 @@#define _SOCFPGA_SDRAM_ARRIA10_H_ #ifndef __ASSEMBLY__ +int ddr_calibration_sequence(void); struct socfpga_ecc_hmc { u32 ip_rev_id;
@@ -204,6 +205,7 @@ struct socfpga_io48_mmr {u32 niosreserve1; u32 niosreserve2; }; +#endif /*__ASSEMBLY__*/ #define IO48_MMR_CTRLCFG0_DB2_BURST_LENGTH_MASK 0x1F000000
drivers/ddr/altera/Makefile +1 -0
@@ -10,4 +10,5 @@ ifdef CONFIG_ALTERA_SDRAM obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += sdram_gen5.o sequencer.o +obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += sdram_arria10.o endif
drivers/ddr/altera/sdram_arria10.c new file +736 -0
736 lines not on this page · raw message
Signature · 1 line
2.2.0
Dinh Nguyen
maintainerPATCH v3 11/20 arm: socfpga: Add DDR driver for Arria 10
Quoted 3 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add DDR driver suppport for Arria 10.
s/suppport/support
Quoted 72 lines
Signed-off-by Tien Fong Chee <[email protected]>--- arch/arm/mach-socfpga/include/mach/sdram.h | 2 + arch/arm/mach-socfpga/include/mach/sdram_arria10.h | 2 + drivers/ddr/altera/Makefile | 1 + drivers/ddr/altera/sdram_arria10.c | 736 +++++++++++++++++++++ 4 files changed, 741 insertions(+) create mode 100644 drivers/ddr/altera/sdram_arria10.carch/arm/mach-socfpga/include/mach/sdram.h +2
-0@@ -10,6 +10,8 @@#if defined(CONFIG_TARGET_SOCFPGA_GEN5 )#include <asm/arch/sdram_gen5.h> +#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) +#include <asm/arch/sdram_arria10.h> #endif #endif arch/arm/mach-socfpga/include/mach/sdram_arria10.h +2
-0@@ -8,6 +8,7 @@#define _SOCFPGA_SDRAM_ARRIA10_H_ #ifndef __ASSEMBLY__ +int ddr_calibration_sequence(void); struct socfpga_ecc_hmc { u32 ip_rev_id;@@ -204,6 +205,7 @@ struct socfpga_io48_mmr {u32 niosreserve1; u32 niosreserve2; }; +#endif /*__ASSEMBLY__*/ #define IO48_MMR_CTRLCFG0_DB2_BURST_LENGTH_MASK 0x1F000000drivers/ddr/altera/Makefile +1
-0@@ -10,4 +10,5 @@ ifdef CONFIG_ALTERA_SDRAM obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += sdram_gen5.o sequencer.o +obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += sdram_arria10.o endifdrivers/ddr/altera/sdram_arria10.c new file +13
-0@@ -0,0 +1,736 @@ +/* +* Copyright (C) 2017 Intel Corporation <www.intel.com> +* +* SPDX-License-Identifier: GPL-2.0 +*/ + +#include <common.h> +#include <errno.h> +#include <fdtdec.h> +#include <malloc.h> +#include <wait_bit.h> +#include <watchdog.h> +#include <asm/io.h>
drivers/ddr/altera/sdram_arria10.c line 23
Quoted 10 lines
drivers/ddr/altera/sdram_arria10.c new file +10
-0+#include <asm/arch/fpga_manager.h> +#include <asm/arch/misc.h> +#include <asm/arch/reset_manager.h> +#include <asm/arch/sdram.h> +#include <linux/kernel.h> + +DECLARE_GLOBAL_DATA_PTR ; + +static void sdram_mmr_init (void ); +static unsigned long long sdram_size_calc (void );
Use uint64_t
Quoted 25 lines
drivers/ddr/altera/sdram_arria10.c new file +25
-0+ +/* FAWBANK - Number of Bank of a given device involved in the FAW period. */ +#define ARRIA10_SDR_ACTIVATE_FAWBANK (0x1) + +#define ARRIA_DDR_CONFIG (A ,B ,C ,R ) \ + (((A) << 24) | ((B) << 16) | ((C) << 8) | (R)) +#define DDR_CONFIG_ELEMENTS ARRAY_SIZE(ddr_config) +#define DDR_REG_SEQ2CORE 0xFFD0507C +#define DDR_REG_CORE2SEQ 0xFFD05078 +#define DDR_READ_LATENCY_DELAY 40 +#define DDR_SIZE_2GB_HEX 0x80000000 +#define DDR_MAX_TRIES 0x00100000 + +#define IO48_MMR_DRAMSTS 0xFFCFA0EC +#define IO48_MMR_NIOS2_RESERVE0 0xFFCFA110 +#define IO48_MMR_NIOS2_RESERVE1 0xFFCFA114 +#define IO48_MMR_NIOS2_RESERVE2 0xFFCFA118 + +#define SEQ2CORE_MASK 0xF +#define CORE2SEQ_INT_REQ 0xF +#define SEQ2CORE_INT_RESP_BIT 3 + +static const struct socfpga_ecc_hmc *socfpga_ecc_hmc_base = + (void *)SOCFPGA_SDR_ADDRESS ; +static const struct socfpga_noc_ddr_scheduler *socfpga_noc_ddr_scheduler_base =
drivers/ddr/altera/sdram_arria10.c line 58
Quoted 10 lines
drivers/ddr/altera/sdram_arria10.c new file +10
-0+ (void *)SOCFPGA_SDR_SCHEDULER_ADDRESS ; +static const struct socfpga_noc_fw_ddr_mpu_fpga2sdram + *socfpga_noc_fw_ddr_mpu_fpga2sdram_base = + (void *)SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS ; +static const struct socfpga_noc_fw_ddr_l3 *socfpga_noc_fw_ddr_l3_base = + (void *)SOCFPGA_SDR_FIREWALL_L3_ADDRESS ; +static const struct socfpga_io48_mmr *socfpga_io48_mmr_base = + (void *)SOCFPGA_HMC_MMR_IO48_ADDRESS ; + +/* The followring are the supported configurations */
s/followring/following
Quoted 120 lines
drivers/ddr/altera/sdram_arria10.c new file +120
-0+static u32 ddr_config[] = { +/* Chip - Row - Bank - Column Style */ +/* All Types */ +ARRIA_DDR_CONFIG (0 ,3 ,10 ,12 ), +ARRIA_DDR_CONFIG (0 ,3 ,10 ,13 ), +ARRIA_DDR_CONFIG (0 ,3 ,10 ,14 ), +ARRIA_DDR_CONFIG (0 ,3 ,10 ,15 ), +ARRIA_DDR_CONFIG (0 ,3 ,10 ,16 ), +ARRIA_DDR_CONFIG (0 ,3 ,10 ,17 ), +/* LPDDR x16 */ +ARRIA_DDR_CONFIG (0 ,3 ,11 ,14 ), +ARRIA_DDR_CONFIG (0 ,3 ,11 ,15 ), +ARRIA_DDR_CONFIG (0 ,3 ,11 ,16 ), +ARRIA_DDR_CONFIG (0 ,3 ,12 ,15 ), +/* DDR4 Only */ +ARRIA_DDR_CONFIG (0 ,4 ,10 ,14 ), +ARRIA_DDR_CONFIG (0 ,4 ,10 ,15 ), +ARRIA_DDR_CONFIG (0 ,4 ,10 ,16 ), +ARRIA_DDR_CONFIG (0 ,4 ,10 ,17 ),/* 14 */ +/* Chip - Bank - Row - Column Style */ +ARRIA_DDR_CONFIG (1 ,3 ,10 ,12 ), +ARRIA_DDR_CONFIG (1 ,3 ,10 ,13 ), +ARRIA_DDR_CONFIG (1 ,3 ,10 ,14 ), +ARRIA_DDR_CONFIG (1 ,3 ,10 ,15 ), +ARRIA_DDR_CONFIG (1 ,3 ,10 ,16 ), +ARRIA_DDR_CONFIG (1 ,3 ,10 ,17 ), +ARRIA_DDR_CONFIG (1 ,3 ,11 ,14 ), +ARRIA_DDR_CONFIG (1 ,3 ,11 ,15 ), +ARRIA_DDR_CONFIG (1 ,3 ,11 ,16 ), +ARRIA_DDR_CONFIG (1 ,3 ,12 ,15 ), +/* DDR4 Only */ +ARRIA_DDR_CONFIG (1 ,4 ,10 ,14 ), +ARRIA_DDR_CONFIG (1 ,4 ,10 ,15 ), +ARRIA_DDR_CONFIG (1 ,4 ,10 ,16 ), +ARRIA_DDR_CONFIG (1 ,4 ,10 ,17 ), +}; + +static int match_ddr_conf (u32 ddr_conf) +{ +int i; +/ +for (i =0 ; i <DDR_CONFIG_ELEMENTS ; i++) { +if (ddr_conf == ddr_config[i]) +return i; + } +return 0 ; +} + +/* Check whether SDRAM is successfully Calibrated */ +static int is_sdram_cal_success (void ) +{ +return readl (&socfpga_ecc_hmc_base->ddrcalstat); +} + +static unsigned char ddr_get_bit (u32 ereg,unsigned char bit) +{ +u32 reg =readl (ereg); + +return (reg &BIT (bit)) ?1 :0 ; +} + +static unsigned char ddr_wait_bit (u32 ereg,u32 bit, +u32 expected,u32 timeout_usec) +{ +u32 tmr; + +for (tmr =0 ; tmr < timeout_usec; tmr +=100 ) { +udelay (100 ); +WATCHDOG_RESET (); +if (ddr_get_bit (ereg, bit) == expected) +return 0 ; + } + +return 1 ; +} + +static void ddr_delay (u32 delay) +{ +int tmr; + +for (tmr =0 ; tmr < delay; tmr++) { +mdelay (1 ); +WATCHDOG_RESET (); + } +} + +static int emif_clear (void ) +{ +u32 i =DDR_MAX_TRIES ; +u8 ret =0 ; + +writel (0 ,DDR_REG_CORE2SEQ ); + +do { + ret = !wait_for_bit (__func__, (u32 *)DDR_REG_SEQ2CORE , +SEQ2CORE_MASK ,1 ,50 ,0 ); + }while (ret && (--i >0 )); + +return !i; +} + +static int emif_reset (void ) +{ +u32 c2s, s2c; + + c2s =readl (DDR_REG_CORE2SEQ ); + s2c =readl (DDR_REG_SEQ2CORE ); + +debug ("c2s=%08x s2c=%08x nr0=%08x nr1=%08x nr2=%08x dst=%08x\n" , + c2s, s2c,readl (IO48_MMR_NIOS2_RESERVE0 ), +readl (IO48_MMR_NIOS2_RESERVE1 ), +readl (IO48_MMR_NIOS2_RESERVE2 ), +readl (IO48_MMR_DRAMSTS )); + +if ((s2c &SEQ2CORE_MASK ) &&emif_clear ()) { +printf ("failed emif_clear()\n" ); +return -EPERM ; + } + +writel (CORE2SEQ_INT_REQ ,DDR_REG_CORE2SEQ );
drivers/ddr/altera/sdram_arria10.c line 188
Quoted 10 lines
drivers/ddr/altera/sdram_arria10.c new file +10
-0+ +if (ddr_wait_bit (DDR_REG_SEQ2CORE ,SEQ2CORE_INT_RESP_BIT ,0 ,1000000 )) { +printf ("emif_reset failed to see interrupt acknowledge\n" ); +return -EPERM ; + }else { +printf ("emif_reset interrupt acknowledged\n" ); + } + +if (emif_clear ()) { +printf ("emif_clear() failed\n" );
Use debug() instead of all the printf()'s.
drivers/ddr/altera/sdram_arria10.c line 198
Quoted 10 lines
drivers/ddr/altera/sdram_arria10.c new file +10
-0+return -EPERM ; + } +debug ("emif_reset interrupt cleared\n" ); + +debug ("nr0=%08x nr1=%08x nr2=%08x\n" , +readl (IO48_MMR_NIOS2_RESERVE0 ), +readl (IO48_MMR_NIOS2_RESERVE1 ), +readl (IO48_MMR_NIOS2_RESERVE2 )); + +return 0 ;
emif_reset() has all these return values, but the actual call to emif_reset() is not checking the values at all.
drivers/ddr/altera/sdram_arria10.c line 211
Quoted 13 lines
drivers/ddr/altera/sdram_arria10.c new file +13
-0+} + +static int ddr_setup (void ) +{ +int i, j, ddr_setup_complete =0 ; + +/* Try 3 times to do a calibration */ +for (i =0 ; (i <3 ) && !ddr_setup_complete; i++) { +WATCHDOG_RESET (); + +/* A delay to wait for calibration bit to set */ +for (j =0 ; (j <10 ) && !ddr_setup_complete; j++) { +ddr_delay (500 );
Looks like all ddr_delay() is doing is call to 1ms delay, and the max delay is 5s. Looks like you can rid of the ddr_delay() function and do the wait here.
drivers/ddr/altera/sdram_arria10.c line 222
Quoted 11 lines
drivers/ddr/altera/sdram_arria10.c new file +11
-0+ ddr_setup_complete =is_sdram_cal_success (); + } + +if (!ddr_setup_complete) +emif_reset (); + } + +if (!ddr_setup_complete) { +puts ("Error: Could Not Calibrate SDRAM\n" ); +return -EPERM ; + }
Move this block of code up to where you did the check for !ddr_setup_complete the first time.
Quoted 5 lines
drivers/ddr/altera/sdram_arria10.c new file +5
-0+ +return 0 ; +} + +/* Function to startup the SDRAM*/
drivers/ddr/altera/sdram_arria10.c line 237
Quoted 10 lines
drivers/ddr/altera/sdram_arria10.c new file +10
-0+static int sdram_startup (void ) +{ +/* Release NOC ddr scheduler from reset */ +socfpga_reset_deassert_noc_ddr_scheduler (); + +/* Bringup the DDR (calibration and configuration) */ +return ddr_setup (); +} + +static unsigned long long sdram_size_calc (void )
Use uint64_t
drivers/ddr/altera/sdram_arria10.c line 241
Quoted 4 lines
drivers/ddr/altera/sdram_arria10.c new file +4
-0+{ +u32 dramaddrw =readl (&socfpga_io48_mmr_base->dramaddrw); + + unsigned long long size = BIT(((dramaddrw &
uint64_t
Quoted 5 lines
drivers/ddr/altera/sdram_arria10.c new file +5
-0+ IO48_MMR_DRAMADDRW_CFG_CS_ADDR_WIDTH_MASK) >> + IO48_MMR_DRAMADDRW_CFG_CS_ADDR_WIDTH_SHIFT) + + ((dramaddrw & +IO48_MMR_DRAMADDRW_CFG_BANK_GROUP_ADDR_WIDTH_MASK ) >> + IO48_MMR_DRAMADDRW_CFG_BANK_GROUP_ADDR_WIDTH_SHIFT) +
drivers/ddr/altera/sdram_arria10.c line 256
Quoted 10 lines
drivers/ddr/altera/sdram_arria10.c new file +10
-0+ ((dramaddrw & +IO48_MMR_DRAMADDRW_CFG_BANK_ADDR_WIDTH_MASK ) >> +IO48_MMR_DRAMADDRW_CFG_BANK_ADDR_WIDTH_SHIFT ) + + ((dramaddrw & +IO48_MMR_DRAMADDRW_CFG_ROW_ADDR_WIDTH_MASK ) >> +IO48_MMR_DRAMADDRW_CFG_ROW_ADDR_WIDTH_SHIFT ) + + (dramaddrw & IO48_MMR_DRAMADDRW_CFG_COL_ADDR_WIDTH_MASK)); + + size *= (2 << (readl (&socfpga_ecc_hmc_base->ddrioctrl) & +ALT_ECC_HMC_OCP_DDRIOCTRL_IO_SIZE_MSK ));
Should add a debug statement here for the size.
Quoted 430 lines
drivers/ddr/altera/sdram_arria10.c new file +430
-0+ +return size; +} + +/* Function to initialize SDRAM MMR and NOC DDR scheduler*/ +static void sdram_mmr_init (void ) +{ +u32 update_value, io48_value; +u32 ctrlcfg0 =readl (&socfpga_io48_mmr_base->ctrlcfg0); +u32 ctrlcfg1 =readl (&socfpga_io48_mmr_base->ctrlcfg1); +u32 dramaddrw =readl (&socfpga_io48_mmr_base->dramaddrw); +u32 caltim0 =readl (&socfpga_io48_mmr_base->caltiming0); +u32 caltim1 =readl (&socfpga_io48_mmr_base->caltiming1); +u32 caltim2 =readl (&socfpga_io48_mmr_base->caltiming2); +u32 caltim3 =readl (&socfpga_io48_mmr_base->caltiming3); +u32 caltim4 =readl (&socfpga_io48_mmr_base->caltiming4); +u32 caltim9 =readl (&socfpga_io48_mmr_base->caltiming9); +u32 ddrioctl; + +/* +* Configure the DDR IO size [0xFFCFB008] +* niosreserve0: Used to indicate DDR width & +* bit[7:0] = Number of data bits (0x20 for 32bit) +* bit[8] = 1 if user-mode OCT is present +* bit[9] = 1 if warm reset compiled into EMIF Cal Code +* bit[10] = 1 if warm reset is on during generation in EMIF Cal +* niosreserve1: IP ADCDS version encoded as 16 bit value +* bit[2:0] = Variant (0=not special,1=FAE beta, 2=Customer beta, +* 3=EAP, 4-6 are reserved) +* bit[5:3] = Service Pack # (e.g. 1) +* bit[9:6] = Minor Release # +* bit[14:10] = Major Release # +*/ +if ((socfpga_io48_mmr_base->niosreserve1 >>6 ) &0x1FF ) { + update_value =readl (&socfpga_io48_mmr_base->niosreserve0); +writel (((update_value &0xFF ) >>5 ), + &socfpga_ecc_hmc_base->ddrioctrl); + } + + ddrioctl =readl (&socfpga_ecc_hmc_base->ddrioctrl); + +/* Set the DDR Configuration [0xFFD12400] */ + io48_value =ARRIA_DDR_CONFIG ( + ((ctrlcfg1 & +IO48_MMR_CTRLCFG1_ADDR_ORDER_MASK ) >> +IO48_MMR_CTRLCFG1_ADDR_ORDER_SHIFT ), + ((dramaddrw & +IO48_MMR_DRAMADDRW_CFG_BANK_ADDR_WIDTH_MASK ) >> +IO48_MMR_DRAMADDRW_CFG_BANK_ADDR_WIDTH_SHIFT ) + + ((dramaddrw & +IO48_MMR_DRAMADDRW_CFG_BANK_GROUP_ADDR_WIDTH_MASK ) >> +IO48_MMR_DRAMADDRW_CFG_BANK_GROUP_ADDR_WIDTH_SHIFT ), + (dramaddrw & +IO48_MMR_DRAMADDRW_CFG_COL_ADDR_WIDTH_MASK ), + ((dramaddrw & +IO48_MMR_DRAMADDRW_CFG_ROW_ADDR_WIDTH_MASK ) >> +IO48_MMR_DRAMADDRW_CFG_ROW_ADDR_WIDTH_SHIFT )); + + update_value =match_ddr_conf (io48_value); +if (update_value) +writel (update_value, + &socfpga_noc_ddr_scheduler_base->ddr_t_main_scheduler_ddrconf); + +/* +* Configure DDR timing [0xFFD1240C] +* RDTOMISS = tRTP + tRP + tRCD - BL/2 +* WRTOMISS = WL + tWR + tRP + tRCD and +* WL = RL + BL/2 + 2 - rd-to-wr ; tWR = 15ns so... +* First part of equation is in memory clock units so divide by 2 +* for HMC clock units. 1066MHz is close to 1ns so use 15 directly. +* WRTOMISS = ((RL + BL/2 + 2 + tWR) >> 1)- rd-to-wr + tRP + tRCD +*/ +u32 ctrlcfg0_cfg_ctrl_burst_len = + (ctrlcfg0 &IO48_MMR_CTRLCFG0_CTRL_BURST_LENGTH_MASK ) >> +IO48_MMR_CTRLCFG0_CTRL_BURST_LENGTH_SHIFT ; + +u32 caltim0_cfg_act_to_rdwr = caltim0 & +IO48_MMR_CALTIMING0_CFG_ACT_TO_RDWR_MASK ; + +u32 caltim0_cfg_act_to_act = + (caltim0 &IO48_MMR_CALTIMING0_CFG_ACT_TO_ACT_MASK ) >> +IO48_MMR_CALTIMING0_CFG_ACT_TO_ACT_SHIFT ; + +u32 caltim0_cfg_act_to_act_db = + (caltim0 & +IO48_MMR_CALTIMING0_CFG_ACT_TO_ACT_DIFF_BANK_MASK ) >> +IO48_MMR_CALTIMING0_CFG_ACT_TO_ACT_DIFF_BANK_SHIFT ; + +u32 caltim1_cfg_rd_to_wr = + (caltim1 &IO48_MMR_CALTIMING1_CFG_RD_TO_WR_MASK ) >> +IO48_MMR_CALTIMING1_CFG_RD_TO_WR_SHIFT ; + +u32 caltim1_cfg_rd_to_rd_dc = + (caltim1 &IO48_MMR_CALTIMING1_CFG_RD_TO_RD_DC_MASK ) >> +IO48_MMR_CALTIMING1_CFG_RD_TO_RD_DC_SHIFT ; + +u32 caltim1_cfg_rd_to_wr_dc = + (caltim1 &IO48_MMR_CALTIMING1_CFG_RD_TO_WR_DIFF_CHIP_MASK ) >> +IO48_MMR_CALTIMING1_CFG_RD_TO_WR_DIFF_CHIP_SHIFT ; + +u32 caltim2_cfg_rd_to_pch = + (caltim2 &IO48_MMR_CALTIMING2_CFG_RD_TO_PCH_MASK ) >> +IO48_MMR_CALTIMING2_CFG_RD_TO_PCH_SHIFT ; + +u32 caltim3_cfg_wr_to_rd = + (caltim3 &IO48_MMR_CALTIMING3_CFG_WR_TO_RD_MASK ) >> +IO48_MMR_CALTIMING3_CFG_WR_TO_RD_SHIFT ; + +u32 caltim3_cfg_wr_to_rd_dc = + (caltim3 &IO48_MMR_CALTIMING3_CFG_WR_TO_RD_DIFF_CHIP_MASK ) >> +IO48_MMR_CALTIMING3_CFG_WR_TO_RD_DIFF_CHIP_SHIFT ; + +u32 caltim4_cfg_pch_to_valid = + (caltim4 &IO48_MMR_CALTIMING4_CFG_PCH_TO_VALID_MASK ) >> +IO48_MMR_CALTIMING4_CFG_PCH_TO_VALID_SHIFT ; + +u32 caltim9_cfg_4_act_to_act = caltim9 & +IO48_MMR_CALTIMING9_CFG_WR_4_ACT_TO_ACT_MASK ; + + update_value = (caltim2_cfg_rd_to_pch + caltim4_cfg_pch_to_valid + + caltim0_cfg_act_to_rdwr - + (ctrlcfg0_cfg_ctrl_burst_len >>2 )); + + io48_value = ((((socfpga_io48_mmr_base->dramtiming0 & +ALT_IO48_DRAMTIME_MEM_READ_LATENCY_MASK ) +2 +15 + + (ctrlcfg0_cfg_ctrl_burst_len >>1 )) >>1 ) - +/* Up to here was in memory cycles so divide by 2 */ + caltim1_cfg_rd_to_wr + caltim0_cfg_act_to_rdwr + + caltim4_cfg_pch_to_valid); + +writel (((caltim0_cfg_act_to_act << +ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_ACTTOACT_LSB ) | + (update_value << +ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_RDTOMISS_LSB ) | + (io48_value << +ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_WRTOMISS_LSB ) | + ((ctrlcfg0_cfg_ctrl_burst_len >>2 ) << +ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_BURSTLEN_LSB ) | + (caltim1_cfg_rd_to_wr << +ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_RDTOWR_LSB ) | + (caltim3_cfg_wr_to_rd << +ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_WRTORD_LSB ) | + (((ddrioctl ==1 ) ?1 :0 ) << +ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_BWRATIO_LSB )), + &socfpga_noc_ddr_scheduler_base-> + ddr_t_main_scheduler_ddrtiming); + +/* Configure DDR mode [0xFFD12410] [precharge = 0] */ +writel (((ddrioctl ?0 :1 ) << +ALT_NOC_MPU_DDR_T_SCHED_DDRMOD_BWRATIOEXTENDED_LSB ), + &socfpga_noc_ddr_scheduler_base->ddr_t_main_scheduler_ddrmode); + +/* Configure the read latency [0xFFD12414] */ +writel (((socfpga_io48_mmr_base->dramtiming0 & +ALT_IO48_DRAMTIME_MEM_READ_LATENCY_MASK ) >>1 ) + +DDR_READ_LATENCY_DELAY , + &socfpga_noc_ddr_scheduler_base-> + ddr_t_main_scheduler_readlatency); + +/* +* Configuring timing values concerning activate commands +* [0xFFD12438] [FAWBANK alway 1 because always 4 bank DDR] +*/ +writel (((caltim0_cfg_act_to_act_db << +ALT_NOC_MPU_DDR_T_SCHED_ACTIVATE_RRD_LSB ) | + (caltim9_cfg_4_act_to_act << +ALT_NOC_MPU_DDR_T_SCHED_ACTIVATE_FAW_LSB ) | + (ARRIA10_SDR_ACTIVATE_FAWBANK << +ALT_NOC_MPU_DDR_T_SCHED_ACTIVATE_FAWBANK_LSB )), + &socfpga_noc_ddr_scheduler_base->ddr_t_main_scheduler_activate); + +/* +* Configuring timing values concerning device to device data bus +* ownership change [0xFFD1243C] +*/ +writel (((caltim1_cfg_rd_to_rd_dc << +ALT_NOC_MPU_DDR_T_SCHED_DEVTODEV_BUSRDTORD_LSB ) | + (caltim1_cfg_rd_to_wr_dc << +ALT_NOC_MPU_DDR_T_SCHED_DEVTODEV_BUSRDTOWR_LSB ) | + (caltim3_cfg_wr_to_rd_dc << +ALT_NOC_MPU_DDR_T_SCHED_DEVTODEV_BUSWRTORD_LSB )), + &socfpga_noc_ddr_scheduler_base->ddr_t_main_scheduler_devtodev); + +/* Enable or disable the SDRAM ECC */ +if (ctrlcfg1 &IO48_MMR_CTRLCFG1_CTRL_ENABLE_ECC ) { +setbits_le32 (&socfpga_ecc_hmc_base->eccctrl, + (ALT_ECC_HMC_OCP_ECCCTL_AWB_CNT_RST_SET_MSK | +ALT_ECC_HMC_OCP_ECCCTL_CNT_RST_SET_MSK | +ALT_ECC_HMC_OCP_ECCCTL_ECC_EN_SET_MSK )); +clrbits_le32 (&socfpga_ecc_hmc_base->eccctrl, + (ALT_ECC_HMC_OCP_ECCCTL_AWB_CNT_RST_SET_MSK | +ALT_ECC_HMC_OCP_ECCCTL_CNT_RST_SET_MSK )); +setbits_le32 (&socfpga_ecc_hmc_base->eccctrl2, + (ALT_ECC_HMC_OCP_ECCCTL2_RMW_EN_SET_MSK | +ALT_ECC_HMC_OCP_ECCCTL2_AWB_EN_SET_MSK )); + }else { +clrbits_le32 (&socfpga_ecc_hmc_base->eccctrl, + (ALT_ECC_HMC_OCP_ECCCTL_AWB_CNT_RST_SET_MSK | +ALT_ECC_HMC_OCP_ECCCTL_CNT_RST_SET_MSK | +ALT_ECC_HMC_OCP_ECCCTL_ECC_EN_SET_MSK )); +clrbits_le32 (&socfpga_ecc_hmc_base->eccctrl2, + (ALT_ECC_HMC_OCP_ECCCTL2_RMW_EN_SET_MSK | +ALT_ECC_HMC_OCP_ECCCTL2_AWB_EN_SET_MSK )); + } +} + +struct firewall_entry { +const char *prop_name; +const u32 cfg_addr; +const u32 en_addr; +const u32 en_bit; +}; +#define FW_MPU_FPGA_ADDRESS \ + ((const struct socfpga_noc_fw_ddr_mpu_fpga2sdram *)\ + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS) + +#define SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (ADDR ) \ + (SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS + \ + offsetof(struct socfpga_noc_fw_ddr_mpu_fpga2sdram, ADDR)) + +#define SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (ADDR ) \ + (SOCFPGA_SDR_FIREWALL_L3_ADDRESS + \ + offsetof(struct socfpga_noc_fw_ddr_l3, ADDR)) + +const struct firewall_entry firewall_table[] = { + { +"altr,mpu0" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (mpuregion0addr), +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_MPUREG0EN_SET_MSK + }, + { +"altr,mpu1" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS + +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (mpuregion1addr), +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_MPUREG1EN_SET_MSK + }, + { +"altr,mpu2" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (mpuregion2addr), +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_MPUREG2EN_SET_MSK + }, + { +"altr,mpu3" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (mpuregion3addr), +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_MPUREG3EN_SET_MSK + }, + { +"altr,l3-0" , +SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (hpsregion0addr), +SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_HPSREG0EN_SET_MSK + }, + { +"altr,l3-1" , +SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (hpsregion1addr), +SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_HPSREG1EN_SET_MSK + }, + { +"altr,l3-2" , +SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (hpsregion2addr), +SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_HPSREG2EN_SET_MSK + }, + { +"altr,l3-3" , +SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (hpsregion3addr), +SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_HPSREG3EN_SET_MSK + }, + { +"altr,l3-4" , +SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (hpsregion4addr), +SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_HPSREG4EN_SET_MSK + }, + { +"altr,l3-5" , +SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (hpsregion5addr), +SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_HPSREG5EN_SET_MSK + }, + { +"altr,l3-6" , +SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (hpsregion6addr), +SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_HPSREG6EN_SET_MSK + }, + { +"altr,l3-7" , +SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (hpsregion7addr), +SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_HPSREG7EN_SET_MSK + }, + { +"altr,fpga2sdram0-0" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram0region0addr), +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_F2SDR0REG0EN_SET_MSK + }, + { +"altr,fpga2sdram0-1" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram0region1addr), +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_F2SDR0REG1EN_SET_MSK + }, + { +"altr,fpga2sdram0-2" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram0region2addr), +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_F2SDR0REG2EN_SET_MSK + }, + { +"altr,fpga2sdram0-3" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram0region3addr), +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_F2SDR0REG3EN_SET_MSK + }, + { +"altr,fpga2sdram1-0" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram1region0addr), +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_F2SDR1REG0EN_SET_MSK + }, + { +"altr,fpga2sdram1-1" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram1region1addr), +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_F2SDR1REG1EN_SET_MSK + }, + { +"altr,fpga2sdram1-2" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram1region2addr), +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_F2SDR1REG2EN_SET_MSK + }, + { +"altr,fpga2sdram1-3" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram1region3addr), +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_F2SDR1REG3EN_SET_MSK + }, + { +"altr,fpga2sdram2-0" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram2region0addr), +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_F2SDR2REG0EN_SET_MSK + }, + { +"altr,fpga2sdram2-1" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram2region1addr), +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_F2SDR2REG1EN_SET_MSK + }, + { +"altr,fpga2sdram2-2" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram2region2addr), +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_F2SDR2REG2EN_SET_MSK + }, + { +"altr,fpga2sdram2-3" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram2region3addr), +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_F2SDR2REG3EN_SET_MSK + }, + +}; + +static int of_sdram_firewall_setup (const void *blob) +{ +int child, i, node; +u32 start_end[2 ]; + + node =fdtdec_next_compatible (blob,0 ,COMPAT_ALTERA_SOCFPGA_NOC ); +if (node <0 ) +return -ENXIO ; + + child =fdt_first_subnode (blob, node); +if (child <0 ) +return -ENXIO ; + +/* set to default state */ +writel (0 , &socfpga_noc_fw_ddr_mpu_fpga2sdram_base->enable); +writel (0 , &socfpga_noc_fw_ddr_l3_base->enable); + + +for (i =0 ; i <ARRAY_SIZE (firewall_table); i++) { +if (!fdtdec_get_int_array (blob, child, + firewall_table[i].prop_name, + start_end,2 )) { +writel ((start_end[0 ] &ALT_NOC_FW_DDR_ADDR_MASK ) | + (start_end[1 ] <<ALT_NOC_FW_DDR_END_ADDR_LSB ), + firewall_table[i].cfg_addr); +setbits_le32 (firewall_table[i].en_addr, + firewall_table[i].en_bit); + } + } + +return 0 ; +} + +int ddr_calibration_sequence (void ) +{ +WATCHDOG_RESET (); + +/* Check to see if SDRAM cal was success */ +if (sdram_startup ()) { +puts ("DDRCAL: Failed\n" ); +return -EPERM ; + } + +puts ("DDRCAL: Success\n" ); +
drivers/ddr/altera/sdram_arria10.c line 696
Quoted 10 lines
drivers/ddr/altera/sdram_arria10.c new file +10
-0+WATCHDOG_RESET (); + +/* initialize the MMR register */ +sdram_mmr_init (); + +/* assigning the SDRAM size */ +unsigned long long size =sdram_size_calc (); + +/* If a weird value, use default Config size */ +/* Up to 2GB is supported, 2GB would be used if more than that */
Fix comment style.
drivers/ddr/altera/sdram_arria10.c line 697
Quoted 1 line
drivers/ddr/altera/sdram_arria10.c new file +1
-0+if (size <=0 )
Can size ever be less than zero?
Dinh
Chee
PATCH v3 11/20 arm: socfpga: Add DDR driver for Arria 10
Quoted 8 lines · Dinh Nguyen
Quoted 4 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add DDR driver suppport for Arria 10.
s/suppport/support
Okay.
Quoted 82 lines
Quoted 82 lines
Signed-off-by Tien Fong Chee <[email protected]>---
arch/arm/mach-socfpga/include/mach/sdram.h | 2 +arch/arm/mach-socfpga/include/mach/sdram_arria10.h| 2 + drivers/ddr/altera/Makefile | 1 + drivers/ddr/altera/sdram_arria10.c | 736
+++++++++++++++++++++4 files changed, 741 insertions(+)create mode 100644
drivers/ddr/altera/sdram_arria10.carch/arm/mach-socfpga/include/mach/sdram.h +0
-0@@ -10,6 +10,8 @@
#ifdefined(CONFIG_TARGET_SOCFPGA_GEN5)
#include <asm/arch/sdram_gen5.h>arch/arm/mach-socfpga/include/mach/sdram.h +2
-0+#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) +#include <asm/arch/sdram_arria10.h> #endif
#endifarch/arm/mach-socfpga/include/mach/sdram_arria10.h +0
-0@@ -8,6 +8,7 @@ #define _SOCFPGA_SDRAM_ARRIA10_H_
#ifndef__ASSEMBLY__
+intddr_calibration_sequence(void);
structsocfpga_ecc_hmc{
u32ip_rev_id;arch/arm/mach-socfpga/include/mach/sdram_arria10.h +1
-0@@ -204,6 +205,7 @@ struct socfpga_io48_mmr { u32 niosreserve1; u32 niosreserve2; }; + #endif /*__ASSEMBLY__*/
#defineIO48_MMR_CTRLCFG0_DB2_BURST_LENGTH_MASK0x1
F000000drivers/ddr/altera/Makefile +0
-0@@ -10,4 +10,5 @@
ifdefCONFIG_ALTERA_SDRAMobj-$(CONFIG_TARGET_SOCFPGA_GEN5) += sdram_gen5.o sequencer.o +obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += sdram_arria10.o endifdrivers/ddr/altera/sdram_arria10.c new file +16
-0@@ -0,0 +1,736 @@ +/* +* Copyright (C) 2017 Intel Corporation <www.intel.com> +* +* SPDX-License-Identifier: GPL-2.0 +*/ + +#include <common.h> +#include <errno.h> +#include <fdtdec.h> +#include <malloc.h> +#include <wait_bit.h> +#include <watchdog.h> +#include <asm/io.h> +#include <asm/arch/fpga_manager.h> +#include <asm/arch/misc.h> +#include <asm/arch/reset_manager.h>
Quoted 9 lines
drivers/ddr/altera/sdram_arria10.c line 23
Quoted 7 lines
drivers/ddr/altera/sdram_arria10.c new file +7
-0+#include <asm/arch/sdram.h> +#include <linux/kernel.h> + +DECLARE_GLOBAL_DATA_PTR ; + +static void sdram_mmr_init (void ); +static unsigned long long sdram_size_calc (void );Use
uint64_t
Okay.
Quoted 32 lines
Quoted 32 lines
drivers/ddr/altera/sdram_arria10.c new file +2
-0+ +/* FAWBANK - Number of Bank of a given device involved in the FAW period. */
drivers/ddr/altera/sdram_arria10.c new file +23
-0+#define ARRIA10_SDR_ACTIVATE_FAWBANK (0x1) + +#define ARRIA_DDR_CONFIG (A ,B ,C ,R ) \ + (((A) << 24) | ((B) << 16) | ((C) << 8) | (R)) +#define DDR_CONFIG_ELEMENTS ARRAY_SIZE(ddr_config) +#define DDR_REG_SEQ2CORE 0xFFD0507C +#define DDR_REG_CORE2SEQ 0xFFD05078 +#define DDR_READ_LATENCY_DELAY 40 +#define DDR_SIZE_2GB_HEX 0x80000000 +#define DDR_MAX_TRIES 0x00100000 + +#define IO48_MMR_DRAMSTS 0xFFCFA0EC +#define IO48_MMR_NIOS2_RESERVE0 0xFFCFA110 +#define IO48_MMR_NIOS2_RESERVE1 0xFFCFA114 +#define IO48_MMR_NIOS2_RESERVE2 0xFFCFA118 + +#define SEQ2CORE_MASK 0xF +#define CORE2SEQ_INT_REQ 0xF +#define SEQ2CORE_INT_RESP_BIT 3 + +static const struct socfpga_ecc_hmc *socfpga_ecc_hmc_base = + (void *)SOCFPGA_SDR_ADDRESS ; +static const struct socfpga_noc_ddr_scheduler
*socfpga_noc_ddr_scheduler_base=drivers/ddr/altera/sdram_arria10.c new file +4
-0+ (void *)SOCFPGA_SDR_SCHEDULER_ADDRESS ; +static const struct socfpga_noc_fw_ddr_mpu_fpga2sdram + *socfpga_noc_fw_ddr_mpu_fpga2sdram_base = + (void *)SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS ;
Quoted 9 lines
drivers/ddr/altera/sdram_arria10.c line 58
Quoted 7 lines
+static const struct
socfpga_noc_fw_ddr_l3*socfpga_noc_fw_ddr_l3_base=drivers/ddr/altera/sdram_arria10.c new file +5
-0+ (void *)SOCFPGA_SDR_FIREWALL_L3_ADDRESS ; +static const struct socfpga_io48_mmr *socfpga_io48_mmr_base = + (void *)SOCFPGA_HMC_MMR_IO48_ADDRESS ; + +/* The followring are the supported configurations */ s/followring/following
Okay.
Quoted 128 lines
Quoted 128 lines
drivers/ddr/altera/sdram_arria10.c new file +95
-0+static u32 ddr_config[] = { +/* Chip - Row - Bank - Column Style */ +/* All Types */ +ARRIA_DDR_CONFIG (0 ,3 ,10 ,12 ), +ARRIA_DDR_CONFIG (0 ,3 ,10 ,13 ), +ARRIA_DDR_CONFIG (0 ,3 ,10 ,14 ), +ARRIA_DDR_CONFIG (0 ,3 ,10 ,15 ), +ARRIA_DDR_CONFIG (0 ,3 ,10 ,16 ), +ARRIA_DDR_CONFIG (0 ,3 ,10 ,17 ), +/* LPDDR x16 */ +ARRIA_DDR_CONFIG (0 ,3 ,11 ,14 ), +ARRIA_DDR_CONFIG (0 ,3 ,11 ,15 ), +ARRIA_DDR_CONFIG (0 ,3 ,11 ,16 ), +ARRIA_DDR_CONFIG (0 ,3 ,12 ,15 ), +/* DDR4 Only */ +ARRIA_DDR_CONFIG (0 ,4 ,10 ,14 ), +ARRIA_DDR_CONFIG (0 ,4 ,10 ,15 ), +ARRIA_DDR_CONFIG (0 ,4 ,10 ,16 ), +ARRIA_DDR_CONFIG (0 ,4 ,10 ,17 ),/* 14 */ +/* Chip - Bank - Row - Column Style */ +ARRIA_DDR_CONFIG (1 ,3 ,10 ,12 ), +ARRIA_DDR_CONFIG (1 ,3 ,10 ,13 ), +ARRIA_DDR_CONFIG (1 ,3 ,10 ,14 ), +ARRIA_DDR_CONFIG (1 ,3 ,10 ,15 ), +ARRIA_DDR_CONFIG (1 ,3 ,10 ,16 ), +ARRIA_DDR_CONFIG (1 ,3 ,10 ,17 ), +ARRIA_DDR_CONFIG (1 ,3 ,11 ,14 ), +ARRIA_DDR_CONFIG (1 ,3 ,11 ,15 ), +ARRIA_DDR_CONFIG (1 ,3 ,11 ,16 ), +ARRIA_DDR_CONFIG (1 ,3 ,12 ,15 ), +/* DDR4 Only */ +ARRIA_DDR_CONFIG (1 ,4 ,10 ,14 ), +ARRIA_DDR_CONFIG (1 ,4 ,10 ,15 ), +ARRIA_DDR_CONFIG (1 ,4 ,10 ,16 ), +ARRIA_DDR_CONFIG (1 ,4 ,10 ,17 ), +}; + +static int match_ddr_conf (u32 ddr_conf) +{ +int i; +/ +for (i =0 ; i <DDR_CONFIG_ELEMENTS ; i++) { +if (ddr_conf == ddr_config[i]) +return i; + } +return 0 ; +} + +/* Check whether SDRAM is successfully Calibrated */ +static int is_sdram_cal_success (void ) +{ +return readl (&socfpga_ecc_hmc_base->ddrcalstat); +} + +static unsigned char ddr_get_bit (u32 ereg,unsigned char bit) +{ +u32 reg =readl (ereg); + +return (reg &BIT (bit)) ?1 :0 ; +} + +static unsigned char ddr_wait_bit (u32 ereg,u32 bit, + u32 expected, u32 timeout_usec) +{ +u32 tmr; + +for (tmr =0 ; tmr < timeout_usec; tmr +=100 ) { +udelay (100 ); +WATCHDOG_RESET (); +if (ddr_get_bit (ereg, bit) == expected) +return 0 ; + } + +return 1 ; +} + +static void ddr_delay (u32 delay) +{ +int tmr; + +for (tmr =0 ; tmr < delay; tmr++) { +mdelay (1 ); +WATCHDOG_RESET (); + } +} + +static int emif_clear(void) +{ + u32 i = DDR_MAX_TRIES; + u8 ret = 0; + + writel(0, DDR_REG_CORE2SEQ); + + do { + ret = !wait_for_bit(__func__, (u32*)DDR_REG_SEQ2CORE,
drivers/ddr/altera/sdram_arria10.c new file +14
-0+ SEQ2CORE_MASK, 1, 50, 0); + }while (ret && (--i >0 )); + +return !i; +} + +static int emif_reset (void ) +{ +u32 c2s, s2c; + + c2s =readl (DDR_REG_CORE2SEQ ); + s2c =readl (DDR_REG_SEQ2CORE ); + + debug("c2s=%08x s2c=%08x nr0=%08x nr1=%08x nr2=%08xdst=%08x\n",
drivers/ddr/altera/sdram_arria10.c new file +13
-0+ c2s, s2c, readl(IO48_MMR_NIOS2_RESERVE0), + readl(IO48_MMR_NIOS2_RESERVE1), + readl(IO48_MMR_NIOS2_RESERVE2), + readl(IO48_MMR_DRAMSTS)); + +if ((s2c &SEQ2CORE_MASK ) &&emif_clear ()) { +printf ("failed emif_clear()\n" ); +return -EPERM ; + } + +writel (CORE2SEQ_INT_REQ ,DDR_REG_CORE2SEQ ); + + if (ddr_wait_bit(DDR_REG_SEQ2CORE, SEQ2CORE_INT_RESP_BIT,0, 1000000)) {
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ printf("emif_reset failed to see interruptacknowledge\n");
Quoted 9 lines
drivers/ddr/altera/sdram_arria10.c line 188
Quoted 7 lines
drivers/ddr/altera/sdram_arria10.c new file +7
-0+return -EPERM ; + }else { +printf ("emif_reset interrupt acknowledged\n" ); + } + +if (emif_clear ()) { +printf ("emif_clear() failed\n" );Use
debug()instead of all the printf()'s.
Okay.
Quoted 14 lines
drivers/ddr/altera/sdram_arria10.c line 198
Quoted 11 lines
drivers/ddr/altera/sdram_arria10.c new file +10
-0+return -EPERM ; + } +debug ("emif_reset interrupt cleared\n" ); + +debug ("nr0=%08x nr1=%08x nr2=%08x\n" , + readl(IO48_MMR_NIOS2_RESERVE0), + readl(IO48_MMR_NIOS2_RESERVE1), + readl(IO48_MMR_NIOS2_RESERVE2)); + +return 0 ;
emif_reset()has all these return values, but the actual call toemif_reset()is not checking the values at all.
Okay, i will add checking to emif_reset().
Quoted 11 lines
Quoted 11 lines
drivers/ddr/altera/sdram_arria10.c new file +10
-0+} + +static int ddr_setup (void ) +{ +int i, j, ddr_setup_complete =0 ; + +/* Try 3 times to do a calibration */ +for (i =0 ; (i <3 ) && !ddr_setup_complete; i++) { +WATCHDOG_RESET (); +
Quoted 9 lines
drivers/ddr/altera/sdram_arria10.c line 211
Quoted 4 lines
drivers/ddr/altera/sdram_arria10.c new file +2
-0+/* A delay to wait for calibration bit to set */ +for (j =0 ; (j <10 ) && !ddr_setup_complete; j++){
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ddr_delay (500 );Looks like all
ddr_delay()is doing is call to 1ms delay, and the max delay is 5s. Looks like you can rid of theddr_delay()function and do
the wait here.
Okay.
Quoted 16 lines
drivers/ddr/altera/sdram_arria10.c line 222
Quoted 13 lines
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ ddr_setup_complete =
is_sdram_cal_success();drivers/ddr/altera/sdram_arria10.c new file +10
-0+ } + +if (!ddr_setup_complete) +emif_reset (); + } + +if (!ddr_setup_complete) { +puts ("Error: Could Not Calibrate SDRAM\n" ); +return -EPERM ; + }Move this block of code up to where you did the check for !ddr_setup_complete the first time.
This block of codes is located here has its purpose, which return calibration failed after 3 times trying calibration and emif reset(also depend on the status checking with !ddr_setup_complete).
Quoted 18 lines
Quoted 6 lines
drivers/ddr/altera/sdram_arria10.c new file +5
-0+ +return 0 ; +} + +/* Function to startup the SDRAM*/ drivers/ddr/altera/sdram_arria10.c line 237
Quoted 10 lines
drivers/ddr/altera/sdram_arria10.c new file +10
-0+static int sdram_startup (void ) +{ +/* Release NOC ddr scheduler from reset */ +socfpga_reset_deassert_noc_ddr_scheduler (); + +/* Bringup the DDR (calibration and configuration) */ +return ddr_setup (); +} + +static unsigned long long sdram_size_calc (void )Use
uint64_t
Okay.
Quoted 7 lines
drivers/ddr/altera/sdram_arria10.c line 241
Quoted 5 lines
drivers/ddr/altera/sdram_arria10.c new file +4
-0+{ +u32 dramaddrw =readl (&socfpga_io48_mmr_base->dramaddrw); + + unsigned long long size = BIT(((dramaddrw &
uint64_t
Okay.
Quoted 6 lines
Quoted 6 lines
drivers/ddr/altera/sdram_arria10.c new file +4
-0+ IO48_MMR_DRAMADDRW_CFG_CS_ADDR_WIDTH_MASK) >> + IO48_MMR_DRAMADDRW_CFG_CS_ADDR_WIDTH_SHIFT) + + ((dramaddrw & + IO48_MMR_DRAMADDRW_CFG_BANK_GROUP_ADDR_WIDTH_MASK)Quoted 1 line
Quoted 1 line
Quoted 15 lines
drivers/ddr/altera/sdram_arria10.c line 256
Quoted 13 lines
drivers/ddr/altera/sdram_arria10.c new file +1
-0+IO48_MMR_DRAMADDRW_CFG_BANK_GROUP_ADDR_WIDTH_SHIFT ) +
drivers/ddr/altera/sdram_arria10.c new file +7
-0+ ((dramaddrw & +IO48_MMR_DRAMADDRW_CFG_BANK_ADDR_WIDTH_MASK ) >> +IO48_MMR_DRAMADDRW_CFG_BANK_ADDR_WIDTH_SHIFT ) + + ((dramaddrw & +IO48_MMR_DRAMADDRW_CFG_ROW_ADDR_WIDTH_MASK ) >> + IO48_MMR_DRAMADDRW_CFG_ROW_ADDR_WIDTH_SHIFT) + + (dramaddrw &
IO48_MMR_DRAMADDRW_CFG_COL_ADDR_WIDTH_MASK));drivers/ddr/altera/sdram_arria10.c new file +3
-0+ + size *= (2 << (readl (&socfpga_ecc_hmc_base->ddrioctrl) & + ALT_ECC_HMC_OCP_DDRIOCTRL_IO_SIZE_MSK));Should add a debug statement here for the size.
Okay.
Quoted 530 lines
Quoted 530 lines
drivers/ddr/altera/sdram_arria10.c new file +25
-0+ +return size; +} + +/* Function to initialize SDRAM MMR and NOC DDR scheduler*/ +static void sdram_mmr_init (void ) +{ +u32 update_value, io48_value; +u32 ctrlcfg0 =readl (&socfpga_io48_mmr_base->ctrlcfg0); +u32 ctrlcfg1 =readl (&socfpga_io48_mmr_base->ctrlcfg1); +u32 dramaddrw =readl (&socfpga_io48_mmr_base->dramaddrw); +u32 caltim0 =readl (&socfpga_io48_mmr_base->caltiming0); +u32 caltim1 =readl (&socfpga_io48_mmr_base->caltiming1); +u32 caltim2 =readl (&socfpga_io48_mmr_base->caltiming2); +u32 caltim3 =readl (&socfpga_io48_mmr_base->caltiming3); +u32 caltim4 =readl (&socfpga_io48_mmr_base->caltiming4); +u32 caltim9 =readl (&socfpga_io48_mmr_base->caltiming9); +u32 ddrioctl; + +/* +* Configure the DDR IO size [0xFFCFB008] +* niosreserve0: Used to indicate DDR width & +* bit[7:0] = Number of data bits (0x20 for 32bit) +* bit[8] = 1 if user-mode OCT is present +* bit[9] = 1 if warm reset compiled into EMIF Cal Code
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ * bit[10] = 1 if warm reset is on duringgeneration in EMIF Cal
drivers/ddr/altera/sdram_arria10.c new file +2
-0+ * niosreserve1: IP ADCDS version encoded as 16 bit value + * bit[2:0] = Variant (0=not special,1=FAE beta,2=Customer beta,
drivers/ddr/altera/sdram_arria10.c new file +7
-0+* 3=EAP, 4-6 are reserved) +* bit[5:3] = Service Pack # (e.g. 1) +* bit[9:6] = Minor Release # +* bit[14:10] = Major Release # +*/ +if ((socfpga_io48_mmr_base->niosreserve1 >>6 ) &0x1FF ) { + update_value = readl(&socfpga_io48_mmr_base-Quoted 1 line
niosreserve0);
drivers/ddr/altera/sdram_arria10.c new file +13
-0+writel (((update_value &0xFF ) >>5 ), + &socfpga_ecc_hmc_base->ddrioctrl); + } + + ddrioctl =readl (&socfpga_ecc_hmc_base->ddrioctrl); + +/* Set the DDR Configuration [0xFFD12400] */ + io48_value = ARRIA_DDR_CONFIG( + ((ctrlcfg1 & + IO48_MMR_CTRLCFG1_ADDR_ORDER_MASK) >> + IO48_MMR_CTRLCFG1_ADDR_ORDER_SHIFT), + ((dramaddrw & + IO48_MMR_DRAMADDRW_CFG_BANK_ADDR_WIDTH_MASK) >>
drivers/ddr/altera/sdram_arria10.c new file +1
-0+IO48_MMR_DRAMADDRW_CFG_BANK_ADDR_WIDTH_SHI FT) +
drivers/ddr/altera/sdram_arria10.c new file +2
-0+ ((dramaddrw & + IO48_MMR_DRAMADDRW_CFG_BANK_GROUP_ADDR_WID
TH_MASK) >>drivers/ddr/altera/sdram_arria10.c new file +1
-0+IO48_MMR_DRAMADDRW_CFG_BANK_GROUP_ADDR_WID
TH_SHIFT),drivers/ddr/altera/sdram_arria10.c new file +2
-0+ (dramaddrw & + IO48_MMR_DRAMADDRW_CFG_COL_ADDR_WIDTH_MASK),
drivers/ddr/altera/sdram_arria10.c new file +2
-0+ ((dramaddrw & + IO48_MMR_DRAMADDRW_CFG_ROW_ADDR_WIDTH_MASK) >>
drivers/ddr/altera/sdram_arria10.c new file +1
-0+IO48_MMR_DRAMADDRW_CFG_ROW_ADDR_WIDTH_SHIF T));
drivers/ddr/altera/sdram_arria10.c new file +5
-0+ + update_value =match_ddr_conf (io48_value); +if (update_value) + writel(update_value, + &socfpga_noc_ddr_scheduler_base-Quoted 1 line
ddr_t_main_scheduler_ddrconf);drivers/ddr/altera/sdram_arria10.c new file +7
-0+ +/* +* Configure DDR timing [0xFFD1240C] +* RDTOMISS = tRTP + tRP + tRCD - BL/2 +* WRTOMISS = WL + tWR + tRP + tRCD and +* WL = RL + BL/2 + 2 - rd-to-wr ; tWR = 15ns so... +* First part of equation is in memory clock units so divide by 2
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ * for HMC clock units. 1066MHz is close to 1ns so use 15directly.
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ * WRTOMISS = ((RL + BL/2 + 2 + tWR) >> 1)- rd-to-wr +tRP + tRCD
drivers/ddr/altera/sdram_arria10.c new file +3
-0+*/ + u32 ctrlcfg0_cfg_ctrl_burst_len = + (ctrlcfg0 &
IO48_MMR_CTRLCFG0_CTRL_BURST_LENGTH_MASK) >>drivers/ddr/altera/sdram_arria10.c new file +7
-0+IO48_MMR_CTRLCFG0_CTRL_BURST_LENGTH_SHIFT ; + +u32 caltim0_cfg_act_to_rdwr = caltim0 & +IO48_MMR_CALTIMING0_CFG_ACT_TO_RDWR_MASK ; + + u32 caltim0_cfg_act_to_act = + (caltim0 &
IO48_MMR_CALTIMING0_CFG_ACT_TO_ACT_MASK) >>drivers/ddr/altera/sdram_arria10.c new file +5
-0+IO48_MMR_CALTIMING0_CFG_ACT_TO_ACT_SHIFT ; + +u32 caltim0_cfg_act_to_act_db = + (caltim0 & +IO48_MMR_CALTIMING0_CFG_ACT_TO_ACT_DIFF_BANK_MASK )Quoted 1 line
Quoted 1 line
drivers/ddr/altera/sdram_arria10.c new file +1
-0+IO48_MMR_CALTIMING0_CFG_ACT_TO_ACT_DIFF_BANK_SHIFT ;
drivers/ddr/altera/sdram_arria10.c new file +3
-0+ +u32 caltim1_cfg_rd_to_wr = + (caltim1 &IO48_MMR_CALTIMING1_CFG_RD_TO_WR_MASK )Quoted 1 line
Quoted 1 line
drivers/ddr/altera/sdram_arria10.c new file +4
-0+IO48_MMR_CALTIMING1_CFG_RD_TO_WR_SHIFT ; + + u32 caltim1_cfg_rd_to_rd_dc = + (caltim1 &
IO48_MMR_CALTIMING1_CFG_RD_TO_RD_DC_MASK) >>drivers/ddr/altera/sdram_arria10.c new file +4
-0+IO48_MMR_CALTIMING1_CFG_RD_TO_RD_DC_SHIFT ; + + u32 caltim1_cfg_rd_to_wr_dc = + (caltim1 &
IO48_MMR_CALTIMING1_CFG_RD_TO_WR_DIFF_CHIP_MASK) >>drivers/ddr/altera/sdram_arria10.c new file +4
-0+IO48_MMR_CALTIMING1_CFG_RD_TO_WR_DIFF_CHIP_SHIFT ; + +u32 caltim2_cfg_rd_to_pch = + (caltim2 &IO48_MMR_CALTIMING2_CFG_RD_TO_PCH_MASK )Quoted 1 line
Quoted 1 line
drivers/ddr/altera/sdram_arria10.c new file +4
-0+IO48_MMR_CALTIMING2_CFG_RD_TO_PCH_SHIFT ; + +u32 caltim3_cfg_wr_to_rd = + (caltim3 &IO48_MMR_CALTIMING3_CFG_WR_TO_RD_MASK )Quoted 1 line
Quoted 1 line
drivers/ddr/altera/sdram_arria10.c new file +4
-0+IO48_MMR_CALTIMING3_CFG_WR_TO_RD_SHIFT ; + + u32 caltim3_cfg_wr_to_rd_dc = + (caltim3 &
IO48_MMR_CALTIMING3_CFG_WR_TO_RD_DIFF_CHIP_MASK) >>drivers/ddr/altera/sdram_arria10.c new file +4
-0+IO48_MMR_CALTIMING3_CFG_WR_TO_RD_DIFF_CHIP_SHIFT ; + + u32 caltim4_cfg_pch_to_valid = + (caltim4 &
IO48_MMR_CALTIMING4_CFG_PCH_TO_VALID_MASK) >>drivers/ddr/altera/sdram_arria10.c new file +15
-0+IO48_MMR_CALTIMING4_CFG_PCH_TO_VALID_SHIFT ; + +u32 caltim9_cfg_4_act_to_act = caltim9 & +IO48_MMR_CALTIMING9_CFG_WR_4_ACT_TO_ACT_MASK ; + + update_value = (caltim2_cfg_rd_to_pch + caltim4_cfg_pch_to_valid + + caltim0_cfg_act_to_rdwr - + (ctrlcfg0_cfg_ctrl_burst_len >>2 )); + + io48_value = ((((socfpga_io48_mmr_base->dramtiming0 & + ALT_IO48_DRAMTIME_MEM_READ_LATENCY_MASK) + 2 +15 + + (ctrlcfg0_cfg_ctrl_burst_len >> 1)) >> 1) - + /* Up to here was in memory cycles so divideby 2 */
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ caltim1_cfg_rd_to_wr +
caltim0_cfg_act_to_rdwr+drivers/ddr/altera/sdram_arria10.c new file +4
-0+ caltim4_cfg_pch_to_valid); + + writel(((caltim0_cfg_act_to_act << + ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_ACTTOACT
_LSB) |drivers/ddr/altera/sdram_arria10.c new file +2
-0+ (update_value << + ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_RDTOMISS
_LSB) |drivers/ddr/altera/sdram_arria10.c new file +2
-0+ (io48_value << + ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_WRTOMISS
_LSB) |drivers/ddr/altera/sdram_arria10.c new file +2
-0+ ((ctrlcfg0_cfg_ctrl_burst_len >>2 ) << + ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_BURSTLEN
_LSB) |drivers/ddr/altera/sdram_arria10.c new file +2
-0+ (caltim1_cfg_rd_to_wr << + ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_RDTOWR_LSB) |
drivers/ddr/altera/sdram_arria10.c new file +2
-0+ (caltim3_cfg_wr_to_rd << + ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_WRTORD_LSB) |
drivers/ddr/altera/sdram_arria10.c new file +2
-0+ (((ddrioctl ==1 ) ?1 :0 ) << + ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_BWRATIO_LSB)),
drivers/ddr/altera/sdram_arria10.c new file +6
-0+ &socfpga_noc_ddr_scheduler_base-> + ddr_t_main_scheduler_ddrtiming); + +/* Configure DDR mode [0xFFD12410] [precharge = 0] */ + writel(((ddrioctl ? 0 : 1) << + ALT_NOC_MPU_DDR_T_SCHED_DDRMOD_BWRATIOEXTENDED_LSB),
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ &socfpga_noc_ddr_scheduler_base-Quoted 1 line
ddr_t_main_scheduler_ddrmode);drivers/ddr/altera/sdram_arria10.c new file +11
-0+ +/* Configure the read latency [0xFFD12414] */ +writel (((socfpga_io48_mmr_base->dramtiming0 & +ALT_IO48_DRAMTIME_MEM_READ_LATENCY_MASK ) >>1 ) + +DDR_READ_LATENCY_DELAY , + &socfpga_noc_ddr_scheduler_base-> + ddr_t_main_scheduler_readlatency); + +/* +* Configuring timing values concerning activate commands +* [0xFFD12438] [FAWBANK alway 1 because always 4 bank DDR]
drivers/ddr/altera/sdram_arria10.c new file +3
-0+*/ + writel(((caltim0_cfg_act_to_act_db << + ALT_NOC_MPU_DDR_T_SCHED_ACTIVATE_RRD_LSB)|
drivers/ddr/altera/sdram_arria10.c new file +2
-0+ (caltim9_cfg_4_act_to_act << +ALT_NOC_MPU_DDR_T_SCHED_ACTIVATE_FAW_LSB )|
drivers/ddr/altera/sdram_arria10.c new file +2
-0+ (ARRIA10_SDR_ACTIVATE_FAWBANK << + ALT_NOC_MPU_DDR_T_SCHED_ACTIVATE_FAWBANK_LSB)),
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ &socfpga_noc_ddr_scheduler_base-Quoted 1 line
ddr_t_main_scheduler_activate);drivers/ddr/altera/sdram_arria10.c new file +3
-0+ +/* +* Configuring timing values concerning device to device data bus
drivers/ddr/altera/sdram_arria10.c new file +4
-0+* ownership change [0xFFD1243C] +*/ + writel(((caltim1_cfg_rd_to_rd_dc << + ALT_NOC_MPU_DDR_T_SCHED_DEVTODEV_BUSRDTORD
_LSB) |drivers/ddr/altera/sdram_arria10.c new file +2
-0+ (caltim1_cfg_rd_to_wr_dc << + ALT_NOC_MPU_DDR_T_SCHED_DEVTODEV_BUSRDTOWR
_LSB) |drivers/ddr/altera/sdram_arria10.c new file +2
-0+ (caltim3_cfg_wr_to_rd_dc << + ALT_NOC_MPU_DDR_T_SCHED_DEVTODEV_BUSWRTORD
_LSB)),drivers/ddr/altera/sdram_arria10.c new file +1
-0+ &socfpga_noc_ddr_scheduler_base-Quoted 1 line
ddr_t_main_scheduler_devtodev);drivers/ddr/altera/sdram_arria10.c new file +5
-0+ +/* Enable or disable the SDRAM ECC */ +if (ctrlcfg1 &IO48_MMR_CTRLCFG1_CTRL_ENABLE_ECC ) { +setbits_le32 (&socfpga_ecc_hmc_base->eccctrl, + (ALT_ECC_HMC_OCP_ECCCTL_AWB_CNT_RST_S
ET_MSK|drivers/ddr/altera/sdram_arria10.c new file +1
-0+ ALT_ECC_HMC_OCP_ECCCTL_CNT_RST_SET_MSK |
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ ALT_ECC_HMC_OCP_ECCCTL_ECC_EN_SET_MSK));
drivers/ddr/altera/sdram_arria10.c new file +2
-0+clrbits_le32 (&socfpga_ecc_hmc_base->eccctrl, + (ALT_ECC_HMC_OCP_ECCCTL_AWB_CNT_RST_S
ET_MSK|drivers/ddr/altera/sdram_arria10.c new file +1
-0+ ALT_ECC_HMC_OCP_ECCCTL_CNT_RST_SET_MSK));
drivers/ddr/altera/sdram_arria10.c new file +2
-0+setbits_le32 (&socfpga_ecc_hmc_base->eccctrl2, + (ALT_ECC_HMC_OCP_ECCCTL2_RMW_EN_SET_MSK |
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ ALT_ECC_HMC_OCP_ECCCTL2_AWB_EN_SET_MSK));
drivers/ddr/altera/sdram_arria10.c new file +3
-0+ }else { +clrbits_le32 (&socfpga_ecc_hmc_base->eccctrl, + (ALT_ECC_HMC_OCP_ECCCTL_AWB_CNT_RST_S
ET_MSK|drivers/ddr/altera/sdram_arria10.c new file +1
-0+ ALT_ECC_HMC_OCP_ECCCTL_CNT_RST_SET_MSK |
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ ALT_ECC_HMC_OCP_ECCCTL_ECC_EN_SET_MSK));
drivers/ddr/altera/sdram_arria10.c new file +2
-0+clrbits_le32 (&socfpga_ecc_hmc_base->eccctrl2, + (ALT_ECC_HMC_OCP_ECCCTL2_RMW_EN_SET_MSK |
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ ALT_ECC_HMC_OCP_ECCCTL2_AWB_EN_SET_MSK));
drivers/ddr/altera/sdram_arria10.c new file +16
-0+ } +} + +struct firewall_entry { +const char *prop_name; +const u32 cfg_addr; +const u32 en_addr; +const u32 en_bit; +}; +#define FW_MPU_FPGA_ADDRESS \ + ((const struct socfpga_noc_fw_ddr_mpu_fpga2sdram *)\ + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS) + +#define SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET (ADDR ) \ + (SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS + \ + offsetof(struct socfpga_noc_fw_ddr_mpu_fpga2sdram,ADDR))
drivers/ddr/altera/sdram_arria10.c new file +9
-0+ +#define SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (ADDR ) \ + (SOCFPGA_SDR_FIREWALL_L3_ADDRESS + \ + offsetof(struct socfpga_noc_fw_ddr_l3, ADDR)) + +const struct firewall_entry firewall_table[] = { + { +"altr,mpu0" , + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(mpuregion0addr),
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
drivers/ddr/altera/sdram_arria10.c new file +6
-0+ALT_NOC_FW_DDR_SCR_EN_MPUREG0EN_SET_MSK + }, + { +"altr,mpu1" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS + + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(mpuregion1addr),
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
drivers/ddr/altera/sdram_arria10.c new file +5
-0+ALT_NOC_FW_DDR_SCR_EN_MPUREG1EN_SET_MSK + }, + { +"altr,mpu2" , + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(mpuregion2addr),
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
drivers/ddr/altera/sdram_arria10.c new file +5
-0+ALT_NOC_FW_DDR_SCR_EN_MPUREG2EN_SET_MSK + }, + { +"altr,mpu3" , + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(mpuregion3addr),
drivers/ddr/altera/sdram_arria10.c new file +1
-0+ SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
drivers/ddr/altera/sdram_arria10.c new file +5
-0+ALT_NOC_FW_DDR_SCR_EN_MPUREG3EN_SET_MSK + }, + { +"altr,l3-0" , + SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET(hpsregion0addr),
drivers/ddr/altera/sdram_arria10.c new file +6
-0+SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_HPSREG0EN_SET_MSK + }, + { +"altr,l3-1" , + SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET(hpsregion1addr),
drivers/ddr/altera/sdram_arria10.c new file +6
-0+SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_HPSREG1EN_SET_MSK + }, + { +"altr,l3-2" , + SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET(hpsregion2addr),
drivers/ddr/altera/sdram_arria10.c new file +6
-0+SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_HPSREG2EN_SET_MSK + }, + { +"altr,l3-3" , + SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET(hpsregion3addr),
drivers/ddr/altera/sdram_arria10.c new file +6
-0+SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_HPSREG3EN_SET_MSK + }, + { +"altr,l3-4" , + SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET(hpsregion4addr),
drivers/ddr/altera/sdram_arria10.c new file +6
-0+SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_HPSREG4EN_SET_MSK + }, + { +"altr,l3-5" , + SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET(hpsregion5addr),
drivers/ddr/altera/sdram_arria10.c new file +6
-0+SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_HPSREG5EN_SET_MSK + }, + { +"altr,l3-6" , + SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET(hpsregion6addr),
drivers/ddr/altera/sdram_arria10.c new file +6
-0+SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_HPSREG6EN_SET_MSK + }, + { +"altr,l3-7" , + SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET(hpsregion7addr),
drivers/ddr/altera/sdram_arria10.c new file +8
-0+SOCFPGA_SDR_FIREWALL_L3_ADDRESS_OFFSET (enable), +ALT_NOC_FW_DDR_SCR_EN_HPSREG7EN_SET_MSK + }, + { +"altr,fpga2sdram0-0" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram0region0addr), + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
drivers/ddr/altera/sdram_arria10.c new file +7
-0+ALT_NOC_FW_DDR_SCR_EN_F2SDR0REG0EN_SET_MSK + }, + { +"altr,fpga2sdram0-1" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram0region1addr), + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
drivers/ddr/altera/sdram_arria10.c new file +7
-0+ALT_NOC_FW_DDR_SCR_EN_F2SDR0REG1EN_SET_MSK + }, + { +"altr,fpga2sdram0-2" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram0region2addr), + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
drivers/ddr/altera/sdram_arria10.c new file +7
-0+ALT_NOC_FW_DDR_SCR_EN_F2SDR0REG2EN_SET_MSK + }, + { +"altr,fpga2sdram0-3" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram0region3addr), + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
drivers/ddr/altera/sdram_arria10.c new file +7
-0+ALT_NOC_FW_DDR_SCR_EN_F2SDR0REG3EN_SET_MSK + }, + { +"altr,fpga2sdram1-0" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram1region0addr), + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
drivers/ddr/altera/sdram_arria10.c new file +7
-0+ALT_NOC_FW_DDR_SCR_EN_F2SDR1REG0EN_SET_MSK + }, + { +"altr,fpga2sdram1-1" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram1region1addr), + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
drivers/ddr/altera/sdram_arria10.c new file +7
-0+ALT_NOC_FW_DDR_SCR_EN_F2SDR1REG1EN_SET_MSK + }, + { +"altr,fpga2sdram1-2" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram1region2addr), + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
drivers/ddr/altera/sdram_arria10.c new file +7
-0+ALT_NOC_FW_DDR_SCR_EN_F2SDR1REG2EN_SET_MSK + }, + { +"altr,fpga2sdram1-3" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram1region3addr), + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
drivers/ddr/altera/sdram_arria10.c new file +7
-0+ALT_NOC_FW_DDR_SCR_EN_F2SDR1REG3EN_SET_MSK + }, + { +"altr,fpga2sdram2-0" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram2region0addr), + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
drivers/ddr/altera/sdram_arria10.c new file +7
-0+ALT_NOC_FW_DDR_SCR_EN_F2SDR2REG0EN_SET_MSK + }, + { +"altr,fpga2sdram2-1" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram2region1addr), + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
drivers/ddr/altera/sdram_arria10.c new file +7
-0+ALT_NOC_FW_DDR_SCR_EN_F2SDR2REG1EN_SET_MSK + }, + { +"altr,fpga2sdram2-2" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram2region2addr), + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
drivers/ddr/altera/sdram_arria10.c new file +7
-0+ALT_NOC_FW_DDR_SCR_EN_F2SDR2REG2EN_SET_MSK + }, + { +"altr,fpga2sdram2-3" , +SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET + (fpga2sdram2region3addr), + SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
drivers/ddr/altera/sdram_arria10.c new file +11
-0+ALT_NOC_FW_DDR_SCR_EN_F2SDR2REG3EN_SET_MSK + }, + +}; + +static int of_sdram_firewall_setup (const void *blob) +{ +int child, i, node; +u32 start_end[2 ]; + + node = fdtdec_next_compatible(blob, 0,
COMPAT_ALTERA_SOCFPGA_NOC);drivers/ddr/altera/sdram_arria10.c new file +9
-0+if (node <0 ) +return -ENXIO ; + + child =fdt_first_subnode (blob, node); +if (child <0 ) +return -ENXIO ; + +/* set to default state */ + writel(0, &socfpga_noc_fw_ddr_mpu_fpga2sdram_base-Quoted 1 line
enable);
drivers/ddr/altera/sdram_arria10.c new file +6
-0+writel (0 , &socfpga_noc_fw_ddr_l3_base->enable); + + + for (i = 0; i < ARRAY_SIZE(firewall_table); i++) { + if (!fdtdec_get_int_array(blob, child, + firewall_table[i].prop_name,
drivers/ddr/altera/sdram_arria10.c new file +2
-0+ start_end, 2)) { + writel((start_end[0] &
ALT_NOC_FW_DDR_ADDR_MASK) |drivers/ddr/altera/sdram_arria10.c new file +1
-0+ (start_end[1] <<
ALT_NOC_FW_DDR_END_ADDR_LSB),drivers/ddr/altera/sdram_arria10.c new file +25
-0+ firewall_table[i].cfg_addr); +setbits_le32 (firewall_table[i].en_addr, + firewall_table[i].en_bit); + } + } + +return 0 ; +} + +int ddr_calibration_sequence (void ) +{ +WATCHDOG_RESET (); + +/* Check to see if SDRAM cal was success */ +if (sdram_startup ()) { +puts ("DDRCAL: Failed\n" ); +return -EPERM ; + } + +puts ("DDRCAL: Success\n" ); + +WATCHDOG_RESET (); + +/* initialize the MMR register */ +sdram_mmr_init ();
Quoted 9 lines
Quoted 7 lines
drivers/ddr/altera/sdram_arria10.c new file +6
-0+ +/* assigning the SDRAM size */ +unsigned long long size =sdram_size_calc (); + +/* If a weird value, use default Config size */ +/* Up to 2GB is supported, 2GB would be used if more than that */
Fix comment style.
Okay.
Quoted 4 lines
drivers/ddr/altera/sdram_arria10.c line 697
Quoted 2 lines
drivers/ddr/altera/sdram_arria10.c new file +1
-0+if (size <=0 )Can size ever be less than zero?
This is invalid/weird value returned from calculation.
Quoted 1 line
Dinh
PATCH v3 12/20 configs: Add DDR Kconfig support for Arria 10
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
This patch enables DDR Kconfig support for Arria 10.
--- arch/arm/mach-socfpga/Kconfig | 1 + drivers/ddr/altera/Kconfig | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-socfpga/Kconfig +1 -0
@@ -40,6 +40,7 @@ config TARGET_SOCFPGA_ARRIA5 config TARGET_SOCFPGA_ARRIA10 bool select SPL_BOARD_INIT if SPL + select ALTERA_SDRAM config TARGET_SOCFPGA_CYCLONE5 bool
drivers/ddr/altera/Kconfig +1 -1
@@ -1,5 +1,5 @@ config ALTERA_SDRAM bool "SoCFPGA DDR SDRAM driver" - depends on TARGET_SOCFPGA_GEN5 + depends on TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10 help Enable DDR SDRAM controller for the SoCFPGA devices.
Signature · 1 line
2.2.0
Dinh Nguyen
maintainerPATCH v3 12/20 configs: Add DDR Kconfig support for Arria 10
Quoted 10 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This patch enables DDR
Kconfigsupport for Arria 10.Signed-off-by Tien Fong Chee <[email protected]>--- arch/arm/mach-socfpga/Kconfig | 1 + drivers/ddr/altera/Kconfig | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
Dinh
PATCH v3 13/20 arm: socfpga: Enable SPL memory allocation
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Enable memory allocation in SPL for preparation to enable FAT in SPL. Memory allocation is needed by FAT to work properly.
--- include/configs/socfpga_common.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
include/configs/socfpga_common.h +21 -1
@@ -274,17 +274,33 @@ unsigned int cm_get_qspi_controller_clk_hz(void);/* * SPL * -* SRAM Memory layout: +* SRAM Memory layout for gen 5: * * 0xFFFF_0000 ...... Start of SRAM * 0xFFFF_xxxx ...... Top of stack (grows down) * 0xFFFF_yyyy ...... Malloc area * 0xFFFF_zzzz ...... Global Data * 0xFFFF_FF00 ...... End of SRAM +* +* SRAM Memory layout for Arria 10: +* 0xFFE0_0000 ...... Start of SRAM (bottom) +* 0xFFEx_xxxx ...... Top of stack (grows down to bottom) +* 0xFFEy_yyyy ...... Global Data +* 0xFFEz_zzzz ...... Malloc area (grows up to top) +* 0xFFE3_FFFF ...... End of SRAM (top) */ #define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR#define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZE +#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) +/* SPL memory allocation configuration, this is for FAT implementation */ +#ifndef CONFIG_SYS_SPL_MALLOC_START +#define CONFIG_SYS_SPL_MALLOC_SIZE 0x00010000 +#define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SYS_INIT_RAM_SIZE - \ + CONFIG_SYS_SPL_MALLOC_SIZE + \ + CONFIG_SYS_INIT_RAM_ADDR) +#endif +#endif /* SPL SDMMC boot support */ #ifdef CONFIG_SPL_MMC_SUPPORT
@@ -314,7 +330,11 @@ unsigned int cm_get_qspi_controller_clk_hz(void);/* * Stack setup */ +#if defined(CONFIG_TARGET_SOCFPGA_GEN5 )#define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR +#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) +#define CONFIG_SPL_STACK CONFIG_SYS_SPL_MALLOC_START +#endif /* Extra Environment */ #ifndef CONFIG_SPL_BUILD
Signature · 1 line
2.2.0
Dinh Nguyen
maintainerPATCH v3 13/20 arm: socfpga: Enable SPL memory allocation
Quoted 10 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Enable memory allocation in SPL for preparation to enable FAT in SPL. Memory allocation is needed by FAT to work properly.
Signed-off-by Tien Fong Chee <[email protected]>--- include/configs/socfpga_common.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
Dinh
PATCH v3 14/20 arm: socfpga: Improve comments for Intel SoCFPGA program header
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Adding some details about size in bytes to each section.
--- arch/arm/mach-socfpga/include/mach/boot0.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-socfpga/include/mach/boot0.h +2 -2
@@ -11,8 +11,8 @@ .balignl 64,0xf33db33f; .word 0x1337c0d3; /* SoCFPGA preloader validation word */ - .word 0xc01df00d; /* Version, flags, length */ - .word 0xcafec0d3; /* Checksum, zero-pad */ + .word 0xc01df00d; /* Header length(2B),flags(1B),version(1B) */ + .word 0xcafec0d3; /* Simple checksum(2B),spare offset(2B) */ nop;b reset;/* SoCFPGA jumps here */
Signature · 1 line
2.2.0
Dinh Nguyen
maintainerPATCH v3 14/20 arm: socfpga: Improve comments for Intel SoCFPGA program header
Quoted 9 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Adding some details about size in bytes to each section.
Signed-off-by Tien Fong Chee <[email protected]>--- arch/arm/mach-socfpga/include/mach/boot0.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Dinh
PATCH v3 15/20 arm: socfpga: Enhance Intel SoCFPGA program header to support Arria 10
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Enhance preloader header with both additional program length and program entry offset attributes, which offset is relative to the start of program header.
--- arch/arm/mach-socfpga/include/mach/boot0.h | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/mach-socfpga/include/mach/boot0.h +7 -0
@@ -12,6 +12,13 @@ .word 0x1337c0d3; /* SoCFPGA preloader validation word */ .word 0xc01df00d; /* Header length(2B),flags(1B),version(1B) */ +#ifndef CONFIG_TARGET_SOCFPGA_GEN5 + .word 0xfeedface; /* Program length(4B) */ + .word 0xf00dcafe; /* +* Program entry offset(4B),relative to +* the start of program header +*/ +#endif .word 0xcafec0d3; /* Simple checksum(2B),spare offset(2B) */ nop;
Signature · 1 line
2.2.0
Dinh Nguyen
maintainerPATCH v3 15/20 arm: socfpga: Enhance Intel SoCFPGA program header to support Arria 10
Quoted 11 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Enhance preloader header with both additional program length and program entry offset attributes, which offset is relative to the start of program header.
Signed-off-by Tien Fong Chee <[email protected]>--- arch/arm/mach-socfpga/include/mach/boot0.h | 7 +++++++ 1 file changed, 7 insertions(+)
Dinh
PATCH v3 16/20 arm: socfpga: Adding clock frequency info for U-boot
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Clock frequency info is required in U-boot.
--- arch/arm/mach-socfpga/board.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/mach-socfpga/board.c +8 -0
@@ -8,7 +8,10 @@#include <common.h> #include <errno.h> +#include <fdtdec.h> #include <asm/arch/reset_manager.h> +#include <asm/arch/clock_manager.h> +#include <asm/arch/misc.h> #include <asm/io.h> #include <usb.h>
@@ -26,6 +29,11 @@ int board_init(void)/* Address of boot parameters for ATAG (if ATAG is used) */ gd->bd->bi_boot_params =CONFIG_SYS_SDRAM_BASE +0x100 ; +#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) +/* configuring the clock based on handoff */ +cm_basic_init (gd->fdt_blob); +#endif +return 0 ; }
Signature · 1 line
2.2.0
Dinh Nguyen
maintainerPATCH v3 16/20 arm: socfpga: Adding clock frequency info for U-boot
Quoted 3 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Clock frequency info is required in U-boot.
We know this patch is for U-Boot, don't need to state it in the commit message. Also, it's "U-Boot", not "U-boot".
Quoted 11 lines
Signed-off-by Tien Fong Chee <[email protected]>--- arch/arm/mach-socfpga/board.c | 8 ++++++++ 1 file changed, 8 insertions(+)arch/arm/mach-socfpga/board.c +0
-0
arch/arm/mach-socfpga/board.c line 14
Quoted 7 lines
arch/arm/mach-socfpga/board.c +3
-0@@ -8,7 +8,10 @@#include <common.h> #include <errno.h> +#include <fdtdec.h> #include <asm/arch/reset_manager.h> +#include <asm/arch/clock_manager.h> +#include <asm/arch/misc.h>
Is misc.h needed?
arch/arm/mach-socfpga/board.c int board_init(void) · line 36
Quoted 12 lines
arch/arm/mach-socfpga/board.c +5
-0#include <asm/io.h> #include <usb.h> @@ -26,6 +29,11 @@ int board_init(void)/* Address of boot parameters for ATAG (if ATAG is used) */ gd->bd->bi_boot_params =CONFIG_SYS_SDRAM_BASE +0x100 ; +#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) +/* configuring the clock based on handoff */ +cm_basic_init (gd->fdt_blob); +#endif +
Is is the right place this? The usual call is in the SPL.
Dinh
Chee
PATCH v3 16/20 arm: socfpga: Adding clock frequency info for U-boot
Quoted 10 lines · Dinh Nguyen
Quoted 4 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Clock frequency info is required in U-boot.
We know this patch is for U-Boot, don't need to state it in the commit
message. Also, it's "U-Boot", not "U-boot".
Both SPL and U-Boot need to know the clock freq info. SPL already has one, and this patch is for creating the clock freq info for U-Boot.
Quoted 7 lines
Quoted 7 lines
Signed-off-by Tien Fong Chee <[email protected]>---
arch/arm/mach-socfpga/board.c | 8 ++++++++1 file changed, 8 insertions(+)
Quoted 15 lines
arch/arm/mach-socfpga/board.c line 14
Quoted 13 lines
arch/arm/mach- renamed from arch/arm/mach-socfpga/board.c +0
-0
socfpga/board.c
index 965f9dc..9a96f52 100644arch/arm/mach-socfpga/board.c +0
-0@@ -8,7 +8,10 @@
#include <common.h>
#include <errno.h>
+#include <fdtdec.h>
#include <asm/arch/reset_manager.h>arch/arm/mach-socfpga/board.c +2
-0+#include <asm/arch/clock_manager.h> +#include <asm/arch/misc.h> Is
misc.hneeded?
I believe can remove mish.h . I will verify again.
Quoted 16 lines
Quoted 9 lines
#include <
asm/io.h>
#include <usb.h>arch/arm/mach-socfpga/board.c +0
-0@@ -26,6 +29,11 @@ int board_init(void) /* Address of boot parameters for ATAG (if ATAG is used) */ gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;arch/arm/mach-socfpga/board.c int board_init(void) · line 36
Quoted 5 lines
arch/arm/mach-socfpga/board.c +5
-0+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) +/* configuring the clock based on handoff */ +cm_basic_init (gd->fdt_blob); +#endif +Is is the right place this? The usual call is in the SPL.
SPL has one. This is for U-Boot. Clock freq info which is stored in SPL memory will gone after moving to U-Boot.
Quoted 1 line
Dinh
PATCH v3 17/20 arm: socfpga: Adding SoCFPGA info for both SPL and U-boot
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
SoC FPGA info is required in both SPL and U-boot.
--- arch/arm/mach-socfpga/board.c | 3 +++ arch/arm/mach-socfpga/misc_arria10.c | 5 ----- arch/arm/mach-socfpga/spl.c | 6 ++++++ 3 files changed, 9 insertions(+), 5 deletions(-)
arch/arm/mach-socfpga/board.c +3 -0
@@ -32,6 +32,9 @@ int board_init(void)#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )/* configuring the clock based on handoff */ cm_basic_init (gd->fdt_blob); + +/* Add device descriptor to FPGA device table */ +socfpga_fpga_add ();#endif return 0 ;
arch/arm/mach-socfpga/misc_arria10.c +0 -5
@@ -94,11 +94,6 @@ int arch_early_init_r(void)/* assert reset to all except L4WD0 and L4TIMER0 */ socfpga_per_reset_all (); -/* configuring the clock based on handoff */ -/* TODO: Add call to cm_basic_init() */ - -/* Add device descriptor to FPGA device table */ -socfpga_fpga_add (); return 0; }#else
arch/arm/mach-socfpga/spl.c +6 -0
@@ -15,6 +15,7 @@#include <asm/arch/system_manager.h> #include <asm/arch/freeze_controller.h> #include <asm/arch/clock_manager.h> +#include <asm/arch/misc.h> #include <asm/arch/scan_manager.h> #include <asm/arch/sdram.h> #include <asm/arch/scu.h>
@@ -208,6 +209,11 @@ void spl_board_init(void)/* enable console uart printing */ preloader_console_init (); + +WATCHDOG_RESET (); + +/* Add device descriptor to FPGA device table */ +socfpga_fpga_add (); }void board_init_f (ulong dummy)
Signature · 1 line
2.2.0
Dinh Nguyen
maintainerPATCH v3 17/20 arm: socfpga: Adding SoCFPGA info for both SPL and U-boot
Quoted 3 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
SoC FPGA info is required in both SPL and U-boot.
s/SoC FPGA/SocFPGA to be consistent.
s/U-boot/U-Boot
Quoted 27 lines
Signed-off-by Tien Fong Chee <[email protected]>--- arch/arm/mach-socfpga/board.c | 3 +++ arch/arm/mach-socfpga/misc_arria10.c | 5 ----- arch/arm/mach-socfpga/spl.c | 6 ++++++ 3 files changed, 9 insertions(+), 5 deletions(-)arch/arm/mach-socfpga/board.c +3
-0@@ -32,6 +32,9 @@ int board_init(void)#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )/* configuring the clock based on handoff */ cm_basic_init (gd->fdt_blob); + +/* Add device descriptor to FPGA device table */ +socfpga_fpga_add ();#endif return 0 ;arch/arm/mach-socfpga/misc_arria10.c +0
-0
arch/arm/mach-socfpga/misc_arria10.c int arch_early_init_r(void) · line 101
Quoted 8 lines
arch/arm/mach-socfpga/misc_arria10.c +0
-5@@ -94,11 +94,6 @@ int arch_early_init_r(void)/* assert reset to all except L4WD0 and L4TIMER0 */ socfpga_per_reset_all (); -/* configuring the clock based on handoff */ -/* TODO: Add call to cm_basic_init() */ - -/* Add device descriptor to FPGA device table */ -socfpga_fpga_add ();
Why remove it from here?
Quoted 16 lines
arch/arm/mach-socfpga/misc_arria10.c +0
-0return 0; }#else arch/arm/mach-socfpga/spl.c +1
-0@@ -15,6 +15,7 @@#include <asm/arch/system_manager.h> #include <asm/arch/freeze_controller.h> #include <asm/arch/clock_manager.h> +#include <asm/arch/misc.h> #include <asm/arch/scan_manager.h> #include <asm/arch/sdram.h> #include <asm/arch/scu.h>
arch/arm/mach-socfpga/spl.c void spl_board_init(void) · line 216
Quoted 8 lines
arch/arm/mach-socfpga/spl.c +5
-0@@ -208,6 +209,11 @@ void spl_board_init(void)/* enable console uart printing */ preloader_console_init (); + +WATCHDOG_RESET (); + +/* Add device descriptor to FPGA device table */ +socfpga_fpga_add ();
And add here?
Dinh
Chee
PATCH v3 17/20 arm: socfpga: Adding SoCFPGA info for both SPL and U-boot
Quoted 10 lines · Dinh Nguyen
Quoted 4 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
SoC FPGA info is required in both SPL and U-boot.
s/SoC FPGA/SocFPGA to be consistent.
s/U-boot/U-Boot
Okay.
Quoted 31 lines
Quoted 31 lines
Signed-off-by Tien Fong Chee <[email protected]>---
arch/arm/mach-socfpga/board.c | 3 +++
arch/arm/mach-socfpga/misc_arria10.c | 5 -----
arch/arm/mach-socfpga/spl.c | 6 ++++++3 files changed, 9 insertions(+), 5 deletions(-)arch/arm/mach- renamed from arch/arm/mach-socfpga/board.c +0
-0
socfpga/board.c
index 9a96f52..7beb347 100644arch/arm/mach-socfpga/board.c +3
-0@@ -32,6 +32,9 @@ int board_init(void) #if defined(CONFIG_TARGET_SOCFPGA_ARRIA10) /* configuring the clock based on handoff */ cm_basic_init(gd->fdt_blob); + +/* Add device descriptor to FPGA device table */ +socfpga_fpga_add (); #endif
return 0;arch/arm/mach- renamed from arch/arm/mach-socfpga/misc_arria10.c +0
-0
socfpga/misc_arria10.c
index 9d751f6..8760ac9 100644arch/arm/mach-socfpga/misc_arria10.c +0
-0@@ -94,11 +94,6 @@ int arch_early_init_r(void) /* assert reset to all except L4WD0 and L4TIMER0 */
Quoted 9 lines
arch/arm/mach-socfpga/misc_arria10.c int arch_early_init_r(void) · line 101
Quoted 7 lines
arch/arm/mach-socfpga/misc_arria10.c +0
-0socfpga_per_reset_all();arch/arm/mach-socfpga/misc_arria10.c +0
-5-/* configuring the clock based on handoff */ -/* TODO: Add call to cm_basic_init() */ - -/* Add device descriptor to FPGA device table */ -socfpga_fpga_add ();Why remove it from here?
Initially, this is only created for SPL. Until U-Boot enable development phase, i realized this also required by U-boot. So i duplicated socfpga_fpga_add in both SPL(spl.c - below) and U- Boot(board.c - above).
Quoted 19 lines
Quoted 19 lines
return 0;
}
#elsearch/arm/mach- renamed from arch/arm/mach-socfpga/spl.c +0
-0
socfpga/spl.c
index 71bae82..aba116d 100644arch/arm/mach-socfpga/spl.c +1
-0@@ -15,6 +15,7 @@ #include <asm/arch/system_manager.h> #include <asm/arch/freeze_controller.h> #include <asm/arch/clock_manager.h> +#include <asm/arch/misc.h> #include <asm/arch/scan_manager.h> #include <asm/arch/sdram.h> #include <asm/arch/scu.h>@@ -208,6 +209,11 @@ void spl_board_init(void)
Quoted 9 lines
arch/arm/mach-socfpga/spl.c void spl_board_init(void) · line 216
Quoted 7 lines
/* enable console uart printing */
preloader_console_init();arch/arm/mach-socfpga/spl.c +5
-0+ +WATCHDOG_RESET (); + +/* Add device descriptor to FPGA device table */ +socfpga_fpga_add ();And add here?
Refer to my comment above.
Quoted 1 line
Dinh
PATCH v3 18/20 arm: socfpga: Enable function visible to other file
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Enable function visible to other file, so it can be used by other functions from other file.
--- common/spl/spl_mmc.c | 2 +- include/spl.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
common/spl/spl_mmc.c +1 -1
@@ -113,7 +113,7 @@ static int spl_mmc_get_device_index(u32 boot_device)return -ENODEV ; } -static int spl_mmc_find_device (struct mmc **mmcp,u32 boot_device) +int spl_mmc_find_device (struct mmc **mmcp,u32 boot_device) {#if CONFIG_IS_ENABLED (DM_MMC )struct udevice *dev;
include/spl.h +2 -0
@@ -10,6 +10,7 @@/* Platform-specific defines */ #include <linux/compiler.h> #include <asm/spl.h> +#include <mmc.h> /* Value in r0 indicates we booted from U-Boot */ #define UBOOT_NOT_LOADED_FROM_SPL 0x13578642
@@ -68,6 +69,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,void preloader_console_init (void );u32 spl_boot_device (void );u32 spl_boot_mode (const u32 boot_device); +int spl_mmc_find_device (struct mmc **mmcp,u32 boot_device);/** * spl_set_header_raw_uboot() - Set up a standard SPL image structure
Signature · 1 line
2.2.0
Dinh Nguyen
maintainerPATCH v3 18/20 arm: socfpga: Enable function visible to other file
Quoted 4 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Enable function visible to other file, so it can be used by other functions from other file.
Huh? What function? What other file? Why?
Please bear in mind for future patches, when reading the commit message, you should have a good idea of what the patch is doing without even looking at the patch.
Need to include more people listed in get_maintainer.pl
Maybe Marek has already commented, but this patch can be separated out from the A10 series.
Also, the commit header "arm:socfpga: Enable function visible to other file" is horrible and this patch has nothing to do with socfpga.
Dinh
Chee
PATCH v3 18/20 arm: socfpga: Enable function visible to other file
Quoted 16 lines · Dinh Nguyen
Quoted 5 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Enable function visible to other file, so it can be used by other functions from other file.
Huh? What function? What other file? Why?
Please bear in mind for future patches, when reading the commit message,
you should have a good idea of what the patch is doing without even looking at the patch.Need to include more people listed in get_maintainer.pl
Quoted 8 lines
Maybe Marek has already commented, but this patch can be separated out
from the A10 series.Also, the commit header "arm:socfpga: Enable function visible to other
file" is horrible and this patch has nothing to do with socfpga.
This patch is required by later patches, so this patch can't be separated out. This function is static declaration, but this function is required by the caller from other file(later patches). So, this patch is to remove ths static declaration so it is accessible by the caller from other file.
Quoted 1 line
Dinh
Dinh Nguyen
maintainerPATCH v3 18/20 arm: socfpga: Enable function visible to other file
Quoted 25 lines · Tien Fong
Quoted 16 lines · Dinh Nguyen
Quoted 5 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Enable function visible to other file, so it can be used by other functions from other file.
Huh? What function? What other file? Why?
Please bear in mind for future patches, when reading the commit message,
you should have a good idea of what the patch is doing without even looking at the patch.Need to include more people listed in get_maintainer.pl
Quoted 8 lines
Maybe Marek has already commented, but this patch can be separated out
from the A10 series.Also, the commit header "arm:socfpga: Enable function visible to other
file" is horrible and this patch has nothing to do with socfpga.
Quoted 5 lines
This patch is required by later patches, so this patch can't be separated out. This function is static declaration, but this function is required by the caller from other file(later patches). So, this patch is to remove ths static declaration so it is accessible by the caller from other file.
yes, I know what it means to remove the static declaration. Ok, I understand the need for this patch in this series. Please fix up the commit header and message.
Dinh
Chee
PATCH v3 18/20 arm: socfpga: Enable function visible to other file
Quoted 40 lines · Dinh Nguyen
Quoted 31 lines · Tien Fong
Quoted 20 lines · Dinh Nguyen
Quoted 7 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Enable function visible to other file, so it can be used by other
functions from other file.Huh? What function? What other file? Why?
Please bear in mind for future patches, when reading the commit message,
you should have a good idea of what the patch is doing without even
looking at the patch.Need to include more people listed in get_maintainer.pl
Quoted 9 lines
Maybe Marek has already commented, but this patch can be separated
out
from the A10 series.Also, the commit header "arm:socfpga: Enable function visible to other
file" is horrible and this patch has nothing to do with socfpga.Quoted 7 lines
This patch is required by later patches, so this patch can't be separated out. This function is static declaration, but this function
is required by the caller from other file(later patches). So, this patch is to remove ths static declaration so it is accessible by the
caller from other file.
Quoted 4 lines
yes, I know what it means to remove the static declaration. Ok, I understand the need for this patch in this series. Please fix up the commit header and message.
Okay.
Quoted 1 line
Dinh
PATCH v3 19/20 arm: socfpga: Enable DDR working
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
SPL configures DDR by programming peripheral raw binary file and calibrating DDR.
--- arch/arm/mach-socfpga/spl.c | 56 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
arch/arm/mach-socfpga/spl.c +56 -0
@@ -15,6 +15,7 @@#include <asm/arch/system_manager.h> #include <asm/arch/freeze_controller.h> #include <asm/arch/clock_manager.h> +#include <asm/arch/fpga_manager.h> #include <asm/arch/misc.h> #include <asm/arch/scan_manager.h> #include <asm/arch/sdram.h>
@@ -22,6 +23,10 @@#include <asm/arch/nic301.h> #include <asm/sections.h> #include <fdtdec.h> +#include <fat.h> +#include <fs.h> +#include <linux/ctype.h> +#include <mmc.h> #include <watchdog.h> #if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )#include <asm/arch/pinmux.h>
@@ -29,6 +34,9 @@DECLARE_GLOBAL_DATA_PTR ; +#define BSIZE 4096 +#define PERIPH_RBF 0 +#if defined(CONFIG_TARGET_SOCFPGA_GEN5 )static struct pl310_regs *const pl310 = (struct pl310_regs *)CONFIG_SYS_PL310_BASE ;
@@ -197,6 +205,12 @@ void board_init_f(ulong dummy)#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )void spl_board_init (void ) { +int rval =0 ; +int len =0 ; +u32 buffer[BSIZE ]__aligned(ARCH_DMA_MINALIGN) ; +struct spl_boot_device bootdev; +fpga_fs_info fpga_fsinfo; +/* configuring the clock based on handoff */ cm_basic_init (gd->fdt_blob);WATCHDOG_RESET ();
@@ -214,6 +228,48 @@ void spl_board_init(void)/* Add device descriptor to FPGA device table */ socfpga_fpga_add (); + + bootdev.boot_device =spl_boot_device (); + +if (BOOT_DEVICE_MMC1 == bootdev.boot_device) { +struct mmc *mmc =NULL ; +int err =0 ; + +spl_mmc_find_device (&mmc, bootdev.boot_device); + + err =mmc_init (mmc); + +if (err) { +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT +printf ("spl: mmc init failed with error: %d\n" , err); +#endif +return ; + } + + fpga_fsinfo.interface ="mmc" ; + fpga_fsinfo.fstype =FS_TYPE_FAT ; + } + + fpga_fsinfo.dev_part = (char *)get_cff_devpart (gd->fdt_blob, + &len); + + fpga_fsinfo.filename = (char *)get_cff_filename (gd->fdt_blob, + &len, +PERIPH_RBF ); + +/* Program peripheral RBF */ +if (fpga_fsinfo.filename) + rval =fpga_fsload (0 , buffer,BSIZE , &fpga_fsinfo); +else { +printf ("Failed to find peripheral RBF file from DTS\n" ); +return ; + } + +if (!rval) { +config_pins (gd->fdt_blob,"shared" ); + +ddr_calibration_sequence (); + } }void board_init_f (ulong dummy)
Signature · 1 line
2.2.0
Dinh Nguyen
maintainerPATCH v3 19/20 arm: socfpga: Enable DDR working
Please update your commit header.
Quoted 64 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
SPL configures DDR by programming peripheral raw binary file and calibrating DDR.
Signed-off-by Tien Fong Chee <[email protected]>--- arch/arm/mach-socfpga/spl.c | 56 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)arch/arm/mach-socfpga/spl.c +18
-0@@ -15,6 +15,7 @@#include <asm/arch/system_manager.h> #include <asm/arch/freeze_controller.h> #include <asm/arch/clock_manager.h> +#include <asm/arch/fpga_manager.h> #include <asm/arch/misc.h> #include <asm/arch/scan_manager.h> #include <asm/arch/sdram.h> @@ -22,6 +23,10 @@#include <asm/arch/nic301.h> #include <asm/sections.h> #include <fdtdec.h> +#include <fat.h> +#include <fs.h> +#include <linux/ctype.h> +#include <mmc.h> #include <watchdog.h> #if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )#include <asm/arch/pinmux.h> @@ -29,6 +34,9 @@DECLARE_GLOBAL_DATA_PTR ; +#define BSIZE 4096 +#define PERIPH_RBF 0 +#if defined(CONFIG_TARGET_SOCFPGA_GEN5 )static struct pl310_regs *const pl310 = (struct pl310_regs *)CONFIG_SYS_PL310_BASE ;@@ -197,6 +205,12 @@ void board_init_f(ulong dummy)#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )void spl_board_init (void ) { +int rval =0 ; +int len =0 ; +u32 buffer[BSIZE ]__aligned(ARCH_DMA_MINALIGN) ; +struct spl_boot_device bootdev; +fpga_fs_info fpga_fsinfo; +/* configuring the clock based on handoff */ cm_basic_init (gd->fdt_blob);WATCHDOG_RESET ();@@ -214,6 +228,48 @@ void spl_board_init(void)/* Add device descriptor to FPGA device table */ socfpga_fpga_add (); + + bootdev.boot_device =spl_boot_device (); + +if (BOOT_DEVICE_MMC1 == bootdev.boot_device) {
arch/arm/mach-socfpga/spl.c void spl_board_init(void) · line 244
Quoted 10 lines
arch/arm/mach-socfpga/spl.c +10
-0+struct mmc *mmc =NULL ; +int err =0 ; + +spl_mmc_find_device (&mmc, bootdev.boot_device); + + err =mmc_init (mmc); + +if (err) { +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT +printf ("spl: mmc init failed with error: %d\n" , err);
You should use puts instead of printf. But this case use error()? Why do you need to wrap this around CONFIG_SPL_LIBCOMMON_SUPPORT?
Quoted 10 lines
arch/arm/mach-socfpga/spl.c +10
-0+#endif +return ; + } + + fpga_fsinfo.interface ="mmc" ; + fpga_fsinfo.fstype =FS_TYPE_FAT ; + } + + fpga_fsinfo.dev_part = (char *)get_cff_devpart (gd->fdt_blob, + &len);
arch/arm/mach-socfpga/spl.c void spl_board_init(void) · line 264
Quoted 10 lines
arch/arm/mach-socfpga/spl.c +10
-0+ + fpga_fsinfo.filename = (char *)get_cff_filename (gd->fdt_blob, + &len, +PERIPH_RBF ); + +/* Program peripheral RBF */ +if (fpga_fsinfo.filename) + rval =fpga_fsload (0 , buffer,BSIZE , &fpga_fsinfo); +else { +printf ("Failed to find peripheral RBF file from DTS\n" );
Use error()?
Dinh
Chee
PATCH v3 19/20 arm: socfpga: Enable DDR working
Quoted 76 lines · Dinh Nguyen
Please update your commit header.
Quoted 73 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
SPL configures DDR by programming peripheral raw binary file and calibrating DDR.
Signed-off-by Tien Fong Chee <[email protected]>---
arch/arm/mach-socfpga/spl.c | 56
+++++++++++++++++++++++++++++++++++++++++++++1 file changed, 56 insertions(+)arch/arm/mach- renamed from arch/arm/mach-socfpga/spl.c +0
-0
socfpga/spl.c
index aba116d..6c9bf81 100644arch/arm/mach-socfpga/spl.c +5
-0@@ -15,6 +15,7 @@ #include <asm/arch/system_manager.h> #include <asm/arch/freeze_controller.h> #include <asm/arch/clock_manager.h> +#include <asm/arch/fpga_manager.h> #include <asm/arch/misc.h> #include <asm/arch/scan_manager.h> #include <asm/arch/sdram.h>@@ -22,6 +23,10 @@ #include <asm/arch/nic301.h> #include <asm/sections.h> #include <fdtdec.h> +#include <fat.h> +#include <fs.h> +#include <linux/ctype.h> +#include <mmc.h> #include <watchdog.h> #if defined(CONFIG_TARGET_SOCFPGA_ARRIA10) #include <asm/arch/pinmux.h>@@ -29,6 +34,9 @@
DECLARE_GLOBAL_DATA_PTR;arch/arm/mach-socfpga/spl.c +3
-0+#define BSIZE 4096 +#define PERIPH_RBF 0 +#if
defined(CONFIG_TARGET_SOCFPGA_GEN5)static structpl310_regs*const pl310 = (structpl310_regs*)CONFIG_SYS_PL310_BASE;arch/arm/mach-socfpga/spl.c +6
-0@@ -197,6 +205,12 @@ void board_init_f(ulong dummy) #elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10) void spl_board_init(void) { +int rval =0 ; +int len =0 ; +u32 buffer[BSIZE ]__aligned(ARCH_DMA_MINALIGN) ; +struct spl_boot_device bootdev; +fpga_fs_info fpga_fsinfo; + /* configuring the clock based on handoff */ cm_basic_init(gd->fdt_blob); WATCHDOG_RESET();@@ -214,6 +228,48 @@ void spl_board_init(void)
/* Add device descriptor to FPGA device table */socfpga_fpga_add();arch/arm/mach-socfpga/spl.c +10
-0+ + bootdev.boot_device =spl_boot_device (); + +if (BOOT_DEVICE_MMC1 == bootdev.boot_device) { +struct mmc *mmc =NULL ; +int err =0 ; + +spl_mmc_find_device (&mmc, bootdev.boot_device); + + err =mmc_init (mmc);
Quoted 9 lines
Quoted 5 lines
arch/arm/mach-socfpga/spl.c +4
-0+ +if (err) { +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT + printf("spl: mmc init failed with error:%d\n", err);
You should use puts instead of printf. But this case use
error()? Why do
you need to wrap this aroundCONFIG_SPL_LIBCOMMON_SUPPORT?
I copied this block of code from /common/spl_mmc.c, so i keep everything intact. But, i tried to track back the reason of wrapping around with CONFIG_SPL_LIBCOMMON_SUPPORT, this is what i found "If we don't have CONFIG_SPL_LIBCOMMON_SUPPORT defined then stdio functions are unavailable & calling them will cause a link failure."
https://lists.denx.de/pipermail/u-boot/2013-September/161969.html
Quoted 15 lines
Quoted 15 lines
arch/arm/mach-socfpga/spl.c +9
-0+#endif +return ; + } + + fpga_fsinfo.interface ="mmc" ; + fpga_fsinfo.fstype =FS_TYPE_FAT ; + } + + fpga_fsinfo.dev_part = (char *)get_cff_devpart(gd-Quoted 1 line
fdt_blob,arch/arm/mach-socfpga/spl.c +3
-0+ &len); + + fpga_fsinfo.filename = (char *)get_cff_filename(gd-Quoted 1 line
fdt_blob,
Quoted 13 lines
Quoted 11 lines
arch/arm/mach-socfpga/spl.c +2
-0+ &len, + PERIPH_RBF);
arch/arm/mach-socfpga/spl.c +4
-0+ +/* Program peripheral RBF */ +if (fpga_fsinfo.filename) + rval = fpga_fsload(0, buffer, BSIZE,
&fpga_fsinfo);arch/arm/mach-socfpga/spl.c +2
-0+else { + printf("Failed to find peripheral RBF file fromDTS\n");
Use
error()?
Okay.
Quoted 1 line
Dinh
PATCH v3 20/20 arm: socfpga: Enable SPL booting U-boot
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Enable SPL successfully boot to U-boot.
--- configs/socfpga_arria10_defconfig | 57 +++++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 8 deletions(-)
configs/socfpga_arria10_defconfig +49 -8
@@ -1,34 +1,75 @@ CONFIG_ARM=y CONFIG_ARCH_SOCFPGA=y -CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_SOCFPGA_ARRIA10_SOCDK=y CONFIG_IDENT_STRING="socfpga_arria10" CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_socdk_sdmmc" -CONFIG_USE_BOOTARGS=y -CONFIG_BOOTARGS="console=ttyS0,115200" CONFIG_DEFAULT_FDT_FILE="socfpga_arria10_socdk_sdmmc.dtb" +CONFIG_FIT=y +CONFIG_SYS_CONSOLE_IS_IN_ENV=y +CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y +CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y +CONFIG_SPL_ENV_SUPPORT=y +CONFIG_VERSION_VARIABLE=y CONFIG_SPL=y +CONFIG_HUSH_PARSER=y CONFIG_SPL_FPGA_SUPPORT=y +CONFIG_SPL_FAT_SUPPORT=y +CONFIG_FS_FAT_MAX_CLUSTSIZE=32768 CONFIG_CMD_BOOTZ=y # CONFIG_CMD_IMLS is not set CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y # CONFIG_CMD_FLASH is not set -CONFIG_CMD_GPIO=y +CONFIG_SPL_LIBDISK_SUPPORT=y +CONFIG_CMD_PART=y CONFIG_CMD_MMC=y +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y +CONFIG_CMD_I2C=y +CONFIG_SYS_I2C_DW=y +CONFIG_CMD_USB=y +CONFIG_CMD_DFU=y +CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_CMD_GPIO=y +CONFIG_CMD_MII=y CONFIG_CMD_DHCP=y CONFIG_CMD_PING=y CONFIG_CMD_CACHE=y -CONFIG_CMD_EXT4=y -CONFIG_CMD_EXT4_WRITE=y CONFIG_DOS_PARTITION=y -# CONFIG_SPL_DOS_PARTITION is not set -CONFIG_ENV_IS_IN_MMC=y +CONFIG_SPL_DOS_PARTITION=y +CONFIG_SPL_FS_GENERIC=y +CONFIG_CMD_FAT=y +CONFIG_CMD_FS_GENERIC=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_DFU_MMC=y CONFIG_FPGA_SOCFPGA=y CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y CONFIG_DM_MMC=y +CONFIG_MMC_DW=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_DM_ETH=y +CONFIG_ETH_DESIGNWARE=y CONFIG_SYS_NS16550=y CONFIG_USE_TINY_PRINTF=y +CONFIG_CMD_FPGA_LOADFS=y +CONFIG_CADENCE_QSPI=y +CONFIG_DESIGNWARE_SPI=y +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_DWC2_OTG=y +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_G_DNL_MANUFACTURER="altera" +CONFIG_G_DNL_VENDOR_NUM=0x0525 +CONFIG_G_DNL_PRODUCT_NUM=0xa4a5 +CONFIG_USE_TINY_PRINTF=y +CONFIG_SPL_MMC_SUPPORT=y +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800 +CONFIG_ENABLE_ARM_SOC_BOOT0_HOOK=y
Signature · 1 line
2.2.0
Dinh Nguyen
maintainerPATCH v3 20/20 arm: socfpga: Enable SPL booting U-boot
Quoted 3 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Enable SPL successfully boot to U-boot.
s/U-boot/U-Boot
Quoted 11 lines
Signed-off-by Tien Fong Chee <[email protected]>--- configs/socfpga_arria10_defconfig | 57 +++++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 8 deletions(-)configs/socfpga_arria10_defconfig +0
-0
configs/socfpga_arria10_defconfig line 3
Quoted 3 lines
configs/socfpga_arria10_defconfig +0
-1@@ -1,34 +1,75 @@ CONFIG_ARM=y CONFIG_ARCH_SOCFPGA=y -CONFIG_SYS_MALLOC_F_LEN=0x2000
Why are you removing this?
configs/socfpga_arria10_defconfig line 8
Quoted 5 lines
configs/socfpga_arria10_defconfig +0
-2CONFIG_TARGET_SOCFPGA_ARRIA10_SOCDK=y CONFIG_IDENT_STRING="socfpga_arria10" CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_socdk_sdmmc" -CONFIG_USE_BOOTARGS=y -CONFIG_BOOTARGS="console=ttyS0,115200"
Why remove this?
Dinh
Chee
PATCH v3 20/20 arm: socfpga: Enable SPL booting U-boot
Quoted 28 lines · Dinh Nguyen
Quoted 4 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Enable SPL successfully boot to U-boot.
s/U-boot/U-Boot
Quoted 14 lines
Signed-off-by Tien Fong Chee <[email protected]>---
configs/socfpga_arria10_defconfig | 57
+++++++++++++++++++++++++++++++++------1 file changed, 49 insertions(+), 8 deletions(-)configs/socfpga_arria10_defconfig +0
-0@@ -1,34 +1,75 @@Quoted 3 lines
CONFIG_ARM=y
CONFIG_ARCH_SOCFPGA=y
-CONFIG_SYS_MALLOC_F_LEN=0x2000Why are you removing this?
Quoted 1 line
Quoted 7 lines
configs/socfpga_arria10_defconfig line 8
Quoted 5 lines
CONFIG_TARGET_SOCFPGA_ARRIA10_SOCDK=y
CONFIG_IDENT_STRING="socfpga_arria10"CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_socdk_sdmmc"configs/socfpga_arria10_defconfig +0
-2-CONFIG_USE_BOOTARGS=y -CONFIG_BOOTARGS="console=ttyS0,115200"Why remove this?
We using distro boot. Those configs would be defined at extlinux.conf.
Quoted 1 line
Dinh