Skip to contentSkip to conversation

ARM: socfpga: Fix FPGA bitstream loading code

PATCH New Marek Vasut 4 participants 18 messages May 7, 2019 – Dec 1, 2019 FPGA manager framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

According to SoCFPGA Cyclone V datasheet rev.2018.01.26 page 175 (Chapter 5, FPGA Manager, data register) and Arria10 datasheet rev.2017.07.22 page 211 (Chapter 5.4.1.2, FPGA Manager, img_data_w register), the FPGA data register must be written with writes with non-incrementing address.

The current code increments the address in 32-byte bursts. Fix the code so it does not increment the address and writes the register repeatedly instead.

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>
---
 drivers/fpga/socfpga.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/fpga/socfpga.c +1 -2
index 685957626b..6ecea771ce 100644
@@ -55,8 +55,7 @@ void fpgamgr_program_write(const void *rbf_data, size_t rbf_size)
 		"	cmp	%2,	#0\n"
 		"	beq	2f\n"
 		"1:	ldmia	%0!,	{r0-r7}\n"
-		"	stmia	%1!,	{r0-r7}\n"
-		"	sub	%1,	#32\n"
+		"	stmia	%1,	{r0-r7}\n"
 		"	subs	%2,	#1\n"
 		"	bne	1b\n"
 		"2:	cmp	%3,	#0\n"
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

Quoted 23 lines · Marek Vasut

According to SoCFPGA Cyclone V datasheet rev.2018.01.26 page 175 (Chapter 5, FPGA Manager, data register) and Arria10 datasheet rev.2017.07.22 page 211 (Chapter 5.4.1.2, FPGA Manager, img_data_w register), the FPGA data register must be written with writes with non-incrementing address.

The current code increments the address in 32-byte bursts. Fix the code so it does not increment the address and writes the register repeatedly instead. >

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>
---
  drivers/fpga/socfpga.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/fpga/socfpga.c +0 -0
index 685957626b..6ecea771ce 100644

drivers/fpga/socfpga.c void fpgamgr_program_write(const void *rbf_data, size_t rbf_size) · line 58

Quoted 6 lines
drivers/fpga/socfpga.c +1 -2
@@ -55,8 +55,7 @@ void fpgamgr_program_write(const void *rbf_data, size_t rbf_size)
  		"	cmp	%2,	#0\n"
  		"	beq	2f\n"
  		"1:	ldmia	%0!,	{r0-r7}\n"
-		"	stmia	%1!,	{r0-r7}\n"
-		"	sub	%1,	#32\n"
+		"	stmia	%1,	{r0-r7}\n"

Iirc, stmia without the "!" still stores the registers to different addresses, it just does not change %1 any more if you leave away the "!"? So this would save on opcode, but not change anything?

Regards,
Simon

Quoted 4 lines
drivers/fpga/socfpga.c +0 -0
  		"	subs	%2,	#1\n"
  		"	bne	1b\n"
  		"2:	cmp	%3,	#0\n"
#2 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

Quoted 21 lines · Simon Goldschmidt
Quoted 18 lines · Marek Vasut

According to SoCFPGA Cyclone V datasheet rev.2018.01.26 page 175 (Chapter 5, FPGA Manager, data register) and Arria10 datasheet rev.2017.07.22 page 211 (Chapter 5.4.1.2, FPGA Manager, img_data_w register), the FPGA data register must be written with writes with non-incrementing address.

The current code increments the address in 32-byte bursts. Fix the code so it does not increment the address and writes the register repeatedly instead. >

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>

---
  drivers/fpga/socfpga.c | 3 +--

  1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 16 lines
Quoted 6 lines
drivers/fpga/socfpga.c +0 -0
index 685957626b..6ecea771ce 100644
@@ -55,8 +55,7 @@ void fpgamgr_program_write(const void *rbf_data,
 size_t rbf_size)
Quoted 6 lines

          "    cmp    %2,    #0\n"
          "    beq    2f\n"
          "1:    ldmia    %0!,    {r0-r7}\n"
-        "    stmia    %1!,    {r0-r7}\n"
-        "    sub    %1,    #32\n"
+        "    stmia    %1,    {r0-r7}\n"

Iirc, stmia without the "!" still stores the registers to different addresses, it just does not change %1 any more if you leave away the "!"? So this would save on opcode, but not change anything?

Uh oh, you're right. Do we have a bigger problem here then ? Or is the socfpga ignoring the bottom 5 bits of this register address ?

Signature · 2 lines
Best regards,
Marek Vasut
#3 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

Quoted 39 lines · Marek Vasut
Quoted 21 lines · Simon Goldschmidt
Quoted 18 lines · Marek Vasut

According to SoCFPGA Cyclone V datasheet rev.2018.01.26 page 175 (Chapter 5, FPGA Manager, data register) and Arria10 datasheet rev.2017.07.22 page 211 (Chapter 5.4.1.2, FPGA Manager, img_data_w register), the FPGA data register must be written with writes with non-incrementing address.

The current code increments the address in 32-byte bursts. Fix the code so it does not increment the address and writes the register repeatedly instead. >

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>
---
   drivers/fpga/socfpga.c | 3 +--
   1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 16 lines

