mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Michael Graichen <michael.graichen@hotmail.com>
Cc: "barebox@lists.infradead.org" <barebox@lists.infradead.org>,
	"m.tretter@pengutronix.de" <m.tretter@pengutronix.de>,
	"a.fatoum@pengutronix.de" <a.fatoum@pengutronix.de>,
	"johannes@gnu-linux.rocks" <johannes@gnu-linux.rocks>
Subject: Re: [PATCH v2025] added-zynq-fpga-manager
Date: Thu, 22 May 2025 22:08:00 +0200	[thread overview]
Message-ID: <aC-EIHYin8cjNZG2@pengutronix.de> (raw)
In-Reply-To: <VI1PR02MB4429961876C186741ADDF9B1AB9CA@VI1PR02MB4429.eurprd02.prod.outlook.com>

Hi Michael,

On Mon, May 19, 2025 at 07:03:44AM +0000, Michael Graichen wrote:
> This adds support to programm the PL part of the Zynq-7000 SoC,
> It adds the 'zynq_fpga_manager' so we can use
> 
> firmwareload -l
> firmwareload -t zynq-fpga-manager /mnt/mmc0.0/design_1_wrapper.bit
> 
> to programm the PL.
> 
> +
> +	buf_aligned = dma_alloc_coherent(DMA_DEVICE_BROKEN, body_length, DMA_ADDRESS_BROKEN);
> +	if (!buf_aligned) {
> +		status = -ENOBUFS;
> +		goto err_free;
> +	}
> +
> +#ifdef CONFIG_FIRMWARE_ZYNQMP_FPGA
> +	if (!(mgr->features & ZYNQMP_PM_FEATURE_SIZE_NOT_NEEDED)) {
> +		buf_size = dma_alloc_coherent(sizeof(*buf_size),
> +		DMA_ADDRESS_BROKEN);
> +		if (!buf_size) {
> +			status = -ENOBUFS;
> +			goto err_free;
> +		}
> +		*buf_size = body_length;
> +	}
> +
> +	if (!(mgr->features & ZYNQMP_PM_FEATURE_BYTE_ORDER_IRREL) &&
> +	    byte_order == XILINX_BYTE_ORDER_BIN)
> +		copy_words_swapped((u32 *)buf_aligned, body,
> +				   body_length / sizeof(u32));
> +	else
> +		memcpy((u32 *)buf_aligned, body, body_length);
> +
> +	addr = (u64)buf_aligned;
> +
> +	/* we do not provide a header */
> +	flags |= ZYNQMP_FPGA_BIT_ONLY_BIN;
> +
> +	if (!(mgr->features & ZYNQMP_PM_FEATURE_SIZE_NOT_NEEDED) && buf_size) {
> +		status = mgr->eemi_ops->fpga_load(addr,
> +				(u32)(uintptr_t)buf_size,
> +				flags);
> +		dma_free_coherent(buf_size, 0, sizeof(*buf_size));
> +	} else {
> +		status = mgr->eemi_ops->fpga_load(addr, (u32)(body_length),
> +						  flags);
> +	}
> +#endif
> +#ifdef CONFIG_FIRMWARE_ZYNQ7000_FPGA

The ZYNQ7000 part should ideally be integrated into the existing driver
using runtime decisions instead of compile time decisions.

If that's not feasible please just drop everything inside
CONFIG_FIRMWARE_ZYNQMP_FPGA and drop the #ifdef
CONFIG_FIRMWARE_ZYNQ7000_FPGA.

> +
> +static struct of_device_id zynq_fpga_id_table[] = {
> +	{ .compatible = "xlnx,zynqmp-pcap-fpga" },
> +	{ .compatible = "xlnx,zynq-devcfg-1.0" },
> +	{ /* sentinel */ }
> +};

The compatible should then only match the part the driver actually
supports.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



      reply	other threads:[~2025-05-22 20:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-19  7:03 Michael Graichen
2025-05-22 20:08 ` Sascha Hauer [this message]

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=aC-EIHYin8cjNZG2@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=johannes@gnu-linux.rocks \
    --cc=m.tretter@pengutronix.de \
    --cc=michael.graichen@hotmail.com \
    /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