Add Intel Arria 10 SoC FPGA driver
v11 cover Add Intel Arria 10 SoC FPGA driver
From: Tien Fong Chee <[email protected]>
This is the 11th version of patchset to adds support for Intel Arria 10 SoC FPGA driver. This version mainly resolved comments from Dinh in [v10]. This series is working on top of u-boot-socfpga.git - http://git.denx.de/u-boot-socfpga.git
[v10]: https://www.mail-archive.com/u-boot at lists.denx.de/msg252583.html
v10 -> v11 changes:
-----------------
- Changed the commit header of patch 3 and patch 4 to "kconfig:", previously was "arm: socfpga:".
- Cleaned up commit old message on patch 5.
Patchset history
----------------
[v1]: https://www.mail-archive.com/u-boot at lists.denx.de/msg247788.html [v2]: https://www.mail-archive.com/u-boot at lists.denx.de/msg248541.html [v3]: https://www.mail-archive.com/u-boot at lists.denx.de/msg249160.html [v4]: https://www.mail-archive.com/u-boot at lists.denx.de/msg250149.html [v5]: https://www.mail-archive.com/u-boot at lists.denx.de/msg250517.html [v6]: https://www.mail-archive.com/u-boot at lists.denx.de/msg250687.html [v7]: https://www.mail-archive.com/u-boot at lists.denx.de/msg251213.html [v8]: https://www.mail-archive.com/u-boot at lists.denx.de/msg252196.html [v9]: https://www.mail-archive.com/u-boot at lists.denx.de/msg252422.html
Tien Fong Chee (6):
arm: socfpga: Remove unused passing parameter of socfpga_bridges_reset
arm: socfpga: Restructure FPGA driver in the preparation to support
A10
kconfig: Convert FPGA and FPGA_ALTERA configuration to Kconfig
kconfig: Convert FPGA_SOCFPGA configuration to Kconfig
drivers: Enable FPGA driver build on SPL
arm: socfpga: Add FPGA driver support for Arria 10
arch/arm/mach-socfpga/Makefile | 2 +-
arch/arm/mach-socfpga/include/mach/fpga_manager.h | 70 +--
.../include/mach/fpga_manager_arria10.h | 100 +++++
.../mach/{fpga_manager.h => fpga_manager_gen5.h} | 69 ++-
.../include/mach/reset_manager_arria10.h | 2 +-
arch/arm/mach-socfpga/reset_manager_arria10.c | 4 +-
configs/astro_mcf5373l_defconfig | 1 +
configs/socfpga_arria10_defconfig | 2 +
configs/socfpga_arria5_defconfig | 1 +
configs/socfpga_cyclone5_defconfig | 1 +
configs/socfpga_de0_nano_soc_defconfig | 1 +
configs/socfpga_de10_nano_defconfig | 1 +
configs/socfpga_de1_soc_defconfig | 1 +
configs/socfpga_is1_defconfig | 1 +
configs/socfpga_mcvevk_defconfig | 1 +
configs/socfpga_sockit_defconfig | 1 +
configs/socfpga_socrates_defconfig | 1 +
configs/socfpga_sr1500_defconfig | 1 +
configs/socfpga_vining_fpga_defconfig | 1 +
configs/theadorable_debug_defconfig | 1 +
configs/theadorable_defconfig | 1 +
drivers/Makefile | 1 +
drivers/fpga/Kconfig | 8 +
drivers/fpga/Makefile | 2 +
drivers/fpga/socfpga.c | 241 +----------
drivers/fpga/socfpga_arria10.c | 479 +++++++++++++++++++++
drivers/fpga/{socfpga.c => socfpga_gen5.c} | 54 +--
include/configs/astro_mcf5373l.h | 2 -
include/configs/socfpga_common.h | 6 +-
include/configs/theadorable.h | 2 -
30 files changed, 660 insertions(+), 398 deletions(-)
create mode 100644 arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
copy arch/arm/mach-socfpga/include/mach/{fpga_manager.h => fpga_manager_gen5.h} (57%)
create mode 100644 drivers/fpga/socfpga_arria10.c
copy drivers/fpga/{socfpga.c => socfpga_gen5.c} (83%)Signature · 1 line
2.2.0
v11 cover Add Intel Arria 10 SoC FPGA driver
From: Tien Fong Chee <[email protected]>
This is the 11th version of patchset to adds support for Intel Arria 10 SoC FPGA driver. This version mainly resolved comments from Dinh in [v10]. This series is working on top of u-boot-socfpga.git - http://git.denx.de/u-boot-socfpga.git
[v10]: https://www.mail-archive.com/u-boot at lists.denx.de/msg252583.html
v10 -> v11 changes:
-----------------
- Changed the commit header of patch 3 and patch 4 to "kconfig:", previously was "arm: socfpga:".
- Cleaned up commit old message on patch 5.
Patchset history
----------------
[v1]: https://www.mail-archive.com/u-boot at lists.denx.de/msg247788.html [v2]: https://www.mail-archive.com/u-boot at lists.denx.de/msg248541.html [v3]: https://www.mail-archive.com/u-boot at lists.denx.de/msg249160.html [v4]: https://www.mail-archive.com/u-boot at lists.denx.de/msg250149.html [v5]: https://www.mail-archive.com/u-boot at lists.denx.de/msg250517.html [v6]: https://www.mail-archive.com/u-boot at lists.denx.de/msg250687.html [v7]: https://www.mail-archive.com/u-boot at lists.denx.de/msg251213.html [v8]: https://www.mail-archive.com/u-boot at lists.denx.de/msg252196.html [v9]: https://www.mail-archive.com/u-boot at lists.denx.de/msg252422.html
Tien Fong Chee (6):
arm: socfpga: Remove unused passing parameter of socfpga_bridges_reset
arm: socfpga: Restructure FPGA driver in the preparation to support
A10
kconfig: Convert FPGA and FPGA_ALTERA configuration to Kconfig
kconfig: Convert FPGA_SOCFPGA configuration to Kconfig
drivers: Enable FPGA driver build on SPL
arm: socfpga: Add FPGA driver support for Arria 10
arch/arm/mach-socfpga/Makefile | 2 +-
arch/arm/mach-socfpga/include/mach/fpga_manager.h | 70 +--
.../include/mach/fpga_manager_arria10.h | 100 +++++
.../mach/{fpga_manager.h => fpga_manager_gen5.h} | 69 ++-
.../include/mach/reset_manager_arria10.h | 2 +-
arch/arm/mach-socfpga/reset_manager_arria10.c | 4 +-
configs/astro_mcf5373l_defconfig | 1 +
configs/socfpga_arria10_defconfig | 2 +
configs/socfpga_arria5_defconfig | 1 +
configs/socfpga_cyclone5_defconfig | 1 +
configs/socfpga_de0_nano_soc_defconfig | 1 +
configs/socfpga_de10_nano_defconfig | 1 +
configs/socfpga_de1_soc_defconfig | 1 +
configs/socfpga_is1_defconfig | 1 +
configs/socfpga_mcvevk_defconfig | 1 +
configs/socfpga_sockit_defconfig | 1 +
configs/socfpga_socrates_defconfig | 1 +
configs/socfpga_sr1500_defconfig | 1 +
configs/socfpga_vining_fpga_defconfig | 1 +
configs/theadorable_debug_defconfig | 1 +
configs/theadorable_defconfig | 1 +
drivers/Makefile | 1 +
drivers/fpga/Kconfig | 8 +
drivers/fpga/Makefile | 2 +
drivers/fpga/socfpga.c | 241 +----------
drivers/fpga/socfpga_arria10.c | 479 +++++++++++++++++++++
drivers/fpga/{socfpga.c => socfpga_gen5.c} | 54 +--
include/configs/astro_mcf5373l.h | 2 -
include/configs/socfpga_common.h | 6 +-
include/configs/theadorable.h | 2 -
30 files changed, 660 insertions(+), 398 deletions(-)
create mode 100644 arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
copy arch/arm/mach-socfpga/include/mach/{fpga_manager.h => fpga_manager_gen5.h} (57%)
create mode 100644 drivers/fpga/socfpga_arria10.c
copy drivers/fpga/{socfpga.c => socfpga_gen5.c} (83%)Signature · 3 lines
2.2.0 Reviewed-by: Ley Foon Tan <[email protected]> Reviewed-by: Dinh Nguyen <[email protected]>
PATCH v11 1/6 arm: socfpga: Remove unused passing parameter of socfpga_bridges_reset
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Remove parameter from socfpga_bridges_reset(), and keeping this function for single purpose which is just triggering reset on bridges. socfpga_reset_deassert_bridges_handoff() can be called for releasing reset on any bridges based on the bridge setting defined in fdt.
--- arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h | 2 +- arch/arm/mach-socfpga/reset_manager_arria10.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h +1 -1
@@ -17,7 +17,7 @@ int socfpga_reset_deassert_bridges_handoff(void);void socfpga_reset_assert_fpga_connected_peripherals (void );void socfpga_reset_deassert_osc1wd0 (void );void socfpga_reset_uart (int assert); -int socfpga_bridges_reset (int enable); +int socfpga_bridges_reset (void );struct socfpga_reset_manager {u32 stat;
arch/arm/mach-socfpga/reset_manager_arria10.c +2 -2
@@ -318,13 +318,13 @@ void socfpga_per_reset_all(void) }#if defined(CONFIG_SOCFPGA_VIRTUAL_TARGET ) -int socfpga_bridges_reset (int enable) +int socfpga_bridges_reset (void ) {/* For SoCFPGA-VT, this is NOP. */ return 0 ; }#else -int socfpga_bridges_reset (int enable) +int socfpga_bridges_reset (void ) {int ret;
Signature · 1 line
2.2.0
PATCH v11 2/6 arm: socfpga: Restructure FPGA driver in the preparation to support A10
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Move FPGA driver which is Gen5 specific code into Gen5 driver file and keeping common FPGA driver intact. All the changes are still keeping in driver/fpga/ and no functional change. Subsequent patch would move FPGA manager driver from arch/arm into driver/fpga/.
---
arch/arm/mach-socfpga/Makefile | 2 +-
arch/arm/mach-socfpga/include/mach/fpga_manager.h | 68 +-----
.../mach/{fpga_manager.h => fpga_manager_gen5.h} | 69 +++---
drivers/fpga/Makefile | 1 +
drivers/fpga/socfpga.c | 241 +--------------------
drivers/fpga/{socfpga.c => socfpga_gen5.c} | 54 +----
6 files changed, 49 insertions(+), 386 deletions(-)
copy arch/arm/mach-socfpga/include/mach/{fpga_manager.h => fpga_manager_gen5.h} (57%)
copy drivers/fpga/{socfpga.c => socfpga_gen5.c} (83%)arch/arm/mach-socfpga/Makefile +1 -1
@@ -9,7 +9,6 @@ obj-y += board.o obj-y += clock_manager.o -obj-y += fpga_manager.o obj-y += misc.o obj-y += reset_manager.o obj-y += timer.o
@@ -21,6 +20,7 @@ obj-y += reset_manager_gen5.o obj-y += scan_manager.o obj-y += system_manager_gen5.o obj-y += wrap_pll_config.o +obj-y += fpga_manager.o endif ifdef CONFIG_TARGET_SOCFPGA_ARRIA10
arch/arm/mach-socfpga/include/mach/fpga_manager.h +12 -56
84 lines not on this page · raw message
arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/fpga_manager.h +30 -39
83 lines not on this page · raw message
drivers/fpga/Makefile +1 -0
@@ -20,4 +20,5 @@ obj-$(CONFIG_FPGA_CYCLON2) += cyclon2.o obj-$(CONFIG_FPGA_STRATIX_II) += stratixII.o obj-$(CONFIG_FPGA_STRATIX_V) += stratixv.o obj-$(CONFIG_FPGA_SOCFPGA) += socfpga.o +obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += socfpga_gen5.o endif
drivers/fpga/socfpga.c +4 -237
262 lines not on this page · raw message
drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +1 -53
72 lines not on this page · raw message
Signature · 1 line
2.2.0
PATCH v11 2/6 arm: socfpga: Restructure FPGA driver in the preparation to support A10
Quoted 20 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Move FPGA driver which is Gen5 specific code into Gen5 driver file and keeping common FPGA driver intact. All the changes are still keeping in driver/fpga/ and no functional change. Subsequent patch would move FPGA manager driver from
arch/arminto driver/fpga/.Signed-off-by Tien Fong Chee <[email protected]>Reviewed-by Ley Foon Tan <[email protected]>Reviewed-by Dinh Nguyen <[email protected]>--- arch/arm/mach-socfpga/Makefile | 2 +- arch/arm/mach-socfpga/include/mach/fpga_manager.h | 68 +----- .../mach/{fpga_manager.h => fpga_manager_gen5.h} | 69 +++--- drivers/fpga/Makefile | 1 + drivers/fpga/socfpga.c | 241 +-------------------- drivers/fpga/{socfpga.c => socfpga_gen5.c} | 54 +---- 6 files changed, 49 insertions(+), 386 deletions(-) copy arch/arm/mach-socfpga/include/mach/{fpga_manager.h => fpga_manager_gen5.h} (57%) copy drivers/fpga/{socfpga.c => socfpga_gen5.c} (83%)
[...]
drivers/fpga/socfpga.c line 17
Quoted 10 lines
index f1b2f2c..5200de7 100644
drivers/fpga/socfpga.c +1
-2@@ -14,23 +14,12 @@DECLARE_GLOBAL_DATA_PTR ; -/* Timeout count */ -#define FPGA_TIMEOUT_CNT 0x1000000 +#define FPGA_TIMEOUT_CNT 0x1000000
Drop this hunk.
Quoted 12 lines
drivers/fpga/socfpga.c +0
-9static struct socfpga_fpga_manager *fpgamgr_regs = (struct socfpga_fpga_manager *)SOCFPGA_FPGAMGRREGS_ADDRESS ; -static struct socfpga_system_manager *sysmgr_regs = - (struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS ; -/* Set CD ratio */ -static void fpgamgr_set_cd_ratio (unsigned long ratio) -{ -clrsetbits_le32 (&fpgamgr_regs->ctrl, -0x3 <<FPGAMGRREGS_CTRL_CDRATIO_LSB , - (ratio &0x3 ) <<FPGAMGRREGS_CTRL_CDRATIO_LSB ); -}
[...]
Signature · 2 lines
Best regards, Marek Vasut
PATCH v11 3/6 kconfig: Convert FPGA and FPGA_ALTERA configuration to Kconfig
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
This converts the following to Kconfig:
CONFIG_FPGA
CONFIG_FPGA_ALTERA
--- configs/astro_mcf5373l_defconfig | 1 + configs/theadorable_debug_defconfig | 1 + configs/theadorable_defconfig | 1 + include/configs/astro_mcf5373l.h | 2 -- include/configs/theadorable.h | 2 -- 5 files changed, 3 insertions(+), 4 deletions(-)
configs/astro_mcf5373l_defconfig +1 -0
@@ -10,4 +10,5 @@ CONFIG_CMD_I2C=y # CONFIG_CMD_NFS is not set CONFIG_CMD_CACHE=y CONFIG_CMD_DATE=y +CONFIG_FPGA_ALTERA=y CONFIG_MTD_NOR_FLASH=y
configs/theadorable_debug_defconfig +1 -0
@@ -43,6 +43,7 @@ CONFIG_EFI_PARTITION=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y +CONFIG_FPGA_ALTERA=y CONFIG_DM_GPIO=y # CONFIG_MMC is not set CONFIG_SPI_FLASH=y
configs/theadorable_defconfig +1 -0
@@ -37,6 +37,7 @@ CONFIG_EFI_PARTITION=y # CONFIG_PARTITION_UUIDS is not set # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_SPL_OF_TRANSLATE=y +CONFIG_FPGA_ALTERA=y CONFIG_DM_GPIO=y # CONFIG_MMC is not set CONFIG_SPI_FLASH=y
include/configs/astro_mcf5373l.h +0 -2
@@ -201,10 +201,8 @@#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE#define CONFIG_FPGA_COUNT 1 -#define CONFIG_FPGA #define CONFIG_FPGA_XILINX #define CONFIG_FPGA_SPARTAN3 -#define CONFIG_FPGA_ALTERA #define CONFIG_FPGA_CYCLON2 #define CONFIG_SYS_FPGA_PROG_FEEDBACK #define CONFIG_SYS_FPGA_WAIT 1000
include/configs/theadorable.h +0 -2
@@ -89,8 +89,6 @@#define CONFIG_SYS_MEM_TOP_HIDE 0x80000/* FPGA programming support */ -#define CONFIG_FPGA -#define CONFIG_FPGA_ALTERA #define CONFIG_FPGA_STRATIX_V /*
Signature · 1 line
2.2.0
PATCH v11 3/6 kconfig: Convert FPGA and FPGA_ALTERA configuration to Kconfig
Quoted 9 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This converts the following to
Kconfig:
CONFIG_FPGA
CONFIG_FPGA_ALTERASigned-off-by Tien Fong Chee <[email protected]>Reviewed-by Ley Foon Tan <[email protected]>Reviewed-by Dinh Nguyen <[email protected]>
Did you run make savedefconfig on all these boards or did you just put the CONFIG_FPGA_ALTERA=y into their defconfigs ?
Quoted 71 lines
--- configs/astro_mcf5373l_defconfig | 1 + configs/theadorable_debug_defconfig | 1 + configs/theadorable_defconfig | 1 + include/configs/astro_mcf5373l.h | 2 -- include/configs/theadorable.h | 2 -- 5 files changed, 3 insertions(+), 4 deletions(-)configs/astro_mcf5373l_defconfig +1
-0@@ -10,4 +10,5 @@ CONFIG_CMD_I2C=y # CONFIG_CMD_NFS is not set CONFIG_CMD_CACHE=y CONFIG_CMD_DATE=y +CONFIG_FPGA_ALTERA=y CONFIG_MTD_NOR_FLASH=yconfigs/theadorable_debug_defconfig +1
-0@@ -43,6 +43,7 @@ CONFIG_EFI_PARTITION=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y +CONFIG_FPGA_ALTERA=y CONFIG_DM_GPIO=y # CONFIG_MMC is not set CONFIG_SPI_FLASH=yconfigs/theadorable_defconfig +1
-0@@ -37,6 +37,7 @@ CONFIG_EFI_PARTITION=y # CONFIG_PARTITION_UUIDS is not set # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_SPL_OF_TRANSLATE=y +CONFIG_FPGA_ALTERA=y CONFIG_DM_GPIO=y # CONFIG_MMC is not set CONFIG_SPI_FLASH=yinclude/configs/astro_mcf5373l.h +0
-2@@ -201,10 +201,8 @@#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE#define CONFIG_FPGA_COUNT 1 -#define CONFIG_FPGA #define CONFIG_FPGA_XILINX #define CONFIG_FPGA_SPARTAN3 -#define CONFIG_FPGA_ALTERA #define CONFIG_FPGA_CYCLON2 #define CONFIG_SYS_FPGA_PROG_FEEDBACK #define CONFIG_SYS_FPGA_WAIT 1000include/configs/theadorable.h +0
-2@@ -89,8 +89,6 @@#define CONFIG_SYS_MEM_TOP_HIDE 0x80000/* FPGA programming support */ -#define CONFIG_FPGA -#define CONFIG_FPGA_ALTERA #define CONFIG_FPGA_STRATIX_V /*
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v11 3/6 kconfig: Convert FPGA and FPGA_ALTERA configuration to Kconfig
Quoted 8 lines · Marek Vasut
Quoted 7 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This converts the following to
Kconfig:
CONFIG_FPGA
CONFIG_FPGA_ALTERA
Quoted 7 lines
Quoted 3 lines
Signed-off-by Tien Fong Chee <[email protected]>Reviewed-by Ley Foon Tan <[email protected]>Reviewed-by Dinh Nguyen <[email protected]>Did you run make savedefconfig on all these boards or did you just put
theCONFIG_FPGA_ALTERA=yinto their defconfigs ?
I'm not only run make defconfig. I also running compilation on all effeted defconfigs.
Quoted 78 lines
Quoted 77 lines
---
configs/astro_mcf5373l_defconfig | 1 +
configs/theadorable_debug_defconfig | 1 +
configs/theadorable_defconfig | 1 +
include/configs/astro_mcf5373l.h | 2 --
include/configs/theadorable.h | 2 --5 files changed, 3 insertions(+), 4 deletions(-)configs/astro_mcf5373l_defconfig +0
-0@@ -10,4 +10,5 @@ CONFIG_CMD_I2C=y # CONFIG_CMD_NFS is not setCONFIG_CMD_CACHE=y
CONFIG_CMD_DATE=y
+CONFIG_FPGA_ALTERA=y
CONFIG_MTD_NOR_FLASH=yconfigs/theadorable_debug_defconfig +0
-0@@ -43,6 +43,7 @@ CONFIG_EFI_PARTITION=y # CONFIG_SPL_PARTITION_UUIDS is not setCONFIG_NET_RANDOM_ETHADDR=y
CONFIG_SPL_OF_TRANSLATE=y
+CONFIG_FPGA_ALTERA=y
CONFIG_DM_GPIO=y
#CONFIG_MMCis not set
CONFIG_SPI_FLASH=yconfigs/theadorable_defconfig +0
-0@@ -37,6 +37,7 @@ CONFIG_EFI_PARTITION=y # CONFIG_PARTITION_UUIDS is not set # CONFIG_SPL_PARTITION_UUIDS is not setCONFIG_SPL_OF_TRANSLATE=y
+CONFIG_FPGA_ALTERA=y
CONFIG_DM_GPIO=y
#CONFIG_MMCis not set
CONFIG_SPI_FLASH=yinclude/configs/astro_mcf5373l.h +0
-0@@ -201,10 +201,8 @@ #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
#defineCONFIG_FPGA_COUNT1
-#defineCONFIG_FPGA
#defineCONFIG_FPGA_XILINX
#defineCONFIG_FPGA_SPARTAN3
-#defineCONFIG_FPGA_ALTERA
#defineCONFIG_FPGA_CYCLON2
#defineCONFIG_SYS_FPGA_PROG_FEEDBACK
#defineCONFIG_SYS_FPGA_WAIT1000include/configs/theadorable.h +0
-0@@ -89,8 +89,6 @@ #define CONFIG_SYS_MEM_TOP_HIDE 0x80000
/* FPGA programming support */include/configs/theadorable.h +0
-2-#define CONFIG_FPGA -#define CONFIG_FPGA_ALTERA #define
CONFIG_FPGA_STRATIX_V
/*
PATCH v11 3/6 kconfig: Convert FPGA and FPGA_ALTERA configuration to Kconfig
Quoted 12 lines · Tien Fong
Quoted 11 lines · Marek Vasut
Quoted 10 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This converts the following to
Kconfig:
CONFIG_FPGA
CONFIG_FPGA_ALTERASigned-off-by Tien Fong Chee <[email protected]>Reviewed-by Ley Foon Tan <[email protected]>Reviewed-by Dinh Nguyen <[email protected]>
Quoted 6 lines
Quoted 4 lines
Did you run make savedefconfig on all these boards or did you just put
theCONFIG_FPGA_ALTERA=yinto their defconfigs ?I'm not only run make defconfig. I also running compilation on all effeted defconfigs.
That doesn't answer my question. Did you do something like make savedefconfig
cp defconfig configs/foo_defconfig
?
Quoted 77 lines
Quoted 77 lines
Quoted 77 lines
--- configs/astro_mcf5373l_defconfig | 1 + configs/theadorable_debug_defconfig | 1 + configs/theadorable_defconfig | 1 + include/configs/astro_mcf5373l.h | 2 -- include/configs/theadorable.h | 2 -- 5 files changed, 3 insertions(+), 4 deletions(-)configs/astro_mcf5373l_defconfig +1
-0@@ -10,4 +10,5 @@ CONFIG_CMD_I2C=y # CONFIG_CMD_NFS is not set CONFIG_CMD_CACHE=y CONFIG_CMD_DATE=y +CONFIG_FPGA_ALTERA=y CONFIG_MTD_NOR_FLASH=yconfigs/theadorable_debug_defconfig +1
-0@@ -43,6 +43,7 @@ CONFIG_EFI_PARTITION=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y +CONFIG_FPGA_ALTERA=y CONFIG_DM_GPIO=y # CONFIG_MMC is not set CONFIG_SPI_FLASH=yconfigs/theadorable_defconfig +1
-0@@ -37,6 +37,7 @@ CONFIG_EFI_PARTITION=y # CONFIG_PARTITION_UUIDS is not set # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_SPL_OF_TRANSLATE=y +CONFIG_FPGA_ALTERA=y CONFIG_DM_GPIO=y # CONFIG_MMC is not set CONFIG_SPI_FLASH=yinclude/configs/astro_mcf5373l.h +0
-2@@ -201,10 +201,8 @@#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE#define CONFIG_FPGA_COUNT 1 -#define CONFIG_FPGA #define CONFIG_FPGA_XILINX #define CONFIG_FPGA_SPARTAN3 -#define CONFIG_FPGA_ALTERA #define CONFIG_FPGA_CYCLON2 #define CONFIG_SYS_FPGA_PROG_FEEDBACK #define CONFIG_SYS_FPGA_WAIT 1000include/configs/theadorable.h +0
-2@@ -89,8 +89,6 @@#define CONFIG_SYS_MEM_TOP_HIDE 0x80000/* FPGA programming support */ -#define CONFIG_FPGA -#define CONFIG_FPGA_ALTERA #define CONFIG_FPGA_STRATIX_V /*
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v11 3/6 kconfig: Convert FPGA and FPGA_ALTERA configuration to Kconfig
Quoted 21 lines · Marek Vasut
Quoted 20 lines · Tien Fong
Quoted 18 lines · Marek Vasut
Quoted 11 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This converts the following to
Kconfig:
CONFIG_FPGA
CONFIG_FPGA_ALTERASigned-off-by Tien Fong Chee <[email protected]>Reviewed-by Ley Foon Tan <[email protected]>Reviewed-by Dinh Nguyen <[email protected]>Did you run make savedefconfig on all these boards or did you just
put
theCONFIG_FPGA_ALTERA=yinto their defconfigs ?
Quoted 7 lines
Quoted 2 lines
I'm not only run make defconfig. I also running compilation on all effeted defconfigs.
That doesn't answer my question. Did you do something like make savedefconfig
cp defconfig configs/foo_defconfig
?
Sorry for confusing, i don't know make savedefconfig is for creating new defconfig based on .config until i googled it. CONFIG_FPGA_ALTERA=y was put into their defconfigs after running moveconfig script.
Quoted 81 lines
Quoted 80 lines
Quoted 80 lines
Quoted 80 lines
---
configs/astro_mcf5373l_defconfig | 1 +
configs/theadorable_debug_defconfig | 1 +
configs/theadorable_defconfig | 1 +
include/configs/astro_mcf5373l.h | 2 --
include/configs/theadorable.h | 2 --5 files changed, 3 insertions(+), 4 deletions(-)configs/astro_mcf5373l_defconfig +0
-0@@ -10,4 +10,5 @@ CONFIG_CMD_I2C=y # CONFIG_CMD_NFS is not setCONFIG_CMD_CACHE=y
CONFIG_CMD_DATE=y
+CONFIG_FPGA_ALTERA=y
CONFIG_MTD_NOR_FLASH=yconfigs/theadorable_debug_defconfig +0
-0@@ -43,6 +43,7 @@ CONFIG_EFI_PARTITION=y # CONFIG_SPL_PARTITION_UUIDS is not setCONFIG_NET_RANDOM_ETHADDR=y
CONFIG_SPL_OF_TRANSLATE=y
+CONFIG_FPGA_ALTERA=y
CONFIG_DM_GPIO=y
#CONFIG_MMCis not set
CONFIG_SPI_FLASH=yconfigs/theadorable_defconfig +0
-0@@ -37,6 +37,7 @@ CONFIG_EFI_PARTITION=y # CONFIG_PARTITION_UUIDS is not set # CONFIG_SPL_PARTITION_UUIDS is not setCONFIG_SPL_OF_TRANSLATE=y
+CONFIG_FPGA_ALTERA=y
CONFIG_DM_GPIO=y
#CONFIG_MMCis not set
CONFIG_SPI_FLASH=yinclude/configs/astro_mcf5373l.h +0
-0@@ -201,10 +201,8 @@ #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
#defineCONFIG_FPGA_COUNT1
-#defineCONFIG_FPGA
#defineCONFIG_FPGA_XILINX
#defineCONFIG_FPGA_SPARTAN3
-#defineCONFIG_FPGA_ALTERA
#defineCONFIG_FPGA_CYCLON2
#defineCONFIG_SYS_FPGA_PROG_FEEDBACK
#defineCONFIG_SYS_FPGA_WAIT1000include/configs/theadorable.h +0
-0@@ -89,8 +89,6 @@ #define CONFIG_SYS_MEM_TOP_HIDE 0x80000
/* FPGA programming support */include/configs/theadorable.h +0
-2-#define CONFIG_FPGA -#define CONFIG_FPGA_ALTERA #define
CONFIG_FPGA_STRATIX_V
/*
PATCH v11 4/6 kconfig: Convert FPGA_SOCFPGA configuration to Kconfig
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
This converts the following to Kconfig:
CONFIG_FPGA_SOCFPGA
--- configs/socfpga_arria5_defconfig | 1 + configs/socfpga_cyclone5_defconfig | 1 + configs/socfpga_de0_nano_soc_defconfig | 1 + configs/socfpga_de10_nano_defconfig | 1 + configs/socfpga_de1_soc_defconfig | 1 + configs/socfpga_is1_defconfig | 1 + configs/socfpga_mcvevk_defconfig | 1 + configs/socfpga_sockit_defconfig | 1 + configs/socfpga_socrates_defconfig | 1 + configs/socfpga_sr1500_defconfig | 1 + configs/socfpga_vining_fpga_defconfig | 1 + drivers/fpga/Kconfig | 8 ++++++++ include/configs/socfpga_common.h | 3 --- 13 files changed, 19 insertions(+), 3 deletions(-)
configs/socfpga_arria5_defconfig +1 -0
@@ -40,6 +40,7 @@ CONFIG_CMD_UBI=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_SYS_I2C_DW=y
configs/socfpga_cyclone5_defconfig +1 -0
@@ -40,6 +40,7 @@ CONFIG_CMD_UBI=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_SYS_I2C_DW=y
configs/socfpga_de0_nano_soc_defconfig +1 -0
@@ -39,6 +39,7 @@ CONFIG_CMD_FS_GENERIC=y CONFIG_CMD_UBI=y CONFIG_SPL_DM=y CONFIG_DFU_MMC=y +CONFIG_FPGA_SOCFPGA=y CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y CONFIG_SYS_I2C_DW=y
configs/socfpga_de10_nano_defconfig +1 -0
@@ -37,6 +37,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_SPL_DM=y CONFIG_DFU_MMC=y +CONFIG_FPGA_SOCFPGA=y CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y CONFIG_SYS_I2C_DW=y
configs/socfpga_de1_soc_defconfig +1 -0
@@ -38,6 +38,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_SPL_DM=y +CONFIG_FPGA_SOCFPGA=y CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y CONFIG_SYS_I2C_DW=y
configs/socfpga_is1_defconfig +1 -0
@@ -34,6 +34,7 @@ CONFIG_CMD_FS_GENERIC=y CONFIG_CMD_UBI=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_FPGA_SOCFPGA=y CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y CONFIG_SYS_I2C_DW=y
configs/socfpga_mcvevk_defconfig +1 -0
@@ -38,6 +38,7 @@ CONFIG_CMD_FS_GENERIC=y CONFIG_CMD_UBI=y CONFIG_SPL_DM=y CONFIG_DFU_MMC=y +CONFIG_FPGA_SOCFPGA=y CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y CONFIG_SYS_I2C_DW=y
configs/socfpga_sockit_defconfig +1 -0
@@ -40,6 +40,7 @@ CONFIG_CMD_UBI=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_SYS_I2C_DW=y
configs/socfpga_socrates_defconfig +1 -0
@@ -41,6 +41,7 @@ CONFIG_CMD_UBI=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_SYS_I2C_DW=y
configs/socfpga_sr1500_defconfig +1 -0
@@ -40,6 +40,7 @@ CONFIG_CMD_FS_GENERIC=y CONFIG_CMD_UBI=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_FPGA_SOCFPGA=y CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y CONFIG_SYS_I2C_DW=y
configs/socfpga_vining_fpga_defconfig +1 -0
@@ -44,6 +44,7 @@ CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_DFU_MMC=y CONFIG_DFU_RAM=y CONFIG_DFU_SF=y +CONFIG_FPGA_SOCFPGA=y CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y CONFIG_LED_STATUS=y
drivers/fpga/Kconfig +8 -0
@@ -13,6 +13,14 @@ config FPGA_ALTERA Enable Altera FPGA specific functions which includes bitstream (in BIT format), fpga and device validation. +config FPGA_SOCFPGA + bool "Enable Gen5 and Arria10 common FPGA drivers" + select FPGA_ALTERA + help + Say Y here to enable the Gen5 and Arria10 common FPGA driver + + This provides common functionality for Gen5 and Arria10 devices. + config FPGA_CYCLON2 bool "Enable Altera FPGA driver for Cyclone II" depends on FPGA_ALTERA
include/configs/socfpga_common.h +0 -3
@@ -107,9 +107,6 @@*/ #ifdef CONFIG_TARGET_SOCFPGA_GEN5 #ifdef CONFIG_CMD_FPGA -#define CONFIG_FPGA -#define CONFIG_FPGA_ALTERA -#define CONFIG_FPGA_SOCFPGA #define CONFIG_FPGA_COUNT 1#endif #endif
Signature · 1 line
2.2.0
PATCH v11 5/6 drivers: Enable FPGA driver build on SPL
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Enable FPGA driver build for SPL because FPGA driver is needed for SPL to configure and getting DDR up before loading U-boot into DDR and booting from there.
--- drivers/Makefile | 1 + 1 file changed, 1 insertion(+)
drivers/Makefile +1 -0
@@ -48,6 +48,7 @@ obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/ obj-$(CONFIG_SPL_SATA_SUPPORT) += block/ obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += block/ obj-$(CONFIG_SPL_MMC_SUPPORT) += block/ +obj-$(CONFIG_SPL_FPGA_SUPPORT) += fpga/ endif ifdef CONFIG_TPL_BUILD
Signature · 1 line
2.2.0
PATCH v11 5/6 drivers: Enable FPGA driver build on SPL
Quoted 5 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Enable FPGA driver build for SPL because FPGA driver is needed for SPL to configure and getting DDR up before loading U-boot into DDR and booting from there.
It is only needed for that on Arria 10 , not elsewhere.
Quoted 20 lines
Signed-off-by Tien Fong Chee <[email protected]>Reviewed-by Ley Foon Tan <[email protected]>Reviewed-by Dinh Nguyen <[email protected]>--- drivers/Makefile | 1 + 1 file changed, 1 insertion(+)drivers/Makefile +1
-0@@ -48,6 +48,7 @@ obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/ obj-$(CONFIG_SPL_SATA_SUPPORT) += block/ obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += block/ obj-$(CONFIG_SPL_MMC_SUPPORT) += block/ +obj-$(CONFIG_SPL_FPGA_SUPPORT) += fpga/ endif ifdef CONFIG_TPL_BUILD
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v11 5/6 drivers: Enable FPGA driver build on SPL
Quoted 10 lines · Marek Vasut
Quoted 7 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Enable FPGA driver build for SPL because FPGA driver is needed for SPL
to configure and getting DDR up before loading U-boot into DDR and booting from there.It is only needed for that on Arria 10 , not elsewhere.
Okay, i will describe clearly on commit message.
Quoted 22 lines
Quoted 21 lines
Signed-off-by Tien Fong Chee <[email protected]>Reviewed-by Ley Foon Tan <[email protected]>Reviewed-by Dinh Nguyen <[email protected]>---
drivers/Makefile | 1 +1 file changed, 1 insertion(+)drivers/Makefile +0
-0@@ -48,6 +48,7 @@ obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/obj-$(CONFIG_SPL_SATA_SUPPORT) +=
block/
obj-$(CONFIG_SPL_USB_HOST_SUPPORT) +=block/
obj-$(CONFIG_SPL_MMC_SUPPORT) +=block/
+obj-$(CONFIG_SPL_FPGA_SUPPORT) += fpga/
endif
ifdefCONFIG_TPL_BUILD
PATCH v11 6/6 arm: socfpga: Add FPGA driver support for Arria 10
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Add FPGA driver support for Arria 10.
--- arch/arm/mach-socfpga/include/mach/fpga_manager.h | 2 + .../include/mach/fpga_manager_arria10.h | 100 +++++ configs/socfpga_arria10_defconfig | 2 + drivers/fpga/Makefile | 1 + drivers/fpga/socfpga_arria10.c | 479 +++++++++++++++++++++ include/configs/socfpga_common.h | 3 +- 6 files changed, 585 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h create mode 100644 drivers/fpga/socfpga_arria10.c
arch/arm/mach-socfpga/include/mach/fpga_manager.h +2 -0
@@ -12,6 +12,8 @@#if defined(CONFIG_TARGET_SOCFPGA_GEN5 )#include <asm/arch/fpga_manager_gen5.h> +#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) +#include <asm/arch/fpga_manager_arria10.h> #endif /* FPGA CD Ratio Value */
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h new file +100 -0
100 lines not on this page · raw message
configs/socfpga_arria10_defconfig +2 -0
@@ -6,6 +6,7 @@ CONFIG_IDENT_STRING="socfpga_arria10" CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_socdk_sdmmc" CONFIG_DEFAULT_FDT_FILE="socfpga_arria10_socdk_sdmmc.dtb" CONFIG_SPL=y +CONFIG_SPL_FPGA_SUPPORT=y CONFIG_CMD_BOOTZ=y # CONFIG_CMD_IMLS is not set CONFIG_CMD_ASKENV=y
@@ -22,6 +23,7 @@ CONFIG_DOS_PARTITION=y # CONFIG_SPL_DOS_PARTITION is not set CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_FPGA_SOCFPGA=y CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y CONFIG_DM_MMC=y
drivers/fpga/Makefile +1 -0
@@ -21,4 +21,5 @@ obj-$(CONFIG_FPGA_STRATIX_II) += stratixII.o obj-$(CONFIG_FPGA_STRATIX_V) += stratixv.o obj-$(CONFIG_FPGA_SOCFPGA) += socfpga.o obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += socfpga_gen5.o +obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += socfpga_arria10.o endif
drivers/fpga/socfpga_arria10.c new file +479 -0
479 lines not on this page · raw message
include/configs/socfpga_common.h +1 -2
@@ -105,11 +105,10 @@/* * FPGA Driver */ -#ifdef CONFIG_TARGET_SOCFPGA_GEN5 #ifdef CONFIG_CMD_FPGA #define CONFIG_FPGA_COUNT 1#endif -#endif +/* * L4 OSC1 Timer 0 */
Signature · 1 line
2.2.0
PATCH v11 6/6 arm: socfpga: Add FPGA driver support for Arria 10
Quoted 7 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add FPGA driver support for Arria 10.
Signed-off-by Tien Fong Chee <[email protected]>Reviewed-by Ley Foon Tan <[email protected]>Reviewed-by Dinh Nguyen <[email protected]>
[...]
configs/socfpga_arria10_defconfig
Quoted 4 lines
configs/socfpga_arria10_defconfig +0
-0
defconfig stuff should be in separate patch.
Quoted 114 lines
configs/socfpga_arria10_defconfig +2
-0@@ -6,6 +6,7 @@ CONFIG_IDENT_STRING="socfpga_arria10" CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_socdk_sdmmc" CONFIG_DEFAULT_FDT_FILE="socfpga_arria10_socdk_sdmmc.dtb" CONFIG_SPL=y +CONFIG_SPL_FPGA_SUPPORT=y CONFIG_CMD_BOOTZ=y # CONFIG_CMD_IMLS is not set CONFIG_CMD_ASKENV=y@@ -22,6 +23,7 @@ CONFIG_DOS_PARTITION=y # CONFIG_SPL_DOS_PARTITION is not set CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_FPGA_SOCFPGA=y CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y CONFIG_DM_MMC=ydrivers/fpga/Makefile +1
-0@@ -21,4 +21,5 @@ obj-$(CONFIG_FPGA_STRATIX_II) += stratixII.o obj-$(CONFIG_FPGA_STRATIX_V) += stratixv.o obj-$(CONFIG_FPGA_SOCFPGA) += socfpga.o obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += socfpga_gen5.o +obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += socfpga_arria10.o endifdrivers/fpga/socfpga_arria10.c new file +82
-0@@ -0,0 +1,479 @@ +/* +* Copyright (C) 2017 Intel Corporation <www.intel.com> +* +* SPDX-License-Identifier: GPL-2.0 +*/ + +#include <asm/io.h> +#include <asm/arch/fpga_manager.h> +#include <asm/arch/reset_manager.h> +#include <asm/arch/system_manager.h> +#include <asm/arch/sdram.h> +#include <asm/arch/misc.h> +#include <altera.h> +#include <common.h> +#include <errno.h> +#include <wait_bit.h> +#include <watchdog.h> + +#define CFGWDTH_32 1 +#define MIN_BITSTREAM_SIZECHECK 230 +#define ENCRYPTION_OFFSET 69 +#define COMPRESSION_OFFSET 229 +#define FPGA_TIMEOUT_MSEC 1000/* timeout in ms */ +#define FPGA_TIMEOUT_CNT 0x1000000 + +DECLARE_GLOBAL_DATA_PTR ; + +static const struct socfpga_fpga_manager *fpga_manager_base = + (void *)SOCFPGA_FPGAMGRREGS_ADDRESS ; + +static const struct socfpga_system_manager *system_manager_base = + (void *)SOCFPGA_SYSMGR_ADDRESS ; + +static void fpgamgr_set_cd_ratio (unsigned long ratio); + +static uint32_t fpgamgr_get_msel (void ) +{ +u32 reg; + + reg =readl (&fpga_manager_base->imgcfg_stat); + reg = (reg &ALT_FPGAMGR_IMGCFG_STAT_F2S_MSEL_SET_MSD ) >> +ALT_FPGAMGR_IMGCFG_STAT_F2S_MSEL0_LSB ; + +return reg; +} + +static void fpgamgr_set_cfgwdth (int width) +{ +if (width) +setbits_le32 (&fpga_manager_base->imgcfg_ctrl_02, +ALT_FPGAMGR_IMGCFG_CTL_02_CFGWIDTH_SET_MSK ); +else +clrbits_le32 (&fpga_manager_base->imgcfg_ctrl_02, +ALT_FPGAMGR_IMGCFG_CTL_02_CFGWIDTH_SET_MSK ); +} + +int is_fpgamgr_user_mode (void ) +{ +return (readl (&fpga_manager_base->imgcfg_stat) & +ALT_FPGAMGR_IMGCFG_STAT_F2S_USERMODE_SET_MSK ) !=0 ; +} + +static int wait_for_user_mode (void ) +{ +return wait_for_bit (__func__, + &fpga_manager_base->imgcfg_stat, +ALT_FPGAMGR_IMGCFG_STAT_F2S_USERMODE_SET_MSK , +1 ,FPGA_TIMEOUT_MSEC , false); +} + +static int is_fpgamgr_early_user_mode (void ) +{ +return (readl (&fpga_manager_base->imgcfg_stat) & +ALT_FPGAMGR_IMGCFG_STAT_F2S_EARLY_USERMODE_SET_MSK ) !=0 ; +} + +int fpgamgr_wait_early_user_mode (void ) +{ +u32 sync_data =0xffffffff ; +u32 i =0 ; +unsigned start =get_timer (0 ); +unsigned long cd_ratio;
drivers/fpga/socfpga_arria10.c line 92
Quoted 10 lines
drivers/fpga/socfpga_arria10.c new file +10
-0+ +/* Getting existing CDRATIO */ + cd_ratio = (readl (&fpga_manager_base->imgcfg_ctrl_02) & +ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_SET_MSK ) >> +ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_LSB ; + +/* Using CDRATIO_X1 for better compatibility */ +fpgamgr_set_cd_ratio (CDRATIO_x1); + +while (!(is_fpgamgr_early_user_mode ())) {
The parens around is_fpga.... are superfluous, drop them.
Quoted 47 lines
drivers/fpga/socfpga_arria10.c new file +47
-0+if (get_timer (start) >FPGA_TIMEOUT_MSEC ) +return -ETIMEDOUT ; +fpgamgr_program_write ((const long unsigned int *)&sync_data, +sizeof (sync_data)); +udelay (FPGA_TIMEOUT_MSEC ); + i++; + } + +debug ("Additional %i sync word needed\n" , i); + +/* restoring original CDRATIO */ +fpgamgr_set_cd_ratio (cd_ratio); + +return 0 ; +} + +/* Read f2s_nconfig_pin and f2s_nstatus_pin; loop until de-asserted */ +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 +*/ +return wait_for_bit (__func__, + &fpga_manager_base->imgcfg_stat, + mask, + false,FPGA_TIMEOUT_MSEC , false); +} + +static int wait_for_f2s_nstatus_pin (unsigned long value) +{ +/* Poll until f2s to specific value, timeout at 1000ms */ +return wait_for_bit (__func__, + &fpga_manager_base->imgcfg_stat, +ALT_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN_SET_MSK , + value,FPGA_TIMEOUT_MSEC , false); +} + +/* set CD ratio */ +static void fpgamgr_set_cd_ratio (unsigned long ratio) +{ +clrbits_le32 (&fpga_manager_base->imgcfg_ctrl_02, +ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_SET_MSK ); + + setbits_le32(&fpga_manager_base->imgcfg_ctrl_02,
drivers/fpga/socfpga_arria10.c line 149
Quoted 10 lines
drivers/fpga/socfpga_arria10.c new file +10
-0+ (ratio <<ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_LSB ) & + ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_SET_MSK); +} + +/* get the MSEL value, verify we are set for FPP configuration mode */ +static int fpgamgr_verify_msel (void ) +{ +u32 msel =fpgamgr_get_msel (); + +if ((msel !=0 ) && (msel !=1 )) {
You mean if (msel & ~BIT(0)) ?
Quoted 74 lines
drivers/fpga/socfpga_arria10.c new file +74
-0+printf ("Fail: read msel=%d\n" , msel); +return -EPERM ; + } + +return 0 ; +} + +/* +* Write cdratio and cdwidth based on whether the bitstream is compressed +* and/or encoded +*/ +static int fpgamgr_set_cdratio_cdwidth (unsigned int cfg_width,u32 *rbf_data, +size_t rbf_size) +{ +unsigned int cd_ratio; +bool encrypt, compress; + +/* +* According to the bitstream specification, +* both encryption and compression status are +* in location before offset 230 of the buffer. +*/ +if (rbf_size <MIN_BITSTREAM_SIZECHECK ) +return -EINVAL ; + + encrypt = (rbf_data[ENCRYPTION_OFFSET ] >>2 ) &3 ; + encrypt = encrypt !=0 ; + + compress = (rbf_data[COMPRESSION_OFFSET ] >>1 ) &1 ; + compress = !compress; + +debug ("header word %d = %08x\n" ,69 , rbf_data[69 ]); +debug ("header word %d = %08x\n" ,229 , rbf_data[229 ]); +debug ("read from rbf header: encrypt=%d compress=%d\n" , encrypt, compress); + +/* +* from the register map description of cdratio in imgcfg_ctrl_02: +* Normal Configuration : 32bit Passive Parallel +* Partial Reconfiguration : 16bit Passive Parallel +*/ + +/* +* cd ratio is dependent on cfg width and whether the bitstream +* is encrypted and/or compressed. +* +* | width | encr. | compr. | cd ratio | +* | 16 | 0 | 0 | 1 | +* | 16 | 0 | 1 | 4 | +* | 16 | 1 | 0 | 2 | +* | 16 | 1 | 1 | 4 | +* | 32 | 0 | 0 | 1 | +* | 32 | 0 | 1 | 8 | +* | 32 | 1 | 0 | 4 | +* | 32 | 1 | 1 | 8 | +*/ +if (!compress && !encrypt) { + cd_ratio = CDRATIO_x1; + }else { +if (compress) + cd_ratio = CDRATIO_x4; +else + cd_ratio = CDRATIO_x2; + +/* if 32 bit, double the cd ratio (so register +field setting is incremented) */ +if (cfg_width ==CFGWDTH_32 ) + cd_ratio +=1 ; + } + +fpgamgr_set_cfgwdth (cfg_width); +fpgamgr_set_cd_ratio (cd_ratio); + +return 0 ; +}
[...]
include/configs/socfpga_common.h line 112
Quoted 13 lines
include/configs/socfpga_common.h +0
-2@@ -105,11 +105,10 @@/* * FPGA Driver */ -#ifdef CONFIG_TARGET_SOCFPGA_GEN5 #ifdef CONFIG_CMD_FPGA #define CONFIG_FPGA_COUNT 1#endif -#endif
Should be in separate patch, cf above.
Quoted 4 lines
include/configs/socfpga_common.h +0
-0/* * L4 OSC1 Timer 0 */
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v11 6/6 arm: socfpga: Add FPGA driver support for Arria 10
Quoted 12 lines · Marek Vasut
Quoted 8 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add FPGA driver support for Arria 10.
Signed-off-by Tien Fong Chee <[email protected]>Reviewed-by Ley Foon Tan <[email protected]>Reviewed-by Dinh Nguyen <[email protected]>[...]
Quoted 1 line
Quoted 7 lines
configs/socfpga_arria10_defconfig
Quoted 5 lines
configs/socfpga_arria10_defconfig +0
-0defconfig stuff should be in separate patch.
Okay.
Quoted 282 lines
Quoted 120 lines
configs/socfpga_arria10_defconfig +0
-0@@ -6,6 +6,7 @@ CONFIG_IDENT_STRING="socfpga_arria10"CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_socdk_sdmmc"
CONFIG_DEFAULT_FDT_FILE="socfpga_arria10_socdk_sdmmc.dtb"CONFIG_SPL=y
+CONFIG_SPL_FPGA_SUPPORT=y
CONFIG_CMD_BOOTZ=y
#CONFIG_CMD_IMLSis not set
CONFIG_CMD_ASKENV=yconfigs/socfpga_arria10_defconfig +0
-0@@ -22,6 +23,7 @@ CONFIG_DOS_PARTITION=y # CONFIG_SPL_DOS_PARTITION is not setCONFIG_SPL_DM=y
CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_FPGA_SOCFPGA=y
CONFIG_DM_GPIO=y
CONFIG_DWAPB_GPIO=y
CONFIG_DM_MMC=ydrivers/fpga/Makefile +0
-0@@ -21,4 +21,5 @@ obj-$(CONFIG_FPGA_STRATIX_II) += stratixII.oobj-$(CONFIG_FPGA_STRATIX_V) += stratixv.o obj-$(CONFIG_FPGA_SOCFPGA) += socfpga.o obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += socfpga_gen5.o +obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += socfpga_arria10.o endif
drivers/fpga/socfpga_arria10.c new file +51
-0@@ -0,0 +1,479 @@ +/* +* Copyright (C) 2017 Intel Corporation <www.intel.com> +* +* SPDX-License-Identifier: GPL-2.0 +*/ + +#include <asm/io.h> +#include <asm/arch/fpga_manager.h> +#include <asm/arch/reset_manager.h> +#include <asm/arch/system_manager.h> +#include <asm/arch/sdram.h> +#include <asm/arch/misc.h> +#include <altera.h> +#include <common.h> +#include <errno.h> +#include <wait_bit.h> +#include <watchdog.h> + +#define CFGWDTH_32 1 +#define MIN_BITSTREAM_SIZECHECK 230 +#define ENCRYPTION_OFFSET 69 +#define COMPRESSION_OFFSET 229 +#define FPGA_TIMEOUT_MSEC 1000/* timeout in ms */ +#define FPGA_TIMEOUT_CNT 0x1000000 + +DECLARE_GLOBAL_DATA_PTR ; + +static const struct socfpga_fpga_manager *fpga_manager_base = + (void *)SOCFPGA_FPGAMGRREGS_ADDRESS ; + +static const struct socfpga_system_manager *system_manager_base = + (void *)SOCFPGA_SYSMGR_ADDRESS ; + +static void fpgamgr_set_cd_ratio (unsigned long ratio); + +static uint32_t fpgamgr_get_msel (void ) +{ +u32 reg; + + reg =readl (&fpga_manager_base->imgcfg_stat); + reg = (reg &ALT_FPGAMGR_IMGCFG_STAT_F2S_MSEL_SET_MSD ) >> +ALT_FPGAMGR_IMGCFG_STAT_F2S_MSEL0_LSB ; + +return reg; +} + +static void fpgamgr_set_cfgwdth (int width) +{ +if (width) +setbits_le32 (&fpga_manager_base->imgcfg_ctrl_02, + ALT_FPGAMGR_IMGCFG_CTL_02_CFGWIDTH_SET_MSK);
drivers/fpga/socfpga_arria10.c new file +3
-0+else +clrbits_le32 (&fpga_manager_base->imgcfg_ctrl_02, + ALT_FPGAMGR_IMGCFG_CTL_02_CFGWIDTH_SET_MSK);
drivers/fpga/socfpga_arria10.c new file +6
-0+} + +int is_fpgamgr_user_mode (void ) +{ +return (readl (&fpga_manager_base->imgcfg_stat) & + ALT_FPGAMGR_IMGCFG_STAT_F2S_USERMODE_SET_MSK) !=0;
drivers/fpga/socfpga_arria10.c new file +14
-0+} + +static int wait_for_user_mode (void ) +{ +return wait_for_bit (__func__, + &fpga_manager_base->imgcfg_stat, +ALT_FPGAMGR_IMGCFG_STAT_F2S_USERMODE_SET_MSK , +1 ,FPGA_TIMEOUT_MSEC , false); +} + +static int is_fpgamgr_early_user_mode (void ) +{ +return (readl (&fpga_manager_base->imgcfg_stat) & + ALT_FPGAMGR_IMGCFG_STAT_F2S_EARLY_USERMODE_SET_MSK) != 0;
drivers/fpga/socfpga_arria10.c new file +8
-0+} + +int fpgamgr_wait_early_user_mode (void ) +{ +u32 sync_data =0xffffffff ; +u32 i =0 ; +unsigned start =get_timer (0 ); +unsigned long cd_ratio;drivers/fpga/socfpga_arria10.c line 92
Quoted 10 lines
drivers/fpga/socfpga_arria10.c new file +10
-0+ +/* Getting existing CDRATIO */ + cd_ratio = (readl (&fpga_manager_base->imgcfg_ctrl_02) & +ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_SET_MSK ) >> +ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_LSB ; + +/* Using CDRATIO_X1 for better compatibility */ +fpgamgr_set_cd_ratio (CDRATIO_x1); + +while (!(is_fpgamgr_early_user_mode ())) {The parens around
is_fpga.... are superfluous, drop them.Quoted 60 lines
drivers/fpga/socfpga_arria10.c new file +3
-0+if (get_timer (start) >FPGA_TIMEOUT_MSEC ) +return -ETIMEDOUT ; + fpgamgr_program_write((const long unsigned int*)&sync_data,
drivers/fpga/socfpga_arria10.c new file +14
-0+ sizeof(sync_data)); +udelay (FPGA_TIMEOUT_MSEC ); + i++; + } + +debug ("Additional %i sync word needed\n" , i); + +/* restoring original CDRATIO */ +fpgamgr_set_cd_ratio (cd_ratio); + +return 0 ; +} + +/* Read f2s_nconfig_pin and f2s_nstatus_pin; loop until de- asserted */
drivers/fpga/socfpga_arria10.c new file +3
-0+static int wait_for_nconfig_pin_and_nstatus_pin (void ) +{ + unsigned long mask =
ALT_FPGAMGR_IMGCFG_STAT_F2S_NCONFIG_PIN_SET_MSK|drivers/fpga/socfpga_arria10.c new file +1
-0+ALT_FPGAMGR_IMGCFG_STAT_F2S_NSTATU
S_PIN_SET_MSK;drivers/fpga/socfpga_arria10.c new file +2
-0+ +/* Poll until f2s_nconfig_pin and f2s_nstatus_pin; loop until de-asserted,
drivers/fpga/socfpga_arria10.c new file +14
-0+* timeout at 1000ms +*/ +return wait_for_bit (__func__, + &fpga_manager_base->imgcfg_stat, + mask, + false, FPGA_TIMEOUT_MSEC, false); +} + +static int wait_for_f2s_nstatus_pin (unsigned long value) +{ +/* Poll until f2s to specific value, timeout at 1000ms */ +return wait_for_bit (__func__, + &fpga_manager_base->imgcfg_stat, + ALT_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PI
N_SET_MSK,drivers/fpga/socfpga_arria10.c new file +15
-0+ value, FPGA_TIMEOUT_MSEC, false); +} + +/* set CD ratio */ +static void fpgamgr_set_cd_ratio (unsigned long ratio) +{ +clrbits_le32 (&fpga_manager_base->imgcfg_ctrl_02, +ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_SET_MSK ); + +setbits_le32 (&fpga_manager_base->imgcfg_ctrl_02, + (ratio <<ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_LSB ) & +ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_SET_MSK ); +} + +/* get the MSEL value, verify we are set for FPP configuration mode */
drivers/fpga/socfpga_arria10.c line 149
Quoted 5 lines
drivers/fpga/socfpga_arria10.c new file +5
-0+static int fpgamgr_verify_msel (void ) +{ +u32 msel =fpgamgr_get_msel (); + +if ((msel !=0 ) && (msel !=1 )) {You mean if (msel & ~BIT(0)) ?
Quoted 80 lines
drivers/fpga/socfpga_arria10.c new file +9
-0+printf ("Fail: read msel=%d\n" , msel); +return -EPERM ; + } + +return 0 ; +} + +/* +* Write cdratio and cdwidth based on whether the bitstream is compressed
+ * and/or encoded
+ */
+static int fpgamgr_set_cdratio_cdwidth(unsigned intcfg_width, u32*rbf_data,drivers/fpga/socfpga_arria10.c new file +22
-0+ size_t rbf_size) +{ +unsigned int cd_ratio; +bool encrypt, compress; + +/* +* According to the bitstream specification, +* both encryption and compression status are +* in location before offset 230 of the buffer. +*/ +if (rbf_size <MIN_BITSTREAM_SIZECHECK ) +return -EINVAL ; + + encrypt = (rbf_data[ENCRYPTION_OFFSET ] >>2 ) &3 ; + encrypt = encrypt !=0 ; + + compress = (rbf_data[COMPRESSION_OFFSET ] >>1 ) &1 ; + compress = !compress; + +debug ("header word %d = %08x\n" ,69 , rbf_data[69 ]); +debug ("header word %d = %08x\n" ,229 , rbf_data[229 ]); + debug("read from rbf header: encrypt=%d compress=%d\n",encrypt, compress);
drivers/fpga/socfpga_arria10.c new file +3
-0+ +/* +* from the register map description of cdratio in
imgcfg_ctrl_02:drivers/fpga/socfpga_arria10.c new file +6
-0+* Normal Configuration : 32bit Passive Parallel +* Partial Reconfiguration : 16bit Passive Parallel +*/ + +/* +* cd ratio is dependent on cfg width and whether the bitstream
drivers/fpga/socfpga_arria10.c new file +31
-0+* is encrypted and/or compressed. +* +* | width | encr. | compr. | cd ratio | +* | 16 | 0 | 0 | 1 | +* | 16 | 0 | 1 | 4 | +* | 16 | 1 | 0 | 2 | +* | 16 | 1 | 1 | 4 | +* | 32 | 0 | 0 | 1 | +* | 32 | 0 | 1 | 8 | +* | 32 | 1 | 0 | 4 | +* | 32 | 1 | 1 | 8 | +*/ +if (!compress && !encrypt) { + cd_ratio = CDRATIO_x1; + }else { +if (compress) + cd_ratio = CDRATIO_x4; +else + cd_ratio = CDRATIO_x2; + +/* if 32 bit, double the cd ratio (so register +field setting is incremented) */ +if (cfg_width ==CFGWDTH_32 ) + cd_ratio +=1 ; + } + +fpgamgr_set_cfgwdth (cfg_width); +fpgamgr_set_cd_ratio (cd_ratio); + +return 0 ; +}[...]
Quoted 1 line
Quoted 16 lines
Quoted 6 lines
include/configs/socfpga_common.h +0
-0include/configs/socfpga_common.h line 112
Quoted 8 lines
include/configs/socfpga_common.h +0
-2@@ -105,11 +105,10 @@ /* * FPGA Driver */ -#ifdef CONFIG_TARGET_SOCFPGA_GEN5 #ifdef CONFIG_CMD_FPGA #define CONFIG_FPGA_COUNT 1 #endif -#endif Should be in separate patch, cf above.
Okay.
Quoted 6 lines
Quoted 5 lines
include/configs/socfpga_common.h +0
-0/** L4 OSC1 Timer 0 */
Chee
PATCH v11 6/6 arm: socfpga: Add FPGA driver support for Arria 10
In reply to Marek VasutQuoted 12 lines · Marek Vasut
Quoted 8 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add FPGA driver support for Arria 10.
Signed-off-by Tien Fong Chee <[email protected]>Reviewed-by Ley Foon Tan <[email protected]>Reviewed-by Dinh Nguyen <[email protected]>[...]
Quoted 1 line
Quoted 7 lines
configs/socfpga_arria10_defconfig
Quoted 5 lines
configs/socfpga_arria10_defconfig +0
-0defconfig stuff should be in separate patch.
Okay.
Quoted 123 lines
Quoted 123 lines
configs/socfpga_arria10_defconfig +0
-0@@ -6,6 +6,7 @@ CONFIG_IDENT_STRING="socfpga_arria10"CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_socdk_sdmmc"
CONFIG_DEFAULT_FDT_FILE="socfpga_arria10_socdk_sdmmc.dtb"CONFIG_SPL=y
+CONFIG_SPL_FPGA_SUPPORT=y
CONFIG_CMD_BOOTZ=y
#CONFIG_CMD_IMLSis not set
CONFIG_CMD_ASKENV=yconfigs/socfpga_arria10_defconfig +0
-0@@ -22,6 +23,7 @@ CONFIG_DOS_PARTITION=y # CONFIG_SPL_DOS_PARTITION is not setCONFIG_SPL_DM=y
CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_FPGA_SOCFPGA=y
CONFIG_DM_GPIO=y
CONFIG_DWAPB_GPIO=y
CONFIG_DM_MMC=ydrivers/fpga/Makefile +0
-0@@ -21,4 +21,5 @@ obj-$(CONFIG_FPGA_STRATIX_II) += stratixII.oobj-$(CONFIG_FPGA_STRATIX_V) += stratixv.o obj-$(CONFIG_FPGA_SOCFPGA) += socfpga.o obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += socfpga_gen5.o +obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += socfpga_arria10.o endif
drivers/fpga/socfpga_arria10.c new file +51
-0@@ -0,0 +1,479 @@ +/* +* Copyright (C) 2017 Intel Corporation <www.intel.com> +* +* SPDX-License-Identifier: GPL-2.0 +*/ + +#include <asm/io.h> +#include <asm/arch/fpga_manager.h> +#include <asm/arch/reset_manager.h> +#include <asm/arch/system_manager.h> +#include <asm/arch/sdram.h> +#include <asm/arch/misc.h> +#include <altera.h> +#include <common.h> +#include <errno.h> +#include <wait_bit.h> +#include <watchdog.h> + +#define CFGWDTH_32 1 +#define MIN_BITSTREAM_SIZECHECK 230 +#define ENCRYPTION_OFFSET 69 +#define COMPRESSION_OFFSET 229 +#define FPGA_TIMEOUT_MSEC 1000/* timeout in ms */ +#define FPGA_TIMEOUT_CNT 0x1000000 + +DECLARE_GLOBAL_DATA_PTR ; + +static const struct socfpga_fpga_manager *fpga_manager_base = + (void *)SOCFPGA_FPGAMGRREGS_ADDRESS ; + +static const struct socfpga_system_manager *system_manager_base = + (void *)SOCFPGA_SYSMGR_ADDRESS ; + +static void fpgamgr_set_cd_ratio (unsigned long ratio); + +static uint32_t fpgamgr_get_msel (void ) +{ +u32 reg; + + reg =readl (&fpga_manager_base->imgcfg_stat); + reg = (reg &ALT_FPGAMGR_IMGCFG_STAT_F2S_MSEL_SET_MSD ) >> +ALT_FPGAMGR_IMGCFG_STAT_F2S_MSEL0_LSB ; + +return reg; +} + +static void fpgamgr_set_cfgwdth (int width) +{ +if (width) +setbits_le32 (&fpga_manager_base->imgcfg_ctrl_02, + ALT_FPGAMGR_IMGCFG_CTL_02_CFGWIDTH_SET_MSK);
drivers/fpga/socfpga_arria10.c new file +3
-0+else +clrbits_le32 (&fpga_manager_base->imgcfg_ctrl_02, + ALT_FPGAMGR_IMGCFG_CTL_02_CFGWIDTH_SET_MSK);
drivers/fpga/socfpga_arria10.c new file +6
-0+} + +int is_fpgamgr_user_mode (void ) +{ +return (readl (&fpga_manager_base->imgcfg_stat) & + ALT_FPGAMGR_IMGCFG_STAT_F2S_USERMODE_SET_MSK) !=0;
drivers/fpga/socfpga_arria10.c new file +14
-0+} + +static int wait_for_user_mode (void ) +{ +return wait_for_bit (__func__, + &fpga_manager_base->imgcfg_stat, +ALT_FPGAMGR_IMGCFG_STAT_F2S_USERMODE_SET_MSK , +1 ,FPGA_TIMEOUT_MSEC , false); +} + +static int is_fpgamgr_early_user_mode (void ) +{ +return (readl (&fpga_manager_base->imgcfg_stat) & + ALT_FPGAMGR_IMGCFG_STAT_F2S_EARLY_USERMODE_SET_MSK) != 0;
drivers/fpga/socfpga_arria10.c new file +11
-0+} + +int fpgamgr_wait_early_user_mode (void ) +{ +u32 sync_data =0xffffffff ; +u32 i =0 ; +unsigned start =get_timer (0 ); +unsigned long cd_ratio; + +/* Getting existing CDRATIO */ + cd_ratio = (readl(&fpga_manager_base->imgcfg_ctrl_02) &
Quoted 9 lines
drivers/fpga/socfpga_arria10.c line 92
Quoted 7 lines
drivers/fpga/socfpga_arria10.c new file +7
-0+ ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_SET_MSK) >> +ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_LSB ; + +/* Using CDRATIO_X1 for better compatibility */ +fpgamgr_set_cd_ratio (CDRATIO_x1); + +while (!(is_fpgamgr_early_user_mode ())) {The parens around
is_fpga.... are superfluous, drop them.
Okay.
Quoted 58 lines
Quoted 58 lines
drivers/fpga/socfpga_arria10.c new file +3
-0+if (get_timer (start) >FPGA_TIMEOUT_MSEC ) +return -ETIMEDOUT ; + fpgamgr_program_write((const long unsigned int*)&sync_data,
drivers/fpga/socfpga_arria10.c new file +14
-0+ sizeof(sync_data)); +udelay (FPGA_TIMEOUT_MSEC ); + i++; + } + +debug ("Additional %i sync word needed\n" , i); + +/* restoring original CDRATIO */ +fpgamgr_set_cd_ratio (cd_ratio); + +return 0 ; +} + +/* Read f2s_nconfig_pin and f2s_nstatus_pin; loop until de- asserted */
drivers/fpga/socfpga_arria10.c new file +3
-0+static int wait_for_nconfig_pin_and_nstatus_pin (void ) +{ + unsigned long mask =
ALT_FPGAMGR_IMGCFG_STAT_F2S_NCONFIG_PIN_SET_MSK|drivers/fpga/socfpga_arria10.c new file +1
-0+ALT_FPGAMGR_IMGCFG_STAT_F2S_NSTATU
S_PIN_SET_MSK;drivers/fpga/socfpga_arria10.c new file +2
-0+ +/* Poll until f2s_nconfig_pin and f2s_nstatus_pin; loop until de-asserted,
drivers/fpga/socfpga_arria10.c new file +14
-0+* timeout at 1000ms +*/ +return wait_for_bit (__func__, + &fpga_manager_base->imgcfg_stat, + mask, + false, FPGA_TIMEOUT_MSEC, false); +} + +static int wait_for_f2s_nstatus_pin (unsigned long value) +{ +/* Poll until f2s to specific value, timeout at 1000ms */ +return wait_for_bit (__func__, + &fpga_manager_base->imgcfg_stat, + ALT_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PI
N_SET_MSK,drivers/fpga/socfpga_arria10.c new file +14
-0+ value, FPGA_TIMEOUT_MSEC, false); +} + +/* set CD ratio */ +static void fpgamgr_set_cd_ratio (unsigned long ratio) +{ +clrbits_le32 (&fpga_manager_base->imgcfg_ctrl_02, +ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_SET_MSK ); + +setbits_le32 (&fpga_manager_base->imgcfg_ctrl_02, + (ratio <<ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_LSB ) & +ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_SET_MSK ); +} +
Quoted 9 lines
drivers/fpga/socfpga_arria10.c line 149
Quoted 7 lines
+/* get the MSEL value, verify we are set for FPP configuration mode */
drivers/fpga/socfpga_arria10.c new file +5
-0+static int fpgamgr_verify_msel (void ) +{ +u32 msel =fpgamgr_get_msel (); + +if ((msel !=0 ) && (msel !=1 )) {You mean if (msel & ~BIT(0)) ?
yes.
Quoted 83 lines
Quoted 80 lines
drivers/fpga/socfpga_arria10.c new file +9
-0+printf ("Fail: read msel=%d\n" , msel); +return -EPERM ; + } + +return 0 ; +} + +/* +* Write cdratio and cdwidth based on whether the bitstream is compressed
+ * and/or encoded
+ */
+static int fpgamgr_set_cdratio_cdwidth(unsigned intcfg_width, u32*rbf_data,drivers/fpga/socfpga_arria10.c new file +22
-0+ size_t rbf_size) +{ +unsigned int cd_ratio; +bool encrypt, compress; + +/* +* According to the bitstream specification, +* both encryption and compression status are +* in location before offset 230 of the buffer. +*/ +if (rbf_size <MIN_BITSTREAM_SIZECHECK ) +return -EINVAL ; + + encrypt = (rbf_data[ENCRYPTION_OFFSET ] >>2 ) &3 ; + encrypt = encrypt !=0 ; + + compress = (rbf_data[COMPRESSION_OFFSET ] >>1 ) &1 ; + compress = !compress; + +debug ("header word %d = %08x\n" ,69 , rbf_data[69 ]); +debug ("header word %d = %08x\n" ,229 , rbf_data[229 ]); + debug("read from rbf header: encrypt=%d compress=%d\n",encrypt, compress);
drivers/fpga/socfpga_arria10.c new file +3
-0+ +/* +* from the register map description of cdratio in
imgcfg_ctrl_02:drivers/fpga/socfpga_arria10.c new file +6
-0+* Normal Configuration : 32bit Passive Parallel +* Partial Reconfiguration : 16bit Passive Parallel +*/ + +/* +* cd ratio is dependent on cfg width and whether the bitstream
drivers/fpga/socfpga_arria10.c new file +31
-0+* is encrypted and/or compressed. +* +* | width | encr. | compr. | cd ratio | +* | 16 | 0 | 0 | 1 | +* | 16 | 0 | 1 | 4 | +* | 16 | 1 | 0 | 2 | +* | 16 | 1 | 1 | 4 | +* | 32 | 0 | 0 | 1 | +* | 32 | 0 | 1 | 8 | +* | 32 | 1 | 0 | 4 | +* | 32 | 1 | 1 | 8 | +*/ +if (!compress && !encrypt) { + cd_ratio = CDRATIO_x1; + }else { +if (compress) + cd_ratio = CDRATIO_x4; +else + cd_ratio = CDRATIO_x2; + +/* if 32 bit, double the cd ratio (so register +field setting is incremented) */ +if (cfg_width ==CFGWDTH_32 ) + cd_ratio +=1 ; + } + +fpgamgr_set_cfgwdth (cfg_width); +fpgamgr_set_cd_ratio (cd_ratio); + +return 0 ; +}[...]
Quoted 1 line
Quoted 16 lines
Quoted 6 lines
include/configs/socfpga_common.h +0
-0include/configs/socfpga_common.h line 112
Quoted 8 lines
include/configs/socfpga_common.h +0
-2@@ -105,11 +105,10 @@ /* * FPGA Driver */ -#ifdef CONFIG_TARGET_SOCFPGA_GEN5 #ifdef CONFIG_CMD_FPGA #define CONFIG_FPGA_COUNT 1 #endif -#endif Should be in separate patch, cf above.
okay.
Quoted 6 lines
Quoted 5 lines
include/configs/socfpga_common.h +0
-0/** L4 OSC1 Timer 0 */
Chee
v11 cover Add Intel Arria 10 SoC FPGA driver
In reply to tien.fong.chee at intel.comQuoted 40 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This is the 11th version of patchset to adds support for Intel Arria 10 SoC FPGA
driver. This version mainly resolved comments from Dinh in [v10]. This series is
working on top of u-boot-socfpga.git - http://git.denx.de/u-boot-socf
pga.git[v10]: https://www.mail-archive.com/u-boot at lists.denx.de/msg252583.ht ml
v10 -> v11 changes:
-----------------
- Changed the commit header of patch 3 and patch 4 to "kconfig:", previously was
"arm: socfpga:".
- Cleaned up commit old message on patch 5.Patchset history
----------------
[v1]: https://www.mail-archive.com/u-boot at lists.denx.de/msg247788.htm l
[v2]: https://www.mail-archive.com/u-boot at lists.denx.de/msg248541.htm l
[v3]: https://www.mail-archive.com/u-boot at lists.denx.de/msg249160.htm l
[v4]: https://www.mail-archive.com/u-boot at lists.denx.de/msg250149.htm l
[v5]: https://www.mail-archive.com/u-boot at lists.denx.de/msg250517.htm l
[v6]: https://www.mail-archive.com/u-boot at lists.denx.de/msg250687.htm l
[v7]: https://www.mail-archive.com/u-boot at lists.denx.de/msg251213.htm l
[v8]: https://www.mail-archive.com/u-boot at lists.denx.de/msg252196.htm l
[v9]: https://www.mail-archive.com/u-boot at lists.denx.de/msg252422.htm l
Quoted 3 lines
Reviewed-by Ley Foon Tan <[email protected]>Reviewed-by Dinh Nguyen <[email protected]>
Dear all reviewers,
Any comment on this patchset?
Thanks.
Quoted 49 lines
Tien Fong Chee (6):
arm: socfpga: Remove unused passing parameter ofsocfpga_bridges_reset
arm: socfpga: Restructure FPGA driver in the preparation to support A10
kconfig: Convert FPGA andFPGA_ALTERAconfiguration toKconfig
kconfig: ConvertFPGA_SOCFPGAconfiguration toKconfig
drivers: Enable FPGA driver build on SPL
arm: socfpga: Add FPGA driver support for Arria 10arch/arm/mach-socfpga/Makefile | 2 +- arch/arm/mach-socfpga/include/mach/fpga_manager.h | 70 +-- .../include/mach/fpga_manager_arria10.h | 100 +++++
.../mach/{fpga_manager.h=> fpga_manager_gen5.h} | 69 ++- .../include/mach/reset_manager_arria10.h | 2 +- arch/arm/mach-socfpga/reset_manager_arria10.c | 4 +- configs/astro_mcf5373l_defconfig | 1 + configs/socfpga_arria10_defconfig | 2 + configs/socfpga_arria5_defconfig | 1 + configs/socfpga_cyclone5_defconfig | 1 + configs/socfpga_de0_nano_soc_defconfig | 1 + configs/socfpga_de10_nano_defconfig | 1 + configs/socfpga_de1_soc_defconfig | 1 + configs/socfpga_is1_defconfig | 1 + configs/socfpga_mcvevk_defconfig | 1 + configs/socfpga_sockit_defconfig | 1 + configs/socfpga_socrates_defconfig | 1 + configs/socfpga_sr1500_defconfig | 1 + configs/socfpga_vining_fpga_defconfig | 1 + configs/theadorable_debug_defconfig | 1 + configs/theadorable_defconfig | 1 + drivers/Makefile | 1 + drivers/fpga/Kconfig | 8 + drivers/fpga/Makefile | 2 + drivers/fpga/socfpga.c | 241 +---------- drivers/fpga/socfpga_arria10.c | 479
+++++++++++++++++++++
drivers/fpga/{socfpga.c => socfpga_gen5.c} | 54 +-- include/configs/astro_mcf5373l.h | 2 - include/configs/socfpga_common.h | 6 +- include/configs/theadorable.h | 2 -30 files changed, 660 insertions(+), 398 deletions(-)create mode 100644
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
copyarch/arm/mach-socfpga/include/mach/{fpga_manager.h=>fpga_manager_gen5.h} (57%)
create mode 100644drivers/fpga/socfpga_arria10.ccopydrivers/fpga/{socfpga.c=>socfpga_gen5.c} (83%)
v11 cover Add Intel Arria 10 SoC FPGA driver
Quoted 41 lines · Tien Fong
Quoted 40 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This is the 11th version of patchset to adds support for Intel Arria 10 SoC FPGA
driver. This version mainly resolved comments from Dinh in [v10]. This series is
working on top of u-boot-socfpga.git - http://git.denx.de/u-boot-socf
pga.git[v10]: https://www.mail-archive.com/u-boot at lists.denx.de/msg252583.ht ml
v10 -> v11 changes:
-----------------
- Changed the commit header of patch 3 and patch 4 to "kconfig:", previously was
"arm: socfpga:".
- Cleaned up commit old message on patch 5.Patchset history
----------------
[v1]: https://www.mail-archive.com/u-boot at lists.denx.de/msg247788.htm l
[v2]: https://www.mail-archive.com/u-boot at lists.denx.de/msg248541.htm l
[v3]: https://www.mail-archive.com/u-boot at lists.denx.de/msg249160.htm l
[v4]: https://www.mail-archive.com/u-boot at lists.denx.de/msg250149.htm l
[v5]: https://www.mail-archive.com/u-boot at lists.denx.de/msg250517.htm l
[v6]: https://www.mail-archive.com/u-boot at lists.denx.de/msg250687.htm l
[v7]: https://www.mail-archive.com/u-boot at lists.denx.de/msg251213.htm l
[v8]: https://www.mail-archive.com/u-boot at lists.denx.de/msg252196.htm l
[v9]: https://www.mail-archive.com/u-boot at lists.denx.de/msg252422.htm l
Quoted 6 lines
Quoted 3 lines
Reviewed-by Ley Foon Tan <[email protected]>Reviewed-by Dinh Nguyen <[email protected]>Dear all reviewers,
Any comment on this patchset?
Unless Dinh has comments, one more iteration should do.
Signature · 2 lines
Best regards, Marek Vasut
Chee
v11 cover Add Intel Arria 10 SoC FPGA driver
Quoted 56 lines · Marek Vasut
Quoted 55 lines · Tien Fong
Quoted 53 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This is the 11th version of patchset to adds support for Intel Arria
10 SoC FPGA
driver. This version mainly resolved comments from Dinh in [v10]. This series is
working on top of u-boot-socfpga.git - http://git.denx.de/u-boot-
socf
pga.git[v10]: https://www.mail-archive.com/u-boot at lists.denx.de/msg25258 3.ht
mlv10 -> v11 changes:
-----------------
- Changed the commit header of patch 3 and patch 4 to "kconfig:", previously was
 "arm: socfpga:".