drivers/fpga/socfpga.c void fpgamgr_program_write(const void *rbf_data, · line 59

Quoted 12 lines
drivers/fpga/socfpga.c +1 -2
index 685957626b..6ecea771ce 100644
@@ -55,8 +55,7 @@ void fpgamgr_program_write(const void *rbf_data,
 size_t rbf_size)
           "    cmp    %2,    #0\n"
           "    beq    2f\n"
           "1:    ldmia    %0!,    {r0-r7}\n"
-        "    stmia    %1!,    {r0-r7}\n"
-        "    sub    %1,    #32\n"
+        "    stmia    %1,    {r0-r7}\n"

Iirc, stmia without the "!" still stores the registers to different addresses, it just does not change %1 any more if you leave away the "!"? So this would save on opcode, but not change anything?

Quoted 2 lines

Uh oh, you're right. Do we have a bigger problem here then ? Or is the socfpga ignoring the bottom 5 bits of this register address ?

Well, bitsream programming works for me very well (we're loading all our FGPAs in U-Boot from a FIT image), so maybe it's the documentation that has a problem?

Regards,
Simon

#4 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

Quoted 42 lines · Simon Goldschmidt
Quoted 39 lines · Marek Vasut
Quoted 37 lines · Simon Goldschmidt
Quoted 24 lines · Marek Vasut

According to SoCFPGA Cyclone V datasheet rev.2018.01.26 page 175 (Chapter 5, FPGA Manager, data register) and Arria10 datasheet rev.2017.07.22 page 211 (Chapter 5.4.1.2, FPGA Manager, img_data_w register), the FPGA data register must be written with writes with non-incrementing address.

The current code increments the address in 32-byte bursts. Fix the code so it does not increment the address and writes the register repeatedly instead. >

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>

---
   drivers/fpga/socfpga.c | 3 +--

   1 file changed, 1 insertion(+), 2 deletions(-)
drivers/fpga/socfpga.c +0 -0
index 685957626b..6ecea771ce 100644
@@ -55,8 +55,7 @@ void fpgamgr_program_write(const void *rbf_data,
 size_t rbf_size)
Quoted 6 lines

           "    cmp    %2,    #0\n"
           "    beq    2f\n"
           "1:    ldmia    %0!,    {r0-r7}\n"
-        "    stmia    %1!,    {r0-r7}\n"
-        "    sub    %1,    #32\n"
+        "    stmia    %1,    {r0-r7}\n"

Iirc, stmia without the "!" still stores the registers to different addresses, it just does not change %1 any more if you leave away the "!"? So this would save on opcode, but not change anything?

Quoted 6 lines
Quoted 2 lines

Uh oh, you're right. Do we have a bigger problem here then ? Or is the socfpga ignoring the bottom 5 bits of this register address ?

Well, bitsream programming works for me very well (we're loading all our FGPAs in U-Boot from a FIT image), so maybe it's the documentation that has a problem?

That could indeed be, maybe someone on the CC list can take a look into it and crosscheck it with internal docs ?

Signature · 2 lines
Best regards,
Marek Vasut
#5 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

Quoted 57 lines · Marek Vasut
Quoted 56 lines · Simon Goldschmidt
Quoted 52 lines · Marek Vasut
Quoted 39 lines · Simon Goldschmidt
Quoted 35 lines · Marek Vasut

According to SoCFPGA Cyclone V datasheet rev.2018.01.26 page 175
(Chapter 5, FPGA Manager, data register) and Arria10 datasheet
rev.2017.07.22 page 211 (Chapter 5.4.1.2, FPGA Manager, img_data_w
register), the FPGA data register must be written with writes with
non-incrementing address.

The current code increments the address in 32-byte bursts. Fix the
code so it does not increment the address and writes the register
repeatedly instead. >

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>

---
   drivers/fpga/socfpga.c | 3 +--

   1 file changed, 1 insertion(+), 2 deletions(-)
drivers/fpga/socfpga.c +0 -0
index 685957626b..6ecea771ce 100644
@@ -55,8 +55,7 @@ void fpgamgr_program_write(const void
 *rbf_data,
 size_t rbf_size)

           "    cmp    %2,    #0\n"
           "    beq    2f\n"
           "1:    ldmia    %0!,    {r0-r7}\n"

Quoted 8 lines
Quoted 3 lines

-        "    stmia    %1!,    {r0-r7}\n"
-        "    sub    %1,    #32\n"
+        "    stmia    %1,    {r0-r7}\n"

Iirc, stmia without the "!" still stores the registers to different
addresses, it just does not change %1 any more if you leave away the
"!"? So this would save on opcode, but not change anything?

Uh oh, you're right. Do we have a bigger problem here then ? Or is the
socfpga ignoring the bottom 5 bits of this register address ?

Quoted 8 lines
Quoted 5 lines

Well, bitsream programming works for me very well (we're loading all our
FGPAs in U-Boot from a FIT image), so maybe it's the documentation that
has a problem?

That could indeed be, maybe someone on the CC list can take a look into
it and crosscheck it with internal docs ?

sure. let me check.

Thanks for finding.

Quoted 1 line
#6 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

In reply to Marek Vasut
Quoted 57 lines · Marek Vasut
Quoted 56 lines · Simon Goldschmidt
Quoted 52 lines · Marek Vasut
Quoted 39 lines · Simon Goldschmidt
Quoted 35 lines · Marek Vasut

According to SoCFPGA Cyclone V datasheet rev.2018.01.26 page 175
(Chapter 5, FPGA Manager, data register) and Arria10 datasheet
rev.2017.07.22 page 211 (Chapter 5.4.1.2, FPGA Manager, img_data_w
register), the FPGA data register must be written with writes with
non-incrementing address.

The current code increments the address in 32-byte bursts. Fix the
code so it does not increment the address and writes the register
repeatedly instead. >

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>

---
   drivers/fpga/socfpga.c | 3 +--

   1 file changed, 1 insertion(+), 2 deletions(-)
drivers/fpga/socfpga.c +0 -0
index 685957626b..6ecea771ce 100644
@@ -55,8 +55,7 @@ void fpgamgr_program_write(const void
 *rbf_data,
 size_t rbf_size)

           "    cmp    %2,    #0\n"
           "    beq    2f\n"
           "1:    ldmia    %0!,    {r0-r7}\n"

Quoted 8 lines
Quoted 3 lines

-        "    stmia    %1!,    {r0-r7}\n"
-        "    sub    %1,    #32\n"
+        "    stmia    %1,    {r0-r7}\n"

Iirc, stmia without the "!" still stores the registers to different
addresses, it just does not change %1 any more if you leave away the
"!"? So this would save on opcode, but not change anything?

Uh oh, you're right. Do we have a bigger problem here then ? Or is the
socfpga ignoring the bottom 5 bits of this register address ?

Quoted 8 lines
Quoted 5 lines

Well, bitsream programming works for me very well (we're loading all our
FGPAs in U-Boot from a FIT image), so maybe it's the documentation that
has a problem?

That could indeed be, maybe someone on the CC list can take a look into
it and crosscheck it with internal docs ?

I can't find any doc mention about "FPGA data must be written in non- incremting address", but i saw there is a description about configuration data is buffered in a 64 deep x 32 bits wide FIFO in the FPGA Manager https://www.intel.com/content/dam/www/programmable/us/en/p
dfs/literature/hb/arria-10/a10_5v4.pdf (pg. 204)

Based on my understand through this register fpga_mgr_fpgamgrdata address map (0xFFCFE400-0xFFCFE7FF) on pg. 207 , the 256 bytes of FIFO buffer is mapping to above range addresses.

Thanks.

Regards,
TF.

Quoted 1 line
#7 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

Quoted 67 lines · Tien Fong
Quoted 57 lines · Marek Vasut
Quoted 56 lines · Simon Goldschmidt
Quoted 52 lines · Marek Vasut
Quoted 39 lines · Simon Goldschmidt
Quoted 35 lines · Marek Vasut

According to SoCFPGA Cyclone V datasheet rev.2018.01.26 page 175
(Chapter 5, FPGA Manager, data register) and Arria10 datasheet
rev.2017.07.22 page 211 (Chapter 5.4.1.2, FPGA Manager, img_data_w
register), the FPGA data register must be written with writes with
non-incrementing address.

The current code increments the address in 32-byte bursts. Fix the
code so it does not increment the address and writes the register
repeatedly instead. >

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>

---
   drivers/fpga/socfpga.c | 3 +--

   1 file changed, 1 insertion(+), 2 deletions(-)
drivers/fpga/socfpga.c +0 -0
index 685957626b..6ecea771ce 100644
@@ -55,8 +55,7 @@ void fpgamgr_program_write(const void
 *rbf_data,
 size_t rbf_size)

           "    cmp    %2,    #0\n"
           "    beq    2f\n"
           "1:    ldmia    %0!,    {r0-r7}\n"

Quoted 8 lines
Quoted 3 lines

-        "    stmia    %1!,    {r0-r7}\n"
-        "    sub    %1,    #32\n"
+        "    stmia    %1,    {r0-r7}\n"

Iirc, stmia without the "!" still stores the registers to different
addresses, it just does not change %1 any more if you leave away the
"!"? So this would save on opcode, but not change anything?

Uh oh, you're right. Do we have a bigger problem here then ? Or is the
socfpga ignoring the bottom 5 bits of this register address ?

Quoted 8 lines
Quoted 5 lines

Well, bitsream programming works for me very well (we're loading all our
FGPAs in U-Boot from a FIT image), so maybe it's the documentation that
has a problem?

That could indeed be, maybe someone on the CC list can take a look into
it and crosscheck it with internal docs ?

Quoted 5 lines

I can't find any doc mention about "FPGA data must be written in non- incremting address", but i saw there is a description about configuration data is buffered in a 64 deep x 32 bits wide FIFO in the FPGA Manager https://www.intel.com/content/dam/www/programmable/us/en/p
dfs/literature/hb/arria-10/a10_5v4.pdf (pg. 204)

Well yes, it's a FIFO, but is the FIFO populated by writing to a single non-incrementing address or are we supposed to write to subsequent incrementing addresses ?

Quoted 3 lines

Based on my understand through this register fpga_mgr_fpgamgrdata address map (0xFFCFE400-0xFFCFE7FF) on pg. 207 , the 256 bytes of FIFO buffer is mapping to above range addresses.

0xFFCFE7FF-0xFFCFE400 = 0x400 = 1024 Bytes , not 256 . Why ?

Signature · 2 lines
Best regards,
Marek Vasut
#8 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

Quoted 95 lines · Marek Vasut
Quoted 80 lines · Tien Fong
Quoted 74 lines · Marek Vasut
Quoted 65 lines · Simon Goldschmidt
Quoted 56 lines · Marek Vasut
Quoted 45 lines · Simon Goldschmidt
Quoted 40 lines · Marek Vasut

According to SoCFPGA Cyclone V datasheet rev.2018.01.26 page
175
(Chapter 5, FPGA Manager, data register) and Arria10 datasheet
rev.2017.07.22 page 211 (Chapter 5.4.1.2, FPGA Manager, img_data_w
register), the FPGA data register must be written with writes
with
non-incrementing address.

The current code increments the address in 32-byte bursts.
Fix the
code so it does not increment the address and writes the register
repeatedly instead. >

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>

---
   drivers/fpga/socfpga.c | 3 +--

   1 file changed, 1 insertion(+), 2 deletions(-)
drivers/fpga/socfpga.c +0 -0
index 685957626b..6ecea771ce 100644
@@ -55,8 +55,7 @@ void fpgamgr_program_write(const void
 *rbf_data,
 size_t rbf_size)

           "    cmp    %2,    #0\n"
           "    beq    2f\n"
           "1:    ldmia    %0!,    {r0-r7}\n"

Quoted 8 lines
Quoted 3 lines

-        "    stmia    %1!,    {r0-r7}\n"
-        "    sub    %1,    #32\n"
+        "    stmia    %1,    {r0-r7}\n"

Iirc, stmia without the "!" still stores the registers to different
addresses, it just does not change %1 any more if you leave away the
"!"? So this would save on opcode, but not change anything?

Quoted 4 lines

Uh oh, you're right. Do we have a bigger problem here then ? Or
is the
socfpga ignoring the bottom 5 bits of this register address ?

Quoted 7 lines

Well, bitsream programming works for me very well (we're loading
all our
FGPAs in U-Boot from a FIT image), so maybe it's the documentation
that
has a problem?

Quoted 4 lines

That could indeed be, maybe someone on the CC list can take a look
into
it and crosscheck it with internal docs ?

Quoted 8 lines

I can't find any doc mention about "FPGA data must be written in non-
incremting address", but i saw there is a description about configuration data is buffered in a 64 deep x 32 bits wide FIFO in the
FPGA Manager https://www.intel.com/content/dam/www/programmable/us/
en/p
dfs/literature/hb/arria-10/a10_5v4.pdf (pg. 204)

Well yes, it's a FIFO, but is the FIFO populated by writing to a single
non-incrementing address or are we supposed to write to subsequent incrementing addresses ?

Quoted 1 line
Quoted 5 lines
Quoted 4 lines

Based on my understand through this register fpga_mgr_fpgamgrdata address map (0xFFCFE400-0xFFCFE7FF) on pg. 207 , the 256 bytes of FIFO
buffer is mapping to above range addresses.

0xFFCFE7FF-0xFFCFE400 = 0x400 = 1024 Bytes , not 256 . Why ?

Finally, i have connected all scattered dot information from few internal docs. The register fpga_mgr_fpgamgrdata is actually a space in memory, acting like a buffer for the FPGA data. Regardless of the programming mode, data input from this buffer is translated into a 32- bit wide data path used by the configuration logic.

Thanks.

#9 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

Quoted 100 lines · Tien Fong
Quoted 99 lines · Marek Vasut
Quoted 80 lines · Tien Fong
Quoted 74 lines · Marek Vasut
Quoted 65 lines · Simon Goldschmidt
Quoted 56 lines · Marek Vasut
Quoted 45 lines · Simon Goldschmidt
Quoted 40 lines · Marek Vasut

According to SoCFPGA Cyclone V datasheet rev.2018.01.26 page
175
(Chapter 5, FPGA Manager, data register) and Arria10 datasheet
rev.2017.07.22 page 211 (Chapter 5.4.1.2, FPGA Manager, img_data_w
register), the FPGA data register must be written with writes
with
non-incrementing address.

The current code increments the address in 32-byte bursts.
Fix the
code so it does not increment the address and writes the register
repeatedly instead. >

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>

---
   drivers/fpga/socfpga.c | 3 +--

   1 file changed, 1 insertion(+), 2 deletions(-)
drivers/fpga/socfpga.c +0 -0
index 685957626b..6ecea771ce 100644
@@ -55,8 +55,7 @@ void fpgamgr_program_write(const void
 *rbf_data,
 size_t rbf_size)

           "    cmp    %2,    #0\n"
           "    beq    2f\n"
           "1:    ldmia    %0!,    {r0-r7}\n"

Quoted 8 lines
Quoted 3 lines

-        "    stmia    %1!,    {r0-r7}\n"
-        "    sub    %1,    #32\n"
+        "    stmia    %1,    {r0-r7}\n"

Iirc, stmia without the "!" still stores the registers to different
addresses, it just does not change %1 any more if you leave away the
"!"? So this would save on opcode, but not change anything?

Quoted 4 lines

Uh oh, you're right. Do we have a bigger problem here then ? Or
is the
socfpga ignoring the bottom 5 bits of this register address ?

Quoted 7 lines

Well, bitsream programming works for me very well (we're loading
all our
FGPAs in U-Boot from a FIT image), so maybe it's the documentation
that
has a problem?

Quoted 4 lines

That could indeed be, maybe someone on the CC list can take a look
into
it and crosscheck it with internal docs ?

Quoted 8 lines

I can't find any doc mention about "FPGA data must be written in non-
incremting address", but i saw there is a description about configuration data is buffered in a 64 deep x 32 bits wide FIFO in the
FPGA Manager https://www.intel.com/content/dam/www/programmable/us/
en/p
dfs/literature/hb/arria-10/a10_5v4.pdf (pg. 204)

Well yes, it's a FIFO, but is the FIFO populated by writing to a single
non-incrementing address or are we supposed to write to subsequent incrementing addresses ?

Quoted 5 lines

Based on my understand through this register fpga_mgr_fpgamgrdata address map (0xFFCFE400-0xFFCFE7FF) on pg. 207 , the 256 bytes of FIFO
buffer is mapping to above range addresses.

Quoted 7 lines
Quoted 1 line

0xFFCFE7FF-0xFFCFE400 = 0x400 = 1024 Bytes , not 256 . Why ?

Finally, i have connected all scattered dot information from few internal docs. The register fpga_mgr_fpgamgrdata is actually a space in memory, acting like a buffer for the FPGA data. Regardless of the programming mode, data input from this buffer is translated into a 32- bit wide data path used by the configuration logic.

Does that mean that a write anywhere in 0xFFCFE400..0xFFCFE7FF ends up in the same register / FIFO ? Does that mean that whole address range ignores the bottom 0x3ff MSbits ? Does it matter to which address in that range the CPU writes the data or not ?

Signature · 2 lines
Best regards,
Marek Vasut
#10 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

Quoted 135 lines · Marek Vasut
Quoted 126 lines · Tien Fong
Quoted 124 lines · Marek Vasut
Quoted 97 lines · Tien Fong
Quoted 90 lines · Marek Vasut
Quoted 80 lines · Simon Goldschmidt
Quoted 68 lines · Marek Vasut
Quoted 56 lines · Simon Goldschmidt
Quoted 42 lines · Marek Vasut

According to SoCFPGA Cyclone V datasheet rev.2018.01.26
page
175
(Chapter 5, FPGA Manager, data register) and Arria10 datasheet
rev.2017.07.22 page 211 (Chapter 5.4.1.2, FPGA Manager,
img_data_w
register), the FPGA data register must be written with
writes
with
non-incrementing address.

The current code increments the address in 32-byte bursts.
Fix the
code so it does not increment the address and writes the
register
repeatedly instead. >

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]

m>
Cc: Tien Fong Chee <[email protected]>
---
   drivers/fpga/socfpga.c | 3 +--

   1 file changed, 1 insertion(+), 2 deletions(-)
drivers/fpga/socfpga.c +0 -0
index 685957626b..6ecea771ce 100644
@@ -55,8 +55,7 @@ void fpgamgr_program_write(const

void

Quoted 8 lines

*rbf_data,
size_t rbf_size)
           "    cmp    %2,    #0\n"
           "    beq    2f\n"
           "1:    ldmia    %0!,    {r0-r7}\n" -        "    stmia    %1!,    {r0-r7}\n" -        "    sub    %1,    #32\n"
+        "    stmia    %1,    {r0-r7}\n"

Quoted 8 lines

Iirc, stmia without the "!" still stores the registers to
different
addresses, it just does not change %1 any more if you leave
away the
"!"? So this would save on opcode, but not change anything?

Quoted 6 lines

Uh oh, you're right. Do we have a bigger problem here then ?
Or
is the
socfpga ignoring the bottom 5 bits of this register address ?

Quoted 7 lines

Well, bitsream programming works for me very well (we're loading
all our
FGPAs in U-Boot from a FIT image), so maybe it's the documentation
that
has a problem?

Quoted 4 lines

That could indeed be, maybe someone on the CC list can take a look
into
it and crosscheck it with internal docs ?

Quoted 11 lines

I can't find any doc mention about "FPGA data must be written in
non-
incremting address", but i saw there is a description about configuration data is buffered in a 64 deep x 32 bits wide FIFO in
the
FPGA Manager https://www.intel.com/content/dam/www/programmable
/us/
en/p
dfs/literature/hb/arria-10/a10_5v4.pdf (pg. 204)

Well yes, it's a FIFO, but is the FIFO populated by writing to a single
non-incrementing address or are we supposed to write to subsequent
incrementing addresses ?

Quoted 8 lines

Based on my understand through this register fpga_mgr_fpgamgrdata
address map (0xFFCFE400-0xFFCFE7FF) on pg. 207 , the 256 bytes of
FIFO
buffer is mapping to above range addresses.

Quoted 8 lines
Quoted 1 line

0xFFCFE7FF-0xFFCFE400 = 0x400 = 1024 Bytes , not 256 . Why ?

Finally, i have connected all scattered dot information from few internal docs. The register fpga_mgr_fpgamgrdata is actually a space in
memory, acting like a buffer for the FPGA data. Regardless of the programming mode, data input from this buffer is translated into a 32-
bit wide data path used by the configuration logic.

Quoted 5 lines

Does that mean that a write anywhere in 0xFFCFE400..0xFFCFE7FF ends up
in the same register / FIFO ? Does that mean that whole address range ignores the bottom 0x3ff MSbits ? Does it matter to which address in that range the CPU writes the data or not ?

Sorry, that's all information i have. Anyway, i have already engaged the HW engineer in the loop, and i will update you once i have more details.

Thanks.

Quoted 1 line
#11 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

Quoted 142 lines · Tien Fong
Quoted 135 lines · Marek Vasut
Quoted 126 lines · Tien Fong
Quoted 124 lines · Marek Vasut
Quoted 97 lines · Tien Fong
Quoted 90 lines · Marek Vasut
Quoted 80 lines · Simon Goldschmidt
Quoted 68 lines · Marek Vasut
Quoted 56 lines · Simon Goldschmidt
Quoted 42 lines · Marek Vasut

According to SoCFPGA Cyclone V datasheet rev.2018.01.26
page
175
(Chapter 5, FPGA Manager, data register) and Arria10 datasheet
rev.2017.07.22 page 211 (Chapter 5.4.1.2, FPGA Manager,
img_data_w
register), the FPGA data register must be written with
writes
with
non-incrementing address.

The current code increments the address in 32-byte bursts.
Fix the
code so it does not increment the address and writes the
register
repeatedly instead. >

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]

m>
Cc: Tien Fong Chee <[email protected]>
---
   drivers/fpga/socfpga.c | 3 +--

   1 file changed, 1 insertion(+), 2 deletions(-)
drivers/fpga/socfpga.c +0 -0
index 685957626b..6ecea771ce 100644
@@ -55,8 +55,7 @@ void fpgamgr_program_write(const

void

Quoted 8 lines

*rbf_data,
size_t rbf_size)
           "    cmp    %2,    #0\n"
           "    beq    2f\n"
           "1:    ldmia    %0!,    {r0-r7}\n" -        "    stmia    %1!,    {r0-r7}\n" -        "    sub    %1,    #32\n"
+        "    stmia    %1,    {r0-r7}\n"

Quoted 8 lines

Iirc, stmia without the "!" still stores the registers to
different
addresses, it just does not change %1 any more if you leave
away the
"!"? So this would save on opcode, but not change anything?

Quoted 6 lines

Uh oh, you're right. Do we have a bigger problem here then ?
Or
is the
socfpga ignoring the bottom 5 bits of this register address ?

Quoted 7 lines

Well, bitsream programming works for me very well (we're loading
all our
FGPAs in U-Boot from a FIT image), so maybe it's the documentation
that
has a problem?

Quoted 4 lines

That could indeed be, maybe someone on the CC list can take a look
into
it and crosscheck it with internal docs ?

Quoted 11 lines

I can't find any doc mention about "FPGA data must be written in
non-
incremting address", but i saw there is a description about configuration data is buffered in a 64 deep x 32 bits wide FIFO in
the
FPGA Manager https://www.intel.com/content/dam/www/programmable
/us/
en/p
dfs/literature/hb/arria-10/a10_5v4.pdf (pg. 204)

Well yes, it's a FIFO, but is the FIFO populated by writing to a single
non-incrementing address or are we supposed to write to subsequent
incrementing addresses ?

Quoted 8 lines

Based on my understand through this register fpga_mgr_fpgamgrdata
address map (0xFFCFE400-0xFFCFE7FF) on pg. 207 , the 256 bytes of
FIFO
buffer is mapping to above range addresses.

Quoted 8 lines
Quoted 1 line

0xFFCFE7FF-0xFFCFE400 = 0x400 = 1024 Bytes , not 256 . Why ?

Finally, i have connected all scattered dot information from few internal docs. The register fpga_mgr_fpgamgrdata is actually a space in
memory, acting like a buffer for the FPGA data. Regardless of the programming mode, data input from this buffer is translated into a 32-
bit wide data path used by the configuration logic.

Quoted 5 lines

Does that mean that a write anywhere in 0xFFCFE400..0xFFCFE7FF ends up
in the same register / FIFO ? Does that mean that whole address range ignores the bottom 0x3ff MSbits ? Does it matter to which address in that range the CPU writes the data or not ?

Quoted 3 lines

Sorry, that's all information i have. Anyway, i have already engaged the HW engineer in the loop, and i will update you once i have more details.

Thanks, let's wait and see ...

Signature · 2 lines
Best regards,
Marek Vasut
#12 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

Marek,

Am 13.05.2019 um 15:12 schrieb Marek Vasut:

Quoted 143 lines · Tien Fong
Quoted 142 lines · Marek Vasut
Quoted 140 lines · Tien Fong
Quoted 126 lines · Marek Vasut
Quoted 124 lines · Tien Fong
Quoted 97 lines · Marek Vasut
Quoted 90 lines · Simon Goldschmidt
Quoted 80 lines · Marek Vasut
Quoted 68 lines · Simon Goldschmidt
Quoted 56 lines · Marek Vasut
Quoted 42 lines

According to SoCFPGA Cyclone V datasheet rev.2018.01.26
page
175
(Chapter 5, FPGA Manager, data register) and Arria10 datasheet
rev.2017.07.22 page 211 (Chapter 5.4.1.2, FPGA Manager,
img_data_w
register), the FPGA data register must be written with
writes
with
non-incrementing address.

The current code increments the address in 32-byte bursts.
Fix the
code so it does not increment the address and writes the
register
repeatedly instead. >

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]

