public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Chee, Tien Fong <tien.fong.chee@intel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 09/19] arm: socfpga: Add drivers for programing FPGA from flash
Date: Thu, 28 Sep 2017 02:45:46 +0000	[thread overview]
Message-ID: <1506566738.3589.38.camel@intel.com> (raw)
In-Reply-To: <e28c98d6-fdd9-3836-7d1c-871a87522f4a@denx.de>

On Rab, 2017-09-27 at 10:30 +0200, Marek Vasut wrote:
> On 09/27/2017 08:05 AM, Chee, Tien Fong wrote:
> > 
> > On Sel, 2017-09-26 at 12:32 +0200, Marek Vasut wrote:
> > > 
> > > On 09/26/2017 10:30 AM, Chee, Tien Fong wrote:
> > > > 
> > > > 
> > > > On Isn, 2017-09-25 at 11:14 +0200, Marek Vasut wrote:
> > > > > 
> > > > > 
> > > > > On 09/25/2017 10:40 AM, tien.fong.chee at intel.com wrote:
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > From: Tien Fong Chee <tien.fong.chee@intel.com>
> > > > > > 
> > > > > > These drivers handle FPGA program operation from flash
> > > > > > loading
> > > > > > RBF to memory and then to program FPGA.
> > > > > > 
> > > > > > Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
> > > > > Did you run checkpatch on this before submitting ? I presume
> > > > > no
> > > > > ...
> > > > > 
> > > > Yeah, i run checkpatch for all patches. What's the issue here?
> > > It should definitely indicate problem with ie. yoda-notation
> > > +if (0 == flashinfo->remaining) {
> > > and indent ...
> > > 
> > No complaint from checkpath. I know someone saying bad for
> > readbility,
> > but yoda-notation at this simple implementation doesn't impact the
> > readbility, and having benefit to leverage detection of compiler on
> > missing "=". Overall, this can help to improve coding quality. I
> > can
> > remove it if this doesn't favored in U-boot.
> It is not welcome and modern gcc warns you about such things .
> 
Okay.
> > 
> > > 
> > > > 
> > > > 
> > > > > 
> > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > ---
> > > > > >  .../include/mach/fpga_manager_arria10.h            |  27
> > > > > > ++
> > > > > >  drivers/fpga/socfpga_arria10.c                     | 391
> > > > > > ++++++++++++++++++++-
> > > > > >  include/altera.h                                   |   6 +
> > > > > >  include/configs/socfpga_common.h                   |   4 +
> > > > > >  4 files changed, 425 insertions(+), 3 deletions(-)
> > > > > [...]
> > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > @@ -112,13 +122,14 @@ static int
> > > > > > wait_for_nconfig_pin_and_nstatus_pin(void)
> > > > > >  	unsigned long mask =
> > > > > > ALT_FPGAMGR_IMGCFG_STAT_F2S_NCONFIG_PIN_SET_MSK |
> > > > > >  				ALT_FPGAMGR_IMGCFG_STAT_F2
> > > > > > S_NS
> > > > > > TATU
> > > > > > S_PIN_SET_MSK;
> > > > > >  
> > > > > > -	/* Poll until f2s_nconfig_pin and f2s_nstatus_pin;
> > > > > > loop
> > > > > > until de-asserted,
> > > > > > -	 * timeout at 1000ms
> > > > > > +	/*
> > > > > > +	 * Poll until f2s_nconfig_pin and f2s_nstatus_pin;
> > > > > > loop
> > > > > > until
> > > > > > +	 * de-asserted, timeout at 1000ms
> > > > > >  	 */
> > > > > >  	return wait_for_bit(__func__,
> > > > > >  			    &fpga_manager_base-
> > > > > > >imgcfg_stat,
> > > > > >  			    mask,
> > > > > > -			    false, FPGA_TIMEOUT_MSEC,
> > > > > > false);
> > > > > > +			    true, FPGA_TIMEOUT_MSEC,
> > > > > > false);
> > > > > >  }
> > > > > Seems more like a fix, split this out.
> > > > > 
> > > > Okay.
> > > > > 
> > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > >  static int wait_for_f2s_nstatus_pin(unsigned long value)
> > > > > > @@ -469,6 +480,7 @@ int socfpga_load(Altera_desc *desc,
> > > > > > const
> > > > > > void
> > > > > > *rbf_data, size_t rbf_size)
> > > > > >  
> > > > > >  	/* Initialize the FPGA Manager */
> > > > > >  	status = fpgamgr_program_init((u32 *)rbf_data,
> > > > > > rbf_size);
> > > > > > +
> > > > > >  	if (status)
> > > > > >  		return status;
> > > > > >  
> > > > > > @@ -477,3 +489,376 @@ int socfpga_load(Altera_desc *desc,
> > > > > > const
> > > > > > void *rbf_data, size_t rbf_size)
> > > > > >  
> > > > > >  	return fpgamgr_program_finish();
> > > > > >  }
> > > > > > +
> > > > > > +#if defined(CONFIG_CMD_FPGA_LOADFS)
> > > > > > +const char *get_cff_filename(const void *fdt, int *len,
> > > > > > u32
> > > > > > core)
> > > > > > +{
> > > > > > +	const char *cff_filename = NULL;
> > > > > > +	const char *cell;
> > > > > > +	int nodeoffset;
> > > > > > +	nodeoffset = fdtdec_next_compatible(fdt, 0,
> > > > > > +			 COMPAT_ALTERA_SOCFPGA_FPGA0);
> > > > > > +
> > > > > > +	if (nodeoffset >= 0) {
> > > > > > +		if (core)
> > > > > > +			cell = fdt_getprop(fdt,
> > > > > > +					nodeoffset,
> > > > > > +					"bitstream_core",
> > > > > > +					len);
> > > > > > +		else
> > > > > > +			cell = fdt_getprop(fdt,
> > > > > > nodeoffset,
> > > > > > "bitstream_periph",
> > > > > > +					 len);
> > > > > > +
> > > > > > +		if (cell)
> > > > > > +			cff_filename = cell;
> > > > > > +	}
> > > > > > +
> > > > > > +	return cff_filename;
> > > > > > +}
> > > > > > +
> > > > > > +const char *get_cff_devpart(const void *fdt, int *len)
> > > > > > +{
> > > > > > +	const char *cff_devpart = NULL;
> > > > > > +	const char *cell;
> > > > > > +	int nodeoffset;
> > > > > > +	nodeoffset = fdtdec_next_compatible(fdt, 0,
> > > > > > +			 COMPAT_ALTERA_SOCFPGA_FPGA0);
> > > > > > +
> > > > > > +	cell = fdt_getprop(fdt, nodeoffset,
> > > > > > "bitstream_devpart",
> > > > > > len);
> > > > > > +
> > > > > > +	if (cell)
> > > > > > +		cff_devpart = cell;
> > > > > > +
> > > > > > +	return cff_devpart;
> > > > > > +}
> > > > > Take a look at splash*.c , I believe that can be reworked
> > > > > into
> > > > > generic
> > > > > firmware loader , which you could then use here.
> > > This is important here, I don't want yet another ad-hoc loader
> > > ...
> > > 
> > Disucss in another email reply separately. I need time to think.
> > > 
> > > > 
> > > > 
> > > > > 
> > > > > 
> > > > > [...]
> > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > diff --git a/include/configs/socfpga_common.h
> > > > > > b/include/configs/socfpga_common.h
> > > > > > index 9897e11..eadce2d 100644
> > > > > > --- a/include/configs/socfpga_common.h
> > > > > > +++ b/include/configs/socfpga_common.h
> > > > > > @@ -27,7 +27,11 @@
> > > > > >   */
> > > > > >  #define CONFIG_NR_DRAM_BANKS		1
> > > > > >  #define PHYS_SDRAM_1			0x0
> > > > > > +#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
> > > > > >  #define CONFIG_SYS_MALLOC_LEN		(64 * 1024 *
> > > > > > 1024)
> > > > > > +#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
> > > > > > +#define CONFIG_SYS_MALLOC_LEN		(128 * 1024 *
> > > > > > 1024)
> > > > > > +#endif
> > > > > You definitely don't need 128 MiB of malloc area.
> > > > > 
> > > > Okay, i will try out with smaller size.
> > > Why do you need such massive area ? It's not a matter of "try
> > > out",
> > > you
> > > should know why this change was needed for your use-case.
> > > 
> > I forgot what reason i put this value. I need to find out.
> If this was properly documented in the commit message, you would not
> have to ...
> 
Okay.
> > 
> > > 
> > > > 
> > > > 
> > > > > 
> > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > >  #define CONFIG_SYS_MEMTEST_START	PHYS_SDRAM_1
> > > > > >  #define CONFIG_SYS_MEMTEST_END		PHYS_SDRAM_1
> > > > > > _SIZ
> > > > > > E
> > > > > >  #if defined(CONFIG_TARGET_SOCFPGA_GEN5)
> > > > > > 
> 

  reply	other threads:[~2017-09-28  2:45 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-25  8:39 [U-Boot] [PATCH v2 00/19] Add FPGA, SDRAM, SPL loads U-boot & booting to console tien.fong.chee at intel.com
2017-09-25  8:39 ` [U-Boot] [PATCH v2 01/19] ARM: socfpga: add bindings doc for arria10 fpga manager tien.fong.chee at intel.com
2017-09-25  8:59   ` Marek Vasut
2017-09-25  8:39 ` [U-Boot] [PATCH v2 02/19] doc: dtbinding: Description on FPGA RBF properties at Arria 10 FPGA manager tien.fong.chee at intel.com
2017-09-25  9:00   ` Marek Vasut
2017-09-26  8:54     ` Chee, Tien Fong
2017-09-26 10:30       ` Marek Vasut
2017-09-27  3:12         ` Chee, Tien Fong
2017-09-27  8:29           ` Marek Vasut
2017-09-28  2:49             ` Chee, Tien Fong
2017-09-25  9:01   ` Marek Vasut
2017-09-26  8:32     ` Chee, Tien Fong
2017-09-25  8:39 ` [U-Boot] [PATCH v2 03/19] dts: Add FPGA bitstream properties to Arria 10 DTS tien.fong.chee at intel.com
2017-09-25  8:40 ` [U-Boot] [PATCH v2 04/19] arm: socfpga: Add Arria 10 SoCFPGA programming interface tien.fong.chee at intel.com
2017-09-25  9:03   ` Marek Vasut
2017-09-29  7:42     ` Chee, Tien Fong
2017-09-25  8:40 ` [U-Boot] [PATCH v2 05/19] arm: socfpga: Enhance FPGA program write rbf data with size >= 4 bytes tien.fong.chee at intel.com
2017-09-25  9:08   ` Marek Vasut
2017-09-25  8:40 ` [U-Boot] [PATCH v2 06/19] dts: Enable fpga-mgr node build for Arria 10 SPL tien.fong.chee at intel.com
2017-09-25  8:40 ` [U-Boot] [PATCH v2 07/19] fdt: Add compatible strings for Arria 10 tien.fong.chee at intel.com
2017-09-25  9:08   ` Marek Vasut
2017-12-10 19:34     ` Simon Glass
2017-09-25  8:40 ` [U-Boot] [PATCH v2 08/19] fs: Enable generic filesystems interface support in SPL tien.fong.chee at intel.com
2017-09-25  9:09   ` Marek Vasut
2017-10-09  4:47   ` Simon Glass
2017-09-25  8:40 ` [U-Boot] [PATCH v2 09/19] arm: socfpga: Add drivers for programing FPGA from flash tien.fong.chee at intel.com
2017-09-25  9:14   ` Marek Vasut
2017-09-26  8:30     ` Chee, Tien Fong
2017-09-26 10:32       ` Marek Vasut
2017-09-27  6:05         ` Chee, Tien Fong
2017-09-27  8:30           ` Marek Vasut
2017-09-28  2:45             ` Chee, Tien Fong [this message]
2017-09-26  9:52     ` Chee, Tien Fong
2017-09-26 10:39       ` Marek Vasut
2017-09-27  9:13         ` Chee, Tien Fong
2017-09-27  9:23           ` Marek Vasut
2017-09-28 15:14             ` Chee, Tien Fong
2017-09-28 15:18               ` Marek Vasut
2017-10-09  4:47   ` Simon Glass
2017-09-25  8:40 ` [U-Boot] [PATCH v2 10/19] arm: socfpga: Rename the gen5 sdram driver to more specific name tien.fong.chee at intel.com
2017-09-25  9:15   ` Marek Vasut
2017-09-26  8:23     ` Chee, Tien Fong
2017-09-26 10:33       ` Marek Vasut
2017-09-27  5:06         ` Chee, Tien Fong
2017-09-25  8:40 ` [U-Boot] [PATCH v2 11/19] arm: socfpga: Add DRAM bank size initialization function tien.fong.chee at intel.com
2017-09-25  9:15   ` Marek Vasut
2017-09-26  8:20     ` Chee, Tien Fong
2017-09-26 10:33       ` Marek Vasut
2017-10-02 10:01         ` Chee, Tien Fong
2017-10-02 10:04           ` Marek Vasut
2017-10-02 10:06             ` Chee, Tien Fong
2017-10-03  3:30               ` Ley Foon Tan
2017-09-25  8:40 ` [U-Boot] [PATCH v2 12/19] arm: socfpga: Add DDR driver for Arria 10 tien.fong.chee at intel.com
2017-09-25  9:19   ` Marek Vasut
2017-09-26  8:20     ` Chee, Tien Fong
2017-09-26 10:35       ` Marek Vasut
2017-09-27  4:55         ` Chee, Tien Fong
2017-09-25  8:40 ` [U-Boot] [PATCH v2 13/19] configs: Add DDR Kconfig support " tien.fong.chee at intel.com
2017-09-25  8:40 ` [U-Boot] [PATCH v2 14/19] arm: socfpga: Enable build for DDR " tien.fong.chee at intel.com
2017-09-25  9:20   ` Marek Vasut
2017-09-26  5:06     ` Chee, Tien Fong
2017-09-25  8:40 ` [U-Boot] [PATCH v2 15/19] arm: socfpga: Add support to memory allocation in SPL tien.fong.chee at intel.com
2017-09-25  9:21   ` Marek Vasut
2017-09-26  5:06     ` Chee, Tien Fong
2017-09-26 10:37       ` Marek Vasut
2017-09-27  5:43         ` Chee, Tien Fong
2017-09-27  8:32           ` Marek Vasut
2017-09-28  2:48             ` Chee, Tien Fong
2017-09-25  8:40 ` [U-Boot] [PATCH v2 16/19] arm: socfpga: Enhance Intel SoCFPGA program header to support Arria 10 tien.fong.chee at intel.com
2017-09-25  9:23   ` Marek Vasut
2017-09-26  4:42     ` Chee, Tien Fong
2017-09-26 10:37       ` Marek Vasut
2017-09-27  3:30         ` Chee, Tien Fong
2017-09-27  8:33           ` Marek Vasut
2017-09-28  2:46             ` Chee, Tien Fong
2017-09-25  8:40 ` [U-Boot] [PATCH v2 17/19] arm: socfpga: Adding clock frequency info for U-boot tien.fong.chee at intel.com
2017-09-25  9:23   ` Marek Vasut
2017-09-26  4:32     ` Chee, Tien Fong
2017-09-27  3:24     ` Chee, Tien Fong
2017-10-02 10:04     ` Chee, Tien Fong
2017-10-02 10:10       ` Marek Vasut
2017-10-02 10:25         ` Chee, Tien Fong
2017-09-25  8:40 ` [U-Boot] [PATCH v2 18/19] arm: socfpga: Adding SoCFPGA info for both SPL and U-boot tien.fong.chee at intel.com
2017-09-25  8:40 ` [U-Boot] [PATCH v2 19/19] arm: socfpga: Enable SPL loading U-boot to DDR and booting U-boot tien.fong.chee at intel.com
2017-09-25  9:24   ` Marek Vasut
2017-09-26  4:31     ` Chee, Tien Fong
2017-09-26 10:38       ` Marek Vasut
2017-09-27  3:14         ` Chee, Tien Fong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1506566738.3589.38.camel@intel.com \
    --to=tien.fong.chee@intel.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox