Skip to content

Commit

Permalink
FogBugz #303558: ensure RBF data gets through control block
Browse files Browse the repository at this point in the history
There are cases where all the RBF data might
not get clocked through the control block.  To ensure
the RBF data gets clocked through, write 10 words
of sync data, all f's, to the fpga manager
after an rbf has been written.

Signed-off-by: Matthew Gerlach <mgerlach@opensource.altera.com>
  • Loading branch information
Matthew Gerlach committed Nov 13, 2015
1 parent f6d86c3 commit 4c95599
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/arm/cpu/armv7/socfpga_arria10/cff.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ int cff_from_mmc_fat(char *dev_part, const char *filename, int len)
slen = strlen(filename) + 1; slen = strlen(filename) + 1;
len -= slen; len -= slen;
filename += slen; filename += slen;
fpgamgr_program_sync();
} }


/* Ensure the FPGA entering config done */ /* Ensure the FPGA entering config done */
Expand Down Expand Up @@ -261,6 +262,8 @@ int cff_from_qspi(unsigned long flash_offset)


} }


fpgamgr_program_sync();

/* Ensure the FPGA entering config done */ /* Ensure the FPGA entering config done */
status = fpgamgr_program_fini(); status = fpgamgr_program_fini();
if (status) { if (status) {
Expand Down Expand Up @@ -417,6 +420,8 @@ int cff_from_nand(unsigned long flash_offset)
WATCHDOG_RESET(); WATCHDOG_RESET();
} }


fpgamgr_program_sync();

#ifdef CONFIG_CHECK_FPGA_DATA_CRC #ifdef CONFIG_CHECK_FPGA_DATA_CRC
if (datacrc != image_get_dcrc(&header)) { if (datacrc != image_get_dcrc(&header)) {
printf("FPGA: Bad Data Checksum\n"); printf("FPGA: Bad Data Checksum\n");
Expand Down
11 changes: 11 additions & 0 deletions arch/arm/cpu/armv7/socfpga_arria10/fpga_manager.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ static int wait_for_user_mode(void)
return i; return i;
} }


/* send sync words to clock data through the control block */
void fpgamgr_program_sync(void)
{
u32 sync_data = 0xffffffff;
int i;
for (i = 0; i < 10; i++) {
fpgamgr_program_write((const long unsigned int *)&sync_data,
sizeof(sync_data));
}
}

static int wait_for_imgcfg_stat(unsigned long mask) static int wait_for_imgcfg_stat(unsigned long mask)
{ {
unsigned long reg, i; unsigned long reg, i;
Expand Down
1 change: 1 addition & 0 deletions arch/arm/include/asm/arch-socfpga_arria10/fpga_manager.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ int fpgamgr_program_init(u32 * rbf_data, u32 rbf_size);
int fpgamgr_program_fini(void); int fpgamgr_program_fini(void);
void fpgamgr_program_write(const unsigned long *rbf_data, void fpgamgr_program_write(const unsigned long *rbf_data,
unsigned long rbf_size); unsigned long rbf_size);
void fpgamgr_program_sync(void);
int fpgamgr_program_poll_cd(void); int fpgamgr_program_poll_cd(void);
int fpgamgr_program_poll_initphase(void); int fpgamgr_program_poll_initphase(void);
int is_fpgamgr_user_mode(void); int is_fpgamgr_user_mode(void);
Expand Down

0 comments on commit 4c95599

Please sign in to comment.