m>
Cc: Tien Fong Chee <[email protected]>

---
    drivers/fpga/socfpga.c | 3 +--
    1 file changed, 1 insertion(+), 2 deletions(-)
drivers/fpga/socfpga.c +0 -0
index 685957626b..6ecea771ce 100644
@@ -55,8 +55,7 @@ void fpgamgr_program_write(const

void

Quoted 8 lines

*rbf_data,
size_t rbf_size)
           "    cmp    %2,    #0\n"
           "    beq    2f\n"
           "1:    ldmia    %0!,    {r0-r7}\n"
-        "    stmia    %1!,    {r0-r7}\n" -        "    sub    %1,    #32\n"
+        "    stmia    %1,    {r0-r7}\n"

Quoted 8 lines

Iirc, stmia without the "!" still stores the registers to
different
addresses, it just does not change %1 any more if you leave
away the
"!"? So this would save on opcode, but not change anything?

Quoted 6 lines

Uh oh, you're right. Do we have a bigger problem here then ?
Or
is the
socfpga ignoring the bottom 5 bits of this register address ?

Quoted 7 lines

Well, bitsream programming works for me very well (we're loading
all our
FGPAs in U-Boot from a FIT image), so maybe it's the documentation
that
has a problem?

Quoted 4 lines

That could indeed be, maybe someone on the CC list can take a look
into
it and crosscheck it with internal docs ?

Quoted 11 lines

I can't find any doc mention about "FPGA data must be written in
non-
incremting address", but i saw there is a description about configuration data is buffered in a 64 deep x 32 bits wide FIFO in
the
FPGA Manager https://www.intel.com/content/dam/www/programmable
/us/
en/p
dfs/literature/hb/arria-10/a10_5v4.pdf (pg. 204)

Well yes, it's a FIFO, but is the FIFO populated by writing to a single
non-incrementing address or are we supposed to write to subsequent
incrementing addresses ?

Quoted 8 lines

Based on my understand through this register fpga_mgr_fpgamgrdata
address map (0xFFCFE400-0xFFCFE7FF) on pg. 207 , the 256 bytes of
FIFO
buffer is mapping to above range addresses.

Quoted 8 lines
Quoted 1 line

0xFFCFE7FF-0xFFCFE400 = 0x400 = 1024 Bytes , not 256 . Why ?

Finally, i have connected all scattered dot information from few internal docs. The register fpga_mgr_fpgamgrdata is actually a space in
memory, acting like a buffer for the FPGA data. Regardless of the programming mode, data input from this buffer is translated into a 32-
bit wide data path used by the configuration logic.

Does that mean that a write anywhere in 0xFFCFE400..0xFFCFE7FF ends up
in the same register / FIFO ? Does that mean that whole address range ignores the bottom 0x3ff MSbits ? Does it matter to which address in that range the CPU writes the data or not ?

