mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Cc: barebox@lists.infradead.org, Juergen Beisert <jbe@pengutronix.de>
Subject: Re: [PATCH v3 2/4] Firmware: provide a handler to program Altera FPGAs
Date: Mon, 8 Sep 2014 08:03:48 +0200	[thread overview]
Message-ID: <20140908060348.GJ5352@pengutronix.de> (raw)
In-Reply-To: <1409838437-3625-3-git-send-email-s.trumtrar@pengutronix.de>

On Thu, Sep 04, 2014 at 03:47:15PM +0200, Steffen Trumtrar wrote:
> +/*
> + * Physical requirements:
> + * - three free GPIOs for the signals nCONFIG, CONFIGURE_DONE, nSTATUS
> + * - 32 bit per word, LSB first capable SPI master (MOSI + clock)
> + *
> + * Example how to configure this driver via device tree
> + *
> + *	fpga@0 {
> + *		compatible = "altr,fpga-passive-serial";
> + *		nstat-gpio = <&gpio4 18 0>;
> + *		confd-gpio = <&gpio4 19 0>;
> + *		nconfig-gpio = <&gpio4 20 0>;
> + *		spi-max-frequency = <10000000>;
> + *		reg = <0>;
> + *	};

We have Documentation/devicetree/bindings/. Please add a document there.

> +
> +	/*
> +	 * after about 2 µs the FPGA must acknowledge with
> +	 * STATUS and CONFIG DONE lines at low level
> +	 */
> +	ret = wait_on_timeout(2 * 1000,
> +				(gpio_get_value(this->nstat_gpio) == 0) &&
> +				(gpio_get_value(this->confd_gpio) == 0));

2 * USECOND please, also for the other calls to wait_on_timeout().

> +static int altera_spi_write(struct firmware_handler *fh, const void *buf, size_t sz)
> +{
> +	struct fpga_spi *this = container_of(fh, struct fpga_spi, fh);
> +	struct device_d *dev = this->dev;
> +	struct spi_transfer t[2];
> +	struct spi_message m;
> +	u32 dummy;
> +	int ret;
> +
> +	printf("%s: %d\n", __func__, sz);

Is this useful output for production?

> +	/*
> +	 * when programming was successfully,

s/successfully/successful/

> +	 * both status lines should be at high level
> +	 */
> +	ret = wait_on_timeout(10 * 1000,
> +				(gpio_get_value(this->nstat_gpio) == 1) &&
> +				(gpio_get_value(this->confd_gpio) == 1));
> +	if (ret == 0) {
> +		dev_dbg(dev, "Programming successfull\n");

s/successfull/successful/

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2014-09-08  6:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-04 13:47 [PATCH v3 0/4] firmware programming interface Steffen Trumtrar
2014-09-04 13:47 ` [PATCH v3 1/4] Add a Firmware programming framework Steffen Trumtrar
2014-09-08  5:53   ` Sascha Hauer
2014-09-04 13:47 ` [PATCH v3 2/4] Firmware: provide a handler to program Altera FPGAs Steffen Trumtrar
2014-09-08  6:03   ` Sascha Hauer [this message]
2014-09-08  6:08     ` Sascha Hauer
2014-09-04 13:47 ` [PATCH v3 3/4] DT: Add binding for Altera FPGAs in passive-serial mode Steffen Trumtrar
2014-09-04 13:47 ` [PATCH v3 4/4] Firmware: socfpga: Add SoCFPGA FPGA program support Steffen Trumtrar
2014-09-08  6:10   ` Sascha Hauer

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=20140908060348.GJ5352@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=jbe@pengutronix.de \
    --cc=s.trumtrar@pengutronix.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