- Cleaned up commit old message on patch 5.Patchset history
----------------
[v1]: https://www.mail-archive.com/u-boot at lists.denx.de/msg247788 .htm
l
[v2]: https://www.mail-archive.com/u-boot at lists.denx.de/msg248541 .htm
l
[v3]: https://www.mail-archive.com/u-boot at lists.denx.de/msg249160 .htm
l
[v4]: https://www.mail-archive.com/u-boot at lists.denx.de/msg250149 .htm
l
[v5]: https://www.mail-archive.com/u-boot at lists.denx.de/msg250517 .htm
l
[v6]: https://www.mail-archive.com/u-boot at lists.denx.de/msg250687 .htm
l
[v7]: https://www.mail-archive.com/u-boot at lists.denx.de/msg251213 .htm
l
[v8]: https://www.mail-archive.com/u-boot at lists.denx.de/msg252196 .htm
l
[v9]: https://www.mail-archive.com/u-boot at lists.denx.de/msg252422 .htm
l
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Reviewed-by Ley Foon Tan <[email protected]>Reviewed-by Dinh Nguyen <[email protected]>Dear all reviewers,
Any comment on this patchset?
Unless Dinh has comments, one more iteration should do.
Glad to hear that.
Dear Dinh,
Do you have any comment on this patchset?
Thanks.