Quoted 5 lines
Quoted 3 lines

Sorry, that's all information i have. Anyway, i have already engaged the HW engineer in the loop, and i will update you once i have more details.

Thanks, let's wait and see ...

Have you dropped this? It's assigned to me in patchwork (I'm going through the list of old items assigned to me...).

Regards,
Simon

#13 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

On 10/9/19 8:06 PM, Simon Goldschmidt wrote:
[...]

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Based on my understand through this register fpga_mgr_fpgamgrdata
address map (0xFFCFE400-0xFFCFE7FF) on pg. 207 , the 256 bytes of
FIFO
buffer is mapping to above range addresses.

Quoted 8 lines
Quoted 1 line

0xFFCFE7FF-0xFFCFE400 = 0x400 = 1024 Bytes , not 256 . Why ?

Finally, i have connected all scattered dot information from few internal docs. The register fpga_mgr_fpgamgrdata is actually a space in
memory, acting like a buffer for the FPGA data. Regardless of the programming mode, data input from this buffer is translated into a 32-
bit wide data path used by the configuration logic.

Does that mean that a write anywhere in 0xFFCFE400..0xFFCFE7FF ends up
in the same register / FIFO ? Does that mean that whole address range ignores the bottom 0x3ff MSbits ? Does it matter to which address in that range the CPU writes the data or not ?

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Sorry, that's all information i have. Anyway, i have already engaged the HW engineer in the loop, and i will update you once i have more details.

