[PATCH v3 2/4] Firmware: provide a handler to program Altera FPGAs
Sascha Hauer
s.hauer at pengutronix.de
Sun Sep 7 23:03:48 PDT 2014
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 at 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 |
More information about the barebox
mailing list