Add Intel Arria 10 SoC FPGA driver
Subsystems (5)
cover Add Intel Arria 10 SoC FPGA driver
From: Tien Fong Chee <[email protected]>
This patchset adds FPGA driver to Intel Arria 10 SoC.
This series is working on top of u-boot-socfpga-next branch
http://git.denx.de/?p=u-boot/u-boot-socfpga.git;a=shortlog;h=refs/heads/next.
Tien Fong Chee (7):
arm: socfpga: Remove unused passing parameter of
socfpga_bridges_reset
arm: socfpga: Convert FPGA configuration to Kconfig method.
arm: socfpga: Restructure FPGA driver in the preparation to support
A10.
arm: socfpga: Move FPGA manager driver to FPGA driver
arm: socfpga: Move the FPGA driver header from arch to include
directory
arm: socfpga: Add Arria10 FPGA manager program assembly driver
arm: socfpga: Add FPGA driver support for Arria 10
arch/arm/mach-socfpga/Makefile | 2 +-
arch/arm/mach-socfpga/fpga_manager.c | 78 ---
arch/arm/mach-socfpga/include/mach/fpga_manager.h | 65 +---
.../mach/{fpga_manager.h => fpga_manager_gen5.h} | 69 ++--
.../include/mach/reset_manager_arria10.h | 2 +-
arch/arm/mach-socfpga/lowlevel_init.S | 48 ++
arch/arm/mach-socfpga/reset_manager_arria10.c | 6 +-
arch/arm/mach-socfpga/reset_manager_gen5.c | 5 +-
arch/arm/mach-socfpga/system_manager_gen5.c | 2 +-
drivers/Makefile | 1 +
drivers/ddr/altera/sdram.c | 7 +-
drivers/fpga/Kconfig | 5 +-
drivers/fpga/Makefile | 5 +-
drivers/fpga/socfpga.c | 269 +-----------
drivers/fpga/socfpga_arria10.c | 490 ++++++++++++++++++++
drivers/fpga/{socfpga.c => socfpga_gen5.c} | 75 ++-
include/altera.h | 2 +-
include/configs/socfpga_common.h | 3 -
include/intel_socfpga/fpga_manager.h | 38 ++
include/intel_socfpga/fpga_manager_arria10.h | 107 +++++
.../intel_socfpga/fpga_manager_gen5.h | 69 ++--
21 files changed, 831 insertions(+), 517 deletions(-)
delete mode 100644 arch/arm/mach-socfpga/fpga_manager.c
copy arch/arm/mach-socfpga/include/mach/{fpga_manager.h => fpga_manager_gen5.h} (57%)
create mode 100644 arch/arm/mach-socfpga/lowlevel_init.S
create mode 100644 drivers/fpga/socfpga_arria10.c
copy drivers/fpga/{socfpga.c => socfpga_gen5.c} (86%)
create mode 100644 include/intel_socfpga/fpga_manager.h
create mode 100644 include/intel_socfpga/fpga_manager_arria10.h
copy arch/arm/mach-socfpga/include/mach/fpga_manager.h => include/intel_socfpga/fpga_manager_gen5.h (57%)Signature · 1 line
1.7.7.4
PATCH 1/7 arm: socfpga: Remove unused passing parameter of socfpga_bridges_reset
From: Tien Fong Chee <[email protected]>
Remove unused passing parameter of socfpga_bridges_reset function in SoCFPGA Arria10.
--- .../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
1.7.7.4
PATCH 1/7 arm: socfpga: Remove unused passing parameter of socfpga_bridges_reset
Quoted 4 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Remove unused passing parameter of
socfpga_bridges_resetfunction in SoCFPGA Arria10.
So how do you un-reset the bridges if you drop this $enable argument ?
Quoted 40 lines
Signed-off-by Tien Fong Chee <[email protected]>--- .../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 · 2 lines
Best regards, Marek Vasut
Chee
PATCH 1/7 arm: socfpga: Remove unused passing parameter of socfpga_bridges_reset
Quoted 10 lines · Marek Vasut
Quoted 6 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Remove unused passing parameter of
socfpga_bridges_resetfunction in
SoCFPGA Arria10.So how do you un-reset the bridges if you drop this $enable argument ?
This socfpga_reset_deassert_bridges_handoff() would be called, bridges are released based on DTS.
Quoted 45 lines
Quoted 44 lines
Signed-off-by Tien Fong Chee <[email protected]>---
.../include/mach/reset_manager_arria10.h | 2 +- arch/arm/mach-socfpga/reset_manager_arria10.c | 4 ++--2 files changed, 3 insertions(+), 3 deletions(-)(quoted diff) +0
-0
socfpga/include/mach/reset_manager_arria10.hb/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h
index 7922db8..b6d7f4f 100644arch/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 );
structsocfpga_reset_manager{
u32 stat;arch/arm/mach-socfpga/reset_manager_arria10.c +0
-0@@ -318,13 +318,13 @@ void socfpga_per_reset_all(void) }
#ifdefined(CONFIG_SOCFPGA_VIRTUAL_TARGET)arch/arm/mach-socfpga/reset_manager_arria10.c +1
-1-int socfpga_bridges_reset (int enable) +int socfpga_bridges_reset (void ){
/* For SoCFPGA-VT, this is NOP. */
return 0;
}
#elsearch/arm/mach-socfpga/reset_manager_arria10.c +1
-1-int socfpga_bridges_reset (int enable) +int socfpga_bridges_reset (void ){
int ret;
PATCH 1/7 arm: socfpga: Remove unused passing parameter of socfpga_bridges_reset
Quoted 5 lines · Tien Fong
Quoted 4 lines · Marek Vasut
Quoted 3 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Remove unused passing parameter of
socfpga_bridges_resetfunction in
SoCFPGA Arria10.So how do you un-reset the bridges if you drop this $enable argument ?
This
socfpga_reset_deassert_bridges_handoff()would be called, bridges are released based on DTS.
Seems the naming needs some work, it's quite chaotic and inobvious then.
Quoted 44 lines
Quoted 44 lines
Quoted 44 lines
Signed-off-by Tien Fong Chee <[email protected]>--- .../include/mach/reset_manager_arria10.h | 2 +- arch/arm/mach-socfpga/reset_manager_arria10.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)(quoted diff) +0
-0
socfpga/include/mach/reset_manager_arria10.hb/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h
index 7922db8..b6d7f4f 100644arch/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 · 2 lines
Best regards, Marek Vasut
Chee
PATCH 1/7 arm: socfpga: Remove unused passing parameter of socfpga_bridges_reset
Quoted 17 lines · Marek Vasut
Quoted 16 lines · Tien Fong
Quoted 14 lines · Marek Vasut
Quoted 8 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Remove unused passing parameter of
socfpga_bridges_resetfunction
in
SoCFPGA Arria10.So how do you un-reset the bridges if you drop this $enable argument
?
Quoted 6 lines
Quoted 3 lines
This
socfpga_reset_deassert_bridges_handoff()would be called, bridges
are released based on DTS.Seems the naming needs some work, it's quite chaotic and inobvious then.
It is okay for "socfpga_bridges_unreset_byfdt()?
Quoted 51 lines
Quoted 50 lines
Quoted 50 lines
Quoted 50 lines
Signed-off-by Tien Fong Chee <[email protected]>---
.../include/mach/reset_manager_arria10.h | 2 +- arch/arm/mach-socfpga/reset_manager_arria10.c | 4 ++--2 files changed, 3 insertions(+), 3 deletions(-)(quoted diff) +0
-0
socfpga/include/mach/reset_manager_arria10.hb/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h
index 7922db8..b6d7f4f 100644
--- a/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h
+++ b/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.harch/arm/mach-socfpga/include/mach/reset_manager_arria10.h +1
-1@@ -17,7 +17,7 @@ intsocfpga_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 );
structsocfpga_reset_manager{
u32 stat;arch/arm/mach-socfpga/reset_manager_arria10.c +0
-0@@ -318,13 +318,13 @@ void socfpga_per_reset_all(void) }
#ifdefined(CONFIG_SOCFPGA_VIRTUAL_TARGET)arch/arm/mach-socfpga/reset_manager_arria10.c +1
-1-int socfpga_bridges_reset (int enable) +int socfpga_bridges_reset (void ){
/* For SoCFPGA-VT, this is NOP. */
return 0;
}
#elsearch/arm/mach-socfpga/reset_manager_arria10.c +1
-1-int socfpga_bridges_reset (int enable) +int socfpga_bridges_reset (void ){
int ret;
PATCH 1/7 arm: socfpga: Remove unused passing parameter of socfpga_bridges_reset
Quoted 18 lines · Tien Fong
Quoted 17 lines · Marek Vasut
Quoted 16 lines · Tien Fong
Quoted 14 lines · Marek Vasut
Quoted 8 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Remove unused passing parameter of
socfpga_bridges_resetfunction
in
SoCFPGA Arria10.So how do you un-reset the bridges if you drop this $enable argument
?
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
This
socfpga_reset_deassert_bridges_handoff()would be called, bridges
are released based on DTS.Seems the naming needs some work, it's quite chaotic and inobvious then.
It is okay for "
socfpga_bridges_unreset_byfdt()?
Just keep it as-is for now ...
Quoted 49 lines
Quoted 49 lines
Quoted 49 lines
Quoted 49 lines
Quoted 49 lines
Signed-off-by Tien Fong Chee <[email protected]>--- .../include/mach/reset_manager_arria10.h | 2 +- arch/arm/mach-socfpga/reset_manager_arria10.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)(quoted diff) +0
-0
socfpga/include/mach/reset_manager_arria10.hb/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h
index 7922db8..b6d7f4f 100644
--- a/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h
+++ b/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.harch/arm/mach-socfpga/include/mach/reset_manager_arria10.h +1
-1@@ -17,7 +17,7 @@ intsocfpga_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 {arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h +0
-0u32 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 · 2 lines
Best regards, Marek Vasut
Chee
PATCH 1/7 arm: socfpga: Remove unused passing parameter of socfpga_bridges_reset
Quoted 27 lines · Marek Vasut
Quoted 26 lines · Tien Fong
Quoted 24 lines · Marek Vasut
Quoted 22 lines · Tien Fong
Quoted 8 lines · Marek Vasut
Quoted 5 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Quoted 8 lines
Quoted 4 lines
Remove unused passing parameter of
socfpga_bridges_resetfunction
in
SoCFPGA Arria10.So how do you un-reset the bridges if you drop this $enable argument
?This
socfpga_reset_deassert_bridges_handoff()would be called, bridges
are released based on DTS.
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Seems the naming needs some work, it's quite chaotic and inobvious
then.It is okay for "
socfpga_bridges_unreset_byfdt()?Just keep it as-is for now ...
Okay.
Quoted 59 lines
Quoted 58 lines
Quoted 58 lines
Quoted 58 lines
Quoted 58 lines
Quoted 58 lines
Signed-off-by Tien Fong Chee <[email protected]>---
.../include/mach/reset_manager_arria10.h | 2+- arch/arm/mach-socfpga/reset_manager_arria10.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)(quoted diff) +0
-0
socfpga/include/mach/reset_manager_arria10.h
b/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h
index 7922db8..b6d7f4f 100644
--- a/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h
+++ b/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h(quoted diff) +0
-0@@ -17,7 +17,7 @@ int socfpga_reset_deassert_bridges_handoff(void);void
socfpga_reset_assert_fpga_connected_peripherals(void); voidsocfpga_reset_deassert_osc1wd0(void); voidsocfpga_reset_uart(int assert);arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h +1
-1-int socfpga_bridges_reset (int enable); +int socfpga_bridges_reset (void );
structsocfpga_reset_manager{
u32 stat;arch/arm/mach-socfpga/reset_manager_arria10.c +0
-0@@ -318,13 +318,13 @@ void socfpga_per_reset_all(void) }
#ifdefined(CONFIG_SOCFPGA_VIRTUAL_TARGET)arch/arm/mach-socfpga/reset_manager_arria10.c +1
-1-int socfpga_bridges_reset (int enable) +int socfpga_bridges_reset (void ){
/* For SoCFPGA-VT, this is NOP. */
return 0;
}
#elsearch/arm/mach-socfpga/reset_manager_arria10.c +1
-1-int socfpga_bridges_reset (int enable) +int socfpga_bridges_reset (void ){
int ret;
PATCH 2/7 arm: socfpga: Convert FPGA configuration to Kconfig method.
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Convert Macro #define configuration to Kconfig method. All FPGA devices enable configuration based on CONFIG_FPGA_ALTERA.
--- drivers/fpga/Kconfig | 5 ++++- drivers/fpga/Makefile | 3 +-- include/altera.h | 2 +- include/configs/socfpga_common.h | 3 --- 4 files changed, 6 insertions(+), 7 deletions(-)
drivers/fpga/Kconfig +4 -1
@@ -2,12 +2,15 @@ menu "FPGA support" config FPGA bool + help + Enable FPGA driver build. config FPGA_ALTERA bool "Enable Altera FPGA drivers" + default y if TARGET_SOCFPGA_GEN5 && CMD_FPGA select FPGA help - Say Y here to enable the Altera FPGA driver + Default Y here to enable the Altera FPGA driver This provides basic infrastructure to support Altera FPGA devices. Enable Altera FPGA specific functions which includes bitstream
drivers/fpga/Makefile +1 -2
@@ -14,10 +14,9 @@ obj-$(CONFIG_FPGA_ZYNQMPPL) += zynqmppl.o obj-$(CONFIG_FPGA_XILINX) += xilinx.o obj-$(CONFIG_FPGA_LATTICE) += ivm_core.o lattice.o ifdef CONFIG_FPGA_ALTERA -obj-y += altera.o +obj-y += altera.o socfpga.o obj-$(CONFIG_FPGA_ACEX1K) += ACEX1K.o 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 endif
include/altera.h +1 -1
@@ -109,7 +109,7 @@ typedef struct {Altera_post_fn post; } altera_board_specific_func; -#ifdef CONFIG_FPGA_SOCFPGA +#ifdef CONFIG_FPGA_ALTERA int socfpga_load (Altera_desc *desc,const void *rbf_data,size_t rbf_size);#endif
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
1.7.7.4
PATCH 2/7 arm: socfpga: Convert FPGA configuration to Kconfig method.
Quoted 18 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Convert Macro #define configuration to
Kconfigmethod. All FPGA devices enable configuration based onCONFIG_FPGA_ALTERA.Signed-off-by Tien Fong Chee <[email protected]>--- drivers/fpga/Kconfig | 5 ++++- drivers/fpga/Makefile | 3 +-- include/altera.h | 2 +- include/configs/socfpga_common.h | 3 --- 4 files changed, 6 insertions(+), 7 deletions(-)drivers/fpga/Kconfig +0
-0
drivers/fpga/Kconfig menu "FPGA support" · line 6
Quoted 5 lines
drivers/fpga/Kconfig +2
-0@@ -2,12 +2,15 @@ menu "FPGA support" config FPGA bool + help + Enable FPGA driver build.
Separate patch please , also this is not driver, but framework . There's not just drivers here IMO.
drivers/fpga/Kconfig menu "FPGA support" · line 10
Quoted 3 lines
drivers/fpga/Kconfig +1
-0config FPGA_ALTERA bool "Enable Altera FPGA drivers" + default y if TARGET_SOCFPGA_GEN5 && CMD_FPGA
Should be selected by arch code, drop this.
drivers/fpga/Kconfig menu "FPGA support" · line 13
Quoted 4 lines
drivers/fpga/Kconfig +1
-1select FPGA help - Say Y here to enable the Altera FPGA driver + Default Y here to enable the Altera FPGA driver
Keep as is, it's up to user to decide.
drivers/fpga/Makefile obj-$(CONFIG_FPGA_ZYNQMPPL) += zynqmppl.o · line 17
Quoted 12 lines
drivers/fpga/Kconfig +0
-0This provides basic infrastructure to support Altera FPGA devices. Enable Altera FPGA specific functions which includes bitstreamdrivers/fpga/Makefile +1
-1@@ -14,10 +14,9 @@ obj-$(CONFIG_FPGA_ZYNQMPPL) += zynqmppl.o obj-$(CONFIG_FPGA_XILINX) += xilinx.o obj-$(CONFIG_FPGA_LATTICE) += ivm_core.o lattice.o ifdef CONFIG_FPGA_ALTERA -obj-y += altera.o +obj-y += altera.o socfpga.o
Now all the ancient systems which had the ancient Altera FPGAs will build-in the socfpga stuff too . That cannot work.
Quoted 34 lines
drivers/fpga/Makefile +0
-1obj-$(CONFIG_FPGA_ACEX1K) += ACEX1K.o 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 endifinclude/altera.h +1
-1@@ -109,7 +109,7 @@ typedef struct {Altera_post_fn post; } altera_board_specific_func; -#ifdef CONFIG_FPGA_SOCFPGA +#ifdef CONFIG_FPGA_ALTERA int socfpga_load (Altera_desc *desc,const void *rbf_data,size_t rbf_size);#endif 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 · 2 lines
Best regards, Marek Vasut
Chee
PATCH 2/7 arm: socfpga: Convert FPGA configuration to Kconfig method.
Quoted 16 lines · Marek Vasut
Quoted 15 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Convert Macro #define configuration to
Kconfigmethod. All FPGA devices
enable configuration based onCONFIG_FPGA_ALTERA.Signed-off-by Tien Fong Chee <[email protected]>---
drivers/fpga/Kconfig | 5 ++++-
drivers/fpga/Makefile | 3 +--
include/altera.h | 2 +-
include/configs/socfpga_common.h | 3 ---4 files changed, 6 insertions(+), 7 deletions(-)
Quoted 14 lines
drivers/fpga/Kconfig menu "FPGA support" · line 6
Quoted 10 lines
drivers/fpga/Kconfig +0
-0@@ -2,12 +2,15 @@ menu "FPGA support"
config FPGA
booldrivers/fpga/Kconfig +2
-0+ help + Enable FPGA driver build.Separate patch please , also this is not driver, but framework . There's
not just drivers here IMO.
ohh...okay, so you prefer i revert the changes, or better explanation in separate patch? if for later,what is your suggestion? Thanks.
Quoted 6 lines
drivers/fpga/Kconfig menu "FPGA support" · line 10
Quoted 4 lines
config
FPGA_ALTERA
bool "Enable Altera FPGA drivers"drivers/fpga/Kconfig +1
-0+ default y if TARGET_SOCFPGA_GEN5 && CMD_FPGAShould be selected by arch code, drop this.
just for clarity, are you means defconfig == "selected by arch code"?
Quoted 7 lines
drivers/fpga/Kconfig menu "FPGA support" · line 13
Quoted 5 lines
select FPGA
helpdrivers/fpga/Kconfig +1
-1- Say Y here to enable the Altera FPGA driver + Default Y here to enable the Altera FPGA driverKeep as is, it's up to user to decide.
I found that all users enable it, so that is why i set this as default, otherwise i have to add this into their defconfig one by one. Users who don't want enable it, they can set "N" in their defconfig. What do you think?
Quoted 18 lines
Quoted 13 lines
This provides basic infrastructure to support Altera FPGA devices.
Enable Altera FPGA specific functions which includes bitstreamdrivers/fpga/Makefile +0
-0@@ -14,10 +14,9 @@ obj-$(CONFIG_FPGA_ZYNQMPPL) += zynqmppl.oobj-$(CONFIG_FPGA_XILINX) += xilinx.o obj-$(CONFIG_FPGA_LATTICE) += ivm_core.o lattice.o ifdef
CONFIG_FPGA_ALTERAdrivers/fpga/Makefile obj-$(CONFIG_FPGA_ZYNQMPPL) += zynqmppl.o · line 17
Quoted 2 lines
drivers/fpga/Makefile +1
-1-obj-y += altera.o +obj-y += altera.o socfpga.oNow all the ancient systems which had the ancient Altera FPGAs will build-in the socfpga stuff too . That cannot work.
Okay, i will revert the changes.
Quoted 38 lines
Quoted 37 lines
obj-$(CONFIG_FPGA_ACEX1K) += ACEX1K.o
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
endifinclude/altera.h +0
-0@@ -109,7 +109,7 @@ typedef struct { Altera_post_fn post; } altera_board_specific_func;include/altera.h +1
-1-#ifdef CONFIG_FPGA_SOCFPGA +#ifdef CONFIG_FPGA_ALTERA int
socfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size);
#endifinclude/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
PATCH 2/7 arm: socfpga: Convert FPGA configuration to Kconfig method.
Quoted 31 lines · Tien Fong
Quoted 22 lines · Marek Vasut
Quoted 21 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Convert Macro #define configuration to
Kconfigmethod. All FPGA devices
enable configuration based onCONFIG_FPGA_ALTERA.Signed-off-by Tien Fong Chee <[email protected]>--- drivers/fpga/Kconfig | 5 ++++- drivers/fpga/Makefile | 3 +-- include/altera.h | 2 +- include/configs/socfpga_common.h | 3 --- 4 files changed, 6 insertions(+), 7 deletions(-)drivers/fpga/Kconfig +0
-0@@ -2,12 +2,15 @@ menu "FPGA support"Quoted 8 lines
drivers/fpga/Kconfig menu "FPGA support" · line 6
Quoted 4 lines
drivers/fpga/Kconfig +2
-0config FPGA bool + help + Enable FPGA driver build.Separate patch please , also this is not driver, but framework . There's
not just drivers here IMO.
Quoted 2 lines
ohh...okay, so you prefer i revert the changes, or better explanation in separate patch? if for later,what is your suggestion? Thanks.
Turning this whole FPGA subsystem into Kconfig should be a separate patch. There's a script for that too and you need to convert and build test all the boards which define CONFIG_FPGA .
Quoted 6 lines
Quoted 5 lines
drivers/fpga/Kconfig menu "FPGA support" · line 10
Quoted 3 lines
drivers/fpga/Kconfig +1
-0config FPGA_ALTERA bool "Enable Altera FPGA drivers" + default y if TARGET_SOCFPGA_GEN5 && CMD_FPGAShould be selected by arch code, drop this.
just for clarity, are you means defconfig == "selected by arch code"?
I mean arch/arm/mach-socfpga/Kconfig
Quoted 8 lines
Quoted 7 lines
drivers/fpga/Kconfig menu "FPGA support" · line 13
Quoted 5 lines
drivers/fpga/Kconfig +1
-1select FPGA help - Say Y here to enable the Altera FPGA driver + Default Y here to enable the Altera FPGA driverKeep as is, it's up to user to decide.
I found that all users enable it, so that is why i set this as default,
You set it as default in arch/arm/mach-socfpga/Kconfig , no need to modify the text.
Quoted 59 lines
otherwise i have to add this into their defconfig one by one. Users who don't want enable it, they can set "N" in their defconfig. What do you think?
Quoted 18 lines
Quoted 10 lines
drivers/fpga/Kconfig +0
-0This provides basic infrastructure to support AlteraFPGA devices.
Enable Altera FPGA specific functions which includes
bitstreamdrivers/fpga/Makefile +0
-0drivers/fpga/Makefile obj-$(CONFIG_FPGA_ZYNQMPPL) += zynqmppl.o · line 17
Quoted 5 lines
drivers/fpga/Makefile +1
-1@@ -14,10 +14,9 @@ obj-$(CONFIG_FPGA_ZYNQMPPL) += zynqmppl.o obj-$(CONFIG_FPGA_XILINX) += xilinx.o obj-$(CONFIG_FPGA_LATTICE) += ivm_core.o lattice.o ifdef CONFIG_FPGA_ALTERA -obj-y += altera.o +obj-y += altera.o socfpga.oNow all the ancient systems which had the ancient Altera FPGAs will build-in the socfpga stuff too . That cannot work.
Okay, i will revert the changes.
Quoted 37 lines
Quoted 37 lines
drivers/fpga/Makefile +0
-1obj-$(CONFIG_FPGA_ACEX1K) += ACEX1K.o 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 endifinclude/altera.h +1
-1@@ -109,7 +109,7 @@ typedef struct {Altera_post_fn post; } altera_board_specific_func; -#ifdef CONFIG_FPGA_SOCFPGA +#ifdef CONFIG_FPGA_ALTERA int socfpga_load (Altera_desc *desc,const void *rbf_data,size_t rbf_size);#endif 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 · 2 lines
Best regards, Marek Vasut
Chee
PATCH 2/7 arm: socfpga: Convert FPGA configuration to Kconfig method.
Quoted 35 lines · Marek Vasut
Quoted 34 lines · Tien Fong
Quoted 32 lines · Marek Vasut
Quoted 24 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Convert Macro #define configuration to
Kconfigmethod. All FPGA devices
enable configuration based onCONFIG_FPGA_ALTERA.Signed-off-by Tien Fong Chee <[email protected]>---
drivers/fpga/Kconfig | 5 ++++-
drivers/fpga/Makefile | 3 +--
include/altera.h | 2 +-
include/configs/socfpga_common.h | 3 ---4 files changed, 6 insertions(+), 7 deletions(-)drivers/fpga/Kconfig +0
-0@@ -2,12 +2,15 @@ menu "FPGA support"
config FPGA
booldrivers/fpga/Kconfig menu "FPGA support" · line 6
Quoted 2 lines
drivers/fpga/Kconfig +2
-0+ help + Enable FPGA driver build.Separate patch please , also this is not driver, but framework . There's
not just drivers here IMO.
Quoted 8 lines
Quoted 3 lines
ohh...okay, so you prefer i revert the changes, or better explanation
in separate patch? if for later,what is your suggestion? Thanks.Turning this whole FPGA subsystem into
Kconfigshould be a separat patch. There's a script for that too and you need to convert and build
test all the boards which defineCONFIG_FPGA.
Okay, this patch is specific for turning whole FPGA sybsytem into Kconfig. I will use moveconfig.py for this. thanks.
Quoted 12 lines
Quoted 10 lines
Quoted 8 lines
drivers/fpga/Kconfig menu "FPGA support" · line 10
Quoted 6 lines
config
FPGA_ALTERA
bool "Enable Altera FPGA drivers"drivers/fpga/Kconfig +1
-0+ default y if TARGET_SOCFPGA_GEN5 && CMD_FPGAShould be selected by arch code, drop this.
just for clarity, are you means defconfig == "selected by arch code"?
I mean
arch/arm/mach-socfpga/Kconfig
With moveconfig.py, i think this change is not required.
Quoted 84 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 8 lines
Quoted 6 lines
drivers/fpga/Kconfig menu "FPGA support" · line 13
Quoted 4 lines
select FPGA
helpdrivers/fpga/Kconfig +1
-1- Say Y here to enable the Altera FPGA driver + Default Y here to enable the Altera FPGA driverKeep as is, it's up to user to decide.
I found that all users enable it, so that is why i set this as default,
You set it as default in
arch/arm/mach-socfpga/Kconfig, no need to modify the text.Quoted 68 lines
otherwise i have to add this into their defconfig one by one. Users who
don't want enable it, they can set "N" in their defconfig. What do you
think?Quoted 12 lines
Quoted 12 lines
This provides basic infrastructure to support Altera FPGA devices.
Enable Altera FPGA specific functions which includes bitstreamdrivers/fpga/Makefile +0
-0@@ -14,10 +14,9 @@ obj-$(CONFIG_FPGA_ZYNQMPPL) += zynqmppl.oQuoted 9 lines
drivers/fpga/Makefile obj-$(CONFIG_FPGA_ZYNQMPPL) += zynqmppl.o · line 17
Quoted 5 lines
obj-$(CONFIG_FPGA_XILINX) += xilinx.o obj-$(CONFIG_FPGA_LATTICE) += ivm_core.o lattice.o ifdef
CONFIG_FPGA_ALTERAdrivers/fpga/Makefile +1
-1-obj-y += altera.o +obj-y += altera.o socfpga.oNow all the ancient systems which had the ancient Altera FPGAs will
build-in the socfpga stuff too . That cannot work.Okay, i will revert the changes.
Quoted 40 lines
Quoted 40 lines
obj-$(CONFIG_FPGA_ACEX1K) += ACEX1K.o
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
endifinclude/altera.h +0
-0@@ -109,7 +109,7 @@ typedef struct { Altera_post_fn post; } altera_board_specific_func;include/altera.h +1
-1-#ifdef CONFIG_FPGA_SOCFPGA +#ifdef CONFIG_FPGA_ALTERA int socfpga_load(Altera_desc *desc, const void
*rbf_data,size_trbf_size);
#endifinclude/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
PATCH 2/7 arm: socfpga: Convert FPGA configuration to Kconfig method.
Quoted 54 lines · Tien Fong
Quoted 35 lines · Marek Vasut
Quoted 34 lines · Tien Fong
Quoted 32 lines · Marek Vasut
Quoted 21 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Convert Macro #define configuration to
Kconfigmethod. All FPGA devices
enable configuration based onCONFIG_FPGA_ALTERA.Signed-off-by Tien Fong Chee <[email protected]>--- drivers/fpga/Kconfig | 5 ++++- drivers/fpga/Makefile | 3 +-- include/altera.h | 2 +- include/configs/socfpga_common.h | 3 --- 4 files changed, 6 insertions(+), 7 deletions(-)drivers/fpga/Kconfig +0
-0drivers/fpga/Kconfig menu "FPGA support" · line 6
Quoted 5 lines
drivers/fpga/Kconfig +2
-0@@ -2,12 +2,15 @@ menu "FPGA support" config FPGA bool + help + Enable FPGA driver build.Separate patch please , also this is not driver, but framework . There's
not just drivers here IMO.Quoted 8 lines
Quoted 3 lines
ohh...okay, so you prefer i revert the changes, or better explanation
in separate patch? if for later,what is your suggestion? Thanks.Turning this whole FPGA subsystem into
Kconfigshould be a separat patch. There's a script for that too and you need to convert and build
test all the boards which defineCONFIG_FPGA.Okay, this patch is specific for turning whole FPGA sybsytem into
Kconfig. I will usemoveconfig.pyfor this. thanks.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/fpga/Kconfig menu "FPGA support" · line 10
Quoted 6 lines
drivers/fpga/Kconfig +1
-0config FPGA_ALTERA bool "Enable Altera FPGA drivers" + default y if TARGET_SOCFPGA_GEN5 && CMD_FPGAShould be selected by arch code, drop this.
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
just for clarity, are you means defconfig == "selected by arch code"?
I mean
arch/arm/mach-socfpga/KconfigWith
moveconfig.py, i think this change is not required.
So, who will enable FPGA_ALTERA ?
[...]
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH 2/7 arm: socfpga: Convert FPGA configuration to Kconfig method.
Quoted 68 lines · Marek Vasut
Quoted 67 lines · Tien Fong
Quoted 45 lines · Marek Vasut
Quoted 39 lines · Tien Fong
Quoted 21 lines · Marek Vasut
Quoted 18 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Convert Macro #define configuration to
Kconfigmethod. All FPGA
devices
enable configuration based onCONFIG_FPGA_ALTERA.Signed-off-by Tien Fong Chee <[email protected]>---
drivers/fpga/Kconfig | 5 ++++-
drivers/fpga/Makefile | 3 +--
include/altera.h | 2 +-
include/configs/socfpga_common.h | 3 ---4 files changed, 6 insertions(+), 7 deletions(-)Quoted 15 lines
drivers/fpga/Kconfig menu "FPGA support" · line 6
Quoted 10 lines
drivers/fpga/Kconfig +0
-0@@ -2,12 +2,15 @@ menu "FPGA support"
config FPGA
booldrivers/fpga/Kconfig +2
-0+ help + Enable FPGA driver build.Separate patch please , also this is not driver, but framework .
There's
not just drivers here IMO.Quoted 4 lines
ohh...okay, so you prefer i revert the changes, or better explanation
in separate patch? if for later,what is your suggestion? Thanks.Quoted 6 lines
Turning this whole FPGA subsystem into
Kconfigshould be a separat
patch. There's a script for that too and you need to convert and build
test all the boards which defineCONFIG_FPGA.Okay, this patch is specific for turning whole FPGA sybsytem into
Kconfig. I will usemoveconfig.pyfor this. thanks.Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
drivers/fpga/Kconfig menu "FPGA support" · line 10
Quoted 10 lines
config
FPGA_ALTERA
bool "Enable Altera FPGA drivers"drivers/fpga/Kconfig +1
-0+ default y if TARGET_SOCFPGA_GEN5 && CMD_FPGAShould be selected by arch code, drop this.
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
just for clarity, are you means defconfig == "selected by arch code"?
I mean
arch/arm/mach-socfpga/KconfigWith
moveconfig.py, i think this change is not required.So, who will enable
FPGA_ALTERA?
Below boards will enable the FPGA_ALTERA, their header file include socfpga_common.h, and CONFIG_CMD_FPGA set to y by default. i believe moveconfig.py will set this FPGA_ALTERA into their defconfig respectively.
config TARGET_SOCFPGA_ARRIA10_SOCDK
bool "Altera SOCFPGA SoCDK (Arria 10)"
select TARGET_SOCFPGA_ARRIA10
config TARGET_SOCFPGA_ARRIA5_SOCDK
bool "Altera SOCFPGA SoCDK (Arria V)"
select TARGET_SOCFPGA_ARRIA5
config TARGET_SOCFPGA_CYCLONE5_SOCDK
bool "Altera SOCFPGA SoCDK (Cyclone V)"
select TARGET_SOCFPGA_CYCLONE5
config TARGET_SOCFPGA_ARIES_MCVEVK
bool "Aries MCVEVK (Cyclone V)"
select TARGET_SOCFPGA_CYCLONE5
config TARGET_SOCFPGA_EBV_SOCRATES
bool "EBV SoCrates (Cyclone V)"
select TARGET_SOCFPGA_CYCLONE5
config TARGET_SOCFPGA_IS1
bool "IS1 (Cyclone V)"
select TARGET_SOCFPGA_CYCLONE5
config TARGET_SOCFPGA_SAMTEC_VINING_FPGA
bool "samtec VIN|ING FPGA (Cyclone V)"
select BOARD_LATE_INIT
select TARGET_SOCFPGA_CYCLONE5
config TARGET_SOCFPGA_SR1500
bool "SR1500 (Cyclone V)" select TARGET_SOCFPGA_CYCLONE5
config TARGET_SOCFPGA_TERASIC_DE0_NANO
bool "Terasic DE0-Nano-Atlas (Cyclone V)"
select TARGET_SOCFPGA_CYCLONE5
config TARGET_SOCFPGA_TERASIC_DE10_NANO
bool "Terasic DE10-Nano (Cyclone V)"
select TARGET_SOCFPGA_CYCLONE5
config TARGET_SOCFPGA_TERASIC_DE1_SOC
bool "Terasic DE1-SoC (Cyclone V)"
select TARGET_SOCFPGA_CYCLONE5
config TARGET_SOCFPGA_TERASIC_SOCKIT
bool "Terasic SoCkit (Cyclone V)"
select TARGET_SOCFPGA_CYCLONE5
Quoted 2 lines
[...]
Chee
PATCH 2/7 arm: socfpga: Convert FPGA configuration to Kconfig method.
Quoted 137 lines · Tien Fong
Quoted 1 line
Quoted 80 lines · Marek Vasut
Quoted 78 lines · Tien Fong
Quoted 50 lines · Marek Vasut
Quoted 43 lines · Tien Fong
Quoted 24 lines · Marek Vasut
Quoted 20 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Convert Macro #define configuration to
Kconfigmethod. All
FPGA
devices
enable configuration based onCONFIG_FPGA_ALTERA.Signed-off-by Tien Fong Chee <[email protected]>---
drivers/fpga/Kconfig | 5 ++++-
drivers/fpga/Makefile | 3 +--
include/altera.h | 2 +-
include/configs/socfpga_common.h | 3 ---4 files changed, 6 insertions(+), 7 deletions(-)Quoted 15 lines
drivers/fpga/Kconfig
Quoted 10 lines
drivers/fpga/Kconfig +0
-0@@ -2,12 +2,15 @@ menu "FPGA support"
config FPGA
booldrivers/fpga/Kconfig +2
-0+ help + Enable FPGA driver build.Separate patch please , also this is not driver, but framework .
There's
not just drivers here IMO.Quoted 4 lines
ohh...okay, so you prefer i revert the changes, or better explanation
in separate patch? if for later,what is your suggestion? Thanks.Quoted 7 lines
Turning this whole FPGA subsystem into
Kconfigshould be a separat
patch. There's a script for that too and you need to convert and
build
test all the boards which defineCONFIG_FPGA.Okay, this patch is specific for turning whole FPGA sybsytem into
Kconfig. I will usemoveconfig.pyfor this. thanks.Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 13 lines
config
FPGA_ALTERA
bool "Enable Altera FPGA drivers"drivers/fpga/Kconfig
Quoted 1 line
drivers/fpga/Kconfig +1
-0+ default y if TARGET_SOCFPGA_GEN5 && CMD_FPGAShould be selected by arch code, drop this.
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
just for clarity, are you means defconfig == "selected by arch
code"?I mean
arch/arm/mach-socfpga/KconfigWith
moveconfig.py, i think this change is not required.So, who will enable
FPGA_ALTERA?Below boards will enable the
FPGA_ALTERA, their header file includesocfpga_common.h, andCONFIG_CMD_FPGAset to y by default. i believemoveconfig.pywill set this FPGA_ALTERA into their defconfig respectively.
configTARGET_SOCFPGA_ARRIA10_SOCDK
bool "Altera SOCFPGA SoCDK (Arria 10)"
selectTARGET_SOCFPGA_ARRIA10config
TARGET_SOCFPGA_ARRIA5_SOCDK
bool "Altera SOCFPGA SoCDK (Arria V)"
selectTARGET_SOCFPGA_ARRIA5config
TARGET_SOCFPGA_CYCLONE5_SOCDK
bool "Altera SOCFPGA SoCDK (Cyclone V)"
selectTARGET_SOCFPGA_CYCLONE5config
TARGET_SOCFPGA_ARIES_MCVEVK
bool "Aries MCVEVK (Cyclone V)"
selectTARGET_SOCFPGA_CYCLONE5config
TARGET_SOCFPGA_EBV_SOCRATES
bool "EBV SoCrates (Cyclone V)"
selectTARGET_SOCFPGA_CYCLONE5config
TARGET_SOCFPGA_IS1
bool "IS1 (Cyclone V)"
selectTARGET_SOCFPGA_CYCLONE5config
TARGET_SOCFPGA_SAMTEC_VINING_FPGA
bool "samtec VIN|ING FPGA (Cyclone V)"
selectBOARD_LATE_INIT
selectTARGET_SOCFPGA_CYCLONE5config
TARGET_SOCFPGA_SR1500bool "SR1500 (Cyclone V)" select TARGET_SOCFPGA_CYCLONE5config
TARGET_SOCFPGA_TERASIC_DE0_NANO
bool "Terasic DE0-Nano-Atlas (Cyclone V)"
selectTARGET_SOCFPGA_CYCLONE5config
TARGET_SOCFPGA_TERASIC_DE10_NANO
bool "Terasic DE10-Nano (Cyclone V)"
selectTARGET_SOCFPGA_CYCLONE5
Quoted 7 lines
config
TARGET_SOCFPGA_TERASIC_DE1_SOC
bool "Terasic DE1-SoC (Cyclone V)"
selectTARGET_SOCFPGA_CYCLONE5config
TARGET_SOCFPGA_TERASIC_SOCKIT
bool "Terasic SoCkit (Cyclone V)"
selectTARGET_SOCFPGA_CYCLONE5
convert to Kconfig take time to run, more than 1k++ defconfg need to be processed, so i plan to take out from this patch set and submiting separately after this patchset. It sounds okay for you, marek :)?
Quoted 1 line
Quoted 1 line
[...]
PATCH 2/7 arm: socfpga: Convert FPGA configuration to Kconfig method.
Quoted 142 lines · Tien Fong
Quoted 141 lines · Tien Fong
Quoted 1 line
Quoted 80 lines · Marek Vasut
Quoted 78 lines · Tien Fong
Quoted 50 lines · Marek Vasut
Quoted 43 lines · Tien Fong
Quoted 30 lines · Marek Vasut
Quoted 26 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Convert Macro #define configuration to
Kconfigmethod. All
FPGA
devices
enable configuration based onCONFIG_FPGA_ALTERA.Signed-off-by Tien Fong Chee <[email protected]>--- drivers/fpga/Kconfig | 5 ++++- drivers/fpga/Makefile | 3 +-- include/altera.h | 2 +- include/configs/socfpga_common.h | 3 --- 4 files changed, 6 insertions(+), 7 deletions(-)drivers/fpga/Kconfig +0
-0@@ -2,12 +2,15 @@ menu "FPGA support"Quoted 9 lines
drivers/fpga/Kconfig menu "FPGA support" · line 6
Quoted 4 lines
drivers/fpga/Kconfig +2
-0config FPGA bool + help + Enable FPGA driver build.Separate patch please , also this is not driver, but framework .
There's
not just drivers here IMO.Quoted 4 lines
ohh...okay, so you prefer i revert the changes, or better explanation
in separate patch? if for later,what is your suggestion? Thanks.Quoted 7 lines
Turning this whole FPGA subsystem into
Kconfigshould be a separat
patch. There's a script for that too and you need to convert and
build
test all the boards which defineCONFIG_FPGA.Okay, this patch is specific for turning whole FPGA sybsytem into
Kconfig. I will usemoveconfig.pyfor this. thanks.Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 11 lines
drivers/fpga/Kconfig menu "FPGA support" · line 9
Quoted 3 lines
drivers/fpga/Kconfig +1
-0config FPGA_ALTERA bool "Enable Altera FPGA drivers" + default y if TARGET_SOCFPGA_GEN5 && CMD_FPGAShould be selected by arch code, drop this.
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
just for clarity, are you means defconfig == "selected by arch
code"?I mean
arch/arm/mach-socfpga/KconfigWith
moveconfig.py, i think this change is not required.So, who will enable
FPGA_ALTERA?Below boards will enable the
FPGA_ALTERA, their header file includesocfpga_common.h, andCONFIG_CMD_FPGAset to y by default. i believemoveconfig.pywill set thisFPGA_ALTERAinto their defconfig respectively.
configTARGET_SOCFPGA_ARRIA10_SOCDK
bool "Altera SOCFPGA SoCDK (Arria 10)"
selectTARGET_SOCFPGA_ARRIA10config
TARGET_SOCFPGA_ARRIA5_SOCDK
bool "Altera SOCFPGA SoCDK (Arria V)"
selectTARGET_SOCFPGA_ARRIA5config
TARGET_SOCFPGA_CYCLONE5_SOCDK
bool "Altera SOCFPGA SoCDK (Cyclone V)"
selectTARGET_SOCFPGA_CYCLONE5config
TARGET_SOCFPGA_ARIES_MCVEVK
bool "Aries MCVEVK (Cyclone V)"
selectTARGET_SOCFPGA_CYCLONE5config
TARGET_SOCFPGA_EBV_SOCRATES
bool "EBV SoCrates (Cyclone V)"
selectTARGET_SOCFPGA_CYCLONE5config
TARGET_SOCFPGA_IS1
bool "IS1 (Cyclone V)"
selectTARGET_SOCFPGA_CYCLONE5config
TARGET_SOCFPGA_SAMTEC_VINING_FPGA
bool "samtec VIN|ING FPGA (Cyclone V)"
selectBOARD_LATE_INIT
selectTARGET_SOCFPGA_CYCLONE5config
TARGET_SOCFPGA_SR1500bool "SR1500 (Cyclone V)" select TARGET_SOCFPGA_CYCLONE5config
TARGET_SOCFPGA_TERASIC_DE0_NANO
bool "Terasic DE0-Nano-Atlas (Cyclone V)"
selectTARGET_SOCFPGA_CYCLONE5config
TARGET_SOCFPGA_TERASIC_DE10_NANO
bool "Terasic DE10-Nano (Cyclone V)"
selectTARGET_SOCFPGA_CYCLONE5config
TARGET_SOCFPGA_TERASIC_DE1_SOC
bool "Terasic DE1-SoC (Cyclone V)"
selectTARGET_SOCFPGA_CYCLONE5
Quoted 6 lines
Quoted 3 lines
config
TARGET_SOCFPGA_TERASIC_SOCKIT
bool "Terasic SoCkit (Cyclone V)"
selectTARGET_SOCFPGA_CYCLONE5convert to
Kconfigtake time to run, more than 1k++ defconfg need to be processed, so i plan to take out from this patch set and submiting separately after this patchset. It sounds okay for you, marek :)?
Yes, it takes time. That's fine.
Signature · 2 lines
Best regards, Marek Vasut
PATCH 3/7 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 files. No functional change.
---
arch/arm/mach-socfpga/Makefile | 2 +-
arch/arm/mach-socfpga/include/mach/fpga_manager.h | 65 +----
.../mach/{fpga_manager.h => fpga_manager_gen5.h} | 69 +++---
drivers/Makefile | 1 +
drivers/fpga/Makefile | 1 +
drivers/fpga/socfpga.c | 267 +-------------------
drivers/fpga/{socfpga.c => socfpga_gen5.c} | 29 +--
7 files changed, 48 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} (92%)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 -53
79 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/Makefile +1 -0
@@ -47,6 +47,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_FPGA) += fpga/ endif ifdef CONFIG_TPL_BUILD
drivers/fpga/Makefile +1 -0
@@ -19,4 +19,5 @@ obj-$(CONFIG_FPGA_ACEX1K) += ACEX1K.o obj-$(CONFIG_FPGA_CYCLON2) += cyclon2.o obj-$(CONFIG_FPGA_STRATIX_II) += stratixII.o obj-$(CONFIG_FPGA_STRATIX_V) += stratixv.o +obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += socfpga_gen5.o endif
drivers/fpga/socfpga.c +2 -265
283 lines not on this page · raw message
drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +1 -28
@@ -1,5 +1,5 @@/* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause
@@ -14,9 +14,6 @@DECLARE_GLOBAL_DATA_PTR ; -/* Timeout count */ -#define FPGA_TIMEOUT_CNT 0x1000000 -static struct socfpga_fpga_manager *fpgamgr_regs = (struct socfpga_fpga_manager *)SOCFPGA_FPGAMGRREGS_ADDRESS ; static struct socfpga_system_manager *sysmgr_regs =
@@ -30,29 +27,6 @@ static void fpgamgr_set_cd_ratio(unsigned long ratio) (ratio & 0x3) << FPGAMGRREGS_CTRL_CDRATIO_LSB); } -static int fpgamgr_dclkcnt_set (unsigned long cnt) -{ -unsigned long i; - -/* Clear any existing done status */ -if (readl (&fpgamgr_regs->dclkstat)) -writel (0x1 , &fpgamgr_regs->dclkstat); - -/* Write the dclkcnt */ -writel (cnt, &fpgamgr_regs->dclkcnt); - -/* Wait till the dclkcnt done */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { -if (!readl (&fpgamgr_regs->dclkstat)) -continue ; - -writel (0x1 , &fpgamgr_regs->dclkstat); -return 0 ; - } - -return -ETIMEDOUT ; -} -/* Start the FPGA programming by initialize the FPGA Manager */ static int fpgamgr_program_init (void ) {
@@ -267,7 +241,6 @@ int socfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size) }/* Prior programming the FPGA, all bridges need to be shut off */ -/* Disable all signals from hps peripheral controller to fpga */ writel (0 , &sysmgr_regs->fpgaintfgrp_module);
Signature · 1 line
1.7.7.4
PATCH 3/7 arm: socfpga: Restructure FPGA driver in the preparation to support A10.
Quoted 4 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Move FPGA driver which is Gen5 specific code into Gen5 files. No functional change.
It's a driver, so it should stay in drivers/ . If you need to split it, split it in drivers/fpga/ and add Kconfig option(s)
Quoted 586 lines
Signed-off-by Tien Fong Chee <[email protected]>--- arch/arm/mach-socfpga/Makefile | 2 +- arch/arm/mach-socfpga/include/mach/fpga_manager.h | 65 +---- .../mach/{fpga_manager.h => fpga_manager_gen5.h} | 69 +++--- drivers/Makefile | 1 + drivers/fpga/Makefile | 1 + drivers/fpga/socfpga.c | 267 +------------------- drivers/fpga/{socfpga.c => socfpga_gen5.c} | 29 +-- 7 files changed, 48 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} (92%)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_ARRIA10arch/arm/mach-socfpga/include/mach/fpga_manager.h +12
-53@@ -1,5 +1,5 @@/* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -10,58 +10,9 @@#include <altera.h> -struct socfpga_fpga_manager { -/* FPGA Manager Module */ -u32 stat;/* 0x00 */ -u32 ctrl; -u32 dclkcnt; -u32 dclkstat; -u32 gpo;/* 0x10 */ -u32 gpi; -u32 misci;/* 0x18 */ -u32 _pad_0x1c_0x82c[517 ]; - -/* Configuration Monitor (MON) Registers */ -u32 gpio_inten;/* 0x830 */ -u32 gpio_intmask; -u32 gpio_inttype_level; -u32 gpio_int_polarity; -u32 gpio_intstatus;/* 0x840 */ -u32 gpio_raw_intstatus; -u32 _pad_0x848; -u32 gpio_porta_eoi; -u32 gpio_ext_porta;/* 0x850 */ -u32 _pad_0x854_0x85c[3 ]; -u32 gpio_1s_sync;/* 0x860 */ -u32 _pad_0x864_0x868[2 ]; -u32 gpio_ver_id_code; -u32 gpio_config_reg2;/* 0x870 */ -u32 gpio_config_reg1; -}; - -#define FPGAMGRREGS_STAT_MODE_MASK 0x7 -#define FPGAMGRREGS_STAT_MSEL_MASK 0xf8 -#define FPGAMGRREGS_STAT_MSEL_LSB 3 - -#define FPGAMGRREGS_CTRL_CFGWDTH_MASK 0x200 -#define FPGAMGRREGS_CTRL_AXICFGEN_MASK 0x100 -#define FPGAMGRREGS_CTRL_NCONFIGPULL_MASK 0x4 -#define FPGAMGRREGS_CTRL_NCE_MASK 0x2 -#define FPGAMGRREGS_CTRL_EN_MASK 0x1 -#define FPGAMGRREGS_CTRL_CDRATIO_LSB 6 - -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CRC_MASK 0x8 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_ID_MASK 0x4 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CD_MASK 0x2 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK 0x1 - -/* FPGA Mode */ -#define FPGAMGRREGS_MODE_FPGAOFF 0x0 -#define FPGAMGRREGS_MODE_RESETPHASE 0x1 -#define FPGAMGRREGS_MODE_CFGPHASE 0x2 -#define FPGAMGRREGS_MODE_INITPHASE 0x3 -#define FPGAMGRREGS_MODE_USERMODE 0x4 -#define FPGAMGRREGS_MODE_UNKNOWN 0x5 +#if defined(CONFIG_TARGET_SOCFPGA_GEN5 ) +#include <asm/arch/fpga_manager_gen5.h> +#endif /* FPGA CD Ratio Value */ #define CDRATIO_x1 0x0@@ -74,4 +25,12 @@ int fpgamgr_test_fpga_ready(void);int fpgamgr_poll_fpga_ready (void );int fpgamgr_get_mode (void ); +#define FPGA_TIMEOUT_CNT 0x1000000 + +#ifndef __ASSEMBLY__ + +/* Common prototypes */ +int fpgamgr_dclkcnt_set (unsigned long cnt); + +#endif /* __ASSEMBLY__ */ #endif /* _FPGA_MANAGER_H_ */ arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/fpga_manager.h +30
-39@@ -1,14 +1,38 @@/* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef _FPGA_MANAGER_H_ -#define _FPGA_MANAGER_H_ +#ifndef _FPGA_MANAGER_GEN5_H_ +#define _FPGA_MANAGER_GEN5_H_ -#include <altera.h> +#define FPGAMGRREGS_STAT_MODE_MASK 0x7 +#define FPGAMGRREGS_STAT_MSEL_MASK 0xf8 +#define FPGAMGRREGS_STAT_MSEL_LSB 3 + +#define FPGAMGRREGS_CTRL_CFGWDTH_MASK BIT(9) +#define FPGAMGRREGS_CTRL_AXICFGEN_MASK BIT(8) +#define FPGAMGRREGS_CTRL_NCONFIGPULL_MASK BIT(2) +#define FPGAMGRREGS_CTRL_NCE_MASK BIT(1) +#define FPGAMGRREGS_CTRL_EN_MASK BIT(0) +#define FPGAMGRREGS_CTRL_CDRATIO_LSB 6 + +#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CRC_MASK BIT(3) +#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_ID_MASK BIT(2) +#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CD_MASK BIT(1) +#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK BIT(0) + +/* FPGA Mode */ +#define FPGAMGRREGS_MODE_FPGAOFF 0x0 +#define FPGAMGRREGS_MODE_RESETPHASE 0x1 +#define FPGAMGRREGS_MODE_CFGPHASE 0x2 +#define FPGAMGRREGS_MODE_INITPHASE 0x3 +#define FPGAMGRREGS_MODE_USERMODE 0x4 +#define FPGAMGRREGS_MODE_UNKNOWN 0x5 + +#ifndef __ASSEMBLY__ struct socfpga_fpga_manager {/* FPGA Manager Module */ @@ -39,39 +63,6 @@ struct socfpga_fpga_manager {u32 gpio_config_reg1; }; -#define FPGAMGRREGS_STAT_MODE_MASK 0x7 -#define FPGAMGRREGS_STAT_MSEL_MASK 0xf8 -#define FPGAMGRREGS_STAT_MSEL_LSB 3 - -#define FPGAMGRREGS_CTRL_CFGWDTH_MASK 0x200 -#define FPGAMGRREGS_CTRL_AXICFGEN_MASK 0x100 -#define FPGAMGRREGS_CTRL_NCONFIGPULL_MASK 0x4 -#define FPGAMGRREGS_CTRL_NCE_MASK 0x2 -#define FPGAMGRREGS_CTRL_EN_MASK 0x1 -#define FPGAMGRREGS_CTRL_CDRATIO_LSB 6 - -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CRC_MASK 0x8 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_ID_MASK 0x4 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CD_MASK 0x2 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK 0x1 - -/* FPGA Mode */ -#define FPGAMGRREGS_MODE_FPGAOFF 0x0 -#define FPGAMGRREGS_MODE_RESETPHASE 0x1 -#define FPGAMGRREGS_MODE_CFGPHASE 0x2 -#define FPGAMGRREGS_MODE_INITPHASE 0x3 -#define FPGAMGRREGS_MODE_USERMODE 0x4 -#define FPGAMGRREGS_MODE_UNKNOWN 0x5 - -/* FPGA CD Ratio Value */ -#define CDRATIO_x1 0x0 -#define CDRATIO_x2 0x1 -#define CDRATIO_x4 0x2 -#define CDRATIO_x8 0x3 - -/* SoCFPGA support functions */ -int fpgamgr_test_fpga_ready (void ); -int fpgamgr_poll_fpga_ready (void ); -int fpgamgr_get_mode (void ); +#endif /* __ASSEMBLY__ */ -#endif /* _FPGA_MANAGER_H_ */ +#endif /* _FPGA_MANAGER_GEN5_H_ */ drivers/Makefile +1
-0@@ -47,6 +47,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_FPGA) += fpga/ endif ifdef CONFIG_TPL_BUILDdrivers/fpga/Makefile +1
-0@@ -19,4 +19,5 @@ obj-$(CONFIG_FPGA_ACEX1K) += ACEX1K.o obj-$(CONFIG_FPGA_CYCLON2) += cyclon2.o obj-$(CONFIG_FPGA_STRATIX_II) += stratixII.o obj-$(CONFIG_FPGA_STRATIX_V) += stratixv.o +obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += socfpga_gen5.o endifdrivers/fpga/socfpga.c +2
-265@@ -1,5 +1,5 @@/* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -14,23 +14,10 @@DECLARE_GLOBAL_DATA_PTR ; -/* Timeout count */ -#define FPGA_TIMEOUT_CNT 0x1000000 -static 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 ); -} -static int fpgamgr_dclkcnt_set (unsigned long cnt) +int fpgamgr_dclkcnt_set (unsigned long cnt) {unsigned long i;@@ -52,253 +39,3 @@ static int fpgamgr_dclkcnt_set(unsigned long cnt)return -ETIMEDOUT ; } - -/* Start the FPGA programming by initialize the FPGA Manager */ -static int fpgamgr_program_init (void ) -{ -unsigned long msel, i; - -/* Get the MSEL value */ - msel =readl (&fpgamgr_regs->stat); - msel &=FPGAMGRREGS_STAT_MSEL_MASK ; - msel >>=FPGAMGRREGS_STAT_MSEL_LSB ; - -/* -* Set the cfg width -* If MSEL[3] = 1, cfg width = 32 bit -*/ -if (msel &0x8 ) { -setbits_le32 (&fpgamgr_regs->ctrl, -FPGAMGRREGS_CTRL_CFGWDTH_MASK ); - -/* To determine the CD ratio */ -/* MSEL[1:0] = 0, CD Ratio = 1 */ -if ((msel &0x3 ) ==0x0 ) -fpgamgr_set_cd_ratio (CDRATIO_x1); -/* MSEL[1:0] = 1, CD Ratio = 4 */ -else if ((msel &0x3 ) ==0x1 ) -fpgamgr_set_cd_ratio (CDRATIO_x4); -/* MSEL[1:0] = 2, CD Ratio = 8 */ -else if ((msel &0x3 ) ==0x2 ) -fpgamgr_set_cd_ratio (CDRATIO_x8); - - }else {/* MSEL[3] = 0 */ -clrbits_le32 (&fpgamgr_regs->ctrl, -FPGAMGRREGS_CTRL_CFGWDTH_MASK ); - -/* To determine the CD ratio */ -/* MSEL[1:0] = 0, CD Ratio = 1 */ -if ((msel &0x3 ) ==0x0 ) -fpgamgr_set_cd_ratio (CDRATIO_x1); -/* MSEL[1:0] = 1, CD Ratio = 2 */ -else if ((msel &0x3 ) ==0x1 ) -fpgamgr_set_cd_ratio (CDRATIO_x2); -/* MSEL[1:0] = 2, CD Ratio = 4 */ -else if ((msel &0x3 ) ==0x2 ) -fpgamgr_set_cd_ratio (CDRATIO_x4); - } - -/* To enable FPGA Manager configuration */ -clrbits_le32 (&fpgamgr_regs->ctrl,FPGAMGRREGS_CTRL_NCE_MASK ); - -/* To enable FPGA Manager drive over configuration line */ -setbits_le32 (&fpgamgr_regs->ctrl,FPGAMGRREGS_CTRL_EN_MASK ); - -/* Put FPGA into reset phase */ -setbits_le32 (&fpgamgr_regs->ctrl,FPGAMGRREGS_CTRL_NCONFIGPULL_MASK ); - -/* (1) wait until FPGA enter reset phase */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { -if (fpgamgr_get_mode () ==FPGAMGRREGS_MODE_RESETPHASE ) -break ; - } - -/* If not in reset state, return error */ -if (fpgamgr_get_mode () !=FPGAMGRREGS_MODE_RESETPHASE ) { -puts ("FPGA: Could not reset\n" ); -return -1 ; - } - -/* Release FPGA from reset phase */ -clrbits_le32 (&fpgamgr_regs->ctrl,FPGAMGRREGS_CTRL_NCONFIGPULL_MASK ); - -/* (2) wait until FPGA enter configuration phase */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { -if (fpgamgr_get_mode () ==FPGAMGRREGS_MODE_CFGPHASE ) -break ; - } - -/* If not in configuration state, return error */ -if (fpgamgr_get_mode () !=FPGAMGRREGS_MODE_CFGPHASE ) { -puts ("FPGA: Could not configure\n" ); -return -2 ; - } - -/* Clear all interrupts in CB Monitor */ -writel (0xFFF , &fpgamgr_regs->gpio_porta_eoi); - -/* Enable AXI configuration */ -setbits_le32 (&fpgamgr_regs->ctrl,FPGAMGRREGS_CTRL_AXICFGEN_MASK ); - -return 0 ; -} - -/* Write the RBF data to FPGA Manager */ -static void fpgamgr_program_write (const void *rbf_data,unsigned long rbf_size) -{ -uint32_t src = (uint32_t )rbf_data; -uint32_t dst =SOCFPGA_FPGAMGRDATA_ADDRESS ; - -/* Number of loops for 32-byte long copying. */ -uint32_t loops32 = rbf_size /32 ; -/* Number of loops for 4-byte long copying + trailing bytes */ -uint32_t loops4 =DIV_ROUND_UP (rbf_size %32 ,4 ); - - asmvolatile ( -"1: ldmia %0!, {r0-r7}\n" -" stmia %1!, {r0-r7}\n" -" sub %1, #32\n" -" subs %2, #1\n" -" bne 1b\n" -" cmp %3, #0\n" -" beq 3f\n" -"2: ldr %2, [%0], #4\n" -" str %2, [%1]\n" -" subs %3, #1\n" -" bne 2b\n" -"3: nop\n" - :"+r" (src),"+r" (dst),"+r" (loops32),"+r" (loops4) : - :"r0" ,"r1" ,"r2" ,"r3" ,"r4" ,"r5" ,"r6" ,"r7" ,"cc" ); -} - -/* Ensure the FPGA entering config done */ -static int fpgamgr_program_poll_cd (void ) -{ -const uint32_t mask =FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK | -FPGAMGRREGS_MON_GPIO_EXT_PORTA_CD_MASK ; -unsigned long reg, i; - -/* (3) wait until full config done */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { - reg =readl (&fpgamgr_regs->gpio_ext_porta); - -/* Config error */ -if (!(reg & mask)) { -printf ("FPGA: Configuration error.\n" ); -return -3 ; - } - -/* Config done without error */ -if (reg & mask) -break ; - } - -/* Timeout happened, return error */ -if (i ==FPGA_TIMEOUT_CNT ) { -printf ("FPGA: Timeout waiting for program.\n" ); -return -4 ; - } - -/* Disable AXI configuration */ -clrbits_le32 (&fpgamgr_regs->ctrl,FPGAMGRREGS_CTRL_AXICFGEN_MASK ); - -return 0 ; -} - -/* Ensure the FPGA entering init phase */ -static int fpgamgr_program_poll_initphase (void ) -{ -unsigned long i; - -/* Additional clocks for the CB to enter initialization phase */ -if (fpgamgr_dclkcnt_set (0x4 )) -return -5 ; - -/* (4) wait until FPGA enter init phase or user mode */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { -if (fpgamgr_get_mode () ==FPGAMGRREGS_MODE_INITPHASE ) -break ; -if (fpgamgr_get_mode () ==FPGAMGRREGS_MODE_USERMODE ) -break ; - } - -/* If not in configuration state, return error */ -if (i ==FPGA_TIMEOUT_CNT ) -return -6 ; - -return 0 ; -} - -/* Ensure the FPGA entering user mode */ -static int fpgamgr_program_poll_usermode (void ) -{ -unsigned long i; - -/* Additional clocks for the CB to exit initialization phase */ -if (fpgamgr_dclkcnt_set (0x5000 )) -return -7 ; - -/* (5) wait until FPGA enter user mode */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { -if (fpgamgr_get_mode () ==FPGAMGRREGS_MODE_USERMODE ) -break ; - } -/* If not in configuration state, return error */ -if (i ==FPGA_TIMEOUT_CNT ) -return -8 ; - -/* To release FPGA Manager drive over configuration line */ -clrbits_le32 (&fpgamgr_regs->ctrl,FPGAMGRREGS_CTRL_EN_MASK ); - -return 0 ; -} - -/* -* FPGA Manager to program the FPGA. This is the interface used by FPGA driver. -* Return 0 for sucess, non-zero for error. -*/ -int socfpga_load (Altera_desc *desc,const void *rbf_data,size_t rbf_size) -{ -unsigned long status; - -if ((uint32_t )rbf_data &0x3 ) { -puts ("FPGA: Unaligned data, realign to 32bit boundary.\n" ); -return -EINVAL ; - } - -/* Prior programming the FPGA, all bridges need to be shut off */ - -/* Disable all signals from hps peripheral controller to fpga */ -writel (0 , &sysmgr_regs->fpgaintfgrp_module); - -/* Disable all signals from FPGA to HPS SDRAM */ -#define SDR_CTRLGRP_FPGAPORTRST_ADDRESS 0x5080 -writel (0 ,SOCFPGA_SDR_ADDRESS +SDR_CTRLGRP_FPGAPORTRST_ADDRESS ); - -/* Disable all axi bridge (hps2fpga, lwhps2fpga & fpga2hps) */ -socfpga_bridges_reset (1 ); - -/* Unmap the bridges from NIC-301 */ -writel (0x1 ,SOCFPGA_L3REGS_ADDRESS ); - -/* Initialize the FPGA Manager */ - status =fpgamgr_program_init (); -if (status) -return status; - -/* Write the RBF data to FPGA Manager */ -fpgamgr_program_write (rbf_data, rbf_size); - -/* Ensure the FPGA entering config done */ - status =fpgamgr_program_poll_cd (); -if (status) -return status; - -/* Ensure the FPGA entering init phase */ - status =fpgamgr_program_poll_initphase (); -if (status) -return status; - -/* Ensure the FPGA entering user mode */ -return fpgamgr_program_poll_usermode (); -}drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +1
-28@@ -1,5 +1,5 @@/* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -14,9 +14,6 @@DECLARE_GLOBAL_DATA_PTR ; -/* Timeout count */ -#define FPGA_TIMEOUT_CNT 0x1000000 -static struct socfpga_fpga_manager *fpgamgr_regs = (struct socfpga_fpga_manager *)SOCFPGA_FPGAMGRREGS_ADDRESS ; static struct socfpga_system_manager *sysmgr_regs =@@ -30,29 +27,6 @@ static void fpgamgr_set_cd_ratio(unsigned long ratio) (ratio & 0x3) << FPGAMGRREGS_CTRL_CDRATIO_LSB); } -static int fpgamgr_dclkcnt_set (unsigned long cnt) -{ -unsigned long i; - -/* Clear any existing done status */ -if (readl (&fpgamgr_regs->dclkstat)) -writel (0x1 , &fpgamgr_regs->dclkstat); - -/* Write the dclkcnt */ -writel (cnt, &fpgamgr_regs->dclkcnt); - -/* Wait till the dclkcnt done */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { -if (!readl (&fpgamgr_regs->dclkstat)) -continue ; - -writel (0x1 , &fpgamgr_regs->dclkstat); -return 0 ; - } - -return -ETIMEDOUT ; -} -/* Start the FPGA programming by initialize the FPGA Manager */ static int fpgamgr_program_init (void ) {@@ -267,7 +241,6 @@ int socfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size) }/* Prior programming the FPGA, all bridges need to be shut off */ -/* Disable all signals from hps peripheral controller to fpga */ writel (0 , &sysmgr_regs->fpgaintfgrp_module);
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH 3/7 arm: socfpga: Restructure FPGA driver in the preparation to support A10.
Quoted 10 lines · Marek Vasut
Quoted 5 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Move FPGA driver which is Gen5 specific code into Gen5 files. No functional change.
It's a driver, so it should stay in
drivers/. If you need to split it,
split it indrivers/fpga/and addKconfigoption(s)
I am confused here, all the FPGA drivers which i split into common and platform specific are still in the drivers/fpga/. Could you explain more? Thanks.
Quoted 631 lines
Quoted 630 lines
Signed-off-by Tien Fong Chee <[email protected]>---
arch/arm/mach-socfpga/Makefile | 2 +- arch/arm/mach-socfpga/include/mach/fpga_manager.h | 65 +----.../mach/{fpga_manager.h=> fpga_manager_gen5.h} | 69 +++--- drivers/Makefile | 1 + drivers/fpga/Makefile | 1 + drivers/fpga/socfpga.c | 267 +-------
------------
drivers/fpga/{socfpga.c => socfpga_gen5.c} | 29 +--7 files changed, 48 insertions(+), 386 deletions(-)copy
arch/arm/mach-socfpga/include/mach/{fpga_manager.h=>fpga_manager_gen5.h} (57%)
copydrivers/fpga/{socfpga.c=>socfpga_gen5.c} (92%)arch/arm/mach- renamed from arch/arm/mach-socfpga/Makefile +0
-0socfpga/Makefile
index 41b779c..286bfef 100644arch/arm/mach-socfpga/Makefile +0
-0@@ -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.oarch/arm/mach-socfpga/Makefile +0
-0@@ -21,6 +20,7 @@ obj-y += reset_manager_gen5.oobj-y += scan_manager.o
obj-y += system_manager_gen5.o
obj-y += wrap_pll_config.o
+obj-y += fpga_manager.o
endif
ifdefCONFIG_TARGET_SOCFPGA_ARRIA10arch/arm/mach-socfpga/include/mach/fpga_manager.h +1
-1@@ -1,5 +1,5 @@ /* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -10,58 +10,9 @@
#include <altera.h>arch/arm/mach-socfpga/include/mach/fpga_manager.h +3
-52-struct socfpga_fpga_manager { -/* FPGA Manager Module */ -u32 stat;/* 0x00 */ -u32 ctrl; -u32 dclkcnt; -u32 dclkstat; -u32 gpo;/* 0x10 */ -u32 gpi; -u32 misci;/* 0x18 */ -u32 _pad_0x1c_0x82c[517 ]; - -/* Configuration Monitor (MON) Registers */ -u32 gpio_inten;/* 0x830 */ -u32 gpio_intmask; -u32 gpio_inttype_level; -u32 gpio_int_polarity; -u32 gpio_intstatus;/* 0x840 */ -u32 gpio_raw_intstatus; -u32 _pad_0x848; -u32 gpio_porta_eoi; -u32 gpio_ext_porta;/* 0x850 */ -u32 _pad_0x854_0x85c[3 ]; -u32 gpio_1s_sync;/* 0x860 */ -u32 _pad_0x864_0x868[2 ]; -u32 gpio_ver_id_code; -u32 gpio_config_reg2;/* 0x870 */ -u32 gpio_config_reg1; -}; - -#define FPGAMGRREGS_STAT_MODE_MASK 0x7 -#define FPGAMGRREGS_STAT_MSEL_MASK 0xf8 -#define FPGAMGRREGS_STAT_MSEL_LSB 3 - -#define FPGAMGRREGS_CTRL_CFGWDTH_MASK 0x200 -#define FPGAMGRREGS_CTRL_AXICFGEN_MASK 0x100 -#define FPGAMGRREGS_CTRL_NCONFIGPULL_MASK 0x4 -#define FPGAMGRREGS_CTRL_NCE_MASK 0x2 -#define FPGAMGRREGS_CTRL_EN_MASK 0x1 -#define FPGAMGRREGS_CTRL_CDRATIO_LSB 6 - -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CRC_MASK 0x8 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_ID_MASK 0x4 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CD_MASK 0x2 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK 0x1 - -/* FPGA Mode */ -#define FPGAMGRREGS_MODE_FPGAOFF 0x0 -#define FPGAMGRREGS_MODE_RESETPHASE 0x1 -#define FPGAMGRREGS_MODE_CFGPHASE 0x2 -#define FPGAMGRREGS_MODE_INITPHASE 0x3 -#define FPGAMGRREGS_MODE_USERMODE 0x4 -#define FPGAMGRREGS_MODE_UNKNOWN 0x5 +#if defined(CONFIG_TARGET_SOCFPGA_GEN5 ) +#include <asm/arch/fpga_manager_gen5.h> +#endif
/* FPGA CD Ratio Value */
#defineCDRATIO_x10x0arch/arm/mach-socfpga/include/mach/fpga_manager.h +0
-0@@ -74,4 +25,12 @@ int fpgamgr_test_fpga_ready(void); int fpgamgr_poll_fpga_ready(void); int fpgamgr_get_mode(void);arch/arm/mach-socfpga/include/mach/fpga_manager.h +8
-0+#define FPGA_TIMEOUT_CNT 0x1000000 + +#ifndef __ASSEMBLY__ + +/* Common prototypes */ +int fpgamgr_dclkcnt_set (unsigned long cnt); + +#endif /* __ASSEMBLY__ */ #endif /* _FPGA_MANAGER_H_ */
arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/fpga_manager.h +1
-1@@ -1,14 +1,38 @@ /* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/fpga_manager.h +2
-2-#ifndef _FPGA_MANAGER_H_ -#define _FPGA_MANAGER_H_ +#ifndef _FPGA_MANAGER_GEN5_H_ +#define _FPGA_MANAGER_GEN5_H_arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/fpga_manager.h +25
-1-#include <altera.h> +#define FPGAMGRREGS_STAT_MODE_MASK 0x7 +#define FPGAMGRREGS_STAT_MSEL_MASK 0xf8 +#define FPGAMGRREGS_STAT_MSEL_LSB 3 + +#define FPGAMGRREGS_CTRL_CFGWDTH_MASK BIT(9) +#define FPGAMGRREGS_CTRL_AXICFGEN_MASK BIT(8) +#define FPGAMGRREGS_CTRL_NCONFIGPULL_MASK BIT(2) +#define FPGAMGRREGS_CTRL_NCE_MASK BIT(1) +#define FPGAMGRREGS_CTRL_EN_MASK BIT(0) +#define FPGAMGRREGS_CTRL_CDRATIO_LSB 6 + +#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CRC_MASK BIT(3) +#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_ID_MASK BIT(2) +#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CD_MASK BIT(1) +#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK BIT(0) + +/* FPGA Mode */ +#define FPGAMGRREGS_MODE_FPGAOFF 0x0 +#define FPGAMGRREGS_MODE_RESETPHASE 0x1 +#define FPGAMGRREGS_MODE_CFGPHASE 0x2 +#define FPGAMGRREGS_MODE_INITPHASE 0x3 +#define FPGAMGRREGS_MODE_USERMODE 0x4 +#define FPGAMGRREGS_MODE_UNKNOWN 0x5 + +#ifndef __ASSEMBLY__
structsocfpga_fpga_manager{
/* FPGA Manager Module */arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/fpga_manager.h +0
-0@@ -39,39 +63,6 @@ struct socfpga_fpga_manager { u32 gpio_config_reg1; };arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/fpga_manager.h +1
-34-#define FPGAMGRREGS_STAT_MODE_MASK 0x7 -#define FPGAMGRREGS_STAT_MSEL_MASK 0xf8 -#define FPGAMGRREGS_STAT_MSEL_LSB 3 - -#define FPGAMGRREGS_CTRL_CFGWDTH_MASK 0x200 -#define FPGAMGRREGS_CTRL_AXICFGEN_MASK 0x100 -#define FPGAMGRREGS_CTRL_NCONFIGPULL_MASK 0x4 -#define FPGAMGRREGS_CTRL_NCE_MASK 0x2 -#define FPGAMGRREGS_CTRL_EN_MASK 0x1 -#define FPGAMGRREGS_CTRL_CDRATIO_LSB 6 - -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CRC_MASK 0x8 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_ID_MASK 0x4 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CD_MASK 0x2 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK 0x1 - -/* FPGA Mode */ -#define FPGAMGRREGS_MODE_FPGAOFF 0x0 -#define FPGAMGRREGS_MODE_RESETPHASE 0x1 -#define FPGAMGRREGS_MODE_CFGPHASE 0x2 -#define FPGAMGRREGS_MODE_INITPHASE 0x3 -#define FPGAMGRREGS_MODE_USERMODE 0x4 -#define FPGAMGRREGS_MODE_UNKNOWN 0x5 - -/* FPGA CD Ratio Value */ -#define CDRATIO_x1 0x0 -#define CDRATIO_x2 0x1 -#define CDRATIO_x4 0x2 -#define CDRATIO_x8 0x3 - -/* SoCFPGA support functions */ -int fpgamgr_test_fpga_ready (void ); -int fpgamgr_poll_fpga_ready (void ); -int fpgamgr_get_mode (void ); +#endif /* __ASSEMBLY__ */ arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/fpga_manager.h +1
-1-#endif /* _FPGA_MANAGER_H_ */ +#endif /* _FPGA_MANAGER_GEN5_H_ */ drivers/Makefile +0
-0@@ -47,6 +47,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_FPGA) += fpga/
endif
ifdefCONFIG_TPL_BUILDdrivers/fpga/Makefile +0
-0@@ -19,4 +19,5 @@ obj-$(CONFIG_FPGA_ACEX1K) += ACEX1K.oobj-$(CONFIG_FPGA_CYCLON2) += cyclon2.o obj-$(CONFIG_FPGA_STRATIX_II) += stratixII.o obj-$(CONFIG_FPGA_STRATIX_V) += stratixv.o +obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += socfpga_gen5.o endif
drivers/fpga/socfpga.c +1
-1@@ -1,5 +1,5 @@ /* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -14,23 +14,10 @@
DECLARE_GLOBAL_DATA_PTR;drivers/fpga/socfpga.c +0
-3-/* Timeout count */ -#define FPGA_TIMEOUT_CNT 0x1000000 -static struct
socfpga_fpga_manager*fpgamgr_regs= (structsocfpga_fpga_manager*)SOCFPGA_FPGAMGRREGS_ADDRESS;drivers/fpga/socfpga.c +0
-9-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);
-}drivers/fpga/socfpga.c +1
-1-static int fpgamgr_dclkcnt_set (unsigned long cnt) +int fpgamgr_dclkcnt_set (unsigned long cnt){
unsigned long i;drivers/fpga/socfpga.c +0
-0@@ -52,253 +39,3 @@ static int fpgamgr_dclkcnt_set(unsigned long cnt)
return-ETIMEDOUT;
}drivers/fpga/socfpga.c +0
-48- -/* Start the FPGA programming by initialize the FPGA Manager */ -static int fpgamgr_program_init (void ) -{ -unsigned long msel, i; - -/* Get the MSEL value */ - msel =readl (&fpgamgr_regs->stat); - msel &=FPGAMGRREGS_STAT_MSEL_MASK ; - msel >>=FPGAMGRREGS_STAT_MSEL_LSB ; - -/* -* Set the cfg width -* If MSEL[3] = 1, cfg width = 32 bit -*/ -if (msel &0x8 ) { -setbits_le32 (&fpgamgr_regs->ctrl, - FPGAMGRREGS_CTRL_CFGWDTH_MASK); - -/* To determine the CD ratio */ -/* MSEL[1:0] = 0, CD Ratio = 1 */ -if ((msel &0x3 ) ==0x0 ) -fpgamgr_set_cd_ratio (CDRATIO_x1); -/* MSEL[1:0] = 1, CD Ratio = 4 */ -else if ((msel &0x3 ) ==0x1 ) -fpgamgr_set_cd_ratio (CDRATIO_x4); -/* MSEL[1:0] = 2, CD Ratio = 8 */ -else if ((msel &0x3 ) ==0x2 ) -fpgamgr_set_cd_ratio (CDRATIO_x8); - - }else {/* MSEL[3] = 0 */ -clrbits_le32 (&fpgamgr_regs->ctrl, - FPGAMGRREGS_CTRL_CFGWDTH_MASK); - -/* To determine the CD ratio */ -/* MSEL[1:0] = 0, CD Ratio = 1 */ -if ((msel &0x3 ) ==0x0 ) -fpgamgr_set_cd_ratio (CDRATIO_x1); -/* MSEL[1:0] = 1, CD Ratio = 2 */ -else if ((msel &0x3 ) ==0x1 ) -fpgamgr_set_cd_ratio (CDRATIO_x2); -/* MSEL[1:0] = 2, CD Ratio = 4 */ -else if ((msel &0x3 ) ==0x2 ) -fpgamgr_set_cd_ratio (CDRATIO_x4); - } - -/* To enable FPGA Manager configuration */ - clrbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_NCE_MASK);drivers/fpga/socfpga.c +0
-3- -/* To enable FPGA Manager drive over configuration line */ - setbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_EN_MASK);drivers/fpga/socfpga.c +0
-3- -/* Put FPGA into reset phase */ - setbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_NCONFIGPULL_MASK);drivers/fpga/socfpga.c +0
-4- -/* (1) wait until FPGA enter reset phase */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { - if (fpgamgr_get_mode() ==
FPGAMGRREGS_MODE_RESETPHASE)drivers/fpga/socfpga.c +0
-11-break ; - } - -/* If not in reset state, return error */ -if (fpgamgr_get_mode () !=FPGAMGRREGS_MODE_RESETPHASE ) { -puts ("FPGA: Could not reset\n" ); -return -1 ; - } - -/* Release FPGA from reset phase */ - clrbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_NCONFIGPULL_MASK);drivers/fpga/socfpga.c +0
-4- -/* (2) wait until FPGA enter configuration phase */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { - if (fpgamgr_get_mode() ==
FPGAMGRREGS_MODE_CFGPHASE)drivers/fpga/socfpga.c +0
-14-break ; - } - -/* If not in configuration state, return error */ -if (fpgamgr_get_mode () !=FPGAMGRREGS_MODE_CFGPHASE ) { -puts ("FPGA: Could not configure\n" ); -return -2 ; - } - -/* Clear all interrupts in CB Monitor */ -writel (0xFFF , &fpgamgr_regs->gpio_porta_eoi); - -/* Enable AXI configuration */ - setbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_AXICFGEN_MASK);drivers/fpga/socfpga.c +0
-6- -return 0 ; -} - -/* Write the RBF data to FPGA Manager */ -static void fpgamgr_program_write(const void *rbf_data, unsignedlong
rbf_size)drivers/fpga/socfpga.c +0
-7-{ -uint32_t src = (uint32_t )rbf_data; -uint32_t dst =SOCFPGA_FPGAMGRDATA_ADDRESS ; - -/* Number of loops for 32-byte long copying. */ -uint32_t loops32 = rbf_size /32 ; -/* Number of loops for 4-byte long copying + trailing bytes */
drivers/fpga/socfpga.c +0
-11-uint32_t loops4 =DIV_ROUND_UP (rbf_size %32 ,4 ); - - asmvolatile ( -"1: ldmia %0!, {r0-r7}\n" -" stmia %1!, {r0-r7}\n" -" sub %1, #32\n" -" subs %2, #1\n" -" bne 1b\n" -" cmp %3, #0\n" -" beq 3f\n" - "2: ldr %2, [%0], #4\n"
drivers/fpga/socfpga.c +0
-5-" str %2, [%1]\n" -" subs %3, #1\n" -" bne 2b\n" -"3: nop\n" - : "+r"(src), "+r"(dst), "+r"(loops32),"+r"(loops4) :
drivers/fpga/socfpga.c +0
-1- : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7","cc");
drivers/fpga/socfpga.c +0
-6-} - -/* Ensure the FPGA entering config done */ -static int fpgamgr_program_poll_cd (void ) -{ - const uint32_t mask =
FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK|drivers/fpga/socfpga.c +0
-1- FPGAMGRREGS_MON_GPIO_EXT_PORTA_CD_MASK;
drivers/fpga/socfpga.c +0
-25-unsigned long reg, i; - -/* (3) wait until full config done */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { - reg =readl (&fpgamgr_regs->gpio_ext_porta); - -/* Config error */ -if (!(reg & mask)) { -printf ("FPGA: Configuration error.\n" ); -return -3 ; - } - -/* Config done without error */ -if (reg & mask) -break ; - } - -/* Timeout happened, return error */ -if (i ==FPGA_TIMEOUT_CNT ) { -printf ("FPGA: Timeout waiting for program.\n" ); -return -4 ; - } - -/* Disable AXI configuration */ - clrbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_AXICFGEN_MASK);drivers/fpga/socfpga.c +0
-10- -return 0 ; -} - -/* Ensure the FPGA entering init phase */ -static int fpgamgr_program_poll_initphase (void ) -{ -unsigned long i; - -/* Additional clocks for the CB to enter initialization phase */
drivers/fpga/socfpga.c +0
-6-if (fpgamgr_dclkcnt_set (0x4 )) -return -5 ; - -/* (4) wait until FPGA enter init phase or user mode */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { - if (fpgamgr_get_mode() ==
FPGAMGRREGS_MODE_INITPHASE)drivers/fpga/socfpga.c +0
-2-break ; - if (fpgamgr_get_mode() ==
FPGAMGRREGS_MODE_USERMODE)drivers/fpga/socfpga.c +0
-16-break ; - } - -/* If not in configuration state, return error */ -if (i ==FPGA_TIMEOUT_CNT ) -return -6 ; - -return 0 ; -} - -/* Ensure the FPGA entering user mode */ -static int fpgamgr_program_poll_usermode (void ) -{ -unsigned long i; - -/* Additional clocks for the CB to exit initialization phase */
drivers/fpga/socfpga.c +0
-6-if (fpgamgr_dclkcnt_set (0x5000 )) -return -7 ; - -/* (5) wait until FPGA enter user mode */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { - if (fpgamgr_get_mode() ==
FPGAMGRREGS_MODE_USERMODE)drivers/fpga/socfpga.c +0
-7-break ; - } -/* If not in configuration state, return error */ -if (i ==FPGA_TIMEOUT_CNT ) -return -8 ; - -/* To release FPGA Manager drive over configuration line */
drivers/fpga/socfpga.c +0
-1- clrbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_EN_MASK);drivers/fpga/socfpga.c +0
-6- -return 0 ; -} - -/* -* FPGA Manager to program the FPGA. This is the interface used by FPGA driver.
- * Return 0 for sucess, non-zero for error.
- */
-intsocfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size)drivers/fpga/socfpga.c +0
-5-{ -unsigned long status; - -if ((uint32_t )rbf_data &0x3 ) { - puts("FPGA: Unaligned data, realign to 32bitboundary.\n");
drivers/fpga/socfpga.c +0
-4-return -EINVAL ; - } - -/* Prior programming the FPGA, all bridges need to be shut off */
drivers/fpga/socfpga.c +0
-2- -/* Disable all signals from hps peripheral controller to fpga */
drivers/fpga/socfpga.c +0
-5-writel (0 , &sysmgr_regs->fpgaintfgrp_module); - -/* Disable all signals from FPGA to HPS SDRAM */ -#define SDR_CTRLGRP_FPGAPORTRST_ADDRESS 0x5080 - writel(0, SOCFPGA_SDR_ADDRESS +
SDR_CTRLGRP_FPGAPORTRST_ADDRESS);drivers/fpga/socfpga.c +0
-2- -/* Disable all axi bridge (hps2fpga, lwhps2fpga & fpga2hps) */
drivers/fpga/socfpga.c +0
-26-socfpga_bridges_reset (1 ); - -/* Unmap the bridges from NIC-301 */ -writel (0x1 ,SOCFPGA_L3REGS_ADDRESS ); - -/* Initialize the FPGA Manager */ - status =fpgamgr_program_init (); -if (status) -return status; - -/* Write the RBF data to FPGA Manager */ -fpgamgr_program_write (rbf_data, rbf_size); - -/* Ensure the FPGA entering config done */ - status =fpgamgr_program_poll_cd (); -if (status) -return status; - -/* Ensure the FPGA entering init phase */ - status =fpgamgr_program_poll_initphase (); -if (status) -return status; - -/* Ensure the FPGA entering user mode */ -return fpgamgr_program_poll_usermode (); -}drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +1
-1@@ -1,5 +1,5 @@ /* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -14,9 +14,6 @@
DECLARE_GLOBAL_DATA_PTR;drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +0
-3-/* Timeout count */ -#define FPGA_TIMEOUT_CNT 0x1000000 -static struct
socfpga_fpga_manager*fpgamgr_regs= (structsocfpga_fpga_manager*)SOCFPGA_FPGAMGRREGS_ADDRESS;
static structsocfpga_system_manager*sysmgr_regs=drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +0
-0@@ -30,29 +27,6 @@ static void fpgamgr_set_cd_ratio(unsigned long ratio)(ratio &
0x3) <<FPGAMGRREGS_CTRL_CDRATIO_LSB);
}drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +0
-23-static int fpgamgr_dclkcnt_set (unsigned long cnt) -{ -unsigned long i; - -/* Clear any existing done status */ -if (readl (&fpgamgr_regs->dclkstat)) -writel (0x1 , &fpgamgr_regs->dclkstat); - -/* Write the dclkcnt */ -writel (cnt, &fpgamgr_regs->dclkcnt); - -/* Wait till the dclkcnt done */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { -if (!readl (&fpgamgr_regs->dclkstat)) -continue ; - -writel (0x1 , &fpgamgr_regs->dclkstat); -return 0 ; - } - -return -ETIMEDOUT ; -} -/* Start the FPGA programming by initialize the FPGA Manager */ static int
fpgamgr_program_init(void)
{drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +0
-0@@ -267,7 +241,6 @@ int socfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size) }
/* Prior programming the FPGA, all bridges need to be shut off */
-
/* Disable all signals from hps peripheral controller to fpga */
writel(0, &sysmgr_regs->fpgaintfgrp_module);
PATCH 3/7 arm: socfpga: Restructure FPGA driver in the preparation to support A10.
Quoted 7 lines · Tien Fong
Quoted 6 lines · Marek Vasut
Quoted 5 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Move FPGA driver which is Gen5 specific code into Gen5 files. No functional change.
Quoted 7 lines
Quoted 4 lines
It's a driver, so it should stay in
drivers/. If you need to split it,
split it indrivers/fpga/and addKconfigoption(s)I am confused here, all the FPGA drivers which i split into common and platform specific are still in the
drivers/fpga/. Could you explain more? Thanks.
The driver code should be in drivers/fpga/ , so unless there's a good reason, don't move any of it into arch/arm/
Quoted 630 lines
Quoted 630 lines
Quoted 630 lines
Signed-off-by Tien Fong Chee <[email protected]>--- arch/arm/mach-socfpga/Makefile | 2 +- arch/arm/mach-socfpga/include/mach/fpga_manager.h | 65 +---- .../mach/{fpga_manager.h => fpga_manager_gen5.h} | 69 +++--- drivers/Makefile | 1 + drivers/fpga/Makefile | 1 + drivers/fpga/socfpga.c | 267 +------- ------------ drivers/fpga/{socfpga.c => socfpga_gen5.c} | 29 +-- 7 files changed, 48 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} (92%)arch/arm/mach- renamed from arch/arm/mach-socfpga/Makefile +0
-0socfpga/Makefile
index 41b779c..286bfef 100644arch/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_ARRIA10arch/arm/mach-socfpga/include/mach/fpga_manager.h +12
-53@@ -1,5 +1,5 @@/* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -10,58 +10,9 @@#include <altera.h> -struct socfpga_fpga_manager { -/* FPGA Manager Module */ -u32 stat;/* 0x00 */ -u32 ctrl; -u32 dclkcnt; -u32 dclkstat; -u32 gpo;/* 0x10 */ -u32 gpi; -u32 misci;/* 0x18 */ -u32 _pad_0x1c_0x82c[517 ]; - -/* Configuration Monitor (MON) Registers */ -u32 gpio_inten;/* 0x830 */ -u32 gpio_intmask; -u32 gpio_inttype_level; -u32 gpio_int_polarity; -u32 gpio_intstatus;/* 0x840 */ -u32 gpio_raw_intstatus; -u32 _pad_0x848; -u32 gpio_porta_eoi; -u32 gpio_ext_porta;/* 0x850 */ -u32 _pad_0x854_0x85c[3 ]; -u32 gpio_1s_sync;/* 0x860 */ -u32 _pad_0x864_0x868[2 ]; -u32 gpio_ver_id_code; -u32 gpio_config_reg2;/* 0x870 */ -u32 gpio_config_reg1; -}; - -#define FPGAMGRREGS_STAT_MODE_MASK 0x7 -#define FPGAMGRREGS_STAT_MSEL_MASK 0xf8 -#define FPGAMGRREGS_STAT_MSEL_LSB 3 - -#define FPGAMGRREGS_CTRL_CFGWDTH_MASK 0x200 -#define FPGAMGRREGS_CTRL_AXICFGEN_MASK 0x100 -#define FPGAMGRREGS_CTRL_NCONFIGPULL_MASK 0x4 -#define FPGAMGRREGS_CTRL_NCE_MASK 0x2 -#define FPGAMGRREGS_CTRL_EN_MASK 0x1 -#define FPGAMGRREGS_CTRL_CDRATIO_LSB 6 - -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CRC_MASK 0x8 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_ID_MASK 0x4 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CD_MASK 0x2 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK 0x1 - -/* FPGA Mode */ -#define FPGAMGRREGS_MODE_FPGAOFF 0x0 -#define FPGAMGRREGS_MODE_RESETPHASE 0x1 -#define FPGAMGRREGS_MODE_CFGPHASE 0x2 -#define FPGAMGRREGS_MODE_INITPHASE 0x3 -#define FPGAMGRREGS_MODE_USERMODE 0x4 -#define FPGAMGRREGS_MODE_UNKNOWN 0x5 +#if defined(CONFIG_TARGET_SOCFPGA_GEN5 ) +#include <asm/arch/fpga_manager_gen5.h> +#endif /* FPGA CD Ratio Value */ #define CDRATIO_x1 0x0@@ -74,4 +25,12 @@ int fpgamgr_test_fpga_ready(void);int fpgamgr_poll_fpga_ready (void );int fpgamgr_get_mode (void ); +#define FPGA_TIMEOUT_CNT 0x1000000 + +#ifndef __ASSEMBLY__ + +/* Common prototypes */ +int fpgamgr_dclkcnt_set (unsigned long cnt); + +#endif /* __ASSEMBLY__ */ #endif /* _FPGA_MANAGER_H_ */ arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/fpga_manager.h +30
-39@@ -1,14 +1,38 @@/* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef _FPGA_MANAGER_H_ -#define _FPGA_MANAGER_H_ +#ifndef _FPGA_MANAGER_GEN5_H_ +#define _FPGA_MANAGER_GEN5_H_ -#include <altera.h> +#define FPGAMGRREGS_STAT_MODE_MASK 0x7 +#define FPGAMGRREGS_STAT_MSEL_MASK 0xf8 +#define FPGAMGRREGS_STAT_MSEL_LSB 3 + +#define FPGAMGRREGS_CTRL_CFGWDTH_MASK BIT(9) +#define FPGAMGRREGS_CTRL_AXICFGEN_MASK BIT(8) +#define FPGAMGRREGS_CTRL_NCONFIGPULL_MASK BIT(2) +#define FPGAMGRREGS_CTRL_NCE_MASK BIT(1) +#define FPGAMGRREGS_CTRL_EN_MASK BIT(0) +#define FPGAMGRREGS_CTRL_CDRATIO_LSB 6 + +#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CRC_MASK BIT(3) +#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_ID_MASK BIT(2) +#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CD_MASK BIT(1) +#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK BIT(0) + +/* FPGA Mode */ +#define FPGAMGRREGS_MODE_FPGAOFF 0x0 +#define FPGAMGRREGS_MODE_RESETPHASE 0x1 +#define FPGAMGRREGS_MODE_CFGPHASE 0x2 +#define FPGAMGRREGS_MODE_INITPHASE 0x3 +#define FPGAMGRREGS_MODE_USERMODE 0x4 +#define FPGAMGRREGS_MODE_UNKNOWN 0x5 + +#ifndef __ASSEMBLY__ struct socfpga_fpga_manager {/* FPGA Manager Module */ @@ -39,39 +63,6 @@ struct socfpga_fpga_manager {u32 gpio_config_reg1; }; -#define FPGAMGRREGS_STAT_MODE_MASK 0x7 -#define FPGAMGRREGS_STAT_MSEL_MASK 0xf8 -#define FPGAMGRREGS_STAT_MSEL_LSB 3 - -#define FPGAMGRREGS_CTRL_CFGWDTH_MASK 0x200 -#define FPGAMGRREGS_CTRL_AXICFGEN_MASK 0x100 -#define FPGAMGRREGS_CTRL_NCONFIGPULL_MASK 0x4 -#define FPGAMGRREGS_CTRL_NCE_MASK 0x2 -#define FPGAMGRREGS_CTRL_EN_MASK 0x1 -#define FPGAMGRREGS_CTRL_CDRATIO_LSB 6 - -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CRC_MASK 0x8 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_ID_MASK 0x4 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CD_MASK 0x2 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK 0x1 - -/* FPGA Mode */ -#define FPGAMGRREGS_MODE_FPGAOFF 0x0 -#define FPGAMGRREGS_MODE_RESETPHASE 0x1 -#define FPGAMGRREGS_MODE_CFGPHASE 0x2 -#define FPGAMGRREGS_MODE_INITPHASE 0x3 -#define FPGAMGRREGS_MODE_USERMODE 0x4 -#define FPGAMGRREGS_MODE_UNKNOWN 0x5 - -/* FPGA CD Ratio Value */ -#define CDRATIO_x1 0x0 -#define CDRATIO_x2 0x1 -#define CDRATIO_x4 0x2 -#define CDRATIO_x8 0x3 - -/* SoCFPGA support functions */ -int fpgamgr_test_fpga_ready (void ); -int fpgamgr_poll_fpga_ready (void ); -int fpgamgr_get_mode (void ); +#endif /* __ASSEMBLY__ */ -#endif /* _FPGA_MANAGER_H_ */ +#endif /* _FPGA_MANAGER_GEN5_H_ */ drivers/Makefile +1
-0@@ -47,6 +47,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_FPGA) += fpga/ endif ifdef CONFIG_TPL_BUILDdrivers/fpga/Makefile +1
-0@@ -19,4 +19,5 @@ obj-$(CONFIG_FPGA_ACEX1K) += ACEX1K.o obj-$(CONFIG_FPGA_CYCLON2) += cyclon2.o obj-$(CONFIG_FPGA_STRATIX_II) += stratixII.o obj-$(CONFIG_FPGA_STRATIX_V) += stratixv.o +obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += socfpga_gen5.o endifdrivers/fpga/socfpga.c +2
-15@@ -1,5 +1,5 @@/* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -14,23 +14,10 @@DECLARE_GLOBAL_DATA_PTR ; -/* Timeout count */ -#define FPGA_TIMEOUT_CNT 0x1000000 -static 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); -} -static int fpgamgr_dclkcnt_set (unsigned long cnt) +int fpgamgr_dclkcnt_set (unsigned long cnt) {drivers/fpga/socfpga.c +0
-48unsigned long i;@@ -52,253 +39,3 @@ static int fpgamgr_dclkcnt_set(unsigned long cnt)return -ETIMEDOUT ; } - -/* Start the FPGA programming by initialize the FPGA Manager */ -static int fpgamgr_program_init (void ) -{ -unsigned long msel, i; - -/* Get the MSEL value */ - msel =readl (&fpgamgr_regs->stat); - msel &=FPGAMGRREGS_STAT_MSEL_MASK ; - msel >>=FPGAMGRREGS_STAT_MSEL_LSB ; - -/* -* Set the cfg width -* If MSEL[3] = 1, cfg width = 32 bit -*/ -if (msel &0x8 ) { -setbits_le32 (&fpgamgr_regs->ctrl, -FPGAMGRREGS_CTRL_CFGWDTH_MASK ); - -/* To determine the CD ratio */ -/* MSEL[1:0] = 0, CD Ratio = 1 */ -if ((msel &0x3 ) ==0x0 ) -fpgamgr_set_cd_ratio (CDRATIO_x1); -/* MSEL[1:0] = 1, CD Ratio = 4 */ -else if ((msel &0x3 ) ==0x1 ) -fpgamgr_set_cd_ratio (CDRATIO_x4); -/* MSEL[1:0] = 2, CD Ratio = 8 */ -else if ((msel &0x3 ) ==0x2 ) -fpgamgr_set_cd_ratio (CDRATIO_x8); - - }else {/* MSEL[3] = 0 */ -clrbits_le32 (&fpgamgr_regs->ctrl, -FPGAMGRREGS_CTRL_CFGWDTH_MASK ); - -/* To determine the CD ratio */ -/* MSEL[1:0] = 0, CD Ratio = 1 */ -if ((msel &0x3 ) ==0x0 ) -fpgamgr_set_cd_ratio (CDRATIO_x1); -/* MSEL[1:0] = 1, CD Ratio = 2 */ -else if ((msel &0x3 ) ==0x1 ) -fpgamgr_set_cd_ratio (CDRATIO_x2); -/* MSEL[1:0] = 2, CD Ratio = 4 */ -else if ((msel &0x3 ) ==0x2 ) -fpgamgr_set_cd_ratio (CDRATIO_x4); - } - -/* To enable FPGA Manager configuration */ - clrbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_NCE_MASK);drivers/fpga/socfpga.c +0
-3- -/* To enable FPGA Manager drive over configuration line */ - setbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_EN_MASK);drivers/fpga/socfpga.c +0
-3- -/* Put FPGA into reset phase */ - setbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_NCONFIGPULL_MASK);drivers/fpga/socfpga.c +0
-4- -/* (1) wait until FPGA enter reset phase */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { - if (fpgamgr_get_mode() ==
FPGAMGRREGS_MODE_RESETPHASE)drivers/fpga/socfpga.c +0
-11-break ; - } - -/* If not in reset state, return error */ -if (fpgamgr_get_mode () !=FPGAMGRREGS_MODE_RESETPHASE ) { -puts ("FPGA: Could not reset\n" ); -return -1 ; - } - -/* Release FPGA from reset phase */ - clrbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_NCONFIGPULL_MASK);drivers/fpga/socfpga.c +0
-4- -/* (2) wait until FPGA enter configuration phase */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { - if (fpgamgr_get_mode() ==
FPGAMGRREGS_MODE_CFGPHASE)drivers/fpga/socfpga.c +0
-14-break ; - } - -/* If not in configuration state, return error */ -if (fpgamgr_get_mode () !=FPGAMGRREGS_MODE_CFGPHASE ) { -puts ("FPGA: Could not configure\n" ); -return -2 ; - } - -/* Clear all interrupts in CB Monitor */ -writel (0xFFF , &fpgamgr_regs->gpio_porta_eoi); - -/* Enable AXI configuration */ - setbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_AXICFGEN_MASK);drivers/fpga/socfpga.c +0
-6- -return 0 ; -} - -/* Write the RBF data to FPGA Manager */ -static void fpgamgr_program_write(const void *rbf_data, unsignedlong
rbf_size)drivers/fpga/socfpga.c +0
-7-{ -uint32_t src = (uint32_t )rbf_data; -uint32_t dst =SOCFPGA_FPGAMGRDATA_ADDRESS ; - -/* Number of loops for 32-byte long copying. */ -uint32_t loops32 = rbf_size /32 ; -/* Number of loops for 4-byte long copying + trailing bytes */
drivers/fpga/socfpga.c +0
-11-uint32_t loops4 =DIV_ROUND_UP (rbf_size %32 ,4 ); - - asmvolatile ( -"1: ldmia %0!, {r0-r7}\n" -" stmia %1!, {r0-r7}\n" -" sub %1, #32\n" -" subs %2, #1\n" -" bne 1b\n" -" cmp %3, #0\n" -" beq 3f\n" - "2: ldr %2, [%0], #4\n"
drivers/fpga/socfpga.c +0
-5-" str %2, [%1]\n" -" subs %3, #1\n" -" bne 2b\n" -"3: nop\n" - : "+r"(src), "+r"(dst), "+r"(loops32),"+r"(loops4) :
drivers/fpga/socfpga.c +0
-1- : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7","cc");
drivers/fpga/socfpga.c +0
-6-} - -/* Ensure the FPGA entering config done */ -static int fpgamgr_program_poll_cd (void ) -{ - const uint32_t mask =
FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK|drivers/fpga/socfpga.c +0
-1-FPGAMGRREGS_MON_GPIO_EXT_PORTA_CD_MA SK;
drivers/fpga/socfpga.c +0
-25-unsigned long reg, i; - -/* (3) wait until full config done */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { - reg =readl (&fpgamgr_regs->gpio_ext_porta); - -/* Config error */ -if (!(reg & mask)) { -printf ("FPGA: Configuration error.\n" ); -return -3 ; - } - -/* Config done without error */ -if (reg & mask) -break ; - } - -/* Timeout happened, return error */ -if (i ==FPGA_TIMEOUT_CNT ) { -printf ("FPGA: Timeout waiting for program.\n" ); -return -4 ; - } - -/* Disable AXI configuration */ - clrbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_AXICFGEN_MASK);drivers/fpga/socfpga.c +0
-10- -return 0 ; -} - -/* Ensure the FPGA entering init phase */ -static int fpgamgr_program_poll_initphase (void ) -{ -unsigned long i; - -/* Additional clocks for the CB to enter initialization phase */
drivers/fpga/socfpga.c +0
-6-if (fpgamgr_dclkcnt_set (0x4 )) -return -5 ; - -/* (4) wait until FPGA enter init phase or user mode */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { - if (fpgamgr_get_mode() ==
FPGAMGRREGS_MODE_INITPHASE)drivers/fpga/socfpga.c +0
-2-break ; - if (fpgamgr_get_mode() ==
FPGAMGRREGS_MODE_USERMODE)drivers/fpga/socfpga.c +0
-16-break ; - } - -/* If not in configuration state, return error */ -if (i ==FPGA_TIMEOUT_CNT ) -return -6 ; - -return 0 ; -} - -/* Ensure the FPGA entering user mode */ -static int fpgamgr_program_poll_usermode (void ) -{ -unsigned long i; - -/* Additional clocks for the CB to exit initialization phase */
drivers/fpga/socfpga.c +0
-6-if (fpgamgr_dclkcnt_set (0x5000 )) -return -7 ; - -/* (5) wait until FPGA enter user mode */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { - if (fpgamgr_get_mode() ==
FPGAMGRREGS_MODE_USERMODE)drivers/fpga/socfpga.c +0
-7-break ; - } -/* If not in configuration state, return error */ -if (i ==FPGA_TIMEOUT_CNT ) -return -8 ; - -/* To release FPGA Manager drive over configuration line */
drivers/fpga/socfpga.c +0
-1- clrbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_EN_MASK);drivers/fpga/socfpga.c +0
-6- -return 0 ; -} - -/* -* FPGA Manager to program the FPGA. This is the interface used by FPGA driver.
- * Return 0 for sucess, non-zero for error.
- */
-intsocfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size)drivers/fpga/socfpga.c +0
-5-{ -unsigned long status; - -if ((uint32_t )rbf_data &0x3 ) { - puts("FPGA: Unaligned data, realign to 32bitboundary.\n");
drivers/fpga/socfpga.c +0
-4-return -EINVAL ; - } - -/* Prior programming the FPGA, all bridges need to be shut off */
drivers/fpga/socfpga.c +0
-2- -/* Disable all signals from hps peripheral controller to fpga */
drivers/fpga/socfpga.c +0
-5-writel (0 , &sysmgr_regs->fpgaintfgrp_module); - -/* Disable all signals from FPGA to HPS SDRAM */ -#define SDR_CTRLGRP_FPGAPORTRST_ADDRESS 0x5080 - writel(0, SOCFPGA_SDR_ADDRESS +
SDR_CTRLGRP_FPGAPORTRST_ADDRESS);drivers/fpga/socfpga.c +0
-2- -/* Disable all axi bridge (hps2fpga, lwhps2fpga & fpga2hps) */
drivers/fpga/socfpga.c +0
-26-socfpga_bridges_reset (1 ); - -/* Unmap the bridges from NIC-301 */ -writel (0x1 ,SOCFPGA_L3REGS_ADDRESS ); - -/* Initialize the FPGA Manager */ - status =fpgamgr_program_init (); -if (status) -return status; - -/* Write the RBF data to FPGA Manager */ -fpgamgr_program_write (rbf_data, rbf_size); - -/* Ensure the FPGA entering config done */ - status =fpgamgr_program_poll_cd (); -if (status) -return status; - -/* Ensure the FPGA entering init phase */ - status =fpgamgr_program_poll_initphase (); -if (status) -return status; - -/* Ensure the FPGA entering user mode */ -return fpgamgr_program_poll_usermode (); -}drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +1
-4@@ -1,5 +1,5 @@/* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -14,9 +14,6 @@DECLARE_GLOBAL_DATA_PTR ; -/* Timeout count */ -#define FPGA_TIMEOUT_CNT 0x1000000 -static struct socfpga_fpga_manager *fpgamgr_regs = (struct socfpga_fpga_manager *)SOCFPGA_FPGAMGRREGS_ADDRESS ;static struct
socfpga_system_manager*sysmgr_regs=drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +0
-23@@ -30,29 +27,6 @@ static void fpgamgr_set_cd_ratio(unsigned long ratio) (ratio &0x3 ) << FPGAMGRREGS_CTRL_CDRATIO_LSB); } -static int fpgamgr_dclkcnt_set (unsigned long cnt) -{ -unsigned long i; - -/* Clear any existing done status */ -if (readl (&fpgamgr_regs->dclkstat)) -writel (0x1 , &fpgamgr_regs->dclkstat); - -/* Write the dclkcnt */ -writel (cnt, &fpgamgr_regs->dclkcnt); - -/* Wait till the dclkcnt done */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { -if (!readl (&fpgamgr_regs->dclkstat)) -continue ; - -writel (0x1 , &fpgamgr_regs->dclkstat); -return 0 ; - } - -return -ETIMEDOUT ; -} -/* Start the FPGA programming by initialize the FPGA Manager */ static int
fpgamgr_program_init(void)
{drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +0
-0@@ -267,7 +241,6 @@ int socfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size) }/* Prior programming the FPGA, all bridges need to be shut off */
drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +0
-1-/* Disable all signals from hps peripheral controller to fpga */
writel(0, &sysmgr_regs->fpgaintfgrp_module);
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH 3/7 arm: socfpga: Restructure FPGA driver in the preparation to support A10.
Quoted 16 lines · Marek Vasut
Quoted 15 lines · Tien Fong
Quoted 13 lines · Marek Vasut
Quoted 6 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Move FPGA driver which is Gen5 specific code into Gen5 files. No functional change.
It's a driver, so it should stay in
drivers/. If you need to split
it,
split it indrivers/fpga/and addKconfigoption(s)
Quoted 7 lines
Quoted 4 lines
I am confused here, all the FPGA drivers which i split into common and
platform specific are still in thedrivers/fpga/. Could you explain more? Thanks.The driver code should be in
drivers/fpga/, so unless there's a good reason, don't move any of it intoarch/arm/
Yeah, i agree with you. Hence, the patch 3, patch 4 and patch 5 are for moving all fpga drivers into drivers/fpga/, and header files into include/intel_socfpga/ .
Quoted 661 lines
Quoted 660 lines
Quoted 660 lines
Quoted 660 lines
Signed-off-by Tien Fong Chee <[email protected]>---
arch/arm/mach-socfpga/Makefile | 2 +- arch/arm/mach-socfpga/include/mach/fpga_manager.h | 65 +--- -
.../mach/{fpga_manager.h => fpga_manager_gen5.h} | 69 +++- --
drivers/Makefile | 1 + drivers/fpga/Makefile | 1 + drivers/fpga/socfpga.c | 267 +---
----
------------
drivers/fpga/{socfpga.c => socfpga_gen5.c} | 29 +--7 files changed, 48 insertions(+), 386 deletions(-)copy
arch/arm/mach-socfpga/include/mach/{fpga_manager.h=>fpga_manager_gen5.h} (57%)
copydrivers/fpga/{socfpga.c=>socfpga_gen5.c} (92%)arch/arm/mach- renamed from arch/arm/mach-socfpga/Makefile +0
-0socfpga/Makefile
index 41b779c..286bfef 100644arch/arm/mach-socfpga/Makefile +0
-0@@ -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.oarch/arm/mach-socfpga/Makefile +0
-0@@ -21,6 +20,7 @@ obj-y += reset_manager_gen5.oobj-y += scan_manager.o
obj-y += system_manager_gen5.o
obj-y += wrap_pll_config.o
+obj-y += fpga_manager.o
endif
ifdefCONFIG_TARGET_SOCFPGA_ARRIA10arch/arm/mach-socfpga/include/mach/fpga_manager.h +1
-1@@ -1,5 +1,5 @@ /* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -10,58 +10,9 @@
#include <altera.h>arch/arm/mach-socfpga/include/mach/fpga_manager.h +3
-52-struct socfpga_fpga_manager { -/* FPGA Manager Module */ -u32 stat;/* 0x00 */ -u32 ctrl; -u32 dclkcnt; -u32 dclkstat; -u32 gpo;/* 0x10 */ -u32 gpi; -u32 misci;/* 0x18 */ -u32 _pad_0x1c_0x82c[517 ]; - -/* Configuration Monitor (MON) Registers */ -u32 gpio_inten;/* 0x830 */ -u32 gpio_intmask; -u32 gpio_inttype_level; -u32 gpio_int_polarity; -u32 gpio_intstatus;/* 0x840 */ -u32 gpio_raw_intstatus; -u32 _pad_0x848; -u32 gpio_porta_eoi; -u32 gpio_ext_porta;/* 0x850 */ -u32 _pad_0x854_0x85c[3 ]; -u32 gpio_1s_sync;/* 0x860 */ -u32 _pad_0x864_0x868[2 ]; -u32 gpio_ver_id_code; -u32 gpio_config_reg2;/* 0x870 */ -u32 gpio_config_reg1; -}; - -#define FPGAMGRREGS_STAT_MODE_MASK 0x7 -#define FPGAMGRREGS_STAT_MSEL_MASK 0xf8 -#define FPGAMGRREGS_STAT_MSEL_LSB 3 - -#define FPGAMGRREGS_CTRL_CFGWDTH_MASK 0x200 -#define FPGAMGRREGS_CTRL_AXICFGEN_MASK 0x100 -#define FPGAMGRREGS_CTRL_NCONFIGPULL_MASK 0x4 -#define FPGAMGRREGS_CTRL_NCE_MASK 0x2 -#define FPGAMGRREGS_CTRL_EN_MASK 0x1 -#define FPGAMGRREGS_CTRL_CDRATIO_LSB 6 - -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CRC_MASK 0x8 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_ID_MASK 0x4 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CD_MASK 0x2 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK 0x1 - -/* FPGA Mode */ -#define FPGAMGRREGS_MODE_FPGAOFF 0x0 -#define FPGAMGRREGS_MODE_RESETPHASE 0x1 -#define FPGAMGRREGS_MODE_CFGPHASE 0x2 -#define FPGAMGRREGS_MODE_INITPHASE 0x3 -#define FPGAMGRREGS_MODE_USERMODE 0x4 -#define FPGAMGRREGS_MODE_UNKNOWN 0x5 +#if defined(CONFIG_TARGET_SOCFPGA_GEN5 ) +#include <asm/arch/fpga_manager_gen5.h> +#endif
/* FPGA CD Ratio Value */
#defineCDRATIO_x10x0arch/arm/mach-socfpga/include/mach/fpga_manager.h +0
-0@@ -74,4 +25,12 @@ int fpgamgr_test_fpga_ready(void); int fpgamgr_poll_fpga_ready(void); int fpgamgr_get_mode(void);arch/arm/mach-socfpga/include/mach/fpga_manager.h +8
-0+#define FPGA_TIMEOUT_CNT 0x1000000 + +#ifndef __ASSEMBLY__ + +/* Common prototypes */ +int fpgamgr_dclkcnt_set (unsigned long cnt); + +#endif /* __ASSEMBLY__ */ #endif /* _FPGA_MANAGER_H_ */
arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/fpga_manager.h +1
-1@@ -1,14 +1,38 @@ /* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/fpga_manager.h +2
-2-#ifndef _FPGA_MANAGER_H_ -#define _FPGA_MANAGER_H_ +#ifndef _FPGA_MANAGER_GEN5_H_ +#define _FPGA_MANAGER_GEN5_H_arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/fpga_manager.h +25
-1-#include <altera.h> +#define FPGAMGRREGS_STAT_MODE_MASK 0x7 +#define FPGAMGRREGS_STAT_MSEL_MASK 0xf8 +#define FPGAMGRREGS_STAT_MSEL_LSB 3 + +#define FPGAMGRREGS_CTRL_CFGWDTH_MASK BIT(9) +#define FPGAMGRREGS_CTRL_AXICFGEN_MASK BIT(8) +#define FPGAMGRREGS_CTRL_NCONFIGPULL_MASK BIT(2) +#define FPGAMGRREGS_CTRL_NCE_MASK BIT(1) +#define FPGAMGRREGS_CTRL_EN_MASK BIT(0) +#define FPGAMGRREGS_CTRL_CDRATIO_LSB 6 + +#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CRC_MASK BIT(3) +#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_ID_MASK BIT(2) +#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CD_MASK BIT(1) +#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK BIT(0) + +/* FPGA Mode */ +#define FPGAMGRREGS_MODE_FPGAOFF 0x0 +#define FPGAMGRREGS_MODE_RESETPHASE 0x1 +#define FPGAMGRREGS_MODE_CFGPHASE 0x2 +#define FPGAMGRREGS_MODE_INITPHASE 0x3 +#define FPGAMGRREGS_MODE_USERMODE 0x4 +#define FPGAMGRREGS_MODE_UNKNOWN 0x5 + +#ifndef __ASSEMBLY__
structsocfpga_fpga_manager{
/* FPGA Manager Module */arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/fpga_manager.h +0
-0@@ -39,39 +63,6 @@ struct socfpga_fpga_manager { u32 gpio_config_reg1; };arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/fpga_manager.h +1
-34-#define FPGAMGRREGS_STAT_MODE_MASK 0x7 -#define FPGAMGRREGS_STAT_MSEL_MASK 0xf8 -#define FPGAMGRREGS_STAT_MSEL_LSB 3 - -#define FPGAMGRREGS_CTRL_CFGWDTH_MASK 0x200 -#define FPGAMGRREGS_CTRL_AXICFGEN_MASK 0x100 -#define FPGAMGRREGS_CTRL_NCONFIGPULL_MASK 0x4 -#define FPGAMGRREGS_CTRL_NCE_MASK 0x2 -#define FPGAMGRREGS_CTRL_EN_MASK 0x1 -#define FPGAMGRREGS_CTRL_CDRATIO_LSB 6 - -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CRC_MASK 0x8 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_ID_MASK 0x4 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_CD_MASK 0x2 -#define FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK 0x1 - -/* FPGA Mode */ -#define FPGAMGRREGS_MODE_FPGAOFF 0x0 -#define FPGAMGRREGS_MODE_RESETPHASE 0x1 -#define FPGAMGRREGS_MODE_CFGPHASE 0x2 -#define FPGAMGRREGS_MODE_INITPHASE 0x3 -#define FPGAMGRREGS_MODE_USERMODE 0x4 -#define FPGAMGRREGS_MODE_UNKNOWN 0x5 - -/* FPGA CD Ratio Value */ -#define CDRATIO_x1 0x0 -#define CDRATIO_x2 0x1 -#define CDRATIO_x4 0x2 -#define CDRATIO_x8 0x3 - -/* SoCFPGA support functions */ -int fpgamgr_test_fpga_ready (void ); -int fpgamgr_poll_fpga_ready (void ); -int fpgamgr_get_mode (void ); +#endif /* __ASSEMBLY__ */ arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/fpga_manager.h +1
-1-#endif /* _FPGA_MANAGER_H_ */ +#endif /* _FPGA_MANAGER_GEN5_H_ */ drivers/Makefile +0
-0@@ -47,6 +47,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_FPGA) += fpga/
endif
ifdefCONFIG_TPL_BUILDdrivers/fpga/Makefile +0
-0@@ -19,4 +19,5 @@ obj-$(CONFIG_FPGA_ACEX1K) += ACEX1K.oobj-$(CONFIG_FPGA_CYCLON2) += cyclon2.o obj-$(CONFIG_FPGA_STRATIX_II) += stratixII.o obj-$(CONFIG_FPGA_STRATIX_V) += stratixv.o +obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += socfpga_gen5.o endif
drivers/fpga/socfpga.c +1
-1@@ -1,5 +1,5 @@ /* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -14,23 +14,10 @@
DECLARE_GLOBAL_DATA_PTR;drivers/fpga/socfpga.c +0
-3-/* Timeout count */ -#define FPGA_TIMEOUT_CNT 0x1000000 -static struct
socfpga_fpga_manager*fpgamgr_regs= (structsocfpga_fpga_manager*)SOCFPGA_FPGAMGRREGS_ADDRESS;drivers/fpga/socfpga.c +0
-2-static struct socfpga_system_manager *sysmgr_regs = - (struct socfpga_system_manager*)SOCFPGA_SYSMGR_ADDRESS;
drivers/fpga/socfpga.c +0
-7- -/* 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);
-}drivers/fpga/socfpga.c +1
-1-static int fpgamgr_dclkcnt_set (unsigned long cnt) +int fpgamgr_dclkcnt_set (unsigned long cnt){
unsigned long i;drivers/fpga/socfpga.c +0
-0@@ -52,253 +39,3 @@ static int fpgamgr_dclkcnt_set(unsignedlong
cnt)
return-ETIMEDOUT;
}drivers/fpga/socfpga.c +0
-2- -/* Start the FPGA programming by initialize the FPGA Manager */
drivers/fpga/socfpga.c +0
-46-static int fpgamgr_program_init (void ) -{ -unsigned long msel, i; - -/* Get the MSEL value */ - msel =readl (&fpgamgr_regs->stat); - msel &=FPGAMGRREGS_STAT_MSEL_MASK ; - msel >>=FPGAMGRREGS_STAT_MSEL_LSB ; - -/* -* Set the cfg width -* If MSEL[3] = 1, cfg width = 32 bit -*/ -if (msel &0x8 ) { -setbits_le32 (&fpgamgr_regs->ctrl, - FPGAMGRREGS_CTRL_CFGWDTH_MASK); - -/* To determine the CD ratio */ -/* MSEL[1:0] = 0, CD Ratio = 1 */ -if ((msel &0x3 ) ==0x0 ) -fpgamgr_set_cd_ratio (CDRATIO_x1); -/* MSEL[1:0] = 1, CD Ratio = 4 */ -else if ((msel &0x3 ) ==0x1 ) -fpgamgr_set_cd_ratio (CDRATIO_x4); -/* MSEL[1:0] = 2, CD Ratio = 8 */ -else if ((msel &0x3 ) ==0x2 ) -fpgamgr_set_cd_ratio (CDRATIO_x8); - - }else {/* MSEL[3] = 0 */ -clrbits_le32 (&fpgamgr_regs->ctrl, - FPGAMGRREGS_CTRL_CFGWDTH_MASK); - -/* To determine the CD ratio */ -/* MSEL[1:0] = 0, CD Ratio = 1 */ -if ((msel &0x3 ) ==0x0 ) -fpgamgr_set_cd_ratio (CDRATIO_x1); -/* MSEL[1:0] = 1, CD Ratio = 2 */ -else if ((msel &0x3 ) ==0x1 ) -fpgamgr_set_cd_ratio (CDRATIO_x2); -/* MSEL[1:0] = 2, CD Ratio = 4 */ -else if ((msel &0x3 ) ==0x2 ) -fpgamgr_set_cd_ratio (CDRATIO_x4); - } - -/* To enable FPGA Manager configuration */ - clrbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_NCE_MASK);drivers/fpga/socfpga.c +0
-2- -/* To enable FPGA Manager drive over configuration line */
drivers/fpga/socfpga.c +0
-1- setbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_EN_MASK);drivers/fpga/socfpga.c +0
-3- -/* Put FPGA into reset phase */ - setbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_NCONFIGPULL_MASK);drivers/fpga/socfpga.c +0
-4- -/* (1) wait until FPGA enter reset phase */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { - if (fpgamgr_get_mode() ==
FPGAMGRREGS_MODE_RESETPHASE)drivers/fpga/socfpga.c +0
-5-break ; - } - -/* If not in reset state, return error */ -if (fpgamgr_get_mode () !=FPGAMGRREGS_MODE_RESETPHASE ){
drivers/fpga/socfpga.c +0
-6-puts ("FPGA: Could not reset\n" ); -return -1 ; - } - -/* Release FPGA from reset phase */ - clrbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_NCONFIGPULL_MASK);drivers/fpga/socfpga.c +0
-4- -/* (2) wait until FPGA enter configuration phase */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { - if (fpgamgr_get_mode() ==
FPGAMGRREGS_MODE_CFGPHASE)drivers/fpga/socfpga.c +0
-14-break ; - } - -/* If not in configuration state, return error */ -if (fpgamgr_get_mode () !=FPGAMGRREGS_MODE_CFGPHASE ) { -puts ("FPGA: Could not configure\n" ); -return -2 ; - } - -/* Clear all interrupts in CB Monitor */ -writel (0xFFF , &fpgamgr_regs->gpio_porta_eoi); - -/* Enable AXI configuration */ - setbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_AXICFGEN_MASK);drivers/fpga/socfpga.c +0
-6- -return 0 ; -} - -/* Write the RBF data to FPGA Manager */ -static void fpgamgr_program_write(const void *rbf_data,unsigned
longrbf_size)drivers/fpga/socfpga.c +0
-7-{ -uint32_t src = (uint32_t )rbf_data; -uint32_t dst =SOCFPGA_FPGAMGRDATA_ADDRESS ; - -/* Number of loops for 32-byte long copying. */ -uint32_t loops32 = rbf_size /32 ; -/* Number of loops for 4-byte long copying + trailing bytes */
drivers/fpga/socfpga.c +0
-11-uint32_t loops4 =DIV_ROUND_UP (rbf_size %32 ,4 ); - - asmvolatile ( -"1: ldmia %0!, {r0-r7}\n" -" stmia %1!, {r0-r7}\n" -" sub %1, #32\n" -" subs %2, #1\n" -" bne 1b\n" -" cmp %3, #0\n" -" beq 3f\n" - "2: ldr %2, [%0],#4\n
"drivers/fpga/socfpga.c +0
-5-" str %2, [%1]\n" -" subs %3, #1\n" -" bne 2b\n" -"3: nop\n" - : "+r"(src), "+r"(dst), "+r"(loops32),"+r"(loops4) :
drivers/fpga/socfpga.c +0
-1- : "r0", "r1", "r2", "r3", "r4", "r5", "r6","r7",
"cc");drivers/fpga/socfpga.c +0
-6-} - -/* Ensure the FPGA entering config done */ -static int fpgamgr_program_poll_cd (void ) -{ - const uint32_t mask =
FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK|drivers/fpga/socfpga.c +0
-1- FPGAMGRREGS_MON_GPIO_EXT_PORTA_C
D_MA
SK;drivers/fpga/socfpga.c +0
-9-unsigned long reg, i; - -/* (3) wait until full config done */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { - reg =readl (&fpgamgr_regs->gpio_ext_porta); - -/* Config error */ -if (!(reg & mask)) { - printf("FPGA: Configurationerror.\n");
drivers/fpga/socfpga.c +0
-11-return -3 ; - } - -/* Config done without error */ -if (reg & mask) -break ; - } - -/* Timeout happened, return error */ -if (i ==FPGA_TIMEOUT_CNT ) { - printf("FPGA: Timeout waiting forprogram.\n");
drivers/fpga/socfpga.c +0
-5-return -4 ; - } - -/* Disable AXI configuration */ - clrbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_AXICFGEN_MASK);drivers/fpga/socfpga.c +0
-10- -return 0 ; -} - -/* Ensure the FPGA entering init phase */ -static int fpgamgr_program_poll_initphase (void ) -{ -unsigned long i; - -/* Additional clocks for the CB to enter initialization
phase */drivers/fpga/socfpga.c +0
-4-if (fpgamgr_dclkcnt_set (0x4 )) -return -5 ; - -/* (4) wait until FPGA enter init phase or user mode */
drivers/fpga/socfpga.c +0
-2-for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { - if (fpgamgr_get_mode() ==
FPGAMGRREGS_MODE_INITPHASE)drivers/fpga/socfpga.c +0
-2-break ; - if (fpgamgr_get_mode() ==
FPGAMGRREGS_MODE_USERMODE)drivers/fpga/socfpga.c +0
-16-break ; - } - -/* If not in configuration state, return error */ -if (i ==FPGA_TIMEOUT_CNT ) -return -6 ; - -return 0 ; -} - -/* Ensure the FPGA entering user mode */ -static int fpgamgr_program_poll_usermode (void ) -{ -unsigned long i; - -/* Additional clocks for the CB to exit initialization phase */
drivers/fpga/socfpga.c +0
-6-if (fpgamgr_dclkcnt_set (0x5000 )) -return -7 ; - -/* (5) wait until FPGA enter user mode */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { - if (fpgamgr_get_mode() ==
FPGAMGRREGS_MODE_USERMODE)drivers/fpga/socfpga.c +0
-7-break ; - } -/* If not in configuration state, return error */ -if (i ==FPGA_TIMEOUT_CNT ) -return -8 ; - -/* To release FPGA Manager drive over configuration line
*/drivers/fpga/socfpga.c +0
-1- clrbits_le32(&fpgamgr_regs->ctrl,
FPGAMGRREGS_CTRL_EN_MASK);drivers/fpga/socfpga.c +0
-6- -return 0 ; -} - -/* -* FPGA Manager to program the FPGA. This is the interface used by
FPGA driver.
- * Return 0 for sucess, non-zero for error.
- */
-int socfpga_load(Altera_desc *desc, const void*rbf_data,size_trbf_size)drivers/fpga/socfpga.c +0
-5-{ -unsigned long status; - -if ((uint32_t )rbf_data &0x3 ) { - puts("FPGA: Unaligned data, realign to 32bitboundary.\n");
drivers/fpga/socfpga.c +0
-4-return -EINVAL ; - } - -/* Prior programming the FPGA, all bridges need to be shut
off */drivers/fpga/socfpga.c +0
-2- -/* Disable all signals from hps peripheral controller to
fpga */drivers/fpga/socfpga.c +0
-5-writel (0 , &sysmgr_regs->fpgaintfgrp_module); - -/* Disable all signals from FPGA to HPS SDRAM */ -#define SDR_CTRLGRP_FPGAPORTRST_ADDRESS 0x5080 - writel(0, SOCFPGA_SDR_ADDRESS +
SDR_CTRLGRP_FPGAPORTRST_ADDRESS);drivers/fpga/socfpga.c +0
-2- -/* Disable all axi bridge (hps2fpga, lwhps2fpga & fpga2hps) */
drivers/fpga/socfpga.c +0
-26-socfpga_bridges_reset (1 ); - -/* Unmap the bridges from NIC-301 */ -writel (0x1 ,SOCFPGA_L3REGS_ADDRESS ); - -/* Initialize the FPGA Manager */ - status =fpgamgr_program_init (); -if (status) -return status; - -/* Write the RBF data to FPGA Manager */ -fpgamgr_program_write (rbf_data, rbf_size); - -/* Ensure the FPGA entering config done */ - status =fpgamgr_program_poll_cd (); -if (status) -return status; - -/* Ensure the FPGA entering init phase */ - status =fpgamgr_program_poll_initphase (); -if (status) -return status; - -/* Ensure the FPGA entering user mode */ -return fpgamgr_program_poll_usermode (); -}drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +1
-1@@ -1,5 +1,5 @@ /* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -14,9 +14,6 @@
DECLARE_GLOBAL_DATA_PTR;drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +0
-3-/* Timeout count */ -#define FPGA_TIMEOUT_CNT 0x1000000 -static struct
socfpga_fpga_manager*fpgamgr_regs= (structsocfpga_fpga_manager*)SOCFPGA_FPGAMGRREGS_ADDRESS;
static structsocfpga_system_manager*sysmgr_regs=drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +0
-0@@ -30,29 +27,6 @@ static void fpgamgr_set_cd_ratio(unsignedlong
ratio)
(ratio &0x3) <<FPGAMGRREGS_CTRL_CDRATIO_LSB);
}drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +0
-23-static int fpgamgr_dclkcnt_set (unsigned long cnt) -{ -unsigned long i; - -/* Clear any existing done status */ -if (readl (&fpgamgr_regs->dclkstat)) -writel (0x1 , &fpgamgr_regs->dclkstat); - -/* Write the dclkcnt */ -writel (cnt, &fpgamgr_regs->dclkcnt); - -/* Wait till the dclkcnt done */ -for (i =0 ; i <FPGA_TIMEOUT_CNT ; i++) { -if (!readl (&fpgamgr_regs->dclkstat)) -continue ; - -writel (0x1 , &fpgamgr_regs->dclkstat); -return 0 ; - } - -return -ETIMEDOUT ; -} -/* Start the FPGA programming by initialize the FPGA Manager */
static intfpgamgr_program_init(void)
{drivers/fpga/socfpga_gen5.c renamed from drivers/fpga/socfpga.c +0
-0@@ -267,7 +241,6 @@ int socfpga_load(Altera_desc *desc, constvoid
*rbf_data,size_trbf_size)
}
/* Prior programming the FPGA, all bridges need to be shut
off */
-
/* Disable all signals from hps peripheral controller to
fpga */
writel(0, &sysmgr_regs->fpgaintfgrp_module);
PATCH 4/7 arm: socfpga: Move FPGA manager driver to FPGA driver
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Move FPGA manager driver which is Gen5 specific code into FPGA driver. No functional change.
--- arch/arm/mach-socfpga/Makefile | 1 - arch/arm/mach-socfpga/fpga_manager.c | 78 ---------------------------------- drivers/fpga/socfpga_gen5.c | 54 +++++++++++++++++++++++ 3 files changed, 54 insertions(+), 79 deletions(-) delete mode 100644 arch/arm/mach-socfpga/fpga_manager.c
arch/arm/mach-socfpga/Makefile +0 -1
@@ -20,7 +20,6 @@ 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/fpga_manager.c deleted +0 -78
78 lines not on this page · raw message
drivers/fpga/socfpga_gen5.c +54 -0
60 lines not on this page · raw message
Signature · 1 line
1.7.7.4
PATCH 5/7 arm: socfpga: Move the FPGA driver header from arch to include directory
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Move FPGA driver header to include directory which would be shared between arch platform drivers and FPGA drivers.
--- arch/arm/mach-socfpga/reset_manager_arria10.c | 2 +- arch/arm/mach-socfpga/reset_manager_gen5.c | 5 +- arch/arm/mach-socfpga/system_manager_gen5.c | 2 +- drivers/ddr/altera/sdram.c | 7 ++- drivers/fpga/socfpga.c | 2 +- drivers/fpga/socfpga_gen5.c | 2 +- include/intel_socfpga/fpga_manager.h | 36 +++++++++++++ include/intel_socfpga/fpga_manager_gen5.h | 68 +++++++++++++++++++++++++ 8 files changed, 115 insertions(+), 9 deletions(-) create mode 100644 include/intel_socfpga/fpga_manager.h create mode 100644 include/intel_socfpga/fpga_manager_gen5.h
arch/arm/mach-socfpga/reset_manager_arria10.c +1 -1
@@ -5,13 +5,13 @@*/ #include <asm/io.h> -#include <asm/arch/fpga_manager.h> #include <asm/arch/misc.h> #include <asm/arch/reset_manager.h> #include <asm/arch/system_manager.h> #include <common.h> #include <errno.h> #include <fdtdec.h> +#include <intel_socfpga/fpga_manager.h> #include <wait_bit.h> DECLARE_GLOBAL_DATA_PTR ;
arch/arm/mach-socfpga/reset_manager_gen5.c +2 -3
@@ -1,13 +1,12 @@/* -* Copyright (C) 2013 Altera Corporation <www.altera.com> +* Copyright (C) 2013-2017 Altera Corporation <www.altera.com> * * SPDX-License-Identifier: GPL-2.0+ */ -#include <common.h> #include <asm/io.h> -#include <asm/arch/fpga_manager.h> +#include <intel_socfpga/fpga_manager.h> #include <asm/arch/reset_manager.h> #include <asm/arch/system_manager.h>
arch/arm/mach-socfpga/system_manager_gen5.c +1 -1
@@ -7,7 +7,7 @@#include <common.h> #include <asm/io.h> #include <asm/arch/system_manager.h> -#include <asm/arch/fpga_manager.h> +#include <intel_socfpga/fpga_manager.h> DECLARE_GLOBAL_DATA_PTR ;
drivers/ddr/altera/sdram.c +5 -2
@@ -1,17 +1,20 @@/* -* Copyright Altera Corporation (C) 2014-2015 +* Copyright Altera Corporation (C) 2014-2017 * * SPDX-License-Identifier: GPL-2.0+ */ +#include <common.h> #include <errno.h> #include <div64.h> #include <watchdog.h> -#include <asm/arch/fpga_manager.h> +#include <intel_socfpga/fpga_manager.h> #include <asm/arch/sdram.h> #include <asm/arch/system_manager.h> #include <asm/io.h> + +DECLARE_GLOBAL_DATA_PTR ;struct sdram_prot_rule {
drivers/fpga/socfpga.c +1 -1
@@ -8,7 +8,7 @@#include <common.h> #include <asm/io.h> #include <linux/errno.h> -#include <asm/arch/fpga_manager.h> +#include <intel_socfpga/fpga_manager.h> #include <asm/arch/reset_manager.h> #include <asm/arch/system_manager.h>
drivers/fpga/socfpga_gen5.c +1 -1
@@ -8,7 +8,7 @@#include <common.h> #include <asm/io.h> #include <linux/errno.h> -#include <asm/arch/fpga_manager.h> +#include <intel_socfpga/fpga_manager.h> #include <asm/arch/reset_manager.h> #include <asm/arch/system_manager.h>
include/intel_socfpga/fpga_manager.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* Copyright (C) 2012-2017 Altera Corporation <www.altera.com> +* All rights reserved. +* +* SPDX-License-Identifier: BSD-3-Clause +*/ + +#ifndef _FPGA_MANAGER_H_ +#define _FPGA_MANAGER_H_ + +#include <altera.h> + +#if defined(CONFIG_TARGET_SOCFPGA_GEN5 ) +#include <intel_socfpga/fpga_manager_gen5.h> +#endif + +/* FPGA CD Ratio Value */ +#define CDRATIO_x1 0x0 +#define CDRATIO_x2 0x1 +#define CDRATIO_x4 0x2 +#define CDRATIO_x8 0x3 + +/* SoCFPGA support functions */ +int fpgamgr_test_fpga_ready (void ); +int fpgamgr_poll_fpga_ready (void ); +int fpgamgr_get_mode (void ); + +#define FPGA_TIMEOUT_CNT 0x1000000 + +#ifndef __ASSEMBLY__ + +/* Common prototypes */ +int fpgamgr_dclkcnt_set (unsigned long cnt); + +#endif /* __ASSEMBLY__ */ +#endif /* _FPGA_MANAGER_H_ */
include/intel_socfpga/fpga_manager_gen5.h new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
1.7.7.4
PATCH 6/7 arm: socfpga: Add Arria10 FPGA manager program assembly driver
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Adding the Arria10 FPGA manager program assembly driver which can be used to feed bitstream into FPGA manager for configuring FPGA.
--- arch/arm/mach-socfpga/Makefile | 1 + arch/arm/mach-socfpga/lowlevel_init.S | 48 +++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-socfpga/lowlevel_init.S
arch/arm/mach-socfpga/Makefile +1 -0
@@ -24,6 +24,7 @@ endif ifdef CONFIG_TARGET_SOCFPGA_ARRIA10 obj-y += clock_manager_arria10.o +obj-y += lowlevel_init.o obj-y += misc_arria10.o obj-y += pinmux_arria10.o obj-y += reset_manager_arria10.o
arch/arm/mach-socfpga/lowlevel_init.S new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
1.7.7.4
PATCH 6/7 arm: socfpga: Add Arria10 FPGA manager program assembly driver
Quoted 36 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Adding the Arria10 FPGA manager program assembly driver which can be used to feed bitstream into FPGA manager for configuring FPGA.
Signed-off-by Tien Fong Chee <[email protected]>--- arch/arm/mach-socfpga/Makefile | 1 + arch/arm/mach-socfpga/lowlevel_init.S | 48 +++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-socfpga/lowlevel_init.Sarch/arm/mach-socfpga/Makefile +1
-0@@ -24,6 +24,7 @@ endif ifdef CONFIG_TARGET_SOCFPGA_ARRIA10 obj-y += clock_manager_arria10.o +obj-y += lowlevel_init.o obj-y += misc_arria10.o obj-y += pinmux_arria10.o obj-y += reset_manager_arria10.oarch/arm/mach-socfpga/lowlevel_init.S new file +6
-0@@ -0,0 +1,48 @@ +/* + * Copyright (C) 2017 Intel Corporation <www.intel.com> + * + * SPDX-License-Identifier: GPL-2.0 + */ +
arch/arm/mach-socfpga/lowlevel_init.S line 16
Quoted 10 lines
arch/arm/mach-socfpga/lowlevel_init.S new file +10
-0+#include <asm-offsets.h> +#include <config.h> +#include <linux/linkage.h> + +/* + * Write RBF data in burst form to FPGA Manager + * [r0] RBF binary source address + * [r1] FPGA Manager data address + * [r2] RBF data length + */
We do the same for Gen5 in C code with a bit of assembly, so do the same.
Quoted 32 lines
arch/arm/mach-socfpga/lowlevel_init.S new file +31
-0+ENTRY(fpgamgr_axi_write) + PUSH {r4-r11, lr} /* save registers per AAPCS */ + +write_burst: + cmp r2,#32 + beq write_burst_cont + bls write_word +write_burst_cont: + ldmia r0!, {r4-r11} + stmia r1, {r4-r11} + subs r2, r2, #32 + b write_burst + +write_word: + cmp r2,#4 + beq write_word_cont + bls write_byte +write_word_cont: + ldmia r0!, {r4} + stmia r1, {r4} + subs r2, r2, #4 + b write_word + +write_byte: + cmp r2,#0 + beq write_end + ldr r3, [r0] + str r3, [r1] +write_end: + POP {r4-r11, pc} +ENDPROC(fpgamgr_axi_write)
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH 6/7 arm: socfpga: Add Arria10 FPGA manager program assembly driver
Quoted 46 lines · Marek Vasut
Quoted 45 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Adding the Arria10 FPGA manager program assembly driver which can be used
to feed bitstream into FPGA manager for configuring FPGA.Signed-off-by Tien Fong Chee <[email protected]>---
arch/arm/mach-socfpga/Makefile | 1 +
arch/arm/mach-socfpga/lowlevel_init.S | 48
+++++++++++++++++++++++++++++++++2 files changed, 49 insertions(+), 0 deletions(-)create mode 100644
arch/arm/mach-socfpga/lowlevel_init.Sarch/arm/mach- renamed from arch/arm/mach-socfpga/Makefile +0
-0socfpga/Makefile
index 824cd8e..8b86dc7 100644arch/arm/mach-socfpga/Makefile +0
-0@@ -24,6 +24,7 @@ endif
ifdefCONFIG_TARGET_SOCFPGA_ARRIA10
obj-y += clock_manager_arria10.o
+obj-y += lowlevel_init.o
obj-y += misc_arria10.o
obj-y += pinmux_arria10.o
obj-y += reset_manager_arria10.oarch/arm/mach- renamed from arch/arm/mach-socfpga/lowlevel_init.S +0
-0
socfpga/lowlevel_init.S
new file mode 100644
index 0000000..79e9d07arch/arm/mach-socfpga/lowlevel_init.S new file +10
-0@@ -0,0 +1,48 @@ +/* + * Copyright (C) 2017 Intel Corporation <www.intel.com> + * + * SPDX-License-Identifier: GPL-2.0 + */ + +#include <asm-offsets.h> +#include <config.h> +#include <linux/linkage.h> +
Quoted 9 lines
arch/arm/mach-socfpga/lowlevel_init.S line 16
Quoted 6 lines
arch/arm/mach-socfpga/lowlevel_init.S new file +6
-0+/* + * Write RBF data in burst form to FPGA Manager + * [r0] RBF binary source address + * [r1] FPGA Manager data address + * [r2] RBF data length + */We do the same for Gen5 in C code with a bit of assembly, so do the same.
Okay, i just saw it, thanks for pointing out.
Quoted 35 lines
Quoted 34 lines
arch/arm/mach-socfpga/lowlevel_init.S new file +2
-0+ENTRY(fpgamgr_axi_write) + PUSH {r4-r11, lr} /* save registers perAAPCS */
arch/arm/mach-socfpga/lowlevel_init.S new file +29
-0+ +write_burst: + cmp r2,#32 + beq write_burst_cont + bls write_word +write_burst_cont: + ldmia r0!, {r4-r11} + stmia r1, {r4-r11} + subs r2, r2, #32 + b write_burst + +write_word: + cmp r2,#4 + beq write_word_cont + bls write_byte +write_word_cont: + ldmia r0!, {r4} + stmia r1, {r4} + subs r2, r2, #4 + b write_word + +write_byte: + cmp r2,#0 + beq write_end + ldr r3, [r0] + str r3, [r1] +write_end: + POP {r4-r11, pc} +ENDPROC(fpgamgr_axi_write)
PATCH 7/7 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.
--- drivers/fpga/Kconfig | 2 +- drivers/fpga/Makefile | 1 + drivers/fpga/socfpga_arria10.c | 490 ++++++++++++++++++++++++++ include/intel_socfpga/fpga_manager.h | 2 + include/intel_socfpga/fpga_manager_arria10.h | 107 ++++++ 5 files changed, 601 insertions(+), 1 deletions(-) create mode 100644 drivers/fpga/socfpga_arria10.c create mode 100644 include/intel_socfpga/fpga_manager_arria10.h
drivers/fpga/Kconfig +1 -1
@@ -7,7 +7,7 @@ config FPGA config FPGA_ALTERA bool "Enable Altera FPGA drivers" - default y if TARGET_SOCFPGA_GEN5 && CMD_FPGA + default y if (TARGET_SOCFPGA_GEN5 && CMD_FPGA) || TARGET_SOCFPGA_ARRIA10 select FPGA help Default Y here to enable the Altera FPGA driver
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_TARGET_SOCFPGA_GEN5) += socfpga_gen5.o +obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += socfpga_arria10.o endif
drivers/fpga/socfpga_arria10.c new file +490 -0
490 lines not on this page · raw message
include/intel_socfpga/fpga_manager.h +2 -0
@@ -12,6 +12,8 @@#if defined(CONFIG_TARGET_SOCFPGA_GEN5 )#include <intel_socfpga/fpga_manager_gen5.h> +#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) +#include <intel_socfpga/fpga_manager_arria10.h> #endif /* FPGA CD Ratio Value */
include/intel_socfpga/fpga_manager_arria10.h new file +107 -0
107 lines not on this page · raw message
Signature · 1 line
1.7.7.4