Thanks, let's wait and see ...

Have you dropped this? It's assigned to me in patchwork (I'm going through the list of old items assigned to me...).

I don't know, sorry. Apparently there isn't enough information to decide whether this patch is correct or not.

#14 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

Marek Vasut <[email protected]> schrieb am Mi., 9. Okt. 2019, 23:01:

Quoted 26 lines · Simon Goldschmidt

[...]

Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Based on my understand through this register fpga_mgr_fpgamgrdata
address map (0xFFCFE400-0xFFCFE7FF) on pg. 207 , the 256 bytes of
FIFO
buffer is mapping to above range addresses.

Quoted 8 lines
Quoted 1 line

0xFFCFE7FF-0xFFCFE400 = 0x400 = 1024 Bytes , not 256 . Why ?

Finally, i have connected all scattered dot information from few internal docs. The register fpga_mgr_fpgamgrdata is actually a space in
memory, acting like a buffer for the FPGA data. Regardless of the programming mode, data input from this buffer is translated into a 32-
bit wide data path used by the configuration logic.

Quoted 5 lines

Does that mean that a write anywhere in 0xFFCFE400..0xFFCFE7FF ends up
in the same register / FIFO ? Does that mean that whole address range ignores the bottom 0x3ff MSbits ? Does it matter to which address in that range the CPU writes the data or not ?

