[PATCH 3/4] mtd/fpga: add fpga directory to mtd (with Cyclone 10)

Marek Vasut marex at denx.de
Sun Feb 12 21:01:41 CET 2023


On 2/12/23 20:52, Ulf Samuelsson wrote:
> 
> 
> Den 2023-02-12 kl. 20:31, skrev Marek Vasut:
>  > On 2/11/23 11:07, u-boot at emagii.com wrote:
>  >
>  > [...]
>  >
>  >> +static int cyc10_write(struct mtd_info *mtd, loff_t to, size_t len,
>  >> +                 size_t *retlen, const u_char *buf)
>  >> +{
>  >> +    struct udevice *dev = mtd->dev;
>  >> +    struct spi_slave *slave = dev_get_parent_priv(dev);
>  >> +    struct cyc10_plat *fpga = dev_get_plat(dev);
>  >> +    int ret;
>  >
>  > Do I read this right, that the 'write' callback is the only one doing
>  > meaningful work, all the other callbacks are just empty stubs ?
>  > Yes, you cannot read back the configuration data.

That makes it look like any framework which supports "write" callback 
would be suitable, not just MTD framework.

>  > Why not update drivers/fpga/cyclon2.c which is Passive Serial
>  > implementation already present in U-Boot for Altera Cyclone II FPGA ,
>  > with Cyclone 10 FPGA support ? I believe the PS protocol changed very
>  > little.
> Since the MTD command set is enough to configure the FPGA, the FPGA 
> commands can be removed from the build. The FPGA command set requires 
> you to supply addresses, but the MTD command set uses devices.
> 
> So:
> * Smaller U-Boot image

The MTD framework is rather large, compared to the trivial FPGA 
framework. Can you back this claim with any numbers ?

> * Simplified user interface.

If I am to select between 'fpga load' and 'mtd write' for FPGA bitstream 
loading , my obvious choice would be 'fpga load' . How is using 'mtd 
write' any better or simpler ?

> * The FPGA is an SPI peripheral, so why not add it to the SPI part of 
> the device tree?

You can add the device into DT and still operate it using the U-Boot 
FPGA framework, just add the DT support. Why not do it that way ?

Let me be blunt about this, I have this feeling that what is happening 
here is just overloading of MTD framework with unrelated functionality 
(FPGA bitstream loading). MTD framework simply is not the right place, 
esp. if there is dedicated FPGA framework, with existing Altera PS 
driver no less.


More information about the U-Boot mailing list