Sorry, that's all information i have. Anyway, i have already engaged the HW engineer in the loop, and i will update you once i have more details.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Thanks, let's wait and see ...

Have you dropped this? It's assigned to me in patchwork (I'm going through the list of old items assigned to me...).

I don't know, sorry. Apparently there isn't enough information to decide whether this patch is correct or not.

Right. However, since it seems to work as is, I don't think we have a real problem.

Regards,
Simon

Quoted 1 line
#15 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

On 10/10/19 7:15 AM, Simon Goldschmidt wrote:
[...]

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

Have you dropped this? It's assigned to me in patchwork (I'm going through the list of old items assigned to me...).

I don't know, sorry. Apparently there isn't enough information to decide whether this patch is correct or not.

Right. However, since it seems to work as is, I don't think we have a real problem.

I think the datasheet could use clarification in that aspect. But it might be way too late for that.

Signature · 2 lines
Best regards,
Marek Vasut
#16 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

Hi, i think i have find the problem, but i think i doesn't have the experience for modifie that.
on the file : drivers/fpga/ socfpga_gen5.c : line 161 : function <fpgamgr_program_poll_initphase> :

1. we wait fot the return of the fonction <fpgamgr_get_mode> with the value <FPGAMGRREGS_MODE_INITPHASE> or <FPGAMGRREGS_MODE_USERMODE>
2. but he never comming its always the value <FPGAMGRREGS_MODE_CFGPHASE> then we are the timing out.

Then the fpga is on configuration mode, my question is:

1. How to set him on user mode ?
2. Why the configuration is not finalised ?
3. Where i can find information for finalise it ?

I want to contribute, but im a noobies :)

Quoted 24 lines · Marek Vasut

On 10/10/19 7:15 AM, Simon Goldschmidt wrote:
[...]

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Have you dropped this? It's assigned to me in patchwork (I'm going through the list of old items assigned to me...).

I don't know, sorry. Apparently there isn't enough information to decide whether this patch is correct or not.

Right. However, since it seems to work as is, I don't think we have a

real

Quoted 1 line

problem.

I think the datasheet could use clarification in that aspect. But it might be way too late for that.

--
Best regards,
Marek Vasut
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#17 lore raw

PATCH 1/1 ARM: socfpga: Fix FPGA bitstream loading code

jérémy alcim <[email protected]> schrieb am Fr., 29. Nov. 2019, 08:32:

Quoted 10 lines

Hi, i think i have find the problem, but i think i doesn't have the experience for modifie that.
on the file : drivers/fpga/ socfpga_gen5.c : line 161 : function <fpgamgr_program_poll_initphase> :

1. we wait fot the return of the fonction <fpgamgr_get_mode> with the value <FPGAMGRREGS_MODE_INITPHASE> or <FPGAMGRREGS_MODE_USERMODE>
2. but he never comming its always the value <FPGAMGRREGS_MODE_CFGPHASE> then we are the timing out.

Quoted 8 lines

Then the fpga is on configuration mode, my question is:

1. How to set him on user mode ?
2. Why the configuration is not finalised ?
3. Where i can find information for finalise it ?

I want to contribute, but im a noobies :)

Most probably, the FPGA is stuck in configuration phase because the file you were trying to program is not a valid programming file. Unless I'm really mistaken, this does not have anything to do with what's discussed in this thread.

Regards,
Simon

Quoted 28 lines · Marek Vasut
Quoted 26 lines · Simon Goldschmidt

[...]

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

Have you dropped this? It's assigned to me in patchwork (I'm going through the list of old items assigned to me...).

I don't know, sorry. Apparently there isn't enough information to

decide

Quoted 4 lines
Quoted 2 lines

whether this patch is correct or not.

Right. However, since it seems to work as is, I don't think we have a

real

Quoted 1 line

problem.

I think the datasheet could use clarification in that aspect. But it might be way too late for that.

--
Best regards,
Marek Vasut
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot